Skip to content

Commit ed42608

Browse files
gtrrz-victorclaude
andcommitted
fix(pi): single-quote the extension ENTIRE_CMD so local-dev is valid JS
The launcher value (LocalDevHookScript) carries its own shell quotes, so the double-quoted template literal produced the malformed const ENTIRE_CMD = ""\$(git rev-parse --show-toplevel)"/scripts/entire-dev". Switch the template to single quotes, matching opencode, so the value nests cleanly and the shell still sees the space-protecting quotes via sh -c. Regenerate the dogfood .pi extension and pin the exact generated line in the local-dev test (the old substring check passed on the broken output). Addresses PR review feedback. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Entire-Checkpoint: 01KY9X6EJ1EK9MAGYJSVC8XVQN
1 parent a4151e2 commit ed42608

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

.pi/extensions/entire/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
1111
import { execFile } from "node:child_process";
1212

1313
export default function (pi: ExtensionAPI) {
14-
const ENTIRE_CMD = ""$(git rev-parse --show-toplevel)"/scripts/entire-dev";
14+
const ENTIRE_CMD = '"$(git rev-parse --show-toplevel)"/scripts/entire-dev';
1515
let pendingSkillEvents: Array<{ skill_name: string; invocation: string; timestamp: string }> = [];
1616

1717
// fireHook pipes data to `entire hooks pi <hookName>` and resolves with the

cmd/entire/cli/agent/pi/entire_extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
1111
import { execFile } from "node:child_process";
1212

1313
export default function (pi: ExtensionAPI) {
14-
const ENTIRE_CMD = "__ENTIRE_CMD__";
14+
const ENTIRE_CMD = '__ENTIRE_CMD__';
1515
let pendingSkillEvents: Array<{ skill_name: string; invocation: string; timestamp: string }> = [];
1616

1717
// fireHook pipes data to `entire hooks pi <hookName>` and resolves with the

cmd/entire/cli/agent/pi/hooks_test.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestInstallHooks_FreshInstall(t *testing.T) {
2929
}
3030
body := string(data)
3131

32-
if !strings.Contains(body, `const ENTIRE_CMD = "entire"`) {
32+
if !strings.Contains(body, `const ENTIRE_CMD = 'entire'`) {
3333
t.Error("production ENTIRE_CMD missing")
3434
}
3535
if !strings.Contains(body, "hooks pi ") {
@@ -53,8 +53,13 @@ func TestInstallHooks_LocalDev(t *testing.T) {
5353
if err != nil {
5454
t.Fatal(err)
5555
}
56-
if !strings.Contains(string(data), `"$(git rev-parse --show-toplevel)"/scripts/entire-dev`) {
57-
t.Error("local-dev extension should delegate to the entire-dev launcher via git rev-parse")
56+
// Assert the exact, well-formed line. The launcher value carries its own
57+
// shell quotes, so the template must wrap the placeholder in single quotes;
58+
// wrapping in double quotes yields the malformed `""$(...)"/..."` (a broken
59+
// JS string literal). A substring check alone would pass on that broken
60+
// output, so pin the whole line.
61+
if !strings.Contains(string(data), `const ENTIRE_CMD = '"$(git rev-parse --show-toplevel)"/scripts/entire-dev'`) {
62+
t.Errorf("local-dev ENTIRE_CMD malformed; got:\n%s", data)
5863
}
5964
}
6065

0 commit comments

Comments
 (0)