Files
backnotprop__plannotator/tests/manual/test-server.ts
Michael Ramos 78a30eab49 fix: OpenCode config read and lazy evaluation
- Fix config access: use response.data.share instead of response.share
- Make config read lazy to avoid blocking plugin init
- Add --disable-sharing and --keep flags to sandbox script
- Add sharingEnabled to test-server.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 13:48:05 -08:00

58 lines
1.4 KiB
TypeScript

/**
* Test script for Plannotator server
*
* Usage:
* bun run tests/manual/test-server.ts [origin]
*
* Examples:
* bun run tests/manual/test-server.ts # defaults to claude-code
* bun run tests/manual/test-server.ts opencode # tests opencode origin
*
* Reads plan from stdin if provided, otherwise uses a sample plan.
*/
import { startPlannotatorServer, handleServerReady } from "@plannotator/server";
// @ts-ignore - Bun import attribute for text
import html from "../../apps/hook/dist/index.html" with { type: "text" };
const origin = process.argv[2] || "claude-code";
const sharingEnabled = process.env.PLANNOTATOR_SHARE !== "disabled";
// Use sample plan (stdin reading was blocking)
const plan = `# Test Plan: Sample Feature
## Overview
This is a sample plan for testing the Plannotator UI.
## Implementation
\`\`\`typescript
function hello() {
console.log("Hello, world!");
}
\`\`\`
## Checklist
- [ ] Step 1
- [ ] Step 2
- [x] Step 3
`;
console.error(`Starting Plannotator server with origin: ${origin}`);
const server = await startPlannotatorServer({
plan,
origin,
sharingEnabled,
htmlContent: html as unknown as string,
onReady: (url, isRemote, port) => handleServerReady(url, isRemote, port),
});
const result = await server.waitForDecision();
await Bun.sleep(1500);
server.stop();
console.log(JSON.stringify(result, null, 2));
process.exit(0);