fix(workflow): detect nested git worktree in new-project bootstrap (#3491)
The `has_git` boolean returned by `init new-project` and `init ingest-docs` was derived from a shallow `pathExists(cwd, '.git')` check, so a subdirectory of an existing repo reported `has_git: false`. The workflow then ran `git init`, creating a nested `.git` inside the outer worktree and silently diverting subsequent `gsd-sdk commit` calls into the nested repo. Replace the shallow check with `git rev-parse --is-inside-work-tree` semantics in both CJS (`get-shit-done/bin/lib/init.cjs`) and TS (`sdk/src/query/init.ts`, `sdk/src/query/init-complex.ts`) handlers via a new shared `gitWorktreeInfoInternal` helper, and expose `git_worktree_root` + `in_nested_subdir` so the workflows can refuse `git init` inside an existing worktree and warn that planning files will track to the outer repo. Regression test: `tests/bug-3491-nested-git-worktree.test.cjs`. Fixes #3491 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,7 @@ const SCAN_EXTS = new Set(['.md', '.cjs', '.js', '.json']);
|
||||
const ALLOWLIST = new Set([
|
||||
'get-shit-done/bin/lib/security.cjs', // The security module itself
|
||||
'get-shit-done/workflows/discuss-phase.md', // Large workflow (~50K) with power mode + i18n
|
||||
'get-shit-done/workflows/new-project.md', // Large workflow (~50K) — agent install, runtime detect, brownfield map, #3491 worktree gating
|
||||
'get-shit-done/workflows/execute-phase.md', // Large orchestration workflow (~51K) with wave execution + code-review gate
|
||||
'get-shit-done/workflows/plan-phase.md', // Large orchestration workflow (~51K) with TDD mode integration
|
||||
'hooks/gsd-prompt-guard.js', // The prompt guard hook
|
||||
|
||||
Reference in New Issue
Block a user