@leeovery/claude-technical-workflows 2.1.30 → 2.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +36 -5
  2. package/hooks/workflows/compact-recovery.sh +81 -0
  3. package/hooks/workflows/session-cleanup.sh +26 -0
  4. package/hooks/workflows/session-env.sh +17 -0
  5. package/hooks/workflows/system-check.sh +100 -0
  6. package/hooks/workflows/write-session-state.sh +66 -0
  7. package/package.json +1 -1
  8. package/skills/begin-implementation/SKILL.md +158 -0
  9. package/skills/begin-planning/SKILL.md +87 -0
  10. package/skills/continue-feature/SKILL.md +177 -0
  11. package/skills/continue-feature/references/detect-phase.md +92 -0
  12. package/skills/continue-feature/references/invoke-implementation.md +43 -0
  13. package/skills/continue-feature/references/invoke-planning.md +43 -0
  14. package/skills/continue-feature/references/invoke-specification.md +55 -0
  15. package/skills/continue-feature/references/phase-bridge.md +58 -0
  16. package/skills/continue-feature/scripts/discovery.sh +216 -0
  17. package/skills/link-dependencies/SKILL.md +6 -0
  18. package/skills/start-discussion/SKILL.md +22 -1
  19. package/skills/start-feature/SKILL.md +100 -38
  20. package/skills/start-feature/references/gather-feature-context.md +60 -0
  21. package/skills/start-feature/references/invoke-discussion.md +24 -0
  22. package/skills/start-feature/references/phase-bridge.md +37 -0
  23. package/skills/start-implementation/SKILL.md +22 -1
  24. package/skills/start-planning/SKILL.md +22 -1
  25. package/skills/start-research/SKILL.md +23 -1
  26. package/skills/start-review/SKILL.md +22 -1
  27. package/skills/start-specification/SKILL.md +8 -2
  28. package/skills/start-specification/references/handoffs/continue-concluded.md +15 -0
  29. package/skills/start-specification/references/handoffs/continue.md +15 -0
  30. package/skills/start-specification/references/handoffs/create-with-incorporation.md +15 -0
  31. package/skills/start-specification/references/handoffs/create.md +15 -0
  32. package/skills/start-specification/references/handoffs/unify-with-incorporation.md +15 -0
  33. package/skills/start-specification/references/handoffs/unify.md +15 -0
  34. package/skills/status/SKILL.md +7 -1
  35. package/skills/technical-planning/SKILL.md +2 -2
  36. package/skills/technical-planning/references/author-tasks.md +3 -1
  37. package/skills/technical-planning/references/define-tasks.md +35 -3
  38. package/skills/technical-planning/references/output-formats/tick/about.md +5 -0
  39. package/skills/technical-planning/references/output-formats/tick/authoring.md +11 -0
  40. package/skills/technical-planning/references/output-formats/tick/updating.md +2 -0
  41. package/skills/technical-planning/references/plan-construction.md +17 -8
  42. package/skills/technical-planning/references/plan-index-schema.md +6 -3
  43. package/skills/view-plan/SKILL.md +6 -0
