@trim21/personal-pi-extensions 0.1.554 → 0.1.556

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trim21/personal-pi-extensions",
3
- "version": "0.1.554",
3
+ "version": "0.1.556",
4
4
  "type": "module",
5
5
  "description": "Custom pi coding-agent extensions: bwrap sandbox, workspace guard, opencode edit, and more",
6
6
  "keywords": [
@@ -0,0 +1,3 @@
1
+ ### AFT 工具
2
+
3
+ 调查代码库时先用 AFT 工具(aft_outline / aft_zoom / aft_callgraph / aft_search)摸清结构、查看符号、追踪调用关系,再退回 grep 或整文件读取——它们成本更低,也是为此专门构建的。
package/src/aft/tools.ts CHANGED
@@ -41,6 +41,14 @@ const SEARCH_PROMPT = readFileSync(
41
41
  fileURLToPath(new URL("search.md", import.meta.url)),
42
42
  "utf8",
43
43
  ).trim();
44
+ /**
45
+ * 四个工具共用的使用准则,挂在结构入口 aft_outline 上注入一次:pi 的
46
+ * promptGuidelines 是 per-tool 的,而这条讲的是整个 AFT 工具集的分工。
47
+ */
48
+ const AFT_GUIDELINES = readFileSync(
49
+ fileURLToPath(new URL("guidelines.md", import.meta.url)),
50
+ "utf8",
51
+ ).trim();
44
52
 
45
53
  export interface AftToolContext {
46
54
  cwd: string;
@@ -124,7 +132,7 @@ export function registerOutlineTool(pi: ExtensionAPI, ctx: AftToolContext): void
124
132
  "target 为目录时默认返回扁平文件树(语言、顶层符号数、字节大小);传 files: false 可改回符号大纲。",
125
133
  ].join("\n"),
126
134
  promptSnippet: "Output structural outline of a file/directory",
127
- promptGuidelines: [OUTLINE_PROMPT],
135
+ promptGuidelines: [OUTLINE_PROMPT, AFT_GUIDELINES],
128
136
  parameters: OutlineParams,
129
137
  async execute(_id, params, signal, _onUpdate, extCtx) {
130
138
  const target = coerceTargetParam(params.target);
@@ -260,8 +260,8 @@ function notifyMode(
260
260
  ctx.ui.notify(labels[mode], "info");
261
261
  }
262
262
 
263
- /** 沙箱默认写边界:根只读、工作区可写、.git 只读。不展开用户配置的额外可写路径。 */
264
- const SANDBOX_WRITE_RULES = "/ is read-only, ./ is writable, ./.git/ is read-only";
263
+ /** 沙箱默认写边界:根只读、工作区与 /tmp 可写、.git 只读。不展开用户配置的额外可写路径。 */
264
+ const SANDBOX_WRITE_RULES = "/ is read-only, /tmp/ and ./ are writable, ./.git/ is read-only";
265
265
 
266
266
  /** 网络层级:关 / 只放行白名单 / 完全放开(白名单域名本身不列出,对判断失败无用)。 */
267
267
  function describeNetwork(resolved: ResolvedBwrap): string {
@@ -17,7 +17,6 @@ In addition to the tools above, you may have access to other custom tools depend
17
17
 
18
18
  ## Doing tasks
19
19
 
20
- - When investigating a codebase, first use the AFT tools (aft_outline / aft_zoom / aft_callgraph / aft_search) to map the structure, inspect named symbols, and trace call relationships before falling back to grep or full-file reads — they are cheaper and purpose-built for this.
21
20
  - The user will primarily request you to perform software engineering tasks. These may include solving bugs, adding new functionality, refactoring code, explaining code, and more. When given an unclear or generic instruction, consider it in the context of these software engineering tasks and the current working directory. For example, if the user asks you to change "methodName" to snake case, do not reply with just "method_name", instead find the method in the code and modify the code.
22
21
  - You are highly capable and often allow users to complete ambitious tasks that would otherwise be too complex or take too long. You should defer to user judgement about whether a task is too large to attempt.
23
22
  - For exploratory questions ("what could we do about X?", "how should we approach this?", "what do you think?"), respond in 2-3 sentences with a recommendation and the main tradeoff. Present it as something the user can redirect, not a decided plan. Don't implement until the user agrees.
Binary file