@cydm/pie 1.0.29 → 1.0.31

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
@@ -219,6 +219,7 @@ Pie uses a hierarchical slash-command menu. The current built-in commands includ
219
219
  | `/skills/reload` | Reload skills from disk |
220
220
  | `/settings/extensions` | List extensions and toggle enable/disable |
221
221
  | `/tools/subagent` | Spawn a subagent for a task |
222
+ | `/tools/init` | Create or update the project AGENTS.md (`/init` is a hidden direct alias) |
222
223
  | `/settings/debugs/cache-test` | Run provider cache diagnostics with a dedicated 2-request probe |
223
224
  | `/settings/debugs/context` | Append a context summary to `~/.pie/logs/pie-cli.log` |
224
225
  | `/settings/debugs/package` | Append a package summary to `~/.pie/logs/pie-cli.log` |
@@ -298,11 +299,9 @@ Run `pie doctor` to check whether Playwright CLI and its browser runtime are dis
298
299
 
299
300
  ## Web Research
300
301
 
301
- Pie exposes a canonical `web_research` tool for public web research, current information, online documentation, and internet inspiration. It plans search variants, uses provider-native search, fetches credible sources, and returns citations. Workspace search remains separate: use `grep_text`, `find_files`, and `list_dir` for local repository content.
302
+ Pie exposes one default model-visible web tool: `web_research`. Use it for public web research, current information, online documentation, and internet inspiration. Pass `query` for research, `url` to fetch a known page/PDF, or `query` with `mode: "search"` for low-level search results. Workspace search remains separate: use `grep_text`, `find_files`, and `list_dir` for local repository content.
302
303
 
303
- `web_search` remains available as the lower-level provider-native search tool. It does not scrape DuckDuckGo or fall back to `bash` with `curl` or Python HTTP scripts. If the configured provider/model cannot perform native web search, the tool returns a clear unavailable result with provider/configuration details.
304
-
305
- Use `web_fetch` directly when the agent needs to read a specific URL, documentation page, changelog, issue, or PDF. `web_fetch` follows redirects, extracts readable text/markdown, returns citation anchors and extraction diagnostics, and reports `requires_browser` for JavaScript-heavy pages instead of pretending the content was read. In the CLI, `web_research` can use browser-tools for browser-rendered sources when the Playwright runtime is available; Unity reports those pages as `requires_browser`.
304
+ `web_search` and `web_fetch` remain lower-level internal primitives for probes, diagnostics, and tests; they are not separate default model-visible tools. `web_search` does not scrape DuckDuckGo or fall back to `bash` with `curl` or Python HTTP scripts. If the configured provider/model cannot perform native web search, Pie returns a clear unavailable result with provider/configuration details. In the CLI, `web_research` can use browser-tools for browser-rendered sources when the Playwright runtime is available; Unity reports those pages as `requires_browser`.
306
305
 
307
306
  `web_research` records route health and latency in Pie's state directory so later runs can prefer providers with better source quality, fewer timeouts, and lower rate-limit pressure. `pie doctor --json` reports the recorded provider health, and `verify:web` writes web metrics including p50/p95 latency, failure categories, and citation quality artifacts.
308
307
 
@@ -312,7 +311,7 @@ Pie's default tools operate from the current workspace. File tools are workspace
312
311
 
313
312
  ## Code Intelligence
314
313
 
315
- `code_intel` provides read-only JS/TS diagnostics, definition, references, symbols, and hover. CLI uses the TypeScript language service by default and falls back to lightweight text analysis only when the TypeScript service cannot start. Unity uses a Node sidecar contract for TypeScript intelligence so the PuerTS bundle does not import Node-only parser dependencies.
314
+ `code_intel` provides read-only JS/TS diagnostics, definition, references, symbols, and hover. CLI uses an isolated TypeScript worker by default and falls back to bounded lightweight text analysis on worker startup/OOM/crash/timeout failures; aborts, permission errors, and path escapes do not fallback. Unity uses a Node sidecar contract for TypeScript intelligence so the PuerTS bundle does not import Node-only parser dependencies.
316
315
 
317
316
  ## Diagnostics