@@ -0,0 +1,177 @@
1
+ ---
2
+ name: continue-feature
3
+ description: "Continue a feature through the pipeline. Routes to the next phase (specification, planning, or implementation) based on artifact state. Can be invoked manually or from plan mode bridges."
4
+ allowed-tools: Bash(.claude/skills/continue-feature/scripts/discovery.sh), Bash(.claude/hooks/workflows/write-session-state.sh)
5
+ hooks:
6
+ PreToolUse:
7
+ - hooks:
8
+ - type: command
9
+ command: "$CLAUDE_PROJECT_DIR/.claude/hooks/workflows/system-check.sh"
10
+ once: true
11
+ ---
12
+
13
+ Route a feature to its next pipeline phase.
14
+
15
+ > **⚠️ ZERO OUTPUT RULE**: Do not narrate your processing. Produce no output until a step or reference file explicitly specifies display content. No "proceeding with...", no discovery summaries, no routing decisions, no transition text. Your first output must be content explicitly called for by the instructions.
16
+
17
+ ## Instructions
18
+
19
+ Follow these steps EXACTLY as written. Do not skip steps or combine them.
20
+
21
+ **CRITICAL**: This guidance is mandatory.
22
+
23
+ - After each user interaction, STOP and wait for their response before proceeding
24
+ - Never assume or anticipate user choices
25
+ - Complete each step fully before moving to the next
26
+
27
+ ---
28
+
29
+ ## Resuming After Context Refresh
30
+
31
+ Context refresh (compaction) summarizes the conversation, losing procedural detail. When you detect a context refresh has occurred — the conversation feels abruptly shorter, you lack memory of recent steps, or a summary precedes this message — follow this recovery protocol:
32
+
33
+ 1. **Re-read this skill file completely.** Do not rely on your summary of it. The full process, steps, and rules must be reloaded.
34
+ 2. **Identify the topic.** Check conversation history for the topic name. If unknown, ask the user.
35
+ 3. **Determine current step from artifacts** (check top-down, first match wins):
36
+ - Implementation tracking exists with `status: completed` → resume at **Step 6** (phase bridge — feature is done)
37
+ - Implementation tracking exists with `status: in-progress` → resume at **Step 5** (re-invoke begin-implementation)
38
+ - Plan exists with `status: concluded` → resume at **Step 5** (invoke begin-implementation)
39
+ - Plan exists with other status → resume at **Step 4** (re-invoke begin-planning)
40
+ - Specification exists with `status: concluded` → resume at **Step 4** (invoke begin-planning)
41
+ - Specification exists with other status → resume at **Step 3** (re-invoke technical-specification)
42
+ - Discussion exists with `status: concluded` → resume at **Step 3** (invoke technical-specification)
43
+ - Discussion exists with other status → terminal — suggest `/start-discussion`
44
+ 4. **Announce your position** to the user before continuing: what step you believe you're at, what's been completed, and what comes next. Wait for confirmation.
45
+
46
+ Do not guess at progress or continue from memory. The files on disk and git history are authoritative — your recollection is not.
47
+
48
+ ---
49
+
50
+ ## Step 0: Run Migrations
51
+
52
+ **This step is mandatory. You must complete it before proceeding.**
53
+
54
+ Invoke the `/migrate` skill and assess its output.
55
+
56
+ **If files were updated**: STOP and wait for the user to review the changes (e.g., via `git diff`) and confirm before proceeding to Step 1. Do not continue automatically.
57
+
58
+ **If no updates needed**: Proceed to Step 1.
59
+
60
+ ---
61
+
62
+ ## Step 1: Determine Topic
63
+
64
+ Check whether a topic was provided by the caller (e.g., from a plan mode bridge: "invoke continue-feature for {topic}").
65
+
66
+ #### If topic was provided
67
+
68
+ Use the provided topic directly.
69
+
70
+ → Proceed to **Step 2**.
71
+
72
+ #### If no topic provided (bare invocation)
73
+
74
+ Run the discovery script to gather current state:
75
+
76
+ ```bash
77
+ .claude/skills/continue-feature/scripts/discovery.sh
78
+ ```
79
+
80
+ Parse the output to understand:
81
+
82
+ **From `topics` array:** Each topic's name, discussion/specification/plan/implementation state, next_phase, and actionable flag.
83
+
84
+ **From `state` section:** topic_count, actionable_count, scenario.
85
+
86
+ **IMPORTANT**: Use ONLY this script for discovery. Do NOT run additional bash commands (ls, head, cat, etc.) to gather state.
87
+
88
+ #### If scenario is "no_topics"
89
+
90
+ > *Output the next fenced block as a code block:*
91
+
92
+ ```
93
+ Continue Feature
94
+
95
+ No workflow topics found.
96
+
97
+ Start a new feature with /start-feature.
98
+ ```
99
+
100
+ **STOP.** Do not proceed — terminal condition.
101
+
102
+ #### If topics exist
103
+
104
+ Present the discovered state as context, then ask the user to select:
105
+
106
+ > *Output the next fenced block as a code block:*
107
+
108
+ ```
109
+ Continue Feature
110
+
111
+ This skill continues a feature through the pipeline phases:
112
+ Discussion → Specification → Planning → Implementation
113
+
114
+ It's designed for features started with /start-feature, but works
115
+ with any topic that has workflow artifacts.
116
+
117
+ Topics found:
118
+
119
+ 1. {topic:(titlecase)}
120
+ └─ Next: {next_phase}
121
+
122
+ 2. ...
123
+ ```
124
+
125
+ > *Output the next fenced block as markdown (not a code block):*
126
+
127
+ ```
128
+ · · · · · · · · · · · ·
129
+ Which topic would you like to continue?
130
+
131
+ Select by number, or enter a topic name directly:
132
+ · · · · · · · · · · · ·
133
+ ```
134
+
135
+ **STOP.** Wait for user response.
136
+
137
+ → Proceed to **Step 2**.
138
+
139
+ ---
140
+
141
+ ## Step 2: Detect Phase and Route
142
+
143
+ Load **[detect-phase.md](references/detect-phase.md)** and follow its instructions.
144
+
145
+ → The reference file will route you to **Step 3**, **Step 4**, **Step 5**, or a terminal condition. Follow its routing.
146
+
147
+ ---
148
+
149
+ ## Step 3: Specification Phase
150
+
151
+ Load **[invoke-specification.md](references/invoke-specification.md)** and follow its instructions.
152
+
153
+ **CRITICAL**: When the specification concludes (status becomes "concluded"), you MUST proceed to **Step 6** below. Do not end the session — the feature pipeline continues to the phase bridge.
154
+
155
+ ---
156
+
157
+ ## Step 4: Planning Phase
158
+
159
+ Load **[invoke-planning.md](references/invoke-planning.md)** and follow its instructions.
160
+
161
+ **CRITICAL**: When the plan concludes (status becomes "concluded"), you MUST proceed to **Step 6** below. Do not end the session — the feature pipeline continues to the phase bridge.
162
+
163
+ ---
164
+
165
+ ## Step 5: Implementation Phase
166
+
167
+ Load **[invoke-implementation.md](references/invoke-implementation.md)** and follow its instructions.
168
+
169
+ **CRITICAL**: When implementation completes (tracking status becomes "completed"), you MUST proceed to **Step 6** below. Do not end the session — the feature pipeline continues to the phase bridge.
170
+
171
+ ---
172
+
173
+ ## Step 6: Phase Bridge
174
+
175
+ Load **[phase-bridge.md](references/phase-bridge.md)** and follow its instructions.
176
+
177
+ The bridge will enter plan mode with instructions to invoke continue-feature for the topic in the next session.
@@ -0,0 +1,92 @@
1
+ # Detect Phase
2
+
3
+ *Reference for **[continue-feature](../SKILL.md)***
4
+
5
+ ---
6
+
7
+ Determine the next phase for the selected topic using its artifact state.
8
+
9
+ ## Phase Detection
10
+
11
+ Either use the `next_phase` from discovery output (if discovery was run), or compute it by checking artifacts directly:
12
+
13
+ ### If discovery was not run (topic provided by caller)
14
+
15
+ Check artifacts in this order (first match wins):
16
+
17
+ 1. Read `docs/workflow/implementation/{topic}/tracking.md`
18
+ - If exists with `status: completed` → next_phase is **"done"**
19
+ - If exists with `status: in-progress` → next_phase is **"implementation"**
20
+
21
+ 2. Read `docs/workflow/planning/{topic}/plan.md`
22
+ - If exists with `status: concluded` → next_phase is **"implementation"**
23
+ - If exists with other status → next_phase is **"planning"**
24
+
25
+ 3. Read `docs/workflow/specification/{topic}/specification.md`
26
+ - If exists with `status: concluded` → next_phase is **"planning"**
27
+ - If exists with other status → next_phase is **"specification"**
28
+
29
+ 4. Check `docs/workflow/discussion/{topic}.md`
30
+ - If exists with `status: concluded` → next_phase is **"specification"**
31
+ - If exists with other status → next_phase is **"discussion"**
32
+
33
+ 5. If none found → next_phase is **"unknown"**
34
+
35
+ ## Routing
36
+
37
+ #### If next_phase is "specification"
38
+
39
+ → Proceed to **Step 3**.
40
+
41
+ #### If next_phase is "planning"
42
+
43
+ → Proceed to **Step 4**.
44
+
45
+ #### If next_phase is "implementation"
46
+
47
+ → Proceed to **Step 5**.
48
+
49
+ #### If next_phase is "done"
50
+
51
+ > *Output the next fenced block as a code block:*
52
+
53
+ ```
54
+ Feature Complete
55
+
56
+ "{topic:(titlecase)}" has completed implementation.
57
+
58
+ Run /start-review to validate the implementation against the
59
+ specification and plan.
60
+ ```
61
+
62
+ **STOP.** Do not proceed — terminal condition.
63
+
64
+ #### If next_phase is "discussion"
65
+
66
+ > *Output the next fenced block as a code block:*
67
+
68
+ ```
69
+ Discussion In Progress
70
+
71
+ "{topic:(titlecase)}" has a discussion that is not yet concluded.
72
+
73
+ Resume the discussion with /start-discussion, or use /start-feature
74
+ to start a new feature from scratch.
75
+ ```
76
+
77
+ **STOP.** Do not proceed — terminal condition.
78
+
79
+ #### If next_phase is "unknown"
80
+
81
+ > *Output the next fenced block as a code block:*
82
+
83
+ ```
84
+ No Artifacts Found
85
+
86
+ No workflow artifacts found for "{topic}".
87
+
88
+ Start a new feature with /start-feature or begin a discussion
89
+ with /start-discussion.
90
+ ```
91
+
92
+ **STOP.** Do not proceed — terminal condition.
@@ -0,0 +1,43 @@
1
+ # Invoke Implementation
2
+
3
+ *Reference for **[continue-feature](../SKILL.md)***
4
+
5
+ ---
6
+
7
+ Invoke the begin-implementation bridge skill for this topic.
8
+
9
+ ## Save Session State
10
+
11
+ Before invoking the processing skill, save a session bookmark.
12
+
13
+ > *Output the next fenced block as a code block:*
14
+
15
+ ```
16
+ Saving session state so Claude can pick up where it left off and continue the feature pipeline if the conversation is compacted.
17
+ ```
18
+
19
+ ```bash
20
+ .claude/hooks/workflows/write-session-state.sh \
21
+ "{topic}" \
22
+ "skills/technical-implementation/SKILL.md" \
23
+ "docs/workflow/implementation/{topic}/tracking.md" \
24
+ --pipeline "This session is part of the feature pipeline. After implementation completes, return to the continue-feature skill and execute Step 6 (Phase Bridge). Load: skills/continue-feature/references/phase-bridge.md"
25
+ ```
26
+
27
+ ## Handoff
28
+
29
+ Invoke the [begin-implementation](../../begin-implementation/SKILL.md) skill:
30
+
31
+ ```
32
+ Implementation pre-flight for: {topic}
33
+ Plan: docs/workflow/planning/{topic}/plan.md
34
+
35
+ PIPELINE CONTINUATION — When implementation completes (tracking status: completed),
36
+ you MUST return to the continue-feature skill and execute Step 6 (Phase Bridge).
37
+ Load: skills/continue-feature/references/phase-bridge.md
38
+ Do not end the session after implementation — the feature pipeline continues.
39
+
40
+ Invoke the begin-implementation skill.
41
+ ```
42
+
43
+ The bridge skill handles dependency checking, environment setup, and the handoff to technical-implementation.
@@ -0,0 +1,43 @@
1
+ # Invoke Planning
2
+
3
+ *Reference for **[continue-feature](../SKILL.md)***
4
+
5
+ ---
6
+
7
+ Invoke the begin-planning bridge skill for this topic.
8
+
9
+ ## Save Session State
10
+
11
+ Before invoking the processing skill, save a session bookmark.
12
+
13
+ > *Output the next fenced block as a code block:*
14
+
15
+ ```
16
+ Saving session state so Claude can pick up where it left off and continue the feature pipeline if the conversation is compacted.
17
+ ```
18
+
19
+ ```bash
20
+ .claude/hooks/workflows/write-session-state.sh \
21
+ "{topic}" \
22
+ "skills/technical-planning/SKILL.md" \
23
+ "docs/workflow/planning/{topic}/plan.md" \
24
+ --pipeline "This session is part of the feature pipeline. After the plan concludes, return to the continue-feature skill and execute Step 6 (Phase Bridge). Load: skills/continue-feature/references/phase-bridge.md"
25
+ ```
26
+
27
+ ## Handoff
28
+
29
+ Invoke the [begin-planning](../../begin-planning/SKILL.md) skill:
30
+
31
+ ```
32
+ Planning pre-flight for: {topic}
33
+ Specification: docs/workflow/specification/{topic}/specification.md
34
+
35
+ PIPELINE CONTINUATION — When planning concludes (plan status: concluded),
36
+ you MUST return to the continue-feature skill and execute Step 6 (Phase Bridge).
37
+ Load: skills/continue-feature/references/phase-bridge.md
38
+ Do not end the session after planning — the feature pipeline continues.
39
+
40
+ Invoke the begin-planning skill.
41
+ ```
42
+
43
+ The bridge skill handles cross-cutting context, additional context gathering, and the handoff to technical-planning.
@@ -0,0 +1,55 @@
1
+ # Invoke Specification
2
+
3
+ *Reference for **[continue-feature](../SKILL.md)***
4
+
5
+ ---
6
+
7
+ Invoke the specification skill for this topic.
8
+
9
+ ## Check Source Material
10
+
11
+ The specification needs source material. Check what's available:
12
+
13
+ 1. **Discussion document**: `docs/workflow/discussion/{topic}.md`
14
+ - If exists and concluded → use as primary source
15
+ - If exists and in-progress → this shouldn't happen (detect-phase would have routed to discussion)
16
+
17
+ 2. If no discussion exists, this is an error — the pipeline expects a concluded discussion before specification. Report it and stop.
18
+
19
+ ## Save Session State
20
+
21
+ Before invoking the processing skill, save a session bookmark.
22
+
23
+ > *Output the next fenced block as a code block:*
24
+
25
+ ```
26
+ Saving session state so Claude can pick up where it left off and continue the feature pipeline if the conversation is compacted.
27
+ ```
28
+
29
+ ```bash
30
+ .claude/hooks/workflows/write-session-state.sh \
31
+ "{topic}" \
32
+ "skills/technical-specification/SKILL.md" \
33
+ "docs/workflow/specification/{topic}/specification.md" \
34
+ --pipeline "This session is part of the feature pipeline. After the specification concludes, return to the continue-feature skill and execute Step 6 (Phase Bridge). Load: skills/continue-feature/references/phase-bridge.md"
35
+ ```
36
+
37
+ ## Handoff
38
+
39
+ Invoke the [technical-specification](../../technical-specification/SKILL.md) skill:
40
+
41
+ ```
42
+ Specification session for: {topic}
43
+
44
+ Source material:
45
+ - Discussion: docs/workflow/discussion/{topic}.md
46
+
47
+ Topic name: {topic}
48
+
49
+ PIPELINE CONTINUATION — When this specification concludes (status: concluded),
50
+ you MUST return to the continue-feature skill and execute Step 6 (Phase Bridge).
51
+ Load: skills/continue-feature/references/phase-bridge.md
52
+ Do not end the session after the specification — the feature pipeline continues.
53
+
54
+ Invoke the technical-specification skill.
55
+ ```
@@ -0,0 +1,58 @@
1
+ # Phase Bridge
2
+
3
+ *Reference for **[continue-feature](../SKILL.md)***
4
+
5
+ ---
6
+
7
+ The phase bridge clears context between pipeline phases using plan mode. This is necessary because each phase can consume significant context, and starting fresh prevents degradation.
8
+
9
+ ## Determine Next Phase
10
+
11
+ Check which step just completed to determine what continue-feature will route to next:
12
+
13
+ - Just completed **specification** (Step 3) → next session routes to planning
14
+ - Just completed **planning** (Step 4) → next session routes to implementation
15
+ - Just completed **implementation** (Step 5) → feature is done
16
+
17
+ #### If implementation just completed
18
+
19
+ > *Output the next fenced block as a code block:*
20
+
21
+ ```
22
+ Feature Complete
23
+
24
+ "{topic:(titlecase)}" has completed all pipeline phases.
25
+
26
+ Run /start-review to validate the implementation.
27
+ ```
28
+
29
+ **STOP.** Do not proceed — terminal condition.
30
+
31
+ ## Enter Plan Mode
32
+
33
+ Enter plan mode and write the following plan:
34
+
35
+ ```
36
+ # Continue Feature: {topic}
37
+
38
+ The previous phase for "{topic}" has concluded. The next session should
39
+ continue the feature pipeline.
40
+
41
+ ## Instructions
42
+
43
+ 1. Invoke the `/continue-feature` skill for topic "{topic}"
44
+ 2. The skill will detect the current phase and route accordingly
45
+
46
+ ## Context
47
+
48
+ - Topic: {topic}
49
+ - Previous phase: {phase that just completed}
50
+ - Expected next phase: {next phase based on routing above}
51
+
52
+ ## How to proceed
53
+
54
+ Clear context and continue. Claude will invoke continue-feature
55
+ with the topic above and route to the next phase automatically.
56
+ ```
57
+
58
+ Exit plan mode. The user will approve and clear context, and the fresh session will pick up with continue-feature routing to the correct phase.
@@ -0,0 +1,216 @@
1
+ #!/bin/bash
2
+ #
3
+ # Cross-phase discovery script for /continue-feature.
4
+ #
5
+ # Scans all workflow directories (discussion, specification, planning,
6
+ # implementation) and builds a unified topic list with phase state
7
+ # and next_phase computation.
8
+ #
9
+ # Outputs structured YAML that the command can consume directly.
10
+ #
11
+
12
+ set -eo pipefail
13
+
14
+ DISC_DIR="docs/workflow/discussion"
15
+ SPEC_DIR="docs/workflow/specification"
16
+ PLAN_DIR="docs/workflow/planning"
17
+ IMPL_DIR="docs/workflow/implementation"
18
+
19
+ # Helper: Extract a frontmatter field value from a file
20
+ # Usage: extract_field <file> <field_name>
21
+ extract_field() {
22
+ local file="$1"
23
+ local field="$2"
24
+ local value=""
25
+
26
+ # Extract from YAML frontmatter (file must start with ---)
27
+ if head -1 "$file" 2>/dev/null | grep -q "^---$"; then
28
+ value=$(sed -n '2,/^---$/p' "$file" 2>/dev/null | \
29
+ grep -i -m1 "^${field}:" | \
30
+ sed -E "s/^${field}:[[:space:]]*//i" || true)
31
+ fi
32
+
33
+ echo "$value"
34
+ }
35
+
36
+ # Start YAML output
37
+ echo "# Continue-Feature Cross-Phase Discovery"
38
+ echo "# Generated: $(date -Iseconds)"
39
+ echo ""
40
+
41
+ #
42
+ # Collect all unique topic names from discussion + specification
43
+ #
44
+ declare -a all_topics=()
45
+ declare -A topic_seen=()
46
+
47
+ # Scan discussions
48
+ if [ -d "$DISC_DIR" ]; then
49
+ for file in "$DISC_DIR"/*.md; do
50
+ [ -f "$file" ] || continue
51
+ name=$(basename "$file" .md)
52
+ if [ -z "${topic_seen[$name]+x}" ]; then
53
+ all_topics+=("$name")
54
+ topic_seen[$name]=1
55
+ fi
56
+ done
57
+ fi
58
+
59
+ # Scan specifications
60
+ if [ -d "$SPEC_DIR" ]; then
61
+ for dir in "$SPEC_DIR"/*/; do
62
+ [ -d "$dir" ] || continue
63
+ [ -f "${dir}specification.md" ] || continue
64
+ name=$(basename "$dir")
65
+ if [ -z "${topic_seen[$name]+x}" ]; then
66
+ all_topics+=("$name")
67
+ topic_seen[$name]=1
68
+ fi
69
+ done
70
+ fi
71
+
72
+ #
73
+ # Build topic entries
74
+ #
75
+ echo "topics:"
76
+
77
+ topic_count=0
78
+ actionable_count=0
79
+
80
+ if [ ${#all_topics[@]} -eq 0 ]; then
81
+ echo " []"
82
+ else
83
+ for topic in "${all_topics[@]}"; do
84
+ # Discussion state
85
+ disc_exists="false"
86
+ disc_status=""
87
+ disc_file="$DISC_DIR/${topic}.md"
88
+ if [ -f "$disc_file" ]; then
89
+ disc_exists="true"
90
+ disc_status=$(extract_field "$disc_file" "status")
91
+ disc_status=${disc_status:-"in-progress"}
92
+ fi
93
+
94
+ # Specification state
95
+ spec_exists="false"
96
+ spec_status=""
97
+ spec_type=""
98
+ spec_file="$SPEC_DIR/${topic}/specification.md"
99
+ if [ -f "$spec_file" ]; then
100
+ spec_exists="true"
101
+ spec_status=$(extract_field "$spec_file" "status")
102
+ spec_status=${spec_status:-"in-progress"}
103
+ spec_type=$(extract_field "$spec_file" "type")
104
+ spec_type=${spec_type:-"feature"}
105
+ fi
106
+
107
+ # Skip cross-cutting specs — they aren't features
108
+ if [ "$spec_type" = "cross-cutting" ]; then
109
+ continue
110
+ fi
111
+
112
+ # Plan state
113
+ plan_exists="false"
114
+ plan_status=""
115
+ plan_format=""
116
+ plan_file="$PLAN_DIR/${topic}/plan.md"
117
+ if [ -f "$plan_file" ]; then
118
+ plan_exists="true"
119
+ plan_status=$(extract_field "$plan_file" "status")
120
+ plan_status=${plan_status:-"in-progress"}
121
+ plan_format=$(extract_field "$plan_file" "format")
122
+ plan_format=${plan_format:-"unknown"}
123
+ fi
124
+
125
+ # Implementation state
126
+ impl_exists="false"
127
+ impl_status=""
128
+ impl_file="$IMPL_DIR/${topic}/tracking.md"
129
+ if [ -f "$impl_file" ]; then
130
+ impl_exists="true"
131
+ impl_status=$(extract_field "$impl_file" "status")
132
+ impl_status=${impl_status:-"in-progress"}
133
+ fi
134
+
135
+ #
136
+ # Compute next_phase (check from top down, first match wins)
137
+ #
138
+ next_phase=""
139
+
140
+ if [ "$impl_exists" = "true" ] && [ "$impl_status" = "completed" ]; then
141
+ next_phase="done"
142
+ elif [ "$impl_exists" = "true" ] && [ "$impl_status" = "in-progress" ]; then
143
+ next_phase="implementation"
144
+ elif [ "$plan_exists" = "true" ] && [ "$plan_status" = "concluded" ]; then
145
+ next_phase="implementation"
146
+ elif [ "$plan_exists" = "true" ] && [ "$plan_status" != "concluded" ]; then
147
+ next_phase="planning"
148
+ elif [ "$spec_exists" = "true" ] && [ "$spec_status" = "concluded" ]; then
149
+ next_phase="planning"
150
+ elif [ "$spec_exists" = "true" ] && [ "$spec_status" != "concluded" ]; then
151
+ next_phase="specification"
152
+ elif [ "$disc_exists" = "true" ] && [ "$disc_status" = "concluded" ]; then
153
+ next_phase="specification"
154
+ elif [ "$disc_exists" = "true" ]; then
155
+ next_phase="discussion"
156
+ else
157
+ next_phase="unknown"
158
+ fi
159
+
160
+ # Actionable = can continue in the pipeline (not done, not unknown)
161
+ actionable="false"
162
+ if [ "$next_phase" != "done" ] && [ "$next_phase" != "unknown" ]; then
163
+ actionable="true"
164
+ actionable_count=$((actionable_count + 1))
165
+ fi
166
+
167
+ echo " - name: \"$topic\""
168
+
169
+ echo " discussion:"
170
+ echo " exists: $disc_exists"
171
+ if [ "$disc_exists" = "true" ]; then
172
+ echo " status: \"$disc_status\""
173
+ fi
174
+
175
+ echo " specification:"
176
+ echo " exists: $spec_exists"
177
+ if [ "$spec_exists" = "true" ]; then
178
+ echo " status: \"$spec_status\""
179
+ fi
180
+
181
+ echo " plan:"
182
+ echo " exists: $plan_exists"
183
+ if [ "$plan_exists" = "true" ]; then
184
+ echo " status: \"$plan_status\""
185
+ echo " format: \"$plan_format\""
186
+ fi
187
+
188
+ echo " implementation:"
189
+ echo " exists: $impl_exists"
190
+ if [ "$impl_exists" = "true" ]; then
191
+ echo " status: \"$impl_status\""
192
+ fi
193
+
194
+ echo " next_phase: \"$next_phase\""
195
+ echo " actionable: $actionable"
196
+
197
+ topic_count=$((topic_count + 1))
198
+ done
199
+ fi
200
+
201
+ echo ""
202
+
203
+ #
204
+ # STATE SUMMARY
205
+ #
206
+ echo "state:"
207
+ echo " topic_count: $topic_count"
208
+ echo " actionable_count: $actionable_count"
209
+
210
+ if [ "$topic_count" -eq 0 ]; then
211
+ echo " scenario: \"no_topics\""
212
+ elif [ "$topic_count" -eq 1 ]; then
213
+ echo " scenario: \"single_topic\""
214
+ else
215
+ echo " scenario: \"multiple_topics\""
216
+ fi