pi-hashline-edit-pro 0.16.8 → 0.16.10

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/index.ts CHANGED
@@ -7,6 +7,7 @@ import { regReplaceFlat } from "./src/replace-flat";
7
7
  import { regReplaceUndo } from "./src/replace-undo";
8
8
  import { regRead, fmtReadPreview } from "./src/read";
9
9
  import { toLF, stripBOM } from "./src/replace-diff";
10
+ import { resolveTarget } from "./src/fs-write";
10
11
  import { visLines } from "./src/utils";
11
12
  import { AUTO_READ_MAX } from "./src/constants";
12
13
  import {
@@ -88,13 +89,14 @@ export default function (pi: ExtensionAPI): void {
88
89
 
89
90
  try {
90
91
  const absolutePath = isAbsolute(filePath) ? filePath : join(ctx.cwd, filePath);
91
- const content = await readFile(absolutePath, "utf-8");
92
+ const resolvedPath = await resolveTarget(absolutePath);
93
+ const content = await readFile(resolvedPath, "utf-8");
92
94
  const { text: rawContent } = stripBOM(content);
93
95
  const normalized = toLF(rawContent);
94
96
 
95
97
  if (visLines(normalized).length === 0) return;
96
98
 
97
- const preview = await fmtReadPreview(normalized, { limit: AUTO_READ_MAX }, undefined, absolutePath);
99
+ const preview = await fmtReadPreview(normalized, { limit: AUTO_READ_MAX }, undefined, resolvedPath);
98
100
 
99
101
  return {
100
102
  content: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-hashline-edit-pro",
3
- "version": "0.16.8",
3
+ "version": "0.16.10",
4
4
  "description": "Strict hashline read/replace tool for pi-coding-agent with hash-anchored edits (3-char, 18-bit, perfect hashing)",
5
5
  "main": "index.ts",
6
6
  "repository": {
package/src/hash-store.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { readFile, writeFile, mkdir } from "fs/promises";
1
+ import { readFile, mkdir } from "fs/promises";
2
2
  import { stat } from "fs/promises";
3
3
  import { hashStorePath, hashStoreDir } from "./paths";
4
4
  import { errCode } from "./validation";
5
+ import { writeAtomic } from "./fs-write";
5
6
 
6
7
  export interface FileSnapshot {
7
8
  content: string;
@@ -30,14 +31,14 @@ export async function loadHashStore(): Promise<HashStore> {
30
31
  version: 1,
31
32
  snapshots: {},
32
33
  };
33
- await writeFile(hashStorePath(), JSON.stringify(defaultStore), "utf-8");
34
+ await writeAtomic(hashStorePath(), JSON.stringify(defaultStore));
34
35
  return defaultStore;
35
36
  }
36
37
  }
37
38
 
38
39
  export async function saveHashStore(store: HashStore): Promise<void> {
39
40
  await mkdir(hashStoreDir(), { recursive: true });
40
- await writeFile(hashStorePath(), JSON.stringify(store, null, 2), "utf-8");
41
+ await writeAtomic(hashStorePath(), JSON.stringify(store, null, 2));
41
42
  }
42
43
 
43
44
  export async function pruneHashStore(store: HashStore): Promise<void> {