318
317
 
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createAskUserCapability
4
- } from "../../../chunks/chunk-L63BJMTT.js";
4
+ } from "../../../chunks/chunk-BOFCKEV5.js";
5
5
  import "../../../chunks/chunk-4B42ZU4B.js";
6
6
  import "../../../chunks/chunk-64XJIKVK.js";
7
7
  import "../../../chunks/chunk-TG2EQLX2.js";
@@ -65,54 +65,54 @@ function changelogExtension(ctx) {
65
65
  if (!commits2) {
66
66
  return "No git history found. Cannot check for missing entries.";
67
67
  }
68
- return `\u{1F50D} CHANGELOG \u9057\u6F0F\u68C0\u67E5
68
+ return `CHANGELOG gap check
69
69
 
70
- \u8BF7\u5206\u6790\u4EE5\u4E0B\u4FE1\u606F\uFF0C\u68C0\u67E5 CHANGELOG \u662F\u5426\u6709\u9057\u6F0F\uFF1A
70
+ Analyze the following information and check whether CHANGELOG is missing entries:
71
71
 
72
- ## \u6700\u8FD1 Git \u63D0\u4EA4
73
- ${commits2 || "(\u65E0\u6CD5\u83B7\u53D6)"}
72
+ ## Recent Git commits
73
+ ${commits2 || "(unavailable)"}
74
74
 
75
- ## \u53D8\u66F4\u6587\u4EF6
76
- ${changedFiles2 || "(\u65E0\u6CD5\u83B7\u53D6)"}
75
+ ## Changed files
76
+ ${changedFiles2 || "(unavailable)"}
77
77
 
78
- ## \u5F53\u524D CHANGELOG
79
- ${changelog2 ? changelog2.slice(0, 1500) + "\n..." : "(\u6587\u4EF6\u4E0D\u5B58\u5728)"}
78
+ ## Current CHANGELOG
79
+ ${changelog2 ? changelog2.slice(0, 1500) + "\n..." : "(file does not exist)"}
80
80
 
81
- \u8BF7\u5BF9\u6BD4\u5206\u6790\uFF1A
82
- 1. \u54EA\u4E9B\u91CD\u8981\u7684\u53D8\u66F4\u5DF2\u7ECF\u63D0\u4EA4\u5230 git \u4F46\u6CA1\u6709\u8BB0\u5F55\u5728 CHANGELOG\uFF1F
83
- 2. \u5F53\u524D [Unreleased] \u90E8\u5206\u662F\u5426\u5B8C\u6574\u53CD\u6620\u4E86\u6700\u8FD1\u7684\u5DE5\u4F5C\uFF1F
84
- 3. \u5217\u51FA\u9057\u6F0F\u7684\u6761\u76EE\u5EFA\u8BAE\uFF08\u6309 Added/Changed/Fixed \u5206\u7C7B\uFF09
81
+ Compare and report:
82
+ 1. Which important committed changes are missing from CHANGELOG?
83
+ 2. Does the current [Unreleased] section fully reflect recent work?
84
+ 3. List suggested missing entries grouped by Added/Changed/Fixed.
85
85
 
86
- \u53EA\u8FD4\u56DE\u5206\u6790\u62A5\u544A\uFF0C\u4E0D\u8981\u4FEE\u6539\u6587\u4EF6\u3002`;
86
+ Return only the analysis report. Do not modify files.`;
87
87
  }
