@oh-my-pi/pi-coding-agent 13.7.4 → 13.7.5

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,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-coding-agent",
4
- "version": "13.7.4",
4
+ "version": "13.7.5",
5
5
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
7
7
  "author": "Can Boluk",
@@ -41,12 +41,12 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@mozilla/readability": "^0.6",
44
- "@oh-my-pi/omp-stats": "13.7.4",
45
- "@oh-my-pi/pi-agent-core": "13.7.4",
46
- "@oh-my-pi/pi-ai": "13.7.4",
47
- "@oh-my-pi/pi-natives": "13.7.4",
48
- "@oh-my-pi/pi-tui": "13.7.4",
49
- "@oh-my-pi/pi-utils": "13.7.4",
44
+ "@oh-my-pi/omp-stats": "13.7.5",
45
+ "@oh-my-pi/pi-agent-core": "13.7.5",
46
+ "@oh-my-pi/pi-ai": "13.7.5",
47
+ "@oh-my-pi/pi-natives": "13.7.5",
48
+ "@oh-my-pi/pi-tui": "13.7.5",
49
+ "@oh-my-pi/pi-utils": "13.7.5",
50
50
  "@sinclair/typebox": "^0.34",
51
51
  "@xterm/headless": "^6.0",
52
52
  "ajv": "^8.18",
@@ -1,41 +1,40 @@
1
- Applies precise file edits using `LINE#ID` tags from `read` output.
1
+ Applies precise, surgical file edits by referencing `LINE#ID` tags from `read` output. Each tag uniquely identifies a line, so edits remain stable even when lines shift.
2
2
 
3
3
  <workflow>
4
- 1. You **SHOULD** issue a `read` call before editing if you have no tagged context for a file.
5
- 2. You **MUST** pick the smallest operation per change site.
6
- 3. You **MUST** submit one `edit` call per file with all operations, think your changes through before submitting.
4
+ Follow these steps in order for every edit:
5
+ 1. You **SHOULD** issue a `read` call before editing to get fresh `LINE#ID` tags. Editing without current tags causes mismatches because other edits or external changes may have shifted line numbers since your last read.
6
+ 2. You **MUST** submit one `edit` call per file with all operations. Multiple calls to the same file require re-reading between each one (tags shift after each edit), so batching avoids wasted round-trips. Think your changes through before submitting.
7
+ 3. You **MUST** pick the smallest operation per change site. Each operation should be one logical mutation — a single replace, insert, or delete. Combining unrelated changes into one operation makes errors harder to diagnose and recover from.
7
8
  </workflow>
8
9
 
9
10
  <operations>
10
11
  **`path`** — the path to the file to edit.
11
12
  **`move`** — if set, move the file to the given path.
12
13
  **`delete`** — if true, delete the file.
13
- **`edits.[n].pos`** — the anchor line. Meaning depends on `op`:
14
+ **`edits[n].pos`** — the anchor line. Meaning depends on `op`:
14
15
  - `replace`: start of range (or the single line to replace)
15
16
  - `prepend`: insert new lines **before** this line; omit for beginning of file
16
17
  - `append`: insert new lines **after** this line; omit for end of file
17
- **`edits.[n].end`** — range replace only. The last line of the range (inclusive). Omit for single-line replace.
18
- **`edits.[n].lines`** — the replacement content:
18
+ **`edits[n].end`** — range replace only. The last line of the range (inclusive). Omit for single-line replace.
19
+ **`edits[n].lines`** — the replacement content:
19
20
  - `["line1", "line2"]` — replace with these lines (array of strings)
20
21
  - `"line1"` — shorthand for `["line1"]` (single-line replace)
21
22
  - `[""]` — replace content with a blank line (line preserved, content cleared)
22
23
  - `null` or `[]` — **delete** the line(s) entirely
23
24
 
24
- Tags should be referenced from the last `read` output.
25
- Edits are applied bottom-up, so earlier tags stay valid even when later ops add or remove lines.
25
+ Tags are applied bottom-up: later edits (by position) are applied first, so earlier tags remain valid even when subsequent ops add or remove lines. Tags **MUST** be referenced from the most recent `read` output.
26
26
  </operations>
27
27
 
28
28
  <rules>
