@leocm/flowcraft 2.2.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 +7 -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 -162
  25. package/setup/.claude/hooks/permission-request.py +132 -132
  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 -186
  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 -91
  37. package/setup/.claude/settings.json +233 -233
  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 -199
  96. package/setup/tests/test_task_manager.py +148 -148
package/lib/fsutil.js CHANGED
@@ -1,104 +1,104 @@
1
- /**
2
- * fsutil.js — 文件系统工具(备份/行尾检测/遍历/复制)
3
- */
4
- 'use strict';
5
-
6
- const fs = require('node:fs');
7
- const path = require('node:path');
8
-
9
- /**
10
- * 生成备份时间戳(对齐 date +%Y%m%d-%H%M%S)
11
- * @returns {string} 形如 20261009-110530
12
- */
13
- function timestamp() {
14
- const d = new Date();
15
- const p = (n) => String(n).padStart(2, '0');
16
- return `${d.getFullYear()}${p(d.getMonth() + 1)}${p(d.getDate())}-${p(d.getHours())}${p(d.getMinutes())}${p(d.getSeconds())}`;
17
- }
18
-
19
- /**
20
- * 生成日期时间字符串(对齐 date '+%Y-%m-%d %H:%M:%S')
21
- * @returns {string} 形如 2026-10-09 11:05:30
22
- */
23
- function nowStr() {
24
- const d = new Date();
25
- const p = (n) => String(n).padStart(2, '0');
26
- return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
27
- }
28
-
29
- /**
30
- * 时间戳备份:已存在则复制为 <file>.bak-<ts>(不覆盖旧备份)
31
- * @param {string} file 目标文件
32
- * @param {string} ts 时间戳
33
- * @returns {boolean} 是否完成备份
34
- */
35
- function backupFile(file, ts) {
36
- if (!fs.existsSync(file)) return false;
37
- fs.copyFileSync(file, `${file}.bak-${ts}`);
38
- console.log(` 备份: ${file} -> ${path.basename(file)}.bak-${ts}`);
39
- return true;
40
- }
41
-
42
- /**
43
- * 检测缓冲区是否含 CR(CRLF)
44
- * @param {Buffer} buf 文件内容
45
- * @returns {boolean} 是否含 \r
46
- */
47
- function hasCrlf(buf) {
48
- return buf.includes(0x0d);
49
- }
50
-
51
- /**
52
- * 判断文件是否文本(前 8KB 无 NUL,对齐 file|grep text)
53
- * @param {string} file 文件路径
54
- * @returns {boolean} 是否文本
55
- */
56
- function isTextFile(file) {
57
- const fd = fs.openSync(file, 'r');
58
- try {
59
- const buf = Buffer.alloc(8192);
60
- const n = fs.readSync(fd, buf, 0, 8192, 0);
61
- return !buf.slice(0, n).includes(0x00);
62
- } finally {
63
- fs.closeSync(fd);
64
- }
65
- }
66
-
67
- /**
68
- * 递归列出目录内全部文件
69
- * @param {string} dir 目录
70
- * @returns {string[]} 文件绝对路径列表
71
- */
72
- function listFiles(dir) {
73
- const out = [];
74
- if (!fs.existsSync(dir)) return out;
75
- for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
76
- const abs = path.join(dir, e.name);
77
- if (e.isDirectory()) out.push(...listFiles(abs));
78
- else out.push(abs);
79
- }
80
- return out;
81
- }
82
-
83
- /**
84
- * 递归复制目录(覆盖同名文件)
85
- * @param {string} src 源目录
86
- * @param {string} dst 目标目录
87
- * @returns {number} 复制的文件数
88
- */
89
- function copyDir(src, dst) {
90
- let n = 0;
91
- fs.mkdirSync(dst, { recursive: true });
92
- for (const e of fs.readdirSync(src, { withFileTypes: true })) {
93
- const s = path.join(src, e.name);
94
- const d = path.join(dst, e.name);
95
- if (e.isDirectory()) n += copyDir(s, d);
96
- else {
97
- fs.copyFileSync(s, d);
98
- n += 1;
99
- }
100
- }
101
- return n;
102
- }
103
-
104
- module.exports = { timestamp, nowStr, backupFile, hasCrlf, isTextFile, listFiles, copyDir };
1
+ /**
2
+ * fsutil.js — 文件系统工具(备份/行尾检测/遍历/复制)
3
+ */
4
+ 'use strict';
5
+
6
+ const fs = require('node:fs');
7
+ const path = require('node:path');
8
+
9
+ /**
10
+ * 生成备份时间戳(对齐 date +%Y%m%d-%H%M%S)
11
+ * @returns {string} 形如 20261009-110530
12
+ */
13
+ function timestamp() {
14
+ const d = new Date();
15
+ const p = (n) => String(n).padStart(2, '0');
16
+ return `${d.getFullYear()}${p(d.getMonth() + 1)}${p(d.getDate())}-${p(d.getHours())}${p(d.getMinutes())}${p(d.getSeconds())}`;
17
+ }
18
+
19
+ /**
20
+ * 生成日期时间字符串(对齐 date '+%Y-%m-%d %H:%M:%S')
21
+ * @returns {string} 形如 2026-10-09 11:05:30
22
+ */
23
+ function nowStr() {
24
+ const d = new Date();
25
+ const p = (n) => String(n).padStart(2, '0');
26
+ return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
27
+ }
28
+
29
+ /**
30
+ * 时间戳备份:已存在则复制为 <file>.bak-<ts>(不覆盖旧备份)
31
+ * @param {string} file 目标文件
32
+ * @param {string} ts 时间戳
33
+ * @returns {boolean} 是否完成备份
34
+ */
35
+ function backupFile(file, ts) {
36
+ if (!fs.existsSync(file)) return false;
37
+ fs.copyFileSync(file, `${file}.bak-${ts}`);
38
+ console.log(` 备份: ${file} -> ${path.basename(file)}.bak-${ts}`);
39
+ return true;
40
+ }
41
+
42
+ /**
43
+ * 检测缓冲区是否含 CR(CRLF)
44
+ * @param {Buffer} buf 文件内容
45
+ * @returns {boolean} 是否含 \r
46
+ */
47
+ function hasCrlf(buf) {
48
+ return buf.includes(0x0d);
49
+ }
50
+
51
+ /**
52
+ * 判断文件是否文本(前 8KB 无 NUL,对齐 file|grep text)
53
+ * @param {string} file 文件路径
54
+ * @returns {boolean} 是否文本
55
+ */
56
+ function isTextFile(file) {
57
+ const fd = fs.openSync(file, 'r');
58
+ try {
59
+ const buf = Buffer.alloc(8192);
60
+ const n = fs.readSync(fd, buf, 0, 8192, 0);
61
+ return !buf.slice(0, n).includes(0x00);
62
+ } finally {
63
+ fs.closeSync(fd);
64
+ }
65
+ }
66
+
67
+ /**
68
+ * 递归列出目录内全部文件
69
+ * @param {string} dir 目录
70
+ * @returns {string[]} 文件绝对路径列表
71
+ */
72
+ function listFiles(dir) {
73
+ const out = [];
74
+ if (!fs.existsSync(dir)) return out;
75
+ for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
76
+ const abs = path.join(dir, e.name);
77
+ if (e.isDirectory()) out.push(...listFiles(abs));
78
+ else out.push(abs);
79
+ }
80
+ return out;
81
+ }
82
+
83
+ /**
84
+ * 递归复制目录(覆盖同名文件)
85
+ * @param {string} src 源目录
86
+ * @param {string} dst 目标目录
87
+ * @returns {number} 复制的文件数
88
+ */
89
+ function copyDir(src, dst) {
90
+ let n = 0;
91
+ fs.mkdirSync(dst, { recursive: true });
92
+ for (const e of fs.readdirSync(src, { withFileTypes: true })) {
93
+ const s = path.join(src, e.name);
94
+ const d = path.join(dst, e.name);
95
+ if (e.isDirectory()) n += copyDir(s, d);
96
+ else {
97
+ fs.copyFileSync(s, d);
98
+ n += 1;
99
+ }
100
+ }
101
+ return n;
102
+ }
103
+
104
+ module.exports = { timestamp, nowStr, backupFile, hasCrlf, isTextFile, listFiles, copyDir };