88
88
  if (args?.startsWith("add ")) {
89
89
  const description = args.slice(4).trim();
90
90
  const existingChangelog = await readChangelog(ctx2.cwd);
91
- ctx2.ui.notify(`\u{1F4DD} \u6B63\u5728\u751F\u6210 changelog \u6761\u76EE...`, "info");
92
- return `\u8BF7\u5C06\u4EE5\u4E0B\u63CF\u8FF0\u8F6C\u6362\u4E3A\u4E13\u4E1A\u7684 CHANGELOG \u6761\u76EE\uFF1A
91
+ ctx2.ui.notify("Generating changelog entry...", "info");
92
+ return `Convert the following description into a professional CHANGELOG entry:
93
93
 
94
- \u63CF\u8FF0\uFF1A"${description}"
94
+ Description: "${description}"
95
95
 
96
96
  ${existingChangelog ? `
97
- \u53C2\u8003\u73B0\u6709\u683C\u5F0F\uFF1A
97
+ Use this existing style as reference:
98
98
  \`\`\`
99
99
  ${existingChangelog.slice(0, 800)}
100
100
  ...
101
101
  \`\`\`` : ""}
102
102
 
103
- \u8981\u6C42\uFF1A
104
- 1. \u9009\u62E9\u5408\u9002\u7684\u5206\u7C7B\uFF1A**Added** / **Changed** / **Fixed** / **Removed** / **Deprecated** / **Security**
105
- 2. \u4F7F\u7528\u73B0\u5728\u65F6\u6001\uFF0C\u7B80\u6D01\u4F46\u5305\u542B\u5173\u952E\u6280\u672F\u7EC6\u8282
106
- 3. \u5982\u6709\u76F8\u5173\u6587\u4EF6\u8DEF\u5F84\uFF0C\u8BF7\u5305\u542B
103
+ Requirements:
104
+ 1. Choose the right category: **Added** / **Changed** / **Fixed** / **Removed** / **Deprecated** / **Security**.
105
+ 2. Use present tense; be concise while keeping key technical details.
106
+ 3. Include relevant file paths when useful.
107
107
 
108
- \u683C\u5F0F\u793A\u4F8B\uFF1A
109
- - **Added**: \u65B0\u589E\u7528\u6237\u8BA4\u8BC1\u6A21\u5757\uFF0C\u652F\u6301 JWT token \u9A8C\u8BC1\uFF08src/auth/\uFF09
110
- - **Fixed**: \u4FEE\u590D\u5185\u5B58\u6CC4\u6F0F\u95EE\u9898\uFF0C\u4F18\u5316\u4E86\u5927\u6587\u4EF6\u5904\u7406\u6027\u80FD
108
+ Examples:
109
+ - **Added**: Add JWT validation to the authentication module (src/auth/).
110
+ - **Fixed**: Fix a memory leak in large-file processing.
111
111
 
112
- \u4F7F\u7528 write \u5DE5\u5177\u66F4\u65B0 CHANGELOG.md\uFF1A
113
- - \u5982\u679C\u4E0D\u5B58\u5728\uFF0C\u521B\u5EFA\u6807\u51C6\u683C\u5F0F\uFF08\u5305\u542B ## [Unreleased] \u90E8\u5206\uFF09
114
- - \u5C06\u65B0\u6761\u76EE\u6DFB\u52A0\u5230 [Unreleased] \u90E8\u5206\u7684\u5408\u9002\u4F4D\u7F6E
115
- - \u4FDD\u6301\u73B0\u6709\u6761\u76EE\u4E0D\u53D8`;
112
+ Use the write tool to update CHANGELOG.md:
113
+ - If it does not exist, create the standard format including ## [Unreleased].
114
+ - Add the new entry to the right place in [Unreleased].
115
+ - Preserve existing entries.`;
116
116
  }
117
117
  if (args?.startsWith("release")) {
118
118
  const versionHint = args.slice(7).trim();
@@ -121,30 +121,30 @@ ${existingChangelog.slice(0, 800)}
121
121
  return "No CHANGELOG.md found. Create one first with /changelog";
122
122
  }
123
123
  ctx2.ui.notify(`\u{1F4DD} Preparing release ${versionHint || "..."}`, "info");
124
- return `\u8BF7\u5C06 [Unreleased] \u90E8\u5206\u7684\u5185\u5BB9\u6574\u7406\u4E3A\u4E00\u4E2A\u65B0\u7248\u672C\u53D1\u5E03\u3002
124
+ return `Prepare the [Unreleased] section as a new release.
125
125
 
