@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,36 +1,36 @@
1
- #!/usr/bin/env python3
2
- """PostToolUseFailure - generic advice when a tool fails."""
3
- import json
4
- import re
5
- import sys
6
-
7
- import flowcraft_env # noqa: F401 — UTF-8 stdio 双保险(R2)
8
-
9
-
10
- def main() -> int:
11
- raw = sys.stdin.read()
12
- tool_name = "unknown"
13
- try:
14
- data = json.loads(raw) if raw.strip() else {}
15
- if isinstance(data, dict):
16
- tool_name = data.get("tool_name") or "unknown"
17
- except Exception:
18
- m = re.search(r'"tool_name"\s*:\s*"((?:[^"\\]|\\.)*)"', raw)
19
- if m:
20
- tool_name = m.group(1)
21
- context = (
22
- f"[工具失败] 工具={tool_name}。建议:(1) 检查命令/路径是否正确 "
23
- "(2) 检查权限配置 (3) 查看是否有语法错误。"
24
- )
25
- out = {
26
- "hookSpecificOutput": {
27
- "hookEventName": "PostToolUseFailure",
28
- "additionalContext": context,
29
- }
30
- }
31
- print(json.dumps(out, ensure_ascii=False))
32
- return 0
33
-
34
-
35
- if __name__ == "__main__":
36
- sys.exit(main())
1
+ #!/usr/bin/env python3
2
+ """PostToolUseFailure - generic advice when a tool fails."""
3
+ import json
4
+ import re
5
+ import sys
6
+
7
+ import flowcraft_env # noqa: F401 — UTF-8 stdio 双保险(R2)
8
+
9
+
10
+ def main() -> int:
11
+ raw = sys.stdin.read()
12
+ tool_name = "unknown"
13
+ try:
14
+ data = json.loads(raw) if raw.strip() else {}
15
+ if isinstance(data, dict):
16
+ tool_name = data.get("tool_name") or "unknown"
17
+ except Exception:
18
+ m = re.search(r'"tool_name"\s*:\s*"((?:[^"\\]|\\.)*)"', raw)
19
+ if m:
20
+ tool_name = m.group(1)
21
+ context = (
22
+ f"[工具失败] 工具={tool_name}。建议:(1) 检查命令/路径是否正确 "
23
+ "(2) 检查权限配置 (3) 查看是否有语法错误。"
24
+ )
25
+ out = {
26
+ "hookSpecificOutput": {
27
+ "hookEventName": "PostToolUseFailure",
28
+ "additionalContext": context,
29
+ }
30
+ }
31
+ print(json.dumps(out, ensure_ascii=False))
32
+ return 0
33
+
34
+
35
+ if __name__ == "__main__":
36
+ sys.exit(main())
@@ -1,66 +1,66 @@
1
- #!/usr/bin/env python3
2
- """PreCompact - state check before context compaction."""
3
- import json
4
- import re
5
- import sys
6
-
7
- from task_manager import get_task_state
8
-
9
- import flowcraft_env # noqa: F401 — UTF-8 stdio 双保险(R2)
10
-
11
-
12
- def count_modified_files(content: str) -> int:
13
- """Count list items under the modified_files: section."""
14
- lines = content.split("\n")
15
- in_files = False
16
- count = 0
17
- for line in lines:
18
- if line.startswith("modified_files:"):
19
- in_files = True
20
- continue
21
- if in_files:
22
- if line and not line[0].isspace():
23
- break
24
- if re.match(r"^\s*-\s+", line):
25
- count += 1
26
- return count
27
-
28
-
29
- def main() -> int:
30
- """Emit a pre-compaction state reminder from the routed task state file.
31
-
32
- Returns:
33
- Process exit code.
34
- """
35
- state_file = get_task_state(__file__)
36
- if not state_file.is_file():
37
- return 0
38
- content = state_file.read_text(encoding="utf-8")
39
-
40
- task = ""
41
- m = re.search(r'^task_description:\s*"?([^"]*)"?\s*$', content, re.M)
42
- if m:
43
- task = m.group(1).strip()
44
- kc = ""
45
- m = re.search(r'^key_context:\s*"?([^"]*)"?\s*$', content, re.M)
46
- if m:
47
- kc = m.group(1).strip()
48
- files_count = count_modified_files(content)
49
-
50
- warnings = ""
51
- if not kc:
52
- warnings = "key_context 为空!"
53
- if files_count == 0:
54
- warnings += " modified_files 为空!"
55
-
56
- context = (
57
- f"[压缩前] 任务={task},已修改{files_count}个文件。{warnings}"
58
- "请用 Edit 更新 project-state.md:(1) 确认 modified_files 完整 "
59
- "(2) 更新 key_context 工作摘要。"
60
- )
61
- print(json.dumps({"stopReason": context}, ensure_ascii=False))
62
- return 0
63
-
64
-
65
- if __name__ == "__main__":
66
- sys.exit(main())
1
+ #!/usr/bin/env python3
2
+ """PreCompact - state check before context compaction."""
3
+ import json
4
+ import re
5
+ import sys
6
+
7
+ from task_manager import get_task_state
8
+
9
+ import flowcraft_env # noqa: F401 — UTF-8 stdio 双保险(R2)
10
+
11
+
12
+ def count_modified_files(content: str) -> int:
13
+ """Count list items under the modified_files: section."""
14
+ lines = content.split("\n")
15
+ in_files = False
16
+ count = 0
17
+ for line in lines:
18
+ if line.startswith("modified_files:"):
19
+ in_files = True
20
+ continue
21
+ if in_files:
22
+ if line and not line[0].isspace():
23
+ break
24
+ if re.match(r"^\s*-\s+", line):
25
+ count += 1
26
+ return count
27
+
28
+
29
+ def main() -> int:
30
+ """Emit a pre-compaction state reminder from the routed task state file.
31
+
32
+ Returns:
33
+ Process exit code.
34
+ """
35
+ state_file = get_task_state(__file__)
36
+ if not state_file.is_file():
37
+ return 0
38
+ content = state_file.read_text(encoding="utf-8")
39
+
40
+ task = ""
41
+ m = re.search(r'^task_description:\s*"?([^"]*)"?\s*$', content, re.M)
42
+ if m:
43
+ task = m.group(1).strip()
44
+ kc = ""
45
+ m = re.search(r'^key_context:\s*"?([^"]*)"?\s*$', content, re.M)
46
+ if m:
47
+ kc = m.group(1).strip()
48
+ files_count = count_modified_files(content)
49
+
50
+ warnings = ""
51
+ if not kc:
52
+ warnings = "key_context 为空!"
53
+ if files_count == 0:
54
+ warnings += " modified_files 为空!"
55
+
56
+ context = (
57
+ f"[压缩前] 任务={task},已修改{files_count}个文件。{warnings}"
58
+ "请用 Edit 更新 project-state.md:(1) 确认 modified_files 完整 "
59
+ "(2) 更新 key_context 工作摘要。"
60
+ )
61
+ print(json.dumps({"stopReason": context}, ensure_ascii=False))
62
+ return 0
63
+
64
+
65
+ if __name__ == "__main__":
66
+ sys.exit(main())