@trim21/personal-pi-extensions 0.0.302 → 0.0.303

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/aft/tools.ts +8 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trim21/personal-pi-extensions",
3
- "version": "0.0.302",
3
+ "version": "0.0.303",
4
4
  "type": "module",
5
5
  "description": "Custom pi coding-agent extensions: bwrap sandbox, workspace guard, opencode edit, and more",
6
6
  "keywords": [
package/src/aft/tools.ts CHANGED
@@ -42,14 +42,14 @@ export function bridgeFor(ctx: AftToolContext): AftProjectTransport {
42
42
 
43
43
  const OutlineParams = Type.Object(
44
44
  {
45
- target: Type.Union([Type.String(), Type.Array(Type.String())], {
45
+ target: Type.String({
46
46
  description:
47
- "要 outline 的对象:文件路径、目录路径、URL(http:// 或 https://),或文件路径数组。模式自动识别:URL 按前缀、目录按 stat、数组按多文件。目录递归上限 200 个文件。",
47
+ "要 outline 的对象:文件路径、目录路径或 URL(http:// 或 https://)。只接受单个 target;目录递归上限 200 个文件。",
48
48
  }),
49
49
  files: Type.Optional(
50
50
  Type.Boolean({
51
51
  description:
52
- "目录模式:为 true 时 target 必须是目录(或目录数组),返回带语言/符号数/字节大小的扁平文件树,而非符号大纲。",
52
+ "目录模式:为 true 时 target 必须是目录,返回带语言/符号数/字节大小的扁平文件树,而非符号大纲。",
53
53
  }),
54
54
  ),
55
55
  includeTests: Type.Optional(
@@ -67,24 +67,20 @@ export function registerOutlineTool(pi: ExtensionAPI, ctx: AftToolContext): void
67
67
  "输出代码文件、目录、URL 的结构化大纲:函数/类/类型等符号及其行号范围;Markdown/HTML 返回标题层级。",
68
68
  "用它在读取具体内容之前先了解文件结构(比整文件 read 省 token)。",
69
69
  "深入了解某个符号用 aft_zoom;看跨文件调用关系用 aft_callgraph。",
70
- "target 支持:文件路径(带签名的符号大纲)、目录路径(递归最多 200 文件)、URL、文件路径数组。",
70
+ "target 支持:文件路径(带签名的符号大纲)、目录路径(递归最多 200 文件)、URL。只接受单个 target。",
71
71
  "files: true 且 target 为目录时返回扁平文件树(语言、顶层符号数、字节大小)。",
72
72
  ].join("\n"),
73
73
  promptSnippet: "Output structural outline of a file/directory/URL",
74
74
  parameters: OutlineParams,
75
75
  async execute(_id, params, _signal, _onUpdate, extCtx) {
76
76
  const target = coerceTargetParam(params.target);
77
- if (
78
- (typeof target !== "string" || target.length === 0) &&
79
- (!Array.isArray(target) || target.length === 0)
80
- ) {
81
- throw new Error("'target' must be a non-empty string or array of strings");
77
+ if (typeof target !== "string" || target.length === 0) {
78
+ throw new Error("'target' must be a single path or URL (array targets are not supported)");
82
79
  }
83
80
  const filesMode = coerceBoolean(params.files);
84
81
  const rawArgs: Record<string, unknown> = {
85
- target: Array.isArray(target)
86
- ? target.map((t) => resolvePathArg(extCtx.cwd, t))
87
- : filesMode || target.startsWith("http://") || target.startsWith("https://")
82
+ target:
83
+ filesMode || target.startsWith("http://") || target.startsWith("https://")
88
84
  ? target
89
85
  : resolvePathArg(extCtx.cwd, target),
90
86
  };