@cat-kit/agent-context 1.2.0 → 1.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.
- package/README.md +84 -32
- package/dist/cli.js +1 -1
- package/dist/commands/done.js +1 -1
- package/dist/commands/index-cmd.js +1 -0
- package/dist/commands/install.js +1 -1
- package/dist/commands/sync.js +1 -1
- package/dist/content/actions.js +22 -6
- package/dist/content/index.js +2 -2
- package/dist/context/indexer.js +3 -0
- package/dist/context/reader.js +1 -1
- package/dist/stats.html +1 -1
- package/dist/tools.js +1 -1
- package/package.json +3 -3
- package/src/cli.ts +11 -2
- package/src/commands/done.ts +7 -1
- package/src/commands/index-cmd.ts +26 -0
- package/src/commands/install.ts +1 -1
- package/src/commands/sync.ts +1 -1
- package/src/content/actions.ts +22 -6
- package/src/content/index.ts +2 -2
- package/src/context/index.ts +1 -0
- package/src/context/indexer.ts +52 -0
- package/src/context/scope.ts +1 -1
- package/src/tools.ts +23 -1
- package/src/types.ts +1 -1
package/README.md
CHANGED
|
@@ -15,13 +15,17 @@
|
|
|
15
15
|
|
|
16
16
|
```text
|
|
17
17
|
.agent-context/
|
|
18
|
-
├──
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
├──
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
└──
|
|
18
|
+
├── .env # SCOPE 配置(SCOPE=<name>)
|
|
19
|
+
├── .gitignore
|
|
20
|
+
└── {scope}/ # 作用域目录(按协作者隔离)
|
|
21
|
+
├── index.md # 计划索引(自动生成)
|
|
22
|
+
├── plan-{N}/ # 当前计划(最多一个)
|
|
23
|
+
│ ├── plan.md
|
|
24
|
+
│ └── patch-{N}.md
|
|
25
|
+
├── preparing/ # 待执行计划队列
|
|
26
|
+
│ └── plan-{N}/
|
|
27
|
+
└── done/ # 已归档计划
|
|
28
|
+
└── plan-{N}-{YYYYMMDD}/
|
|
25
29
|
```
|
|
26
30
|
|
|
27
31
|
生命周期如下:
|
|
@@ -57,11 +61,14 @@ agent-context install
|
|
|
57
61
|
agent-context install --tools claude,codex,cursor
|
|
58
62
|
```
|
|
59
63
|
|
|
60
|
-
安装完成后,CLI 会在对应目录生成 Skill
|
|
64
|
+
安装完成后,CLI 会在对应目录生成 Skill 文件(技能目录名为 `ac-workflow`),例如:
|
|
61
65
|
|
|
62
|
-
- Codex: `.codex/skills/
|
|
63
|
-
- Claude: `.claude/skills/
|
|
64
|
-
- Cursor: `.cursor/skills/
|
|
66
|
+
- Codex: `.codex/skills/ac-workflow/`
|
|
67
|
+
- Claude: `.claude/skills/ac-workflow/`
|
|
68
|
+
- Cursor: `.cursor/skills/ac-workflow/`
|
|
69
|
+
- Antigravity: `.agent/skills/ac-workflow/`
|
|
70
|
+
- Agent Skills(开放标准,如 Gemini CLI 等工具的 `.agents` 别名): `.agents/skills/ac-workflow/`
|
|
71
|
+
- Gemini CLI: `.gemini/skills/ac-workflow/`
|
|
65
72
|
|
|
66
73
|
## 快速开始
|
|
67
74
|
|
|
@@ -82,15 +89,15 @@ agent-context install --tools claude,codex,cursor
|
|
|
82
89
|
|
|
83
90
|
下面的 action 不是 CLI 子命令,而是你对 AI 说的话。AI 安装 Skill 后,会把这些话映射到固定协议。
|
|
84
91
|
|
|
85
|
-
| Action
|
|
86
|
-
|
|
|
87
|
-
| `init`
|
|
88
|
-
| `plan`
|
|
89
|
-
| `replan`
|
|
90
|
-
| `implement` | 计划已经明确,开始真正落地
|
|
91
|
-
| `patch`
|
|
92
|
-
| `rush`
|
|
93
|
-
| `done`
|
|
92
|
+
| Action | 何时使用 | 当前状态要求 | 结果 |
|
|
93
|
+
| ----------- | ------------------------------------------------ | ----------------------------- | ------------------------------------------------------- |
|
|
94
|
+
| `init` | 项目还没建立好协作约定,或者 `AGENTS.md` 不完整 | 无 | 生成或补全 `AGENTS.md`,新项目可继续进入计划 |
|
|
95
|
+
| `plan` | 新需求需要正式拆分步骤 | 当前没有冲突中的已执行计划 | 创建 `plan.md`,必要时拆成当前计划 + preparing 队列 |
|
|
96
|
+
| `replan` | 计划还没实施,但拆分方式或技术路线要改 | 目标计划必须仍是 `未执行` | 重写计划结构,保留单当前计划模型 |
|
|
97
|
+
| `implement` | 计划已经明确,开始真正落地 | 当前计划存在且状态为 `未执行` | 实施全部步骤,验证通过后把计划改为 `已执行` |
|
|
98
|
+
| `patch` | 已执行计划上出现 Bug、遗漏项或增量需求 | 当前计划必须是 `已执行` | 执行修补,生成 `patch-{N}.md`,更新影响范围 |
|
|
99
|
+
| `rush` | 任务范围很清晰,不想先单独经历 plan 再 implement | 当前不能存在未实施计划 | 直接创建单计划并立刻实施 |
|
|
100
|
+
| `done` | 当前计划已经真正完成,需要收尾归档 | 当前计划必须是 `已执行` | 把当前计划移入 `done/`,必要时晋升下一个 preparing 计划 |
|
|
94
101
|
|
|
95
102
|
### `init`
|
|
96
103
|
|
|
@@ -235,10 +242,42 @@ rush 一下,把 README 里的命令表更新为最新版本
|
|
|
235
242
|
|
|
236
243
|
`rush` 很适合这种“知道要改什么,也知道验收标准”的任务,但不适合目标模糊的大需求。
|
|
237
244
|
|
|
245
|
+
## 多人协作
|
|
246
|
+
|
|
247
|
+
`agent-context` 通过 SCOPE 机制支持多人在同一项目中独立管理计划:
|
|
248
|
+
|
|
249
|
+
- 每位协作者拥有独立的作用域目录(`{scope}/`),互不干扰
|
|
250
|
+
- SCOPE 名称自动取自 git 配置的 `user.name`
|
|
251
|
+
- 计划编号在各 SCOPE 内独立递增
|
|
252
|
+
- 首次使用时运行 `agent-context init` 初始化作用域
|
|
253
|
+
|
|
254
|
+
```text
|
|
255
|
+
.agent-context/
|
|
256
|
+
├── alice/ # Alice 的计划
|
|
257
|
+
│ ├── index.md
|
|
258
|
+
│ ├── plan-1/
|
|
259
|
+
│ └── done/
|
|
260
|
+
├── bob/ # Bob 的计划
|
|
261
|
+
│ ├── index.md
|
|
262
|
+
│ ├── plan-3/
|
|
263
|
+
│ └── done/
|
|
264
|
+
└── .env # 当前用户的 SCOPE
|
|
265
|
+
```
|
|
266
|
+
|
|
238
267
|
## CLI 命令参考
|
|
239
268
|
|
|
240
269
|
CLI 只负责文件安装、同步和状态管理,不负责替代 action。
|
|
241
270
|
|
|
271
|
+
### `agent-context init`
|
|
272
|
+
|
|
273
|
+
初始化作用域。首次在项目中使用时运行,会自动检测 git `user.name` 作为 SCOPE 名称,并创建必要的目录结构。
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
agent-context init
|
|
277
|
+
agent-context init --scope alice
|
|
278
|
+
agent-context init --yes
|
|
279
|
+
```
|
|
280
|
+
|
|
242
281
|
### `agent-context install`
|
|
243
282
|
|
|
244
283
|
安装 Skill 文件。
|
|
@@ -289,23 +328,36 @@ agent-context done
|
|
|
289
328
|
agent-context done --yes
|
|
290
329
|
```
|
|
291
330
|
|
|
331
|
+
### `agent-context index`
|
|
332
|
+
|
|
333
|
+
生成或更新当前 SCOPE 的计划索引文件 `.agent-context/{scope}/index.md`。索引按 done、当前计划、preparing 分类,每项为 `- [x/ ] [标题](相对路径)` 格式。
|
|
334
|
+
|
|
335
|
+
归档计划时(`done`)会自动调用,也可手动运行:
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
agent-context index
|
|
339
|
+
```
|
|
340
|
+
|
|
292
341
|
## 通用选项
|
|
293
342
|
|
|
294
|
-
| 选项
|
|
295
|
-
|
|
|
296
|
-
| `--tools <tools>` | `install` / `sync`
|
|
297
|
-
| `--check`
|
|
298
|
-
| `--yes`
|
|
343
|
+
| 选项 | 适用命令 | 说明 |
|
|
344
|
+
| ----------------- | --------------------------- | -------------------------------------------- |
|
|
345
|
+
| `--tools <tools>` | `install` / `sync` | 指定目标工具,逗号分隔 |
|
|
346
|
+
| `--check` | `install` / `sync` | 只检查是否有变更,不写文件 |
|
|
347
|
+
| `--yes` | `install` / `init` / `done` | 跳过交互确认;`install` 会优先复用已安装工具 |
|
|
348
|
+
| `--scope <name>` | `init` | 手动指定 SCOPE 名称,不使用 git user.name |
|
|
299
349
|
|
|
300
350
|
## 支持的工具
|
|
301
351
|
|
|
302
|
-
| 工具
|
|
303
|
-
|
|
|
304
|
-
| Claude
|
|
305
|
-
| Codex
|
|
306
|
-
| Cursor
|
|
307
|
-
| Antigravity
|
|
308
|
-
|
|
|
352
|
+
| 工具 | Skill 目录 |
|
|
353
|
+
| -------------- | ------------------------------ |
|
|
354
|
+
| Claude | `.claude/skills/ac-workflow/` |
|
|
355
|
+
| Codex | `.codex/skills/ac-workflow/` |
|
|
356
|
+
| Cursor | `.cursor/skills/ac-workflow/` |
|
|
357
|
+
| Antigravity | `.agent/skills/ac-workflow/` |
|
|
358
|
+
| Agent Skills(开放标准) | `.agents/skills/ac-workflow/` |
|
|
359
|
+
| Gemini CLI | `.gemini/skills/ac-workflow/` |
|
|
360
|
+
| GitHub Copilot | `.github/skills/ac-workflow/` |
|
|
309
361
|
|
|
310
362
|
其中 Codex 会额外生成 `agents/openai.yaml` 元数据文件,其余工具只生成 Skill 内容本身。
|
|
311
363
|
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{doneCommand as e}from"./commands/done.js";import{
|
|
2
|
+
import{doneCommand as e}from"./commands/done.js";import{indexCommand as t}from"./commands/index-cmd.js";import{initCommand as n}from"./commands/init.js";import{installCommand as r}from"./commands/install.js";import{statusCommand as i}from"./commands/status.js";import{syncCommand as a}from"./commands/sync.js";import{validateCommand as o}from"./commands/validate.js";import{readFileSync as s}from"node:fs";import{Command as c}from"commander";const l=JSON.parse(s(new URL(`../package.json`,import.meta.url),`utf8`)),u=typeof l.version==`string`?l.version:`0.0.0`,d=new c;d.name(`agent-context`).description(`Agent Context Skills 安装工具`).version(u),d.command(`install`).description(`安装 ac-workflow Skill`).option(`--tools <tools>`,`指定目标工具,逗号分隔:claude,codex,cursor,antigravity,agents,gemini,copilot`).option(`--yes`,`非交互模式:优先复用已安装工具,否则安装全部工具`).option(`--check`,`仅检查是否存在待更新内容,不写入文件`).action(r),d.command(`sync`).description(`同步已安装的 ac-workflow Skill`).option(`--tools <tools>`,`指定目标工具,逗号分隔:claude,codex,cursor,antigravity,agents,gemini,copilot`).option(`--check`,`仅检查是否存在待更新内容,不写入文件`).action(a),d.command(`init`).description(`初始化 SCOPE(从 git user.name 自动获取或手动指定)`).option(`--scope <name>`,`手动指定 SCOPE 名称`).option(`--yes`,`非交互模式:自动覆盖已存在的 SCOPE`).action(n),d.command(`validate`).description(`校验 .agent-context 目录结构`).action(o),d.command(`status`).description(`查看当前 agent-context 状态`).action(i),d.command(`done`).description(`归档当前已执行计划`).option(`--yes`,`跳过确认,直接归档`).action(e),d.command(`index`).description(`生成或更新计划索引文件`).action(t),d.parseAsync().catch(e=>{let t=e instanceof Error?e.message:String(e);console.error(`\n❌ ${t}`),process.exitCode=1});export{};
|
package/dist/commands/done.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readRawContext as
|
|
1
|
+
import{readContext as e,readRawContext as t}from"../context/reader.js";import{validate as n}from"../context/validator.js";import{archive as r}from"../context/archiver.js";import{generateIndex as i}from"../context/indexer.js";import{basename as a}from"node:path";import{confirm as o}from"@inquirer/prompts";async function s(s){let{snapshot:c,currentPlanCount:l}=await t(process.cwd()),u=n(c,l);if(!u.valid){for(let e of u.errors)console.log(`❌ ${e}`);process.exitCode=1;return}if(!c||!c.currentPlan){console.log(`❌ 无当前计划`),process.exitCode=1;return}if(c.currentPlan.status!==`已执行`){console.log(`❌ 当前计划 plan-${c.currentPlan.number} 尚未执行,无法归档。`),process.exitCode=1;return}if(!s.yes&&!await o({message:`确认归档 plan-${c.currentPlan.number}?`})){console.log(`已取消`);return}let d=await r(c),f=a(d.archivedTo);console.log(`✅ 已归档: plan-${c.currentPlan.number} → done/${f}`),d.promoted!==null&&console.log(`📋 已晋升: plan-${d.promoted} 为新的当前计划`),d.remainingPreparing>0?console.log(`📋 待执行队列剩余 ${d.remainingPreparing} 个计划`):d.promoted===null&&console.log(`ℹ 无更多待执行计划`);let p=await e(process.cwd());p&&(await i(p),console.log(`📇 已更新索引`))}export{s as doneCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readRawContext as e}from"../context/reader.js";import{validate as t}from"../context/validator.js";import{generateIndex as n}from"../context/indexer.js";import{relative as r}from"node:path";async function i(){let i=process.cwd(),{snapshot:a,currentPlanCount:o}=await e(i),s=t(a,o);if(!s.valid){for(let e of s.errors)console.log(`❌ ${e}`);process.exitCode=1;return}if(!a){console.log(`❌ 未找到 .agent-context 目录`),process.exitCode=1;return}let c=await n(a);console.log(`✅ 已生成索引: ${r(i,c.path)}(${c.entries} 个计划)`)}export{i as indexCommand};
|
package/dist/commands/install.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_TOOL_ORDER as e,detectConfiguredToolIds as t,getToolChoices as n,parseToolIds as r}from"../tools.js";import{runInstall as i}from"../runner.js";import{printCheckResult as a,printRunSummary as o}from"./printer.js";import{checkbox as s}from"@inquirer/prompts";async function c(e={}){let t=process.cwd(),n=await l(t,e),r=e.check??!1,s=await i({cwd:t,tools:n
|
|
1
|
+
import{DEFAULT_TOOL_ORDER as e,detectConfiguredToolIds as t,getToolChoices as n,parseToolIds as r}from"../tools.js";import{runInstall as i}from"../runner.js";import{printCheckResult as a,printRunSummary as o}from"./printer.js";import{checkbox as s}from"@inquirer/prompts";async function c(e={}){let t=process.cwd(),n=await l(t,e),r=e.check??!1,s=await i({cwd:t,check:r,...n?{tools:n}:{}});if(r){a(s,t),s.changed.length>0&&(process.exitCode=1);return}o(s,t)}async function l(i,a){let o=a.tools;if(!o||o.trim().length===0){let r=t(i);return a.yes?r.length>0?r:[...e]:s({message:`请选择要安装 ac-workflow Skill 的工具(可多选):`,choices:n().map(e=>({name:e.name,value:e.id,checked:r.includes(e.id)})),required:!0})}return r(o)}export{c as installCommand};
|
package/dist/commands/sync.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{detectConfiguredToolIds as e,parseToolIds as t}from"../tools.js";import{runSync as n}from"../runner.js";import{printCheckResult as r,printRunSummary as i}from"./printer.js";async function a(e={}){let t=process.cwd(),a=o(t,e.tools),s=e.check??!1,c=await n({cwd:t,tools:a
|
|
1
|
+
import{detectConfiguredToolIds as e,parseToolIds as t}from"../tools.js";import{runSync as n}from"../runner.js";import{printCheckResult as r,printRunSummary as i}from"./printer.js";async function a(e={}){let t=process.cwd(),a=o(t,e.tools),s=e.check??!1,c=await n({cwd:t,check:s,...a?{tools:a}:{}});if(s){r(c,t),c.changed.length>0&&(process.exitCode=1);return}i(c,t)}function o(n,r){if(!r||r.trim().length===0){let t=e(n);if(t.length>0)return t;throw Error(`未检测到已安装的 Skill,请先执行 install 或通过 --tools 显式指定工具`)}return t(r)}export{a as syncCommand};
|
package/dist/content/actions.js
CHANGED
|
@@ -4,6 +4,13 @@ const e=[`init`,`plan`,`replan`,`implement`,`patch`,`rush`],t={init:n,plan:r,rep
|
|
|
4
4
|
|
|
5
5
|
可附带描述参数,用于补充项目背景、技术栈、特殊约束。
|
|
6
6
|
|
|
7
|
+
## 前置检查
|
|
8
|
+
|
|
9
|
+
- 若已存在 \`.agent-context/\`:运行 \`agent-context validate\`,不通过则中止并报告错误。
|
|
10
|
+
- 若 \`.agent-context/\` 不存在:确认这是首次初始化场景;若目录残缺或状态异常,向用户报告,不可继续假设。
|
|
11
|
+
- 新项目缺少关键决策信息时,必须主动提问或确认,不可直接生成 \`AGENTS.md\` 或进入 plan。
|
|
12
|
+
- 遇到阻塞问题应向用户报告,不可静默跳过。
|
|
13
|
+
|
|
7
14
|
## 执行步骤
|
|
8
15
|
|
|
9
16
|
1. **判断项目类型**:检测根目录是否存在有效代码文件和目录结构。
|
|
@@ -13,11 +20,16 @@ const e=[`init`,`plan`,`replan`,`implement`,`patch`,`rush`],t={init:n,plan:r,rep
|
|
|
13
20
|
|
|
14
21
|
2. **处理 AGENTS.md**:
|
|
15
22
|
- 新项目:
|
|
16
|
-
1.
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
1. 先收集或确认以下信息,其中前两类属于**必须主动确认**的决策项,即使描述已部分涵盖也不能整体跳过;可基于描述用确认式问题补问,而不是完全重问。
|
|
24
|
+
- 必须主动确认:技术栈与版本(语言、运行时、框架、构建/测试工具等)
|
|
25
|
+
- 必须主动确认:架构偏好(目录结构、分层模式、关键框架或方案选型)
|
|
26
|
+
- 可基于描述补充:项目目标与核心功能
|
|
27
|
+
- 可基于描述补充:代码规范与工具链细节(lint、formatter、测试约定等)
|
|
28
|
+
2. 对高价值决策类问题必须在计划前澄清,例如:是否使用 monorepo、前后端如何拆分、采用哪个框架与测试工具。
|
|
29
|
+
3. 生成高质量 \`AGENTS.md\`(须满足下方质量标准,不满足则重新优化直至满足)。
|
|
30
|
+
4. 继续执行 plan 创建初始计划。
|
|
19
31
|
- 旧项目:
|
|
20
|
-
1. 若不存在 \`AGENTS.md
|
|
32
|
+
1. 若不存在 \`AGENTS.md\`:优先通过代码与配置读取收集信息;仅对无法可靠判断的内容提问后生成。
|
|
21
33
|
2. 若已存在 \`AGENTS.md\`:按质量标准评估,不足时增补优化。
|
|
22
34
|
3. 默认不创建计划(除非用户明确要求)。
|
|
23
35
|
|
|
@@ -125,13 +137,16 @@ const e=[`init`,`plan`,`replan`,`implement`,`patch`,`rush`],t={init:n,plan:r,rep
|
|
|
125
137
|
- 当前计划不存在 → 拒绝执行,提示先创建计划。
|
|
126
138
|
- 当前计划状态为 \`未执行\` → 拒绝执行,提示先实施。
|
|
127
139
|
- 存在多个当前计划 → 拒绝执行,提示恢复单活跃状态。
|
|
140
|
+
- 补丁需求与当前计划完全无关 → 拒绝执行,提示先运行 \`agent-context done\` 归档后再创建新计划。
|
|
128
141
|
- 补丁不改变计划状态,完成后保持 \`已执行\`。
|
|
129
142
|
|
|
130
143
|
## 执行步骤
|
|
131
144
|
|
|
132
145
|
1. 阅读 \`plan.md\` 与已有 \`patch-{number}.md\`,了解上下文与历史,避免重复修复。
|
|
133
146
|
2. 根据描述执行补丁所需的代码变更。
|
|
134
|
-
3.
|
|
147
|
+
3. 完成验证:
|
|
148
|
+
- **IF** (编码任务) **THEN**:运行相关测试,以及必要的 Lint/Typecheck。
|
|
149
|
+
- **ELSE IF** (非编码任务,如纯文档修改) **THEN**:仅凭逻辑与排版审阅确认验收通过。
|
|
135
150
|
4. 创建 \`patch-{number}.md\`(编号:扫描当前计划目录已有补丁取 max+1),遵循下方模板。
|
|
136
151
|
5. 回写 \`plan.md\`:
|
|
137
152
|
- \`## 历史补丁\`:追加 \`- patch-{number}: {补丁名称}\`,按编号去重。
|
|
@@ -162,6 +177,7 @@ const e=[`init`,`plan`,`replan`,`implement`,`patch`,`rush`],t={init:n,plan:r,rep
|
|
|
162
177
|
|
|
163
178
|
- 运行 \`agent-context validate\`,不通过则中止并报告错误。
|
|
164
179
|
- 描述为空 → 拒绝执行。
|
|
180
|
+
- 描述仍存在范围边界、技术路径或验收标准歧义 → 拒绝执行,提示改用 \`plan\`。
|
|
165
181
|
- 存在未归档的已执行当前计划 → 判断新需求与当前计划的关联性:
|
|
166
182
|
- 相关联或用户本意是修补 → 拒绝执行,提示改用 patch。
|
|
167
183
|
- 完全无关 → 拒绝执行,提示先运行 \`agent-context done\` 归档后再创建新计划。
|
|
@@ -173,7 +189,7 @@ const e=[`init`,`plan`,`replan`,`implement`,`patch`,`rush`],t={init:n,plan:r,rep
|
|
|
173
189
|
|
|
174
190
|
### 阶段一:plan(差异)
|
|
175
191
|
|
|
176
|
-
-
|
|
192
|
+
- 仅在描述本身已足够明确时跳过「需求澄清」步骤;否则不得继续 rush。
|
|
177
193
|
- 强制单计划,不拆分,不进入 preparing 队列。
|
|
178
194
|
- 完成 plan 后**不等待用户确认**,直接进入阶段二。
|
|
179
195
|
|
package/dist/content/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import{ACTION_NAMES as e,ACTION_RENDERERS as t}from"./actions.js";function n(n){
|
|
|
6
6
|
## 执行纪律
|
|
7
7
|
|
|
8
8
|
- **协议先行**:匹配到动作后,必须先读取对应 \`actions/*.md\` 协议文件的完整内容,再逐步执行。禁止凭记忆、摘要或猜测跳过协议步骤。
|
|
9
|
-
- **前置检查必做**:所有动作(done
|
|
9
|
+
- **前置检查必做**:所有动作(done 除外)均包含「前置检查」,必须逐条执行,不可跳过。凡协议写明需运行 \`agent-context validate\` 时必须执行;\`init\` 在首次初始化且 \`.agent-context/\` 尚不存在时,先确认初始化场景成立,再按协议继续。
|
|
10
10
|
- **禁止直接改动**:在 plan / rush 创建计划之前,不得直接修改项目代码文件。任何代码变更必须在已创建计划(implement)或已创建补丁(patch)的上下文中进行。
|
|
11
11
|
- **顺序执行**:协议步骤必须按编号顺序逐项执行,不可跳步、合并或并行。
|
|
12
12
|
|
|
@@ -51,7 +51,7 @@ import{ACTION_NAMES as e,ACTION_RENDERERS as t}from"./actions.js";function n(n){
|
|
|
51
51
|
\`\`\`
|
|
52
52
|
|
|
53
53
|
编号规则:在当前 scope 内扫描全部 \`plan-N\` 目录取 \`max(N)+1\`。
|
|
54
|
-
`}function i(e){let t=[`---`,`name: ac-workflow`,`description: 管理 .agent-context 计划生命周期,按 init、plan、replan、implement、patch、rush、done 协议推进任务。`];return e.frontmatterProfile
|
|
54
|
+
`}function i(e){let t=[`---`,`name: ac-workflow`,`description: 管理 .agent-context 计划生命周期,按 init、plan、replan、implement、patch、rush、done 协议推进任务。`];return e.frontmatterProfile!==`copilot`&&t.push(`argument-hint: [request]`),e.frontmatterProfile===`copilot`&&t.push(`license: MIT`),t.push(`---`,``),`${t.join(`
|
|
55
55
|
`)}\n`}function a(){return`interface:
|
|
56
56
|
display_name: "Agent Context Workflow"
|
|
57
57
|
short_description: "统一管理 .agent-context 计划生命周期"
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{existsSync as e}from"node:fs";import{join as t,relative as n}from"node:path";import{readFile as r,writeFile as i}from"node:fs/promises";const a=/^#\s+(.+)$/m;async function o(e){let r=[];for(let t of e.done){let i=await s(t.dir),a=`./${n(e.root,t.dir)}/plan.md`;r.push(`- [x] [${i}](${a})`)}if(e.currentPlan){let t=await s(e.currentPlan.dir),i=`./${n(e.root,e.currentPlan.dir)}/plan.md`,a=e.currentPlan.status===`已执行`?`x`:` `;r.push(`- [${a}] [${t}](${i})`)}for(let t of e.preparing){let i=await s(t.dir),a=`./${n(e.root,t.dir)}/plan.md`;r.push(`- [ ] [${i}](${a})`)}let a=t(e.root,`index.md`);return await i(a,r.join(`
|
|
2
|
+
`)+`
|
|
3
|
+
`,`utf-8`),{path:a,entries:r.length}}async function s(n){let i=t(n,`plan.md`);return e(i)?(await r(i,`utf-8`)).match(a)?.[1]?.trim()??`plan-${n.split(`/`).pop()??`unknown`}`:`plan-${n.split(`/`).pop()??`unknown`}`}export{o as generateIndex};
|
package/dist/context/reader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveScope as e}from"./scope.js";import{existsSync as t}from"node:fs";import{join as n}from"node:path";import{readFile as r,readdir as i}from"node:fs/promises";const a=/^plan-(\d+)$/,o=/^plan-(\d+)(?:-\d{8})?$/,s=/^>\s*状态:\s*(未执行|已执行)$/m,c=/^>?[ \t]*状态[::].*$/m;async function l(r){let i=n(r,`.agent-context`);if(!t(i))return{snapshot:null,currentPlanCount:0};let a=await e(i),o=n(i,a),s=await
|
|
1
|
+
import{resolveScope as e}from"./scope.js";import{existsSync as t}from"node:fs";import{join as n}from"node:path";import{readFile as r,readdir as i}from"node:fs/promises";const a=/^plan-(\d+)$/,o=/^plan-(\d+)(?:-\d{8})?$/,s=/^>\s*状态:\s*(未执行|已执行)$/m,c=/^>?[ \t]*状态[::].*$/m;async function l(e){let{snapshot:t}=await u(e);return t}async function u(r){let i=n(r,`.agent-context`);if(!t(i))return{snapshot:null,currentPlanCount:0};let a=await e(i),o=n(i,a),s=await f(o),c=await f(n(o,`preparing`)),l=await p(n(o,`done`));return{snapshot:{root:o,scope:a,currentPlan:s[0]??null,preparing:c,done:l},currentPlanCount:s.length}}async function d(e){let i=n(e,`plan.md`);if(!t(i))return`未执行`;let a=await r(i,`utf-8`),o=a.match(s);return o?o[1]:c.test(a)?`未知`:`未执行`}async function f(e){if(!t(e))return[];let r=await i(e,{withFileTypes:!0}),o=[];for(let t of r){if(!t.isDirectory())continue;let r=t.name.match(a);if(!r?.[1])continue;let i=parseInt(r[1],10),s=n(e,t.name),c=await d(s);o.push({number:i,status:c,dir:s})}return o.sort((e,t)=>e.number-t.number)}async function p(e){if(!t(e))return[];let r=await i(e,{withFileTypes:!0}),a=[];for(let t of r){if(!t.isDirectory())continue;let r=t.name.match(o);r?.[1]&&a.push({number:parseInt(r[1],10),dir:n(e,t.name)})}return a.sort((e,t)=>e.number-t.number)}export{l as readContext,u as readRawContext};
|
package/dist/stats.html
CHANGED
|
@@ -4930,7 +4930,7 @@ var drawChart = (function (exports) {
|
|
|
4930
4930
|
</script>
|
|
4931
4931
|
<script>
|
|
4932
4932
|
/*<!--*/
|
|
4933
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"cli.d.ts","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/cli.d.ts","uid":"5218ad55-1"}]},{"name":"cli.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/cli.ts","uid":"5218ad55-3"}]},{"name":"commands/done.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/commands/done.ts","uid":"5218ad55-5"}]},{"name":"commands/init.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/commands/init.ts","uid":"5218ad55-7"}]},{"name":"commands/install.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/commands/install.ts","uid":"5218ad55-9"}]},{"name":"commands/printer.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/commands/printer.ts","uid":"5218ad55-11"}]},{"name":"commands/status.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/commands/status.ts","uid":"5218ad55-13"}]},{"name":"commands/sync.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/commands/sync.ts","uid":"5218ad55-15"}]},{"name":"commands/validate.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/commands/validate.ts","uid":"5218ad55-17"}]},{"name":"content/actions.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/content/actions.ts","uid":"5218ad55-19"}]},{"name":"content/index.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/content/index.ts","uid":"5218ad55-21"}]},{"name":"context/archiver.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/context/archiver.ts","uid":"5218ad55-23"}]},{"name":"context/reader.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/context/reader.ts","uid":"5218ad55-25"}]},{"name":"context/scope.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/context/scope.ts","uid":"5218ad55-27"}]},{"name":"context/validator.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/context/validator.ts","uid":"5218ad55-29"}]},{"name":"runner.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/runner.ts","uid":"5218ad55-31"}]},{"name":"tools.js","children":[{"name":"home/whj/codes/cat-kit/packages/agent-context/src/tools.ts","uid":"5218ad55-33"}]}],"isRoot":true},"nodeParts":{"5218ad55-1":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-0"},"5218ad55-3":{"renderedLength":1767,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-2"},"5218ad55-5":{"renderedLength":1349,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-4"},"5218ad55-7":{"renderedLength":718,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-6"},"5218ad55-9":{"renderedLength":985,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-8"},"5218ad55-11":{"renderedLength":909,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-10"},"5218ad55-13":{"renderedLength":993,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-12"},"5218ad55-15":{"renderedLength":745,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-14"},"5218ad55-17":{"renderedLength":813,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-16"},"5218ad55-19":{"renderedLength":9957,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-18"},"5218ad55-21":{"renderedLength":4203,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-20"},"5218ad55-23":{"renderedLength":1012,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-22"},"5218ad55-25":{"renderedLength":2173,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-24"},"5218ad55-27":{"renderedLength":1479,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-26"},"5218ad55-29":{"renderedLength":1905,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-28"},"5218ad55-31":{"renderedLength":2037,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-30"},"5218ad55-33":{"renderedLength":2174,"gzipLength":0,"brotliLength":0,"metaUid":"5218ad55-32"}},"nodeMetas":{"5218ad55-0":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/cli.d.ts","moduleParts":{"cli.d.ts":"5218ad55-1"},"imported":[],"importedBy":[],"isEntry":true},"5218ad55-2":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/cli.ts","moduleParts":{"cli.js":"5218ad55-3"},"imported":[{"uid":"5218ad55-34"},{"uid":"5218ad55-35"},{"uid":"5218ad55-4"},{"uid":"5218ad55-6"},{"uid":"5218ad55-8"},{"uid":"5218ad55-12"},{"uid":"5218ad55-14"},{"uid":"5218ad55-16"}],"importedBy":[],"isEntry":true},"5218ad55-4":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/commands/done.ts","moduleParts":{"commands/done.js":"5218ad55-5"},"imported":[{"uid":"5218ad55-36"},{"uid":"5218ad55-37"},{"uid":"5218ad55-38"}],"importedBy":[{"uid":"5218ad55-2"}]},"5218ad55-6":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/commands/init.ts","moduleParts":{"commands/init.js":"5218ad55-7"},"imported":[{"uid":"5218ad55-34"},{"uid":"5218ad55-39"},{"uid":"5218ad55-36"},{"uid":"5218ad55-37"},{"uid":"5218ad55-26"}],"importedBy":[{"uid":"5218ad55-2"}]},"5218ad55-8":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/commands/install.ts","moduleParts":{"commands/install.js":"5218ad55-9"},"imported":[{"uid":"5218ad55-37"},{"uid":"5218ad55-30"},{"uid":"5218ad55-32"},{"uid":"5218ad55-10"}],"importedBy":[{"uid":"5218ad55-2"}]},"5218ad55-10":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/commands/printer.ts","moduleParts":{"commands/printer.js":"5218ad55-11"},"imported":[{"uid":"5218ad55-36"}],"importedBy":[{"uid":"5218ad55-8"},{"uid":"5218ad55-14"}]},"5218ad55-12":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/commands/status.ts","moduleParts":{"commands/status.js":"5218ad55-13"},"imported":[{"uid":"5218ad55-38"}],"importedBy":[{"uid":"5218ad55-2"}]},"5218ad55-14":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/commands/sync.ts","moduleParts":{"commands/sync.js":"5218ad55-15"},"imported":[{"uid":"5218ad55-30"},{"uid":"5218ad55-32"},{"uid":"5218ad55-10"}],"importedBy":[{"uid":"5218ad55-2"}]},"5218ad55-16":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/commands/validate.ts","moduleParts":{"commands/validate.js":"5218ad55-17"},"imported":[{"uid":"5218ad55-38"}],"importedBy":[{"uid":"5218ad55-2"}]},"5218ad55-18":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/content/actions.ts","moduleParts":{"content/actions.js":"5218ad55-19"},"imported":[],"importedBy":[{"uid":"5218ad55-20"}]},"5218ad55-20":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/content/index.ts","moduleParts":{"content/index.js":"5218ad55-21"},"imported":[{"uid":"5218ad55-18"}],"importedBy":[{"uid":"5218ad55-30"}]},"5218ad55-22":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/context/archiver.ts","moduleParts":{"context/archiver.js":"5218ad55-23"},"imported":[{"uid":"5218ad55-39"},{"uid":"5218ad55-36"}],"importedBy":[{"uid":"5218ad55-38"}]},"5218ad55-24":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/context/reader.ts","moduleParts":{"context/reader.js":"5218ad55-25"},"imported":[{"uid":"5218ad55-34"},{"uid":"5218ad55-39"},{"uid":"5218ad55-36"},{"uid":"5218ad55-26"}],"importedBy":[{"uid":"5218ad55-38"}]},"5218ad55-26":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/context/scope.ts","moduleParts":{"context/scope.js":"5218ad55-27"},"imported":[{"uid":"5218ad55-34"},{"uid":"5218ad55-39"},{"uid":"5218ad55-36"},{"uid":"5218ad55-40"}],"importedBy":[{"uid":"5218ad55-6"},{"uid":"5218ad55-38"},{"uid":"5218ad55-24"}]},"5218ad55-28":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/context/validator.ts","moduleParts":{"context/validator.js":"5218ad55-29"},"imported":[{"uid":"5218ad55-34"},{"uid":"5218ad55-36"}],"importedBy":[{"uid":"5218ad55-38"}]},"5218ad55-30":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/runner.ts","moduleParts":{"runner.js":"5218ad55-31"},"imported":[{"uid":"5218ad55-34"},{"uid":"5218ad55-39"},{"uid":"5218ad55-36"},{"uid":"5218ad55-20"},{"uid":"5218ad55-32"}],"importedBy":[{"uid":"5218ad55-8"},{"uid":"5218ad55-14"}]},"5218ad55-32":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/tools.ts","moduleParts":{"tools.js":"5218ad55-33"},"imported":[{"uid":"5218ad55-34"},{"uid":"5218ad55-36"}],"importedBy":[{"uid":"5218ad55-8"},{"uid":"5218ad55-14"},{"uid":"5218ad55-30"}]},"5218ad55-34":{"id":"node:fs","moduleParts":{},"imported":[],"importedBy":[{"uid":"5218ad55-2"},{"uid":"5218ad55-6"},{"uid":"5218ad55-26"},{"uid":"5218ad55-30"},{"uid":"5218ad55-32"},{"uid":"5218ad55-24"},{"uid":"5218ad55-28"}]},"5218ad55-35":{"id":"commander","moduleParts":{},"imported":[],"importedBy":[{"uid":"5218ad55-2"}]},"5218ad55-36":{"id":"node:path","moduleParts":{},"imported":[],"importedBy":[{"uid":"5218ad55-4"},{"uid":"5218ad55-6"},{"uid":"5218ad55-26"},{"uid":"5218ad55-30"},{"uid":"5218ad55-32"},{"uid":"5218ad55-10"},{"uid":"5218ad55-24"},{"uid":"5218ad55-28"},{"uid":"5218ad55-22"}]},"5218ad55-37":{"id":"@inquirer/prompts","moduleParts":{},"imported":[],"importedBy":[{"uid":"5218ad55-4"},{"uid":"5218ad55-6"},{"uid":"5218ad55-8"}]},"5218ad55-38":{"id":"/home/whj/codes/cat-kit/packages/agent-context/src/context/index.ts","moduleParts":{},"imported":[{"uid":"5218ad55-24"},{"uid":"5218ad55-28"},{"uid":"5218ad55-22"},{"uid":"5218ad55-26"}],"importedBy":[{"uid":"5218ad55-4"},{"uid":"5218ad55-12"},{"uid":"5218ad55-16"}]},"5218ad55-39":{"id":"node:fs/promises","moduleParts":{},"imported":[],"importedBy":[{"uid":"5218ad55-6"},{"uid":"5218ad55-26"},{"uid":"5218ad55-30"},{"uid":"5218ad55-24"},{"uid":"5218ad55-22"}]},"5218ad55-40":{"id":"node:child_process","moduleParts":{},"imported":[],"importedBy":[{"uid":"5218ad55-26"}]}},"env":{"rollup":"4.23.0"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
|
|
4933
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"cli.d.ts","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/cli.d.ts","uid":"e9c35142-1"}]},{"name":"cli.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/cli.ts","uid":"e9c35142-3"}]},{"name":"commands/done.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/done.ts","uid":"e9c35142-5"}]},{"name":"commands/index-cmd.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/index-cmd.ts","uid":"e9c35142-7"}]},{"name":"commands/init.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/init.ts","uid":"e9c35142-9"}]},{"name":"commands/install.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/install.ts","uid":"e9c35142-11"}]},{"name":"commands/printer.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/printer.ts","uid":"e9c35142-13"}]},{"name":"commands/status.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/status.ts","uid":"e9c35142-15"}]},{"name":"commands/sync.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/sync.ts","uid":"e9c35142-17"}]},{"name":"commands/validate.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/validate.ts","uid":"e9c35142-19"}]},{"name":"content/actions.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/content/actions.ts","uid":"e9c35142-21"}]},{"name":"content/index.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/content/index.ts","uid":"e9c35142-23"}]},{"name":"context/archiver.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/context/archiver.ts","uid":"e9c35142-25"}]},{"name":"context/indexer.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/context/indexer.ts","uid":"e9c35142-27"}]},{"name":"context/reader.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/context/reader.ts","uid":"e9c35142-29"}]},{"name":"context/scope.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/context/scope.ts","uid":"e9c35142-31"}]},{"name":"context/validator.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/context/validator.ts","uid":"e9c35142-33"}]},{"name":"runner.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/runner.ts","uid":"e9c35142-35"}]},{"name":"tools.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/tools.ts","uid":"e9c35142-37"}]}],"isRoot":true},"nodeParts":{"e9c35142-1":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-0"},"e9c35142-3":{"renderedLength":1891,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-2"},"e9c35142-5":{"renderedLength":1508,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-4"},"e9c35142-7":{"renderedLength":629,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-6"},"e9c35142-9":{"renderedLength":718,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-8"},"e9c35142-11":{"renderedLength":1005,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-10"},"e9c35142-13":{"renderedLength":909,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-12"},"e9c35142-15":{"renderedLength":993,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-14"},"e9c35142-17":{"renderedLength":765,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-16"},"e9c35142-19":{"renderedLength":813,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-18"},"e9c35142-21":{"renderedLength":11445,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-20"},"e9c35142-23":{"renderedLength":4355,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-22"},"e9c35142-25":{"renderedLength":1012,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-24"},"e9c35142-27":{"renderedLength":1274,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-26"},"e9c35142-29":{"renderedLength":2276,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-28"},"e9c35142-31":{"renderedLength":1479,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-30"},"e9c35142-33":{"renderedLength":1905,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-32"},"e9c35142-35":{"renderedLength":2037,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-34"},"e9c35142-37":{"renderedLength":2509,"gzipLength":0,"brotliLength":0,"metaUid":"e9c35142-36"}},"nodeMetas":{"e9c35142-0":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/cli.d.ts","moduleParts":{"cli.d.ts":"e9c35142-1"},"imported":[],"importedBy":[],"isEntry":true},"e9c35142-2":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/cli.ts","moduleParts":{"cli.js":"e9c35142-3"},"imported":[{"uid":"e9c35142-38"},{"uid":"e9c35142-39"},{"uid":"e9c35142-4"},{"uid":"e9c35142-6"},{"uid":"e9c35142-8"},{"uid":"e9c35142-10"},{"uid":"e9c35142-14"},{"uid":"e9c35142-16"},{"uid":"e9c35142-18"}],"importedBy":[],"isEntry":true},"e9c35142-4":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/done.ts","moduleParts":{"commands/done.js":"e9c35142-5"},"imported":[{"uid":"e9c35142-40"},{"uid":"e9c35142-41"},{"uid":"e9c35142-42"}],"importedBy":[{"uid":"e9c35142-2"}]},"e9c35142-6":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/index-cmd.ts","moduleParts":{"commands/index-cmd.js":"e9c35142-7"},"imported":[{"uid":"e9c35142-40"},{"uid":"e9c35142-42"}],"importedBy":[{"uid":"e9c35142-2"}]},"e9c35142-8":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/init.ts","moduleParts":{"commands/init.js":"e9c35142-9"},"imported":[{"uid":"e9c35142-38"},{"uid":"e9c35142-43"},{"uid":"e9c35142-40"},{"uid":"e9c35142-41"},{"uid":"e9c35142-30"}],"importedBy":[{"uid":"e9c35142-2"}]},"e9c35142-10":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/install.ts","moduleParts":{"commands/install.js":"e9c35142-11"},"imported":[{"uid":"e9c35142-41"},{"uid":"e9c35142-34"},{"uid":"e9c35142-36"},{"uid":"e9c35142-12"}],"importedBy":[{"uid":"e9c35142-2"}]},"e9c35142-12":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/printer.ts","moduleParts":{"commands/printer.js":"e9c35142-13"},"imported":[{"uid":"e9c35142-40"}],"importedBy":[{"uid":"e9c35142-10"},{"uid":"e9c35142-16"}]},"e9c35142-14":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/status.ts","moduleParts":{"commands/status.js":"e9c35142-15"},"imported":[{"uid":"e9c35142-42"}],"importedBy":[{"uid":"e9c35142-2"}]},"e9c35142-16":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/sync.ts","moduleParts":{"commands/sync.js":"e9c35142-17"},"imported":[{"uid":"e9c35142-34"},{"uid":"e9c35142-36"},{"uid":"e9c35142-12"}],"importedBy":[{"uid":"e9c35142-2"}]},"e9c35142-18":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/validate.ts","moduleParts":{"commands/validate.js":"e9c35142-19"},"imported":[{"uid":"e9c35142-42"}],"importedBy":[{"uid":"e9c35142-2"}]},"e9c35142-20":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/content/actions.ts","moduleParts":{"content/actions.js":"e9c35142-21"},"imported":[],"importedBy":[{"uid":"e9c35142-22"}]},"e9c35142-22":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/content/index.ts","moduleParts":{"content/index.js":"e9c35142-23"},"imported":[{"uid":"e9c35142-20"}],"importedBy":[{"uid":"e9c35142-34"}]},"e9c35142-24":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/context/archiver.ts","moduleParts":{"context/archiver.js":"e9c35142-25"},"imported":[{"uid":"e9c35142-43"},{"uid":"e9c35142-40"}],"importedBy":[{"uid":"e9c35142-42"}]},"e9c35142-26":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/context/indexer.ts","moduleParts":{"context/indexer.js":"e9c35142-27"},"imported":[{"uid":"e9c35142-38"},{"uid":"e9c35142-43"},{"uid":"e9c35142-40"}],"importedBy":[{"uid":"e9c35142-42"}]},"e9c35142-28":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/context/reader.ts","moduleParts":{"context/reader.js":"e9c35142-29"},"imported":[{"uid":"e9c35142-38"},{"uid":"e9c35142-43"},{"uid":"e9c35142-40"},{"uid":"e9c35142-30"}],"importedBy":[{"uid":"e9c35142-42"}]},"e9c35142-30":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/context/scope.ts","moduleParts":{"context/scope.js":"e9c35142-31"},"imported":[{"uid":"e9c35142-44"},{"uid":"e9c35142-38"},{"uid":"e9c35142-43"},{"uid":"e9c35142-40"}],"importedBy":[{"uid":"e9c35142-8"},{"uid":"e9c35142-42"},{"uid":"e9c35142-28"}]},"e9c35142-32":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/context/validator.ts","moduleParts":{"context/validator.js":"e9c35142-33"},"imported":[{"uid":"e9c35142-38"},{"uid":"e9c35142-40"}],"importedBy":[{"uid":"e9c35142-42"}]},"e9c35142-34":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/runner.ts","moduleParts":{"runner.js":"e9c35142-35"},"imported":[{"uid":"e9c35142-38"},{"uid":"e9c35142-43"},{"uid":"e9c35142-40"},{"uid":"e9c35142-22"},{"uid":"e9c35142-36"}],"importedBy":[{"uid":"e9c35142-10"},{"uid":"e9c35142-16"}]},"e9c35142-36":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/tools.ts","moduleParts":{"tools.js":"e9c35142-37"},"imported":[{"uid":"e9c35142-38"},{"uid":"e9c35142-40"}],"importedBy":[{"uid":"e9c35142-10"},{"uid":"e9c35142-16"},{"uid":"e9c35142-34"}]},"e9c35142-38":{"id":"node:fs","moduleParts":{},"imported":[],"importedBy":[{"uid":"e9c35142-2"},{"uid":"e9c35142-8"},{"uid":"e9c35142-30"},{"uid":"e9c35142-34"},{"uid":"e9c35142-36"},{"uid":"e9c35142-28"},{"uid":"e9c35142-32"},{"uid":"e9c35142-26"}]},"e9c35142-39":{"id":"commander","moduleParts":{},"imported":[],"importedBy":[{"uid":"e9c35142-2"}]},"e9c35142-40":{"id":"node:path","moduleParts":{},"imported":[],"importedBy":[{"uid":"e9c35142-4"},{"uid":"e9c35142-6"},{"uid":"e9c35142-8"},{"uid":"e9c35142-30"},{"uid":"e9c35142-34"},{"uid":"e9c35142-36"},{"uid":"e9c35142-12"},{"uid":"e9c35142-28"},{"uid":"e9c35142-32"},{"uid":"e9c35142-24"},{"uid":"e9c35142-26"}]},"e9c35142-41":{"id":"@inquirer/prompts","moduleParts":{},"imported":[],"importedBy":[{"uid":"e9c35142-4"},{"uid":"e9c35142-8"},{"uid":"e9c35142-10"}]},"e9c35142-42":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/context/index.ts","moduleParts":{},"imported":[{"uid":"e9c35142-28"},{"uid":"e9c35142-32"},{"uid":"e9c35142-24"},{"uid":"e9c35142-26"},{"uid":"e9c35142-30"}],"importedBy":[{"uid":"e9c35142-4"},{"uid":"e9c35142-6"},{"uid":"e9c35142-14"},{"uid":"e9c35142-18"}]},"e9c35142-43":{"id":"node:fs/promises","moduleParts":{},"imported":[],"importedBy":[{"uid":"e9c35142-8"},{"uid":"e9c35142-30"},{"uid":"e9c35142-34"},{"uid":"e9c35142-28"},{"uid":"e9c35142-24"},{"uid":"e9c35142-26"}]},"e9c35142-44":{"id":"node:child_process","moduleParts":{},"imported":[],"importedBy":[{"uid":"e9c35142-30"}]}},"env":{"rollup":"4.23.0"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
|
|
4934
4934
|
|
|
4935
4935
|
const run = () => {
|
|
4936
4936
|
const width = window.innerWidth;
|
package/dist/tools.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as e}from"node:fs";import{resolve as t}from"node:path";const n={claude:{id:`claude`,name:`Claude Code`,skillRootDir:`.claude/skills`,frontmatterProfile:`claude`,metadataFiles:[]},codex:{id:`codex`,name:`Codex`,skillRootDir:`.codex/skills`,frontmatterProfile:`standard`,metadataFiles:[`openai`]},cursor:{id:`cursor`,name:`Cursor`,skillRootDir:`.cursor/skills`,frontmatterProfile:`standard`,metadataFiles:[]},antigravity:{id:`antigravity`,name:`Antigravity`,skillRootDir:`.agent/skills`,frontmatterProfile:`standard`,metadataFiles:[]},copilot:{id:`copilot`,name:`GitHub Copilot`,skillRootDir:`.github/skills`,frontmatterProfile:`copilot`,metadataFiles:[]}},r=[`claude`,`codex`,`
|
|
1
|
+
import{existsSync as e}from"node:fs";import{resolve as t}from"node:path";const n={claude:{id:`claude`,name:`Claude Code`,skillRootDir:`.claude/skills`,frontmatterProfile:`claude`,metadataFiles:[]},codex:{id:`codex`,name:`Codex`,skillRootDir:`.codex/skills`,frontmatterProfile:`standard`,metadataFiles:[`openai`]},cursor:{id:`cursor`,name:`Cursor`,skillRootDir:`.cursor/skills`,frontmatterProfile:`standard`,metadataFiles:[]},antigravity:{id:`antigravity`,name:`Antigravity`,skillRootDir:`.agent/skills`,frontmatterProfile:`standard`,metadataFiles:[]},agents:{id:`agents`,name:`Agent Skills(开放标准 · .agents)`,skillRootDir:`.agents/skills`,frontmatterProfile:`standard`,metadataFiles:[]},gemini:{id:`gemini`,name:`Gemini CLI`,skillRootDir:`.gemini/skills`,frontmatterProfile:`standard`,metadataFiles:[]},copilot:{id:`copilot`,name:`GitHub Copilot`,skillRootDir:`.github/skills`,frontmatterProfile:`copilot`,metadataFiles:[]}},r=[`agents`,`cursor`,`claude`,`codex`,`antigravity`,`gemini`,`copilot`];function i(){return r.map(e=>({id:e,name:n[e].name}))}function a(e){let t=e.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean);if(t.length===0)return[...r];let n=[];for(let e of t){if(!l(e))throw Error(`不支持的工具标识: ${e}。可选值: ${r.join(`, `)}`);n.includes(e)||n.push(e)}return n}function o(e){return(e&&e.length>0?e:r).map(e=>({...n[e]}))}function s(t){return r.filter(r=>{let i=n[r];return e(c(i,t).skillFile)})}function c(e,n){let r=t(n,e.skillRootDir,`ac-workflow`);return{skillDir:r,skillFile:t(r,`SKILL.md`),openaiMetadataFile:t(r,`agents/openai.yaml`)}}function l(e){return Object.hasOwn(n,e)}export{r as DEFAULT_TOOL_ORDER,s as detectConfiguredToolIds,i as getToolChoices,a as parseToolIds,c as resolveSkillPaths,o as resolveToolTargets};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cat-kit/agent-context",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "代理上下文管理工具",
|
|
5
5
|
"bin": {
|
|
6
6
|
"agent-context": "./dist/cli.js"
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
],
|
|
13
13
|
"type": "module",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@inquirer/prompts": "^8.3.
|
|
15
|
+
"@inquirer/prompts": "^8.3.2",
|
|
16
16
|
"commander": "^14.0.3"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@cat-kit/tsconfig": "
|
|
19
|
+
"@cat-kit/tsconfig": "2.0.0",
|
|
20
20
|
"@types/node": "^24.12.0"
|
|
21
21
|
}
|
|
22
22
|
}
|
package/src/cli.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { readFileSync } from 'node:fs'
|
|
|
5
5
|
import { Command } from 'commander'
|
|
6
6
|
|
|
7
7
|
import { doneCommand } from './commands/done.js'
|
|
8
|
+
import { indexCommand } from './commands/index-cmd.js'
|
|
8
9
|
import { initCommand } from './commands/init.js'
|
|
9
10
|
import { installCommand } from './commands/install.js'
|
|
10
11
|
import { statusCommand } from './commands/status.js'
|
|
@@ -23,7 +24,10 @@ program.name('agent-context').description('Agent Context Skills 安装工具').v
|
|
|
23
24
|
program
|
|
24
25
|
.command('install')
|
|
25
26
|
.description('安装 ac-workflow Skill')
|
|
26
|
-
.option(
|
|
27
|
+
.option(
|
|
28
|
+
'--tools <tools>',
|
|
29
|
+
'指定目标工具,逗号分隔:claude,codex,cursor,antigravity,agents,gemini,copilot'
|
|
30
|
+
)
|
|
27
31
|
.option('--yes', '非交互模式:优先复用已安装工具,否则安装全部工具')
|
|
28
32
|
.option('--check', '仅检查是否存在待更新内容,不写入文件')
|
|
29
33
|
.action(installCommand)
|
|
@@ -31,7 +35,10 @@ program
|
|
|
31
35
|
program
|
|
32
36
|
.command('sync')
|
|
33
37
|
.description('同步已安装的 ac-workflow Skill')
|
|
34
|
-
.option(
|
|
38
|
+
.option(
|
|
39
|
+
'--tools <tools>',
|
|
40
|
+
'指定目标工具,逗号分隔:claude,codex,cursor,antigravity,agents,gemini,copilot'
|
|
41
|
+
)
|
|
35
42
|
.option('--check', '仅检查是否存在待更新内容,不写入文件')
|
|
36
43
|
.action(syncCommand)
|
|
37
44
|
|
|
@@ -52,6 +59,8 @@ program
|
|
|
52
59
|
.option('--yes', '跳过确认,直接归档')
|
|
53
60
|
.action(doneCommand)
|
|
54
61
|
|
|
62
|
+
program.command('index').description('生成或更新计划索引文件').action(indexCommand)
|
|
63
|
+
|
|
55
64
|
program.parseAsync().catch((error: unknown) => {
|
|
56
65
|
const message = error instanceof Error ? error.message : String(error)
|
|
57
66
|
console.error(`\n❌ ${message}`) // eslint-disable-line no-console
|
package/src/commands/done.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { basename } from 'node:path'
|
|
|
2
2
|
|
|
3
3
|
import { confirm } from '@inquirer/prompts'
|
|
4
4
|
|
|
5
|
-
import { archive, readRawContext, validate } from '../context/index.js'
|
|
5
|
+
import { archive, generateIndex, readContext, readRawContext, validate } from '../context/index.js'
|
|
6
6
|
|
|
7
7
|
export async function doneCommand(options: { yes?: boolean }): Promise<void> {
|
|
8
8
|
const { snapshot, currentPlanCount } = await readRawContext(process.cwd())
|
|
@@ -50,4 +50,10 @@ export async function doneCommand(options: { yes?: boolean }): Promise<void> {
|
|
|
50
50
|
} else if (archiveResult.promoted === null) {
|
|
51
51
|
console.log('ℹ 无更多待执行计划') // eslint-disable-line no-console
|
|
52
52
|
}
|
|
53
|
+
|
|
54
|
+
const freshSnapshot = await readContext(process.cwd())
|
|
55
|
+
if (freshSnapshot) {
|
|
56
|
+
await generateIndex(freshSnapshot)
|
|
57
|
+
console.log('📇 已更新索引') // eslint-disable-line no-console
|
|
58
|
+
}
|
|
53
59
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { relative } from 'node:path'
|
|
2
|
+
|
|
3
|
+
import { readRawContext, validate, generateIndex } from '../context/index.js'
|
|
4
|
+
|
|
5
|
+
export async function indexCommand(): Promise<void> {
|
|
6
|
+
const cwd = process.cwd()
|
|
7
|
+
const { snapshot, currentPlanCount } = await readRawContext(cwd)
|
|
8
|
+
const result = validate(snapshot, currentPlanCount)
|
|
9
|
+
|
|
10
|
+
if (!result.valid) {
|
|
11
|
+
for (const error of result.errors) {
|
|
12
|
+
console.log(`❌ ${error}`) // eslint-disable-line no-console
|
|
13
|
+
}
|
|
14
|
+
process.exitCode = 1
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!snapshot) {
|
|
19
|
+
console.log('❌ 未找到 .agent-context 目录') // eslint-disable-line no-console
|
|
20
|
+
process.exitCode = 1
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const indexResult = await generateIndex(snapshot)
|
|
25
|
+
console.log(`✅ 已生成索引: ${relative(cwd, indexResult.path)}(${indexResult.entries} 个计划)`) // eslint-disable-line no-console
|
|
26
|
+
}
|
package/src/commands/install.ts
CHANGED
|
@@ -20,7 +20,7 @@ export async function installCommand(options: InstallCommandOptions = {}): Promi
|
|
|
20
20
|
const cwd = process.cwd()
|
|
21
21
|
const tools = await resolveTools(cwd, options)
|
|
22
22
|
const check = options.check ?? false
|
|
23
|
-
const result = await runInstall({ cwd,
|
|
23
|
+
const result = await runInstall({ cwd, check, ...(tools ? { tools } : {}) })
|
|
24
24
|
|
|
25
25
|
if (check) {
|
|
26
26
|
printCheckResult(result, cwd)
|
package/src/commands/sync.ts
CHANGED
|
@@ -12,7 +12,7 @@ export async function syncCommand(options: SyncCommandOptions = {}): Promise<voi
|
|
|
12
12
|
const cwd = process.cwd()
|
|
13
13
|
const tools = resolveTools(cwd, options.tools)
|
|
14
14
|
const check = options.check ?? false
|
|
15
|
-
const result = await runSync({ cwd,
|
|
15
|
+
const result = await runSync({ cwd, check, ...(tools ? { tools } : {}) })
|
|
16
16
|
|
|
17
17
|
if (check) {
|
|
18
18
|
printCheckResult(result, cwd)
|
package/src/content/actions.ts
CHANGED
|
@@ -17,6 +17,13 @@ function renderInit(): string {
|
|
|
17
17
|
|
|
18
18
|
可附带描述参数,用于补充项目背景、技术栈、特殊约束。
|
|
19
19
|
|
|
20
|
+
## 前置检查
|
|
21
|
+
|
|
22
|
+
- 若已存在 \`.agent-context/\`:运行 \`agent-context validate\`,不通过则中止并报告错误。
|
|
23
|
+
- 若 \`.agent-context/\` 不存在:确认这是首次初始化场景;若目录残缺或状态异常,向用户报告,不可继续假设。
|
|
24
|
+
- 新项目缺少关键决策信息时,必须主动提问或确认,不可直接生成 \`AGENTS.md\` 或进入 plan。
|
|
25
|
+
- 遇到阻塞问题应向用户报告,不可静默跳过。
|
|
26
|
+
|
|
20
27
|
## 执行步骤
|
|
21
28
|
|
|
22
29
|
1. **判断项目类型**:检测根目录是否存在有效代码文件和目录结构。
|
|
@@ -26,11 +33,16 @@ function renderInit(): string {
|
|
|
26
33
|
|
|
27
34
|
2. **处理 AGENTS.md**:
|
|
28
35
|
- 新项目:
|
|
29
|
-
1.
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
1. 先收集或确认以下信息,其中前两类属于**必须主动确认**的决策项,即使描述已部分涵盖也不能整体跳过;可基于描述用确认式问题补问,而不是完全重问。
|
|
37
|
+
- 必须主动确认:技术栈与版本(语言、运行时、框架、构建/测试工具等)
|
|
38
|
+
- 必须主动确认:架构偏好(目录结构、分层模式、关键框架或方案选型)
|
|
39
|
+
- 可基于描述补充:项目目标与核心功能
|
|
40
|
+
- 可基于描述补充:代码规范与工具链细节(lint、formatter、测试约定等)
|
|
41
|
+
2. 对高价值决策类问题必须在计划前澄清,例如:是否使用 monorepo、前后端如何拆分、采用哪个框架与测试工具。
|
|
42
|
+
3. 生成高质量 \`AGENTS.md\`(须满足下方质量标准,不满足则重新优化直至满足)。
|
|
43
|
+
4. 继续执行 plan 创建初始计划。
|
|
32
44
|
- 旧项目:
|
|
33
|
-
1. 若不存在 \`AGENTS.md
|
|
45
|
+
1. 若不存在 \`AGENTS.md\`:优先通过代码与配置读取收集信息;仅对无法可靠判断的内容提问后生成。
|
|
34
46
|
2. 若已存在 \`AGENTS.md\`:按质量标准评估,不足时增补优化。
|
|
35
47
|
3. 默认不创建计划(除非用户明确要求)。
|
|
36
48
|
|
|
@@ -185,13 +197,16 @@ function renderPatch(): string {
|
|
|
185
197
|
- 当前计划不存在 → 拒绝执行,提示先创建计划。
|
|
186
198
|
- 当前计划状态为 \`未执行\` → 拒绝执行,提示先实施。
|
|
187
199
|
- 存在多个当前计划 → 拒绝执行,提示恢复单活跃状态。
|
|
200
|
+
- 补丁需求与当前计划完全无关 → 拒绝执行,提示先运行 \`agent-context done\` 归档后再创建新计划。
|
|
188
201
|
- 补丁不改变计划状态,完成后保持 \`已执行\`。
|
|
189
202
|
|
|
190
203
|
## 执行步骤
|
|
191
204
|
|
|
192
205
|
1. 阅读 \`plan.md\` 与已有 \`patch-{number}.md\`,了解上下文与历史,避免重复修复。
|
|
193
206
|
2. 根据描述执行补丁所需的代码变更。
|
|
194
|
-
3.
|
|
207
|
+
3. 完成验证:
|
|
208
|
+
- **IF** (编码任务) **THEN**:运行相关测试,以及必要的 Lint/Typecheck。
|
|
209
|
+
- **ELSE IF** (非编码任务,如纯文档修改) **THEN**:仅凭逻辑与排版审阅确认验收通过。
|
|
195
210
|
4. 创建 \`patch-{number}.md\`(编号:扫描当前计划目录已有补丁取 max+1),遵循下方模板。
|
|
196
211
|
5. 回写 \`plan.md\`:
|
|
197
212
|
- \`## 历史补丁\`:追加 \`- patch-{number}: {补丁名称}\`,按编号去重。
|
|
@@ -226,6 +241,7 @@ function renderRush(): string {
|
|
|
226
241
|
|
|
227
242
|
- 运行 \`agent-context validate\`,不通过则中止并报告错误。
|
|
228
243
|
- 描述为空 → 拒绝执行。
|
|
244
|
+
- 描述仍存在范围边界、技术路径或验收标准歧义 → 拒绝执行,提示改用 \`plan\`。
|
|
229
245
|
- 存在未归档的已执行当前计划 → 判断新需求与当前计划的关联性:
|
|
230
246
|
- 相关联或用户本意是修补 → 拒绝执行,提示改用 patch。
|
|
231
247
|
- 完全无关 → 拒绝执行,提示先运行 \`agent-context done\` 归档后再创建新计划。
|
|
@@ -237,7 +253,7 @@ function renderRush(): string {
|
|
|
237
253
|
|
|
238
254
|
### 阶段一:plan(差异)
|
|
239
255
|
|
|
240
|
-
-
|
|
256
|
+
- 仅在描述本身已足够明确时跳过「需求澄清」步骤;否则不得继续 rush。
|
|
241
257
|
- 强制单计划,不拆分,不进入 preparing 队列。
|
|
242
258
|
- 完成 plan 后**不等待用户确认**,直接进入阶段二。
|
|
243
259
|
|
package/src/content/index.ts
CHANGED
|
@@ -32,7 +32,7 @@ function renderNavigator(target: ToolTarget): string {
|
|
|
32
32
|
## 执行纪律
|
|
33
33
|
|
|
34
34
|
- **协议先行**:匹配到动作后,必须先读取对应 \`actions/*.md\` 协议文件的完整内容,再逐步执行。禁止凭记忆、摘要或猜测跳过协议步骤。
|
|
35
|
-
- **前置检查必做**:所有动作(done
|
|
35
|
+
- **前置检查必做**:所有动作(done 除外)均包含「前置检查」,必须逐条执行,不可跳过。凡协议写明需运行 \`agent-context validate\` 时必须执行;\`init\` 在首次初始化且 \`.agent-context/\` 尚不存在时,先确认初始化场景成立,再按协议继续。
|
|
36
36
|
- **禁止直接改动**:在 plan / rush 创建计划之前,不得直接修改项目代码文件。任何代码变更必须在已创建计划(implement)或已创建补丁(patch)的上下文中进行。
|
|
37
37
|
- **顺序执行**:协议步骤必须按编号顺序逐项执行,不可跳步、合并或并行。
|
|
38
38
|
|
|
@@ -85,7 +85,7 @@ function renderNavigator(target: ToolTarget): string {
|
|
|
85
85
|
function renderFrontmatter(target: ToolTarget): string {
|
|
86
86
|
const lines = ['---', `name: ${SKILL_NAME}`, `description: ${SKILL_DESCRIPTION}`]
|
|
87
87
|
|
|
88
|
-
if (target.frontmatterProfile
|
|
88
|
+
if (target.frontmatterProfile !== 'copilot') {
|
|
89
89
|
lines.push('argument-hint: [request]')
|
|
90
90
|
}
|
|
91
91
|
|
package/src/context/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { readContext, readRawContext, readPlanStatus } from './reader.js'
|
|
2
2
|
export { validate } from './validator.js'
|
|
3
3
|
export { archive } from './archiver.js'
|
|
4
|
+
export { generateIndex } from './indexer.js'
|
|
4
5
|
export { resolveScope, initScope, normalizeScope } from './scope.js'
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs'
|
|
2
|
+
import { readFile, writeFile } from 'node:fs/promises'
|
|
3
|
+
import { join, relative } from 'node:path'
|
|
4
|
+
|
|
5
|
+
import type { ContextSnapshot } from '../types.js'
|
|
6
|
+
|
|
7
|
+
const H1_RE = /^#\s+(.+)$/m
|
|
8
|
+
|
|
9
|
+
export interface IndexResult {
|
|
10
|
+
path: string
|
|
11
|
+
entries: number
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function generateIndex(context: ContextSnapshot): Promise<IndexResult> {
|
|
15
|
+
const lines: string[] = []
|
|
16
|
+
|
|
17
|
+
for (const plan of context.done) {
|
|
18
|
+
const title = await extractTitle(plan.dir)
|
|
19
|
+
const rel = `./${relative(context.root, plan.dir)}/plan.md`
|
|
20
|
+
lines.push(`- [x] [${title}](${rel})`)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (context.currentPlan) {
|
|
24
|
+
const title = await extractTitle(context.currentPlan.dir)
|
|
25
|
+
const rel = `./${relative(context.root, context.currentPlan.dir)}/plan.md`
|
|
26
|
+
const check = context.currentPlan.status === '已执行' ? 'x' : ' '
|
|
27
|
+
lines.push(`- [${check}] [${title}](${rel})`)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
for (const plan of context.preparing) {
|
|
31
|
+
const title = await extractTitle(plan.dir)
|
|
32
|
+
const rel = `./${relative(context.root, plan.dir)}/plan.md`
|
|
33
|
+
lines.push(`- [ ] [${title}](${rel})`)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const indexPath = join(context.root, 'index.md')
|
|
37
|
+
await writeFile(indexPath, lines.join('\n') + '\n', 'utf-8')
|
|
38
|
+
|
|
39
|
+
return { path: indexPath, entries: lines.length }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function extractTitle(planDir: string): Promise<string> {
|
|
43
|
+
const planFile = join(planDir, 'plan.md')
|
|
44
|
+
|
|
45
|
+
if (!existsSync(planFile)) {
|
|
46
|
+
return `plan-${planDir.split('/').pop() ?? 'unknown'}`
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const content = await readFile(planFile, 'utf-8')
|
|
50
|
+
const match = content.match(H1_RE)
|
|
51
|
+
return match?.[1]?.trim() ?? `plan-${planDir.split('/').pop() ?? 'unknown'}`
|
|
52
|
+
}
|
package/src/context/scope.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process'
|
|
1
2
|
import { existsSync } from 'node:fs'
|
|
2
3
|
import { readFile, writeFile, mkdir } from 'node:fs/promises'
|
|
3
4
|
import { join } from 'node:path'
|
|
4
|
-
import { execSync } from 'node:child_process'
|
|
5
5
|
|
|
6
6
|
export async function resolveScope(acRoot: string): Promise<string> {
|
|
7
7
|
const envPath = join(acRoot, '.env')
|
package/src/tools.ts
CHANGED
|
@@ -35,6 +35,20 @@ const TOOL_TARGET_MAP: Record<ToolId, ToolTarget> = {
|
|
|
35
35
|
frontmatterProfile: 'standard',
|
|
36
36
|
metadataFiles: []
|
|
37
37
|
},
|
|
38
|
+
agents: {
|
|
39
|
+
id: 'agents',
|
|
40
|
+
name: 'Agent Skills(开放标准 · .agents)',
|
|
41
|
+
skillRootDir: '.agents/skills',
|
|
42
|
+
frontmatterProfile: 'standard',
|
|
43
|
+
metadataFiles: []
|
|
44
|
+
},
|
|
45
|
+
gemini: {
|
|
46
|
+
id: 'gemini',
|
|
47
|
+
name: 'Gemini CLI',
|
|
48
|
+
skillRootDir: '.gemini/skills',
|
|
49
|
+
frontmatterProfile: 'standard',
|
|
50
|
+
metadataFiles: []
|
|
51
|
+
},
|
|
38
52
|
copilot: {
|
|
39
53
|
id: 'copilot',
|
|
40
54
|
name: 'GitHub Copilot',
|
|
@@ -44,7 +58,15 @@ const TOOL_TARGET_MAP: Record<ToolId, ToolTarget> = {
|
|
|
44
58
|
}
|
|
45
59
|
}
|
|
46
60
|
|
|
47
|
-
export const DEFAULT_TOOL_ORDER: ToolId[] = [
|
|
61
|
+
export const DEFAULT_TOOL_ORDER: ToolId[] = [
|
|
62
|
+
'agents',
|
|
63
|
+
'cursor',
|
|
64
|
+
'claude',
|
|
65
|
+
'codex',
|
|
66
|
+
'antigravity',
|
|
67
|
+
'gemini',
|
|
68
|
+
'copilot'
|
|
69
|
+
]
|
|
48
70
|
|
|
49
71
|
export interface ToolChoice {
|
|
50
72
|
id: ToolId
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ToolId = 'claude' | 'codex' | 'cursor' | 'antigravity' | 'copilot'
|
|
1
|
+
export type ToolId = 'claude' | 'codex' | 'cursor' | 'antigravity' | 'agents' | 'gemini' | 'copilot'
|
|
2
2
|
|
|
3
3
|
export type SkillFrontmatterProfile = 'standard' | 'claude' | 'copilot'
|
|
4
4
|
export type SkillMetadataFile = 'openai'
|