@leocm/flowcraft 2.1.0 → 2.3.0

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 (96) hide show
  1. package/README.md +19 -2
  2. package/bin/cli.js +108 -108
  3. package/flowcraft.yaml +30 -30
  4. package/install.sh +24 -24
  5. package/lib/args.js +38 -38
  6. package/lib/config.js +20 -20
  7. package/lib/copy.js +131 -131
  8. package/lib/fix.js +110 -110
  9. package/lib/fsutil.js +104 -104
  10. package/lib/global.js +229 -229
  11. package/lib/init.js +43 -43
  12. package/lib/runtime.js +84 -84
  13. package/lib/version.js +55 -55
  14. package/lib/wizard.js +125 -125
  15. package/package.json +33 -33
  16. package/presets/backend.yaml +20 -20
  17. package/presets/default.yaml +15 -15
  18. package/presets/frontend.yaml +20 -20
  19. package/presets/quick-fix.yaml +15 -15
  20. package/setup/.claude/hooks/check-phase-test.py +152 -152
  21. package/setup/.claude/hooks/check-phase-write.py +235 -235
  22. package/setup/.claude/hooks/dispatch.py +67 -67
  23. package/setup/.claude/hooks/file-suggestion.py +45 -45
  24. package/setup/.claude/hooks/flowcraft_env.py +162 -137
  25. package/setup/.claude/hooks/permission-request.py +132 -125
  26. package/setup/.claude/hooks/post-tool-failure.py +36 -36
  27. package/setup/.claude/hooks/pre-compact.py +66 -66
  28. package/setup/.claude/hooks/review-runner.py +846 -846
  29. package/setup/.claude/hooks/setup-keys.py +282 -282
  30. package/setup/.claude/hooks/statusline.py +63 -63
  31. package/setup/.claude/hooks/stop-check.py +186 -171
  32. package/setup/.claude/hooks/subagent-start.py +50 -50
  33. package/setup/.claude/hooks/subagent-stop.py +63 -63
  34. package/setup/.claude/hooks/task-completed.py +57 -57
  35. package/setup/.claude/hooks/task_manager.py +592 -592
  36. package/setup/.claude/hooks/user-prompt-submit.py +91 -85
  37. package/setup/.claude/settings.json +233 -237
  38. package/setup/.claude/skills/Pstatus/SKILL.md +68 -68
  39. package/setup/.claude/skills/archive/SKILL.md +195 -195
  40. package/setup/.claude/skills/brainstorming/SKILL.md +5 -5
  41. package/setup/.claude/skills/brainstorming/scripts/server.cjs +723 -723
  42. package/setup/.claude/skills/brainstorming/scripts/start-server.py +245 -245
  43. package/setup/.claude/skills/brainstorming/scripts/stop-server.py +178 -178
  44. package/setup/.claude/skills/brainstorming/visual-companion.md +298 -298
  45. package/setup/.claude/skills/chrome-integration/SKILL.md +66 -66
  46. package/setup/.claude/skills/code-review/SKILL.md +264 -264
  47. package/setup/.claude/skills/executing-plans/SKILL.md +1 -1
  48. package/setup/.claude/skills/gitnexus/gitnexus-cli/SKILL.md +67 -67
  49. package/setup/.claude/skills/gitnexus/gitnexus-debugging/SKILL.md +1 -1
  50. package/setup/.claude/skills/gitnexus/gitnexus-exploring/SKILL.md +1 -1
  51. package/setup/.claude/skills/gitnexus/gitnexus-guide/SKILL.md +1 -1
  52. package/setup/.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +1 -1
  53. package/setup/.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md +1 -1
  54. package/setup/.claude/skills/methodology/SKILL.md +124 -0
  55. package/setup/.claude/skills/phase/SKILL.md +62 -62
  56. package/setup/.claude/skills/playwright/SKILL.md +85 -85
  57. package/setup/.claude/skills/review/SKILL.md +97 -97
  58. package/setup/.claude/skills/task/SKILL.md +26 -26
  59. package/setup/.claude/skills/test-driven-development/SKILL.md +1 -1
  60. package/setup/.claude/skills/ui-ux-pro-max/SKILL.md +1 -1
  61. package/setup/.claude/skills/verification-before-completion/SKILL.md +1 -1
  62. package/setup/.claude/skills/writing-plans/SKILL.md +1 -1
  63. package/setup/.codex/.agents/skills/archive/SKILL.md +195 -195
  64. package/setup/.codex/.agents/skills/brainstorming/SKILL.md +5 -5
  65. package/setup/.codex/.agents/skills/brainstorming/scripts/server.cjs +723 -723
  66. package/setup/.codex/.agents/skills/brainstorming/scripts/start-server.py +245 -245
  67. package/setup/.codex/.agents/skills/brainstorming/scripts/stop-server.py +178 -178
  68. package/setup/.codex/.agents/skills/brainstorming/visual-companion.md +298 -298
  69. package/setup/.codex/.agents/skills/chrome-integration/SKILL.md +66 -66
  70. package/setup/.codex/.agents/skills/code-review/SKILL.md +264 -264
  71. package/setup/.codex/.agents/skills/executing-plans/SKILL.md +1 -1
  72. package/setup/.codex/.agents/skills/gitnexus/gitnexus-cli/SKILL.md +67 -67
  73. package/setup/.codex/.agents/skills/gitnexus/gitnexus-debugging/SKILL.md +1 -1
  74. package/setup/.codex/.agents/skills/gitnexus/gitnexus-exploring/SKILL.md +1 -1
  75. package/setup/.codex/.agents/skills/gitnexus/gitnexus-guide/SKILL.md +1 -1
  76. package/setup/.codex/.agents/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +1 -1
  77. package/setup/.codex/.agents/skills/gitnexus/gitnexus-refactoring/SKILL.md +1 -1
  78. package/setup/.codex/.agents/skills/methodology/SKILL.md +124 -0
  79. package/setup/.codex/.agents/skills/phase/SKILL.md +62 -62
  80. package/setup/.codex/.agents/skills/playwright/SKILL.md +85 -85
  81. package/setup/.codex/.agents/skills/review/SKILL.md +97 -97
  82. package/setup/.codex/.agents/skills/task/SKILL.md +27 -27
  83. package/setup/.codex/.agents/skills/test-driven-development/SKILL.md +1 -1
  84. package/setup/.codex/.agents/skills/ui-ux-pro-max/SKILL.md +1 -1
  85. package/setup/.codex/.agents/skills/verification-before-completion/SKILL.md +1 -1
  86. package/setup/.codex/.agents/skills/writing-plans/SKILL.md +1 -1
  87. package/setup/.codex/hooks/review-runner.py +851 -851
  88. package/setup/.codex/hooks/setup-keys.py +287 -287
  89. package/setup/AGENTS.md +11 -1
  90. package/setup/CLAUDE.md +11 -1
  91. package/setup/install.sh +24 -24
  92. package/setup/tests/test_decision_timeout.py +241 -241
  93. package/setup/tests/test_hook_guards.py +357 -357
  94. package/setup/tests/test_sdlc_bootstrap.py +167 -167
  95. package/setup/tests/test_sessionlog_switch.py +199 -0
  96. package/setup/tests/test_task_manager.py +148 -148
