@cat-kit/agent-context 1.2.0 → 1.2.1

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 CHANGED
@@ -15,13 +15,17 @@
15
15
 
16
16
  ```text
17
17
  .agent-context/
18
- ├── plan-{N}/ # 当前计划(最多一个)
19
- ├── plan.md
20
- └── patch-{N}.md
21
- ├── preparing/ # 待执行计划队列
22
- │ └── plan-{N}/
23
- └── done/ # 已归档计划
24
- └── plan-{N}-{YYYYMMDD}/
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
  生命周期如下:
@@ -82,15 +86,15 @@ agent-context install --tools claude,codex,cursor
82
86
 
83
87
  下面的 action 不是 CLI 子命令,而是你对 AI 说的话。AI 安装 Skill 后,会把这些话映射到固定协议。
84
88
 
85
- | Action | 何时使用 | 当前状态要求 | 结果 |
86
- | ------ | -------- | ------------ | ---- |
87
- | `init` | 项目还没建立好协作约定,或者 `AGENTS.md` 不完整 | 无 | 生成或补全 `AGENTS.md`,新项目可继续进入计划 |
88
- | `plan` | 新需求需要正式拆分步骤 | 当前没有冲突中的已执行计划 | 创建 `plan.md`,必要时拆成当前计划 + preparing 队列 |
89
- | `replan` | 计划还没实施,但拆分方式或技术路线要改 | 目标计划必须仍是 `未执行` | 重写计划结构,保留单当前计划模型 |
90
- | `implement` | 计划已经明确,开始真正落地 | 当前计划存在且状态为 `未执行` | 实施全部步骤,验证通过后把计划改为 `已执行` |
91
- | `patch` | 已执行计划上出现 Bug、遗漏项或增量需求 | 当前计划必须是 `已执行` | 执行修补,生成 `patch-{N}.md`,更新影响范围 |
92
- | `rush` | 任务范围很清晰,不想先单独经历 plan 再 implement | 当前不能存在未实施计划 | 直接创建单计划并立刻实施 |
93
- | `done` | 当前计划已经真正完成,需要收尾归档 | 当前计划必须是 `已执行` | 把当前计划移入 `done/`,必要时晋升下一个 preparing 计划 |
89
+ | Action | 何时使用 | 当前状态要求 | 结果 |
90
+ | ----------- | ------------------------------------------------ | ----------------------------- | ------------------------------------------------------- |
91
+ | `init` | 项目还没建立好协作约定,或者 `AGENTS.md` 不完整 | 无 | 生成或补全 `AGENTS.md`,新项目可继续进入计划 |
92
+ | `plan` | 新需求需要正式拆分步骤 | 当前没有冲突中的已执行计划 | 创建 `plan.md`,必要时拆成当前计划 + preparing 队列 |
93
+ | `replan` | 计划还没实施,但拆分方式或技术路线要改 | 目标计划必须仍是 `未执行` | 重写计划结构,保留单当前计划模型 |
94
+ | `implement` | 计划已经明确,开始真正落地 | 当前计划存在且状态为 `未执行` | 实施全部步骤,验证通过后把计划改为 `已执行` |
95
+ | `patch` | 已执行计划上出现 Bug、遗漏项或增量需求 | 当前计划必须是 `已执行` | 执行修补,生成 `patch-{N}.md`,更新影响范围 |
96
+ | `rush` | 任务范围很清晰,不想先单独经历 plan 再 implement | 当前不能存在未实施计划 | 直接创建单计划并立刻实施 |
97
+ | `done` | 当前计划已经真正完成,需要收尾归档 | 当前计划必须是 `已执行` | 把当前计划移入 `done/`,必要时晋升下一个 preparing 计划 |
94
98
 
95
99
  ### `init`
96
100
 
@@ -235,10 +239,42 @@ rush 一下,把 README 里的命令表更新为最新版本
235
239
 
236
240
  `rush` 很适合这种“知道要改什么,也知道验收标准”的任务,但不适合目标模糊的大需求。
237
241
 
242
+ ## 多人协作
243
+
244
+ `agent-context` 通过 SCOPE 机制支持多人在同一项目中独立管理计划:
245
+
246
+ - 每位协作者拥有独立的作用域目录(`{scope}/`),互不干扰
247
+ - SCOPE 名称自动取自 git 配置的 `user.name`
248
+ - 计划编号在各 SCOPE 内独立递增
249
+ - 首次使用时运行 `agent-context init` 初始化作用域
250
+
251
+ ```text
252
+ .agent-context/
253
+ ├── alice/ # Alice 的计划
254
+ │ ├── index.md
255
+ │ ├── plan-1/
256
+ │ └── done/
257
+ ├── bob/ # Bob 的计划
258
+ │ ├── index.md
259
+ │ ├── plan-3/
260
+ │ └── done/
261
+ └── .env # 当前用户的 SCOPE
262
+ ```
263
+
238
264
  ## CLI 命令参考
239
265
 
240
266
  CLI 只负责文件安装、同步和状态管理,不负责替代 action。
241
267
 
268
+ ### `agent-context init`
269
+
270
+ 初始化作用域。首次在项目中使用时运行,会自动检测 git `user.name` 作为 SCOPE 名称,并创建必要的目录结构。
271
+
272
+ ```bash
273
+ agent-context init
274
+ agent-context init --scope alice
275
+ agent-context init --yes
276
+ ```
277
+
242
278
  ### `agent-context install`
243
279
 
244
280
  安装 Skill 文件。
@@ -289,22 +325,33 @@ agent-context done
289
325
  agent-context done --yes
290
326
  ```
