@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.
- package/README.md +7 -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 -162
- package/setup/.claude/hooks/permission-request.py +132 -132
- 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 -186
- 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 -91
- package/setup/.claude/settings.json +233 -233
- 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 -199
- 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 };
|