@trim21/personal-pi-extensions 0.0.400 → 0.0.401

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.0.400",
3
+ "version": "0.0.401",
4
4
  "type": "module",
5
5
  "description": "Custom pi coding-agent extensions: bwrap sandbox, workspace guard, opencode edit, and more",
6
6
  "keywords": [
@@ -6,6 +6,8 @@ The working directory persists between commands, but shell state does not. The s
6
6
 
7
7
  Commands run in a sandbox: no write access outside the workspace and no network access. Use the `dangerouslyDisableSandbox` parameter to request unsandboxed execution; the user must approve this request.
8
8
 
9
+ Long command output is automatically truncated and the full output is saved to a file. Avoid piping commands through `tail` to limit output unless you have a specific reason.
10
+
9
11
  IMPORTANT: Avoid using this tool to run `find`, `grep`, `cat`, `head`, `tail`, `sed`, `awk`, or `echo` commands, unless explicitly instructed or after you have verified that a dedicated tool cannot accomplish your task. Instead, use the appropriate dedicated tool as this will provide a much better experience for the user:
10
12
 
11
13
  - File search: Use Glob (NOT find or ls)
@@ -0,0 +1,7 @@
1
+ ### Bash tool
2
+
3
+ Executes a given bash command synchronously and returns its output.
4
+
5
+ Commands run in a sandbox: no write access outside the workspace and no network access. Use the `dangerouslyDisableSandbox` parameter to request unsandboxed execution; the user must approve this request.
6
+
7
+ Long command output is automatically truncated and the full output is saved to a file. Avoid piping commands through `tail` to limit output unless you have a specific reason.
@@ -1,3 +1,6 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { fileURLToPath } from "node:url";
3
+
1
4
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
5
  import { Type } from "typebox";
3
6
 
@@ -10,6 +13,9 @@ const MAX_TIMEOUT_MS = 600_000;
10
13
  /** 对齐上游 opencode 的截断提示文案(tools/BashTool/bash.ts)。 */
11
14
  const CAPTURE_TRUNCATED_NOTICE = "[output capture truncated at the in-memory safety limit]";
12
15
 
16
+ /** Bash tool guidance, kept in markdown so it reads like documentation. */
17
+ const BASH_PROMPT = readFileSync(fileURLToPath(new URL("bash.md", import.meta.url)), "utf8").trim();
18
+
13
19
  /**
14
20
  * 对齐上游 opencode(packages/core/src/tool/bash.ts):
15
21
  * 命令失败(非 0 退出码)与超时都不抛错,输出与状态文本一起返回,
@@ -32,6 +38,7 @@ export default function opencodeBash(
32
38
  "Every command runs in the foreground. Background command execution is not supported; shell jobs are waited for before the tool returns.",
33
39
  ].join("\n"),
34
40
  promptSnippet: "execute bash command",
41
+ promptGuidelines: [BASH_PROMPT],
35
42
  parameters: Type.Object(
36
43
  {
37
44
  command: Type.String({ description: "The command to execute" }),