mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
78a30eab49
- 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>
58 lines
1.4 KiB
TypeScript
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);
|