@givolt/i3-composer-agent 2.2.1 → 2.2.2

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.
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ // Installed as scripts/i3-composer-agent/lib/installation.cjs. Resolve from
4
+ // this file, never the caller's working directory or the host's package.json.
5
+ const fs = require('node:fs');
6
+ const path = require('node:path');
7
+ const EXPECTED_VERSION = '__I3_INSTALL_VERSION__';
8
+ const root = path.resolve(__dirname, '../../..');
9
+ const manifestPath = path.join(root, '.i3-composer-agent.json');
10
+
11
+ function resolveOwned(relative) {
12
+ if (typeof relative !== 'string' || relative.includes('\\') || relative.includes(':')
13
+ || relative.includes('\0') || relative.split('/').some(part => ['', '.', '..'].includes(part))) {
14
+ throw new Error(`安装清单路径无效:${relative}`);
15
+ }
16
+ let file = root;
17
+ for (const part of relative.split('/')) {
18
+ file = path.join(file, part);
19
+ if (!fs.existsSync(file)) throw new Error(`安装内容缺失:${relative}`);
20
+ if (fs.lstatSync(file).isSymbolicLink()) throw new Error(`安装内容不能通过符号链接替代:${relative}`);
21
+ }
22
+ if (!fs.statSync(file).isFile()) throw new Error(`安装文件无效:${relative}`);
23
+ return file;
24
+ }
25
+
26
+ function loadInstallation() {
27
+ let manifest;
28
+ try { manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')); }
29
+ catch (error) { throw new Error(`无法读取安装清单 ${manifestPath}:${error.message}`); }
30
+ if (manifest.name !== 'i3-composer-agent' || manifest.layoutVersion !== 2
31
+ || manifest.version !== EXPECTED_VERSION || !Array.isArray(manifest.assets) || !manifest.assets.length) {
32
+ throw new Error(`安装清单的名称、布局或版本不匹配:${manifestPath}`);
33
+ }
34
+ const assets = new Set(manifest.assets);
35
+ for (const [category, suffix] of [['skills', '/SKILL.md'], ['commands', '.md'], ['agents', '.md']]) {
36
+ const names = manifest.catalog?.[category];
37
+ if (!Array.isArray(names) || !names.length || new Set(names).size !== names.length) {
38
+ throw new Error(`安装清单缺少有效的 ${category} 目录项:${manifestPath}`);
39
+ }
40
+ for (const name of names) {
41
+ if (typeof name !== 'string' || !/^[a-z0-9][a-z0-9-]*$/.test(name)
42
+ || !assets.has(`${category}/${name}${suffix}`)) throw new Error(`安装清单目录项无效:${category}/${name}`);
43
+ }
44
+ }
45
+ for (const relative of assets) resolveOwned(relative);
46
+ const resources = {};
47
+ for (const category of ['references', 'evals', 'hooks', 'scripts', 'docs']) {
48
+ const relative = `${category}/i3-composer-agent`;
49
+ if (manifest.resources?.[category] !== relative || ![...assets].some(file => file.startsWith(relative + '/'))) {
50
+ throw new Error(`安装清单缺少资源:${category}`);
51
+ }
52
+ resources[category] = path.join(root, relative);
53
+ }
54
+ return { root, manifest, catalog: manifest.catalog, resources, skillsDirectory: path.join(root, 'skills') };
55
+ }
56
+
57
+ module.exports = { loadInstallation };
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ try {
5
+ const { loadInstallation } = require('./lib/installation.cjs');
6
+ const { manifest } = loadInstallation();
7
+ console.log(`安装版本 ${manifest.version},布局 ${manifest.layoutVersion};${manifest.assets.length} 个登记文件均存在。`);
8
+ } catch (error) { console.error(error.message); process.exitCode = 1; }
package/bin/wizard.cjs CHANGED
@@ -44,7 +44,9 @@ async function confirm(plan) {
44
44
  for (const target of plan.targets) {
45
45
  console.log(` ${target.agents.join(', ')}: ${target.skillsDirectory}`);
46
46
  if (target.commandsDirectory) console.log(` 命令:${target.commandsDirectory}`);
47
- console.log(` 完整配套(evals、hooks、scripts):${target.supportDirectory}`);
47
+ console.log(` 评测:${target.evalsDirectory}`);
48
+ console.log(` 脚本:${target.scriptsDirectory}`);
49
+ console.log(` Hook:${target.hooksDirectory}`);
48
50
  }
49
51
  if (plan.conflicts.length) console.log(`将替换 ${plan.conflicts.length} 个已有内容;安装成功后清理旧文件,失败则恢复。`);
50
52
  if (plan.reused.length) console.log(`将复用同版本的 ${plan.reused.length} 个未修改内容。`);
@@ -11,7 +11,8 @@ npx @givolt/i3-composer-agent --codebuddy
11
11
  向导预选 CodeBuddy,可增加其他工具,再选择项目或全局范围。
12
12
  项目安装提供 `.codebuddy/skills/`(25 个技能)、`references/`、
13
13
  `commands/`(9 个命令)和 `agents/`(4 个角色)。
14
- 同级 `i3-composer-agent/` 默认提供完整的 `evals/`、`hooks/`、`scripts/` 和依赖资料。
14
+ 同级 `evals/`、`hooks/`、`scripts/`、`docs/`、`references/` 各自通过 `i3-composer-agent/` 分组资料,
15
+ 只有一份实际技能、命令和角色,评测与宿主共用。
15
16
  全局使用 `~/.codebuddy/` 的相同结构。默认中文说明和回复;技能/命令标识不改名。
16
17
  安装成功清理旧内容,失败恢复;设置与自定义命令保留。
17
18
 
@@ -40,8 +41,8 @@ CodeBuddy 与 WorkBuddy 项目共用 `.codebuddy/`;同版本追加客户端会
40
41
 
41
42
  ## 配套检查
42
43
 
43
- 进入 `.codebuddy/i3-composer-agent/`(全局安装使用对应全局路径)运行 `npm test`,
44
- 可检查技能格式及中英文触发,不调用模型。行为评测、样例和脚本用法见
44
+ 在业务项目运行 `node .codebuddy/scripts/i3-composer-agent/run-evals.cjs --min-rank1 95`,
45
+ 可检查中英文触发,不调用模型;全局安装使用脚本的全局绝对路径。五项校验、行为评测和样例用法见
45
46
  [评测说明](../evals/README.md)。Hook 文件已安装,需要按宿主协议单独启用。
46
47
 
47
48
  ## 通过 CodeBuddy Code 插件管理器安装
@@ -6,10 +6,12 @@
6
6
  npx @givolt/i3-composer-agent --codex
7
7
  ```
8
8
 
9
- 项目范围写入 `.agents/skills/`,全局写入 `~/.agents/skills/`,并安装同级 `references/`。
9
+ 项目范围写入 `.agents/skills/`,全局写入 `~/.agents/skills/`,并安装同级 `references/i3-composer-agent/`。
10
10
  提供全部 25 个 `i3-` 技能,中文选择说明与默认中文回复在每个入口独立生效。
11
- 同级 `i3-composer-agent/` 默认提供完整评测、Hook、脚本及依赖资料。
12
- 进入该配套目录执行 `npm test` 可进行结构和中英文触发检查,不调用模型;详见
11
+ 同级 `evals/`、`hooks/`、`scripts/`、`docs/` 各自以 `i3-composer-agent/` 分组资料。
12
+ 命令与角色文件也会提供,供按需阅读,其自动发现由宿主决定。
13
+ 从项目目录执行 `node .agents/scripts/i3-composer-agent/run-evals.cjs --min-rank1 95`
14
+ 检查实际安装技能的中英文触发,不调用模型;五项结构校验详见
13
15
  [评测说明](../evals/README.md)。原生调用使用技能 ID,Hook 文件需按宿主能力单独启用。
14
16
 
15
17
  ## 通过插件管理器安装
@@ -13,9 +13,11 @@ npx @givolt/i3-composer-agent --agents codebuddy,workbuddy --scope global --yes
13
13
  - `~/.workbuddy/skills/`:25 个 `i3-` 技能,选择说明和默认回复中文。
14
14
  - `~/.workbuddy/commands/`:9 个 `/i3-*` 短命令。
15
15
  - `~/.workbuddy/agents/`:4 个专业角色。
16
- - `~/.workbuddy/references/`:共享参考和标准 MIT 许可。
17
- - `~/.workbuddy/docs/agents.md`:角色说明。
18
- - `~/.workbuddy/i3-composer-agent/`:完整评测、Hook、脚本及依赖资料。
16
+ - `~/.workbuddy/references/i3-composer-agent/`:共享参考。
17
+ - `~/.workbuddy/docs/i3-composer-agent/agents.md`:角色说明。
18
+ - `~/.workbuddy/evals/i3-composer-agent/`:中英文用例、样例与评测结果。
19
+ - `~/.workbuddy/hooks/i3-composer-agent/`:Hook 文件与说明。
20
+ - `~/.workbuddy/scripts/i3-composer-agent/`:评测、校验与依赖库。
19
21
  - `~/.workbuddy/.i3-composer-agent.json`:安装内容所有权及客户端清单。
20
22
 
21
23
  自定义 profile 可设置 `WORKBUDDY_CONFIG_DIR`,安装后打开对应 profile。
@@ -23,8 +25,8 @@ WorkBuddy 的目录选择使用自己的配置,不借用 `CODEBUDDY_CONFIG_DIR
23
25
 
24
26
  ## 配套检查
25
27
 
26
- 进入 `~/.workbuddy/i3-composer-agent/` 运行 `npm test`,检查技能格式及中英文触发,
27
- 不会调用模型。项目安装对应 `.codebuddy/i3-composer-agent/`。行为评测用例、样例和
28
+ 运行 `node ~/.workbuddy/scripts/i3-composer-agent/run-evals.cjs --min-rank1 95`,检查实际安装技能的中英文触发,
29
+ 不会调用模型。项目安装将 `~/.workbuddy/` 换成 `.codebuddy/`。五项校验、行为评测用例、样例和
28
30
  脚本用法见 [评测说明](../evals/README.md)。Hook 文件默认提供,启用需适配宿主事件协议。
29
31
 
30
32
  ## 发现和调用
@@ -72,7 +74,7 @@ npx @givolt/i3-composer-agent --workbuddy --scope global --dry-run
72
74
  npx @givolt/i3-composer-agent --workbuddy --scope global --yes --force
73
75
  ```
74
76
 
75
- 升级、修改内容和未登记同名冲突需要确认;成功替换后清理旧文件与所属历史备份,失败恢复。
77
+ 升级和已登记文件修改需确认;未归属的资料冲突或不同内容的同名评测结果需要先处理;成功替换后清理旧文件与所属历史备份,失败恢复。
76
78
  原生安装同时提供 Skills、Commands、Agents 和完整 evals/hooks/scripts 配套。
77
79
  `--prepare --workbuddy` 不支持,原生安装不会启用插件 Hook。
78
80
 
package/evals/README.md CHANGED
@@ -6,32 +6,39 @@
6
6
 
7
7
  ## 运行位置
8
8
 
9
- 原生安装的完整配套目录是宿主目录下的 `i3-composer-agent/`。
10
- 例如 CodeBuddy 项目安装为 `.codebuddy/i3-composer-agent/`,
11
- WorkBuddy 全局安装为 `~/.workbuddy/i3-composer-agent/`。
12
- 先进入该目录;若使用 `--prepare` / `--extract`,进入指定的导出目录。
13
- 配套目录保留技能、命令、角色、参考资料和插件清单,保证校验及 Hook 的相对路径可解析。
14
- 宿主实际使用的原生入口仍位于它自己的 `skills/`、`commands/`、`agents/`。
9
+ 原生安装的技能位于宿主基址的 `skills/`;评测资料位于 `evals/i3-composer-agent/`,
10
+ 脚本位于 `scripts/i3-composer-agent/`。安装清单记录预期技能和文件,评测只读取这份实际安装内容。
11
+ 例如 CodeBuddy 项目基址是 `.codebuddy/`,WorkBuddy 全局基址是 `~/.workbuddy/`。
12
+ 下面原生示例从业务项目根目录运行;从其他位置运行时,将脚本路径换成绝对路径即可。
13
+ Node.js 20 或以上,无需额外 npm 依赖;`.cjs` 入口兼容业务项目的 ESM/CommonJS 设置。
15
14
 
16
15
  ## 不调用模型的检查
17
16
 
18
- 需要 Node.js 20 或以上,无需额外 npm 依赖。
19
-
20
17
  ```bash
21
- # 技能格式、清单版本、三种命令格式一致性、引用与产物路径
22
- npm run validate
18
+ node .codebuddy/scripts/i3-composer-agent/validate-skills.cjs
19
+ node .codebuddy/scripts/i3-composer-agent/validate-versions.cjs
20
+ node .codebuddy/scripts/i3-composer-agent/validate-commands.cjs
21
+ node .codebuddy/scripts/i3-composer-agent/validate-reference-links.cjs
22
+ node .codebuddy/scripts/i3-composer-agent/validate-artifact-paths.cjs
23
+ node .codebuddy/scripts/i3-composer-agent/run-evals.cjs --locale zh-CN --min-rank1 95
24
+ node .codebuddy/scripts/i3-composer-agent/run-evals.cjs --locale en --min-rank1 95
25
+ ```
23
26
 
24
- # 中英文分别检查;省略 --locale 时检查两种语言
25
- node scripts/run-evals.js --locale zh-CN --min-rank1 95
26
- node scripts/run-evals.js --locale en --min-rank1 95
27
+ 五项校验分别检查技能格式、安装版本及登记文件、实际命令和角色格式、引用锚点、规格/计划产物路径。
28
+ 缺少安装清单、已登记技能或必需资源会报错;其他插件和用户新增技能不进入本包的评测目录项。
29
+ `cases/` 保留英文用例,`zh-CN/cases/` 提供中文用例,`fixtures/` 是行为评测的真实输入,
30
+ `plugin/` 保留插件评测提示与评分标准。`skill-impact.md` 记录因评测未通过而放弃的技能改动。
27
31
 
28
- # 一次运行结构检查和中英文触发评测
32
+ 若使用 `--prepare` / `--extract` 的独立插件,进入导出目录运行原有入口:
33
+
34
+ ```bash
29
35
  npm test
36
+ npm run validate
37
+ node scripts/run-evals.js --locale zh-CN --min-rank1 95
30
38
  ```
31
39
 
32
- `scripts/` 包含 `run-evals.js`、五个 `validate-*.js` 和它们依赖的 `lib/skill-lint.js`。
33
- `evals/cases/` 保留英文用例,`evals/zh-CN/cases/` 提供中文用例,
34
- `evals/fixtures/` 是执行型评测使用的测试项目样例,`evals/plugin/` 是插件级评测用例。
40
+ 独立插件的校验还会检查插件清单和三种命令格式的一致性。原生安装不复制这些注册清单,
41
+ 不需要在业务项目或宿主基址执行 `npm test`。
35
42
 
36
43
  触发评测使用词法评分检查正例、负例、描述冲突、用例结构及样例是否齐全。
37
44
  中英文各自满足指定门槛;这不能证明模型在实际宿主中一定选择正确技能。
@@ -42,13 +49,13 @@ npm test
42
49
  先预览,不调用模型、不生成评测结果:
43
50
 
44
51
  ```bash
45
- node scripts/run-evals.js --behavioral i3-test-driven-development --locale zh-CN --dry-run
52
+ node .codebuddy/scripts/i3-composer-agent/run-evals.cjs --behavioral i3-test-driven-development --locale zh-CN --dry-run
46
53
  ```
47
54
 
48
55
  确认需要后,移除 `--dry-run` 才会调用已登录的 Claude Code,并消耗该账户的模型额度:
49
56
 
50
57
  ```bash
51
- node scripts/run-evals.js --behavioral i3-test-driven-development --locale zh-CN
58
+ node .codebuddy/scripts/i3-composer-agent/run-evals.cjs --behavioral i3-test-driven-development --locale zh-CN
52
59
  ```
53
60
 
54
61
  执行型用例需要 Git,并在临时 Git 项目中复制 `fixtures/` 的真实输入;
@@ -59,13 +66,15 @@ node scripts/run-evals.js --behavioral i3-test-driven-development --locale zh-CN
59
66
 
60
67
  `--locale en` 运行英文用例,省略该参数运行两种语言。可通过 `I3_EVAL_MODEL`
61
68
  和 `I3_EVAL_GRADER_MODEL` 指定执行/评分模型;报告同时记录宿主和模型信息。
62
- 结果写入 `evals/results/`,不会进入发行包,也不属于安装器的替换清单。
69
+ 原生结果写入 `evals/i3-composer-agent/results/`;独立插件写入 `evals/results/`。
70
+ 结果不会进入发行包和文件替换清单,升级保留;旧配套目录的结果会迁入新位置,同名异内容时停止迁移。
63
71
 
64
72
  ## 插件级评测
65
73
 
66
74
  插件清单中的 `experimental.evals` 指向随包提供的 `evals/plugin/`。
75
+ 原生安装也保留这些用例作为资料;要运行依赖插件清单的命令,需要独立插件导出。
67
76
  它包含整体插件的触发/不触发提示和评分规则;支持 `plugin eval` 的 Claude Code
68
- 可从配套目录主动运行:
77
+ 可从 `--prepare` / `--extract` 的独立插件导出目录主动运行:
69
78
 
70
79
  ```bash
71
80
  claude plugin eval . --no-publish
@@ -77,7 +86,7 @@ claude plugin eval . --no-publish
77
86
 
78
87
  ## Hooks
79
88
 
80
- `hooks/` 默认交付会话注入、文档缓存、代码块保护脚本及说明。
89
+ 原生的 `hooks/i3-composer-agent/`(独立插件为 `hooks/`)默认交付会话注入、文档缓存、代码块保护脚本及说明。
81
90
  安装文件不会自动注册事件。中文回复与普通技能调用不依赖启用 Hook。
82
91
  会话注入仅适用于缺少原生技能路由的宿主;已有路由时不要重复注入。
83
92
  缓存及保护的当前配置示例针对 Claude Code,详见
@@ -0,0 +1,6 @@
1
+ # Rejected Skill Changes
2
+
3
+ This append-only ledger records skill and description changes rejected on eval evidence so contributors can review prior attempts before proposing overlapping work. Add one concise row per rejected proposal; do not record accepted changes here.
4
+
5
+ | Date | Affected skill | Attempted change | Rank-1 score (before → after) | Rejected PR and outcome |
6
+ |---|---|---|---:|---|
package/package.json CHANGED
@@ -113,6 +113,7 @@
113
113
  "evals/plugin/code-review-stays-quiet/graders/not-fired.md",
114
114
  "evals/plugin/code-review-stays-quiet/graders/tdd-fired.md",
115
115
  "evals/plugin/code-review-stays-quiet/prompt.md",
116
+ "evals/skill-impact.md",
116
117
  "evals/zh-CN/cases/i3-api-and-interface-design.json",
117
118
  "evals/zh-CN/cases/i3-browser-testing-with-devtools.json",
118
119
  "evals/zh-CN/cases/i3-ci-cd-and-automation.json",
@@ -274,6 +275,7 @@
274
275
  "evals/plugin/code-review-stays-quiet/graders/not-fired.md",
275
276
  "evals/plugin/code-review-stays-quiet/graders/tdd-fired.md",
276
277
  "evals/plugin/code-review-stays-quiet/prompt.md",
278
+ "evals/skill-impact.md",
277
279
  "evals/zh-CN/cases/i3-api-and-interface-design.json",
278
280
  "evals/zh-CN/cases/i3-browser-testing-with-devtools.json",
279
281
  "evals/zh-CN/cases/i3-ci-cd-and-automation.json",
@@ -327,7 +329,7 @@
327
329
  "LICENSE"
328
330
  ]
329
331
  },
330
- "version": "2.2.1",
332
+ "version": "2.2.2",
331
333
  "repository": {
332
334
  "type": "git",
333
335
  "url": "https://github.com/49780522/i3-composer-agent.git"
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i3-composer-agent",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "覆盖需求、计划、开发、测试、审查与发布的软件工程技能,默认使用简体中文。",
5
5
  "homepage": "https://github.com/49780522/i3-composer-agent",
6
6
  "repository": "https://github.com/49780522/i3-composer-agent"