@@ -1,98 +1,98 @@
1
- ---
2
- name: review
3
- description: "P4 comprehensive review: code quality, test coverage, integration, PRD traceability. | 触发词:审查/检查/review"
4
- argument-hint: "[filepath]"
5
- context: fork
6
- allowed-tools:
7
- - Read
8
- - Glob
9
- - Grep
10
- - Bash
11
- - Edit
12
- hooks:
13
- Stop:
14
- - hooks:
15
- - type: command
16
- command: "echo '{\"hookSpecificOutput\":{\"additionalContext\":\"Ensure before review completes: (1) report written to .claude/reviews/ (2) all checklist items marked pass/fail\"}}'"
17
- ---
18
- > **P4 跨模型审查 (Cross-model review, 双跑合并)**: 当前模型 + 用户选定模型各审一次并合并(相同则只跑一次)。Codex 侧用 codex CLI、Claude 侧用 claude CLI(互不串)。脚本:python .codex/hooks/review-runner.py / python ~/.flowcraft/hooks/review-runner.py;provider/base_url/model/context/key 以各自目录 api-keys.json 为准,由 setup-keys.py 自动发现 settings.json + 清单选择生成,不写死;用户选择未配置模型时先确认 base_url/context/key/model。
19
-
20
-
21
- Usage: `/review [file path]`
22
-
23
- Arguments: $ARGUMENTS
24
-
25
- ---
26
-
27
- ## Core principle (核心原则)
28
-
29
- **P4 is the only formal review gate**, covering code quality + test quality + integration consistency + PRD traceability. No other phase requires review. Running `/review` outside P4 → prompt "当前阶段无需审查" (no review needed in this phase).
30
-
31
- Review flow: auto-detect project type (see 06-review-tools.md) → install missing tools → run tools to collect output → run the review checklist based on output → generate report to `.claude/reviews/P4-review-{time}.md`
32
-
33
- ---
34
-
35
- ## Tool execution (工具执行, must run before review)
36
-
37
- **All Bash commands on a single line.** Auto-install tools when missing (see 06-review-tools.md).
38
-
39
- ### Code toolchain (Node.js example; other languages see 06-review-tools.md)
40
- - **Lint**: `npx eslint . 2>&1; echo "LINT_EXIT=$?"`
41
- - **Typecheck**: `npx tsc --noEmit 2>&1; echo "TSC_EXIT=$?"`
42
- - **Build**: `npm run build 2>&1; echo "BUILD_EXIT=$?"`
43
- - **Dependency audit**: `npm audit 2>&1; echo "AUDIT_EXIT=$?"`
44
-
45
- ### Test verification
46
- **Run tests only once; analyze from the output file. Max 3 test runs per review.**
47
-
48
- 1. Run: `npx vitest run --coverage 2>&1 | tee /tmp/sdlc-test-output.txt; echo "TEST_EXIT=${PIPESTATUS[0]}"`
49
- 2. Read: read `/tmp/sdlc-test-output.txt` to extract results
50
- 3. On failure: collect all errors at once → batch-fix → run once more to verify
51
-
52
- ---
53
-
54
- ## Review checklist (审查清单)
55
-
56
- ### 5.1 Code quality
57
- - [ ] **Lint + Typecheck + Build + dependency security** pass (0 errors, no high/critical vulnerabilities)
58
- - [ ] Code standards per 02-coding-standards.md + no security holes + no redundant code
59
-
60
- ### 5.2 Test quality
61
- - [ ] **Every PRD requirement has a corresponding test** + all tests pass
62
- - [ ] **Coverage**: line ≥80%, key business ≥90%, branch ≥70%
63
-
64
- ### 5.3 Integration consistency + PRD traceability
65
- - [ ] **PRD four-ring traceability** — requirement→design→code file:line→test case, no broken links
66
- - [ ] **No out-of-PRD changes** + global consistency + security + performance + no missed TODO/FIXME
67
-
68
- ### 5.4 Delivery readiness
69
- - [ ] No sensitive info + reasonable commit granularity + docs updated as needed
70
-
71
- ---
72
-
73
- ## Output format (输出格式, concise)
74
- ```
75
- # P4 Comprehensive Review Report (P4 综合审查报告)
76
-
77
- **Toolchain**: Lint ✅ | Typecheck ✅ | Build ✅ | Dependencies ✅
78
- **Tests**: passed {n} / failed {n} / coverage {n}%
79
-
80
- **Review results**:
81
- - 5.1 Code quality: ✅
82
- - 5.2 Test quality: ✅
83
- - 5.3 Integration+PRD: ✅
84
- - 5.4 Delivery ready: ✅
85
-
86
- **PRD traceability**: R1→src/foo.ts:10-50→test/foo.test.ts ✅ | R2→src/bar.ts:5-30→test/bar.test.ts ✅
87
-
88
- **Issues**: {none / [severity] description → suggestion}
89
- **Conclusion**: {pass / needs changes}
90
- ```
91
-
92
- ---
93
-
94
- ## Handling failures (未通过处理)
95
-
96
- - Code issues → back to P2 to fix
97
- - Test issues → back to P3 to add/fix
1
+ ---
2
+ name: review
3
+ description: "P4 comprehensive review: code quality, test coverage, integration, PRD traceability. | 触发词:审查/检查/review"
4
+ argument-hint: "[filepath]"
5
+ context: fork
6
+ allowed-tools:
7
+ - Read
8
+ - Glob
9
+ - Grep
10
+ - Bash
11
+ - Edit
12
+ hooks:
13
+ Stop:
14
+ - hooks:
15
+ - type: command
16
+ command: "echo '{\"hookSpecificOutput\":{\"additionalContext\":\"Ensure before review completes: (1) report written to .claude/reviews/ (2) all checklist items marked pass/fail\"}}'"
17
+ ---
18
+ > **P4 跨模型审查 (Cross-model review, 双跑合并)**: 当前模型 + 用户选定模型各审一次并合并(相同则只跑一次)。Codex 侧用 codex CLI、Claude 侧用 claude CLI(互不串)。脚本:python .codex/hooks/review-runner.py / python ~/.flowcraft/hooks/review-runner.py;provider/base_url/model/context/key 以各自目录 api-keys.json 为准,由 setup-keys.py 自动发现 settings.json + 清单选择生成,不写死;用户选择未配置模型时先确认 base_url/context/key/model。
19
+
20
+
21
+ Usage: `/review [file path]`
22
+
23
+ Arguments: $ARGUMENTS
24
+
25
+ ---
26
+
27
+ ## Core principle (核心原则)
28
+
29
+ **P4 is the only formal review gate**, covering code quality + test quality + integration consistency + PRD traceability. No other phase requires review. Running `/review` outside P4 → prompt "当前阶段无需审查" (no review needed in this phase).
30
+
31
+ Review flow: auto-detect project type (see 06-review-tools.md) → install missing tools → run tools to collect output → run the review checklist based on output → generate report to `.claude/reviews/P4-review-{time}.md`
32
+
33
+ ---
34
+
35
+ ## Tool execution (工具执行, must run before review)
36
+
37
+ **All Bash commands on a single line.** Auto-install tools when missing (see 06-review-tools.md).
38
+
39
+ ### Code toolchain (Node.js example; other languages see 06-review-tools.md)
40
+ - **Lint**: `npx eslint . 2>&1; echo "LINT_EXIT=$?"`
41
+ - **Typecheck**: `npx tsc --noEmit 2>&1; echo "TSC_EXIT=$?"`
42
+ - **Build**: `npm run build 2>&1; echo "BUILD_EXIT=$?"`
43
+ - **Dependency audit**: `npm audit 2>&1; echo "AUDIT_EXIT=$?"`
44
+
45
+ ### Test verification
46
+ **Run tests only once; analyze from the output file. Max 3 test runs per review.**
47
+
48
+ 1. Run: `npx vitest run --coverage 2>&1 | tee /tmp/sdlc-test-output.txt; echo "TEST_EXIT=${PIPESTATUS[0]}"`
49
+ 2. Read: read `/tmp/sdlc-test-output.txt` to extract results
50
+ 3. On failure: collect all errors at once → batch-fix → run once more to verify
51
+
52
+ ---
53
+
54
+ ## Review checklist (审查清单)
55
+
56
+ ### 5.1 Code quality
57
+ - [ ] **Lint + Typecheck + Build + dependency security** pass (0 errors, no high/critical vulnerabilities)
58
+ - [ ] Code standards per 02-coding-standards.md + no security holes + no redundant code
59
+
60
+ ### 5.2 Test quality
61
+ - [ ] **Every PRD requirement has a corresponding test** + all tests pass
62
+ - [ ] **Coverage**: line ≥80%, key business ≥90%, branch ≥70%
63
+
64
+ ### 5.3 Integration consistency + PRD traceability
65
+ - [ ] **PRD four-ring traceability** — requirement→design→code file:line→test case, no broken links
66
+ - [ ] **No out-of-PRD changes** + global consistency + security + performance + no missed TODO/FIXME
67
+
68
+ ### 5.4 Delivery readiness
69
+ - [ ] No sensitive info + reasonable commit granularity + docs updated as needed
70
+
71
+ ---
72
+
73
+ ## Output format (输出格式, concise)
74
+ ```
75
+ # P4 Comprehensive Review Report (P4 综合审查报告)
76
+
77
+ **Toolchain**: Lint ✅ | Typecheck ✅ | Build ✅ | Dependencies ✅
78
+ **Tests**: passed {n} / failed {n} / coverage {n}%
79
+
80
+ **Review results**:
81
+ - 5.1 Code quality: ✅
82
+ - 5.2 Test quality: ✅
83
+ - 5.3 Integration+PRD: ✅
84
+ - 5.4 Delivery ready: ✅
85
+
86
+ **PRD traceability**: R1→src/foo.ts:10-50→test/foo.test.ts ✅ | R2→src/bar.ts:5-30→test/bar.test.ts ✅
87
+
88
+ **Issues**: {none / [severity] description → suggestion}
89
+ **Conclusion**: {pass / needs changes}
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Handling failures (未通过处理)
95
+
96
+ - Code issues → back to P2 to fix
97
+ - Test issues → back to P3 to add/fix
98
98
  - Auto-fix then re-review (max 3 times)
@@ -1,26 +1,26 @@
1
- ---
2
- name: task
3
- description: 多任务管理:新任务/切换任务/任务列表/归档任务。目录即任务,会话自动绑定,零配置。
4
- ---
5
-
6
- # task — 多任务管理(Multi-task Management)
7
-
8
- 触发词:`新任务` / `切换任务` / `任务列表` / `归档任务` / `/task`
9
-
10
- 任务绑定规则(用户无需记忆):**工作根目录即任务**——hooks 自动解析(`FLOWCRAFT_TASK_ID` > session 绑定 > 目录默认 > 单任务回退)。同目录多会话按 session_id 隔离。并行任务用多工作根(git worktree / 多目录)承载。
11
-
12
- ## 子命令(全部由 AI 执行,用户只说人话)
13
-
14
- | 用户说 | AI 执行 | 说明 |
15
- |--------|---------|------|
16
- | 新任务:xxx | `python .claude/hooks/task_manager.py create <task-id> "xxx"` + 视需要 `git worktree add` | 建任务状态;并行时建新工作根,提示用户 `cd <目录> && claude` |
17
- | 切换任务 xxx | `python .claude/hooks/task_manager.py use <task-id> [session_id]` | 绑定当前会话到任务;session_id 取自会话启动上下文(`session_id=...`),缺省时自动取 `.last-session` |
18
- | 任务列表 | `python .claude/hooks/task_manager.py list` | 列出任务(阶段/描述)与会话绑定 |
19
- | 归档任务 xxx | `python .claude/hooks/task_manager.py archive <task-id>` | 归档进 completed_tasks 并删除任务文件 |
20
-
21
- > 全局安装路径下用 `python ~/.flowcraft/hooks/task_manager.py ...`。
22
-
23
- ## 边界
24
- - 同目录两个会话 = 各绑各的任务(session_id 隔离);跨目录并行 = 多工作根
25
- - `claude --resume` 可能换 session_id → 说"切换任务 xxx"重新绑定
26
- - 单任务项目(无 `.claude/tasks/`)行为与旧版完全一致,无需任何操作
1
+ ---
2
+ name: task
3
+ description: 多任务管理:新任务/切换任务/任务列表/归档任务。目录即任务,会话自动绑定,零配置。
4
+ ---
5
+
6
+ # task — 多任务管理(Multi-task Management)
7
+
8
+ 触发词:`新任务` / `切换任务` / `任务列表` / `归档任务` / `/task`
9
+
10
+ 任务绑定规则(用户无需记忆):**工作根目录即任务**——hooks 自动解析(`FLOWCRAFT_TASK_ID` > session 绑定 > 目录默认 > 单任务回退)。同目录多会话按 session_id 隔离。并行任务用多工作根(git worktree / 多目录)承载。
11
+
12
+ ## 子命令(全部由 AI 执行,用户只说人话)
13
+
14
+ | 用户说 | AI 执行 | 说明 |
15
+ |--------|---------|------|
16
+ | 新任务:xxx | `python .claude/hooks/task_manager.py create <task-id> "xxx"` + 视需要 `git worktree add` | 建任务状态;并行时建新工作根,提示用户 `cd <目录> && claude` |
17
+ | 切换任务 xxx | `python .claude/hooks/task_manager.py use <task-id> [session_id]` | 绑定当前会话到任务;session_id 取自会话启动上下文(`session_id=...`),缺省时自动取 `.last-session` |
18
+ | 任务列表 | `python .claude/hooks/task_manager.py list` | 列出任务(阶段/描述)与会话绑定 |
19
+ | 归档任务 xxx | `python .claude/hooks/task_manager.py archive <task-id>` | 归档进 completed_tasks 并删除任务文件 |
20
+
21
+ > 全局安装路径下用 `python ~/.flowcraft/hooks/task_manager.py ...`。
22
+
23
+ ## 边界
24
+ - 同目录两个会话 = 各绑各的任务(session_id 隔离);跨目录并行 = 多工作根
25
+ - `claude --resume` 可能换 session_id → 说"切换任务 xxx"重新绑定
26
+ - 单任务项目(无 `.claude/tasks/`)行为与旧版完全一致,无需任何操作
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: test-driven-development
3
- description: "Test-driven development: write tests before implementation code. | 触发词:TDD/先写测试"
3
+ description: "Test-driven development: write tests before implementation code. | 触发词:TDD/先写测试"
4
4
  ---
5
5
 
6
6
  # Test-Driven Development (TDD)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ui-ux-pro-max
3
- description: "UI/UX design intelligence: 67 styles, 96 palettes, 57 fonts, 25 charts, 13 stacks. | 触发词:UI/UX设计/界面设计/设计系统"
3
+ description: "UI/UX design intelligence: 67 styles, 96 palettes, 57 fonts, 25 charts, 13 stacks. | 触发词:UI/UX设计/界面设计/设计系统"
4
4
  ---
5
5
  # UI/UX Pro Max - Design Intelligence
6
6
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: verification-before-completion
3
- description: "Verify before claiming completion: run commands and confirm output first. | 触发词:完成前验证/确认完成"
3
+ description: "Verify before claiming completion: run commands and confirm output first. | 触发词:完成前验证/确认完成"
4
4
  ---
5
5
 
6
6
  # Verification Before Completion
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: writing-plans
3
- description: "Write an implementation plan from a spec before touching code. | 触发词:写计划/实施计划"
3
+ description: "Write an implementation plan from a spec before touching code. | 触发词:写计划/实施计划"
4
4
  ---
5
5
 
6
6
  # Writing Plans