claude-everything-workflow 0.2.5 → 0.2.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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/AGENTS.md +2 -0
- package/bin/claude-everything-workflow.js +15 -0
- package/harness/manifest.json +1 -1
- package/package.json +2 -1
- package/rules/01-base.md +4 -1
- package/rules/02-implementation.md +1 -1
- package/rules/common/testing.md +1 -0
- package/scripts/install.ps1 +28 -44
- package/scripts/install.sh +31 -3
- package/scripts/learning/migrate-homunculus.js +10 -5
- package/scripts/learning/project-utils.js +9 -0
- package/scripts/learning/promote.js +27 -10
- package/scripts/merge-claude-settings.cjs +88 -25
- package/scripts/verify/install-rules.test.js +183 -0
- package/scripts/verify/learning.test.js +122 -0
- package/scripts/verify/metadata-checks.js +1 -1
- package/scripts/verify/skill-invocation.test.js +6 -1
- package/scripts/verify/skill-manifest-checks.js +7 -4
- package/scripts/verify/workflow-checks.js +0 -1
- package/skills/README.md +1 -1
- package/skills/code-review/SKILL.md +7 -2
- package/skills/code-review/references/spec-reviewer-prompt.md +7 -4
- package/skills/continuous-learning-v2/SKILL.md +1 -0
- package/skills/continuous-learning-v2/config.json +1 -1
- package/skills/continuous-learning-v2/hooks/observe-v2.js +2 -9
- package/skills/feature-acceptance/SKILL.md +13 -5
- package/skills/feature-acceptance/references/project-verification.md +55 -0
- package/skills/implement/SKILL.md +3 -1
- package/skills/implement/agents/openai.yaml +2 -0
- package/skills/using-superpowers/SKILL.md +9 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-everything-workflow",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Evidence-based engineering workflows: implement, debug, review and verify.",
|
|
5
5
|
"author": { "name": "xu91102" },
|
|
6
6
|
"homepage": "https://github.com/xu91102/claude-everything-Workflow",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-everything-workflow",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Evidence-based engineering workflows: implement, debug, review and verify.",
|
|
5
5
|
"author": { "name": "xu91102" },
|
|
6
6
|
"homepage": "https://github.com/xu91102/claude-everything-Workflow",
|
package/AGENTS.md
CHANGED
|
@@ -30,6 +30,21 @@ function main() {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function runInstall(args) {
|
|
33
|
+
const supported = new Set(["--claude-only", "--codex-only", "--dry-run", "--help", "-h"]);
|
|
34
|
+
const unknown = args.find((arg) => !supported.has(arg));
|
|
35
|
+
if (unknown) {
|
|
36
|
+
process.stderr.write(`Unknown option: ${unknown}\n`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
if (args.includes("--claude-only") && args.includes("--codex-only")) {
|
|
40
|
+
process.stderr.write("--claude-only and --codex-only cannot be used together\n");
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
44
|
+
printHelp();
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
|
|
33
48
|
if (process.platform === "win32") {
|
|
34
49
|
const script = path.join(root, "scripts", "install.ps1");
|
|
35
50
|
const psArgs = [
|
package/harness/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-everything-workflow",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Claude Code and Codex harness with rules, skills, agents, hooks, and verification gates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"test:invocation": "node scripts/verify/skill-invocation.test.js",
|
|
22
22
|
"test:continuation": "node scripts/verify/continuation-checks.test.js",
|
|
23
23
|
"test:install-rules": "node scripts/verify/install-rules.test.js",
|
|
24
|
+
"test:learning": "node --test scripts/verify/learning.test.js",
|
|
24
25
|
"test:plugins": "node --test scripts/verify/plugin-distribution.test.js",
|
|
25
26
|
"verify:upstream": "node scripts/verify-upstream-capability-map.js",
|
|
26
27
|
"pack:dry-run": "npm pack --dry-run"
|
package/rules/01-base.md
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# 执行原则
|
|
2
2
|
|
|
3
3
|
- 先理解用户目标和真实调用链,可查事实自行读取。只询问会实质改变结果且无法查明的用户决策。
|
|
4
|
-
-
|
|
4
|
+
- 实施前简述当前目标、预计修改范围和验收标准;用户已明确时直接沿用。已授权范围内自主完成,不重复索要确认;
|
|
5
|
+
必须扩大已约定的目标、修改边界或验收标准时,先说明必要性、影响与最小方案,获准后再扩大。
|
|
6
|
+
- 改动必须对应当前任务的需求、失败用例或验收标准;保留已有用户改动,无关问题只记录,不自动纳入本次任务。
|
|
5
7
|
- 优先复用项目现有入口、标准库和已安装依赖;最后才写最小新增代码,并修在共同根因位置。
|
|
6
8
|
- 最小实现不得省略安全、输入校验、错误处理、兼容性、无障碍和必要验证。
|
|
7
9
|
- 目标项目的架构、lint、类型、测试和风格配置优先于本套通用默认值;没有配置时才使用相关规则的回退建议。
|
|
10
|
+
- 收尾核对完整实际差异(含新增文件),撤回本轮引入的无关改动;约定验收与必要审查验证通过后结束,不自行追加目标。
|
|
8
11
|
- 流程路由与升级条件只由 `skills/using-superpowers/SKILL.md` 维护;验证范围见 `rules/common/testing.md`,
|
|
9
12
|
Git 与授权见 `rules/05-git-workflow.md`。不在 rules 重写 Skill 的状态机。
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
- 遵循目标项目的目录、分层和依赖方向;仅调整影响当前需求的职责与耦合。
|
|
6
6
|
- 抽象应隐藏细节、减少调用方复杂度;不为假设的复用增加接口或透传层。
|
|
7
|
-
-
|
|
7
|
+
- 局部修复只改变已授权的目标场景;修改共享逻辑前检查相关调用方,在需求范围内修复共同根因,并用相称回归证据确认非目标调用方的输入输出、错误、重试/超时及副作用不变。
|
|
8
8
|
- 复杂度相近时,优先边界行为正确、维护成本低的方案。
|
|
9
9
|
- 实现、测试和类型保持局部性;跨域共用目录只承接已出现的稳定复用。
|
|
10
10
|
- 状态变化显式,遵循项目更新惯例;保留公共接口和既有工作流,破坏性变更需用户批准。
|
package/rules/common/testing.md
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
## 默认策略
|
|
11
11
|
|
|
12
12
|
- 先识别仓库已有的 lint、format、单测、类型、构建和 E2E 命令,不发明替代流程。
|
|
13
|
+
- 项目验收合同要求真实流程时,按 `skills/feature-acceptance/SKILL.md` 复用项目验收入口和功能地图;普通验证不自动创建验收基础设施。
|
|
13
14
|
- 中间步骤运行覆盖当前改动面的最小验证;完成、跨模块、高风险、发布或 PR 前升级到完整相关质量门。
|
|
14
15
|
- 无法运行某项检查时,说明原因、替代证据和剩余风险;不得把未运行写成通过。
|
|
15
16
|
- monorepo 的 consumer 依赖内部构建产物时,先构建对应上游 package。
|
package/scripts/install.ps1
CHANGED
|
@@ -6,6 +6,13 @@ param(
|
|
|
6
6
|
|
|
7
7
|
$ErrorActionPreference = "Stop"
|
|
8
8
|
|
|
9
|
+
if ($args.Count -gt 0) {
|
|
10
|
+
throw "Unknown option: $($args[0])"
|
|
11
|
+
}
|
|
12
|
+
if ($ClaudeOnly -and $CodexOnly) {
|
|
13
|
+
throw "-ClaudeOnly and -CodexOnly cannot be used together"
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
$RootDir = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
|
10
17
|
$HomeDir = if ($env:USERPROFILE) { $env:USERPROFILE } else { $HOME }
|
|
11
18
|
|
|
@@ -74,55 +81,16 @@ function Copy-ClaudeSettings {
|
|
|
74
81
|
Backup-IfChanged -Source $Source -Destination $Destination
|
|
75
82
|
|
|
76
83
|
if ($DryRun) {
|
|
77
|
-
Write-Host "[dry-run] Merge '$Source' into '$Destination' preserving existing env and mcpServers"
|
|
84
|
+
Write-Host "[dry-run] Merge '$Source' into '$Destination' preserving existing user hooks, env and mcpServers"
|
|
78
85
|
Write-Host "[dry-run] Purge legacy hook paths while merging Claude settings"
|
|
79
86
|
return
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
$mergeScript = Join-Path $RootDir "scripts\merge-claude-settings.cjs"
|
|
83
|
-
& node $mergeScript $Source $Destination
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
function Convert-ClaudeSettingsHookPaths {
|
|
87
|
-
param([string]$SettingsPath)
|
|
88
|
-
|
|
89
|
-
if ($DryRun) {
|
|
90
|
-
Write-Host "[dry-run] Convert hook paths in '$SettingsPath' to Windows absolute paths"
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
$settings = Get-Content -LiteralPath $SettingsPath -Raw | ConvertFrom-Json
|
|
95
|
-
$claudeHome = Join-Path $HomeDir ".claude"
|
|
96
|
-
|
|
97
|
-
function Update-Commands {
|
|
98
|
-
param($Value)
|
|
99
|
-
|
|
100
|
-
if ($null -eq $Value) {
|
|
101
|
-
return
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if ($Value -is [System.Array]) {
|
|
105
|
-
foreach ($item in $Value) {
|
|
106
|
-
Update-Commands -Value $item
|
|
107
|
-
}
|
|
108
|
-
return
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if ($Value -isnot [psobject]) {
|
|
112
|
-
return
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if ($Value.PSObject.Properties.Name -contains "command" -and $Value.command -is [string]) {
|
|
116
|
-
$Value.command = $Value.command.Replace('$HOME/.claude', $claudeHome)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
foreach ($property in $Value.PSObject.Properties) {
|
|
120
|
-
Update-Commands -Value $property.Value
|
|
121
|
-
}
|
|
90
|
+
& node $mergeScript $Source $Destination --windows-paths
|
|
91
|
+
if ($LASTEXITCODE -ne 0) {
|
|
92
|
+
throw "Claude settings merge failed with exit code $LASTEXITCODE"
|
|
122
93
|
}
|
|
123
|
-
|
|
124
|
-
Update-Commands -Value $settings.hooks
|
|
125
|
-
$settings | ConvertTo-Json -Depth 100 | Set-Content -LiteralPath $SettingsPath -Encoding UTF8
|
|
126
94
|
}
|
|
127
95
|
|
|
128
96
|
function Copy-DirectoryMerge {
|
|
@@ -191,6 +159,7 @@ function Remove-PackageOnlyPaths {
|
|
|
191
159
|
"scripts\verify\skill-invocation.test.js",
|
|
192
160
|
"scripts\verify\continuation-checks.test.js",
|
|
193
161
|
"scripts\verify\install-rules.test.js",
|
|
162
|
+
"scripts\verify\learning.test.js",
|
|
194
163
|
"scripts\verify\plugin-distribution.test.js"
|
|
195
164
|
)
|
|
196
165
|
|
|
@@ -297,6 +266,15 @@ function Test-RetiredSkillManifest {
|
|
|
297
266
|
}
|
|
298
267
|
}
|
|
299
268
|
|
|
269
|
+
function Test-InstallRoot {
|
|
270
|
+
param([string]$Destination)
|
|
271
|
+
|
|
272
|
+
$existing = Get-Item -LiteralPath $Destination -Force -ErrorAction SilentlyContinue
|
|
273
|
+
if ($null -ne $existing -and ($existing.Attributes -band [IO.FileAttributes]::ReparsePoint)) {
|
|
274
|
+
throw "Refusing symlinked install root: $Destination"
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
300
278
|
function Install-ClaudeWorkflow {
|
|
301
279
|
$dest = Join-Path $HomeDir ".claude"
|
|
302
280
|
|
|
@@ -310,7 +288,6 @@ function Install-ClaudeWorkflow {
|
|
|
310
288
|
Copy-ConfigFile -Source (Join-Path $RootDir "AGENTS.md") -Destination (Join-Path $dest "AGENTS.md")
|
|
311
289
|
$settingsPath = Join-Path $dest "settings.json"
|
|
312
290
|
Copy-ClaudeSettings -Source (Join-Path $RootDir "settings.json") -Destination $settingsPath
|
|
313
|
-
Convert-ClaudeSettingsHookPaths -SettingsPath $settingsPath
|
|
314
291
|
Install-SharedDirs -Destination $dest
|
|
315
292
|
Install-WorkflowRules -Destination $dest -HostName "claude-code"
|
|
316
293
|
Remove-RetiredSkills -Destination $dest
|
|
@@ -344,6 +321,13 @@ function Install-WorkflowRules {
|
|
|
344
321
|
}
|
|
345
322
|
}
|
|
346
323
|
|
|
324
|
+
if ($InstallClaude) {
|
|
325
|
+
Test-InstallRoot -Destination (Join-Path $HomeDir ".claude")
|
|
326
|
+
}
|
|
327
|
+
if ($InstallCodex) {
|
|
328
|
+
Test-InstallRoot -Destination (Join-Path $HomeDir ".codex")
|
|
329
|
+
}
|
|
330
|
+
|
|
347
331
|
Test-RetiredSkillManifest
|
|
348
332
|
|
|
349
333
|
if ($InstallClaude) {
|
package/scripts/install.sh
CHANGED
|
@@ -7,6 +7,7 @@ HOME_DIR="${HOME:?HOME is required}"
|
|
|
7
7
|
INSTALL_CLAUDE=1
|
|
8
8
|
INSTALL_CODEX=1
|
|
9
9
|
DRY_RUN=0
|
|
10
|
+
SHOW_HELP=0
|
|
10
11
|
|
|
11
12
|
usage() {
|
|
12
13
|
cat <<'EOF'
|
|
@@ -23,10 +24,18 @@ EOF
|
|
|
23
24
|
while [ "$#" -gt 0 ]; do
|
|
24
25
|
case "$1" in
|
|
25
26
|
--claude-only)
|
|
27
|
+
if [ "$INSTALL_CLAUDE" -eq 0 ]; then
|
|
28
|
+
echo "--claude-only and --codex-only cannot be used together" >&2
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
26
31
|
INSTALL_CLAUDE=1
|
|
27
32
|
INSTALL_CODEX=0
|
|
28
33
|
;;
|
|
29
34
|
--codex-only)
|
|
35
|
+
if [ "$INSTALL_CODEX" -eq 0 ]; then
|
|
36
|
+
echo "--claude-only and --codex-only cannot be used together" >&2
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
30
39
|
INSTALL_CLAUDE=0
|
|
31
40
|
INSTALL_CODEX=1
|
|
32
41
|
;;
|
|
@@ -34,8 +43,7 @@ while [ "$#" -gt 0 ]; do
|
|
|
34
43
|
DRY_RUN=1
|
|
35
44
|
;;
|
|
36
45
|
-h|--help)
|
|
37
|
-
|
|
38
|
-
exit 0
|
|
46
|
+
SHOW_HELP=1
|
|
39
47
|
;;
|
|
40
48
|
*)
|
|
41
49
|
echo "Unknown option: $1" >&2
|
|
@@ -46,6 +54,11 @@ while [ "$#" -gt 0 ]; do
|
|
|
46
54
|
shift
|
|
47
55
|
done
|
|
48
56
|
|
|
57
|
+
if [ "$SHOW_HELP" -eq 1 ]; then
|
|
58
|
+
usage
|
|
59
|
+
exit 0
|
|
60
|
+
fi
|
|
61
|
+
|
|
49
62
|
run() {
|
|
50
63
|
if [ "$DRY_RUN" -eq 1 ]; then
|
|
51
64
|
printf '[dry-run] %q' "$1"
|
|
@@ -86,7 +99,7 @@ copy_claude_settings() {
|
|
|
86
99
|
|
|
87
100
|
backup_if_changed "$src" "$dest"
|
|
88
101
|
if [ "$DRY_RUN" -eq 1 ]; then
|
|
89
|
-
echo "[dry-run] merge '$src' into '$dest' preserving existing env and mcpServers"
|
|
102
|
+
echo "[dry-run] merge '$src' into '$dest' preserving existing user hooks, env and mcpServers"
|
|
90
103
|
echo "[dry-run] purge legacy hook paths while merging Claude settings"
|
|
91
104
|
return
|
|
92
105
|
fi
|
|
@@ -157,6 +170,7 @@ remove_package_only_paths() {
|
|
|
157
170
|
"scripts/verify/skill-invocation.test.js" \
|
|
158
171
|
"scripts/verify/continuation-checks.test.js" \
|
|
159
172
|
"scripts/verify/install-rules.test.js" \
|
|
173
|
+
"scripts/verify/learning.test.js" \
|
|
160
174
|
"scripts/verify/plugin-distribution.test.js"
|
|
161
175
|
do
|
|
162
176
|
if [ -f "$dest/$file" ]; then
|
|
@@ -232,6 +246,13 @@ validate_retired_skill_manifest() {
|
|
|
232
246
|
node "$ROOT_DIR/scripts/cleanup-retired-skills.js" --validate
|
|
233
247
|
}
|
|
234
248
|
|
|
249
|
+
check_install_root() {
|
|
250
|
+
if [ -L "$1" ]; then
|
|
251
|
+
echo "Refusing symlinked install root: $1" >&2
|
|
252
|
+
exit 1
|
|
253
|
+
fi
|
|
254
|
+
}
|
|
255
|
+
|
|
235
256
|
install_claude() {
|
|
236
257
|
local dest="$HOME_DIR/.claude"
|
|
237
258
|
|
|
@@ -270,6 +291,13 @@ install_workflow_rules() {
|
|
|
270
291
|
}
|
|
271
292
|
|
|
272
293
|
validate_retired_skill_manifest
|
|
294
|
+
if [ "$INSTALL_CLAUDE" -eq 1 ]; then
|
|
295
|
+
check_install_root "$HOME_DIR/.claude"
|
|
296
|
+
fi
|
|
297
|
+
if [ "$INSTALL_CODEX" -eq 1 ]; then
|
|
298
|
+
check_install_root "$HOME_DIR/.codex"
|
|
299
|
+
fi
|
|
300
|
+
|
|
273
301
|
require_rsync
|
|
274
302
|
|
|
275
303
|
if [ "$INSTALL_CLAUDE" -eq 1 ]; then
|
|
@@ -15,14 +15,14 @@ const {
|
|
|
15
15
|
getProjectContext,
|
|
16
16
|
getProjectInstinctsDir,
|
|
17
17
|
loadConfig,
|
|
18
|
-
registerProject
|
|
18
|
+
registerProject,
|
|
19
|
+
shouldApply
|
|
19
20
|
} = require('./project-utils')
|
|
20
21
|
|
|
21
22
|
function parseArgs() {
|
|
22
23
|
const args = process.argv.slice(2)
|
|
23
24
|
return {
|
|
24
|
-
apply: args
|
|
25
|
-
dryRun: args.includes('--dry-run') || !args.includes('--apply'),
|
|
25
|
+
apply: shouldApply(args),
|
|
26
26
|
scope: parseStringArg(args, '--scope') || 'project',
|
|
27
27
|
source: parseStringArg(args, '--source') ||
|
|
28
28
|
path.join(os.homedir(), '.claude', 'homunculus', 'instincts')
|
|
@@ -63,7 +63,7 @@ function main() {
|
|
|
63
63
|
? getGlobalInstinctsDir(dataRoot)
|
|
64
64
|
: getProjectInstinctsDir(dataRoot, context.project_id)
|
|
65
65
|
|
|
66
|
-
if (options.scope !== 'global') {
|
|
66
|
+
if (options.apply && options.scope !== 'global') {
|
|
67
67
|
registerProject(dataRoot, context)
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -90,4 +90,9 @@ function main() {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
try {
|
|
94
|
+
main()
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error(`[Migrate] ${error.message}`)
|
|
97
|
+
process.exitCode = 1
|
|
98
|
+
}
|
|
@@ -68,6 +68,14 @@ function ensureDir(dirPath) {
|
|
|
68
68
|
return dirPath
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
function shouldApply(args) {
|
|
72
|
+
const apply = args.includes('--apply')
|
|
73
|
+
if (apply && args.includes('--dry-run')) {
|
|
74
|
+
throw new Error('--dry-run and --apply cannot be used together')
|
|
75
|
+
}
|
|
76
|
+
return apply
|
|
77
|
+
}
|
|
78
|
+
|
|
71
79
|
function runGit(args, cwd) {
|
|
72
80
|
return execFileSync('git', args, {
|
|
73
81
|
cwd,
|
|
@@ -210,5 +218,6 @@ module.exports = {
|
|
|
210
218
|
readJson,
|
|
211
219
|
registerProject,
|
|
212
220
|
scanInstincts,
|
|
221
|
+
shouldApply,
|
|
213
222
|
writeJson
|
|
214
223
|
}
|
|
@@ -15,16 +15,31 @@ const {
|
|
|
15
15
|
getProjectInstinctsDir,
|
|
16
16
|
loadConfig,
|
|
17
17
|
parseFrontmatter,
|
|
18
|
-
scanInstincts
|
|
18
|
+
scanInstincts,
|
|
19
|
+
shouldApply
|
|
19
20
|
} = require('./project-utils')
|
|
20
21
|
|
|
22
|
+
function parseConfidence(value) {
|
|
23
|
+
if (typeof value === 'string' && /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(value.trim())) {
|
|
24
|
+
value = Number(value)
|
|
25
|
+
}
|
|
26
|
+
return Number.isFinite(value) && value >= 0 && value <= 1 ? value : undefined
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
function parseArgs() {
|
|
22
30
|
const args = process.argv.slice(2)
|
|
31
|
+
const apply = shouldApply(args)
|
|
32
|
+
const flag = '--min-confidence'
|
|
33
|
+
const thresholds = args.filter(arg => arg === flag || arg.startsWith(`${flag}=`))
|
|
34
|
+
const raw = thresholds[0] === flag ? args[args.indexOf(flag) + 1] : thresholds[0]?.slice(flag.length + 1)
|
|
35
|
+
const minConfidence = thresholds.length === 0 ? 0.7 : parseConfidence(raw)
|
|
36
|
+
if (thresholds.length > 1 || minConfidence === undefined) {
|
|
37
|
+
throw new Error('--min-confidence requires a single number between 0 and 1')
|
|
38
|
+
}
|
|
23
39
|
return {
|
|
24
|
-
apply
|
|
25
|
-
dryRun: args.includes('--dry-run') || !args.includes('--apply'),
|
|
40
|
+
apply,
|
|
26
41
|
projectId: parseStringArg(args, '--project-id'),
|
|
27
|
-
minConfidence
|
|
42
|
+
minConfidence
|
|
28
43
|
}
|
|
29
44
|
}
|
|
30
45
|
|
|
@@ -51,11 +66,8 @@ function main() {
|
|
|
51
66
|
for (const fileInfo of files) {
|
|
52
67
|
const content = fs.readFileSync(fileInfo.path, 'utf8')
|
|
53
68
|
const { meta } = parseFrontmatter(content)
|
|
54
|
-
const confidence =
|
|
55
|
-
|
|
56
|
-
: parseFloat(meta.confidence) || 0
|
|
57
|
-
|
|
58
|
-
if (confidence < options.minConfidence) continue
|
|
69
|
+
const confidence = parseConfidence(meta.confidence)
|
|
70
|
+
if (confidence === undefined || confidence < options.minConfidence) continue
|
|
59
71
|
|
|
60
72
|
const destination = path.join(globalInstinctsDir, fileInfo.category, candidateSlug(fileInfo.path))
|
|
61
73
|
candidates.push({
|
|
@@ -95,4 +107,9 @@ function main() {
|
|
|
95
107
|
}
|
|
96
108
|
}
|
|
97
109
|
|
|
98
|
-
|
|
110
|
+
try {
|
|
111
|
+
main()
|
|
112
|
+
} catch (error) {
|
|
113
|
+
console.error(`[Promote] ${error.message}`)
|
|
114
|
+
process.exitCode = 1
|
|
115
|
+
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const fs = require("fs");
|
|
4
|
+
const os = require("os");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
|
|
7
|
+
const RUNNER = "hooks/runtime/run-with-flags.js";
|
|
8
|
+
const LEGACY_RUNNER = "scripts/hooks/run-with-flags.js";
|
|
9
|
+
const HOME_PREFIX = "$HOME/.claude";
|
|
4
10
|
|
|
5
11
|
const LEGACY_HOOK_PATTERNS = [
|
|
6
|
-
|
|
12
|
+
LEGACY_RUNNER,
|
|
7
13
|
"scripts/hooks/commit-quality.js",
|
|
8
14
|
"scripts/hooks/session-start.js",
|
|
9
15
|
"scripts/hooks/session-end.js",
|
|
@@ -17,40 +23,94 @@ const LEGACY_HOOK_PATTERNS = [
|
|
|
17
23
|
"hooks/pre-compact.js",
|
|
18
24
|
"hooks/runtime/session-utils.js",
|
|
19
25
|
];
|
|
26
|
+
const LEGACY_WRAPPED_TARGETS = new Map([
|
|
27
|
+
["session:start", ["scripts/hooks/session-start.js", "hooks/session-start.js"]],
|
|
28
|
+
["session:end", ["scripts/hooks/session-end.js", "hooks/session-end.js"]],
|
|
29
|
+
["stop:evaluate-session", ["hooks/evaluate-session.js"]],
|
|
30
|
+
["precompact:save-context", ["hooks/pre-compact.js"]],
|
|
31
|
+
["post:observe", ["hooks/observe.js"]],
|
|
32
|
+
["post:write:console-log", ["hooks/check-console-log.js"]],
|
|
33
|
+
["post:multiedit:console-log", ["hooks/check-console-log.js"]],
|
|
34
|
+
]);
|
|
20
35
|
|
|
21
|
-
function
|
|
22
|
-
if (
|
|
23
|
-
|
|
36
|
+
function installedPath(script, installRoot) {
|
|
37
|
+
if (!script) return undefined;
|
|
38
|
+
const prefix = [HOME_PREFIX, installRoot.replace(/\\/g, "/")].find((prefix) =>
|
|
39
|
+
process.platform === "win32"
|
|
40
|
+
? script.toLowerCase().startsWith(`${prefix.toLowerCase()}/`)
|
|
41
|
+
: script.startsWith(`${prefix}/`));
|
|
42
|
+
return prefix ? script.slice(prefix.length + 1) : undefined;
|
|
24
43
|
}
|
|
25
44
|
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
45
|
+
function hookCommand(hook, installRoot) {
|
|
46
|
+
const match = hook?.type === "command" && typeof hook.command === "string" &&
|
|
47
|
+
/^\s*node\s+(?:"([^"]+)"|'([^']+)'|(\S+))(?:\s+(\S+)\s+(?:"([^"]+)"|'([^']+)'|(\S+)))?/i.exec(hook.command);
|
|
48
|
+
if (!match) return {};
|
|
49
|
+
const executable = (match[1] ?? match[2] ?? match[3]).replace(/\\/g, "/");
|
|
50
|
+
const target = (match[5] ?? match[6] ?? match[7])?.replace(/\\/g, "/");
|
|
51
|
+
const relativeLegacyRunner = executable === LEGACY_RUNNER;
|
|
52
|
+
return {
|
|
53
|
+
script: installedPath(executable, installRoot),
|
|
54
|
+
id: match[4],
|
|
55
|
+
target: relativeLegacyRunner ? target : installedPath(target, installRoot),
|
|
56
|
+
relativeLegacyRunner,
|
|
57
|
+
};
|
|
35
58
|
}
|
|
36
59
|
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (filtered.length > 0) cleaned[eventType] = filtered;
|
|
60
|
+
function validateHookGroups(events) {
|
|
61
|
+
for (const [event, groups] of Object.entries(events)) {
|
|
62
|
+
if (!Array.isArray(groups) || groups.some((group) => !Array.isArray(group?.hooks))) {
|
|
63
|
+
throw new Error(`Invalid Claude settings hook groups for ${event}`);
|
|
64
|
+
}
|
|
43
65
|
}
|
|
44
|
-
return cleaned;
|
|
45
66
|
}
|
|
46
67
|
|
|
47
|
-
function
|
|
68
|
+
function mergeHookGroups(current, incoming, installRoot, windowsPaths) {
|
|
69
|
+
const managedTargets = new Map();
|
|
70
|
+
const managedGroups = incoming.map((group) => {
|
|
71
|
+
const hooks = group.hooks.filter((hook) => {
|
|
72
|
+
const command = hookCommand(hook, installRoot);
|
|
73
|
+
if (command.script !== RUNNER || !command.id) return true;
|
|
74
|
+
if (managedTargets.has(command.id)) return false;
|
|
75
|
+
managedTargets.set(command.id, command.target);
|
|
76
|
+
return true;
|
|
77
|
+
}).map((hook) => windowsPaths && hook?.type === "command"
|
|
78
|
+
? { ...hook, command: hook.command.replaceAll(HOME_PREFIX, () => installRoot) }
|
|
79
|
+
: hook);
|
|
80
|
+
return { ...group, hooks };
|
|
81
|
+
});
|
|
82
|
+
const userGroups = current.map((group) => ({
|
|
83
|
+
...group,
|
|
84
|
+
hooks: group.hooks.filter((hook) => {
|
|
85
|
+
const { script, id, target, relativeLegacyRunner } = hookCommand(hook, installRoot);
|
|
86
|
+
if (LEGACY_HOOK_PATTERNS.includes(script)) return false;
|
|
87
|
+
if (!relativeLegacyRunner && script !== RUNNER) return true;
|
|
88
|
+
if (LEGACY_WRAPPED_TARGETS.get(id)?.includes(target)) return false;
|
|
89
|
+
return !target || managedTargets.get(id) !== target;
|
|
90
|
+
}),
|
|
91
|
+
}));
|
|
92
|
+
return [...userGroups, ...managedGroups].filter((group) => group.hooks.length > 0);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function mergeSettings(source, existing, { installRoot = path.join(os.homedir(), ".claude"), windowsPaths = false } = {}) {
|
|
96
|
+
const current = existing.hooks || {};
|
|
97
|
+
const incoming = source.hooks || {};
|
|
98
|
+
validateHookGroups(current);
|
|
99
|
+
validateHookGroups(incoming);
|
|
100
|
+
const hooks = Object.fromEntries([...new Set([...Object.keys(current), ...Object.keys(incoming)])]
|
|
101
|
+
.map((event) => [event, mergeHookGroups(
|
|
102
|
+
Object.hasOwn(current, event) ? current[event] : [],
|
|
103
|
+
Object.hasOwn(incoming, event) ? incoming[event] : [],
|
|
104
|
+
installRoot,
|
|
105
|
+
windowsPaths,
|
|
106
|
+
)])
|
|
107
|
+
.filter(([, groups]) => groups.length > 0));
|
|
48
108
|
return {
|
|
49
109
|
...existing,
|
|
50
110
|
...source,
|
|
51
111
|
env: { ...(source.env || {}), ...(existing.env || {}) },
|
|
52
112
|
mcpServers: { ...(source.mcpServers || {}), ...(existing.mcpServers || {}) },
|
|
53
|
-
hooks
|
|
113
|
+
hooks,
|
|
54
114
|
};
|
|
55
115
|
}
|
|
56
116
|
|
|
@@ -61,15 +121,18 @@ function readJson(path) {
|
|
|
61
121
|
}
|
|
62
122
|
|
|
63
123
|
function main() {
|
|
64
|
-
const [, , sourcePath, destinationPath] = process.argv;
|
|
124
|
+
const [, , sourcePath, destinationPath, mode] = process.argv;
|
|
65
125
|
const source = readJson(sourcePath);
|
|
66
126
|
const existing = fs.existsSync(destinationPath)
|
|
67
127
|
? readJson(destinationPath)
|
|
68
128
|
: {};
|
|
69
|
-
const merged = mergeSettings(source, existing
|
|
129
|
+
const merged = mergeSettings(source, existing, {
|
|
130
|
+
installRoot: path.dirname(path.resolve(destinationPath)),
|
|
131
|
+
windowsPaths: mode === "--windows-paths",
|
|
132
|
+
});
|
|
70
133
|
fs.writeFileSync(destinationPath, JSON.stringify(merged, null, 2) + "\n");
|
|
71
134
|
}
|
|
72
135
|
|
|
73
136
|
if (require.main === module) main();
|
|
74
137
|
|
|
75
|
-
module.exports = {
|
|
138
|
+
module.exports = { mergeSettings };
|
|
@@ -44,6 +44,126 @@ function checkLegacyMigration() {
|
|
|
44
44
|
assert.equal(read(cold + ".bak." + hash), previous);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
function checkInstallerCliOptions() {
|
|
48
|
+
const profile = path.join(tempRoot, "invalid-cli-profile");
|
|
49
|
+
for (const [options, message] of [
|
|
50
|
+
[["--unknown-option"], /Unknown option: --unknown-option/],
|
|
51
|
+
[["--claude-only", "--codex-only"], /cannot be used together/],
|
|
52
|
+
[["--codex-only", "--claude-only"], /cannot be used together/],
|
|
53
|
+
[["--claude-only", "--codex-only", "--help"], /cannot be used together/],
|
|
54
|
+
]) {
|
|
55
|
+
const result = spawnSync(process.execPath, [
|
|
56
|
+
path.join(sourceRoot, "bin/claude-everything-workflow.js"), "install", ...options,
|
|
57
|
+
], {
|
|
58
|
+
cwd: sourceRoot, env: { ...process.env, USERPROFILE: profile, HOME: profile },
|
|
59
|
+
encoding: "utf8", timeout: 60000, maxBuffer: 8 * 1024 * 1024,
|
|
60
|
+
});
|
|
61
|
+
assert.ifError(result.error);
|
|
62
|
+
assert.notEqual(result.status, 0, "invalid CLI options must fail before installation");
|
|
63
|
+
assert.match(result.stderr, message);
|
|
64
|
+
}
|
|
65
|
+
for (const host of [".claude", ".codex"]) {
|
|
66
|
+
assert.equal(fs.existsSync(path.join(profile, host)), false);
|
|
67
|
+
}
|
|
68
|
+
for (const help of ["--help", "-h"]) {
|
|
69
|
+
const result = spawnSync(process.execPath, [
|
|
70
|
+
path.join(sourceRoot, "bin/claude-everything-workflow.js"), "install", help,
|
|
71
|
+
], {
|
|
72
|
+
cwd: sourceRoot, env: { ...process.env, USERPROFILE: profile, HOME: profile },
|
|
73
|
+
encoding: "utf8", timeout: 60000,
|
|
74
|
+
});
|
|
75
|
+
assert.ifError(result.error);
|
|
76
|
+
assert.equal(result.status, 0, "install help must succeed without installing");
|
|
77
|
+
assert.match(result.stdout, /Usage:/);
|
|
78
|
+
for (const host of [".claude", ".codex"]) {
|
|
79
|
+
assert.equal(fs.existsSync(path.join(profile, host)), false);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function checkBashHelpOptions() {
|
|
85
|
+
const executable = process.env.CEW_TEST_BASH || (process.platform === "win32" ? null : "bash");
|
|
86
|
+
if (!executable) return;
|
|
87
|
+
const profile = path.join(tempRoot, "bash options profile");
|
|
88
|
+
const invalidOptions = [
|
|
89
|
+
["--help", "--claude-only", "--codex-only"],
|
|
90
|
+
["--claude-only", "--help", "--codex-only"],
|
|
91
|
+
["--claude-only", "--codex-only", "--help"],
|
|
92
|
+
["--help", "--unknown-option"],
|
|
93
|
+
["--unknown-option", "--help"],
|
|
94
|
+
];
|
|
95
|
+
for (const options of [...invalidOptions, ["--help"], ["-h"]]) {
|
|
96
|
+
const result = spawnSync(executable, ["scripts/install.sh", ...options], {
|
|
97
|
+
cwd: sourceRoot, env: { ...process.env, HOME: profile },
|
|
98
|
+
encoding: "utf8", timeout: 60000,
|
|
99
|
+
});
|
|
100
|
+
assert.ifError(result.error);
|
|
101
|
+
if (options.length === 1) {
|
|
102
|
+
assert.equal(result.status, 0, result.stderr);
|
|
103
|
+
assert.match(result.stdout, /Usage:/);
|
|
104
|
+
} else {
|
|
105
|
+
assert.notEqual(result.status, 0, `Bash must reject invalid options even with help: ${options.join(" ")}`);
|
|
106
|
+
assert.match(result.stderr, /Unknown option|cannot be used together/);
|
|
107
|
+
}
|
|
108
|
+
for (const host of [".claude", ".codex"]) {
|
|
109
|
+
assert.equal(fs.existsSync(path.join(profile, host)), false);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function checkInstallerLinkedRoots() {
|
|
115
|
+
for (const host of [".claude", ".codex"]) {
|
|
116
|
+
const profile = path.join(tempRoot, "linked-profile" + host);
|
|
117
|
+
const outside = path.join(tempRoot, "linked-outside" + host);
|
|
118
|
+
fs.mkdirSync(profile);
|
|
119
|
+
fs.mkdirSync(outside);
|
|
120
|
+
fs.writeFileSync(path.join(outside, "AGENTS.md"), "Keep external user content\n");
|
|
121
|
+
fs.symlinkSync(outside, path.join(profile, host), process.platform === "win32" ? "junction" : "dir");
|
|
122
|
+
const result = spawnSync(process.execPath, [
|
|
123
|
+
path.join(sourceRoot, "bin/claude-everything-workflow.js"), "install",
|
|
124
|
+
host === ".claude" ? "--claude-only" : "--codex-only",
|
|
125
|
+
], {
|
|
126
|
+
cwd: sourceRoot,
|
|
127
|
+
env: {
|
|
128
|
+
...process.env, USERPROFILE: profile, HOME: profile,
|
|
129
|
+
...(process.platform === "win32" ? {
|
|
130
|
+
PSModulePath: path.join(process.env.SystemRoot, "System32/WindowsPowerShell/v1.0/Modules"),
|
|
131
|
+
} : {}),
|
|
132
|
+
},
|
|
133
|
+
encoding: "utf8", timeout: 60000, maxBuffer: 8 * 1024 * 1024,
|
|
134
|
+
});
|
|
135
|
+
assert.ifError(result.error);
|
|
136
|
+
assert.notEqual(result.status, 0, "linked install roots must be rejected");
|
|
137
|
+
assert.match(result.stderr, /symlink/i);
|
|
138
|
+
assert.deepEqual(fs.readdirSync(outside), ["AGENTS.md"], "reject links before any external writes");
|
|
139
|
+
assert.equal(read(path.join(outside, "AGENTS.md")), "Keep external user content\n");
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function checkInstallerMergeFailure() {
|
|
144
|
+
if (process.platform !== "win32") return;
|
|
145
|
+
const profile = path.join(tempRoot, "merge failure profile");
|
|
146
|
+
const settingsPath = path.join(profile, ".claude/settings.json");
|
|
147
|
+
fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
|
|
148
|
+
const previous = JSON.stringify({ env: { KEEP: "yes" }, hooks: { SessionStart: null } });
|
|
149
|
+
fs.writeFileSync(settingsPath, previous);
|
|
150
|
+
const result = spawnSync(process.execPath, [
|
|
151
|
+
path.join(sourceRoot, "bin/claude-everything-workflow.js"), "install", "--claude-only",
|
|
152
|
+
], {
|
|
153
|
+
cwd: sourceRoot,
|
|
154
|
+
env: {
|
|
155
|
+
...process.env, USERPROFILE: profile, HOME: profile,
|
|
156
|
+
PSModulePath: path.join(process.env.SystemRoot, "System32/WindowsPowerShell/v1.0/Modules"),
|
|
157
|
+
},
|
|
158
|
+
encoding: "utf8", timeout: 60000, maxBuffer: 8 * 1024 * 1024,
|
|
159
|
+
});
|
|
160
|
+
assert.ifError(result.error);
|
|
161
|
+
assert.notEqual(result.status, 0, "a failed settings merge must fail the installation");
|
|
162
|
+
assert.match(result.stderr, /Claude settings merge failed/);
|
|
163
|
+
assert.doesNotMatch(result.stdout, /Install complete/);
|
|
164
|
+
assert.equal(fs.readFileSync(settingsPath, "utf8"), previous);
|
|
165
|
+
}
|
|
166
|
+
|
|
47
167
|
function checkInstallerEntrypoint() {
|
|
48
168
|
const profile = path.join(tempRoot, "installer-profile");
|
|
49
169
|
const windows = process.platform === "win32";
|
|
@@ -53,6 +173,27 @@ function checkInstallerEntrypoint() {
|
|
|
53
173
|
: [path.join(sourceRoot, "scripts/install.sh")];
|
|
54
174
|
// The child gets a disposable profile; never update this process's home or the user's installation.
|
|
55
175
|
const env = { ...process.env, USERPROFILE: profile, HOME: profile };
|
|
176
|
+
const invalid = spawnSync(executable, [...args, windows ? "-UnknownOption" : "--unknown-option"], {
|
|
177
|
+
cwd: sourceRoot, env, encoding: "utf8", timeout: 60000, maxBuffer: 8 * 1024 * 1024,
|
|
178
|
+
});
|
|
179
|
+
assert.ifError(invalid.error);
|
|
180
|
+
assert.notEqual(invalid.status, 0, "direct installer must reject unknown options before writing");
|
|
181
|
+
assert.equal(fs.existsSync(path.join(profile, ".claude")), false);
|
|
182
|
+
assert.equal(fs.existsSync(path.join(profile, ".codex")), false);
|
|
183
|
+
for (const only of [
|
|
184
|
+
windows ? ["-ClaudeOnly", "-CodexOnly"] : ["--claude-only", "--codex-only"],
|
|
185
|
+
windows ? ["-CodexOnly", "-ClaudeOnly"] : ["--codex-only", "--claude-only"],
|
|
186
|
+
]) {
|
|
187
|
+
const conflict = spawnSync(executable, [...args, ...only], {
|
|
188
|
+
cwd: sourceRoot, env, encoding: "utf8", timeout: 60000, maxBuffer: 8 * 1024 * 1024,
|
|
189
|
+
});
|
|
190
|
+
assert.ifError(conflict.error);
|
|
191
|
+
assert.notEqual(conflict.status, 0, "direct installer must reject conflicting host options");
|
|
192
|
+
assert.match(conflict.stderr, /cannot be used together/);
|
|
193
|
+
for (const host of [".claude", ".codex"]) {
|
|
194
|
+
assert.equal(fs.existsSync(path.join(profile, host)), false);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
56
197
|
const run = (extra = []) => {
|
|
57
198
|
const result = spawnSync(executable, [...args, ...extra], {
|
|
58
199
|
cwd: sourceRoot, env, encoding: "utf8", timeout: 60000, maxBuffer: 8 * 1024 * 1024,
|
|
@@ -88,7 +229,43 @@ function checkInstallerEntrypoint() {
|
|
|
88
229
|
fs.writeFileSync(path.join(skills, "handoff/agents/openai.yaml"),
|
|
89
230
|
"policy:\n allow_implicit_invocation: false\n");
|
|
90
231
|
}
|
|
232
|
+
const settingsPath = path.join(profile, ".claude/settings.json");
|
|
233
|
+
fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
|
|
234
|
+
const userHookGroup = {
|
|
235
|
+
matcher: "Edit|Write|MultiEdit",
|
|
236
|
+
hooks: [
|
|
237
|
+
{ type: "command", command: 'node "$HOME/.claude/my-hooks/observe.js"', timeout: 7 },
|
|
238
|
+
{ type: "command", command: 'node "$HOME/.claude/hooks/runtime/run-with-flags.js" post:edit:console-log "$HOME/.claude/hooks/my-team-check.js" standard,strict' },
|
|
239
|
+
{ type: "prompt", prompt: "Keep this user hook" },
|
|
240
|
+
],
|
|
241
|
+
};
|
|
242
|
+
const unrelatedHook = {
|
|
243
|
+
matcher: "Bash",
|
|
244
|
+
hooks: [{ type: "command", command: 'node "./hooks/session-start.js"' }],
|
|
245
|
+
};
|
|
246
|
+
const retiredSession = {
|
|
247
|
+
type: "command",
|
|
248
|
+
command: 'node "$HOME/.claude/hooks/runtime/run-with-flags.js" session:start "$HOME/.claude/hooks/session-start.js" minimal,standard,strict',
|
|
249
|
+
};
|
|
250
|
+
const retiredConsole = {
|
|
251
|
+
type: "command",
|
|
252
|
+
command: 'node scripts/hooks/run-with-flags.js post:write:console-log hooks/check-console-log.js standard,strict',
|
|
253
|
+
};
|
|
254
|
+
fs.writeFileSync(settingsPath, JSON.stringify({
|
|
255
|
+
hooks: {
|
|
256
|
+
PostToolUse: [{ ...userHookGroup, hooks: [...userHookGroup.hooks, retiredConsole] }],
|
|
257
|
+
SessionStart: [{ ...unrelatedHook, hooks: [...unrelatedHook.hooks, retiredSession] }],
|
|
258
|
+
},
|
|
259
|
+
}));
|
|
260
|
+
run();
|
|
261
|
+
const installedSettings = JSON.parse(read(settingsPath).replace(/^\uFEFF/, ""));
|
|
262
|
+
assert.deepEqual(installedSettings.hooks.PostToolUse[0], userHookGroup);
|
|
263
|
+
assert.deepEqual(installedSettings.hooks.SessionStart, [unrelatedHook]);
|
|
264
|
+
assert.equal(installedSettings.hooks.PostToolUse.flatMap(({ hooks }) => hooks)
|
|
265
|
+
.filter(({ command }) => command?.includes("hooks/check-console-log.js")).length, 1);
|
|
91
266
|
run();
|
|
267
|
+
assert.deepEqual(JSON.parse(read(settingsPath).replace(/^\uFEFF/, "")), installedSettings,
|
|
268
|
+
"reinstallation must preserve user hooks and add each managed hook only once");
|
|
92
269
|
assert.equal(read(path.join(profile, ".claude/references/rules/common/testing.md")),
|
|
93
270
|
read(path.join(sourceRoot, "rules/common/testing.md")));
|
|
94
271
|
assert.equal(fs.existsSync(path.join(profile, ".claude/rules/common/testing.md")), false);
|
|
@@ -110,6 +287,8 @@ function checkInstallerEntrypoint() {
|
|
|
110
287
|
"安装不应保留仅供包内验证的续接测试");
|
|
111
288
|
assert.equal(fs.existsSync(path.join(profile, host, "scripts/verify/plugin-distribution.test.js")), false,
|
|
112
289
|
"安装不应保留仅供包内验证的插件分发测试");
|
|
290
|
+
assert.equal(fs.existsSync(path.join(profile, host, "scripts/verify/learning.test.js")), false,
|
|
291
|
+
"安装不应保留仅供包内验证的持续学习测试");
|
|
113
292
|
assert.match(read(path.join(profile, host, "skills/handoff/agents/openai.yaml")),
|
|
114
293
|
/allow_implicit_invocation: true/);
|
|
115
294
|
}
|
|
@@ -157,6 +336,10 @@ try {
|
|
|
157
336
|
assert.deepEqual(fs.readdirSync(outside), []);
|
|
158
337
|
assert.throws(() => install("invalid", "unknown"), /host/i);
|
|
159
338
|
checkLegacyMigration();
|
|
339
|
+
checkInstallerCliOptions();
|
|
340
|
+
checkBashHelpOptions();
|
|
341
|
+
checkInstallerLinkedRoots();
|
|
342
|
+
checkInstallerMergeFailure();
|
|
160
343
|
checkInstallerEntrypoint();
|
|
161
344
|
console.log("Rule installation tests passed (migration, backups, custom rules, symlink safety, both hosts, installer dry-run and execution).");
|
|
162
345
|
} finally {
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const assert = require("node:assert/strict");
|
|
4
|
+
const { spawnSync } = require("node:child_process");
|
|
5
|
+
const fs = require("node:fs");
|
|
6
|
+
const os = require("node:os");
|
|
7
|
+
const path = require("node:path");
|
|
8
|
+
const { test } = require("node:test");
|
|
9
|
+
|
|
10
|
+
const root = path.resolve(__dirname, "../..");
|
|
11
|
+
const skill = "skills/continuous-learning-v2";
|
|
12
|
+
const observer = `${skill}/hooks/observe-v2.js`;
|
|
13
|
+
|
|
14
|
+
function fixture(t) {
|
|
15
|
+
const cwd = fs.mkdtempSync(path.join(os.tmpdir(), "cew-learning-"));
|
|
16
|
+
t.after(() => fs.rmSync(cwd, { recursive: true, force: true }));
|
|
17
|
+
const data = path.join(cwd, "data");
|
|
18
|
+
const config = { homunculus: { data_root: data } };
|
|
19
|
+
const configPath = path.join(cwd, skill, "config.json");
|
|
20
|
+
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
|
21
|
+
fs.writeFileSync(configPath, JSON.stringify(config));
|
|
22
|
+
return { cwd, data };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function run(cwd, script, args, input) {
|
|
26
|
+
const result = spawnSync(process.execPath, [path.join(root, script), ...args], {
|
|
27
|
+
cwd, input, encoding: "utf8", env: { ...process.env, HOME: cwd, USERPROFILE: cwd, XDG_DATA_HOME: cwd },
|
|
28
|
+
timeout: 10000,
|
|
29
|
+
});
|
|
30
|
+
assert.ifError(result.error);
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function writeInstinct(base, filename, confidence) {
|
|
35
|
+
const directory = path.join(base, "personal");
|
|
36
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
37
|
+
fs.writeFileSync(path.join(directory, filename), `---\nconfidence: ${confidence}\n---\nA fixture instinct.\n`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
test("project migration preview creates neither registry nor instinct files", (t) => {
|
|
41
|
+
const { cwd, data } = fixture(t);
|
|
42
|
+
const legacy = path.join(cwd, "legacy");
|
|
43
|
+
writeInstinct(legacy, "keep.md", 0.8);
|
|
44
|
+
const args = ["--source", legacy];
|
|
45
|
+
for (const flags of [[], ["--dry-run"]]) {
|
|
46
|
+
const preview = run(cwd, "scripts/learning/migrate-homunculus.js", [...args, ...flags]);
|
|
47
|
+
assert.equal(preview.status, 0, preview.stderr);
|
|
48
|
+
assert.match(preview.stdout, /keep\.md/);
|
|
49
|
+
assert.equal(fs.existsSync(data), false);
|
|
50
|
+
}
|
|
51
|
+
const applied = run(cwd, "scripts/learning/migrate-homunculus.js", [...args, "--apply"]);
|
|
52
|
+
assert.equal(applied.status, 0, applied.stderr);
|
|
53
|
+
const registry = JSON.parse(fs.readFileSync(path.join(data, "projects.json"), "utf8"));
|
|
54
|
+
const [id] = Object.keys(registry.projects);
|
|
55
|
+
assert.equal(fs.existsSync(path.join(data, "projects", id, "instincts/personal/keep.md")), true);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("conflicting preview and apply flags are rejected without writes", (t) => {
|
|
59
|
+
const { cwd, data } = fixture(t);
|
|
60
|
+
const instincts = path.join(data, "projects/example/instincts");
|
|
61
|
+
writeInstinct(instincts, "candidate.md", 0.8);
|
|
62
|
+
const commands = [
|
|
63
|
+
["scripts/learning/migrate-homunculus.js", "--source", instincts],
|
|
64
|
+
["scripts/learning/promote.js", "--project-id", "example"],
|
|
65
|
+
];
|
|
66
|
+
for (const [script, ...args] of commands) {
|
|
67
|
+
const result = run(cwd, script, [...args, "--dry-run", "--apply"]);
|
|
68
|
+
assert.notEqual(result.status, 0);
|
|
69
|
+
assert.match(result.stderr, /--dry-run.*--apply/);
|
|
70
|
+
assert.deepEqual(fs.readdirSync(data), ["projects"]);
|
|
71
|
+
assert.deepEqual(fs.readdirSync(path.join(data, "projects")), ["example"]);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test("an invalid promotion threshold fails before any global write", (t) => {
|
|
76
|
+
const { cwd, data } = fixture(t);
|
|
77
|
+
writeInstinct(path.join(data, "projects/example/instincts"), "candidate.md", 0.8);
|
|
78
|
+
for (const value of [[], [""], ["abc"], ["0.4oops"], ["0x0"], ["Infinity"], ["-0.1"], ["1.1"]]) {
|
|
79
|
+
const result = run(cwd, "scripts/learning/promote.js",
|
|
80
|
+
["--project-id", "example", "--apply", "--min-confidence", ...value]);
|
|
81
|
+
assert.notEqual(result.status, 0, JSON.stringify(value));
|
|
82
|
+
assert.match(result.stderr, /--min-confidence/);
|
|
83
|
+
assert.equal(fs.existsSync(path.join(data, "global")), false);
|
|
84
|
+
}
|
|
85
|
+
for (const flags of [["--min-confidence=abc"], ["--min-confidence", "0.7", "--min-confidence", "abc"]]) {
|
|
86
|
+
const result = run(cwd, "scripts/learning/promote.js", ["--project-id", "example", "--apply", ...flags]);
|
|
87
|
+
assert.notEqual(result.status, 0);
|
|
88
|
+
assert.match(result.stderr, /--min-confidence/);
|
|
89
|
+
assert.equal(fs.existsSync(path.join(data, "global")), false);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("promotion copies only candidates with a valid confidence at or above the threshold", (t) => {
|
|
94
|
+
const { cwd, data } = fixture(t);
|
|
95
|
+
const instincts = path.join(data, "projects/example/instincts");
|
|
96
|
+
writeInstinct(instincts, "at-threshold.md", 0.7);
|
|
97
|
+
writeInstinct(instincts, "low.md", 0.6);
|
|
98
|
+
writeInstinct(instincts, "malformed.md", "0.9oops");
|
|
99
|
+
writeInstinct(instincts, "out-of-range.md", 1.5);
|
|
100
|
+
const args = ["--project-id", "example", "--min-confidence", "0.7"];
|
|
101
|
+
const preview = run(cwd, "scripts/learning/promote.js", [...args, "--dry-run"]);
|
|
102
|
+
assert.equal(preview.status, 0, preview.stderr);
|
|
103
|
+
assert.equal(fs.existsSync(path.join(data, "global")), false);
|
|
104
|
+
const result = run(cwd, "scripts/learning/promote.js", [...args, "--apply"]);
|
|
105
|
+
assert.equal(result.status, 0, result.stderr);
|
|
106
|
+
assert.deepEqual(fs.readdirSync(path.join(data, "global/instincts/personal")), ["at-threshold.md"]);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test("observation leaves the profile untouched with default, missing or invalid config", (t) => {
|
|
110
|
+
const { cwd } = fixture(t);
|
|
111
|
+
const configPath = path.join(cwd, ".claude", skill, "config.json");
|
|
112
|
+
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
|
113
|
+
const input = JSON.stringify({ tool: "Edit", tool_name: "Edit", cwd, session_id: "fixture" });
|
|
114
|
+
const shipped = fs.readFileSync(path.join(root, skill, "config.json"), "utf8");
|
|
115
|
+
for (const config of [null, "{", shipped, '{"observation":{"enabled":"false"}}', "null"]) {
|
|
116
|
+
if (config !== null) fs.writeFileSync(configPath, config);
|
|
117
|
+
const result = run(cwd, observer, ["post"], input);
|
|
118
|
+
assert.equal(result.status, 0, result.stderr);
|
|
119
|
+
assert.deepEqual(fs.readdirSync(cwd).sort(), [".claude", "skills"]);
|
|
120
|
+
assert.deepEqual(fs.readdirSync(path.join(cwd, ".claude")), ["skills"]);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
@@ -31,6 +31,7 @@ const PACKAGE_ONLY_PATHS = [
|
|
|
31
31
|
"scripts/verify/skill-invocation.test.js",
|
|
32
32
|
"scripts/verify/continuation-checks.test.js",
|
|
33
33
|
"scripts/verify/install-rules.test.js",
|
|
34
|
+
"scripts/verify/learning.test.js",
|
|
34
35
|
"scripts/verify/plugin-distribution.test.js",
|
|
35
36
|
];
|
|
36
37
|
|
|
@@ -311,7 +312,6 @@ function checkHookConfigReferences() {
|
|
|
311
312
|
|
|
312
313
|
requireTokens("scripts/merge-claude-settings.cjs", [
|
|
313
314
|
"LEGACY_HOOK_PATTERNS",
|
|
314
|
-
"cleanHooks",
|
|
315
315
|
"mergeSettings",
|
|
316
316
|
]);
|
|
317
317
|
|
|
@@ -71,6 +71,11 @@ const path = require("node:path");
|
|
|
71
71
|
const YAML = require("yaml");
|
|
72
72
|
const root = path.resolve(__dirname, "../..");
|
|
73
73
|
const manifest = require("../../harness/manifest.json");
|
|
74
|
+
const implement = manifest.skills.find((skill) => skill.name === "implement");
|
|
75
|
+
assert.equal(implement?.invocation, "explicit-only");
|
|
76
|
+
const routerBody = fs.readFileSync(path.join(root, "skills/using-superpowers/SKILL.md"), "utf8");
|
|
77
|
+
assert.match(routerBody, /-> read-reference skills\/implement\/SKILL\.md/);
|
|
78
|
+
assert.deepEqual(validateNativeRoutes(manifest, routerBody), []);
|
|
74
79
|
for (const name of ["handoff", "improve-codebase-architecture", "triage"]) {
|
|
75
80
|
const entry = manifest.skills.find((skill) => skill.name === name);
|
|
76
81
|
assert.equal(entry?.invocation, "implicit", name);
|
|
@@ -84,4 +89,4 @@ for (const name of ["research", "wayfinder", "find-skills", "project-context", "
|
|
|
84
89
|
assert.equal(manifest.skills.some((skill) => skill.name === name), false);
|
|
85
90
|
assert.equal(fs.existsSync(path.join(root, "skills", name, "SKILL.md")), false, name);
|
|
86
91
|
}
|
|
87
|
-
console.log("Skill invocation tests passed (
|
|
92
|
+
console.log("Skill invocation tests passed (host gates, router references, natural-language entries and retired skills).");
|
|
@@ -185,10 +185,13 @@ function runSkillManifestChecks(context) {
|
|
|
185
185
|
function validateNativeRoutes(manifest, routerBody) {
|
|
186
186
|
const errors = [];
|
|
187
187
|
const skills = Array.isArray(manifest?.skills) ? manifest.skills : [];
|
|
188
|
-
for (const
|
|
189
|
-
const skill = skills.find((entry) => entry?.path ===
|
|
190
|
-
if (
|
|
191
|
-
errors.push(`
|
|
188
|
+
for (const [, mode, target] of routerBody.matchAll(/->\s*(?:(native-entry|read-reference)\s+)?(skills\/[a-z0-9-]+\/SKILL\.md|[a-z0-9-]+)[ \t]*\r?$/gm)) {
|
|
189
|
+
const skill = skills.find((entry) => entry?.path === target || entry?.name === target);
|
|
190
|
+
if (mode === "read-reference" && skill?.path !== target) {
|
|
191
|
+
errors.push(`read-reference must name a registered Skill file: ${target}`);
|
|
192
|
+
}
|
|
193
|
+
if (skill?.invocation === "explicit-only" && !mode) {
|
|
194
|
+
errors.push(`router must use native-entry or read-reference for explicit-only Skill: ${skill.name}`);
|
|
192
195
|
}
|
|
193
196
|
}
|
|
194
197
|
return errors;
|
|
@@ -376,7 +376,6 @@ function checkCapabilityRouting() {
|
|
|
376
376
|
|
|
377
377
|
for (const deliverySkill of [
|
|
378
378
|
"skills/to-tickets/SKILL.md",
|
|
379
|
-
"skills/implement/SKILL.md",
|
|
380
379
|
"skills/subagent-driven-development/SKILL.md",
|
|
381
380
|
]) {
|
|
382
381
|
if (read(deliverySkill).includes("disable-model-invocation: true")) {
|
package/skills/README.md
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
- `systematic-debugging`:区分普通明确失败与疑难故障;预期 TDD RED 留在实现循环。
|
|
35
35
|
- `resolving-merge-conflicts`:按双方原始意图逐 hunk 解决 merge/rebase 冲突。
|
|
36
36
|
- `e2e-testing`:Playwright E2E 模式、CI、制品和 flaky 处理。
|
|
37
|
-
- `feature-acceptance
|
|
37
|
+
- `feature-acceptance`:建立/维护项目验收工具与功能地图;按用户或项目验收合同执行真实流程并复核证据。
|
|
38
38
|
|
|
39
39
|
## Harness / 上下文与编排
|
|
40
40
|
|
|
@@ -17,13 +17,18 @@ Review depth belongs here; callers supply the scope, base, risk and available ev
|
|
|
17
17
|
- active worktree: `git diff <base>` includes committed changes and tracked staged and unstaged edits;
|
|
18
18
|
- staged-only: `git diff --cached`.
|
|
19
19
|
3. Include task-owned untracked files in full; exclude unrelated dirty files explicitly.
|
|
20
|
-
4. Use
|
|
21
|
-
|
|
20
|
+
4. Use the original user request, including user-approved Spec/ticket and scope changes, as the scope
|
|
21
|
+
authority. An implementer's plan or summary cannot broaden it. Only then inspect tracker references
|
|
22
|
+
or matching durable documents if needed.
|
|
22
23
|
Do not ask again for a base or scope the caller already supplied. Never infer requirements from the diff.
|
|
23
24
|
5. Missing base or required acceptance evidence is `BLOCKED`. An intentionally empty package is `NO CHANGES`.
|
|
24
25
|
For a standalone review with no confirmed requirements, report the Spec axis as `NOT RUN` without
|
|
25
26
|
requiring an extra user confirmation; implementation completion still requires its acceptance criteria.
|
|
26
27
|
|
|
28
|
+
For local fixes touching shared logic, apply the preservation requirements in `rules/02-implementation.md`.
|
|
29
|
+
Unrequested behavior changes fail the Spec axis even if all tests pass; missing required preservation
|
|
30
|
+
evidence is `BLOCKED`, not `PASS`.
|
|
31
|
+
|
|
27
32
|
## Select review depth
|
|
28
33
|
|
|
29
34
|
`--mode auto` is the default. Select by risk and verification evidence, not file count, model generation
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
# Spec reviewer
|
|
2
2
|
|
|
3
|
-
Review only the supplied fixed review package against the
|
|
4
|
-
|
|
3
|
+
Review only the supplied fixed review package against the original user request, including user-approved
|
|
4
|
+
Spec/ticket and scope changes. Do not report general style opinions.
|
|
5
5
|
|
|
6
6
|
Find:
|
|
7
7
|
|
|
8
8
|
1. requirements that are missing or partial;
|
|
9
|
-
2. behavior
|
|
9
|
+
2. scope creep through unrequested behavior changes, especially in non-target callers of shared code;
|
|
10
10
|
3. behavior that looks implemented but is wrong;
|
|
11
|
-
4. acceptance checks that cannot be established
|
|
11
|
+
4. acceptance checks, including required non-target preservation checks, that cannot be established
|
|
12
|
+
from the supplied evidence.
|
|
13
|
+
|
|
14
|
+
Apply the [Code Review](../SKILL.md) Spec failure/blocking rules and the supplied compatibility requirements.
|
|
12
15
|
|
|
13
16
|
Quote or cite the exact requirement and implementation location for every finding. If no confirmed
|
|
14
17
|
Spec source exists, return `NOT RUN`; do not reconstruct requirements from the diff.
|
|
@@ -62,6 +62,7 @@ ${XDG_DATA_HOME:-~/.local/share}/ecc-homunculus/
|
|
|
62
62
|
## 安全边界
|
|
63
63
|
|
|
64
64
|
- 默认不启用后台 observer;`observer.enabled` 保持 `false`,避免额外 token 和误学习。
|
|
65
|
+
- 工具观察记录也默认关闭。仅当 `observation.enabled` 明确设为 `true` 且 Hook 在启用的档位中运行时才采集。
|
|
65
66
|
- 不自动导入、导出、推广或删除 instinct。
|
|
66
67
|
- 不把 raw observations 当作可共享知识;共享前只处理 instinct。
|
|
67
68
|
- 不把 project instinct 自动提升为 global。
|
|
@@ -21,14 +21,7 @@ function getConfig() {
|
|
|
21
21
|
try {
|
|
22
22
|
return JSON.parse(fs.readFileSync(configPath, 'utf8'))
|
|
23
23
|
} catch {
|
|
24
|
-
return
|
|
25
|
-
observation: {
|
|
26
|
-
enabled: true,
|
|
27
|
-
store_path: path.join(os.homedir(), '.claude', 'homunculus', 'observations.jsonl'),
|
|
28
|
-
capture_tools: ['Edit', 'Write', 'Bash', 'Read', 'Grep', 'Glob'],
|
|
29
|
-
ignore_tools: ['TodoWrite']
|
|
30
|
-
}
|
|
31
|
-
}
|
|
24
|
+
return null
|
|
32
25
|
}
|
|
33
26
|
}
|
|
34
27
|
|
|
@@ -76,7 +69,7 @@ async function main() {
|
|
|
76
69
|
const phase = process.argv[2] // 'pre' or 'post'
|
|
77
70
|
const config = getConfig()
|
|
78
71
|
|
|
79
|
-
if (
|
|
72
|
+
if (config?.observation?.enabled !== true) {
|
|
80
73
|
process.exit(0)
|
|
81
74
|
}
|
|
82
75
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: feature-acceptance
|
|
3
|
-
description: "
|
|
3
|
+
description: "建立或维护项目验收工具与功能地图;按用户或项目验收合同执行真实流程,产出可复核证据。"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# 功能验收
|
|
@@ -9,7 +9,14 @@ description: "用于用户明确要求真实流程验收、截图或日志证据
|
|
|
9
9
|
|
|
10
10
|
## 何时使用
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
在用户明确要求真实流程验收、截图/视频/日志证据、建立或维护项目验收能力,或项目验收合同要求真实流程时使用。普通修复、一般“测一下”及完成前的常规验证按 `rules/common/testing.md` 执行,不自动生成工具或功能地图。
|
|
13
|
+
|
|
14
|
+
## 项目验收能力
|
|
15
|
+
|
|
16
|
+
- **建立 / 维护**:读取 [项目验收能力](references/project-verification.md),复用目标项目的驱动与测试入口,生成或更新项目本地操作说明和功能地图,并实际跑通。
|
|
17
|
+
- **执行**:先查项目指令指定的验收入口和功能地图,复用已验证命令,按本次改动选择受影响用例;没有地图时仍可完成一次性验收,不强制脚手架。工具失效时保留失败证据;只在授权范围内修复,不通过删用例或改成功标准取得通过。
|
|
18
|
+
|
|
19
|
+
CEW 维护通用方法;平台命令、选择器、账号前置条件和功能地图由目标项目维护。
|
|
13
20
|
|
|
14
21
|
## 输出协议
|
|
15
22
|
|
|
@@ -33,7 +40,7 @@ description: "用于用户明确要求真实流程验收、截图或日志证据
|
|
|
33
40
|
|
|
34
41
|
### 1. 定义目标
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
记录被测功能、真实用户入口、核心成功标准、环境前置条件和不可执行的高风险动作。记录被测代码版本及工作区差异、工具/用例版本;有比较基线时同时记录基线版本,相关输入变化后重跑受影响用例。没有测试前置条件时先标记 `BLOCKED`,不要通过注入凭据、篡改本地状态或破坏共享数据绕过。
|
|
37
44
|
|
|
38
45
|
### 2. 写用例矩阵
|
|
39
46
|
|
|
@@ -47,8 +54,8 @@ description: "用于用户明确要求真实流程验收、截图或日志证据
|
|
|
47
54
|
|
|
48
55
|
- 至少覆盖主成功路径;按风险补充错误、空状态、权限或关键分支。
|
|
49
56
|
- `keyNodes` 写明名称、重要性、预期观察和证据角色。
|
|
50
|
-
- `evidenceMedium` 只能是 `image`、`video` 或 `log
|
|
51
|
-
- 真实产品流程的 `image` 或 `video`
|
|
57
|
+
- `evidenceMedium` 只能是 `image`、`video` 或 `log`。UI 流程关键节点超过 10 个或需要表达过程时用 `video`;非 UI 流程保留顺序日志与关键断言。
|
|
58
|
+
- 真实产品流程的 `image` 或 `video` 必须来自真实产品页面或应用界面;对于 UI 流程,API、数据库或脚本输出只作为辅助 `log` 证据。CLI、服务/API、库项目可使用真实公开入口的调用、退出码和可观察结果作为主 `log` 证据,不强制截图。
|
|
52
59
|
|
|
53
60
|
### 3. 采集证据
|
|
54
61
|
|
|
@@ -91,3 +98,4 @@ description: "用于用户明确要求真实流程验收、截图或日志证据
|
|
|
91
98
|
- 不把 mock 页面、Storybook、历史截图、终端截图或伪造数据当作真实产品验收证据。
|
|
92
99
|
- 不为验收执行用户未授权的写操作、支付、删除或生产数据变更。
|
|
93
100
|
- 不把一次性验收替代应提交的单元测试、类型检查或 E2E 测试;它们互为补充。
|
|
101
|
+
- 验收通过不授予提交、合并或发布权限,也不替代项目要求的独立审核。
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# 项目验收能力
|
|
2
|
+
|
|
3
|
+
用于明确授权的建立或维护请求。
|
|
4
|
+
|
|
5
|
+
## 1. 从项目事实确定入口
|
|
6
|
+
|
|
7
|
+
读取目标项目指令、启动配置、现有测试和自动化辅助代码,确认:
|
|
8
|
+
|
|
9
|
+
- 用户实际使用的界面:Web、Electron、移动端、CLI、服务/API 或库;多个界面分别列明。
|
|
10
|
+
- 启动与就绪信号、测试账号/数据、依赖服务,以及可观察结果。
|
|
11
|
+
- 可复用的驱动、选择器、日志和截图入口;先运行已有命令,不另造同功能 CLI。
|
|
12
|
+
- 端口、数据目录、账号和进程的隔离能力。不能隔离时串行,不共用用户正在使用的实例。
|
|
13
|
+
|
|
14
|
+
只询问项目中无法查明且影响结果的用户决策。缺环境或权限时标记 `BLOCKED`;产品行为不符合预期则 `FAIL`。不擅自安装系统工具、修改生产配置或扩大为产品修复;可记录草稿和缺口,但不能宣称验收能力已可用。
|
|
15
|
+
|
|
16
|
+
## 2. 保存项目本地操作契约
|
|
17
|
+
|
|
18
|
+
优先更新项目已有验收文档/Skill,并沿用其路径;没有入口时,在项目使用的 Skill 目录创建 `verify-<project>/SKILL.md`(含 name、description)及 `references/features.md`。宿主未使用项目 Skill 时放入项目约定的文档目录,并从已有项目入口链接。不要写进 CEW 的通用规则或用户全局 Skill。维护时保留人工内容,先核对差异,避免全量覆盖。
|
|
19
|
+
|
|
20
|
+
操作契约须让没有上下文的 Agent 直接使用,包含实际验证过的命令和工作目录,不留假命令:
|
|
21
|
+
|
|
22
|
+
| 内容 | 最低要求 |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| 启动 / 健康检查 | 构建和启动入口、就绪条件、目标版本、所属实例、账号是否可用;短命令程序可用一次真实调用确认健康 |
|
|
25
|
+
| 操作 | 真实用户入口和稳定定位方式;CLI/API/库使用公开接口,UI 不用内部状态注入代替操作 |
|
|
26
|
+
| 观察 | 等待真实完成信号,核对用户可见结果及必要的文件/数据副作用;相关错误不能被忽略 |
|
|
27
|
+
| 证据 | 基线、动作、结果、命令退出码、代码及用例版本;脱敏后保存至忽略目录,报告引用可回读的路径 |
|
|
28
|
+
| 清理 | 只关闭本次拥有的进程,移除本次创建的临时状态;保留证据,不按进程名批量终止 |
|
|
29
|
+
|
|
30
|
+
仅当缺少可复用入口且重复操作确有收益时,增加最小项目本地 helper。使用项目已有语言/依赖;复杂或多平台需求才扩展。必须实际运行 helper,验证失败退出码及清理路径;`--dry-run` 也要观察其副作用,不能凭名字认定安全。
|
|
31
|
+
|
|
32
|
+
## 3. 建立功能地图
|
|
33
|
+
|
|
34
|
+
先覆盖最主要的 3~5 个用户流程;项目更小则覆盖实际存在的流程,不凑数。地图不是测试通过清单,明确标注已验证与未验证部分。每个功能记录:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
功能 / 用户目标:
|
|
38
|
+
入口与子流程:列出需要覆盖的不同入口,不只列最方便的一个
|
|
39
|
+
前置条件:平台、服务、账号、数据及隔离要求
|
|
40
|
+
驱动步骤:引用实际命令/定位方式;写明输入与完成信号
|
|
41
|
+
成功断言:用户能观察到的结果及必要副作用
|
|
42
|
+
风险边界:错误、权限、空状态、恢复等与功能相关的用例
|
|
43
|
+
最近验证:代码/工具/用例版本、环境、日期、结果及证据位置
|
|
44
|
+
未覆盖项:具体入口或场景,以及原因
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
选择用例时结合改动、调用方和用户目标;地图是导航,不是范围上限。新功能或遗漏的关键入口必须补充。维护请求只检查相关条目与当前实现的漂移,不默认重写整份地图。
|
|
48
|
+
|
|
49
|
+
## 4. 实际执行后交付
|
|
50
|
+
|
|
51
|
+
按生成或修改后的说明完成一次闭环:启动 → 健康检查 → 一个真实核心流程 → 核对断言和证据 → 清理 → 再次打开证据。失败运行也执行所属资源的清理,保留失败证据;修正工具后重跑受影响步骤。维护时重跑受影响流程,不能用历史证据覆盖本次变化。
|
|
52
|
+
|
|
53
|
+
沿用主 Skill 的 `PASS / FAIL / BLOCKED / NOT RUN` 与二次审核要求。区分“验收入口已通过所列流程验证”和“整个产品通过验收”:一个流程跑通不代表整张地图通过。报告生成/更新的入口、已执行流程、证据、未覆盖项和后续调用方式;未执行的草稿不得作为已验证能力交付。
|
|
54
|
+
|
|
55
|
+
只有用户或项目合同要求时才接入日常开发验收;不自动新增 CI、定时任务、自动合并或发布权限。
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: implement
|
|
3
|
-
description:
|
|
3
|
+
description: Internal delivery procedure selected by using-superpowers for one authorized scope.
|
|
4
|
+
disable-model-invocation: true
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Implement
|
|
7
8
|
|
|
8
9
|
执行 router 选定的一个连贯交付范围。Origin: `mattpocock/skills@2ab9580`,适配本项目授权与审查边界。
|
|
10
|
+
如果用户直接进入此 Skill,先由 `using-superpowers` 判断是否适用,再按选定路径执行。
|
|
9
11
|
|
|
10
12
|
## 入口
|
|
11
13
|
|
|
@@ -24,6 +24,12 @@ below and read only its Skill. Briefly announce the selection, then act. Do not
|
|
|
24
24
|
in anticipation of later stages. Reuse a Skill already read in this task unless it changed or context
|
|
25
25
|
was lost; returning here means applying the routing decision, not reading this file again.
|
|
26
26
|
|
|
27
|
+
For delivery, infer the requested action, outcome, scope and acceptance evidence from the request and
|
|
28
|
+
project. Inspect discoverable details and ask only for unresolved decisions that would change the result.
|
|
29
|
+
`read-reference` means read the target as a file relative to the same distribution, without invoking it
|
|
30
|
+
through a host Skill tool or asking the user to type its name. For `implement`, read
|
|
31
|
+
[the delivery procedure](../implement/SKILL.md) after selecting it.
|
|
32
|
+
|
|
27
33
|
Expected TDD RED stays in the current implementation loop. Do not reroute it as a reported bug.
|
|
28
34
|
An explicit request may use ordinary language or a native `/name` or `$name` invocation.
|
|
29
35
|
For handoff, triage and improve-codebase-architecture,
|
|
@@ -50,6 +56,8 @@ Task arrives
|
|
|
50
56
|
-> skills/handoff/SKILL.md
|
|
51
57
|
-> explicit triage request? -> skills/triage/SKILL.md
|
|
52
58
|
-> explicit TDD request? -> skills/test-driven-development/SKILL.md
|
|
59
|
+
-> explicit project verification setup/maintenance or real-flow acceptance request?
|
|
60
|
+
-> skills/feature-acceptance/SKILL.md
|
|
53
61
|
-> explicit E2E or Playwright request? -> skills/e2e-testing/SKILL.md + agents/e2e-runner.md
|
|
54
62
|
-> explicit harness audit? -> agents/harness-optimizer.md
|
|
55
63
|
-> explicit architecture-health audit? -> skills/improve-codebase-architecture/SKILL.md
|
|
@@ -65,7 +73,7 @@ Task arrives
|
|
|
65
73
|
-> durable multi-session/tracker graph? -> skills/to-tickets/SKILL.md
|
|
66
74
|
-> independent frontier tickets with no overlapping write surface?
|
|
67
75
|
-> skills/subagent-driven-development/SKILL.md
|
|
68
|
-
-> otherwise -> skills/implement/SKILL.md
|
|
76
|
+
-> otherwise -> read-reference skills/implement/SKILL.md
|
|
69
77
|
-> behavior change with a test path? -> test-driven-development
|
|
70
78
|
-> new feature or other Git-rule isolation need? -> rules/05-git-workflow.md
|
|
71
79
|
-> completion, fixed, or ready claim? -> rules/common/testing.md
|