claude-everything-workflow 0.1.5 → 0.1.6
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 +43 -8
- package/package.json +1 -1
- package/rules/common/hooks.md +2 -1
- package/rules/common/skills-learning.md +7 -0
- package/scripts/install.ps1 +80 -43
- package/scripts/install.sh +56 -3
- package/scripts/verify-harness.js +155 -5
- package/settings.json +3 -40
- package/skills/brainstorming/scripts/frame-template.html +25 -26
- package/skills/brainstorming/scripts/helper.js +101 -22
- package/skills/brainstorming/scripts/server.cjs +399 -30
- package/skills/brainstorming/scripts/start-server.sh +70 -9
- package/skills/brainstorming/scripts/stop-server.sh +66 -2
- package/skills/brainstorming/visual-companion.md +33 -22
- package/skills/learn/.gitkeep +0 -0
- package/skills/learn/README.md +15 -0
- package/skills/learn/debugging/.gitkeep +0 -0
- package/skills/learn/pr/.gitkeep +0 -0
- package/skills/learn/testing/.gitkeep +0 -0
- package/skills/subagent-driven-development/SKILL.md +425 -0
- package/skills/subagent-driven-development/implementer-prompt.md +139 -0
- package/skills/subagent-driven-development/scripts/review-package +44 -0
- package/skills/subagent-driven-development/scripts/sdd-workspace +22 -0
- package/skills/subagent-driven-development/scripts/task-brief +40 -0
- package/skills/subagent-driven-development/task-reviewer-prompt.md +188 -0
- package/skills/using-superpowers/SKILL.md +75 -0
- package/skills/writing-plans/SKILL.md +25 -2
- package/hooks/evaluate-session.js +0 -59
- package/hooks/pre-compact.js +0 -92
- package/hooks/runtime/session-utils.js +0 -45
- package/hooks/session-end.js +0 -62
- package/hooks/session-start.js +0 -60
package/README.md
CHANGED
|
@@ -57,6 +57,20 @@ npm pack --dry-run
|
|
|
57
57
|
npm publish --dry-run
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
## npm 自动发布
|
|
61
|
+
|
|
62
|
+
合并到 `main` 后,GitHub Actions 会运行 `.github/workflows/npm-publish.yml`:
|
|
63
|
+
|
|
64
|
+
1. 运行 `npm run verify` 和 `npm run pack:dry-run`。
|
|
65
|
+
2. 读取 npm registry 的当前 `latest` 版本,默认在此基础上计算下一个 patch 版本。
|
|
66
|
+
3. 提交 `package.json` 版本号变更并打 `v<version>` tag。
|
|
67
|
+
4. 通过 npm 受信任的发布商 OIDC 认证执行 `npm publish`。
|
|
68
|
+
5. 发布成功后把版本提交和 tag 推回 `main`。
|
|
69
|
+
|
|
70
|
+
也可以在 Actions 页面手动触发 `Publish npm`,选择 `patch`、`minor` 或 `major`。
|
|
71
|
+
|
|
72
|
+
npm 包设置里必须添加 GitHub Actions 受信任的发布商,仓库为 `xu91102/claude-everything-Workflow`,workflow 文件名为 `npm-publish.yml`,并允许 `npm publish`。
|
|
73
|
+
|
|
60
74
|
安装目标:
|
|
61
75
|
|
|
62
76
|
- Claude Code: `~/.claude/`
|
|
@@ -86,6 +100,10 @@ claude-everything-Workflow/
|
|
|
86
100
|
├── AGENTS.md # Codex 与通用权威规则入口
|
|
87
101
|
├── CLAUDE.md # Claude Code 最小 bootstrap 入口
|
|
88
102
|
├── settings.json # Claude Code Hooks 配置入口
|
|
103
|
+
├── .github/
|
|
104
|
+
│ └── workflows/
|
|
105
|
+
│ ├── ci.yml # PR / main 校验
|
|
106
|
+
│ └── npm-publish.yml # main 合并后自动 bump version 并发布 npm
|
|
89
107
|
│
|
|
90
108
|
├── rules/ # 规则索引与按需加载规则
|
|
91
109
|
│ ├── 01-base.md # 基础设定
|
|
@@ -140,6 +158,13 @@ claude-everything-Workflow/
|
|
|
140
158
|
│ └── review-confidence.js # 置信度审查报告
|
|
141
159
|
│
|
|
142
160
|
├── skills/
|
|
161
|
+
│ ├── using-superpowers/ # Skill 路由、优先级与门禁纪律
|
|
162
|
+
│ │ └── SKILL.md
|
|
163
|
+
│ ├── subagent-driven-development/ # SDD:task brief、review package、progress ledger
|
|
164
|
+
│ │ ├── SKILL.md
|
|
165
|
+
│ │ ├── implementer-prompt.md
|
|
166
|
+
│ │ ├── task-reviewer-prompt.md
|
|
167
|
+
│ │ └── scripts/
|
|
143
168
|
│ ├── using-git-worktrees/ # 隔离式 worktree 执行准备
|
|
144
169
|
│ │ └── SKILL.md
|
|
145
170
|
│ ├── executing-plans/ # 按计划执行、检查点、审查与验证
|
|
@@ -164,14 +189,10 @@ claude-everything-Workflow/
|
|
|
164
189
|
├── hooks/ # 钩子脚本
|
|
165
190
|
│ ├── runtime/ # Hook 运行时与 Profile 控制
|
|
166
191
|
│ │ ├── run-with-flags.js
|
|
167
|
-
│ │
|
|
168
|
-
│ │ └── session-utils.js
|
|
169
|
-
│ ├── session-start.js # 会话启动上下文
|
|
170
|
-
│ ├── session-end.js # 会话结束持久化
|
|
192
|
+
│ │ └── hook-flags.js
|
|
171
193
|
│ ├── commit-quality.js # 可选 Pre-commit 质量门
|
|
172
194
|
│ ├── check-console-log.js # console.log 检测
|
|
173
|
-
│
|
|
174
|
-
│ └── pre-compact.js # 压缩前保存上下文
|
|
195
|
+
│ └── check-code-size.js # 代码规模检测
|
|
175
196
|
│
|
|
176
197
|
└── homunculus/ # 自主学习系统
|
|
177
198
|
└── instincts/
|
|
@@ -261,6 +282,9 @@ claude-everything-Workflow/
|
|
|
261
282
|
```bash
|
|
262
283
|
node scripts/verify-harness.js
|
|
263
284
|
bash scripts/install.sh --dry-run
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
```powershell
|
|
264
288
|
powershell -ExecutionPolicy Bypass -File .\scripts\install.ps1 -DryRun
|
|
265
289
|
```
|
|
266
290
|
|
|
@@ -278,7 +302,7 @@ export ECC_HOOK_PROFILE=standard
|
|
|
278
302
|
export ECC_DISABLED_HOOKS="post:edit:console-log"
|
|
279
303
|
```
|
|
280
304
|
|
|
281
|
-
当前仓库以根目录 `settings.json` 作为 Claude Code hooks 入口;`hooks/`
|
|
305
|
+
当前仓库以根目录 `settings.json` 作为 Claude Code hooks 入口;`hooks/` 目录统一保存低噪音 Hook 运行时和脚本实现。默认不启用会话启动、会话结束、停止或压缩前的弱摘要 Hook,避免污染上下文。`scripts/learning/` 只保存手动学习治理脚本,不作为 Hook 自动触发。
|
|
282
306
|
Codex 安装同一套 `hooks/` 脚本材料,但不会因为安装本仓文件而自动启用 Claude Code hooks;如未来需要 Codex 原生自动化,应新增明确 adapter。
|
|
283
307
|
|
|
284
308
|
## Superpowers 风格开发闭环
|
|
@@ -287,12 +311,13 @@ Codex 安装同一套 `hooks/` 脚本材料,但不会因为安装本仓文件
|
|
|
287
311
|
|
|
288
312
|
```text
|
|
289
313
|
复杂任务
|
|
314
|
+
-> using-superpowers 先路由到相关 process skill
|
|
290
315
|
-> brainstorming 澄清需求
|
|
291
316
|
-> 写 design spec
|
|
292
317
|
-> 用户审核 spec
|
|
293
318
|
-> using-git-worktrees 按需创建隔离工作区
|
|
294
319
|
-> writing-plans 写实施计划
|
|
295
|
-
-> executing-plans 按计划执行
|
|
320
|
+
-> subagent-driven-development 或 executing-plans 按计划执行
|
|
296
321
|
-> TDD 红绿重构
|
|
297
322
|
-> 需求符合性审查
|
|
298
323
|
-> 代码质量审查
|
|
@@ -304,13 +329,23 @@ Codex 安装同一套 `hooks/` 脚本材料,但不会因为安装本仓文件
|
|
|
304
329
|
|
|
305
330
|
硬门禁:
|
|
306
331
|
|
|
332
|
+
- 开始非平凡任务前,先用 `using-superpowers` 判断并加载相关 process skill。
|
|
307
333
|
- 没有 spec,不进入 plan。
|
|
308
334
|
- 没有用户审核,不进入实现。
|
|
335
|
+
- 计划必须包含 `Global Constraints` 和每任务 `Interfaces`,让 implementer/reviewer 不依赖父会话记忆。
|
|
309
336
|
- 没有 failing test,不写行为代码。
|
|
310
337
|
- 没有 review,不标记任务完成。
|
|
311
338
|
- 没有新鲜验证证据,不声明完成、通过、已修复或 ready。
|
|
312
339
|
- 没有 verify,不进入 PR。
|
|
313
340
|
- 有脏工作区、并行任务或高风险改动时,先考虑 `using-git-worktrees`。
|
|
341
|
+
- 只有用户明确批准 commit/PR/SDD 执行时,才使用 `subagent-driven-development` 的 per-task commit 流;否则用 `executing-plans` 或 inline execution。
|
|
342
|
+
|
|
343
|
+
### 对齐 Superpowers v6.0.3 的能力
|
|
344
|
+
|
|
345
|
+
- `subagent-driven-development` 使用 `.superpowers/sdd/` 保存 task brief、implementer report、review package 和 `progress.md`,避免把 scratch 写进 `.git/`。
|
|
346
|
+
- 每个任务使用一个 `task-reviewer-prompt.md` 同时返回 spec compliance 和 code quality verdict,减少重复 reviewer 上下文。
|
|
347
|
+
- `writing-plans` 强制 `Global Constraints` 和每任务 `Interfaces`,把跨任务约束、输入输出契约传给 implementer 和 reviewer。
|
|
348
|
+
- Brainstorming visual companion 使用带 `?key=` 的 per-session URL,HTTP/WebSocket 请求都需要 session key;默认 idle timeout 为 4 小时,可用 `--idle-timeout-minutes` 调整。
|
|
314
349
|
|
|
315
350
|
复杂任务包括新功能、架构调整、多文件行为变化、高风险实现,以及需求存在多种合理解释的工作。简单问答、翻译、格式调整、窄范围文档修正和无行为变化的小修复,可以直接处理,但完成前仍需运行与改动范围匹配的最小验证。
|
|
316
351
|
|
package/package.json
CHANGED
package/rules/common/hooks.md
CHANGED
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
## 摘要类 Hook 规范
|
|
13
13
|
|
|
14
|
-
-
|
|
14
|
+
- 只有在能产生明确恢复价值时,才启用 `PreCompact` / `SessionEnd` 摘要类 Hook;不要保留只写弱状态、占位统计或提示语的生命周期 Hook。
|
|
15
15
|
- 摘要目标是恢复工作现场,不是提高模型智力;只记录目标、决策、关键文件、待办、验证结果、风险和未决问题。
|
|
16
16
|
- 不机械总结“前 N 轮对话”,也不把完整 transcript 写回上下文;轮数不是有效信息密度的可靠指标。
|
|
17
17
|
- Hook 输出应短、结构化、可恢复;默认写入持久化文件,stderr 只给必要提示,stdout 保持静默,避免污染协议输出。
|
|
18
|
+
- 默认模板不启用会话启动、会话结束、停止或压缩前的弱摘要 Hook;这类 Hook 必须先证明恢复价值高于上下文噪音成本。
|
|
18
19
|
- 自动摘要不得覆盖用户明确写下的规则、计划或决策;发现冲突时记录冲突并要求后续人工确认。
|
|
19
20
|
- 涉及敏感信息、凭据、外部链接 token 或用户私密内容时,默认只记录存在风险和证据位置,不保存原文。
|
|
20
21
|
|
|
@@ -11,6 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
保持 skill 精简;详细参考内容应拆到 references,并按需读取。
|
|
13
13
|
|
|
14
|
+
### Superpowers 路由纪律
|
|
15
|
+
|
|
16
|
+
- 非平凡任务开始前,先用 `skills/using-superpowers/SKILL.md` 判断应加载的 process skill。
|
|
17
|
+
- process skill 优先于 implementation skill:先决定工作方法,再做代码、文档、测试或 PR 动作。
|
|
18
|
+
- 不凭记忆执行 skill;skill 可能已更新,必须读取当前 `SKILL.md`。
|
|
19
|
+
- 用户直接指令、`AGENTS.md`、`CLAUDE.md` 和项目规则优先于 skill;冲突影响结果时要说明。
|
|
20
|
+
|
|
14
21
|
## 按需学习
|
|
15
22
|
|
|
16
23
|
- 默认不后台学习,不持续采集大上下文。
|
package/scripts/install.ps1
CHANGED
|
@@ -74,58 +74,90 @@ function Copy-ClaudeSettings {
|
|
|
74
74
|
Backup-IfChanged -Source $Source -Destination $Destination
|
|
75
75
|
|
|
76
76
|
if ($DryRun) {
|
|
77
|
-
Write-Host "[dry-run] Merge '$Source' into '$Destination' preserving existing env and mcpServers"
|
|
77
|
+
Write-Host "[dry-run] Merge '$Source' into '$Destination' preserving existing env and mcpServers, purging legacy hook paths"
|
|
78
78
|
return
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
$
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
# 使用 Node 脚本合并 settings.json,同时清理旧版 Hook 路径
|
|
82
|
+
$mergeScript = @'
|
|
83
|
+
const fs = require('fs')
|
|
84
|
+
|
|
85
|
+
const [, , sourcePath, destinationPath] = process.argv
|
|
86
|
+
const source = JSON.parse(fs.readFileSync(sourcePath, 'utf8'))
|
|
87
|
+
const existing = fs.existsSync(destinationPath)
|
|
88
|
+
? JSON.parse(fs.readFileSync(destinationPath, 'utf8'))
|
|
89
|
+
: {}
|
|
90
|
+
|
|
91
|
+
const LEGACY_HOOK_PATTERNS = [
|
|
92
|
+
'scripts/hooks/run-with-flags.js',
|
|
93
|
+
'scripts/hooks/commit-quality.js',
|
|
94
|
+
'scripts/hooks/session-start.js',
|
|
95
|
+
'scripts/hooks/session-end.js',
|
|
96
|
+
'scripts/lib/hook-flags.js',
|
|
97
|
+
'scripts/lib/utils.js',
|
|
98
|
+
'hooks/observe.js',
|
|
99
|
+
'hooks/review-confidence.js',
|
|
100
|
+
'hooks/session-start.js',
|
|
101
|
+
'hooks/session-end.js',
|
|
102
|
+
'hooks/evaluate-session.js',
|
|
103
|
+
'hooks/pre-compact.js',
|
|
104
|
+
'hooks/runtime/session-utils.js'
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
function isLegacyHook(hookDef) {
|
|
108
|
+
if (typeof hookDef !== 'object' || !hookDef.command) return false
|
|
109
|
+
return LEGACY_HOOK_PATTERNS.some(p => hookDef.command.includes(p))
|
|
110
|
+
}
|
|
87
111
|
|
|
88
|
-
|
|
112
|
+
function filterHooks(hooksArray) {
|
|
113
|
+
if (!Array.isArray(hooksArray)) return hooksArray
|
|
114
|
+
return hooksArray.map(entry => {
|
|
115
|
+
if (!entry || !Array.isArray(entry.hooks)) return entry
|
|
116
|
+
const filtered = entry.hooks.filter(h => !isLegacyHook(h))
|
|
117
|
+
return { ...entry, hooks: filtered }
|
|
118
|
+
}).filter(entry => entry.hooks && entry.hooks.length > 0)
|
|
119
|
+
}
|
|
89
120
|
|
|
90
|
-
|
|
91
|
-
|
|
121
|
+
function cleanHooks(hooksObj) {
|
|
122
|
+
if (!hooksObj || typeof hooksObj !== 'object') return hooksObj
|
|
123
|
+
const cleaned = {}
|
|
124
|
+
for (const [eventType, entries] of Object.entries(hooksObj)) {
|
|
125
|
+
const filtered = filterHooks(entries)
|
|
126
|
+
if (filtered.length > 0) {
|
|
127
|
+
cleaned[eventType] = filtered
|
|
128
|
+
}
|
|
92
129
|
}
|
|
130
|
+
return cleaned
|
|
131
|
+
}
|
|
93
132
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
133
|
+
const merged = {
|
|
134
|
+
...existing,
|
|
135
|
+
...source,
|
|
136
|
+
env: {
|
|
137
|
+
...(source.env || {}),
|
|
138
|
+
...(existing.env || {})
|
|
139
|
+
},
|
|
140
|
+
mcpServers: {
|
|
141
|
+
...(source.mcpServers || {}),
|
|
142
|
+
...(existing.mcpServers || {})
|
|
143
|
+
},
|
|
144
|
+
hooks: cleanHooks({
|
|
145
|
+
...(existing.hooks || {}),
|
|
146
|
+
...(source.hooks || {})
|
|
147
|
+
})
|
|
148
|
+
}
|
|
97
149
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
foreach ($property in $sourceSettings.env.PSObject.Properties) {
|
|
101
|
-
$env[$property.Name] = $property.Value
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if ($existingSettings.PSObject.Properties.Name -contains "env") {
|
|
105
|
-
foreach ($property in $existingSettings.env.PSObject.Properties) {
|
|
106
|
-
$env[$property.Name] = $property.Value
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
if ($env.Count -gt 0) {
|
|
110
|
-
$merged["env"] = $env
|
|
111
|
-
}
|
|
150
|
+
fs.writeFileSync(destinationPath, JSON.stringify(merged, null, 2) + '\n')
|
|
151
|
+
'@
|
|
112
152
|
|
|
113
|
-
$
|
|
114
|
-
|
|
115
|
-
foreach ($property in $sourceSettings.mcpServers.PSObject.Properties) {
|
|
116
|
-
$mcpServers[$property.Name] = $property.Value
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
if ($existingSettings.PSObject.Properties.Name -contains "mcpServers") {
|
|
120
|
-
foreach ($property in $existingSettings.mcpServers.PSObject.Properties) {
|
|
121
|
-
$mcpServers[$property.Name] = $property.Value
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if ($mcpServers.Count -gt 0) {
|
|
125
|
-
$merged["mcpServers"] = $mcpServers
|
|
126
|
-
}
|
|
153
|
+
$scriptFile = [System.IO.Path]::GetTempFileName()
|
|
154
|
+
Set-Content -LiteralPath $scriptFile -Value $mergeScript -Encoding UTF8
|
|
127
155
|
|
|
128
|
-
|
|
156
|
+
try {
|
|
157
|
+
& node $scriptFile $Source $Destination
|
|
158
|
+
} finally {
|
|
159
|
+
Remove-Item -LiteralPath $scriptFile -Force -ErrorAction SilentlyContinue
|
|
160
|
+
}
|
|
129
161
|
}
|
|
130
162
|
|
|
131
163
|
function Convert-ClaudeSettingsHookPaths {
|
|
@@ -238,7 +270,12 @@ function Remove-ObsoleteWorkflowPaths {
|
|
|
238
270
|
"scripts\hooks\session-end.js",
|
|
239
271
|
"scripts\lib\hook-flags.js",
|
|
240
272
|
"scripts\lib\utils.js",
|
|
241
|
-
"hooks\review-confidence.js"
|
|
273
|
+
"hooks\review-confidence.js",
|
|
274
|
+
"hooks\session-start.js",
|
|
275
|
+
"hooks\session-end.js",
|
|
276
|
+
"hooks\evaluate-session.js",
|
|
277
|
+
"hooks\pre-compact.js",
|
|
278
|
+
"hooks\runtime\session-utils.js"
|
|
242
279
|
)
|
|
243
280
|
|
|
244
281
|
foreach ($relative in $obsoleteFiles) {
|
package/scripts/install.sh
CHANGED
|
@@ -86,7 +86,7 @@ copy_claude_settings() {
|
|
|
86
86
|
|
|
87
87
|
backup_if_changed "$src" "$dest"
|
|
88
88
|
if [ "$DRY_RUN" -eq 1 ]; then
|
|
89
|
-
echo "[dry-run] merge '$src' into '$dest' preserving existing env and mcpServers"
|
|
89
|
+
echo "[dry-run] merge '$src' into '$dest' preserving existing env and mcpServers, purging legacy hook paths"
|
|
90
90
|
return
|
|
91
91
|
fi
|
|
92
92
|
|
|
@@ -99,6 +99,49 @@ const existing = fs.existsSync(destinationPath)
|
|
|
99
99
|
? JSON.parse(fs.readFileSync(destinationPath, 'utf8'))
|
|
100
100
|
: {}
|
|
101
101
|
|
|
102
|
+
// 清理旧版 Hook 路径模式,避免合并后残留不存在的文件引用
|
|
103
|
+
const LEGACY_HOOK_PATTERNS = [
|
|
104
|
+
'scripts/hooks/run-with-flags.js',
|
|
105
|
+
'scripts/hooks/commit-quality.js',
|
|
106
|
+
'scripts/hooks/session-start.js',
|
|
107
|
+
'scripts/hooks/session-end.js',
|
|
108
|
+
'scripts/lib/hook-flags.js',
|
|
109
|
+
'scripts/lib/utils.js',
|
|
110
|
+
'hooks/observe.js',
|
|
111
|
+
'hooks/review-confidence.js',
|
|
112
|
+
'hooks/session-start.js',
|
|
113
|
+
'hooks/session-end.js',
|
|
114
|
+
'hooks/evaluate-session.js',
|
|
115
|
+
'hooks/pre-compact.js',
|
|
116
|
+
'hooks/runtime/session-utils.js'
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
function isLegacyHook(hookDef) {
|
|
120
|
+
if (typeof hookDef !== 'object' || !hookDef.command) return false
|
|
121
|
+
return LEGACY_HOOK_PATTERNS.some(p => hookDef.command.includes(p))
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function filterHooks(hooksArray) {
|
|
125
|
+
if (!Array.isArray(hooksArray)) return hooksArray
|
|
126
|
+
return hooksArray.map(entry => {
|
|
127
|
+
if (!entry || !Array.isArray(entry.hooks)) return entry
|
|
128
|
+
const filtered = entry.hooks.filter(h => !isLegacyHook(h))
|
|
129
|
+
return { ...entry, hooks: filtered }
|
|
130
|
+
}).filter(entry => entry.hooks && entry.hooks.length > 0)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function cleanHooks(hooksObj) {
|
|
134
|
+
if (!hooksObj || typeof hooksObj !== 'object') return hooksObj
|
|
135
|
+
const cleaned = {}
|
|
136
|
+
for (const [eventType, entries] of Object.entries(hooksObj)) {
|
|
137
|
+
const filtered = filterHooks(entries)
|
|
138
|
+
if (filtered.length > 0) {
|
|
139
|
+
cleaned[eventType] = filtered
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return cleaned
|
|
143
|
+
}
|
|
144
|
+
|
|
102
145
|
const merged = {
|
|
103
146
|
...existing,
|
|
104
147
|
...source,
|
|
@@ -109,7 +152,12 @@ const merged = {
|
|
|
109
152
|
mcpServers: {
|
|
110
153
|
...(source.mcpServers || {}),
|
|
111
154
|
...(existing.mcpServers || {})
|
|
112
|
-
}
|
|
155
|
+
},
|
|
156
|
+
// hooks 以 source 为权威,清理 existing 中的旧版残留
|
|
157
|
+
hooks: cleanHooks({
|
|
158
|
+
...(existing.hooks || {}),
|
|
159
|
+
...(source.hooks || {})
|
|
160
|
+
})
|
|
113
161
|
}
|
|
114
162
|
|
|
115
163
|
fs.writeFileSync(destinationPath, JSON.stringify(merged, null, 2) + '\n')
|
|
@@ -178,7 +226,12 @@ remove_obsolete_workflow_paths() {
|
|
|
178
226
|
"scripts/hooks/session-end.js" \
|
|
179
227
|
"scripts/lib/hook-flags.js" \
|
|
180
228
|
"scripts/lib/utils.js" \
|
|
181
|
-
"hooks/review-confidence.js"
|
|
229
|
+
"hooks/review-confidence.js" \
|
|
230
|
+
"hooks/session-start.js" \
|
|
231
|
+
"hooks/session-end.js" \
|
|
232
|
+
"hooks/evaluate-session.js" \
|
|
233
|
+
"hooks/pre-compact.js" \
|
|
234
|
+
"hooks/runtime/session-utils.js"
|
|
182
235
|
do
|
|
183
236
|
if [ -f "$dest/$file" ]; then
|
|
184
237
|
run rm -f "$dest/$file"
|
|
@@ -50,6 +50,8 @@ function managedFiles() {
|
|
|
50
50
|
"skills/continuous-learning-v2",
|
|
51
51
|
"skills/test-driven-development",
|
|
52
52
|
"skills/e2e-testing",
|
|
53
|
+
"skills/using-superpowers",
|
|
54
|
+
"skills/subagent-driven-development",
|
|
53
55
|
"skills/brainstorming",
|
|
54
56
|
"skills/using-git-worktrees",
|
|
55
57
|
"skills/executing-plans",
|
|
@@ -232,10 +234,30 @@ function checkHookConfigReferences() {
|
|
|
232
234
|
|
|
233
235
|
collect(settings.hooks);
|
|
234
236
|
|
|
237
|
+
const LEGACY_HOOK_PATTERNS = [
|
|
238
|
+
"scripts/hooks/run-with-flags.js",
|
|
239
|
+
"scripts/hooks/commit-quality.js",
|
|
240
|
+
"scripts/hooks/session-start.js",
|
|
241
|
+
"scripts/hooks/session-end.js",
|
|
242
|
+
"scripts/lib/hook-flags.js",
|
|
243
|
+
"hooks/observe.js",
|
|
244
|
+
"hooks/review-confidence.js",
|
|
245
|
+
"hooks/session-start.js",
|
|
246
|
+
"hooks/session-end.js",
|
|
247
|
+
"hooks/evaluate-session.js",
|
|
248
|
+
"hooks/pre-compact.js",
|
|
249
|
+
"hooks/runtime/session-utils.js",
|
|
250
|
+
];
|
|
251
|
+
|
|
235
252
|
for (const command of commands) {
|
|
236
253
|
if (command.includes("$HOME/.codex")) {
|
|
237
254
|
fail("settings.json should not point hooks at ~/.codex");
|
|
238
255
|
}
|
|
256
|
+
for (const legacy of LEGACY_HOOK_PATTERNS) {
|
|
257
|
+
if (command.includes(legacy)) {
|
|
258
|
+
fail(`settings.json contains legacy hook path: ${legacy}`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
239
261
|
const matches = [...command.matchAll(/\$HOME\/\.claude\/([^" ]+)/g)];
|
|
240
262
|
for (const match of matches) {
|
|
241
263
|
const referenced = match[1];
|
|
@@ -244,6 +266,43 @@ function checkHookConfigReferences() {
|
|
|
244
266
|
}
|
|
245
267
|
}
|
|
246
268
|
}
|
|
269
|
+
|
|
270
|
+
// 验证安装脚本包含旧版 Hook 清理逻辑
|
|
271
|
+
for (const installer of ["scripts/install.sh", "scripts/install.ps1"]) {
|
|
272
|
+
if (!exists(installer)) continue;
|
|
273
|
+
const body = read(installer);
|
|
274
|
+
if (!body.includes("LEGACY_HOOK_PATTERNS") && !body.includes("isLegacyHook")) {
|
|
275
|
+
fail(`${installer} should include legacy hook path cleanup logic`);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function checkGitHubWorkflows() {
|
|
281
|
+
requireTokens(".github/workflows/ci.yml", [
|
|
282
|
+
"pull_request",
|
|
283
|
+
"npm run verify",
|
|
284
|
+
"npm run pack:dry-run",
|
|
285
|
+
]);
|
|
286
|
+
|
|
287
|
+
requireTokens(".github/workflows/npm-publish.yml", [
|
|
288
|
+
"workflow_dispatch",
|
|
289
|
+
"id-token: write",
|
|
290
|
+
"node-version: 22.14.0",
|
|
291
|
+
"package-manager-cache: false",
|
|
292
|
+
"npm install -g npm@11.5.1",
|
|
293
|
+
"npm view \"$PACKAGE_NAME\" version --registry=https://registry.npmjs.org",
|
|
294
|
+
"BASE_VERSION=\"${REGISTRY_VERSION:-$LOCAL_VERSION}\"",
|
|
295
|
+
"npm version \"$VERSION\" --no-git-tag-version",
|
|
296
|
+
"npm publish",
|
|
297
|
+
"git push --follow-tags origin HEAD:main",
|
|
298
|
+
"[skip npm]",
|
|
299
|
+
]);
|
|
300
|
+
|
|
301
|
+
requireTokens("README.md", [
|
|
302
|
+
"npm 自动发布",
|
|
303
|
+
"受信任的发布商",
|
|
304
|
+
"npm registry 的当前 `latest` 版本",
|
|
305
|
+
]);
|
|
247
306
|
}
|
|
248
307
|
|
|
249
308
|
function checkLearningPathPolicy() {
|
|
@@ -359,6 +418,43 @@ function checkNpmPackageSurface() {
|
|
|
359
418
|
}
|
|
360
419
|
|
|
361
420
|
function checkSkillLinks() {
|
|
421
|
+
requireTokens("skills/using-superpowers/SKILL.md", [
|
|
422
|
+
"Skill Invocation Rule",
|
|
423
|
+
"Task arrives",
|
|
424
|
+
"approved plan + SDD/commit approved?",
|
|
425
|
+
"external skill learning or edit?",
|
|
426
|
+
"process skills before implementation skills",
|
|
427
|
+
"skills/brainstorming/SKILL.md",
|
|
428
|
+
"skills/systematic-debugging/SKILL.md",
|
|
429
|
+
"skills/verification-before-completion/SKILL.md",
|
|
430
|
+
"User instructions",
|
|
431
|
+
]);
|
|
432
|
+
|
|
433
|
+
requireTokens("skills/subagent-driven-development/SKILL.md", [
|
|
434
|
+
".superpowers/sdd/progress.md",
|
|
435
|
+
"scripts/task-brief",
|
|
436
|
+
"scripts/review-package BASE HEAD",
|
|
437
|
+
"task-reviewer-prompt.md",
|
|
438
|
+
"Local Git Boundary",
|
|
439
|
+
"skills/executing-plans/SKILL.md",
|
|
440
|
+
]);
|
|
441
|
+
|
|
442
|
+
requireTokens("skills/subagent-driven-development/task-reviewer-prompt.md", [
|
|
443
|
+
"Spec Compliance",
|
|
444
|
+
"Task quality",
|
|
445
|
+
"Cannot verify from diff",
|
|
446
|
+
"[BRIEF_FILE]",
|
|
447
|
+
"[DIFF_FILE]",
|
|
448
|
+
]);
|
|
449
|
+
|
|
450
|
+
for (const script of [
|
|
451
|
+
"skills/subagent-driven-development/scripts/sdd-workspace",
|
|
452
|
+
"skills/subagent-driven-development/scripts/task-brief",
|
|
453
|
+
"skills/subagent-driven-development/scripts/review-package",
|
|
454
|
+
]) {
|
|
455
|
+
if (!exists(script)) fail(`${script} is missing`);
|
|
456
|
+
}
|
|
457
|
+
|
|
362
458
|
const expected = [
|
|
363
459
|
["agents/e2e-runner.md", "skills/e2e-testing/SKILL.md"],
|
|
364
460
|
["agents/tdd-guide.md", "skills/test-driven-development/SKILL.md"],
|
|
@@ -395,6 +491,9 @@ function checkSkillLinks() {
|
|
|
395
491
|
"agents/code-reviewer.md",
|
|
396
492
|
"skills/systematic-debugging/SKILL.md",
|
|
397
493
|
"skills/verification-before-completion/SKILL.md",
|
|
494
|
+
"skills/subagent-driven-development/SKILL.md",
|
|
495
|
+
"## Global Constraints",
|
|
496
|
+
"**Interfaces:**",
|
|
398
497
|
"Completion Loop",
|
|
399
498
|
"`/verify`",
|
|
400
499
|
"`/pr`",
|
|
@@ -529,6 +628,13 @@ function requireTokens(file, tokens) {
|
|
|
529
628
|
function checkSuperpowersDevLoop() {
|
|
530
629
|
requireTokens("README.md", [
|
|
531
630
|
"Superpowers 风格开发闭环",
|
|
631
|
+
"using-superpowers",
|
|
632
|
+
"subagent-driven-development",
|
|
633
|
+
".superpowers/sdd",
|
|
634
|
+
"Global Constraints",
|
|
635
|
+
"Interfaces",
|
|
636
|
+
"?key=",
|
|
637
|
+
"4 小时",
|
|
532
638
|
"using-git-worktrees",
|
|
533
639
|
"executing-plans",
|
|
534
640
|
"verification-before-completion",
|
|
@@ -551,6 +657,12 @@ function checkSuperpowersDevLoop() {
|
|
|
551
657
|
"PR Gate",
|
|
552
658
|
]);
|
|
553
659
|
|
|
660
|
+
requireTokens("rules/common/skills-learning.md", [
|
|
661
|
+
"skills/using-superpowers/SKILL.md",
|
|
662
|
+
"process skill 优先于 implementation skill",
|
|
663
|
+
"不凭记忆执行 skill",
|
|
664
|
+
]);
|
|
665
|
+
|
|
554
666
|
requireTokens("skills/brainstorming/SKILL.md", [
|
|
555
667
|
"Spec Gate",
|
|
556
668
|
"reviewed and approved the saved spec",
|
|
@@ -560,6 +672,9 @@ function checkSuperpowersDevLoop() {
|
|
|
560
672
|
"## Preconditions",
|
|
561
673
|
"approved spec",
|
|
562
674
|
"Plan Gate",
|
|
675
|
+
"## Global Constraints",
|
|
676
|
+
"**Interfaces:**",
|
|
677
|
+
"skills/subagent-driven-development/SKILL.md",
|
|
563
678
|
]);
|
|
564
679
|
|
|
565
680
|
requireTokens("skills/test-driven-development/SKILL.md", [
|
|
@@ -585,6 +700,30 @@ function checkSuperpowersDevLoop() {
|
|
|
585
700
|
"docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md",
|
|
586
701
|
"Write design doc",
|
|
587
702
|
]);
|
|
703
|
+
|
|
704
|
+
requireTokens("skills/brainstorming/visual-companion.md", [
|
|
705
|
+
"session key",
|
|
706
|
+
"?key=",
|
|
707
|
+
"4 hours idle",
|
|
708
|
+
"--idle-timeout-minutes",
|
|
709
|
+
"same port",
|
|
710
|
+
]);
|
|
711
|
+
|
|
712
|
+
requireTokens("skills/brainstorming/scripts/server.cjs", [
|
|
713
|
+
"BRAINSTORM_TOKEN",
|
|
714
|
+
"BRAINSTORM_TOKEN_FILE",
|
|
715
|
+
"timingSafeEqualStr",
|
|
716
|
+
"Cache-Control",
|
|
717
|
+
"X-Frame-Options",
|
|
718
|
+
"Default 4 hours",
|
|
719
|
+
]);
|
|
720
|
+
|
|
721
|
+
requireTokens("skills/brainstorming/scripts/start-server.sh", [
|
|
722
|
+
"--idle-timeout-minutes",
|
|
723
|
+
"BRAINSTORM_TOKEN_FILE",
|
|
724
|
+
"umask 077",
|
|
725
|
+
".last-token",
|
|
726
|
+
]);
|
|
588
727
|
}
|
|
589
728
|
|
|
590
729
|
function checkForbiddenCommandDrift() {
|
|
@@ -630,6 +769,11 @@ function checkScriptLayout() {
|
|
|
630
769
|
"scripts/lib/utils.js",
|
|
631
770
|
"scripts/learning/utils.js",
|
|
632
771
|
"hooks/review-confidence.js",
|
|
772
|
+
"hooks/session-start.js",
|
|
773
|
+
"hooks/session-end.js",
|
|
774
|
+
"hooks/evaluate-session.js",
|
|
775
|
+
"hooks/pre-compact.js",
|
|
776
|
+
"hooks/runtime/session-utils.js",
|
|
633
777
|
]) {
|
|
634
778
|
if (exists(legacyPath)) {
|
|
635
779
|
fail(`${legacyPath} should not exist after script layout cleanup`);
|
|
@@ -639,10 +783,8 @@ function checkScriptLayout() {
|
|
|
639
783
|
for (const requiredPath of [
|
|
640
784
|
"hooks/runtime/run-with-flags.js",
|
|
641
785
|
"hooks/runtime/hook-flags.js",
|
|
642
|
-
"hooks/runtime/session-utils.js",
|
|
643
|
-
"hooks/session-start.js",
|
|
644
|
-
"hooks/session-end.js",
|
|
645
786
|
"hooks/commit-quality.js",
|
|
787
|
+
"hooks/check-console-log.js",
|
|
646
788
|
"hooks/check-code-size.js",
|
|
647
789
|
"scripts/learning/review-confidence.js",
|
|
648
790
|
"scripts/learning/project-utils.js",
|
|
@@ -657,8 +799,10 @@ function checkScriptLayout() {
|
|
|
657
799
|
|
|
658
800
|
requireTokens("settings.json", [
|
|
659
801
|
"hooks/runtime/run-with-flags.js",
|
|
660
|
-
"hooks/
|
|
661
|
-
"hooks/
|
|
802
|
+
"hooks/check-console-log.js",
|
|
803
|
+
"hooks/check-code-size.js",
|
|
804
|
+
"hooks/commit-quality.js",
|
|
805
|
+
"skills/continuous-learning-v2/hooks/observe-v2.js",
|
|
662
806
|
]);
|
|
663
807
|
|
|
664
808
|
requireTokens("scripts/install.ps1", [
|
|
@@ -686,6 +830,11 @@ function checkScriptLayout() {
|
|
|
686
830
|
"scripts/hooks/run-with-flags.js",
|
|
687
831
|
"scripts/lib/hook-flags.js",
|
|
688
832
|
"hooks/review-confidence.js",
|
|
833
|
+
"hooks/session-start.js",
|
|
834
|
+
"hooks/session-end.js",
|
|
835
|
+
"hooks/evaluate-session.js",
|
|
836
|
+
"hooks/pre-compact.js",
|
|
837
|
+
"hooks/runtime/session-utils.js",
|
|
689
838
|
]) {
|
|
690
839
|
if (body.includes(forbidden)) {
|
|
691
840
|
fail(`${file} references legacy path ${forbidden}`);
|
|
@@ -844,6 +993,7 @@ function main() {
|
|
|
844
993
|
checkReadmeTreePaths();
|
|
845
994
|
checkInstallRuntimePolicy();
|
|
846
995
|
checkHookConfigReferences();
|
|
996
|
+
checkGitHubWorkflows();
|
|
847
997
|
checkLearningPathPolicy();
|
|
848
998
|
checkRouterTargets();
|
|
849
999
|
checkNpmPackageSurface();
|