5-phase-workflow 1.3.0 → 1.4.1

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/bin/install.js CHANGED
@@ -373,7 +373,11 @@ function getDefaultConfig(projectType) {
373
373
  command: 'auto',
374
374
  testCommand: 'auto'
375
375
  },
376
- reviewTool: 'claude'
376
+ reviewTool: 'claude',
377
+ git: {
378
+ autoCommit: false,
379
+ commitMessage: { pattern: '{ticket-id} {short-description}' }
380
+ }
377
381
  };
378
382
 
379
383
  // Project-specific overrides
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "5-phase-workflow",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "description": "A 5-phase feature development workflow for Claude Code",
5
5
  "bin": {
6
6
  "5-phase-workflow": "bin/install.js"
7
7
  },
8
8
  "scripts": {
9
- "test": "bash test/verify-install-js.sh",
9
+ "test": "bash test/verify-install-js.sh && bash test/test-check-updates-hook.sh && bash test/test-update-system.sh",
10
+ "test:install": "bash test/verify-install-js.sh",
11
+ "test:hook": "bash test/test-check-updates-hook.sh",
12
+ "test:update": "bash test/test-update-system.sh",
10
13
  "verify": "bash test/verify-install-js.sh"
11
14
  },
12
15
  "files": [
@@ -145,6 +145,9 @@ if command -v coderabbit &> /dev/null; then
145
145
  fi
146
146
 
147
147
  # IDE MCP (JetBrains) - check if MCP tools are available
148
+
149
+ # Context7 - up-to-date documentation MCP server
150
+ # Check if context7 tools are available (resolve-library-id, query-docs)
148
151
  ```
149
152
 
150
153
  **1e. Check CLAUDE.md:**
@@ -326,7 +329,21 @@ If "Cancel": Exit immediately with message "Configuration unchanged."
326
329
  - "Suggested test command: `{command}`. Use this?"
327
330
  - Options: "Yes (recommended)", "Customize", "None (no test step)"
328
331
 
329
- **2f. Review tool preference:**
332
+ **2f. Auto-commit during implementation:**
333
+ - "Should Claude make atomic commits during implementation? This creates a commit after each step, enabling progress tracking and easy rollback."
334
+ - Options:
335
+ 1. "No (recommended)" → `git.autoCommit: false`
336
+ 2. "Yes - commit after each implementation step" → `git.autoCommit: true`
337
+
338
+ **2g. Commit message pattern (only if auto-commit = Yes):**
339
+ - "What commit message format would you like?"
340
+ - Options:
341
+ 1. "Default: `{ticket-id} {short-description}` (Recommended)"
342
+ 2. "Conventional: `feat({ticket-id}): {short-description}`"
343
+ 3. "Custom pattern" → free text
344
+ - Note: "Body will automatically include bullet points of changes."
345
+
346
+ **2h. Review tool preference:**
330
347
  - "Which code review tool would you like to use?"
331
348
  - Options:
332
349
  1. "Claude (built-in, no setup needed)" — always available
@@ -339,11 +356,24 @@ If "Cancel": Exit immediately with message "Configuration unchanged."
339
356
  - Then: `coderabbit auth login`
340
357
  - Record the preference as `coderabbit` regardless (will prompt at review time if still missing)
341
358
 
342
- **2g. Confirm CLAUDE.md generation:**
359
+ **2i. Context7 documentation plugin:**
360
+
361
+ Context7 provides up-to-date, version-specific documentation and code examples directly in your prompts. It solves a common problem with LLMs: outdated training data leading to hallucinated APIs and deprecated code patterns.
362
+
363
+ - If Context7 was detected in Step 1d (resolve-library-id and query-docs tools available):
364
+ - "Context7 is already installed. ✓"
365
+ - If Context7 was NOT detected:
366
+ - "Would you like to install Context7? It provides up-to-date, version-specific documentation directly in prompts — helping avoid hallucinated APIs and deprecated patterns."
367
+ - Options:
368
+ 1. "Install now (recommended)" — run `claude mcp add context7 -- npx -y @anthropic-ai/claude-code-mcp-server-context7` via Bash
369
+ 2. "Skip"
370
+ - If user selects "Install now": execute the install command
371
+
372
+ **2j. Confirm CLAUDE.md generation:**
343
373
  - "Generate/update CLAUDE.md? This will analyze your codebase to document structure and conventions."
344
374
  - Options: "Yes (recommended)", "Skip"
345
375
 
346
- **2h. Review detected patterns for skill generation:**
376
+ **2k. Review detected patterns for skill generation:**
347
377
 
348
378
  Present ONLY patterns that were actually detected in steps 1g and 1h.
349
379
 
@@ -408,7 +438,10 @@ Create `.claude/.5/config.json` with the following values:
408
438
  - Test timeout: 300000ms
409
439
  - CodeRabbit: {available/not-available}, authenticated: {yes/no}
410
440
  - IDE integration: {available/not-available}, type: {type}
441
+ - Context7: {available/not-available}
411
442
  - Review tool: {claude/coderabbit/none}
443
+ - Auto-commit: {yes/no}
444
+ - Commit message pattern: {pattern or "default"}
412
445
 
413
446
  ### Requirement 2: Generate Documentation Files
414
447
  Analyze the codebase and generate modular documentation:
@@ -555,6 +588,12 @@ User: "Yes"
555
588
  Claude: "Test command: `npm test`. Use this?"
556
589
  User: "Yes"
557
590
 
591
+ Claude: "Should Claude make atomic commits during implementation?"
592
+ User: "No"
593
+
594
+ Claude: "Which code review tool would you like to use?"
595
+ User: "Claude (built-in)"
596
+
558
597
  Claude: "Generate CLAUDE.md with codebase analysis?"
559
598
  User: "Yes"
560
599
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: 5:implement-feature
3
3
  description: Executes an implementation plan by delegating to agents. Phase 3 of the 5-phase workflow.
4
- allowed-tools: Task, Read, Write, Glob, Grep
4
+ allowed-tools: Task, Read, Write, Glob, Grep, Bash
5
5
  context: fork
6
6
  user-invocable: true
7
7
  ---
@@ -10,7 +10,11 @@ user-invocable: true
10
10
 
11
11
  ## Prerequisites Check
12
12
 
13
- **CRITICAL: Check for configuration before proceeding**
13
+ **CRITICAL: Check for configuration before proceeding (skip for CONFIGURE feature)**
14
+
15
+ If the feature argument is `CONFIGURE`, skip this check entirely — the CONFIGURE workflow is what creates the config file.
16
+
17
+ For all other features, run this check:
14
18
 
15
19
  ```bash
16
20
  if [ ! -f ".claude/.5/config.json" ]; then
@@ -27,7 +31,7 @@ if [ ! -f ".claude/.5/config.json" ]; then
27
31
  fi
28
32
  ```
29
33
 
30
- **If config doesn't exist, STOP IMMEDIATELY. Do not proceed with the workflow.**
34
+ **If config doesn't exist and the feature is NOT `CONFIGURE`, STOP IMMEDIATELY. Do not proceed with the workflow.**
31
35
 
32
36
  Execute an implementation plan by delegating work to agents.
33
37
 
@@ -46,7 +50,7 @@ Do NOT write code directly. Spawn agents to do the work.
46
50
 
47
51
  ## Process
48
52
 
49
- ### Step 1: Load Plan
53
+ ### Step 1: Load Plan and Config
50
54
 
51
55
  Read `.5/features/{feature-name}/plan.md` (where `{feature-name}` is the argument provided).
52
56
 
@@ -58,6 +62,10 @@ Parse:
58
62
 
59
63
  If the plan doesn't exist, tell the user to run `/5:plan-implementation` first.
60
64
 
65
+ Also read `.claude/.5/config.json` and extract:
66
+ - `git.autoCommit` (boolean, default `false`)
67
+ - `git.commitMessage.pattern` (string, default `{ticket-id} {short-description}`)
68
+
61
69
  ### Step 2: Initialize State
62
70
 
63
71
  Create `.5/features/{feature-name}/state.json`:
@@ -180,7 +188,39 @@ Update state.json:
180
188
  }
181
189
  ```
182
190
 
183
- **3e. Handle failures**
191
+ **3e. Auto-Commit Step (if enabled)**
192
+
193
+ Only fires if `git.autoCommit: true` AND at least one component in the step succeeded.
194
+
195
+ 1. Stage **only** the specific files from the plan's components table for this step (never `git add .`)
196
+ 2. Commit using the configured `git.commitMessage.pattern`:
197
+ - `{ticket-id}` → ticket ID from plan frontmatter
198
+ - `{short-description}` → auto-generated summary of the step (imperative mood, max 50 chars for the full first line)
199
+ - Body: one bullet per completed component
200
+
201
+ ```bash
202
+ # Stage only specific files from this step's components
203
+ git add {file-1} {file-2} ...
204
+
205
+ # Commit with configured pattern + body
206
+ git commit -m "{ticket-id} {short-description}
207
+
208
+ - {concise change 1}
209
+ - {concise change 2}"
210
+ ```
211
+
212
+ 3. If commit fails → log warning, record in `state.json` under `commitResults` array, continue
213
+ 4. If all components in the step failed → skip commit entirely
214
+
215
+ **Example commit:**
216
+ ```
217
+ PROJ-1234 add schedule model and types
218
+
219
+ - Create Schedule.ts entity model
220
+ - Create schedule.ts type definitions
221
+ ```
222
+
223
+ **3f. Handle failures**
184
224
 
185
225
  If any component failed:
186
226
  - Log the failure in state.json
@@ -223,6 +263,7 @@ Implementation complete!
223
263
  - {N} components created/modified
224
264
  - Build: {status}
225
265
  - Tests: {status}
266
+ {If git.autoCommit was true: "- Commits: {N} atomic commits created"}
226
267
 
227
268
  {If any failures: list them}
228
269
 
@@ -10,7 +10,11 @@ user-invocable: true
10
10
 
11
11
  ## Prerequisites Check
12
12
 
13
- **CRITICAL: Check for configuration before proceeding**
13
+ **CRITICAL: Check for configuration before proceeding (skip for CONFIGURE feature)**
14
+
15
+ If the feature argument is `CONFIGURE`, skip this check entirely — the CONFIGURE workflow is what creates the config file.
16
+
17
+ For all other features, run this check:
14
18
 
15
19
  ```bash
16
20
  if [ ! -f ".claude/.5/config.json" ]; then
@@ -27,7 +31,7 @@ if [ ! -f ".claude/.5/config.json" ]; then
27
31
  fi
28
32
  ```
29
33
 
30
- **If config doesn't exist, STOP IMMEDIATELY. Do not proceed with the workflow.**
34
+ **If config doesn't exist and the feature is NOT `CONFIGURE`, STOP IMMEDIATELY. Do not proceed with the workflow.**
31
35
 
32
36
  Create an implementation plan that maps a feature spec to concrete components.
33
37
 
@@ -51,7 +51,7 @@ Your job is NOT:
51
51
  ❌ Skip clarifying questions if unclear
52
52
  ❌ Skip state file updates
53
53
  ❌ Create feature spec files (use full workflow)
54
- ❌ Commit changes (user handles this)
54
+ ❌ Commit without config - Only commit if git.autoCommit is enabled
55
55
 
56
56
  **This is a FAST PATH for well-understood, small tasks. For anything complex, use the full workflow.**
57
57
 
@@ -63,7 +63,7 @@ Your job is NOT:
63
63
  - ❌ **Skip clarifying questions** - If implementation is unclear, ask first
64
64
  - ❌ **Skip state updates** - State file updates are MANDATORY
65
65
  - ❌ **Create feature specs** - This is for quick tasks, not full features
66
- - ❌ **Auto-commit** - User handles commits
66
+ - ❌ **Commit without config** - Only commit if git.autoCommit is enabled
67
67
  - ❌ **Skip plan approval** - Always show plan and get user approval first
68
68
 
69
69
  **If the task involves more than 5 files or multiple domains, STOP and recommend the full workflow instead.**
@@ -79,7 +79,7 @@ Use AskUserQuestion:
79
79
 
80
80
  Store as `$DESCRIPTION`.
81
81
 
82
- ### Step 2: Extract Ticket ID
82
+ ### Step 2: Extract Ticket ID and Load Config
83
83
 
84
84
  ```bash
85
85
  git branch --show-current
@@ -87,6 +87,10 @@ git branch --show-current
87
87
 
88
88
  Extract ticket ID using configurable pattern from config (e.g., `PROJ-\d+` or `\d+`). If not found, ask developer.
89
89
 
90
+ Also read `.claude/.5/config.json` and extract:
91
+ - `git.autoCommit` (boolean, default `false`)
92
+ - `git.commitMessage.pattern` (string, default `{ticket-id} {short-description}`)
93
+
90
94
  ### Step 3: Generate Identifiers
91
95
 
92
96
  ```bash
@@ -268,6 +272,32 @@ Skill tool call:
268
272
  args: "{affected test modules}"
269
273
  ```
270
274
 
275
+ ### Step 9b: Auto-Commit (if enabled)
276
+
277
+ Only fires if `git.autoCommit: true` AND build passed in Step 9.
278
+
279
+ Creates a **single commit** for all components (not per-component — quick-implement is for small tasks):
280
+
281
+ 1. Stage **only** the specific files from the plan's components (never `git add .`)
282
+ 2. Commit using the configured `git.commitMessage.pattern`:
283
+ - `{ticket-id}` → ticket ID
284
+ - `{short-description}` → auto-generated summary (imperative mood, max 50 chars for full first line)
285
+ - Body: one bullet per component
286
+
287
+ ```bash
288
+ # Stage only specific files
289
+ git add {file-1} {file-2} ...
290
+
291
+ # Commit with configured pattern + body
292
+ git commit -m "{ticket-id} {short-description}
293
+
294
+ - {concise change 1}
295
+ - {concise change 2}"
296
+ ```
297
+
298
+ 3. If commit fails → log warning, record in `state.json`, continue
299
+ 4. If build failed in Step 9 → skip commit entirely
300
+
271
301
  ### Step 10: Update State and Report (MANDATORY)
272
302
 
273
303
  **CRITICAL**: You MUST update the state file to mark completion.
@@ -303,10 +333,14 @@ Components created/modified:
303
333
 
304
334
  Build: Success
305
335
  Tests: {Success | Skipped}
336
+ {If git.autoCommit was true: "Commit: {Success | Failed | Skipped (build failed)}"}
306
337
 
307
338
  State: .5/features/${feature_name}/state.json
308
339
 
309
340
  Next steps:
341
+ {If auto-commit fired successfully:}
342
+ 1. For a new task, run `/clear` before starting
343
+ {If auto-commit not enabled or commit skipped:}
310
344
  1. Review and commit changes
311
345
  2. For a new task, run `/clear` before starting
312
346
  ```
@@ -11,7 +11,11 @@ user-invocable: true
11
11
 
12
12
  ## Prerequisites Check
13
13
 
14
- **CRITICAL: Check for configuration before proceeding**
14
+ **CRITICAL: Check for configuration before proceeding (skip for CONFIGURE feature)**
15
+
16
+ If the feature argument is `CONFIGURE`, skip this check entirely — the CONFIGURE workflow is what creates the config file.
17
+
18
+ For all other features, run this check:
15
19
 
16
20
  ```bash
17
21
  if [ ! -f ".claude/.5/config.json" ]; then
@@ -28,7 +32,7 @@ if [ ! -f ".claude/.5/config.json" ]; then
28
32
  fi
29
33
  ```
30
34
 
31
- **If config doesn't exist, STOP IMMEDIATELY. Do not proceed with the workflow.**
35
+ **If config doesn't exist and the feature is NOT `CONFIGURE`, STOP IMMEDIATELY. Do not proceed with the workflow.**
32
36
 
33
37
  ## Overview
34
38
 
@@ -10,7 +10,11 @@ user-invocable: true
10
10
 
11
11
  ## Prerequisites Check
12
12
 
13
- **CRITICAL: Check for configuration before proceeding**
13
+ **CRITICAL: Check for configuration before proceeding (skip for CONFIGURE feature)**
14
+
15
+ If the feature argument is `CONFIGURE`, skip this check entirely — the CONFIGURE workflow is what creates the config file.
16
+
17
+ For all other features, run this check:
14
18
 
15
19
  ```bash
16
20
  if [ ! -f ".claude/.5/config.json" ]; then
@@ -27,7 +31,7 @@ if [ ! -f ".claude/.5/config.json" ]; then
27
31
  fi
28
32
  ```
29
33
 
30
- **If config doesn't exist, STOP IMMEDIATELY. Do not proceed with the workflow.**
34
+ **If config doesn't exist and the feature is NOT `CONFIGURE`, STOP IMMEDIATELY. Do not proceed with the workflow.**
31
35
 
32
36
  Verify that an implementation is complete, correct, and meets feature requirements through multi-layer verification.
33
37
 
@@ -70,11 +74,16 @@ Note: feature.md not found — skipping feature completeness checks.
70
74
  This is normal for quick-implement workflows. Infrastructure and quality checks will still run.
71
75
  ```
72
76
 
77
+ Also read `.claude/.5/config.json` and extract:
78
+ - `git.autoCommit` (boolean, default `false`)
79
+ - `git.commitMessage.pattern` (string, default `{ticket-id} {short-description}`)
80
+
73
81
  Extract from artifacts:
74
82
  - Components table from `plan.md` (step, component, action, file, description, complexity)
75
83
  - Build and test commands from `plan.md`
76
84
  - Completed/failed components from `state.json`
77
85
  - Acceptance criteria and functional requirements from `feature.md` (if present)
86
+ - Number of commits created from `state.json` `commitResults` (if auto-commit was used)
78
87
 
79
88
  ### Step 2: Infrastructure Verification (Layer 1)
80
89
 
@@ -255,7 +264,11 @@ Layer 2 (Feature Completeness): {N}/{N} criteria satisfied, {N}/{N} requirements
255
264
  Layer 3 (Quality): {N}/{N} new files have tests
256
265
 
257
266
  Report: .5/{feature-name}/verification.md
267
+ ```
268
+
269
+ **If `git.autoCommit: false` (default):** offer to commit.
258
270
 
271
+ ```
259
272
  Would you like to commit these changes?
260
273
  ```
261
274
 
@@ -265,6 +278,12 @@ Use AskUserQuestion with options:
265
278
 
266
279
  If yes: stage and commit with message format `{TICKET-ID} {description}`.
267
280
 
281
+ **If `git.autoCommit: true`:** skip the commit offer.
282
+
283
+ ```
284
+ Changes were already committed during implementation ({N} atomic commits).
285
+ ```
286
+
268
287
  Then go to Step 11 (Next Steps).
269
288
 
270
289
  **If PARTIAL or FAILED:**
@@ -359,6 +378,22 @@ After all fixes are applied, re-run build and tests:
359
378
  {test-command}
360
379
  ```
361
380
 
381
+ **If `git.autoCommit: true` and fixes succeeded (build + tests pass):**
382
+
383
+ Auto-commit the fix files:
384
+ ```bash
385
+ # Stage only the specific fix files
386
+ git add {fix-file-1} {fix-file-2} ...
387
+
388
+ # Commit with ticket ID
389
+ git commit -m "{ticket-id} fix verification issues
390
+
391
+ - {concise fix 1}
392
+ - {concise fix 2}"
393
+ ```
394
+
395
+ If commit fails → log warning, continue.
396
+
362
397
  Update `fix-plan.md` with results:
363
398
  - Mark each fix as APPLIED / FAILED
364
399
  - Record build and test results after fixes
@@ -369,6 +404,7 @@ Applied {N} fixes.
369
404
 
370
405
  Build: {status}
371
406
  Tests: {status}
407
+ {If git.autoCommit was true: "Commit: {Success | Failed | Skipped}"}
372
408
 
373
409
  {If any fixes failed, list them}
374
410
 
@@ -3,19 +3,19 @@
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
5
 
6
- // Read stdin (Claude Code passes JSON)
7
- let inputData = '';
8
- process.stdin.on('data', (chunk) => {
9
- inputData += chunk;
10
- });
11
-
12
- process.stdin.on('end', async () => {
6
+ // Read JSON from stdin
7
+ let input = '';
8
+ process.stdin.setEncoding('utf8');
9
+ process.stdin.on('data', chunk => input += chunk);
10
+ process.stdin.on('end', () => {
13
11
  try {
14
- // Parse hook input (contains workspace info)
15
- const hookData = JSON.parse(inputData);
16
- const workspaceDir = hookData.workingDirectory || process.cwd();
12
+ let workspaceDir = process.cwd();
13
+ if (input.trim()) {
14
+ const data = JSON.parse(input);
15
+ workspaceDir = data.cwd || data.workspace?.current_dir || workspaceDir;
16
+ }
17
17
 
18
- await checkForUpdates(workspaceDir);
18
+ checkForUpdates(workspaceDir).catch(() => process.exit(0));
19
19
  } catch (e) {
20
20
  // Silent failure - don't block on errors
21
21
  process.exit(0);
package/src/settings.json CHANGED
@@ -6,10 +6,12 @@
6
6
  "hooks": {
7
7
  "SessionStart": [
8
8
  {
9
+ "matcher": "startup",
9
10
  "hooks": [
10
11
  {
11
12
  "type": "command",
12
- "command": "node .claude/hooks/check-updates.js"
13
+ "command": "node .claude/hooks/check-updates.js",
14
+ "timeout": 10
13
15
  }
14
16
  ]
15
17
  }
@@ -55,14 +55,23 @@ It handles three distinct tasks, invoked with different parameters per component
55
55
  "ide": {
56
56
  "available": false,
57
57
  "type": null
58
+ },
59
+ "context7": {
60
+ "available": false
58
61
  }
59
62
  },
60
- "reviewTool": "claude" or "coderabbit" or "none"
63
+ "reviewTool": "claude" or "coderabbit" or "none",
64
+ "git": {
65
+ "autoCommit": false,
66
+ "commitMessage": {
67
+ "pattern": "{ticket-id} {short-description}"
68
+ }
69
+ }
61
70
  }
62
71
  ```
63
72
 
64
73
  **Process:**
65
- 1. Read all values from the feature spec (`.5/features/CONFIGURE/feature.md`)
74
+ 1. Read all values from the feature spec (`.5/features/CONFIGURE/feature.md`), including `git.autoCommit` and `git.commitMessage.pattern`
66
75
  2. Ensure `.claude/.5/` directory exists (create with `mkdir -p` if needed)
67
76
  3. Write `config.json` with pretty-printed JSON
68
77
  4. Read back to verify correctness