@criogaid/pi-hashline-edit 0.6.0 → 0.6.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@criogaid/pi-hashline-edit",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Hashline-style file editing for pi — line-anchored edits verified by content hash, replacing oldText/newText matching",
|
|
6
6
|
"homepage": "https://github.com/Criogaid/pi-hashline-edit#readme",
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
* no cross-field constraints. Arguments and TypeBox's process-wide settings are not changed.
|
|
8
8
|
*/
|
|
9
9
|
import { validateToolArguments, type ToolCall } from "@earendil-works/pi-ai";
|
|
10
|
-
import { Type, type Static, type TObject, type TSchema } from "typebox";
|
|
11
|
-
import { ObjectOptions } from "typebox/type";
|
|
10
|
+
import { ObjectOptions, Type, type Static, type TObject, type TSchema } from "typebox";
|
|
12
11
|
import { errorMessage } from "../core/errors.ts";
|
|
13
12
|
import { MAX_BLOCK_BYTES } from "./budgets.ts";
|
|
14
13
|
import { DiagnosticBuffer } from "./diagnostic-buffer.ts";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { execFile as execFileCallback } from "node:child_process";
|
|
2
|
+
import { cp, mkdir, mkdtemp, rm, symlink } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { test } from "node:test";
|
|
7
|
+
import manifest from "../../package.json" with { type: "json" };
|
|
8
|
+
import { promisify } from "node:util";
|
|
9
|
+
|
|
10
|
+
const execFile = promisify(execFileCallback);
|
|
11
|
+
const LOAD_TIMEOUT_MS = 30_000;
|
|
12
|
+
|
|
13
|
+
test("extension installed without devDependencies → loads through Pi's virtual modules", async (t) => {
|
|
14
|
+
const root = await mkdtemp(join(tmpdir(), "hashline-extension-"));
|
|
15
|
+
t.after(() => rm(root, { recursive: true, force: true }));
|
|
16
|
+
const repository = fileURLToPath(new URL("../../", import.meta.url));
|
|
17
|
+
await cp(join(repository, "src"), join(root, "src"), { recursive: true });
|
|
18
|
+
await cp(join(repository, "package.json"), join(root, "package.json"));
|
|
19
|
+
// Link only declared runtime packages; their own transitive dependencies stay resolvable.
|
|
20
|
+
for (const dependency of Object.keys(manifest.dependencies)) {
|
|
21
|
+
const destination = join(root, "node_modules", dependency);
|
|
22
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
23
|
+
await symlink(join(repository, "node_modules", dependency), destination, "junction");
|
|
24
|
+
}
|
|
25
|
+
const entry = join(root, "src", "index.ts");
|
|
26
|
+
await execFile(
|
|
27
|
+
process.execPath,
|
|
28
|
+
[fileURLToPath(new URL("./extension-loading.testing.ts", import.meta.url)), entry],
|
|
29
|
+
{
|
|
30
|
+
env: { ...process.env, NODE_OPTIONS: "", NODE_PATH: "" },
|
|
31
|
+
timeout: LOAD_TIMEOUT_MS,
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Run in a fresh Node process so global loaders and module caches cannot supply devDependencies.
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { createJiti } from "../../node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/jiti-static-loader.js";
|
|
5
|
+
import { VIRTUAL_MODULES } from "../../node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/virtual-modules.js";
|
|
6
|
+
|
|
7
|
+
const entry = process.argv[2];
|
|
8
|
+
assert.throws(() => createRequire(entry).resolve("typebox/type"), { code: "MODULE_NOT_FOUND" });
|
|
9
|
+
const jiti = createJiti(import.meta.url, {
|
|
10
|
+
moduleCache: false,
|
|
11
|
+
virtualModules: VIRTUAL_MODULES,
|
|
12
|
+
tryNative: false,
|
|
13
|
+
});
|
|
14
|
+
const factory = await jiti.import<unknown>(entry, { default: true });
|
|
15
|
+
assert.equal(typeof factory, "function");
|