Add opt-in monorepo initializer#165
Merged
Merged
Conversation
nahiyankhan
previously approved these changes
Jun 22, 2026
Merged
nahiyankhan
pushed a commit
that referenced
this pull request
Jun 23, 2026
Add opt-in monorepo initializer
nahiyankhan
pushed a commit
that referenced
this pull request
Jun 24, 2026
Add opt-in monorepo initializer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Category: new-feature
User Impact: Monorepo users can safely bootstrap root and child Ghost packages without manually discovering every workspace path.
Problem: Ghost already supports root-to-child fingerprint stacks, but initialization required users to know each child path and run
ghost init --scope ...by hand.Solution: Add an opt-in
ghost init --monorepomode that creates or preserves the root package, detects workspace child package roots from deterministic metadata, and prints scoped init commands by default. Add--applyfor explicit child package creation, keeping plainghost initunchanged.Validation:
pnpm test: passed, 390 testspnpm check: passedpnpm build: passed in pre-push hookChangeset: added minor changeset for the new public CLI flag/capability.
Ghost Review:
node packages/ghost/dist/bin.js check --base origin/main --format json: passednode packages/ghost/dist/bin.js review --base origin/main --include-memory --format json: ran successfullyFile changes
.changeset/green-monorepos-init.md
Adds the minor release note for the new monorepo initializer.
README.md
Documents the safe
ghost init --monorepoplan mode and explicit--applymode.apps/docs/src/content/docs/cli-reference.mdx
Adds the monorepo initialization commands and behavior to the CLI reference.
apps/docs/src/generated/cli-manifest.json
Regenerates CLI metadata so docs expose
--monorepoand--apply.docs/fingerprint-format.md
Documents the monorepo initializer alongside nested package stack behavior.
docs/superpowers/plans/2026-06-22-monorepo-initializer.md
Captures the implementation plan and execution checklist used for the change.
docs/superpowers/specs/2026-06-22-monorepo-initializer-design.md
Captures the approved design and risk decision for plan-by-default behavior.
packages/ghost/src/fingerprint-commands.ts
Extracts init registration into a focused command module and keeps the broader fingerprint command registry under the file-size guard.
packages/ghost/src/init-command.ts
Registers
ghost init, including existing root/scope behavior plus the new monorepo options and validation.packages/ghost/src/monorepo-init-command.ts
Implements plan/apply output, root creation or preservation, child skip/create handling, and scoped command formatting.
packages/ghost/src/scan/index.ts
Exports the monorepo candidate detector for CLI use.
packages/ghost/src/scan/monorepo-init.ts
Adds deterministic workspace metadata detection for package.json workspaces and pnpm workspaces.
packages/ghost/test/cli.test.ts
Adds coverage for plan mode, apply mode, skipped existing packages, custom
--memory-dir,GHOST_MEMORY_DIR, pnpm workspaces, and invalid option combinations.Screenshots/Demos: N/A