Skip to content

feat(cli): add 'stackbase add' and 'stackbase list' commands - #7

Merged
vijaysingh2219 merged 3 commits into
mainfrom
feat/cli-add-and-list
Nov 22, 2026
Merged

vijaysingh2219 merged 3 commits into
mainfrom
feat/cli-add-and-list

Conversation

@vijaysingh2219

Copy link
Copy Markdown
Member

Problem

When evolving an existing Stackbase Turborepo workspace, adding infrastructure modules (such as queue, storage, email, or rate-limiting) requires tedious, error-prone manual configuration: copying package directories, adapting workspace scope names, rewriting catalog dependencies, merging docker-compose services, and synchronizing .env.example templates. Additionally, developers lack an in-CLI mechanism to discover which official modules are currently installed versus available for installation.

Change

This PR introduces modular package injection and workspace discovery via two new CLI commands, supported by dedicated AST and file transformers:

  1. stackbase list:

    • Inspects workspace packages to determine installed versus available official modules (queue, storage, rate-limit, email, auth).
    • Renders a clean terminal status table with module names, installation states (✔ installed vs ○ available), and descriptions.
  2. stackbase add [module]:

    • Injects official standalone packages incrementally into an existing workspace.
    • Scope Adaptation: Dynamically rewrites package naming and internal imports to match the target workspace scope (e.g., @workspace/* or custom scopes).
    • Catalog Dependency Resolution: Rewrites package dependencies to use pnpm-workspace.yaml catalog versions where available, preventing version fragmentation.
    • Docker Compose Merging: Non-destructively injects required service definitions (e.g., Redis for queue, MinIO for storage) into docker-compose.yml.
    • Environment Variable Merging: Appends required environment configuration blocks into .env.example without overwriting existing entries.
    • Application Dependency Linking: Automatically registers the injected package in the target app (apps/api by default, or specified via --app).
    • Git Working Tree Protection: Detects uncommitted git modifications and warns the user before mutating files (can be bypassed with --allow-dirty or -y).
    • Options & Modes: Supports interactive select menu, --dry-run preview mode, --skip-install, --allow-dirty, and --list alias.
  3. Documentation & Changelog:

    • Added command documentation, flag tables, and usage examples to apps/docs/content/docs/cli.mdx and packages/stackbase/README.md.
    • Recorded release notes under [Unreleased] in CHANGELOG.md.

Scope

Verification

Ran focused unit test suites and workspace type checking locally:

  1. pnpm check-types:

    • Passed with 0 errors across all workspace packages (turbo check-types, 2/2 tasks successful).
  2. pnpm test (packages/stackbase):

    • All 43 tests passed across 3 test suites:
      • src/__tests__/cli.test.ts (23 tests)
      • src/__tests__/migrate.test.ts (6 tests)
      • src/__tests__/add.test.ts (14 tests)
    • Specifically verified:
      • Interactive and argument-based package injection into packages/<module>
      • Workspace scope adaptation (@workspace/* and custom scopes)
      • Dependency resolution against workspace catalogs (catalog:)
      • Docker Compose service merging (Redis, MinIO)
      • Non-destructive .env.example template appending
      • Application dependency linking in apps/api/package.json
      • Git working tree cleanliness check and --allow-dirty bypass
      • stackbase list installation status detection (installed vs available)

- Support incremental package injection into existing workspaces
- Add module registry for queue, storage, rate-limit, email, and auth
- Implement transformers for scope, catalog, docker-compose, and env
- Link injected packages directly to target apps
- Add comprehensive unit test suite
- Display formatted workspace status of installed and available modules
- Add git working tree protection with uncommitted change warnings
- Add --list and --allow-dirty flags to 'stackbase add'
- Integrate module status detection with interactive add prompt
- Add tests for module status detection and git dirty checks
- Add 'add' and 'list' command usage, flags, and options to docs app
- Update packages/stackbase README with examples
- Add release notes to CHANGELOG.md
@vercel

vercel Bot commented Nov 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
stackbase-docs Ready Ready Preview Nov 22, 2026 6:03pm UTC

@vijaysingh2219 vijaysingh2219 added enhancement New feature or request area:cli Stackbase CLI commands (stackbase add, init, list, upgrade) area:docs Documentation site (apps/docs), guides, or API reference labels Nov 22, 2026
@vijaysingh2219 vijaysingh2219 self-assigned this Nov 22, 2026
@vijaysingh2219
vijaysingh2219 merged commit 6cb3529 into main Nov 22, 2026
9 of 10 checks passed
@vijaysingh2219
vijaysingh2219 deleted the feat/cli-add-and-list branch November 22, 2026 18:29

This branch was successfully deployed

1 active deployment
Preview — 07dd94d3 Deployed Nov 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli Stackbase CLI commands (stackbase add, init, list, upgrade) area:docs Documentation site (apps/docs), guides, or API reference enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): add 'stackbase add' and 'stackbase list' commands

1 participant