@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.
- package/README.md +19 -2
- package/bin/cli.js +108 -108
- package/flowcraft.yaml +30 -30
- package/install.sh +24 -24
- package/lib/args.js +38 -38
- package/lib/config.js +20 -20
- package/lib/copy.js +131 -131
- package/lib/fix.js +110 -110
- package/lib/fsutil.js +104 -104
- package/lib/global.js +229 -229
- package/lib/init.js +43 -43
- package/lib/runtime.js +84 -84
- package/lib/version.js +55 -55
- package/lib/wizard.js +125 -125
- package/package.json +33 -33
- package/presets/backend.yaml +20 -20
- package/presets/default.yaml +15 -15
- package/presets/frontend.yaml +20 -20
- package/presets/quick-fix.yaml +15 -15
- package/setup/.claude/hooks/check-phase-test.py +152 -152
- package/setup/.claude/hooks/check-phase-write.py +235 -235
- package/setup/.claude/hooks/dispatch.py +67 -67
- package/setup/.claude/hooks/file-suggestion.py +45 -45
- package/setup/.claude/hooks/flowcraft_env.py +162 -137
- package/setup/.claude/hooks/permission-request.py +132 -125
- package/setup/.claude/hooks/post-tool-failure.py +36 -36
- package/setup/.claude/hooks/pre-compact.py +66 -66
- package/setup/.claude/hooks/review-runner.py +846 -846
- package/setup/.claude/hooks/setup-keys.py +282 -282
- package/setup/.claude/hooks/statusline.py +63 -63
- package/setup/.claude/hooks/stop-check.py +186 -171
- package/setup/.claude/hooks/subagent-start.py +50 -50
- package/setup/.claude/hooks/subagent-stop.py +63 -63
- package/setup/.claude/hooks/task-completed.py +57 -57
- package/setup/.claude/hooks/task_manager.py +592 -592
- package/setup/.claude/hooks/user-prompt-submit.py +91 -85
- package/setup/.claude/settings.json +233 -237
- package/setup/.claude/skills/Pstatus/SKILL.md +68 -68
- package/setup/.claude/skills/archive/SKILL.md +195 -195
- package/setup/.claude/skills/brainstorming/SKILL.md +5 -5
- package/setup/.claude/skills/brainstorming/scripts/server.cjs +723 -723
- package/setup/.claude/skills/brainstorming/scripts/start-server.py +245 -245
- package/setup/.claude/skills/brainstorming/scripts/stop-server.py +178 -178
- package/setup/.claude/skills/brainstorming/visual-companion.md +298 -298
- package/setup/.claude/skills/chrome-integration/SKILL.md +66 -66
- package/setup/.claude/skills/code-review/SKILL.md +264 -264
- package/setup/.claude/skills/executing-plans/SKILL.md +1 -1
- package/setup/.claude/skills/gitnexus/gitnexus-cli/SKILL.md +67 -67
- package/setup/.claude/skills/gitnexus/gitnexus-debugging/SKILL.md +1 -1
- package/setup/.claude/skills/gitnexus/gitnexus-exploring/SKILL.md +1 -1
- package/setup/.claude/skills/gitnexus/gitnexus-guide/SKILL.md +1 -1
- package/setup/.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +1 -1
- package/setup/.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md +1 -1
- package/setup/.claude/skills/methodology/SKILL.md +124 -0
- package/setup/.claude/skills/phase/SKILL.md +62 -62
- package/setup/.claude/skills/playwright/SKILL.md +85 -85
- package/setup/.claude/skills/review/SKILL.md +97 -97
- package/setup/.claude/skills/task/SKILL.md +26 -26
- package/setup/.claude/skills/test-driven-development/SKILL.md +1 -1
- package/setup/.claude/skills/ui-ux-pro-max/SKILL.md +1 -1
- package/setup/.claude/skills/verification-before-completion/SKILL.md +1 -1
- package/setup/.claude/skills/writing-plans/SKILL.md +1 -1
- package/setup/.codex/.agents/skills/archive/SKILL.md +195 -195
- package/setup/.codex/.agents/skills/brainstorming/SKILL.md +5 -5
- package/setup/.codex/.agents/skills/brainstorming/scripts/server.cjs +723 -723
- package/setup/.codex/.agents/skills/brainstorming/scripts/start-server.py +245 -245
- package/setup/.codex/.agents/skills/brainstorming/scripts/stop-server.py +178 -178
- package/setup/.codex/.agents/skills/brainstorming/visual-companion.md +298 -298
- package/setup/.codex/.agents/skills/chrome-integration/SKILL.md +66 -66
- package/setup/.codex/.agents/skills/code-review/SKILL.md +264 -264
- package/setup/.codex/.agents/skills/executing-plans/SKILL.md +1 -1
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-cli/SKILL.md +67 -67
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-debugging/SKILL.md +1 -1
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-exploring/SKILL.md +1 -1
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-guide/SKILL.md +1 -1
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +1 -1
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-refactoring/SKILL.md +1 -1
- package/setup/.codex/.agents/skills/methodology/SKILL.md +124 -0
- package/setup/.codex/.agents/skills/phase/SKILL.md +62 -62
- package/setup/.codex/.agents/skills/playwright/SKILL.md +85 -85
- package/setup/.codex/.agents/skills/review/SKILL.md +97 -97
- package/setup/.codex/.agents/skills/task/SKILL.md +27 -27
- package/setup/.codex/.agents/skills/test-driven-development/SKILL.md +1 -1
- package/setup/.codex/.agents/skills/ui-ux-pro-max/SKILL.md +1 -1
- package/setup/.codex/.agents/skills/verification-before-completion/SKILL.md +1 -1
- package/setup/.codex/.agents/skills/writing-plans/SKILL.md +1 -1
- package/setup/.codex/hooks/review-runner.py +851 -851
- package/setup/.codex/hooks/setup-keys.py +287 -287
- package/setup/AGENTS.md +11 -1
- package/setup/CLAUDE.md +11 -1
- package/setup/install.sh +24 -24
- package/setup/tests/test_decision_timeout.py +241 -241
- package/setup/tests/test_hook_guards.py +357 -357
- package/setup/tests/test_sdlc_bootstrap.py +167 -167
- package/setup/tests/test_sessionlog_switch.py +199 -0
- 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())
|