Skip to content

Commit afe9762

Browse files
authored
fix: run camsnap live proof without pnpm setup (#1246)
* fix(live-proof): resolve pnpm installer binaries * fix(targets): add camsnap Go review profile
1 parent a958131 commit afe9762

5 files changed

Lines changed: 88 additions & 1 deletion

File tree

‎config/target-repositories.json‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,26 @@
8888
"ready_timeout_seconds": 240,
8989
"max_recording_seconds": 90
9090
}
91+
},
92+
{
93+
"target_repo": "steipete/camsnap",
94+
"display_name": "camsnap",
95+
"checkout_dir": "camsnap",
96+
"prompt_note": "Use the camsnap source tree and current main branch. Review camera discovery, RTSP/ONVIF behavior, Go changes, and cross-platform build behavior conservatively. Keep issues and pull requests open for maintainer triage.",
97+
"apply_close_rules": {
98+
"issue": [],
99+
"pull_request": []
100+
},
101+
"package_manager": "npm",
102+
"validation_commands": [],
103+
"changed_gate": null,
104+
"live_test": {
105+
"enabled": true,
106+
"surface_default": "terminal",
107+
"setup": [],
108+
"ready_timeout_seconds": 240,
109+
"max_recording_seconds": 90
110+
}
91111
}
92112
],
93113
"generic_fallbacks": [

‎src/live-proof/execute.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,9 @@ function addPackageManagerToPath(packageManager: string, environment: NodeJS.Pro
406406
packageManager === "bun"
407407
? join(home, ".bun", "bin")
408408
: packageManager === "pnpm"
409-
? environment.PNPM_HOME?.trim() || join(home, ".local", "share", "pnpm")
409+
? environment.PNPM_HOME?.trim()
410+
? join(environment.PNPM_HOME.trim(), "bin")
411+
: join(home, ".local", "share", "pnpm")
410412
: undefined;
411413
if (!directory) return;
412414
const path = environment.PATH ?? "";

‎test/live-proof.test.ts‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,42 @@ test("live-proof installs a missing Bun toolchain with the official installer",
367367
assert.match(logs.join("\n"), /installed target package manager bun/);
368368
});
369369

370+
test("live-proof resolves pnpm from the configured PNPM_HOME bin directory", () => {
371+
const calls: Array<{ command: string; args: readonly string[]; path?: string }> = [];
372+
const environment: NodeJS.ProcessEnv = {
373+
HOME: "/tmp/live-proof-home",
374+
PATH: "/usr/bin",
375+
PNPM_HOME: "/tmp/live-proof-home/pnpm",
376+
};
377+
let probes = 0;
378+
ensureLiveProofPackageManager(
379+
"pnpm",
380+
(command, args, options) => {
381+
calls.push({ command, args, path: options?.env?.PATH ?? environment.PATH });
382+
if (String(args[1]).startsWith("command -v pnpm")) {
383+
probes += 1;
384+
return { status: probes === 1 ? 1 : 0 };
385+
}
386+
return { status: 0 };
387+
},
388+
"/tmp/checkout",
389+
environment,
390+
);
391+
392+
assert.deepEqual(
393+
calls.map(({ command, args }) => [command, ...args].join(" ")),
394+
[
395+
"sh -lc command -v pnpm >/dev/null 2>&1",
396+
"sh -lc curl -fsSL https://get.pnpm.io/install.sh | sh -",
397+
"sh -lc command -v pnpm >/dev/null 2>&1",
398+
],
399+
);
400+
assert.equal(
401+
calls.every(({ path }) => path?.startsWith("/tmp/live-proof-home/pnpm/bin:")),
402+
true,
403+
);
404+
});
405+
370406
test("live-proof reports an unsupported package manager clearly", () => {
371407
assert.throws(
372408
() =>

‎test/repair/target-validation.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8141,6 +8141,18 @@ test("resolveTargetRepoToolchain reads openclaw/clawhub from the real config wit
81418141
}
81428142
});
81438143

8144+
test("resolveTargetRepoToolchain uses the explicit camsnap no-validation profile", () => {
8145+
__resetTargetRepoToolchainCache();
8146+
try {
8147+
const toolchain = resolveTargetRepoToolchain("steipete/camsnap");
8148+
assert.equal(toolchain.packageManager, "npm");
8149+
assert.deepEqual(toolchain.baseValidationCommands, []);
8150+
assert.equal(toolchain.changedGate, null);
8151+
} finally {
8152+
__resetTargetRepoToolchainCache();
8153+
}
8154+
});
8155+
81448156
test("resolveTargetRepoToolchain keeps the OpenClaw changed gate even without core_target_overrides", () => {
81458157
// Regression guard for the earlier ordering bug: if core_target_overrides is
81468158
// ever removed but a generic openclaw fallback is kept (changed_gate: null),

‎test/repository-profiles.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,23 @@ test("generic steipete fallback starts review-only", () => {
130130
assert.deepEqual(profile.liveTest, TERMINAL_LIVE_TEST);
131131
});
132132

133+
test("camsnap uses its Go-native review-only live-proof profile", () => {
134+
const profile = repositoryProfileFor("Steipete/CamSnap");
135+
136+
assert.equal(profile.targetRepo, "steipete/camsnap");
137+
assert.equal(profile.packageManager, "npm");
138+
assert.deepEqual(profile.applyCloseRules.issue, []);
139+
assert.deepEqual(profile.applyCloseRules.pull_request, []);
140+
assert.deepEqual(profile.liveTest, {
141+
enabled: true,
142+
surfaceDefault: "terminal",
143+
setup: [],
144+
allowInstallScripts: false,
145+
readyTimeoutSeconds: 240,
146+
maxRecordingSeconds: 90,
147+
});
148+
});
149+
133150
test("generic OpenClaw fallback keeps denied repositories unsupported", () => {
134151
assert.throws(
135152
() => repositoryProfileFor("openclaw/clawsweeper-state"),

0 commit comments

Comments
 (0)