fix: ensure git init runs in current directory
- Remove silent="true" which caused step to be skipped - Make setup step explicit with MANDATORY instruction - Check for both .git directory AND .git file (worktrees/submodules) - Add explicit "You MUST run using Bash tool" instruction Prevents commits going to parent repo when initializing projects in subdirectories. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,22 +24,30 @@ Creates `.planning/` with PROJECT.md and config.json.
|
|||||||
|
|
||||||
<context>
|
<context>
|
||||||
!`[ -d .planning ] && echo "PLANNING_EXISTS" || echo "NO_PLANNING"`
|
!`[ -d .planning ] && echo "PLANNING_EXISTS" || echo "NO_PLANNING"`
|
||||||
!`[ -d .git ] && echo "GIT_EXISTS" || echo "NO_GIT"`
|
|
||||||
</context>
|
</context>
|
||||||
|
|
||||||
<process>
|
<process>
|
||||||
|
|
||||||
<step name="setup" silent="true">
|
<step name="setup">
|
||||||
Silent setup - execute before any user output:
|
**MANDATORY FIRST STEP — Execute these checks before ANY user interaction:**
|
||||||
|
|
||||||
```bash
|
1. **Abort if project exists:**
|
||||||
# Abort if project exists
|
```bash
|
||||||
[ -d .planning ] && echo "Project already initialized. Use /gsd:progress" && exit 1
|
[ -d .planning ] && echo "ERROR: Project already initialized. Use /gsd:progress" && exit 1
|
||||||
|
```
|
||||||
|
|
||||||
# Initialize git
|
2. **Initialize git repo in THIS directory** (required even if inside a parent repo):
|
||||||
[ -d .git ] || git init
|
```bash
|
||||||
```
|
# Check if THIS directory is already a git repo root (handles .git file for worktrees too)
|
||||||
|
if [ -d .git ] || [ -f .git ]; then
|
||||||
|
echo "Git repo exists in current directory"
|
||||||
|
else
|
||||||
|
git init
|
||||||
|
echo "Initialized new git repo"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
**You MUST run both bash commands above using the Bash tool before proceeding.**
|
||||||
</step>
|
</step>
|
||||||
|
|
||||||
<step name="question">
|
<step name="question">
|
||||||
|
|||||||
Reference in New Issue
Block a user