126
- \u5F53\u524D CHANGELOG\uFF1A
126
+ Current CHANGELOG:
127
127
  \`\`\`
128
128
  ${existingChangelog.slice(0, 1500)}
129
129
  ...
130
130
  \`\`\`
131
131
 
132
- \u7248\u672C\u63D0\u793A\uFF1A${versionHint || "\u6839\u636E\u53D8\u66F4\u5185\u5BB9\u81EA\u52A8\u5224\u65AD\uFF08patch/minor/major\uFF09"}
132
+ Version hint: ${versionHint || "infer from changes (patch/minor/major)"}
133
133
 
134
- Semantic Versioning \u89C4\u5219\uFF1A
134
+ Semantic Versioning rules:
135
135
  - **patch** (0.0.x): Bug fixes only
136
136
  - **minor** (0.x.0): New features, backward compatible
137
137
  - **major** (x.0.0): Breaking changes
138
138
 
139
- \u4EFB\u52A1\uFF1A
140
- 1. \u5206\u6790 [Unreleased] \u4E2D\u7684\u53D8\u66F4\u7C7B\u578B
141
- 2. \u786E\u5B9A\u5408\u9002\u7684\u7248\u672C\u53F7\uFF08\u5982\u679C\u7528\u6237\u672A\u6307\u5B9A\uFF09
142
- 3. \u521B\u5EFA\u65B0\u7684\u7248\u672C\u8282\uFF08\u5982 ## [1.2.0] - 2024-03-06\uFF09
143
- 4. \u5C06 [Unreleased] \u7684\u5185\u5BB9\u79FB\u52A8\u5230\u65B0\u7248\u672C\u8282
144
- 5. \u6E05\u7A7A [Unreleased] \u90E8\u5206\uFF0C\u53EA\u4FDD\u7559\u7A7A\u5217\u8868
145
- 6. \u5728\u6587\u4EF6\u5E95\u90E8\u66F4\u65B0\u7248\u672C\u5BF9\u6BD4\u94FE\u63A5\uFF08\u5982\u679C\u9700\u8981\uFF09
139
+ Tasks:
140
+ 1. Analyze change types in [Unreleased].
141
+ 2. Choose the right version if the user did not specify one.
142
+ 3. Create a new version section, for example ## [1.2.0] - 2024-03-06.
143
+ 4. Move [Unreleased] content into the new version section.
144
+ 5. Leave [Unreleased] empty with placeholder lists.
145
+ 6. Update version comparison links at the bottom when applicable.
146
146
 
147
- \u4F7F\u7528 write \u5DE5\u5177\u66F4\u65B0 CHANGELOG.md`;
147
+ Use the write tool to update CHANGELOG.md.`;
148
148
  }
149
149
  const commits = getRecentCommits(ctx2.cwd, 15);
150
150
  const changelog = await readChangelog(ctx2.cwd);
@@ -152,40 +152,40 @@ Semantic Versioning \u89C4\u5219\uFF1A
152
152
  if (!commits && !changelog) {
153
153
  return "No git history or CHANGELOG.md found. Initialize with: /changelog add <description>";
154
154
  }
155
- ctx2.ui.notify("\u{1F50D} \u5206\u6790\u53D8\u66F4\u5E76\u68C0\u67E5\u9057\u6F0F...", "info");
156
- return `\u{1F4DD} \u667A\u80FD Changelog \u66F4\u65B0
155
+ ctx2.ui.notify("Analyzing changes and checking for missing changelog entries...", "info");
156
+ return `Smart changelog update
157
157
 
158
- \u8BF7\u5206\u6790\u4EE5\u4E0B\u4FE1\u606F\uFF0C\u68C0\u67E5\u5E76\u8865\u5145\u9057\u6F0F\u7684 CHANGELOG \u6761\u76EE\uFF1A
158
+ Analyze the following information, check for missing CHANGELOG entries, and add any clear omissions:
159
159
 
160
- ## \u6700\u8FD1 Git \u63D0\u4EA4\u8BB0\u5F55
161
- ${commits || "(\u65E0\u6CD5\u83B7\u53D6 git \u5386\u53F2)"}
160
+ ## Recent Git commits
161
+ ${commits || "(git history unavailable)"}
162
162
 
163
- ## \u6700\u8FD1\u53D8\u66F4\u7684\u6587\u4EF6
164
- ${changedFiles || "(\u65E0\u6CD5\u83B7\u53D6)"}
163
+ ## Recently changed files
164
+ ${changedFiles || "(unavailable)"}
165
165
 
166
- ## \u5F53\u524D CHANGELOG.md
167
- ${changelog ? "\n```\n" + changelog.slice(0, 2e3) + "\n...\n```" : "(\u6587\u4EF6\u4E0D\u5B58\u5728\uFF0C\u9700\u8981\u521B\u5EFA)"}
166
+ ## Current CHANGELOG.md
167
+ ${changelog ? "\n```\n" + changelog.slice(0, 2e3) + "\n...\n```" : "(file does not exist; create it if needed)"}
168
168
 
169
- ## \u4EFB\u52A1
169
+ ## Tasks
170
170
 
171
- 1. **\u5BF9\u6BD4\u5206\u6790**\uFF1A
172
- - \u67E5\u770B git \u63D0\u4EA4\u4E2D\u6709\u54EA\u4E9B\u91CD\u8981\u53D8\u66F4
173
- - \u5BF9\u6BD4 CHANGELOG \u7684 [Unreleased] \u90E8\u5206
174
- - \u8BC6\u522B\u9057\u6F0F\u7684\u6761\u76EE
171
+ 1. **Compare**
172
+ - Review important changes in recent commits.
173
+ - Compare them with the CHANGELOG [Unreleased] section.
174
+ - Identify missing entries.
175
175
 
176
- 2. **\u8865\u5145\u9057\u6F0F**\uFF08\u5982\u679C\u6709\uFF09\uFF1A
177
- - \u4E3A\u6BCF\u4E2A\u9057\u6F0F\u7684\u53D8\u66F4\u521B\u5EFA\u4E13\u4E1A\u6761\u76EE
178
- - \u5206\u7C7B\uFF1A**Added** / **Changed** / **Fixed** / **Removed**
179
- - \u5305\u542B\u6280\u672F\u7EC6\u8282\u548C\u6587\u4EF6\u8DEF\u5F84
176
+ 2. **Add omissions when clear**
177
+ - Create a professional entry for each missing change.
178
+ - Use **Added** / **Changed** / **Fixed** / **Removed**.
179
+ - Include technical details and file paths where useful.
180
180
 
181
- 3. **\u66F4\u65B0\u6587\u4EF6**\uFF1A
182
- - \u4F7F\u7528 write \u5DE5\u5177\u66F4\u65B0 CHANGELOG.md
183
- - \u5982\u679C\u4E0D\u5B58\u5728\uFF0C\u521B\u5EFA\u6807\u51C6\u683C\u5F0F
184
- - \u53EA\u6DFB\u52A0\u9057\u6F0F\u7684\u6761\u76EE\uFF0C\u4FDD\u6301\u73B0\u6709\u5185\u5BB9
181
+ 3. **Update file**
182
+ - Use the write tool to update CHANGELOG.md.
183
+ - Create a standard format if it does not exist.
184
+ - Only add missing entries; preserve existing content.
185
185
 
186
- 4. **\u62A5\u544A\u7ED3\u679C**\uFF1A
187
- - \u6DFB\u52A0\u4E86\u54EA\u4E9B\u6761\u76EE
188
- - \u662F\u5426\u6709\u4E0D\u786E\u5B9A\u662F\u5426\u9700\u8981\u8BB0\u5F55\u7684\u5185\u5BB9`;
186
+ 4. **Report**
187
+ - State which entries were added.
188
+ - Mention any uncertain items that may or may not need changelog coverage.`;
189
189
  }
190
190
  });
191
191
  ctx.log("Changelog extension ready");
@@ -28,48 +28,48 @@ function buildResearchPrompt(params) {
28
28
  const { isUpdate, existingContent, userIntent, cwd, projectRoot, agentsPath } = params;
29
29
  if (isUpdate && existingContent) {
30
30
  const truncatedContent = existingContent.length > 4e3 ? existingContent.slice(0, 4e3) + "\n... (truncated)" : existingContent;
31
- return `\u{1F4DD} \u66F4\u65B0 root AGENTS.md \u9879\u76EE\u4E0A\u4E0B\u6587
31
+ return `Update root AGENTS.md project context
32
32
 
33
- \u76EE\u6807\u6587\u4EF6\uFF1A${agentsPath}
34
- \u9879\u76EE\u6839\u76EE\u5F55\uFF1A${projectRoot}
35
- \u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55\uFF1A${cwd}
33
+ Target file: ${agentsPath}
34
+ Project root: ${projectRoot}
35
+ Current working directory: ${cwd}
36
36
 
37
- \u5F53\u524D root AGENTS.md \u5185\u5BB9\uFF1A
37
+ Current root AGENTS.md content:
38
38
  \`\`\`
39
39
  ${truncatedContent}
40
40
  \`\`\`
41
41
 
42
- ${userIntent ? `\u{1F4CC} \u7528\u6237\u66F4\u65B0\u610F\u56FE\uFF1A${userIntent}
42
+ ${userIntent ? `User update intent: ${userIntent}
43
43
 
44
- ` : ""}\u8BF7\u91CD\u65B0\u7814\u7A76\u9879\u76EE\u5E76\u66F4\u65B0 root AGENTS.md\uFF1A
44
+ ` : ""}Re-study the project and update root AGENTS.md:
45
45
 
46
- 1. \u4FDD\u6301 AGENTS.md \u662F progressive disclosure index\uFF0C\u4E0D\u8981\u5199\u6210\u957F\u7BC7\u9879\u76EE\u767E\u79D1
47
- 2. \u4FDD\u7559\u7B80\u77ED root instructions\uFF0C\u7136\u540E\u7EF4\u62A4 Repo Map
48
- 3. Repo Map \u91CC\u7684\u6BCF\u4E2A\u91CD\u8981\u76EE\u5F55\u90FD\u8981\u6709 desc\uFF0C\u8BF4\u660E\u4EC0\u4E48\u65F6\u5019\u9700\u8981\u8BFB\u8BE5\u76EE\u5F55\u6216\u76F8\u5173\u6587\u6863
49
- 4. \u53EA\u8865\u5145\u7A33\u5B9A\u89C4\u5219\u3001\u76EE\u5F55\u8DEF\u7531\u3001\u9A8C\u8BC1\u95E8\u7981\u548C\u751F\u6210\u7269\u89C4\u5219
50
- 5. \u5220\u9664\u8FC7\u65F6\u6216\u91CD\u590D README/ARCHITECTURE \u7684\u5927\u6BB5\u5185\u5BB9
46
+ 1. Keep AGENTS.md as a progressive-disclosure index, not a long project encyclopedia.
47
+ 2. Keep concise root instructions and maintain the Repo Map.
48
+ 3. Give each important directory in the Repo Map a desc that says when to read it and what it owns.
49
+ 4. Include only stable rules, directory routing, verification gates, and generated-artifact rules.
50
+ 5. Remove stale or duplicate material already covered by README/ARCHITECTURE.
51
51
 
52
- \u8BF7\u4F7F\u7528 write_file \u5DE5\u5177\u66F4\u65B0\u76EE\u6807\u6587\u4EF6\uFF1A${agentsPath}
53
- CLI \u6587\u4EF6\u5DE5\u5177\u4F1A\u4EE5\u9879\u76EE\u6839\u76EE\u5F55\u4F5C\u4E3A\u8BBF\u95EE\u8FB9\u754C\uFF1B\u4E0D\u8981\u4F7F\u7528\u989D\u5916\u7684 root \u53C2\u6570\u3002`;
52
+ Use write_file to update the target file: ${agentsPath}
53
+ CLI file tools use the project root as their access boundary; do not pass an extra root parameter.`;
54
54
  }
55
- return `\u{1F50D} \u521D\u59CB\u5316 root AGENTS.md \u9879\u76EE\u4E0A\u4E0B\u6587
55
+ return `Initialize root AGENTS.md project context
56
56
 
57
- \u76EE\u6807\u6587\u4EF6\uFF1A${agentsPath}
58
- \u9879\u76EE\u6839\u76EE\u5F55\uFF1A${projectRoot}
59
- \u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55\uFF1A${cwd}
57
+ Target file: ${agentsPath}
58
+ Project root: ${projectRoot}
59
+ Current working directory: ${cwd}
60
60
 
61
- ${userIntent ? `\u{1F4CC} \u7528\u6237\u7814\u7A76\u610F\u56FE\uFF1A${userIntent}
61
+ ${userIntent ? `User research intent: ${userIntent}
62
62
 
63
- ` : ""}\u8BF7\u7814\u7A76\u5F53\u524D\u9879\u76EE\u5E76\u521B\u5EFA root \`AGENTS.md\`\u3002\u8FD9\u4E2A\u6587\u4EF6\u5E94\u8BE5\u662F progressive disclosure index\uFF0C\u7528\u6765\u6307\u5BFC\u540E\u7EED agent \u6309\u9700\u8BFB\u53D6\u76F8\u5173\u6587\u6863\uFF0C\u800C\u4E0D\u662F\u4E00\u6B21\u6027\u603B\u7ED3\u6574\u4E2A\u4ED3\u5E93\u3002
63
+ ` : ""}Study the current project and create root \`AGENTS.md\`. This file should be a progressive-disclosure index that tells future agents what to read on demand, not a full repository summary.
64
64
 
65
- \u7814\u7A76\u4EFB\u52A1\uFF1A
66
- 1. \u8BC6\u522B\u9879\u76EE\u7C7B\u578B\u548C\u6280\u672F\u6808\uFF08\u67E5\u770B package.json, Cargo.toml, go.mod, requirements.txt, pyproject.toml \u7B49\uFF09
67
- 2. \u63A2\u7D22\u9876\u5C42\u76EE\u5F55\u7ED3\u6784\u548C\u5173\u952E package/product \u8FB9\u754C
68
- 3. \u8BFB\u53D6 README\u3001ARCHITECTURE\u3001docs/public-api \u7B49\u5DF2\u6709\u6587\u6863\uFF0C\u907F\u514D\u91CD\u590D\u7C98\u8D34
69
- 4. \u8BC6\u522B\u751F\u6210\u7269\u89C4\u5219\u3001\u6D4B\u8BD5\u95E8\u7981\u3001\u4EE3\u7801\u5206\u5C42\u548C\u9AD8\u98CE\u9669\u6539\u52A8\u8FB9\u754C
70
- 5. \u751F\u6210\u7B80\u77ED\u3001\u7A33\u5B9A\u3001\u53EF\u7EF4\u62A4\u7684\u76EE\u5F55\u8DEF\u7531\u8BF4\u660E
65
+ Research tasks:
66
+ 1. Identify project type and technology stack (package.json, Cargo.toml, go.mod, requirements.txt, pyproject.toml, etc.).
67
+ 2. Inspect the top-level directory structure and key package/product boundaries.
68
+ 3. Read existing README, ARCHITECTURE, docs/public-api, and similar docs to avoid duplicating them.
69
+ 4. Identify generated-artifact rules, verification gates, layering, and high-risk change boundaries.
70
+ 5. Produce concise, stable, maintainable directory-routing guidance.
71
71
 
72
- \u8BF7\u751F\u6210\u5305\u542B\u4EE5\u4E0B\u7AE0\u8282\u7684 AGENTS.md\uFF1A
72
+ Generate AGENTS.md with these sections:
73
73
 
74
74
  \`\`\`
75
75
  # AGENTS.md
@@ -91,8 +91,8 @@ Rules for AGENTS.md, generated bundles, and source-of-truth files.
91
91
  Which focused tests/checks to run by touched area.
92
92
  \`\`\`
93
93
 
94
- \u8BF7\u4F7F\u7528 write_file \u5DE5\u5177\u521B\u5EFA\u76EE\u6807\u6587\u4EF6\uFF1A${agentsPath}
95
- CLI \u6587\u4EF6\u5DE5\u5177\u4F1A\u4EE5\u9879\u76EE\u6839\u76EE\u5F55\u4F5C\u4E3A\u8BBF\u95EE\u8FB9\u754C\uFF1B\u4E0D\u8981\u4F7F\u7528\u989D\u5916\u7684 root \u53C2\u6570\u3002`;
94
+ Use write_file to create the target file: ${agentsPath}
95
+ CLI file tools use the project root as their access boundary; do not pass an extra root parameter.`;
96
96
  }
97
97
  async function initExtension(ctx) {
98
98
  ctx.log("Init extension loaded");
@@ -108,34 +108,41 @@ async function initExtension(ctx) {
108
108
  } catch (err) {
109
109
  ctx.log(`Failed to pre-load root AGENTS.md: ${err}`);
110
110
  }
111
- ctx.registerCommand({
112
- path: ["tools", "init"],
113
- description: "\u7814\u7A76\u9879\u76EE\u5E76\u751F\u6210/\u66F4\u65B0 root AGENTS.md \u9879\u76EE\u4E0A\u4E0B\u6587\u7D22\u5F15",
114
- handler: async (ctx2, args) => {
115
- const existing = await loadExistingKnowledge(ctx2.cwd);
116
- const existingContent = existing.content;
117
- const isUpdate = !!existing.content;
118
- const userIntent = args?.trim();
119
- cachedKnowledge = existingContent;
120
- if (isUpdate) {
121
- if (userIntent) {
122
- ctx2.ui.notify(`\u{1F4DD} \u6B63\u5728\u66F4\u65B0\u9879\u76EE\u77E5\u8BC6\uFF08${userIntent}\uFF09...`, "info");
123
- } else {
124
- ctx2.ui.notify("\u{1F4DD} \u6B63\u5728\u66F4\u65B0 root AGENTS.md...", "info");
125
- }
111
+ const handler = async (ctx2, args) => {
112
+ const existing = await loadExistingKnowledge(ctx2.cwd);
113
+ const existingContent = existing.content;
114
+ const isUpdate = !!existing.content;
115
+ const userIntent = args?.trim();
116
+ cachedKnowledge = existingContent;
117
+ if (isUpdate) {
118
+ if (userIntent) {
119
+ ctx2.ui.notify(`Updating project knowledge (${userIntent})...`, "info");
126
120
  } else {
127
- ctx2.ui.notify("\u{1F50D} \u6B63\u5728\u521D\u59CB\u5316 root AGENTS.md...", "info");
121
+ ctx2.ui.notify("Updating root AGENTS.md...", "info");
128
122
  }
129
- const researchPrompt = buildResearchPrompt({
130
- isUpdate,
131
- existingContent,
132
- userIntent,
133
- cwd: ctx2.cwd,
134
- projectRoot: existing.target.projectRoot,
135
- agentsPath: existing.target.agentsPath
136
- });
137
- return researchPrompt;
123
+ } else {
124
+ ctx2.ui.notify("Initializing root AGENTS.md...", "info");
138
125
  }
126
+ const researchPrompt = buildResearchPrompt({
127
+ isUpdate,
128
+ existingContent,
129
+ userIntent,
130
+ cwd: ctx2.cwd,
131
+ projectRoot: existing.target.projectRoot,
132
+ agentsPath: existing.target.agentsPath
133
+ });
134
+ return researchPrompt;
135
+ };
136
+ ctx.registerCommand({
137
+ path: ["tools", "init"],
138
+ description: "Research the project and create or update the root AGENTS.md index",
139
+ handler
140
+ });
141
+ ctx.registerCommand({
142
+ path: ["init"],
143
+ hidden: true,
144
+ description: "Research the project and create or update the root AGENTS.md index",
145
+ handler
139
146
  });
140
147
  ctx.log("Init extension ready");
141
148
  }
@@ -7,7 +7,7 @@ import {
7
7
  isPlanModeSafeCommand,
8
8
  markCompletedPlanSteps,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-L63BJMTT.js";
10
+ } from "../../../chunks/chunk-BOFCKEV5.js";
11
11
  import "../../../chunks/chunk-4B42ZU4B.js";
12
12
  import "../../../chunks/chunk-64XJIKVK.js";
13
13
  import "../../../chunks/chunk-TG2EQLX2.js";
@@ -1,11 +1,11 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createCliHostCapabilities
4
- } from "../../../chunks/chunk-BDDSZSHX.js";
4
+ } from "../../../chunks/chunk-PLJQYVFC.js";
5
5
  import {
6
6
  createSharedFileSystemTools,
7
7
  createSubagentCapability
8
- } from "../../../chunks/chunk-L63BJMTT.js";
8
+ } from "../../../chunks/chunk-BOFCKEV5.js";
9
9
  import "../../../chunks/chunk-4B42ZU4B.js";
10
10
  import "../../../chunks/chunk-64XJIKVK.js";
11
11
  import "../../../chunks/chunk-TG2EQLX2.js";
@@ -7,7 +7,7 @@ import {
7
7
  executeManageTodoList,
8
8
  executionStateToTodos,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-L63BJMTT.js";
10
+ } from "../../../chunks/chunk-BOFCKEV5.js";
11
11
  import "../../../chunks/chunk-4B42ZU4B.js";
12
12
  import "../../../chunks/chunk-64XJIKVK.js";
13
13
  import "../../../chunks/chunk-TG2EQLX2.js";