#!/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); }