claude-coding-flow 1.4.3 → 1.5.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/bin/flow.js +62 -0
- package/commands/doc-gen.md +6 -9
- package/package.json +1 -1
package/bin/flow.js
CHANGED
|
@@ -86,6 +86,68 @@ function init() {
|
|
|
86
86
|
mkdirp(path.join(CWD, "skills"));
|
|
87
87
|
mkdirp(path.join(CWD, ".worktree"));
|
|
88
88
|
|
|
89
|
+
// 5. Write permissions to .claude/settings.json
|
|
90
|
+
const settingsPath = path.join(CWD, ".claude", "settings.json");
|
|
91
|
+
let settings = {};
|
|
92
|
+
if (fs.existsSync(settingsPath)) {
|
|
93
|
+
try {
|
|
94
|
+
settings = JSON.parse(fs.readFileSync(settingsPath, "utf-8"));
|
|
95
|
+
} catch {}
|
|
96
|
+
}
|
|
97
|
+
if (!settings.permissions) settings.permissions = {};
|
|
98
|
+
if (!settings.permissions.allow) settings.permissions.allow = [];
|
|
99
|
+
|
|
100
|
+
const allowPatterns = [
|
|
101
|
+
// Read-only: git
|
|
102
|
+
"Bash(git rev-parse:*)",
|
|
103
|
+
"Bash(git ls-files:*)",
|
|
104
|
+
"Bash(git diff:*)",
|
|
105
|
+
// Read-only: find (docs, skills, worktree, src)
|
|
106
|
+
"Bash(find docs/ *)",
|
|
107
|
+
"Bash(find skills/ *)",
|
|
108
|
+
"Bash(find .worktree/ *)",
|
|
109
|
+
"Bash(find src/ *)",
|
|
110
|
+
// Read-only: grep
|
|
111
|
+
"Bash(grep -rn * --include=*.java --include=*.kt --include=*.py --include=*.js --include=*.ts --include=*.swift --include=*.dart)",
|
|
112
|
+
// Read-only: python3 one-liners (ID gen, JSON parsing, date)
|
|
113
|
+
"Bash(python3 -c *)",
|
|
114
|
+
// Read-only: ls / cat / test
|
|
115
|
+
"Bash(ls *)",
|
|
116
|
+
"Bash(test -f *)",
|
|
117
|
+
// Write: mkdir / cp for worktree
|
|
118
|
+
"Bash(mkdir -p .worktree/ *)",
|
|
119
|
+
"Bash(cp .worktree/ *)",
|
|
120
|
+
"Bash(cp docs/ .worktree/ *)",
|
|
121
|
+
// Write: rm temp
|
|
122
|
+
"Bash(rm -rf .worktree/code-gen/temp)",
|
|
123
|
+
// Write: date
|
|
124
|
+
"Bash(date *)",
|
|
125
|
+
// Build commands
|
|
126
|
+
"Bash(npm run build:*)",
|
|
127
|
+
"Bash(npx tsc --noEmit)",
|
|
128
|
+
"Bash(cargo check)",
|
|
129
|
+
"Bash(go build ./...)",
|
|
130
|
+
"Bash(make build)",
|
|
131
|
+
"Bash(./gradlew assembleDebug)",
|
|
132
|
+
"Bash(./mvnw compile)",
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
let added = 0;
|
|
136
|
+
for (const p of allowPatterns) {
|
|
137
|
+
if (!settings.permissions.allow.includes(p)) {
|
|
138
|
+
settings.permissions.allow.push(p);
|
|
139
|
+
added++;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (added > 0) {
|
|
144
|
+
fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
|
|
145
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
146
|
+
console.log(green(` added ${added} permission rules to .claude/settings.json`));
|
|
147
|
+
} else {
|
|
148
|
+
console.log(yellow(" skip (exists): .claude/settings.json permissions"));
|
|
149
|
+
}
|
|
150
|
+
|
|
89
151
|
console.log(green("\ndone!"));
|
|
90
152
|
}
|
|
91
153
|
|
package/commands/doc-gen.md
CHANGED
|
@@ -130,15 +130,12 @@ find docs/apis/ -name "*.md" -type f 2>/dev/null
|
|
|
130
130
|
|
|
131
131
|
### 第三步:AskUserQuestion 收集(两批)
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
1. header=需求文档:扫描 `docs/prds/` 下 `.md` 文件,按上述规则。有文件时剩余空位可补充 `{"label":"读取全部","description":"读取所有需求文档"}`
|
|
140
|
-
2. header=图片:扫描 `docs/images/` 下子文件夹,按上述规则。有目录时剩余空位可补充 `{"label":"无图片","description":"本次不使用图片资源"}`
|
|
141
|
-
3. header=API:扫描 `docs/apis/` 下 `.md` 文件,按上述规则。有文件时剩余空位可补充 `{"label":"无API文档","description":"本次不使用API文档"}`
|
|
133
|
+
**动态选项规则**:0 个 → AskUserQuestion 提供选项 `无`(description:"暂不指定")+ `稍后提供`(description:"稍后手动提供路径"),必须逐项弹出;1-3 个 → AskUserQuestion 列出全部 + `自定义输入`;4+ 个 → 文字列出全部(带编号)+ AskUserQuestion(`输入序号` + `自定义输入`)。
|
|
134
|
+
|
|
135
|
+
**第一批(3问,每问单独 AskUserQuestion)**:
|
|
136
|
+
1. header=需求文档:扫描 `docs/prds/` 下 `.md` 文件,按上述规则。有文件时剩余空位可补充 `读取全部`
|
|
137
|
+
2. header=图片:扫描 `docs/images/` 下子文件夹,按上述规则。有目录时剩余空位可补充 `无图片`
|
|
138
|
+
3. header=API:扫描 `docs/apis/` 下 `.md` 文件,按上述规则。有文件时剩余空位可补充 `无 API 文档`
|
|
142
139
|
|
|
143
140
|
**第二批(1问)**:
|
|
144
141
|
4. header=增量:`全新生成` / `增量更新`
|