5-phase-workflow 1.8.6 → 1.8.8
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/README.md +67 -33
- package/bin/install.js +510 -34
- package/docs/workflow-guide.md +1 -1
- package/package.json +1 -1
- package/src/commands/5/address-review-findings.md +2 -2
- package/src/commands/5/configure.md +39 -27
- package/src/commands/5/eject.md +110 -0
- package/src/commands/5/plan-feature.md +0 -1
- package/src/commands/5/plan-implementation.md +0 -1
- package/src/commands/5/quick-implement.md +0 -1
- package/src/commands/5/reconfigure.md +20 -17
- package/src/commands/5/update.md +16 -3
- package/src/hooks/statusline.js +80 -41
- package/src/skills/configure-docs-index/SKILL.md +196 -0
- package/src/skills/configure-skills/SKILL.md +314 -0
- package/src/skills/generate-readme/SKILL.md +1 -2
- package/src/templates/ARCHITECTURE.md +16 -47
- package/src/templates/CONCERNS.md +12 -54
- package/src/templates/TESTING.md +12 -95
- package/src/skills/build-project/SKILL.md +0 -151
- package/src/skills/configure-project/SKILL.md +0 -465
- package/src/skills/run-tests/SKILL.md +0 -162
- package/src/templates/CONVENTIONS.md +0 -75
- package/src/templates/INTEGRATIONS.md +0 -65
- package/src/templates/STACK.md +0 -60
- package/src/templates/STRUCTURE.md +0 -60
package/docs/workflow-guide.md
CHANGED
|
@@ -74,7 +74,7 @@ The installer copies workflow files to `.claude/` directory. **It does NOT creat
|
|
|
74
74
|
After completing these steps, you have:
|
|
75
75
|
- `.5/config.json` with your project settings
|
|
76
76
|
- `CLAUDE.md` with comprehensive project documentation
|
|
77
|
-
- `.5/
|
|
77
|
+
- `.5/ARCHITECTURE.md`, `.5/TESTING.md`, `.5/CONCERNS.md` with focused documentation
|
|
78
78
|
- Project-specific skills in `.claude/skills/`
|
|
79
79
|
|
|
80
80
|
**Without configuration, workflow commands will fail.**
|
package/package.json
CHANGED
|
@@ -296,8 +296,8 @@ If `gh api` is unavailable or fails, log the failure and continue. Do NOT abort
|
|
|
296
296
|
|
|
297
297
|
After all fixes are applied:
|
|
298
298
|
|
|
299
|
-
1. **Build:** Use the
|
|
300
|
-
2. **Test:** Use the
|
|
299
|
+
1. **Build:** Use the project's build skill (e.g., `run-build`) generated during configure
|
|
300
|
+
2. **Test:** Use the project's test skill (e.g., `run-tests`) generated during configure
|
|
301
301
|
3. **Lint:** Check for any lint warnings and errors
|
|
302
302
|
|
|
303
303
|
If build fails:
|
|
@@ -23,7 +23,7 @@ This command is **Phase 1** of the 5-phase workflow applied to project configura
|
|
|
23
23
|
After running this command, proceed through the standard phases:
|
|
24
24
|
1. **`/5:configure`** (this command) - Plan the configuration feature
|
|
25
25
|
2. `/5:plan-implementation CONFIGURE` - Create implementation plan
|
|
26
|
-
3. `/5:implement-feature CONFIGURE` - Execute configuration (uses `configure-
|
|
26
|
+
3. `/5:implement-feature CONFIGURE` - Execute configuration (uses `configure-docs-index` and `configure-skills`)
|
|
27
27
|
4. `/5:verify-implementation` - Verify configuration
|
|
28
28
|
5. `/5:review-code` - Review generated files
|
|
29
29
|
|
|
@@ -307,26 +307,32 @@ Write `.5/features/CONFIGURE/feature.md` containing all gathered data:
|
|
|
307
307
|
# Feature: Project Configuration
|
|
308
308
|
|
|
309
309
|
## Summary
|
|
310
|
-
Generates CLAUDE.md
|
|
310
|
+
Generates CLAUDE.md, a rebuildable codebase index, and project-specific skills. (config.json already written.)
|
|
311
311
|
|
|
312
312
|
## Requirements
|
|
313
313
|
|
|
314
314
|
### Requirement 1: Generate Documentation Files
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
- `.5/
|
|
321
|
-
- `.5/
|
|
322
|
-
- `.5/
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
-
|
|
315
|
+
Handled by: `configure-docs-index`
|
|
316
|
+
|
|
317
|
+
Analyze the codebase and generate focused documentation capturing only non-derivable knowledge (skip version numbers, dependency lists, directory layouts, linter configs — Claude Code can look these up directly):
|
|
318
|
+
|
|
319
|
+
**Create documentation files in `.5/` folder:**
|
|
320
|
+
- `.5/ARCHITECTURE.md` - Architecture pattern, layers & data flow, key abstractions, non-obvious conventions, where to add new code
|
|
321
|
+
- `.5/TESTING.md` - Test organization, patterns, mocking approach, gotchas
|
|
322
|
+
- `.5/CONCERNS.md` - Tech debt, known issues, security/integration/performance notes (**only if concerns found — skip file entirely if nothing detected**)
|
|
323
|
+
|
|
324
|
+
**Create a rebuildable codebase index in `.5/index/`:**
|
|
325
|
+
- Generate a repository-local script at `.5/index/rebuild-index.sh`
|
|
326
|
+
- Generate multiple focused Markdown index files in `.5/index/` plus `.5/index/README.md`
|
|
327
|
+
- Keep the index generic and adapted to the actual project
|
|
328
|
+
- Skip empty categories; do not create placeholder index files
|
|
329
|
+
- Re-running the script should fully refresh the index in place
|
|
330
|
+
|
|
331
|
+
**Create CLAUDE.md:**
|
|
328
332
|
- Project overview and build commands
|
|
329
|
-
-
|
|
333
|
+
- Links to whichever `.5/` documentation files were created
|
|
334
|
+
- Links to `.5/index/README.md`, the generated index files, and `.5/index/rebuild-index.sh`
|
|
335
|
+
- An explicit instruction that if the codebase index is older than one day, it should be regenerated by running `.5/index/rebuild-index.sh`
|
|
330
336
|
- Workflow rules section (verbatim):
|
|
331
337
|
```
|
|
332
338
|
## Workflow Rules
|
|
@@ -346,6 +352,7 @@ Analyze the codebase and generate modular documentation:
|
|
|
346
352
|
- If CLAUDE.md already exists, preserve user-written custom sections
|
|
347
353
|
|
|
348
354
|
### Requirement 2: Generate Project-Specific Skills
|
|
355
|
+
Handled by: `configure-skills`
|
|
349
356
|
|
|
350
357
|
**Create-* skills** for each user-selected architectural pattern:
|
|
351
358
|
- Skill name: `create-{pattern}` (e.g., `create-controller`, `create-service`)
|
|
@@ -360,6 +367,8 @@ Analyze the codebase and generate modular documentation:
|
|
|
360
367
|
Include only patterns/commands where user selected "Generate".
|
|
361
368
|
|
|
362
369
|
### Requirement 3: Generate Scoped Rules (if selected)
|
|
370
|
+
Handled by: `configure-skills`
|
|
371
|
+
|
|
363
372
|
Generate `.claude/rules/` files with project-specific conventions scoped to relevant file types.
|
|
364
373
|
Rules are concise directives (15-40 lines, NOT documentation) derived from codebase analysis.
|
|
365
374
|
Only generate rules for patterns that were actually detected:
|
|
@@ -370,17 +379,19 @@ Only generate rules for patterns that were actually detected:
|
|
|
370
379
|
|
|
371
380
|
## Acceptance Criteria
|
|
372
381
|
- [ ] `.5/` directory created
|
|
373
|
-
- [ ]
|
|
374
|
-
- [ ] `.5/ARCHITECTURE.md`
|
|
375
|
-
- [ ] `.5/
|
|
376
|
-
- [ ] `.5/
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
- [ ]
|
|
382
|
+
- [ ] Documentation files exist and contain only non-derivable knowledge:
|
|
383
|
+
- [ ] `.5/ARCHITECTURE.md` — architecture, conventions, where to add code
|
|
384
|
+
- [ ] `.5/TESTING.md` — test patterns and gotchas
|
|
385
|
+
- [ ] `.5/CONCERNS.md` — only if concerns were found (omit if empty)
|
|
386
|
+
- [ ] `.5/index/` directory exists
|
|
387
|
+
- [ ] `.5/index/rebuild-index.sh` exists and rebuilds the index
|
|
388
|
+
- [ ] `.5/index/README.md` exists and documents the generated index files
|
|
389
|
+
- [ ] Multiple focused `.5/index/*.md` files are generated for applicable codebase concerns
|
|
390
|
+
- [ ] Empty sections omitted (no "Not detected" / "None found" placeholders)
|
|
391
|
+
- [ ] `CLAUDE.md` exists with references to created `.5/` files
|
|
392
|
+
- [ ] `CLAUDE.md` links to the codebase index and rebuild script
|
|
393
|
+
- [ ] `CLAUDE.md` says to regenerate the index if it is older than one day
|
|
382
394
|
- [ ] CLAUDE.md contains 6 coding guidelines
|
|
383
|
-
- [ ] No placeholder text like `{YYYY-MM-DD}` remains unfilled
|
|
384
395
|
- [ ] All specified project-specific skills are generated in `.claude/skills/`
|
|
385
396
|
- [ ] Generated skills reference actual project conventions
|
|
386
397
|
- [ ] If CLAUDE.md existed before, user-written sections are preserved
|
|
@@ -404,4 +415,5 @@ Tell the user:
|
|
|
404
415
|
4. "After that: Continue with `/5:implement-feature CONFIGURE` -> `/5:verify-implementation` -> `/5:review-code` (clearing context between each phase)"
|
|
405
416
|
|
|
406
417
|
## Related Documentation
|
|
407
|
-
- [configure-
|
|
418
|
+
- [configure-docs-index skill](../../skills/configure-docs-index/SKILL.md)
|
|
419
|
+
- [configure-skills skill](../../skills/configure-skills/SKILL.md)
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 5:eject
|
|
3
|
+
description: Eject from the update mechanism — permanently removes update infrastructure
|
|
4
|
+
allowed-tools: Bash, Read, Edit, AskUserQuestion
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<role>
|
|
9
|
+
You are a Workflow Ejector. You permanently remove the update infrastructure from this installation.
|
|
10
|
+
After ejecting, you are DONE.
|
|
11
|
+
</role>
|
|
12
|
+
|
|
13
|
+
# Eject from Update Mechanism
|
|
14
|
+
|
|
15
|
+
Determine which runtime is installed before making any changes:
|
|
16
|
+
- Claude Code install: workflow files live in `.claude/`
|
|
17
|
+
- Codex install: workflow files live in `.codex/`
|
|
18
|
+
|
|
19
|
+
Use runtime-appropriate paths in every step below.
|
|
20
|
+
|
|
21
|
+
Ejecting permanently removes the update system from this installation. After ejecting:
|
|
22
|
+
- The update infrastructure files are deleted
|
|
23
|
+
- Version tracking (`.5/version.json`) is deleted
|
|
24
|
+
- The update cache (`.5/.update-cache.json`) is deleted
|
|
25
|
+
- Claude Code installs also remove the `check-updates.js` hook entry from `.claude/settings.json`
|
|
26
|
+
|
|
27
|
+
All other workflow files (commands, skills, hooks, templates) remain untouched.
|
|
28
|
+
|
|
29
|
+
**This is irreversible.** To restore update functionality, reinstall with `npx 5-phase-workflow`.
|
|
30
|
+
|
|
31
|
+
## Step 1: Check Current State
|
|
32
|
+
|
|
33
|
+
Read `.5/version.json`. If it doesn't exist, tell the user: "No 5-Phase Workflow installation found (or already ejected)." and stop.
|
|
34
|
+
|
|
35
|
+
Note the `packageVersion` for the confirmation message.
|
|
36
|
+
|
|
37
|
+
## Step 2: Confirm with User
|
|
38
|
+
|
|
39
|
+
Tell the user what ejecting means:
|
|
40
|
+
|
|
41
|
+
> **Eject from 5-Phase Workflow updates?**
|
|
42
|
+
>
|
|
43
|
+
> This will permanently delete:
|
|
44
|
+
> - `.5/version.json` (version tracking)
|
|
45
|
+
> - `.5/.update-cache.json` (update cache)
|
|
46
|
+
>
|
|
47
|
+
> For Claude Code installs:
|
|
48
|
+
> - `.claude/hooks/check-updates.js` (update check hook)
|
|
49
|
+
> - `.claude/commands/5/update.md` (update command)
|
|
50
|
+
> - `.claude/commands/5/eject.md` (this command)
|
|
51
|
+
> - The `check-updates.js` hook entry in `.claude/settings.json`
|
|
52
|
+
>
|
|
53
|
+
> For Codex installs:
|
|
54
|
+
> - `.codex/skills/5-update/` (update skill)
|
|
55
|
+
> - `.codex/skills/5-eject/` (this skill)
|
|
56
|
+
> - `.codex/instructions.md` is removed only if it is workflow-managed and no longer needed for remaining installed workflow files
|
|
57
|
+
>
|
|
58
|
+
> All other workflow files remain untouched. To restore updates later, reinstall with `npx 5-phase-workflow`.
|
|
59
|
+
|
|
60
|
+
Ask: "Proceed with eject?"
|
|
61
|
+
|
|
62
|
+
If the user declines, stop here.
|
|
63
|
+
|
|
64
|
+
## Step 3: Delete Update Files
|
|
65
|
+
|
|
66
|
+
Run this command to delete the update-related files:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
rm -f .claude/hooks/check-updates.js .claude/commands/5/update.md .claude/commands/5/eject.md .5/version.json .5/.update-cache.json
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For Codex installs, remove the runtime-appropriate files instead:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
rm -rf .codex/skills/5-update .codex/skills/5-eject
|
|
76
|
+
rm -f .5/version.json .5/.update-cache.json
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Step 4: Clean Up settings.json
|
|
80
|
+
|
|
81
|
+
Claude Code installs only: read `.claude/settings.json`. Remove the hook entry from the `hooks.SessionStart` array where the command is `node .claude/hooks/check-updates.js`.
|
|
82
|
+
|
|
83
|
+
Codex installs do not use `.claude/settings.json` or Claude hooks for updates, so skip this step for Codex.
|
|
84
|
+
|
|
85
|
+
Specifically, find and remove the object in the `SessionStart` array that looks like:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"matcher": "startup",
|
|
90
|
+
"hooks": [
|
|
91
|
+
{
|
|
92
|
+
"type": "command",
|
|
93
|
+
"command": "node .claude/hooks/check-updates.js",
|
|
94
|
+
"timeout": 10
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
If the `SessionStart` array becomes empty after removal, remove the `SessionStart` key entirely. Write the updated settings back.
|
|
101
|
+
|
|
102
|
+
## Step 5: Confirm
|
|
103
|
+
|
|
104
|
+
Tell the user:
|
|
105
|
+
|
|
106
|
+
> Ejected successfully. Update infrastructure has been removed from this installation (was v{packageVersion}).
|
|
107
|
+
>
|
|
108
|
+
> To restore update functionality, reinstall with: `npx 5-phase-workflow`
|
|
109
|
+
>
|
|
110
|
+
> If this was a Codex install, use: `npx 5-phase-workflow --codex`
|
|
@@ -3,7 +3,6 @@ name: 5:quick-implement
|
|
|
3
3
|
description: Execute small, focused implementations quickly with state tracking and atomic commits. Skips extensive planning phases and verification agents - use for tasks where you know exactly what to do.
|
|
4
4
|
allowed-tools: Read, Write, Edit, Glob, Grep, Bash, Task, AskUserQuestion, Skill, TaskCreate, TaskUpdate, TaskList, mcp__jetbrains__*
|
|
5
5
|
user-invocable: true
|
|
6
|
-
context: fork
|
|
7
6
|
---
|
|
8
7
|
|
|
9
8
|
<role>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: 5:reconfigure
|
|
3
|
-
description: Lightweight refresh of project documentation and skills without full Q&A. Re-detects codebase changes, regenerates .5/*.md docs, updates CLAUDE.md, and refreshes all skills.
|
|
3
|
+
description: Lightweight refresh of project documentation, codebase index, and skills without full Q&A. Re-detects codebase changes, regenerates .5/*.md docs, rebuilds .5/index/, updates CLAUDE.md, and refreshes all skills.
|
|
4
4
|
allowed-tools: Read, Write, Bash, Glob, Grep, Task, AskUserQuestion
|
|
5
5
|
user-invocable: true
|
|
6
6
|
context: fork
|
|
@@ -9,7 +9,7 @@ context: fork
|
|
|
9
9
|
<role>
|
|
10
10
|
You are a Project Reconfigurer. You refresh documentation and skills using existing config.json preferences.
|
|
11
11
|
You do NOT modify user preferences (ticket patterns, review tools, branch conventions, etc.).
|
|
12
|
-
You detect codebase changes, confirm with the user, invoke
|
|
12
|
+
You detect codebase changes, confirm with the user, invoke the configuration refresh skills, then report.
|
|
13
13
|
After reporting what was updated, you are DONE.
|
|
14
14
|
</role>
|
|
15
15
|
|
|
@@ -37,7 +37,7 @@ Your job:
|
|
|
37
37
|
✅ Re-detect codebase patterns and commands (same as configure Steps 1b-1h)
|
|
38
38
|
✅ Compare detected state with config.json skill selections
|
|
39
39
|
✅ Show summary and ask for confirmation
|
|
40
|
-
✅ Invoke configure-
|
|
40
|
+
✅ Invoke `configure-docs-index` and `configure-skills` in refresh mode
|
|
41
41
|
✅ Update version.json with artifacts and timestamps
|
|
42
42
|
✅ Clean up .reconfig-reminder flag
|
|
43
43
|
✅ Report what was updated
|
|
@@ -117,7 +117,7 @@ Use the existing skills in `.claude/skills/` (from Step 2e) as the source of tru
|
|
|
117
117
|
|
|
118
118
|
Use `AskUserQuestion` to show a summary and get confirmation. Present:
|
|
119
119
|
|
|
120
|
-
1. **Documentation files that will be rewritten** — list
|
|
120
|
+
1. **Documentation files that will be rewritten** — list `.5/ARCHITECTURE.md`, `.5/TESTING.md`, `.5/CONCERNS.md` (conditional), `.5/index/rebuild-index.sh`, `.5/index/*.md`, and `CLAUDE.md`
|
|
121
121
|
2. **Skills that will be refreshed** — list ALL skills found in `.claude/skills/` (both workflow-generated and user-created)
|
|
122
122
|
3. **Rules that will be refreshed** (if rules enabled) — list workflow-generated rule files in `.claude/rules/`
|
|
123
123
|
4. **New patterns detected** (if any) — "These patterns were found in your codebase but don't have skills yet: [list]. Create skills for them?"
|
|
@@ -134,10 +134,14 @@ New skills will be created and stale skills removed based on the user's choices.
|
|
|
134
134
|
|
|
135
135
|
### Step 5: Regenerate
|
|
136
136
|
|
|
137
|
-
Invoke the
|
|
137
|
+
Invoke the refresh skills in **refresh mode** via the Task tool:
|
|
138
138
|
|
|
139
139
|
```
|
|
140
|
-
Task prompt: "Run configure-
|
|
140
|
+
Task prompt 1: "Run configure-docs-index skill in REFRESH MODE.
|
|
141
|
+
|
|
142
|
+
Refresh the generated documentation, rebuild the codebase index in `.5/index/`, delete legacy docs if they exist, and update `CLAUDE.md` while preserving user-written sections."
|
|
143
|
+
|
|
144
|
+
Task prompt 2: "Run configure-skills skill in REFRESH MODE.
|
|
141
145
|
|
|
142
146
|
Refresh ALL existing skills in .claude/skills/:
|
|
143
147
|
- Existing create-* skills: [list from Step 2e]
|
|
@@ -150,16 +154,13 @@ Refresh rules in .claude/rules/ (if rules.generate is true):
|
|
|
150
154
|
- Existing workflow rules: [list from Step 2f]
|
|
151
155
|
- Rules to remove: [list from user confirmation, if any]
|
|
152
156
|
- New rules to create: [if applicable]
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
6. Refresh all workflow-generated rule files in .claude/rules/ with updated conventions
|
|
161
|
-
7. Create new rule files for newly-detected patterns
|
|
162
|
-
8. Remove rule files the user chose to drop"
|
|
157
|
+
Re-analyze the codebase and:
|
|
158
|
+
1. Refresh ALL skills in .claude/skills/ — read current conventions from codebase and update each skill
|
|
159
|
+
2. Create new skills for newly-added patterns
|
|
160
|
+
3. Remove skills the user chose to drop
|
|
161
|
+
4. Refresh all workflow-generated rule files in .claude/rules/ with updated conventions
|
|
162
|
+
5. Create new rule files for newly-detected patterns
|
|
163
|
+
6. Remove rule files the user chose to drop"
|
|
163
164
|
```
|
|
164
165
|
|
|
165
166
|
Use `subagent_type: "general-purpose"` for the Task.
|
|
@@ -184,6 +185,7 @@ rm -f .5/.reconfig-reminder
|
|
|
184
185
|
|
|
185
186
|
Show the user a summary:
|
|
186
187
|
- List of documentation files updated
|
|
188
|
+
- Mention whether the codebase index script and index files were regenerated
|
|
187
189
|
- List of skills refreshed
|
|
188
190
|
- List of new skills created (if any)
|
|
189
191
|
- List of skills removed (if any)
|
|
@@ -195,4 +197,5 @@ Show the user a summary:
|
|
|
195
197
|
|
|
196
198
|
## Related Documentation
|
|
197
199
|
- [configure command](./configure.md) — full Q&A configuration
|
|
198
|
-
- [configure-
|
|
200
|
+
- [configure-docs-index skill](../../skills/configure-docs-index/SKILL.md)
|
|
201
|
+
- [configure-skills skill](../../skills/configure-skills/SKILL.md)
|
package/src/commands/5/update.md
CHANGED
|
@@ -25,6 +25,12 @@ Read `.5/version.json` and note the current `installedVersion`.
|
|
|
25
25
|
npx 5-phase-workflow@latest --upgrade
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
If this installation is running in Codex (workflow files live in `.codex/` or the workflow command was invoked as a `$5-...` skill), run this instead:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx 5-phase-workflow@latest --codex --upgrade
|
|
32
|
+
```
|
|
33
|
+
|
|
28
34
|
## Step 3: Confirm Upgrade
|
|
29
35
|
|
|
30
36
|
Read `.5/version.json` again. Compare the new `installedVersion` to the previous one.
|
|
@@ -34,14 +40,16 @@ Read `.5/version.json` again. Compare the new `installedVersion` to the previous
|
|
|
34
40
|
|
|
35
41
|
## Step 4: Show What Changed
|
|
36
42
|
|
|
37
|
-
Run `git status` to show the files modified by the upgrade. Summarize the changes for the user
|
|
43
|
+
Run `git status` to show the files modified by the upgrade. Summarize the changes for the user using the correct runtime paths:
|
|
44
|
+
- Claude Code installs typically update files in `.claude/commands/5/`, `.claude/skills/`, `.claude/hooks/`, `.claude/templates/`, `.claude/settings.json`, and `.5/version.json`
|
|
45
|
+
- Codex installs typically update files in `.codex/skills/`, `.codex/templates/`, `.codex/references/`, `.codex/instructions.md`, and `.5/version.json`
|
|
38
46
|
|
|
39
47
|
## Step 5: Ask to Commit
|
|
40
48
|
|
|
41
49
|
Ask the user: "Would you like to commit the upgraded workflow files?"
|
|
42
50
|
|
|
43
51
|
Options:
|
|
44
|
-
1. **Yes** - commit the changes, do not mention
|
|
52
|
+
1. **Yes** - commit the changes, do not mention Claude Code
|
|
45
53
|
2. **No** - leave changes uncommitted
|
|
46
54
|
|
|
47
55
|
If the user chooses **No**, stop here.
|
|
@@ -56,6 +64,11 @@ Build the commit message by applying the pattern:
|
|
|
56
64
|
- If the pattern is the conventional format (`feat({ticket-id}): {short-description}`), use: `chore: update 5-Phase Workflow to {new-version}`
|
|
57
65
|
- If no config or no pattern, use: `update 5-Phase Workflow to {new-version}`
|
|
58
66
|
|
|
59
|
-
Stage **only** the workflow-managed files shown in `git status
|
|
67
|
+
Stage **only** the workflow-managed files shown in `git status`.
|
|
68
|
+
|
|
69
|
+
- For Claude Code installs, this usually means files inside `.claude/commands/5/`, `.claude/skills/`, `.claude/hooks/`, `.claude/templates/`, `.claude/settings.json`, and `.5/version.json`
|
|
70
|
+
- For Codex installs, this usually means files inside `.codex/skills/`, `.codex/templates/`, `.codex/references/`, `.codex/instructions.md`, and `.5/version.json`
|
|
71
|
+
|
|
72
|
+
Never use `git add .` or `git add -A`.
|
|
60
73
|
|
|
61
74
|
Create the commit. Report success to the user.
|
package/src/hooks/statusline.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Claude Code Statusline
|
|
3
|
-
// Shows: model |
|
|
3
|
+
// Shows: model | folder | branch | off-peak | 5hr-usage | cost | context | reset-time
|
|
4
4
|
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const path = require('path');
|
|
7
|
-
const
|
|
7
|
+
const { execSync } = require('child_process');
|
|
8
8
|
|
|
9
9
|
// Read JSON from stdin
|
|
10
10
|
let input = '';
|
|
@@ -13,77 +13,116 @@ process.stdin.on('data', chunk => input += chunk);
|
|
|
13
13
|
process.stdin.on('end', () => {
|
|
14
14
|
try {
|
|
15
15
|
const data = JSON.parse(input);
|
|
16
|
+
const parts = [];
|
|
17
|
+
|
|
18
|
+
// 🤖 Model
|
|
16
19
|
const model = data.model?.display_name || 'Claude';
|
|
20
|
+
parts.push(`\x1b[36m🤖 ${model}\x1b[0m`);
|
|
21
|
+
|
|
22
|
+
// 📁 Folder (basename only)
|
|
17
23
|
const dir = data.workspace?.current_dir || process.cwd();
|
|
18
|
-
const
|
|
19
|
-
|
|
24
|
+
const folderName = path.basename(dir);
|
|
25
|
+
parts.push(`\x1b[90m📁 ${folderName}\x1b[0m`);
|
|
20
26
|
|
|
21
|
-
//
|
|
22
|
-
let
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
// 🌿 Branch
|
|
28
|
+
let branch = data.worktree?.branch || '';
|
|
29
|
+
if (!branch) {
|
|
30
|
+
try {
|
|
31
|
+
branch = execSync('git rev-parse --abbrev-ref HEAD', {
|
|
32
|
+
encoding: 'utf8', cwd: dir, stdio: ['pipe', 'pipe', 'pipe']
|
|
33
|
+
}).trim();
|
|
34
|
+
} catch (e) { branch = ''; }
|
|
35
|
+
}
|
|
36
|
+
if (branch && branch !== 'HEAD') {
|
|
37
|
+
parts.push(`\x1b[32m🌿 ${branch}\x1b[0m`);
|
|
38
|
+
}
|
|
26
39
|
|
|
27
|
-
|
|
40
|
+
// 🚀 Off-peak indicator (weekdays before 5 AM or after 11 AM PT; all weekends)
|
|
41
|
+
// PT = UTC-8 (PST) or UTC-7 (PDT). Use UTC-7 as approximation (covers PDT/PST conservatively).
|
|
42
|
+
const nowUtc = new Date();
|
|
43
|
+
const ptHour = (nowUtc.getUTCHours() - 7 + 24) % 24; // approximate PT
|
|
44
|
+
const ptDay = new Date(nowUtc.getTime() - 7 * 3600 * 1000).getUTCDay(); // 0=Sun,6=Sat
|
|
45
|
+
const isWeekend = ptDay === 0 || ptDay === 6;
|
|
46
|
+
const isPeak = !isWeekend && ptHour >= 5 && ptHour < 11;
|
|
47
|
+
if (!isPeak) {
|
|
48
|
+
parts.push('\x1b[32m🚀 off-peak\x1b[0m');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ⚡ 5-hour session usage
|
|
52
|
+
const fiveHrUsed = data.rate_limits?.five_hour?.used_percentage;
|
|
53
|
+
if (fiveHrUsed != null) {
|
|
54
|
+
const pct = Math.round(fiveHrUsed);
|
|
55
|
+
const color = pct < 50 ? '\x1b[32m' : pct < 75 ? '\x1b[33m' : '\x1b[31m';
|
|
56
|
+
parts.push(`${color}⚡ ${pct}%\x1b[0m`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// 💰 Cost
|
|
60
|
+
const costUsd = data.cost?.total_cost_usd;
|
|
61
|
+
if (costUsd != null) {
|
|
62
|
+
const fmt = costUsd < 0.01 ? costUsd.toFixed(3) : costUsd.toFixed(2);
|
|
63
|
+
parts.push(`\x1b[33m💰 $${fmt}\x1b[0m`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// 📊 Context window (progress bar)
|
|
67
|
+
const ctxUsed = data.context_window?.used_percentage;
|
|
68
|
+
const ctxRemaining = data.context_window?.remaining_percentage;
|
|
69
|
+
if (ctxUsed != null || ctxRemaining != null) {
|
|
70
|
+
const used = ctxUsed != null
|
|
71
|
+
? Math.round(ctxUsed)
|
|
72
|
+
: Math.max(0, Math.min(100, 100 - Math.round(ctxRemaining)));
|
|
28
73
|
const filled = Math.floor(used / 10);
|
|
29
74
|
const bar = '█'.repeat(filled) + '░'.repeat(10 - filled);
|
|
75
|
+
let color;
|
|
76
|
+
if (used < 50) color = '\x1b[32m';
|
|
77
|
+
else if (used < 65) color = '\x1b[33m';
|
|
78
|
+
else if (used < 80) color = '\x1b[38;5;208m';
|
|
79
|
+
else color = '\x1b[5;31m';
|
|
80
|
+
parts.push(`${color}🧠 ${bar} ${used}%\x1b[0m`);
|
|
81
|
+
}
|
|
30
82
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
83
|
+
// ⏱ Reset time (time until 5hr window resets)
|
|
84
|
+
const resetAt = data.rate_limits?.five_hour?.resets_at;
|
|
85
|
+
if (resetAt) {
|
|
86
|
+
const remaining = resetAt - Math.floor(Date.now() / 1000);
|
|
87
|
+
if (remaining > 0) {
|
|
88
|
+
const h = Math.floor(remaining / 3600);
|
|
89
|
+
const m = Math.floor((remaining % 3600) / 60);
|
|
90
|
+
const label = h > 0 ? `${h}h${m}m` : `${m}m`;
|
|
91
|
+
parts.push(`\x1b[90m⏱ ${label}\x1b[0m`);
|
|
40
92
|
}
|
|
41
93
|
}
|
|
42
94
|
|
|
43
|
-
//
|
|
44
|
-
const shortDir = dir.replace(os.homedir(), '~');
|
|
45
|
-
|
|
46
|
-
// Check for available update and reconfigure reminder
|
|
47
|
-
let updateIndicator = '';
|
|
48
|
-
let reconfigIndicator = '';
|
|
95
|
+
// Update and reconfigure indicators
|
|
49
96
|
try {
|
|
50
97
|
const versionFile = path.join(dir, '.5', 'version.json');
|
|
51
98
|
const versionData = JSON.parse(fs.readFileSync(versionFile, 'utf8'));
|
|
52
99
|
|
|
53
|
-
// Update check — read latestAvailableVersion from cache file (gitignored)
|
|
54
100
|
const cacheFile = path.join(dir, '.5', '.update-cache.json');
|
|
55
101
|
let latest = null;
|
|
56
102
|
if (fs.existsSync(cacheFile)) {
|
|
57
103
|
try {
|
|
58
104
|
const cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
|
|
59
105
|
latest = cache.latestAvailableVersion || null;
|
|
60
|
-
} catch(e) {}
|
|
106
|
+
} catch (e) {}
|
|
61
107
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
updateIndicator = ` | \x1b[33m↑${latest} → /5:update\x1b[0m`;
|
|
108
|
+
if (latest && versionData.packageVersion && compareVersions(versionData.packageVersion, latest) < 0) {
|
|
109
|
+
parts.push(`\x1b[33m↑${latest} → /5:update\x1b[0m`);
|
|
65
110
|
}
|
|
66
111
|
|
|
67
|
-
// Reconfigure check (reads flag file in .5/, gitignored)
|
|
68
112
|
const flagFile = path.join(dir, '.5', '.reconfig-reminder');
|
|
69
113
|
if (fs.existsSync(flagFile)) {
|
|
70
|
-
|
|
114
|
+
parts.push(`\x1b[35m↻ /5:reconfigure\x1b[0m`);
|
|
71
115
|
}
|
|
72
|
-
} catch (e) {
|
|
73
|
-
// No version file or parse error — no indicator
|
|
74
|
-
}
|
|
116
|
+
} catch (e) {}
|
|
75
117
|
|
|
76
|
-
|
|
77
|
-
const statusline = `\x1b[36m${model}\x1b[0m | \x1b[90m${shortDir}\x1b[0m${ctx}${updateIndicator}${reconfigIndicator}`;
|
|
78
|
-
process.stdout.write(statusline);
|
|
118
|
+
process.stdout.write(parts.join(' | '));
|
|
79
119
|
|
|
80
120
|
} catch (e) {
|
|
81
|
-
// Silent fail
|
|
121
|
+
// Silent fail — don't break statusline on parse errors
|
|
82
122
|
}
|
|
83
123
|
});
|
|
84
124
|
|
|
85
125
|
// Compare semver versions: returns -1 if v1 < v2, 0 if equal, 1 if v1 > v2
|
|
86
|
-
// Uses parseInt to handle pre-release tags (e.g., "2-beta" → 2)
|
|
87
126
|
function compareVersions(v1, v2) {
|
|
88
127
|
const parts1 = v1.split('.').map(p => parseInt(p, 10) || 0);
|
|
89
128
|
const parts2 = v2.split('.').map(p => parseInt(p, 10) || 0);
|
|
@@ -92,4 +131,4 @@ function compareVersions(v1, v2) {
|
|
|
92
131
|
if (parts1[i] < parts2[i]) return -1;
|
|
93
132
|
}
|
|
94
133
|
return 0;
|
|
95
|
-
}
|
|
134
|
+
}
|