fix: phase directory matching and orphaned references
- Support both zero-padded (05-*) and unpadded (5-*) phase folders - Delete orphaned research-subagent-prompt.md template - Update resume-project.md to use Task tool resume parameter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -444,7 +444,9 @@ Orchestrator provides:
|
||||
**Load phase context (MANDATORY):**
|
||||
|
||||
```bash
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PHASE}-* 2>/dev/null | head -1)
|
||||
# Match both zero-padded (05-*) and unpadded (5-*) folders
|
||||
PADDED_PHASE=$(printf "%02d" ${PHASE} 2>/dev/null || echo "${PHASE}")
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE}-* 2>/dev/null | head -1)
|
||||
|
||||
# Read CONTEXT.md if exists (from /gsd:discuss-phase)
|
||||
cat "${PHASE_DIR}"/*-CONTEXT.md 2>/dev/null
|
||||
@@ -518,14 +520,14 @@ Run through verification protocol checklist:
|
||||
|
||||
Use the output format template. Populate all sections with verified findings.
|
||||
|
||||
Write to: `${PHASE_DIR}/${PHASE}-RESEARCH.md`
|
||||
Write to: `${PHASE_DIR}/${PADDED_PHASE}-RESEARCH.md`
|
||||
|
||||
Where `PHASE_DIR` is the full path (e.g., `.planning/phases/01-foundation`)
|
||||
|
||||
## Step 6: Commit Research
|
||||
|
||||
```bash
|
||||
git add "${PHASE_DIR}/${PHASE}-RESEARCH.md"
|
||||
git add "${PHASE_DIR}/${PADDED_PHASE}-RESEARCH.md"
|
||||
git commit -m "docs(${PHASE}): research phase domain
|
||||
|
||||
Phase ${PHASE}: ${PHASE_NAME}
|
||||
@@ -558,7 +560,7 @@ When research finishes successfully:
|
||||
|
||||
### File Created
|
||||
|
||||
`${PHASE_DIR}/${PHASE}-RESEARCH.md`
|
||||
`${PHASE_DIR}/${PADDED_PHASE}-RESEARCH.md`
|
||||
|
||||
### Confidence Assessment
|
||||
|
||||
|
||||
@@ -808,7 +808,9 @@ Triggered by `--gaps` flag. Creates plans to address verification or UAT failure
|
||||
**1. Find gap sources:**
|
||||
|
||||
```bash
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PHASE_ARG}* 2>/dev/null | head -1)
|
||||
# Match both zero-padded (05-*) and unpadded (5-*) folders
|
||||
PADDED_PHASE=$(printf "%02d" ${PHASE_ARG} 2>/dev/null || echo "${PHASE_ARG}")
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE_ARG}-* 2>/dev/null | head -1)
|
||||
|
||||
# Check for VERIFICATION.md (code verification gaps)
|
||||
ls "$PHASE_DIR"/*-VERIFICATION.md 2>/dev/null
|
||||
@@ -1076,7 +1078,9 @@ Understand:
|
||||
**Load phase-specific context files (MANDATORY):**
|
||||
|
||||
```bash
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PHASE}-* 2>/dev/null | head -1)
|
||||
# Match both zero-padded (05-*) and unpadded (5-*) folders
|
||||
PADDED_PHASE=$(printf "%02d" ${PHASE} 2>/dev/null || echo "${PHASE}")
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE}-* 2>/dev/null | head -1)
|
||||
|
||||
# Read CONTEXT.md if exists (from /gsd:discuss-phase)
|
||||
cat "${PHASE_DIR}"/*-CONTEXT.md 2>/dev/null
|
||||
|
||||
@@ -79,11 +79,12 @@ grep -A5 "Phase ${PHASE}:" .planning/ROADMAP.md 2>/dev/null
|
||||
## 4. Ensure Phase Directory Exists
|
||||
|
||||
```bash
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PHASE}-* 2>/dev/null | head -1)
|
||||
# Match both zero-padded (05-*) and unpadded (5-*) folders
|
||||
PADDED_PHASE=$(printf "%02d" ${PHASE})
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE}-* 2>/dev/null | head -1)
|
||||
if [ -z "$PHASE_DIR" ]; then
|
||||
# Create phase directory from roadmap name with zero-padded phase number
|
||||
PHASE_NAME=$(grep "Phase ${PHASE}:" .planning/ROADMAP.md | sed 's/.*Phase [0-9]*: //' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
|
||||
PADDED_PHASE=$(printf "%02d" ${PHASE})
|
||||
mkdir -p ".planning/phases/${PADDED_PHASE}-${PHASE_NAME}"
|
||||
PHASE_DIR=".planning/phases/${PADDED_PHASE}-${PHASE_NAME}"
|
||||
fi
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
# Research Subagent Prompt Template
|
||||
|
||||
Template for spawning gsd-researcher agent. The agent contains all research expertise - this template provides research context only.
|
||||
|
||||
---
|
||||
|
||||
## Template
|
||||
|
||||
```markdown
|
||||
<objective>
|
||||
Research: {research_question}
|
||||
|
||||
Mode: {research_mode}
|
||||
</objective>
|
||||
|
||||
<context>
|
||||
**Phase:** {phase_number} - {phase_name}
|
||||
**Description:** {phase_description}
|
||||
|
||||
**Requirements:**
|
||||
{phase_requirements}
|
||||
|
||||
**Constraints:**
|
||||
{constraints_from_state}
|
||||
|
||||
**Phase context (if available):**
|
||||
{context_md_content}
|
||||
</context>
|
||||
|
||||
<output>
|
||||
Write research findings to: {output_path}
|
||||
Use RESEARCH.md template structure for phase research.
|
||||
</output>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Placeholders
|
||||
|
||||
| Placeholder | Source | Example |
|
||||
|-------------|--------|---------|
|
||||
| `{research_question}` | Phase description | `How to implement 3D visualization` |
|
||||
| `{research_mode}` | Orchestrator sets | `ecosystem` |
|
||||
| `{phase_number}` | From roadmap | `5` |
|
||||
| `{phase_name}` | From roadmap | `3d-visualization` |
|
||||
| `{phase_description}` | From roadmap | `Add interactive 3D model viewer` |
|
||||
| `{phase_requirements}` | From REQUIREMENTS.md | `VIZ-01: Support GLB format` |
|
||||
| `{constraints_from_state}` | From STATE.md decisions | `Using React, not Vue` |
|
||||
| `{context_md_content}` | From CONTEXT.md | User's vision notes |
|
||||
| `{output_path}` | Generated | `.planning/phases/5-viz/5-RESEARCH.md` |
|
||||
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
**From /gsd:research-phase:**
|
||||
```python
|
||||
Task(
|
||||
prompt=filled_template,
|
||||
subagent_type="gsd-researcher",
|
||||
description="Research Phase {phase}"
|
||||
)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Continuation
|
||||
|
||||
For checkpoints, spawn fresh agent with:
|
||||
|
||||
```markdown
|
||||
<objective>
|
||||
Continue research for Phase {phase_number}: {phase_name}
|
||||
</objective>
|
||||
|
||||
<prior_state>
|
||||
Research file: @{output_path}
|
||||
</prior_state>
|
||||
|
||||
<checkpoint_response>
|
||||
**Type:** {checkpoint_type}
|
||||
**Response:** {user_response}
|
||||
</checkpoint_response>
|
||||
|
||||
<mode>
|
||||
Continue: {research_mode}
|
||||
</mode>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Note:** Research methodology, tool strategy (Context7 > Official > WebSearch), and verification protocols are baked into the gsd-researcher agent. This template only passes context.
|
||||
@@ -109,8 +109,9 @@ Exit workflow.
|
||||
Check if CONTEXT.md already exists:
|
||||
|
||||
```bash
|
||||
ls .planning/phases/${PHASE}-*/CONTEXT.md 2>/dev/null
|
||||
ls .planning/phases/${PHASE}-*/${PHASE}-CONTEXT.md 2>/dev/null
|
||||
# Match both zero-padded (05-*) and unpadded (5-*) folders
|
||||
PADDED_PHASE=$(printf "%02d" ${PHASE})
|
||||
ls .planning/phases/${PADDED_PHASE}-*/CONTEXT.md .planning/phases/${PADDED_PHASE}-*/${PADDED_PHASE}-CONTEXT.md .planning/phases/${PHASE}-*/CONTEXT.md .planning/phases/${PHASE}-*/${PHASE}-CONTEXT.md 2>/dev/null
|
||||
```
|
||||
|
||||
**If exists:**
|
||||
@@ -229,11 +230,21 @@ Track deferred ideas internally.
|
||||
<step name="write_context">
|
||||
Create CONTEXT.md capturing decisions made.
|
||||
|
||||
**File location:** `.planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md`
|
||||
**Find or create phase directory:**
|
||||
|
||||
Zero-pad the phase number: `PADDED_PHASE=$(printf "%02d" ${PHASE})`
|
||||
```bash
|
||||
# Match existing directory (padded or unpadded)
|
||||
PADDED_PHASE=$(printf "%02d" ${PHASE})
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE}-* 2>/dev/null | head -1)
|
||||
if [ -z "$PHASE_DIR" ]; then
|
||||
# Create from roadmap name (lowercase, hyphens)
|
||||
PHASE_NAME=$(grep "Phase ${PHASE}:" .planning/ROADMAP.md | sed 's/.*Phase [0-9]*: //' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
|
||||
mkdir -p ".planning/phases/${PADDED_PHASE}-${PHASE_NAME}"
|
||||
PHASE_DIR=".planning/phases/${PADDED_PHASE}-${PHASE_NAME}"
|
||||
fi
|
||||
```
|
||||
|
||||
Create phase directory if it doesn't exist. Use roadmap phase name for slug (lowercase, hyphens).
|
||||
**File location:** `${PHASE_DIR}/${PADDED_PHASE}-CONTEXT.md`
|
||||
|
||||
**Structure the content by what was discussed:**
|
||||
|
||||
@@ -334,18 +345,18 @@ Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
|
||||
Commit phase context:
|
||||
|
||||
```bash
|
||||
git add .planning/phases/${PHASE}-${SLUG}/${PHASE}-CONTEXT.md
|
||||
git add "${PHASE_DIR}/${PADDED_PHASE}-CONTEXT.md"
|
||||
git commit -m "$(cat <<'EOF'
|
||||
docs(${PHASE}): capture phase context
|
||||
docs(${PADDED_PHASE}): capture phase context
|
||||
|
||||
Phase ${PHASE}: ${PHASE_NAME}
|
||||
Phase ${PADDED_PHASE}: ${PHASE_NAME}
|
||||
- Implementation decisions documented
|
||||
- Phase boundary established
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
|
||||
Confirm: "Committed: docs(${PHASE}): capture phase context"
|
||||
Confirm: "Committed: docs(${PADDED_PHASE}): capture phase context"
|
||||
</step>
|
||||
|
||||
</process>
|
||||
|
||||
@@ -39,7 +39,9 @@ Options:
|
||||
Confirm phase exists and has plans:
|
||||
|
||||
```bash
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PHASE_ARG}* 2>/dev/null | head -1)
|
||||
# Match both zero-padded (05-*) and unpadded (5-*) folders
|
||||
PADDED_PHASE=$(printf "%02d" ${PHASE_ARG} 2>/dev/null || echo "${PHASE_ARG}")
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE_ARG}-* 2>/dev/null | head -1)
|
||||
if [ -z "$PHASE_DIR" ]; then
|
||||
echo "ERROR: No phase directory matching '${PHASE_ARG}'"
|
||||
exit 1
|
||||
|
||||
@@ -121,7 +121,7 @@ Present complete project status to user:
|
||||
Task: [task description from agent-history.json]
|
||||
Interrupted: [timestamp]
|
||||
|
||||
Resume with: /gsd:resume-task
|
||||
Resume with: Task tool (resume parameter with agent ID)
|
||||
|
||||
[If pending todos exist:]
|
||||
📋 [N] pending todos — /gsd:check-todos to review
|
||||
@@ -141,7 +141,7 @@ Present complete project status to user:
|
||||
Based on project state, determine the most logical next action:
|
||||
|
||||
**If interrupted agent exists:**
|
||||
→ Primary: Resume interrupted agent (/gsd:resume-task)
|
||||
→ Primary: Resume interrupted agent (Task tool with resume parameter)
|
||||
→ Option: Start fresh (abandon agent work)
|
||||
|
||||
**If .continue-here file exists:**
|
||||
@@ -178,7 +178,7 @@ Present contextual options based on project state:
|
||||
What would you like to do?
|
||||
|
||||
[Primary action based on state - e.g.:]
|
||||
1. Resume interrupted agent (/gsd:resume-task) [if interrupted agent found]
|
||||
1. Resume interrupted agent [if interrupted agent found]
|
||||
OR
|
||||
1. Execute phase (/gsd:execute-phase {phase})
|
||||
OR
|
||||
|
||||
@@ -29,8 +29,9 @@ Then verify each level against the actual codebase.
|
||||
**Gather all verification context:**
|
||||
|
||||
```bash
|
||||
# Phase directory
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PHASE_ARG}* 2>/dev/null | head -1)
|
||||
# Phase directory (match both zero-padded and unpadded)
|
||||
PADDED_PHASE=$(printf "%02d" ${PHASE_ARG} 2>/dev/null || echo "${PHASE_ARG}")
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE_ARG}-* 2>/dev/null | head -1)
|
||||
|
||||
# Phase goal from ROADMAP
|
||||
grep -A 5 "Phase ${PHASE_NUM}" .planning/ROADMAP.md
|
||||
|
||||
@@ -73,8 +73,9 @@ Continue to `create_uat_file`.
|
||||
Parse $ARGUMENTS as phase number (e.g., "4") or plan number (e.g., "04-02").
|
||||
|
||||
```bash
|
||||
# Find phase directory
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PHASE_ARG}* 2>/dev/null | head -1)
|
||||
# Find phase directory (match both zero-padded and unpadded)
|
||||
PADDED_PHASE=$(printf "%02d" ${PHASE_ARG} 2>/dev/null || echo "${PHASE_ARG}")
|
||||
PHASE_DIR=$(ls -d .planning/phases/${PADDED_PHASE}-* .planning/phases/${PHASE_ARG}-* 2>/dev/null | head -1)
|
||||
|
||||
# Find SUMMARY files
|
||||
ls "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null
|
||||
|
||||
Reference in New Issue
Block a user