claude-everything-workflow 0.2.5 → 0.2.7
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/.mcp.json +14 -0
- package/AGENTS.md +6 -0
- package/CLAUDE.md +2 -0
- package/README.md +20 -0
- package/README.zh-CN.md +20 -0
- package/agents/e2e-runner.md +1 -0
- package/bin/claude-everything-workflow.js +15 -0
- package/docs/plugins.md +4 -0
- package/harness/manifest.json +1 -1
- package/package.json +3 -1
- package/rules/01-base.md +4 -1
- package/rules/02-implementation.md +1 -1
- package/rules/08-specialty-rules-index.md +1 -1
- package/rules/common/testing.md +7 -0
- package/scripts/install-rules.js +8 -4
- 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/legacy-common-rule-hashes.json +16 -1
- package/scripts/merge-claude-settings.cjs +88 -25
- package/scripts/verify/install-rules.test.js +213 -11
- package/scripts/verify/learning.test.js +122 -0
- package/scripts/verify/metadata-checks.js +1 -1
- package/scripts/verify/plugin-distribution.test.js +3 -0
- 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/e2e-testing/SKILL.md +1 -1
- 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.7",
|
|
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.7",
|
|
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/.mcp.json
ADDED
package/AGENTS.md
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
> 规则按需读取,不要默认全量加载 `rules/` 或 `rules/common/`。
|
|
14
14
|
|
|
15
|
+
- 工程交付(实现、修复、测试、审查)先进入 `using-superpowers`,按其判断选择并读取后续流程。
|
|
16
|
+
|
|
15
17
|
## 规则加载策略
|
|
16
18
|
|
|
17
19
|
- 默认不全量读取 `rules/`;涉及代码修改、审查、测试、提交或 Harness 调整时,只读取与当前任务直接相关的规则文件,回退场景不改变该原则。
|
|
@@ -19,6 +21,10 @@
|
|
|
19
21
|
- Claude 升级时若保留了个人修改的旧 `~/.claude/rules/common/...`,该用户规则仍生效;读取同名参考前先检查并尊重该修改,不把新版通用参考覆盖到个人约束上。
|
|
20
22
|
- `rules/common/` 是专项参考区;仅命令、agent、skill 或当前任务明确触发时读取。
|
|
21
23
|
|
|
24
|
+
## 浏览器验证
|
|
25
|
+
|
|
26
|
+
需要复用用户已登录的 Chrome 做交互式验证时,按 `rules/common/testing.md` 的“浏览器验证”执行;不要新开浏览器验证登录态页面。
|
|
27
|
+
|
|
22
28
|
## 规则索引
|
|
23
29
|
|
|
24
30
|
| 规则文件 | 内容与触发场景 |
|
package/CLAUDE.md
CHANGED
package/README.md
CHANGED
|
@@ -71,6 +71,26 @@ The CLI selects the shell or PowerShell installer for your platform. The same `-
|
|
|
71
71
|
|
|
72
72
|
Installation updates user-level files and can affect multiple projects. Changed top-level configuration files are backed up; matching files inside shared directories are synchronized from the repository. Unknown files are generally retained, while known retired files are removed by an explicit cleanup list. Back up any personal edits to shared files before upgrading. Use the installer instead of copying the entire `rules/` directory: it handles the different rule locations used by each host.
|
|
73
73
|
|
|
74
|
+
A fresh Claude Code installation puts CEW’s base, Git and security rules in `~/.claude/rules/`. Other CEW rules are available on demand under `~/.claude/references/rules/`. On upgrade, personally edited copies of the three newly migrated rules stay active. Obsolete rules left by older releases can also still load.
|
|
75
|
+
|
|
76
|
+
### Browser verification (optional)
|
|
77
|
+
|
|
78
|
+
Interactive checks that need your existing login can reuse the running Chrome instead of opening a new browser. Claude Code plugin installs register the `chrome-devtools` MCP from the repository's `.mcp.json`; npm installs add it manually:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
# Claude Code
|
|
82
|
+
claude mcp add -s user chrome-devtools -- \
|
|
83
|
+
npx -y chrome-devtools-mcp@latest --autoConnect \
|
|
84
|
+
--no-usage-statistics --no-performance-crux
|
|
85
|
+
|
|
86
|
+
# Codex
|
|
87
|
+
codex mcp add chrome-devtools -- \
|
|
88
|
+
npx -y chrome-devtools-mcp@latest --autoConnect \
|
|
89
|
+
--no-usage-statistics --no-performance-crux
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Requires Node.js 20.19+, Chrome 144+, and remote debugging enabled at `chrome://inspect/#remote-debugging`. If a `chrome-devtools` server already exists, add `--autoConnect` to it; without it the server opens a new browser instead of reusing the running Chrome. The agent lists open pages and selects the tab matching the project URL. Repeatable `npx playwright test` runs still use their own browser and should prepare login state with `storageState`.
|
|
93
|
+
|
|
74
94
|
## How it works
|
|
75
95
|
|
|
76
96
|
Start with a normal task request. The workflow router selects relevant skills; you do not need to memorize every skill name.
|
package/README.zh-CN.md
CHANGED
|
@@ -71,6 +71,26 @@ node bin/claude-everything-workflow.js install
|
|
|
71
71
|
|
|
72
72
|
安装修改的是用户级目录,可能影响多个项目。顶层配置内容不同时会先备份;共享目录中的同名文件按仓库版本同步。未知文件通常保留,已登记的退役文件按明确清单清理。升级前请备份对共享文件的个人修改。不要直接复制整个 `rules/` 目录,安装器会处理两个宿主不同的规则加载位置。
|
|
73
73
|
|
|
74
|
+
全新安装时,CEW 将执行原则、Git 和安全规则放入 Claude Code 自动读取的 `~/.claude/rules/`,其余规则从 `~/.claude/references/rules/` 按需读取。升级时,本次迁移的三份规则如有个人修改,仍在原处生效。更早版本遗留的退役规则也可能继续加载。
|
|
75
|
+
|
|
76
|
+
### 浏览器验证(可选)
|
|
77
|
+
|
|
78
|
+
需要在你已登录的页面上做交互式核对时,让 agent 连接你当前的 Chrome,而不是新开浏览器。Claude Code 插件安装会通过仓库根目录的 `.mcp.json` 注册 `chrome-devtools` MCP;npm 安装需手动添加:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
# Claude Code
|
|
82
|
+
claude mcp add -s user chrome-devtools -- \
|
|
83
|
+
npx -y chrome-devtools-mcp@latest --autoConnect \
|
|
84
|
+
--no-usage-statistics --no-performance-crux
|
|
85
|
+
|
|
86
|
+
# Codex
|
|
87
|
+
codex mcp add chrome-devtools -- \
|
|
88
|
+
npx -y chrome-devtools-mcp@latest --autoConnect \
|
|
89
|
+
--no-usage-statistics --no-performance-crux
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
需要 Node.js 20.19+、Chrome 144+,并在 `chrome://inspect/#remote-debugging` 启用远程调试。已有同名 `chrome-devtools` 配置时,需为其补上 `--autoConnect`,否则会新开浏览器而不是复用当前 Chrome。agent 会先列出已打开的页面,按项目地址选中标签页。可复跑的 `npx playwright test` 仍使用独立浏览器,登录态通过 `storageState` 准备。
|
|
93
|
+
|
|
74
94
|
## 如何使用
|
|
75
95
|
|
|
76
96
|
直接用自然语言描述任务,路由会选择相关技能,不需要记住所有 Skill 名称。
|
package/agents/e2e-runner.md
CHANGED
|
@@ -14,6 +14,7 @@ model: sonnet
|
|
|
14
14
|
- 优先项目已有脚本、依赖和 CLI;Agent Browser/MCP 只做探索,不替代最终测试。
|
|
15
15
|
- 只修改本次 E2E 范围内的测试、配置和必要脚本,不顺手重构产品代码。
|
|
16
16
|
- 失败时先读取 CLI、trace、截图、视频和 HTML 报告,再判断测试、产品或环境根因。
|
|
17
|
+
- 可复跑测试用 Playwright CLI;需要登录态的交互式查看由主会话用 chrome-devtools MCP(`--autoConnect`)完成,不新开浏览器。
|
|
17
18
|
|
|
18
19
|
## 回传
|
|
19
20
|
|
|
@@ -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/docs/plugins.md
CHANGED
|
@@ -55,6 +55,10 @@ codex plugin add claude-everything-workflow@cew
|
|
|
55
55
|
|
|
56
56
|
CLI 命令以宿主版本为准;缺少 `plugin` 子命令时使用支持插件的应用版本或继续使用 npm 安装。
|
|
57
57
|
|
|
58
|
+
### 浏览器验证 MCP
|
|
59
|
+
|
|
60
|
+
Claude 插件根目录的 `.mcp.json` 会注册 `chrome-devtools` MCP,启用插件后无需手动配置。前置条件、手动添加命令和复用已登录 Chrome 的说明见 README 的“浏览器验证(可选)”。
|
|
61
|
+
|
|
58
62
|
## 与 npm 安装的区别
|
|
59
63
|
|
|
60
64
|
| 项目 | 插件安装 | npm 安装 |
|
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.7",
|
|
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"
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
"yaml": "2.9.0"
|
|
31
32
|
},
|
|
32
33
|
"files": [
|
|
34
|
+
".mcp.json",
|
|
33
35
|
".claude-plugin/",
|
|
34
36
|
".codex-plugin/",
|
|
35
37
|
".agents/plugins/marketplace.json",
|
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
|
- 状态变化显式,遵循项目更新惯例;保留公共接口和既有工作流,破坏性变更需用户批准。
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
| Hook 行为、退出码、Profile、权限 | `common/hooks.md` |
|
|
13
13
|
| Token、MCP、模型和上下文成本 | `common/performance.md` |
|
|
14
14
|
| 外部 skill 学习、模式保存、演化评估 | `common/skills-learning.md` |
|
|
15
|
-
| 测试策略、TDD、E2E
|
|
15
|
+
| 测试策略、TDD、E2E、浏览器验证、验证范围 | `common/testing.md` |
|
|
16
16
|
| 提交、推送、PR、CI 质量门 | `05-git-workflow.md`、`common/pr-automation.md` |
|
|
17
17
|
| 安全敏感实现或安全审查 | `07-forbidden.md` |
|
|
18
18
|
| 架构与兼容、错误处理、代码规模、注释 | `02-implementation.md` |
|
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。
|
|
@@ -34,3 +35,9 @@
|
|
|
34
35
|
## 端到端测试
|
|
35
36
|
|
|
36
37
|
Playwright 的组织、等待、POM、CI 制品和 flake 处理以 `skills/e2e-testing/SKILL.md` 为准;探索工具不能替代可重复的 E2E。本地多 worktree 运行时隔离端口和环境变量,启动服务必须等待 Web/API ready。CI 失败时按 `skills/e2e-testing/SKILL.md` 保留失败制品。
|
|
38
|
+
|
|
39
|
+
## 浏览器验证
|
|
40
|
+
|
|
41
|
+
- 需要登录态时复用已有会话;连接失败不另开浏览器绕过。
|
|
42
|
+
- 操作前确认目标页面,不关闭或修改无关页面。
|
|
43
|
+
- 可复跑测试使用独立测试登录态,不依赖用户日常会话。
|
package/scripts/install-rules.js
CHANGED
|
@@ -8,6 +8,9 @@ const crypto = require("node:crypto");
|
|
|
8
8
|
const digest = (content) => crypto.createHash("sha256")
|
|
9
9
|
.update(content.toString("utf8").replace(/\r\n/g, "\n")).digest("hex");
|
|
10
10
|
|
|
11
|
+
// Only cross-task policies belong in Claude's automatically loaded rules directory.
|
|
12
|
+
const claudeResidentRules = new Set(["01-base.md", "05-git-workflow.md", "07-forbidden.md"]);
|
|
13
|
+
|
|
11
14
|
// Check the root and every descendant before touching a managed file; do not follow links.
|
|
12
15
|
function checkedPath(root, relative) {
|
|
13
16
|
const target = path.resolve(root, relative);
|
|
@@ -44,7 +47,7 @@ function copyRule({ source, root, relative, dryRun, log }) {
|
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
function
|
|
50
|
+
function retireRule({ source, root, relative, knownHashes, dryRun, log }) {
|
|
48
51
|
const target = checkedPath(root, relative);
|
|
49
52
|
if (!fs.existsSync(target)) return;
|
|
50
53
|
const hash = digest(fs.readFileSync(target));
|
|
@@ -67,18 +70,19 @@ function installRules({ sourceRoot, installRoot, host, dryRun = false, log = con
|
|
|
67
70
|
const commonFiles = fs.readdirSync(path.join(rulesRoot, "common"), { withFileTypes: true })
|
|
68
71
|
.filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
|
|
69
72
|
.map((entry) => `common/${entry.name}`);
|
|
73
|
+
const installedOnDemand = (relative) => host === "claude-code" && !claudeResidentRules.has(relative);
|
|
70
74
|
// Validate all managed destinations before the first write, including upgrade cleanup paths.
|
|
71
75
|
for (const relative of [...files, ...commonFiles]) {
|
|
72
76
|
checkedPath(root, `rules/${relative}`);
|
|
73
|
-
if (
|
|
77
|
+
if (installedOnDemand(relative)) {
|
|
74
78
|
checkedPath(root, `references/rules/${relative}`);
|
|
75
79
|
}
|
|
76
80
|
}
|
|
77
81
|
for (const relative of [...files, ...commonFiles]) {
|
|
78
82
|
const source = path.join(rulesRoot, relative);
|
|
79
|
-
const cold =
|
|
83
|
+
const cold = installedOnDemand(relative);
|
|
80
84
|
copyRule({ source, root, relative: `${cold ? "references/rules" : "rules"}/${relative}`, dryRun, log });
|
|
81
|
-
if (cold)
|
|
85
|
+
if (cold) retireRule({ source, root, relative: `rules/${relative}`,
|
|
82
86
|
knownHashes: legacy.files[relative] || [], dryRun, log });
|
|
83
87
|
}
|
|
84
88
|
}
|
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,8 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
3
|
"algorithm": "sha256-lf",
|
|
4
|
-
"source": "origin/main history through a4f938bc70f3f85e4dcfad4d2534f522b823ea20",
|
|
4
|
+
"source": "common/: origin/main history through a4f938bc70f3f85e4dcfad4d2534f522b823ea20; top-level rules: first-parent main history through 7326e4b",
|
|
5
5
|
"files": {
|
|
6
|
+
"02-implementation.md": [
|
|
7
|
+
"1bbe491d9b89e37a6a6d004e1b6e1ccd7478b94341e7b4c51ce8d01fad585c7f",
|
|
8
|
+
"700331676ad40d65acdeb469a67cf802cddff78ebf0861ec5e4427b5a3d23620"
|
|
9
|
+
],
|
|
10
|
+
"08-specialty-rules-index.md": [
|
|
11
|
+
"283aba947990fd768597546f3aab12f8754d4d91968d6d119c3f5828c6be40dd",
|
|
12
|
+
"3fe1bcb7bdbad9ff8b074a36afd96b96fdf0da21c483b842c4ce2042ca398999",
|
|
13
|
+
"70f531356fd1fbd11d62ea0b2b43be82c278e975b43335a8b3956c207a930ef1",
|
|
14
|
+
"7ebf3b13e750fca3888843994ed43aba880ab98bdb8094b1f9070247d3791415"
|
|
15
|
+
],
|
|
16
|
+
"09-first-principles-adversarial-testing.md": [
|
|
17
|
+
"182ab761713451fd9b04c290a070e0235a52833f52cbaf695f065363675faf2f",
|
|
18
|
+
"72b71a851e9349e19806ae66258843b2394d7acbadc4e6498788af6337ba8357",
|
|
19
|
+
"d912674d84c1427d24d9d716d28cc57b926a4cf49284cffd46473d02219a0a57"
|
|
20
|
+
],
|
|
6
21
|
"common/agent-orchestration.md": [
|
|
7
22
|
"0518525f093f91b60dbae5259e0f228686687abdd65787b880f59e286c2e546c",
|
|
8
23
|
"3b5095839ff85adefb7324518526be65c473770df9124d190137ba05721ca6bf",
|