29
- 1. **Minimize scope:** You **MUST** use one logical mutation per operation.
30
- 2. **Prefer insertion over neighbor rewrites:** You **SHOULD** anchor on structural boundaries (`}`, `]`, `},`), not interior lines.
31
- 3. **Range end tag (inclusive):** `end` is inclusive and **MUST** point to the final line being replaced.
32
- - If `lines` includes a closing boundary token (`}`, `]`, `)`, `);`, `},`), `end` **MUST** include the original boundary line.
33
- - You **MUST NOT** set `end` to an interior line and then re-add the boundary token in `lines`; that duplicates the next surviving line.
29
+ 1. **Anchor on unique, structural lines.** You **SHOULD** choose anchors like function signatures, class declarations, or distinct statements — lines that appear exactly once. Blank lines, `}`, and `return null;` repeat throughout a file; anchoring on them risks matching the wrong location. When inserting between blocks, anchor on the nearest unique declaration using `prepend` or `append`.
30
+ 2. **Prefer insertion over neighbor rewrites.** You **SHOULD** use `prepend`/`append` anchored on a structural boundary (`}`, `]`, `},`) rather than replacing adjacent lines when adding code near existing code. This keeps the edit minimal and avoids accidentally rewriting lines that should stay.
31
+ 3. **Include boundary lines in the replaced range.** `end` is inclusive and **MUST** point to the final line being replaced. If your replacement `lines` include a closing token (`}`, `]`, `)`, `);`, `},`), `end` **MUST** include the original closing line. Otherwise the original closer survives and you get a duplicate.
34
32
  </rules>
35
33
 
36
34
  <recovery>
37
- **Tag mismatch (`>>>`):** You **MUST** retry using fresh tags from the error snippet. If snippet lacks context, or if you repeatedly fail, you **MUST** re-read the file and issue less ambitious edits, i.e. single op.
38
- **No-op (`identical`):** You **MUST NOT** resubmit. Re-read target lines and adjust the edit.
35
+ Edits can fail in two ways. Here is exactly what to do for each:
36
+ 1. **Tag mismatch (`>>>`):** The file changed since your last read, so the tag no longer matches. You **MUST** retry using the fresh tags from the error snippet. If the snippet lacks enough context, or if you fail repeatedly, you **MUST** re-read the entire file and submit a simpler, single-op edit.
37
+ 2. **No-op (`identical`):** Your replacement is identical to the existing content — nothing changed. You **MUST NOT** resubmit the same edit. Re-read the target lines to understand what is actually there, then adjust your edit.
39
38
  </recovery>
40
39
 
41
40
  <example name="single-line replace">
@@ -121,6 +120,7 @@ Range — add `end`:
121
120
  </example>
122
121
 
123
122
  <example name="inclusive end avoids duplicate boundary">
123
+ This example demonstrates why `end` must include the original closing line when your replacement also contains that closer.
124
124
  ```ts
125
125
  {{hlinefull 70 "if (ok) {"}}
126
126
  {{hlinefull 71 " run();"}}
@@ -159,7 +159,6 @@ Good — include original `}` in the replaced range when replacement keeps `}`:
159
159
  }]
160
160
  }
161
161
  ```
162
- Also apply the same rule to `);`, `],`, and `},` closers: if replacement includes the closer token, `end` must include the original closer line.
163
162
  </example>
164
163
 
165
164
  <example name="insert between sibling declarations">
@@ -191,7 +190,7 @@ Use a trailing `""` to preserve the blank line between top-level sibling declara
191
190
  </example>
192
191
 
193
192
  <example name="disambiguate anchors">
194
- Blank lines and repeated patterns (`}`, `return null;`) appear many times never anchor on them when a unique line exists nearby.
193
+ Blank lines and repeated patterns (`}`, `return null;`) appear many times. Always anchor on a unique line nearby instead.
195
194
  ```ts
196
195
  {{hlinefull 101 "}"}}
197
196
  {{hlinefull 102 ""}}
@@ -233,8 +232,8 @@ Good — anchor on the unique declaration line:
233
232
 
234
233
  <critical>
235
234
  - Edit payload: `{ path, edits[] }`. Each entry: `op`, `lines`, optional `pos`/`end`. No extra keys.
236
- - Every tag **MUST** be copied exactly from fresh tool result as `N#ID`.
237
- - You **MUST** re-read after each edit call before issuing another on same file.
238
- - Formatting is a batch operation. You **MUST NOT** use this tool to reformat, reindent, or adjust whitespace — run the project's formatter instead. If the only change is whitespace, it is formatting; do not touch it.
239
- - `lines` entries **MUST** be literal file content with indentation copied exactly from the `read` output. If the file uses tabs, use `\t` in JSON (a real tab character) you **MUST NOT** use `\\t` (two characters: backslash + t), which produces the literal string `\t` in the file.
235
+ - Every tag **MUST** be copied exactly from your most recent `read` output as `N#ID`. Stale or mistyped tags cause mismatches.
236
+ - You **MUST** re-read the file after each edit call before issuing another on the same file. Tags shift after every edit, so reusing old tags produces mismatches.
237
+ - You **MUST NOT** use this tool to reformat, reindent, or adjust whitespace — run the project's formatter instead. If the only difference is whitespace, it is formatting; leave it alone.
238
+ - `lines` entries **MUST** be literal file content with indentation copied exactly from the `read` output. If the file uses tabs, use `\t` in JSON (a real tab character). Using `\\t` (backslash + t) writes the literal two-character string `\t` into the file.
240
239
  </critical>