pi-hashline-edit-pro 0.18.4 → 0.18.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/README.md CHANGED
@@ -103,9 +103,9 @@ On first run after upgrading, a one-time migration imports the previous `hash-st
103
103
  ### Chained edits
104
104
 
105
105
  After a successful replace, the response confirms with `Successfully replaced in {path}. Added X line(s), removed Y line(s).` (warnings are still shown if present). When auto-read is enabled, fresh anchors are appended automatically. Otherwise call `read` to get fresh anchors for follow-up edits.
106
- ### Auto-read after write and replace
106
+ ### Auto-read after write, replace, and undo
107
107
 
108
- Auto-read is **disabled by default**. When enabled, after a successful `write` or `replace` the extension automatically reads the file and appends a `--- Auto-read (hashline anchors) ---` block to the result. This gives the model immediate `HASH│content` anchors for the file without requiring a separate `read` call. The workflow becomes:
108
+ Auto-read is **disabled by default**. When enabled, after a successful `write`, `replace`, or `undo_last_replace` the extension automatically reads the file and appends a `--- Auto-read (hashline anchors) ---` block to the result. This gives the model immediate `HASH│content` anchors for the file without requiring a separate `read` call. The workflow becomes:
109
109
 
110
110
  1. `write` a file, result includes hashline anchors
111
111
  2. `replace` using those anchors directly
package/index.ts CHANGED
@@ -87,8 +87,11 @@ export default function (pi: ExtensionAPI): void {
87
87
  }
88
88
  }
89
89
  if (!autoRead) return;
90
- if (event.toolName !== "write" && event.toolName !== "replace") return;
91
-
90
+ if (
91
+ event.toolName !== "write" &&
92
+ event.toolName !== "replace" &&
93
+ event.toolName !== "undo_last_replace"
94
+ ) return;
92
95
  const filePath = (event.input as Record<string, unknown>)?.path;
93
96
  if (typeof filePath !== "string") return;
94
97
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-hashline-edit-pro",
3
- "version": "0.18.4",
3
+ "version": "0.18.5",
4
4
  "type": "module",
5
5
  "description": "Strict hashline read/replace tool for pi-coding-agent with hash-anchored edits (3-char, 18-bit, perfect hashing)",
6
6
  "main": "index.ts",
@@ -46,7 +46,7 @@
46
46
  "scripts": {
47
47
  "test": "vitest run",
48
48
  "test:watch": "vitest",
49
- "lint": "eslint 'src/**/*.ts' 'index.ts'",
49
+ "lint": "eslint 'src/**/*.ts' 'index.ts' 'test/**/*.ts'",
50
50
  "typecheck": "tsc --noEmit"
51
51
  },
52
52
  "devDependencies": {
package/src/config.ts CHANGED
@@ -21,6 +21,14 @@ function parseConfig(content: string): Config {
21
21
  autoRead: parsed.autoRead === true,
22
22
  };
23
23
  }
24
+
25
+ function envDefaultConfig(): Partial<Config> {
26
+ const autoReadValue = process.env.PI_HASHLINE_AUTO_READ;
27
+ return autoReadValue === "1" || autoReadValue === "true"
28
+ ? { autoRead: true }
29
+ : {};
30
+ }
31
+
24
32
  export async function readConfig(): Promise<Config> {
25
33
  try {
26
34
  const content = await readFile(configPath(), "utf-8");
@@ -29,7 +37,7 @@ export async function readConfig(): Promise<Config> {
29
37
  if (errCode(error) !== "ENOENT") {
30
38
  console.error("Config file corrupted, using defaults:", error);
31
39
  }
32
- return { ...DEFAULT_CONFIG };
40
+ return { ...DEFAULT_CONFIG, ...envDefaultConfig() };
33
41
  }
34
42
  }
35
43
  export async function writeConfig(config: Config): Promise<void> {