little-coder 1.4.2 → 1.5.0
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/.pi/extensions/_shared/intervention.test.ts +13 -0
- package/.pi/extensions/_shared/intervention.ts +41 -0
- package/.pi/extensions/benchmark-profiles/index.ts +27 -9
- package/.pi/extensions/benchmark-profiles/profiles.test.ts +53 -44
- package/.pi/extensions/clear-command/index.test.ts +37 -0
- package/.pi/extensions/clear-command/index.ts +26 -0
- package/.pi/extensions/finalize-warn/index.ts +4 -3
- package/.pi/extensions/output-parser/index.ts +4 -3
- package/.pi/extensions/quality-monitor/index.ts +15 -8
- package/.pi/extensions/quality-monitor/quality.test.ts +68 -2
- package/.pi/extensions/quality-monitor/quality.ts +17 -0
- package/.pi/extensions/thinking-budget/budget.test.ts +170 -132
- package/.pi/extensions/thinking-budget/index.ts +118 -52
- package/.pi/extensions/turn-cap/index.ts +4 -3
- package/.pi/extensions/write-guard/index.ts +57 -67
- package/.pi/extensions/write-guard/write-guard.test.ts +102 -2
- package/.pi/settings.json +6 -6
- package/CHANGELOG.md +41 -0
- package/README.md +8 -2
- package/bin/little-coder.mjs +60 -9
- package/package.json +8 -2
- package/scripts/patch-pi.mjs +113 -0
- package/scripts/patch-pi.test.mjs +63 -0
- package/vendor/node-domexception/index.js +9 -0
- package/vendor/node-domexception/package.json +10 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { applyPiPatches, resolvePiRoot, PATCHES } from "./patch-pi.mjs";
|
|
5
|
+
|
|
6
|
+
// These tests are the upgrade safety-net for our pi source patches.
|
|
7
|
+
//
|
|
8
|
+
// A source patch can silently stop suppressing pi's UI marker when pi is
|
|
9
|
+
// upgraded (the surrounding code shifts and the patch no-ops). We never want
|
|
10
|
+
// that to be a silent production regression — so this test FAILS the moment the
|
|
11
|
+
// installed pi no longer matches what a patch expects, telling us to refresh
|
|
12
|
+
// exactly one string in patch-pi.mjs. A pi bump becomes a loud CI failure, not
|
|
13
|
+
// a quiet cosmetic regression for users.
|
|
14
|
+
|
|
15
|
+
describe("pi runtime patches", () => {
|
|
16
|
+
it("resolves the installed pi package root", () => {
|
|
17
|
+
expect(resolvePiRoot(), "could not locate @earendil-works/pi-coding-agent").toBeTruthy();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("applies cleanly and is idempotent", () => {
|
|
21
|
+
// Idempotent: safe to run repeatedly (postinstall + every launch + tests).
|
|
22
|
+
applyPiPatches();
|
|
23
|
+
applyPiPatches();
|
|
24
|
+
const piRoot = resolvePiRoot();
|
|
25
|
+
for (const p of PATCHES) {
|
|
26
|
+
const file = join(piRoot, p.rel);
|
|
27
|
+
if (!existsSync(file)) continue;
|
|
28
|
+
const src = readFileSync(file, "utf8");
|
|
29
|
+
expect(
|
|
30
|
+
src.includes(p.applied),
|
|
31
|
+
`expected patch marker in ${p.rel} after applying`,
|
|
32
|
+
).toBe(true);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("leaves no un-suppressed original block (loud signal to refresh on pi upgrade)", () => {
|
|
37
|
+
applyPiPatches();
|
|
38
|
+
const piRoot = resolvePiRoot();
|
|
39
|
+
for (const p of PATCHES) {
|
|
40
|
+
const file = join(piRoot, p.rel);
|
|
41
|
+
if (!existsSync(file)) continue;
|
|
42
|
+
const src = readFileSync(file, "utf8");
|
|
43
|
+
// After applying, the original block must be gone — either we replaced it,
|
|
44
|
+
// or this pi version no longer ships it. If pi changed *around* the block
|
|
45
|
+
// so our patch silently no-op'd, the original is still present → fail.
|
|
46
|
+
expect(
|
|
47
|
+
src.includes(p.find),
|
|
48
|
+
`pi patch for "${p.rel}" no longer applies — pi likely changed. ` +
|
|
49
|
+
`Refresh the find/replace in scripts/patch-pi.mjs for the new pi version.`,
|
|
50
|
+
).toBe(false);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("the patched file no longer renders the bare \"Operation aborted\" string", () => {
|
|
55
|
+
applyPiPatches();
|
|
56
|
+
const piRoot = resolvePiRoot();
|
|
57
|
+
const file = join(piRoot, PATCHES[0].rel);
|
|
58
|
+
const src = readFileSync(file, "utf8");
|
|
59
|
+
// The literal only survives inside our explanatory comment, never as the
|
|
60
|
+
// rendered fallback (`: "Operation aborted";`).
|
|
61
|
+
expect(src.includes(': "Operation aborted";')).toBe(false);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Drop-in replacement for the deprecated `node-domexception@1.0.0` shim.
|
|
2
|
+
// Bundled with little-coder; wired in via `package.json#overrides` so the
|
|
3
|
+
// transitive `fetch-blob -> node-domexception` chain (pulled in via
|
|
4
|
+
// @earendil-works/pi-ai -> @google/genai -> google-auth-library -> gaxios ->
|
|
5
|
+
// node-fetch -> fetch-blob) doesn't emit a deprecation warning during
|
|
6
|
+
// `npm install -g little-coder`. Native `globalThis.DOMException` has been
|
|
7
|
+
// available since Node 18, and little-coder requires Node >= 22.19, so this
|
|
8
|
+
// is always defined at import time.
|
|
9
|
+
module.exports = globalThis.DOMException;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "node-domexception",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Bundled with little-coder. Returns Node's native globalThis.DOMException (built-in since Node 18). Replaces the deprecated upstream node-domexception@1.0.0 via npm overrides so `npm install -g little-coder` no longer prints its deprecation warning. We pin engines.node to >= 18 because that's where native DOMException landed; the launcher's own preflight enforces >= 22.19, so this is satisfied transitively.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=18.0.0"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT"
|
|
10
|
+
}
|