Files
vscode-cowriting-plugin/scripts/smoke-live-turn.mjs
BenStullsBets 21bbf6b114 test(#60): smoke-live-turn logs live progress snapshots
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 04:38:33 -07:00

31 lines
1.4 KiB
JavaScript

#!/usr/bin/env node
// Scripted half of the F3 manual smoke (docs/MANUAL-SMOKE-F3.md). Drives the
// REAL LiveTurn module against the local Claude Code login. Not run in CI.
import { runEditTurn } from "../out/liveTurn.mjs";
const instruction = process.argv[2] ?? "Replace this sentence with exactly: The smoke test passed.";
const text = process.argv[3] ?? "This sentence is the smoke-test input.";
console.log(`instruction: ${instruction}`);
console.log(`text: ${text}`);
try {
const t0 = Date.now();
// #60: exercise the live-progress path against the real SDK — log each reduced
// snapshot so the smoke shows streaming/activity/tokens, not just the result.
const result = await runEditTurn(instruction, text, {
onProgress: (s) => {
const bits = [s.phase === "tool" ? `tool:${s.tool}` : s.phase, `${s.chars}c`];
if (s.tokens) bits.push(`${s.tokens}tok`);
console.log(` progress: ${bits.join(" ")}`);
},
});
console.log(`replacement: ${JSON.stringify(result.replacement)}`);
console.log(`model: ${result.model}`);
console.log(`sessionId: ${result.sessionId}`);
console.log(`elapsed: ${((Date.now() - t0) / 1000).toFixed(1)}s`);
process.exit(0);
} catch (err) {
console.error(`live turn failed (expected when Claude Code is absent/signed out): ${err instanceof Error ? err.message : String(err)}`);
process.exit(1);
}