291
327
 
328
+ ### `agent-context index`
329
+
330
+ 生成或更新当前 SCOPE 的计划索引文件 `.agent-context/{scope}/index.md`。索引按 done、当前计划、preparing 分类,每项为 `- [x/ ] [标题](相对路径)` 格式。
331
+
332
+ 归档计划时(`done`)会自动调用,也可手动运行:
333
+
334
+ ```bash
335
+ agent-context index
336
+ ```
337
+
292
338
  ## 通用选项
293
339
 
294
- | 选项 | 适用命令 | 说明 |
295
- | ---- | -------- | ---- |
296
- | `--tools <tools>` | `install` / `sync` | 指定目标工具,逗号分隔 |
297
- | `--check` | `install` / `sync` | 只检查是否有变更,不写文件 |
298
- | `--yes` | `install` / `done` | 跳过交互确认;`install` 会优先复用已安装工具 |
340
+ | 选项 | 适用命令 | 说明 |
341
+ | ----------------- | --------------------------- | -------------------------------------------- |
342
+ | `--tools <tools>` | `install` / `sync` | 指定目标工具,逗号分隔 |
343
+ | `--check` | `install` / `sync` | 只检查是否有变更,不写文件 |
344
+ | `--yes` | `install` / `init` / `done` | 跳过交互确认;`install` 会优先复用已安装工具 |
345
+ | `--scope <name>` | `init` | 手动指定 SCOPE 名称,不使用 git user.name |
299
346
 
300
347
  ## 支持的工具
301
348
 
302
- | 工具 | Skill 目录 |
303
- | ---- | ---------- |
304
- | Claude | `.claude/skills/agent-context/` |
305
- | Codex | `.codex/skills/agent-context/` |
306
- | Cursor | `.cursor/skills/agent-context/` |
307
- | Antigravity | `.agent/skills/agent-context/` |
349
+ | 工具 | Skill 目录 |
350
+ | -------------- | ------------------------------- |
351
+ | Claude | `.claude/skills/agent-context/` |
352
+ | Codex | `.codex/skills/agent-context/` |
353
+ | Cursor | `.cursor/skills/agent-context/` |
354
+ | Antigravity | `.agent/skills/agent-context/` |
308
355
  | GitHub Copilot | `.github/skills/agent-context/` |
309
356
 
