pi-readseek 0.7.0 → 0.7.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.
Files changed (3) hide show
  1. package/README.md +10 -4
  2. package/index.ts +15 -0
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -5,6 +5,10 @@ editing, anchored grep, structural maps, symbol navigation, and structural searc
5
5
  Pi's built-in tools remain unchanged by default. `replacedTools` can register the
6
6
  corresponding ReadSeek implementations under built-in names.
7
7
 
8
+ When the ReadSeek binary is available, the extension adds model guidance that
9
+ prefers its anchored read, edit, write, rename, and syntax-check workflow while
10
+ leaving Pi's built-ins available as fallbacks.
11
+
8
12
  ## Installation
9
13
 
10
14
  ```sh
@@ -18,17 +22,19 @@ binary automatically on supported platforms.
18
22
 
19
23
  - `readSeek_read`: reads text with `LINE:HASH` anchors; when image modes are
20
24
  enabled, images and PDFs can be returned as base64 or analyzed locally.
21
- PDF reads return one selected page at a time by default.
25
+ PDF reads select one page by default and accept an explicit page.
22
26
  - `readSeek_edit`: edits existing text files using fresh `LINE:HASH` anchors.
23
27
  - `readSeek_grep`: searches text and returns edit-ready anchors.
24
28
  - `readSeek_search`: searches code by structural AST pattern.
25
29
  - `readSeek_refs`: finds identifier references with enclosing symbols.
26
- - `readSeek_rename`: plans or applies binding-aware renames; workspace matches are
27
- name-based where binding support is unavailable.
30
+ - `readSeek_rename`: applies a binding-aware verified rename by default;
31
+ `apply: false` returns a dry-run plan. Workspace matches are name-based where
32
+ binding support is unavailable.
28
33
  - `readSeek_hover`: identifies the cursor token and enclosing symbol.
29
34
  - `readSeek_def`: finds structural symbol definitions.
30
35
  - `readSeek_check`: checks a source file for parser errors and missing syntax.
31
- - `readSeek_view`: views an indexed PDF overview or narrows it by page, node, kind, or depth.
36
+ - `readSeek_view`: creates or reuses a PDF index, returns its overview, or
37
+ narrows it by page, node, kind, or depth.
32
38
  - `readSeek_write`: creates or overwrites whole files and returns anchors.
33
39
 
34
40
  ## Settings
package/index.ts CHANGED
@@ -47,6 +47,16 @@ function formatSettingsWarning(warning: ReadSeekSettingsWarning): string {
47
47
  return `${warning.message} (${warning.source})`;
48
48
  }
49
49
 
50
+ function editingPolicy(readName: string, editName: string, writeName: string): string {
51
+ return [
52
+ "ReadSeek editing policy:",
53
+ `- Prefer ${readName} when preparing to edit existing text; its LINE:HASH anchors are required by ${editName}.`,
54
+ `- Prefer ${editName} for existing text files, ${writeName} for whole-file creation or replacement, and readSeek_rename for symbol renames.`,
55
+ "- Do not use Pi's built-in edit or write when the corresponding ReadSeek tool is available.",
56
+ "- Use readSeek_check after source edits for a quick syntax check.",
57
+ ].join("\n");
58
+ }
59
+
50
60
  export default function piReadSeekExtension(pi: ExtensionAPI): void {
51
61
  const sessionAnchors = new SessionAnchors();
52
62
  const markAnchored = (absolutePath: string) => sessionAnchors.markAnchored(absolutePath);
@@ -92,6 +102,11 @@ export default function piReadSeekExtension(pi: ExtensionAPI): void {
92
102
  registerViewTool(pi);
93
103
  registerWriteTool(pi, { onFileAnchored: markAnchored, name: writeName });
94
104
 
105
+ pi.on("before_agent_start", (event) => {
106
+ if (!binaryAvailable) return;
107
+ return { systemPrompt: `${event.systemPrompt}\n\n${editingPolicy(readName, editName, writeName)}` };
108
+ });
109
+
95
110
  pi.on("session_start", (_event, ctx) => {
96
111
  sessionAnchors.clear();
97
112
  const { warnings } = resolveReadSeekJsonSettings();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-readseek",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Pi extension for readseek-backed hash-anchored read/edit/grep, structural code maps, structural search, and file exploration",
5
5
  "type": "module",
6
6
  "exports": {
@@ -39,7 +39,7 @@
39
39
  "node": ">=20.0.0"
40
40
  },
41
41
  "dependencies": {
42
- "@jarkkojs/readseek": "^0.7.0",
42
+ "@jarkkojs/readseek": "^0.7.1",
43
43
  "diff": "^8.0.3",
44
44
  "xxhash-wasm": "^1.1.0"
45
45
  },