peppa/packages/mcp/scripts/smoke.ts
Асель 8dc82859c7 PEP-36 stage 1: run Peppa with Node 26 type stripping instead of tsx
- tsconfig: erasableSyntaxOnly + verbatimModuleSyntax; parameter properties
  rewritten (BugsinkError, GiteaError, GiteaClient, OAuthError, TelegramError,
  TelegramApi, MockGitea)
- bin wrappers (peppa, peppa-mcp, peppa-hook, peppa-bot, testkit mocks,
  peppa-dev): `node --import scripts/lib/require-node.mjs` (clear error on
  Node < 26, PEPPA_NODE overrides the binary); package scripts and tests on
  `node` / `node --test`; tsx removed
- install-launchd.sh pins PEPPA_NODE (checked absolute path) in the plists
- fix a race the faster hooks exposed: the prompt hook answered every pending
  question, including a PM question raised after Peppa itself pasted text
  into the terminal; sendToSession now logs `input_sent` and the hook only
  answers questions older than that input
- change pep-36-lightweight-stack: stage 1 done, hook start numbers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:51:22 +05:00

23 lines
1.1 KiB
TypeScript

// Smoke test: spawns peppa-mcp in the given project dir and calls a few tools.
// Usage: node packages/mcp/scripts/smoke.ts <project-dir> <task>
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import { fileURLToPath } from "node:url";
const [dir = process.cwd(), task = "1"] = process.argv.slice(2);
const bin = fileURLToPath(new URL("../bin/peppa-mcp", import.meta.url));
const client = new Client({ name: "peppa-smoke", version: "0" });
await client.connect(new StdioClientTransport({ command: bin, cwd: dir, env: process.env as Record<string, string> }));
const { tools } = await client.listTools();
console.log("tools:", tools.map((t) => t.name).join(", "));
for (const [name, args] of [
["list_goals", {}],
["list_tasks", {}],
["get_task", { task }],
] as const) {
const r = await client.callTool({ name, arguments: args });
console.log(`\n── ${name}${r.isError ? " (error)" : ""}\n${(r.content as Array<{ text: string }>)[0]!.text}`);
}
await client.close();