310
357
  其中 Codex 会额外生成 `agents/openai.yaml` 元数据文件,其余工具只生成 Skill 内容本身。
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{initCommand as t}from"./commands/init.js";import{installCommand as n}from"./commands/install.js";import{statusCommand as r}from"./commands/status.js";import{syncCommand as i}from"./commands/sync.js";import{validateCommand as a}from"./commands/validate.js";import{readFileSync as o}from"node:fs";import{Command as s}from"commander";const c=JSON.parse(o(new URL(`../package.json`,import.meta.url),`utf8`)),l=typeof c.version==`string`?c.version:`0.0.0`,u=new s;u.name(`agent-context`).description(`Agent Context Skills 安装工具`).version(l),u.command(`install`).description(`安装 ac-workflow Skill`).option(`--tools <tools>`,`指定目标工具,逗号分隔:claude,codex,cursor,antigravity,copilot`).option(`--yes`,`非交互模式:优先复用已安装工具,否则安装全部工具`).option(`--check`,`仅检查是否存在待更新内容,不写入文件`).action(n),u.command(`sync`).description(`同步已安装的 ac-workflow Skill`).option(`--tools <tools>`,`指定目标工具,逗号分隔:claude,codex,cursor,antigravity,copilot`).option(`--check`,`仅检查是否存在待更新内容,不写入文件`).action(i),u.command(`init`).description(`初始化 SCOPE(从 git user.name 自动获取或手动指定)`).option(`--scope <name>`,`手动指定 SCOPE 名称`).option(`--yes`,`非交互模式:自动覆盖已存在的 SCOPE`).action(t),u.command(`validate`).description(`校验 .agent-context 目录结构`).action(a),u.command(`status`).description(`查看当前 agent-context 状态`).action(r),u.command(`done`).description(`归档当前已执行计划`).option(`--yes`,`跳过确认,直接归档`).action(e),u.parseAsync().catch(e=>{let t=e instanceof Error?e.message:String(e);console.error(`\n❌ ${t}`),process.exitCode=1});export{};
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,copilot`).option(`--yes`,`非交互模式:优先复用已安装工具,否则安装全部工具`).option(`--check`,`仅检查是否存在待更新内容,不写入文件`).action(r),d.command(`sync`).description(`同步已安装的 ac-workflow Skill`).option(`--tools <tools>`,`指定目标工具,逗号分隔:claude,codex,cursor,antigravity,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{};
@@ -1 +1 @@
1
- import{readRawContext as e}from"../context/reader.js";import{validate as t}from"../context/validator.js";import{archive as n}from"../context/archiver.js";import{basename as r}from"node:path";import{confirm as i}from"@inquirer/prompts";async function a(a){let{snapshot:o,currentPlanCount:s}=await e(process.cwd()),c=t(o,s);if(!c.valid){for(let e of c.errors)console.log(`❌ ${e}`);process.exitCode=1;return}if(!o||!o.currentPlan){console.log(`❌ 无当前计划`),process.exitCode=1;return}if(o.currentPlan.status!==`已执行`){console.log(`❌ 当前计划 plan-${o.currentPlan.number} 尚未执行,无法归档。`),process.exitCode=1;return}if(!a.yes&&!await i({message:`确认归档 plan-${o.currentPlan.number}?`})){console.log(`已取消`);return}let l=await n(o),u=r(l.archivedTo);console.log(`✅ 已归档: plan-${o.currentPlan.number} → done/${u}`),l.promoted!==null&&console.log(`📋 已晋升: plan-${l.promoted} 为新的当前计划`),l.remainingPreparing>0?console.log(`📋 待执行队列剩余 ${l.remainingPreparing} 个计划`):l.promoted===null&&console.log(`ℹ 无更多待执行计划`)}export{a as doneCommand};
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};
@@ -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,check:r});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};
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};
@@ -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,check:s});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};
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};
@@ -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. 通过提问澄清以下要点(已从描述中获取的可跳过):项目目标与核心功能、技术栈与版本、代码规范与工具链(lint/formatter/测试)、目录结构偏好。
17
- 2. 生成高质量 \`AGENTS.md\`(须满足下方质量标准,不满足则重新优化直至满足)。
18
- 3. 继续执行 plan 创建初始计划。
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
- - 跳过「需求澄清」步骤——rush 要求描述本身已足够明确。
192
+ - 仅在描述本身已足够明确时跳过「需求澄清」步骤;否则不得继续 rush
177
193
  - 强制单计划,不拆分,不进入 preparing 队列。
178
194
  - 完成 plan 后**不等待用户确认**,直接进入阶段二。
179
195
 
@@ -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 除外)均包含「前置检查」,必须逐条执行,不可跳过。包括运行 \`agent-context validate\`。
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===`claude`&&t.push(`argument-hint: [request]`),e.frontmatterProfile===`copilot`&&t.push(`license: MIT`),t.push(`---`,``),`${t.join(`
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};
@@ -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 d(o),c=await d(n(o,`preparing`)),l=await f(n(o,`done`));return{snapshot:{root:o,scope:a,currentPlan:s[0]??null,preparing:c,done:l},currentPlanCount:s.length}}async function u(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 d(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 u(s);o.push({number:i,status:c,dir:s})}return o.sort((e,t)=>e.number-t.number)}async function f(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 readRawContext};
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":"2800e162-1"}]},{"name":"cli.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/cli.ts","uid":"2800e162-3"}]},{"name":"commands/done.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/done.ts","uid":"2800e162-5"}]},{"name":"commands/index-cmd.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/index-cmd.ts","uid":"2800e162-7"}]},{"name":"commands/init.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/init.ts","uid":"2800e162-9"}]},{"name":"commands/install.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/install.ts","uid":"2800e162-11"}]},{"name":"commands/printer.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/printer.ts","uid":"2800e162-13"}]},{"name":"commands/status.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/status.ts","uid":"2800e162-15"}]},{"name":"commands/sync.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/sync.ts","uid":"2800e162-17"}]},{"name":"commands/validate.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/commands/validate.ts","uid":"2800e162-19"}]},{"name":"content/actions.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/content/actions.ts","uid":"2800e162-21"}]},{"name":"content/index.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/content/index.ts","uid":"2800e162-23"}]},{"name":"context/archiver.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/context/archiver.ts","uid":"2800e162-25"}]},{"name":"context/indexer.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/context/indexer.ts","uid":"2800e162-27"}]},{"name":"context/reader.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/context/reader.ts","uid":"2800e162-29"}]},{"name":"context/scope.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/context/scope.ts","uid":"2800e162-31"}]},{"name":"context/validator.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/context/validator.ts","uid":"2800e162-33"}]},{"name":"runner.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/runner.ts","uid":"2800e162-35"}]},{"name":"tools.js","children":[{"name":"Users/whj/Codes/cat-kit/packages/agent-context/src/tools.ts","uid":"2800e162-37"}]}],"isRoot":true},"nodeParts":{"2800e162-1":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-0"},"2800e162-3":{"renderedLength":1863,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-2"},"2800e162-5":{"renderedLength":1508,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-4"},"2800e162-7":{"renderedLength":629,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-6"},"2800e162-9":{"renderedLength":718,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-8"},"2800e162-11":{"renderedLength":1005,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-10"},"2800e162-13":{"renderedLength":909,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-12"},"2800e162-15":{"renderedLength":993,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-14"},"2800e162-17":{"renderedLength":765,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-16"},"2800e162-19":{"renderedLength":813,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-18"},"2800e162-21":{"renderedLength":11445,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-20"},"2800e162-23":{"renderedLength":4355,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-22"},"2800e162-25":{"renderedLength":1012,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-24"},"2800e162-27":{"renderedLength":1274,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-26"},"2800e162-29":{"renderedLength":2276,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-28"},"2800e162-31":{"renderedLength":1479,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-30"},"2800e162-33":{"renderedLength":1905,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-32"},"2800e162-35":{"renderedLength":2037,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-34"},"2800e162-37":{"renderedLength":2174,"gzipLength":0,"brotliLength":0,"metaUid":"2800e162-36"}},"nodeMetas":{"2800e162-0":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/cli.d.ts","moduleParts":{"cli.d.ts":"2800e162-1"},"imported":[],"importedBy":[],"isEntry":true},"2800e162-2":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/cli.ts","moduleParts":{"cli.js":"2800e162-3"},"imported":[{"uid":"2800e162-38"},{"uid":"2800e162-39"},{"uid":"2800e162-4"},{"uid":"2800e162-6"},{"uid":"2800e162-8"},{"uid":"2800e162-10"},{"uid":"2800e162-14"},{"uid":"2800e162-16"},{"uid":"2800e162-18"}],"importedBy":[],"isEntry":true},"2800e162-4":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/done.ts","moduleParts":{"commands/done.js":"2800e162-5"},"imported":[{"uid":"2800e162-40"},{"uid":"2800e162-41"},{"uid":"2800e162-42"}],"importedBy":[{"uid":"2800e162-2"}]},"2800e162-6":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/index-cmd.ts","moduleParts":{"commands/index-cmd.js":"2800e162-7"},"imported":[{"uid":"2800e162-40"},{"uid":"2800e162-42"}],"importedBy":[{"uid":"2800e162-2"}]},"2800e162-8":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/init.ts","moduleParts":{"commands/init.js":"2800e162-9"},"imported":[{"uid":"2800e162-38"},{"uid":"2800e162-43"},{"uid":"2800e162-40"},{"uid":"2800e162-41"},{"uid":"2800e162-30"}],"importedBy":[{"uid":"2800e162-2"}]},"2800e162-10":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/install.ts","moduleParts":{"commands/install.js":"2800e162-11"},"imported":[{"uid":"2800e162-41"},{"uid":"2800e162-34"},{"uid":"2800e162-36"},{"uid":"2800e162-12"}],"importedBy":[{"uid":"2800e162-2"}]},"2800e162-12":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/printer.ts","moduleParts":{"commands/printer.js":"2800e162-13"},"imported":[{"uid":"2800e162-40"}],"importedBy":[{"uid":"2800e162-10"},{"uid":"2800e162-16"}]},"2800e162-14":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/status.ts","moduleParts":{"commands/status.js":"2800e162-15"},"imported":[{"uid":"2800e162-42"}],"importedBy":[{"uid":"2800e162-2"}]},"2800e162-16":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/sync.ts","moduleParts":{"commands/sync.js":"2800e162-17"},"imported":[{"uid":"2800e162-34"},{"uid":"2800e162-36"},{"uid":"2800e162-12"}],"importedBy":[{"uid":"2800e162-2"}]},"2800e162-18":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/commands/validate.ts","moduleParts":{"commands/validate.js":"2800e162-19"},"imported":[{"uid":"2800e162-42"}],"importedBy":[{"uid":"2800e162-2"}]},"2800e162-20":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/content/actions.ts","moduleParts":{"content/actions.js":"2800e162-21"},"imported":[],"importedBy":[{"uid":"2800e162-22"}]},"2800e162-22":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/content/index.ts","moduleParts":{"content/index.js":"2800e162-23"},"imported":[{"uid":"2800e162-20"}],"importedBy":[{"uid":"2800e162-34"}]},"2800e162-24":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/context/archiver.ts","moduleParts":{"context/archiver.js":"2800e162-25"},"imported":[{"uid":"2800e162-43"},{"uid":"2800e162-40"}],"importedBy":[{"uid":"2800e162-42"}]},"2800e162-26":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/context/indexer.ts","moduleParts":{"context/indexer.js":"2800e162-27"},"imported":[{"uid":"2800e162-38"},{"uid":"2800e162-43"},{"uid":"2800e162-40"}],"importedBy":[{"uid":"2800e162-42"}]},"2800e162-28":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/context/reader.ts","moduleParts":{"context/reader.js":"2800e162-29"},"imported":[{"uid":"2800e162-38"},{"uid":"2800e162-43"},{"uid":"2800e162-40"},{"uid":"2800e162-30"}],"importedBy":[{"uid":"2800e162-42"}]},"2800e162-30":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/context/scope.ts","moduleParts":{"context/scope.js":"2800e162-31"},"imported":[{"uid":"2800e162-44"},{"uid":"2800e162-38"},{"uid":"2800e162-43"},{"uid":"2800e162-40"}],"importedBy":[{"uid":"2800e162-8"},{"uid":"2800e162-42"},{"uid":"2800e162-28"}]},"2800e162-32":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/context/validator.ts","moduleParts":{"context/validator.js":"2800e162-33"},"imported":[{"uid":"2800e162-38"},{"uid":"2800e162-40"}],"importedBy":[{"uid":"2800e162-42"}]},"2800e162-34":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/runner.ts","moduleParts":{"runner.js":"2800e162-35"},"imported":[{"uid":"2800e162-38"},{"uid":"2800e162-43"},{"uid":"2800e162-40"},{"uid":"2800e162-22"},{"uid":"2800e162-36"}],"importedBy":[{"uid":"2800e162-10"},{"uid":"2800e162-16"}]},"2800e162-36":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/tools.ts","moduleParts":{"tools.js":"2800e162-37"},"imported":[{"uid":"2800e162-38"},{"uid":"2800e162-40"}],"importedBy":[{"uid":"2800e162-10"},{"uid":"2800e162-16"},{"uid":"2800e162-34"}]},"2800e162-38":{"id":"node:fs","moduleParts":{},"imported":[],"importedBy":[{"uid":"2800e162-2"},{"uid":"2800e162-8"},{"uid":"2800e162-30"},{"uid":"2800e162-34"},{"uid":"2800e162-36"},{"uid":"2800e162-28"},{"uid":"2800e162-32"},{"uid":"2800e162-26"}]},"2800e162-39":{"id":"commander","moduleParts":{},"imported":[],"importedBy":[{"uid":"2800e162-2"}]},"2800e162-40":{"id":"node:path","moduleParts":{},"imported":[],"importedBy":[{"uid":"2800e162-4"},{"uid":"2800e162-6"},{"uid":"2800e162-8"},{"uid":"2800e162-30"},{"uid":"2800e162-34"},{"uid":"2800e162-36"},{"uid":"2800e162-12"},{"uid":"2800e162-28"},{"uid":"2800e162-32"},{"uid":"2800e162-24"},{"uid":"2800e162-26"}]},"2800e162-41":{"id":"@inquirer/prompts","moduleParts":{},"imported":[],"importedBy":[{"uid":"2800e162-4"},{"uid":"2800e162-8"},{"uid":"2800e162-10"}]},"2800e162-42":{"id":"/Users/whj/Codes/cat-kit/packages/agent-context/src/context/index.ts","moduleParts":{},"imported":[{"uid":"2800e162-28"},{"uid":"2800e162-32"},{"uid":"2800e162-24"},{"uid":"2800e162-26"},{"uid":"2800e162-30"}],"importedBy":[{"uid":"2800e162-4"},{"uid":"2800e162-6"},{"uid":"2800e162-14"},{"uid":"2800e162-18"}]},"2800e162-43":{"id":"node:fs/promises","moduleParts":{},"imported":[],"importedBy":[{"uid":"2800e162-8"},{"uid":"2800e162-30"},{"uid":"2800e162-34"},{"uid":"2800e162-28"},{"uid":"2800e162-24"},{"uid":"2800e162-26"}]},"2800e162-44":{"id":"node:child_process","moduleParts":{},"imported":[],"importedBy":[{"uid":"2800e162-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-kit/agent-context",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
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.0",
15
+ "@inquirer/prompts": "^8.3.2",
16
16
  "commander": "^14.0.3"
17
17
  },
18
18
  "devDependencies": {
19
- "@cat-kit/tsconfig": "1.0.0",
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'
@@ -52,6 +53,8 @@ program
52
53
  .option('--yes', '跳过确认,直接归档')
53
54
  .action(doneCommand)
54
55
 
56
+ program.command('index').description('生成或更新计划索引文件').action(indexCommand)
57
+
55
58
  program.parseAsync().catch((error: unknown) => {
56
59
  const message = error instanceof Error ? error.message : String(error)
57
60
  console.error(`\n❌ ${message}`) // eslint-disable-line no-console
@@ -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
+ }
@@ -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, tools, check })
23
+ const result = await runInstall({ cwd, check, ...(tools ? { tools } : {}) })
24
24
 
25
25
  if (check) {
26
26
  printCheckResult(result, cwd)
@@ -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, tools, check })
15
+ const result = await runSync({ cwd, check, ...(tools ? { tools } : {}) })
16
16
 
17
17
  if (check) {
18
18
  printCheckResult(result, cwd)
@@ -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. 通过提问澄清以下要点(已从描述中获取的可跳过):项目目标与核心功能、技术栈与版本、代码规范与工具链(lint/formatter/测试)、目录结构偏好。
30
- 2. 生成高质量 \`AGENTS.md\`(须满足下方质量标准,不满足则重新优化直至满足)。
31
- 3. 继续执行 plan 创建初始计划。
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
- - 跳过「需求澄清」步骤——rush 要求描述本身已足够明确。
256
+ - 仅在描述本身已足够明确时跳过「需求澄清」步骤;否则不得继续 rush
241
257
  - 强制单计划,不拆分,不进入 preparing 队列。
242
258
  - 完成 plan 后**不等待用户确认**,直接进入阶段二。
243
259
 
@@ -32,7 +32,7 @@ function renderNavigator(target: ToolTarget): string {
32
32
  ## 执行纪律
33
33
 
34
34
  - **协议先行**:匹配到动作后,必须先读取对应 \`actions/*.md\` 协议文件的完整内容,再逐步执行。禁止凭记忆、摘要或猜测跳过协议步骤。
35
- - **前置检查必做**:所有动作(done 除外)均包含「前置检查」,必须逐条执行,不可跳过。包括运行 \`agent-context validate\`。
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 === 'claude') {
88
+ if (target.frontmatterProfile !== 'copilot') {
89
89
  lines.push('argument-hint: [request]')
90
90
  }
91
91
 
@@ -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
+ }
@@ -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')