5-phase-workflow 1.9.4 → 1.9.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "5-phase-workflow",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
4
4
  "description": "A 5-phase feature development workflow for Claude Code",
5
5
  "bin": {
6
6
  "5-phase-workflow": "bin/install.js"
@@ -16,6 +16,8 @@ After writing config.json and the feature spec, you are DONE. Exit immediately.
16
16
 
17
17
  # Configure (Phase 1 - Plan Feature for Project Configuration)
18
18
 
19
+ Current commit: !`git rev-parse --short HEAD 2>/dev/null || echo "none"`
20
+
19
21
  ## Overview
20
22
 
21
23
  This command is **Phase 1** of the 5-phase workflow applied to project configuration itself. It analyzes the project, asks the user questions, and outputs a feature spec at `.5/features/CONFIGURE/feature.md`.
@@ -283,7 +285,7 @@ mkdir -p .5
283
285
  After writing config.json, update `.5/version.json` so the reconfigure reminder can track staleness:
284
286
  1. Read `.5/version.json` (if it exists)
285
287
  2. Set `configuredAt` to the current ISO timestamp (`new Date().toISOString()`)
286
- 3. Set `configuredAtCommit` to the current short commit hash (run `git rev-parse --short HEAD`)
288
+ 3. Set `configuredAtCommit` to the current short commit hash injected at the top of this command
287
289
  4. Write back `.5/version.json` preserving all other fields
288
290
 
289
291
  **Apply `.gitignore` if selected:**
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: 5:plan-feature
3
3
  description: Plans feature implementation by analyzing requirements, identifying affected modules, and creating a structured feature specification. Use at the start of any new feature to ensure systematic implementation. This is Phase 1 of the 5-phase workflow.
4
- allowed-tools: Read, Write, Agent, AskUserQuestion
4
+ allowed-tools: Bash, Read, Write, Agent, AskUserQuestion, mcp__claude_ai_Atlassian_Rovo__getJiraIssue
5
5
  user-invocable: true
6
6
  model: opus
7
7
  ---
@@ -35,8 +35,8 @@ WHAT IS ALLOWED:
35
35
  <write-rules>
36
36
  You have access to the Write tool for exactly these files:
37
37
  1. `.5/.planning-active` — Step 0 only
38
- 2. `.5/features/{name}/codebase-scan.md` — Step 2 only (Explore agent results cache)
39
- 3. `.5/features/{name}/feature.md` — Step 4 only
38
+ 2. `.5/features/{name}/codebase-scan.md` — Step 3 only (Explore agent results cache)
39
+ 3. `.5/features/{name}/feature.md` — Step 5 only
40
40
  Any other Write target WILL be blocked by the plan-guard hook. Do not attempt it.
41
41
  </write-rules>
42
42
 
@@ -81,18 +81,26 @@ If any of these are unclear, keep discussing.
81
81
 
82
82
  # Plan Feature (Phase 1)
83
83
 
84
+ ## Options
85
+
86
+ - **`--github`** — Auto-fetch feature description from the GitHub issue linked to the current branch.
87
+ - **`--jira`** — Auto-fetch feature description from the Jira ticket linked to the current branch.
88
+
89
+ Current branch: !`git branch --show-current`
90
+
84
91
  ## Progress Checklist
85
92
 
86
93
  Follow these steps IN ORDER. Do NOT skip steps. Do NOT proceed to a later step until the current one is complete. After completing each step, output a status line: `✓ Step N complete`.
87
94
 
88
95
  - [ ] Step 0: Activate planning guard — write `.5/.planning-active`
89
- - [ ] Step 1: Gather feature description ask developer via AskUserQuestion
90
- - [ ] Step 2: Explore codebasespawn Explore sub-agent, wait for results, cache to codebase-scan.md
91
- - [ ] Step 3: Collaborative spec development discuss with the user until the spec is clear
92
- - [ ] Step 4: Write feature specificationcreate `.5/features/{name}/feature.md` (with optional mermaid diagrams)
96
+ - [ ] Step 1: Auto-fetch ticket *(only when `--github` or `--jira` flag is present — skip otherwise)*
97
+ - [ ] Step 2: Gather feature description present fetched content or ask developer via AskUserQuestion
98
+ - [ ] Step 3: Explore codebasespawn Explore sub-agent, wait for results, cache to codebase-scan.md
99
+ - [ ] Step 4: Collaborative spec developmentdiscuss with the user until the spec is clear
100
+ - [ ] Step 5: Write feature specification — create `.5/features/{name}/feature.md` (with optional mermaid diagrams)
93
101
  - [ ] Output completion message and STOP
94
102
 
95
- > **MANDATORY:** After completing Steps 0, 1, 2, and 4, output `✓ Step N complete` before moving on. Step 3 is open-ended — it completes when you and the user agree the spec is ready to write.
103
+ > **MANDATORY:** After completing Steps 0, 1, 2, 3, and 5, output `✓ Step N complete` before moving on. Step 4 is open-ended — it completes when you and the user agree the spec is ready to write.
96
104
 
97
105
  ## Process
98
106
 
@@ -109,25 +117,64 @@ Write the planning guard marker to `.5/.planning-active` using the Write tool:
109
117
 
110
118
  This activates the plan-guard hook which prevents accidental source file edits during planning. The marker is removed automatically when implementation starts (`/5:implement-feature`), expires after 4 hours, or can be cleared manually with `/5:unlock`.
111
119
 
112
- ### Step 1: Gather Feature Description
120
+ ### Step 1: Auto-fetch Ticket *(conditional — skip if no flag was passed)*
121
+
122
+ **Only execute this step when the command was invoked with `--github` or `--jira`.**
123
+
124
+ 1. Read `.5/config.json`. Extract `ticket.pattern` (e.g., `[A-Z]+-\d+` or `\d+`).
125
+ 2. Match the pattern against the injected branch name at the top of this command.
126
+
127
+ **If a ticket ID is found in the branch name:**
128
+
129
+ - **`--jira`**: Call `mcp__claude_ai_Atlassian_Rovo__getJiraIssue` with the extracted ticket ID. Combine the `summary` and `description` fields into `$FETCHED_DESCRIPTION`.
130
+ - **`--github`**: Run `gh issue view {id} --json title,body` via Bash. Combine `title` and `body` into `$FETCHED_DESCRIPTION`.
131
+ - If the fetch **succeeds**: proceed to Step 2 with `$FETCHED_DESCRIPTION` set.
132
+ - If the fetch **fails** (not found, auth error, network issue): inform the user ("Could not fetch ticket {id}: {reason}") and proceed to Step 2 without `$FETCHED_DESCRIPTION`.
133
+
134
+ **If no ticket ID is found in the branch name:**
135
+
136
+ Ask the user via AskUserQuestion:
137
+
138
+ > "Could not extract a ticket ID from branch `{branch}`. Please provide the ticket ID (e.g., `PROJ-1234` or `123` for GitHub issues):"
139
+
140
+ Use the provided ID to fetch using the same logic above. If the fetch fails after the user-provided ID, inform the user and proceed to Step 2 without `$FETCHED_DESCRIPTION`.
141
+
142
+ ### Step 2: Gather Feature Description
143
+
144
+ **If `$FETCHED_DESCRIPTION` is set (flag was used and fetch succeeded):**
145
+
146
+ Display the fetched ticket content to the user and ask via AskUserQuestion:
147
+
148
+ ```
149
+ Here's what I fetched from {GitHub Issues / Jira}:
150
+
151
+ **{Title / Summary}**
152
+ {Body / Description}
153
+
154
+ Is this description complete, or would you like to add any context before I explore the codebase?
155
+ ```
156
+
157
+ Accept any additions from the user. Merge user additions with `$FETCHED_DESCRIPTION` to form the working feature description.
158
+
159
+ **Otherwise (no flag, or fetch failed):**
113
160
 
114
- Ask the developer for the feature description using AskUserQuestion:
161
+ Ask the developer via AskUserQuestion:
115
162
 
116
163
  "Please describe the feature you want to specify. Paste the full ticket description or explain it in your own words."
117
164
 
118
165
  - Expect free-text answer, do NOT provide options
119
166
  - Do NOT ask follow-up questions yet
120
167
 
121
- ### Step 2: Spawn Explore Agent for Codebase Analysis
168
+ ### Step 3: Spawn Explore Agent for Codebase Analysis
122
169
 
123
- > **ROLE CHECK:** You are a Feature Planner. Your ONLY output is feature.md. If you are tempted to write code or create files, STOP and return to the next question in Step 3.
170
+ > **ROLE CHECK:** You are a Feature Planner. Your ONLY output is feature.md. If you are tempted to write code or create files, STOP and return to the next question in Step 4.
124
171
 
125
172
  Spawn an Agent with `subagent_type=Explore`:
126
173
 
127
174
  ```
128
175
  Analyze the codebase for a feature specification session.
129
176
 
130
- **Feature Description:** {paste the user's feature description}
177
+ **Feature Description:** {paste the full feature description from Step 2}
131
178
 
132
179
  **Your Task:**
133
180
  1. Check if `.5/index/` exists. If it does, read `.5/index/README.md` first — it includes a generation timestamp. If the index is fresh (under 1 day old), read the relevant index files (e.g., modules.md, routes.md, models.md) as your structural overview and skip broad Glob scans for information already covered. If the index is outdated (over 1 day old), note in your report that the user should run `.5/index/rebuild-index.sh` to refresh it, then use it anyway (stale is better than nothing). If `.5/index/` does not exist at all, note in your report that the user can run `/5:reconfigure` to generate it, then proceed with Glob/Grep exploration as below.
@@ -136,10 +183,8 @@ Analyze the codebase for a feature specification session.
136
183
  4. Identify coding patterns and conventions
137
184
  5. Find reusable components or patterns
138
185
  6. Identify affected files/modules
139
- 7. Run `git branch --show-current` to get the current branch name
140
186
 
141
187
  **Report Format:**
142
- - Current git branch name
143
188
  - Project structure overview
144
189
  - Relevant existing patterns found
145
190
  - Similar implementations discovered
@@ -147,18 +192,18 @@ Analyze the codebase for a feature specification session.
147
192
  - Reusable components identified
148
193
  - Potential integration points
149
194
 
150
- **IMPORTANT:** READ-ONLY agent. Only use Read, Glob, Grep, and Bash (for git branch) tools.
195
+ **IMPORTANT:** READ-ONLY agent. Only use Read, Glob, and Grep tools.
151
196
  ```
152
197
 
153
198
  Wait for the sub-agent to return before proceeding.
154
199
 
155
200
  **Cache the results:** Write the Explore agent's full output to `.5/features/{name}/codebase-scan.md` using the Write tool. This saves Phase 2 from re-scanning the same codebase and saves significant tokens.
156
201
 
157
- ### Step 3: Collaborative Spec Development
202
+ ### Step 4: Collaborative Spec Development
158
203
 
159
204
  > **ROLE CHECK:** You are gathering requirements, NOT designing solutions. Discussion covers WHAT and WHY, never HOW.
160
205
 
161
- **Begin by sharing your understanding.** Based on the user's description (Step 1) and the codebase exploration (Step 2), propose a concise summary of the feature:
206
+ **Begin by sharing your understanding.** Based on the feature description (Step 2) and the codebase exploration (Step 3), propose a concise summary of the feature:
162
207
  - What problem it solves
163
208
  - What the key capabilities are
164
209
  - Which existing components are relevant
@@ -181,7 +226,7 @@ Ask the user: "Here's my understanding of the feature — [summary]. Does this c
181
226
  4. Acceptance criteria (how to verify success)
182
227
  5. Key decisions and their labels ([DECIDED], [FLEXIBLE], [DEFERRED])
183
228
 
184
- If any of these are unclear, keep discussing. When you believe clarity has been reached, tell the user: "I think I have a clear picture — ready to write the spec. Anything else before I do?" Then proceed to Step 4.
229
+ If any of these are unclear, keep discussing. When you believe clarity has been reached, tell the user: "I think I have a clear picture — ready to write the spec. Anything else before I do?" Then proceed to Step 5.
185
230
 
186
231
  **Optional re-exploration:** If the user mentions components not covered in the initial report, spawn a targeted Explore agent:
187
232
 
@@ -192,13 +237,13 @@ Targeted exploration for feature planning.
192
237
  **READ-ONLY.** Only use Read, Glob, and Grep tools.
193
238
  ```
194
239
 
195
- ### Step 4: Create Feature Specification
240
+ ### Step 5: Create Feature Specification
196
241
 
197
242
  > **ROLE CHECK:** You are writing a FEATURE SPECIFICATION. After writing feature.md you are DONE — do NOT proceed to implementation planning or coding.
198
243
 
199
- **Extract ticket ID from git branch:**
200
- - The Explore agent from Step 2 already ran `git branch --show-current` find the branch name in its results
201
- - Use the configurable ticket pattern from `.5/config.json` (e.g., `PROJ-\d+`) to extract the ticket ID from the branch name
244
+ **Extract ticket ID from the branch name:**
245
+ - Use the branch name injected at the top of this command
246
+ - Use the configurable ticket pattern from `.5/config.json` (e.g., `PROJ-\d+`) to extract the ticket ID
202
247
  - **Sanitize the ticket ID:** Only allow alphanumeric characters, dashes (`-`), and underscores (`_`). Strip any other characters (especially `/`, `..`, `~`, spaces).
203
248
  - **If ticket found:** use folder name `{TICKET-ID}-{feature-name}` and write the ticket ID into the spec
204
249
  - **If no ticket found:** use folder name `{feature-name}` and write `<no-ticket>` as the ticket ID in the spec
@@ -14,6 +14,8 @@ This command handles ONE task. When done, you are DONE.
14
14
 
15
15
  # Quick Implement
16
16
 
17
+ Current branch: !`git branch --show-current`
18
+
17
19
  Fast path for small, well-understood tasks (1-5 files). Skips extensive planning phases but preserves state tracking and skill-based implementation.
18
20
 
19
21
  ## ⚠️ CRITICAL SCOPE CONSTRAINT
@@ -57,9 +59,7 @@ Store as `$DESCRIPTION`.
57
59
 
58
60
  ### Step 2: Extract Ticket ID and Load Config
59
61
 
60
- ```bash
61
- git branch --show-current
62
- ```
62
+ Use the branch name injected at the top of this command.
63
63
 
64
64
  Extract ticket ID using configurable pattern from config (e.g., `PROJ-\d+` or `\d+`). If not found, ask developer.
65
65
 
@@ -17,6 +17,8 @@ After saving the findings file, you are DONE.
17
17
 
18
18
  # Review Code (Phase 5)
19
19
 
20
+ CodeRabbit: !`which coderabbit 2>/dev/null && coderabbit auth status 2>/dev/null || echo "not installed"`
21
+
20
22
  ## Review Tools
21
23
 
22
24
  Two review tools are supported (configured in `.5/config.json` field `reviewTool`):
@@ -35,10 +37,7 @@ Read `.5/config.json` and check the `reviewTool` field.
35
37
  - If not set, missing, or `"claude"` (legacy value), default to `"native"`
36
38
  - If `"none"`, inform user that automated review is disabled and STOP
37
39
 
38
- **If CodeRabbit:** Check prerequisites via Bash:
39
- ```bash
40
- which coderabbit && coderabbit auth status
41
- ```
40
+ **If CodeRabbit:** Check the CodeRabbit status injected at the top of this command.
42
41
  If not installed or not authenticated, ask user via AskUserQuestion:
43
42
  - "Switch to native review for this review? (Recommended)" / "I'll install CodeRabbit first"
44
43
  - If they choose CodeRabbit setup, provide install instructions and STOP