webmcp-codegen 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-I4ZL527H.js → chunk-EAKYM4YS.js} +2 -5
- package/dist/chunk-EAKYM4YS.js.map +1 -0
- package/dist/chunk-MUTXYBL6.js +1255 -0
- package/dist/chunk-MUTXYBL6.js.map +1 -0
- package/dist/cli.d.ts +32 -0
- package/dist/cli.js +234 -197
- package/dist/cli.js.map +1 -1
- package/dist/dev/server.d.ts +25 -0
- package/dist/dev/server.js +12 -0
- package/dist/dev/server.js.map +1 -0
- package/dist/generators/index.d.ts +1 -1
- package/dist/generators/index.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/sources/index.d.ts +1 -1
- package/dist/{types-DWUum51l.d.ts → types-DfK3AA5H.d.ts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-CCVNYNJ5.js +0 -235
- package/dist/chunk-CCVNYNJ5.js.map +0 -1
- package/dist/chunk-I4ZL527H.js.map +0 -1
- package/dist/server-DWP6IHCS.js +0 -638
- package/dist/server-DWP6IHCS.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dev/server.ts","../src/data-file.ts","../src/setup.ts","../src/detect.ts","../src/detect-app.ts","../src/dev/ui.ts"],"sourcesContent":["/**\n * The dev dashboard server: `npx webmcp-codegen dev`.\n *\n * A small HTTP server on localhost that serves the tools UI and answers its\n * three kinds of requests: list the tools, save an override (description /\n * enabled) to .webmcp-codegen.json, and run a tool's endpoint for a direct\n * test. It reuses the exact pipeline the CLI runs, so what the dashboard\n * shows is what a generate run would write.\n *\n * It exists only while the command is running, listens on localhost only,\n * and nothing about it ever touches the user's app bundle — by design, so\n * this dev tool can never leak into production.\n */\n\nimport { spawn } from \"node:child_process\";\nimport { createServer, type Server } from \"node:http\";\nimport { loadDataFile, saveDataFile } from \"../data-file.js\";\nimport { runGenerate } from \"../pipeline.js\";\nimport { resolveSetup } from \"../setup.js\";\nimport type { JsonSchema, ReviewedTool } from \"../types.js\";\nimport { dashboardHtml } from \"./ui.js\";\n\nexport interface DevServerOptions {\n cwd: string;\n port: number;\n /** Open the browser automatically. False in tests and CI. */\n open?: boolean;\n}\n\ninterface RunRequest {\n name: string;\n input: Record<string, unknown>;\n /** Absolute base URL when the API is not same-origin with the dashboard. */\n baseUrl?: string;\n}\n\n/** The JSON shape the UI renders. */\ninterface DashboardState {\n label: string;\n outDir?: string;\n tools: {\n name: string;\n verb?: string;\n path?: string;\n description: string;\n sideEffect: string;\n riskTier: string;\n enabled: boolean;\n endpointRole: string;\n piiInOutput: string[];\n inputSchema: JsonSchema;\n /** Route info the direct \"run it\" test needs to build a real request. */\n pathTemplate?: string;\n paramLocations?: { path: string[]; query: string[]; body: string[] };\n serverUrl?: string;\n requiresAuth?: boolean;\n findings: { level: string; message: string }[];\n }[];\n skipped: { ref: string; reason: string }[];\n notes: string[];\n}\n\nexport async function startDevServer(options: DevServerOptions): Promise<Server> {\n const setup = await resolveSetup(options.cwd, {\n dryRun: true,\n skipAudit: false,\n force: false,\n watch: false,\n });\n\n /** Re-run the pipeline fresh on every state request: edits to the spec\n * show up on reload without restarting the dashboard. */\n async function currentState(): Promise<DashboardState> {\n const data = await loadDataFile(options.cwd);\n const result = await runGenerate(setup.config, {\n cwd: options.cwd,\n dryRun: true,\n overrides: data.overrides,\n });\n return {\n label: setup.label,\n outDir: setup.config.generate[0]?.outDir,\n tools: result.tools.map((tool) => toUiTool(tool, result.findings)),\n skipped: result.skipped,\n notes: result.notes,\n };\n }\n\n const server = createServer(async (request, response) => {\n try {\n await route(request, response);\n } catch (error) {\n sendJson(response, 500, { error: error instanceof Error ? error.message : String(error) });\n }\n });\n\n async function route(\n request: import(\"node:http\").IncomingMessage,\n response: import(\"node:http\").ServerResponse,\n ): Promise<void> {\n const url = new URL(request.url ?? \"/\", \"http://localhost\");\n\n if (request.method === \"GET\" && url.pathname === \"/\") {\n response.writeHead(200, { \"content-type\": \"text/html; charset=utf-8\" });\n response.end(dashboardHtml());\n return;\n }\n\n if (request.method === \"GET\" && url.pathname === \"/api/state\") {\n sendJson(response, 200, await currentState());\n return;\n }\n\n if (request.method === \"POST\" && url.pathname === \"/api/override\") {\n const body = (await readJson(request)) as {\n name?: string;\n description?: string;\n enabled?: boolean;\n };\n if (!body.name) {\n sendJson(response, 400, { error: \"Missing tool name.\" });\n return;\n }\n const data = await loadDataFile(options.cwd);\n const overrides = { ...(data.overrides ?? {}) };\n const existing = overrides[body.name] ?? {};\n // Explicit fields win over what's stored; undefined means \"untouched\".\n overrides[body.name] = {\n ...existing,\n ...(body.description !== undefined ? { description: body.description } : {}),\n ...(body.enabled !== undefined ? { enabled: body.enabled } : {}),\n };\n await saveDataFile(options.cwd, { overrides });\n sendJson(response, 200, { ok: true, saved: `.webmcp-codegen.json` });\n return;\n }\n\n if (request.method === \"POST\" && url.pathname === \"/api/run\") {\n const body = (await readJson(request)) as RunRequest;\n const state = await currentState();\n const tool = state.tools.find((candidate) => candidate.name === body.name);\n if (!tool) {\n sendJson(response, 404, { error: `No tool named \"${body.name}\".` });\n return;\n }\n const result = await runEndpoint(tool, body.input ?? {}, body.baseUrl);\n sendJson(response, result.ok ? 200 : 502, result);\n return;\n }\n\n sendJson(response, 404, { error: \"Not found\" });\n }\n\n await new Promise<void>((resolveListen) =>\n server.listen(options.port, \"127.0.0.1\", resolveListen),\n );\n\n if (options.open !== false) openBrowser(`http://localhost:${options.port}`);\n return server;\n}\n\nfunction toUiTool(\n tool: ReviewedTool,\n findings: { level: string; tool?: string; message: string }[],\n): DashboardState[\"tools\"][number] {\n const [verb, ...rest] = tool.source.ref.split(\" \");\n return {\n name: tool.name,\n verb,\n path: rest.join(\" \"),\n description: tool.description,\n sideEffect: tool.sideEffect,\n riskTier: tool.riskTier,\n enabled: tool.enabledByDefault,\n endpointRole: tool.endpointRole,\n piiInOutput: tool.piiInOutput,\n inputSchema: tool.inputSchema,\n ...(tool.pathTemplate ? { pathTemplate: tool.pathTemplate } : {}),\n ...(tool.paramLocations ? { paramLocations: tool.paramLocations } : {}),\n ...(tool.serverUrl ? { serverUrl: tool.serverUrl } : {}),\n requiresAuth: tool.requiresAuth,\n findings: findings\n .filter((finding) => finding.tool === tool.name)\n .map((finding) => ({ level: finding.level, message: finding.message })),\n };\n}\n\n/**\n * The direct \"run it\" test: call the endpoint the way the generated\n * execute() would, but server-side. Two honest limitations the UI states:\n * there is no browser session here (auth cookies do not apply), and the\n * call needs an absolute base URL — the spec's servers entry or one the\n * developer types in.\n */\nasync function runEndpoint(\n tool: DashboardState[\"tools\"][number],\n input: Record<string, unknown>,\n baseUrlOverride?: string,\n): Promise<{ ok: boolean; status?: number; body?: unknown; error?: string }> {\n const base = baseUrlOverride ?? tool.serverUrl;\n if (!base) {\n return {\n ok: false,\n error:\n \"No base URL: the spec lists no absolute server. Type your app's URL \" +\n '(e.g. http://localhost:3000) in the \"base URL\" field and run again.',\n };\n }\n if (!tool.pathTemplate || !tool.verb) {\n return { ok: false, error: \"This tool has no route to call.\" };\n }\n\n let path = tool.pathTemplate;\n for (const param of tool.paramLocations?.path ?? []) {\n path = path.replace(`{${param}}`, encodeURIComponent(String(input[param] ?? \"\")));\n }\n const url = new URL(path, base);\n for (const param of tool.paramLocations?.query ?? []) {\n const value = input[param];\n if (value !== undefined && value !== null) url.searchParams.set(param, String(value));\n }\n const bodyFields = tool.paramLocations?.body ?? [];\n const body =\n bodyFields.length === 1 && bodyFields[0] === \"body\"\n ? input.body\n : bodyFields.length > 0\n ? Object.fromEntries(bodyFields.map((field) => [field, input[field]]))\n : undefined;\n\n try {\n const response = await fetch(url, {\n method: tool.verb,\n headers: body !== undefined ? { \"content-type\": \"application/json\" } : undefined,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n });\n const text = await response.text();\n let parsed: unknown = text;\n try {\n parsed = JSON.parse(text);\n } catch {\n // Plain-text response; keep it as text.\n }\n return { ok: response.ok, status: response.status, body: parsed };\n } catch (error) {\n return { ok: false, error: error instanceof Error ? error.message : String(error) };\n }\n}\n\nfunction sendJson(\n response: import(\"node:http\").ServerResponse,\n status: number,\n body: unknown,\n): void {\n response.writeHead(status, {\n \"content-type\": \"application/json\",\n });\n response.end(JSON.stringify(body));\n}\n\nfunction readJson(request: import(\"node:http\").IncomingMessage): Promise<unknown> {\n return new Promise((resolveRead, reject) => {\n let text = \"\";\n request.on(\"data\", (chunk: Buffer) => {\n text += chunk.toString(\"utf8\");\n });\n request.on(\"end\", () => {\n try {\n resolveRead(text ? JSON.parse(text) : {});\n } catch {\n reject(new Error(\"Invalid JSON body\"));\n }\n });\n request.on(\"error\", reject);\n });\n}\n\nfunction openBrowser(url: string): void {\n const command =\n process.platform === \"darwin\" ? \"open\" : process.platform === \"win32\" ? \"start\" : \"xdg-open\";\n spawn(command, [url], { stdio: \"ignore\", shell: process.platform === \"win32\" }).unref();\n}\n","/**\n * The remembered-choices file: `.webmcp-codegen.json` at the project root.\n *\n * It is plain data — never code — so it works in the pure-npx flow (no\n * install needed) and can be read and written safely by the CLI and the dev\n * dashboard alike. It holds two kinds of things:\n *\n * - choices we asked for once and should never ask again\n * (\"which of these packages is your web app?\")\n * - overrides per-tool edits made in the dashboard (description,\n * enabled). They are applied after the safety review, so\n * they survive regeneration.\n *\n * The config file (codegen.config.mjs) stays the source of truth for\n * *structure* (sources, generators, safety). This file is for *choices and\n * tweaks*. Editing it by hand is fine; it is meant to be committed.\n */\n\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type { ToolOverrides } from \"./types.js\";\n\nexport const DATA_FILE_NAME = \".webmcp-codegen.json\";\n\nexport interface DataFile {\n /** The spec we used (or were told to use), relative to the project root. */\n spec?: string;\n /** The web app package directory, relative to the project root. */\n app?: string;\n /** Per-tool tweaks, keyed by tool name. */\n overrides?: ToolOverrides;\n}\n\nexport async function loadDataFile(cwd: string): Promise<DataFile> {\n try {\n const parsed = JSON.parse(await readFile(join(cwd, DATA_FILE_NAME), \"utf8\")) as DataFile;\n return parsed && typeof parsed === \"object\" ? parsed : {};\n } catch {\n return {};\n }\n}\n\n/**\n * Merge and write. Only the keys given are touched; everything already in\n * the file (especially overrides) survives. Writes nothing when the merged\n * result equals what's already there, so watch mode never loops on us.\n */\nexport async function saveDataFile(cwd: string, patch: Partial<DataFile>): Promise<void> {\n const current = await loadDataFile(cwd);\n const next: DataFile = { ...current, ...patch };\n if (JSON.stringify(next) === JSON.stringify(current)) return;\n await writeFile(join(cwd, DATA_FILE_NAME), `${JSON.stringify(next, null, 2)}\\n`, \"utf8\");\n}\n","/**\n * Setup resolution: where the tools come from and where they go.\n *\n * Shared by the CLI (`generate`) and the dev dashboard (`dev`), so both see\n * the same project the same way:\n *\n * 1. a config file (codegen.config.mjs or --config) for full control\n * 2. --spec/--out flags as quick overrides, no config needed\n * 3. remembered choices from .webmcp-codegen.json\n * 4. auto-detection: the spec by filename, the web app by its package.json\n *\n * Branches 2-4 build the config right here, which is what makes\n * `npx webmcp-codegen generate` work without installing the package: the\n * user's project never has to resolve a webmcp-codegen import.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { basename, join } from \"node:path\";\nimport { createInterface } from \"node:readline/promises\";\nimport { CONFIG_FILE_NAMES, loadConfig } from \"./config.js\";\nimport { loadDataFile } from \"./data-file.js\";\nimport { findSpecs } from \"./detect.js\";\nimport { findWebApps, type WebApp } from \"./detect-app.js\";\nimport { js } from \"./generators/js.js\";\nimport { openapi } from \"./sources/openapi.js\";\nimport type { CodegenConfig } from \"./types.js\";\n\nexport interface GenerateFlags {\n dryRun: boolean;\n skipAudit: boolean;\n force: boolean;\n watch: boolean;\n configPath?: string;\n spec?: string;\n out?: string;\n}\n\nexport interface Setup {\n config: CodegenConfig;\n label: string;\n /** The web app we detected (when detection ran). Drives placement + wiring. */\n app?: WebApp;\n /** True when the config came from a config file rather than detection. */\n fromConfigFile: boolean;\n /** Choices to remember in .webmcp-codegen.json after a successful run. */\n remember: { spec?: string; app?: string };\n}\n\n/**\n * Where the tools come from and where they go, in priority order:\n *\n * 1. a config file (codegen.config.mjs or --config) for full control\n * 2. --spec/--out flags as quick overrides, no config needed\n * 3. remembered choices from .webmcp-codegen.json\n * 4. auto-detection: the spec by filename, the web app by its package.json\n *\n * Branches 2-4 build the config right here inside the CLI, which is what\n * makes `npx webmcp-codegen generate` work without installing the package:\n * the user's project never has to resolve a webmcp-codegen import.\n */\nexport async function resolveSetup(cwd: string, flags: GenerateFlags): Promise<Setup> {\n const hasConfigFile = flags.configPath\n ? existsSync(join(cwd, flags.configPath))\n : CONFIG_FILE_NAMES.some((name) => existsSync(join(cwd, name)));\n\n if (hasConfigFile) {\n const { config, path } = await loadConfig(cwd, flags.configPath);\n if (flags.spec || flags.out) {\n console.warn(`Note: --spec/--out are ignored; ${basename(path)} is in charge here.`);\n }\n // Wiring still works with a config file if we can find the app.\n const data = await loadDataFile(cwd);\n const apps = await findWebApps(cwd);\n const app = apps.find((candidate) => candidate.dir === data.app) ?? apps[0];\n return { config, label: basename(path), app, fromConfigFile: true, remember: {} };\n }\n if (flags.configPath) {\n throw new Error(`No config file at \"${flags.configPath}\".`);\n }\n\n const data = await loadDataFile(cwd);\n\n // The spec: flag wins, then the remembered choice, then detection.\n const spec = flags.spec ?? data.spec ?? (await detectSpec(cwd));\n\n // The web app: detection decides placement. Only asked once; the answer\n // is remembered in .webmcp-codegen.json.\n let app: WebApp | undefined;\n if (!flags.out) {\n const apps = await findWebApps(cwd);\n const remembered = apps.find((candidate) => candidate.dir === data.app);\n if (remembered) {\n app = remembered;\n } else if (apps.length === 1) {\n app = apps[0];\n console.log(`Found your web app: ${app?.dir} (${app?.framework})`);\n } else if (apps.length > 1) {\n app = await askWhichApp(apps);\n }\n }\n\n const outDir = flags.out ?? (app && app.dir !== \".\" ? `${app.dir}/src/webmcp` : \"./src/webmcp\");\n return {\n config: { sources: [openapi({ spec })], generate: [js({ outDir })] },\n label: flags.spec ? `--spec ${spec}` : `detected ${spec}`,\n app,\n fromConfigFile: false,\n remember: { spec, app: app?.dir },\n };\n}\n\n/**\n * The one question this CLI asks. Several packages look like the web app;\n * a human picks, and .webmcp-codegen.json remembers it. Non-interactive\n * shells (CI) get the best guess with a note, never a hang.\n */\nasync function askWhichApp(apps: WebApp[]): Promise<WebApp> {\n if (!process.stdin.isTTY) {\n const first = apps[0] as WebApp;\n console.log(`Several packages look like web apps; using ${first.dir}. Override with --out.`);\n return first;\n }\n console.log(\"Several packages look like the web app. Which one should the tools live in?\");\n apps.forEach((app, index) => {\n console.log(` ${index + 1}. ${app.dir} (${app.framework})${index === 0 ? \" [default]\" : \"\"}`);\n });\n const rl = createInterface({ input: process.stdin, output: process.stdout });\n try {\n const answer = await rl.question(\"Choice [1]: \");\n const picked = Number.parseInt(answer.trim() || \"1\", 10);\n return apps[picked - 1] ?? (apps[0] as WebApp);\n } finally {\n rl.close();\n }\n}\n\n/**\n * Find the project's API spec. One candidate: use it and say so. Several:\n * list them and make the human pick. None: say exactly what to do next.\n */\nasync function detectSpec(cwd: string): Promise<string> {\n const specs = await findSpecs(cwd);\n\n if (specs.length === 0) {\n throw new Error(\n \"No OpenAPI spec found in this project.\\n\" +\n \"Point at one: npx webmcp-codegen generate --spec path/to/openapi.json\",\n );\n }\n if (specs.length > 1) {\n const list = specs.map((spec) => ` - ${spec}`).join(\"\\n\");\n throw new Error(\n `Found ${specs.length} API specs:\\n${list}\\n\\n` +\n `Pick one: npx webmcp-codegen generate --spec ${specs[0]}`,\n );\n }\n\n console.log(`Detected ${specs[0]} (override with --spec)`);\n return specs[0] as string;\n}\n","/**\n * Spec auto-detection: the reason `npx webmcp-codegen generate` works with\n * zero arguments, zero config, and zero install.\n *\n * The rule is deliberately boring: walk the project (skipping the obvious\n * noise), recognize the usual spec filenames, and return what we find\n * shallowest-first. When exactly one spec exists we just use it; the CLI\n * layer decides what to do about zero or several.\n */\n\nimport type { Dirent } from \"node:fs\";\nimport { readdir } from \"node:fs/promises\";\nimport { join, relative } from \"node:path\";\n\n/** Filenames we recognize as API specs. */\nexport const SPEC_FILE_PATTERN = /^(openapi|swagger|api)\\.(ya?ml|json)$/i;\n\n/** Directories never worth descending into. */\nconst IGNORED_DIRS = new Set([\n \"node_modules\",\n \".git\",\n \".turbo\",\n \".next\",\n \"dist\",\n \"build\",\n \"coverage\",\n]);\n\n/**\n * How deep we look. Enough for monorepo layouts like\n * apps/server/openapi/openapi.json (depth 3) without wandering forever.\n */\nconst MAX_DEPTH = 5;\n\n/**\n * Find API spec files under `cwd`, returned as paths relative to `cwd`,\n * shallowest first. A root-level spec is a likelier intent than one\n * buried six folders deep.\n */\nexport async function findSpecs(cwd: string): Promise<string[]> {\n const found: { path: string; depth: number }[] = [];\n\n async function walk(dir: string, depth: number): Promise<void> {\n if (depth > MAX_DEPTH) return;\n let entries: Dirent[];\n try {\n entries = await readdir(dir, { withFileTypes: true });\n } catch {\n return; // Unreadable directory. Skip it, never die on detection.\n }\n for (const entry of entries) {\n if (entry.isDirectory()) {\n if (!IGNORED_DIRS.has(entry.name)) await walk(join(dir, entry.name), depth + 1);\n } else if (SPEC_FILE_PATTERN.test(entry.name)) {\n found.push({ path: join(dir, entry.name), depth });\n }\n }\n }\n\n await walk(cwd, 0);\n return found.sort((a, b) => a.depth - b.depth).map((entry) => relative(cwd, entry.path));\n}\n","/**\n * Web-app detection: where the generated tools should live.\n *\n * The tools are browser code, so they belong in whichever package *is* the\n * web app — not next to the spec, and not wherever the command happened to\n * run. In a monorepo like:\n *\n * apps/\n * ├── server/ (has the openapi.json)\n * └── web/ (has next in its package.json) ← tools go here\n *\n * detection means reading package.json files and looking for a browser\n * framework. One candidate: we use it and say so. Several: the CLI asks\n * once and remembers the answer in .webmcp-codegen.json.\n */\n\nimport { readdir, readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nexport interface WebApp {\n /** Package directory relative to the project root, e.g. \"apps/web\". */\n dir: string;\n framework: \"next\" | \"vite-react\" | \"nuxt\" | \"sveltekit\" | \"unknown\";\n}\n\n/** The frameworks we recognize, best-supported first. */\nconst FRAMEWORKS: { dep: string; framework: WebApp[\"framework\"] }[] = [\n { dep: \"next\", framework: \"next\" },\n { dep: \"nuxt\", framework: \"nuxt\" },\n { dep: \"@sveltejs/kit\", framework: \"sveltekit\" },\n];\n\n/**\n * Find web apps in the project. Returns candidates with the likeliest first\n * (a known framework beats \"has react\", an app named \"web\" beats \"admin\").\n */\nexport async function findWebApps(cwd: string): Promise<WebApp[]> {\n const packageDirs = await findPackageDirs(cwd);\n const apps: WebApp[] = [];\n\n for (const dir of packageDirs) {\n const pkg = await readPackageJson(join(cwd, dir));\n if (!pkg) continue;\n const deps = {\n ...(pkg.dependencies as Record<string, string> | undefined),\n ...(pkg.devDependencies as Record<string, string> | undefined),\n };\n const known = FRAMEWORKS.find(({ dep }) => deps[dep]);\n // A bare react+vite pair is a Vite SPA; react alone is too weak a signal.\n const framework =\n known?.framework ?? (deps.react && deps.vite ? (\"vite-react\" as const) : undefined);\n if (framework) apps.push({ dir, framework });\n }\n\n // Prefer known frameworks, then the package literally named like the app.\n return apps.sort((a, b) => score(b) - score(a));\n\n function score(app: WebApp): number {\n return (\n (app.framework === \"unknown\" ? 0 : 10) +\n (/(^|\\/)(web|app|frontend|client)$/.test(app.dir) ? 2 : 0)\n );\n }\n}\n\n/** Every directory holding a package.json, root first. */\nasync function findPackageDirs(cwd: string): Promise<string[]> {\n const dirs: string[] = [];\n const root = await readPackageJson(join(cwd, \"\"));\n if (root) {\n dirs.push(\".\");\n for (const pattern of await workspaceGlobs(cwd, root)) {\n dirs.push(...(await expandShallowGlob(cwd, pattern)));\n }\n }\n return [...new Set(dirs)];\n}\n\n/** Workspace globs from package.json workspaces or pnpm-workspace.yaml. */\nasync function workspaceGlobs(cwd: string, rootPkg: Record<string, unknown>): Promise<string[]> {\n const workspaces = rootPkg.workspaces;\n if (Array.isArray(workspaces)) return workspaces as string[];\n if (\n workspaces &&\n typeof workspaces === \"object\" &&\n Array.isArray((workspaces as { packages?: unknown }).packages)\n ) {\n return (workspaces as { packages: string[] }).packages;\n }\n // pnpm monorepos: parse the \"packages:\" list out of pnpm-workspace.yaml.\n // Kept deliberately shallow: we only support single-star globs anyway.\n return readPnpmWorkspaceGlobs(cwd);\n}\n\nasync function readPnpmWorkspaceGlobs(cwd: string): Promise<string[]> {\n try {\n const text = await readFile(join(cwd, \"pnpm-workspace.yaml\"), \"utf8\");\n const packagesBlock = /^packages:\\s*\\n((?:\\s+-\\s+.+\\n?)+)/m.exec(text);\n if (!packagesBlock) return [];\n return [...(packagesBlock[1] as string).matchAll(/^\\s+-\\s+['\"]?([^'\"\\n]+?)['\"]?\\s*$/gm)].map(\n (match) => match[1] as string,\n );\n } catch {\n return [];\n }\n}\n\n/**\n * Expand a workspace glob, but only one star deep (\"apps/*\"). Deep globs\n * (\"packages/**\") are truncated at the first star; a monorepo app is never\n * buried deeper than that in practice.\n */\nasync function expandShallowGlob(cwd: string, pattern: string): Promise<string[]> {\n const starAt = pattern.indexOf(\"*\");\n const base = starAt === -1 ? pattern : pattern.slice(0, starAt).replace(/\\/$/, \"\");\n if (starAt === -1) return [base];\n try {\n const entries = await readdir(join(cwd, base), { withFileTypes: true });\n return entries.filter((entry) => entry.isDirectory()).map((entry) => `${base}/${entry.name}`);\n } catch {\n return [];\n }\n}\n\nasync function readPackageJson(dir: string): Promise<Record<string, unknown> | undefined> {\n try {\n return JSON.parse(await readFile(join(dir, \"package.json\"), \"utf8\")) as Record<string, unknown>;\n } catch {\n return undefined;\n }\n}\n","/**\n * The dashboard's UI: a single HTML page with embedded CSS and JS.\n * Design goals: professional, scannable, no visual noise.\n *\n * Layout:\n * - Left sidebar: search + tool list, grouped by risk\n * - Right panel: tool detail with edit, toggle, and test sections\n *\n * No framework, no build step. Plain HTML/CSS/JS shipped as a string.\n */\n\ninterface UiTool {\n name: string;\n description: string;\n sideEffect: string;\n enabled: boolean;\n endpointRole: string;\n piiInOutput: string[];\n findings: { level: string; message: string }[];\n inputSchema?: Record<string, unknown>;\n serverUrl?: string;\n requiresAuth?: boolean;\n verb?: string;\n path?: string;\n}\n\ninterface UiState {\n label: string;\n outDir?: string;\n tools: UiTool[];\n skipped: { ref: string; reason: string }[];\n notes: string[];\n}\n\nexport function dashboardHtml(): string {\n return `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\" />\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n<title>webmcp-codegen</title>\n<style>\n :root {\n --baseline: #0a0b0f;\n --surface: #10131a;\n --surface-raised: #161a23;\n --line: #1e2330;\n --line-subtle: #161a23;\n --ink: #e9ecf2;\n --dim: #9aa3b2;\n --faint: #5d6575;\n --ghost: #3b4150;\n --accent: #58a6ff;\n --accent-dim: rgba(88, 166, 255, 0.15);\n --signal: #e3b341;\n --signal-dim: rgba(227, 179, 65, 0.15);\n --fault: #f47067;\n --fault-dim: rgba(244, 112, 103, 0.15);\n --sans: ui-sans-serif, system-ui, -apple-system, sans-serif;\n --mono: ui-monospace, SFMono-Regular, Menlo, monospace;\n }\n * { box-sizing: border-box; }\n html, body { margin: 0; height: 100%; }\n body {\n background: var(--baseline);\n color: var(--ink);\n font-family: var(--sans);\n font-size: 14px;\n -webkit-font-smoothing: antialiased;\n overflow: hidden;\n }\n ::selection { background: var(--accent); color: var(--baseline); }\n\n /* Layout */\n .app { display: flex; height: 100vh; }\n .sidebar {\n width: 320px;\n min-width: 320px;\n border-right: 1px solid var(--line);\n display: flex;\n flex-direction: column;\n background: var(--surface);\n }\n .main {\n flex: 1;\n overflow-y: auto;\n background: var(--baseline);\n }\n\n /* Sidebar header */\n .sidebar-header {\n padding: 20px 20px 16px;\n border-bottom: 1px solid var(--line-subtle);\n }\n .brand {\n display: flex;\n align-items: center;\n gap: 10px;\n font-weight: 600;\n font-size: 15px;\n margin-bottom: 4px;\n }\n .brand-mark {\n width: 24px;\n height: 24px;\n background: linear-gradient(135deg, var(--accent), #7c3aed);\n border-radius: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 12px;\n font-weight: 700;\n color: white;\n }\n .brand-sub {\n color: var(--faint);\n font-size: 12px;\n }\n\n /* Search */\n .search-wrap {\n padding: 12px 16px;\n border-bottom: 1px solid var(--line-subtle);\n }\n .search {\n width: 100%;\n background: var(--surface-raised);\n border: 1px solid var(--line);\n border-radius: 6px;\n padding: 8px 12px 8px 32px;\n color: var(--ink);\n font-size: 13px;\n font-family: inherit;\n position: relative;\n }\n .search:focus {\n outline: none;\n border-color: var(--accent);\n }\n .search-icon {\n position: absolute;\n left: 28px;\n top: 50%;\n transform: translateY(-50%);\n color: var(--faint);\n pointer-events: none;\n }\n .search-wrap { position: relative; }\n\n /* Tool list */\n .tool-list {\n flex: 1;\n overflow-y: auto;\n padding: 8px 0;\n }\n .tool-group {\n padding: 8px 16px 4px;\n font-size: 11px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--faint);\n }\n .tool {\n display: flex;\n align-items: center;\n gap: 10px;\n width: 100%;\n padding: 8px 16px;\n border: none;\n background: none;\n color: var(--ink);\n font-size: 13px;\n font-family: var(--mono);\n text-align: left;\n cursor: pointer;\n transition: background 0.1s;\n }\n .tool:hover { background: var(--surface-raised); }\n .tool[aria-selected=\"true\"] {\n background: var(--accent-dim);\n border-right: 2px solid var(--accent);\n }\n .tool-indicator {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n flex-shrink: 0;\n }\n .tool-indicator.read { background: var(--accent); }\n .tool-indicator.write { background: var(--signal); }\n .tool-indicator.destructive { background: var(--fault); }\n .tool-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n .tool-badge {\n font-size: 10px;\n padding: 2px 6px;\n border-radius: 4px;\n background: var(--surface-raised);\n color: var(--dim);\n text-transform: uppercase;\n letter-spacing: 0.02em;\n }\n .tool-badge.disabled { color: var(--signal); }\n\n /* Main content */\n .detail {\n max-width: 640px;\n margin: 0 auto;\n padding: 32px 40px;\n }\n .placeholder {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: var(--faint);\n text-align: center;\n padding: 40px;\n }\n .placeholder-icon {\n width: 48px;\n height: 48px;\n border-radius: 12px;\n background: var(--surface-raised);\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 16px;\n color: var(--ghost);\n }\n .placeholder kbd {\n background: var(--surface-raised);\n padding: 2px 6px;\n border-radius: 4px;\n font-family: var(--mono);\n font-size: 12px;\n }\n\n /* Detail header */\n .detail-header {\n margin-bottom: 24px;\n padding-bottom: 20px;\n border-bottom: 1px solid var(--line-subtle);\n }\n .detail-crumb {\n font-size: 12px;\n color: var(--faint);\n margin-bottom: 8px;\n font-family: var(--mono);\n }\n .detail-title {\n font-size: 24px;\n font-weight: 600;\n margin: 0 0 8px;\n font-family: var(--mono);\n }\n .detail-route {\n font-family: var(--mono);\n font-size: 13px;\n color: var(--dim);\n display: flex;\n align-items: center;\n gap: 8px;\n }\n .verb {\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 4px;\n font-size: 11px;\n }\n .verb.read { color: var(--accent); background: var(--accent-dim); }\n .verb.write { color: var(--signal); background: var(--signal-dim); }\n .verb.destructive { color: var(--fault); background: var(--fault-dim); }\n\n /* Badges */\n .badges {\n display: flex;\n gap: 8px;\n margin-top: 12px;\n flex-wrap: wrap;\n }\n .badge {\n font-size: 11px;\n padding: 3px 8px;\n border-radius: 4px;\n font-weight: 500;\n }\n .badge.read { color: var(--accent); background: var(--accent-dim); }\n .badge.write { color: var(--signal); background: var(--signal-dim); }\n .badge.destructive { color: var(--fault); background: var(--fault-dim); }\n .badge.disabled { color: var(--signal); background: var(--signal-dim); }\n .badge.auth { color: var(--fault); background: var(--fault-dim); }\n\n /* Sections */\n .section {\n margin-bottom: 28px;\n }\n .section-label {\n font-size: 11px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--faint);\n margin-bottom: 10px;\n }\n\n /* Description edit */\n .description-edit {\n width: 100%;\n background: var(--surface);\n border: 1px solid var(--line);\n border-radius: 6px;\n padding: 12px;\n color: var(--ink);\n font-size: 14px;\n font-family: inherit;\n line-height: 1.5;\n resize: vertical;\n min-height: 80px;\n }\n .description-edit:focus {\n outline: none;\n border-color: var(--accent);\n }\n .edit-actions {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-top: 10px;\n }\n .btn {\n padding: 8px 16px;\n border-radius: 6px;\n font-size: 13px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.15s;\n border: 1px solid var(--line);\n background: var(--surface);\n color: var(--ink);\n }\n .btn:hover { background: var(--surface-raised); border-color: var(--ghost); }\n .btn-primary {\n background: var(--accent);\n border-color: var(--accent);\n color: var(--baseline);\n }\n .btn-primary:hover { background: #4a95ee; border-color: #4a95ee; }\n .saved-indicator {\n font-size: 12px;\n color: var(--accent);\n opacity: 0;\n transition: opacity 0.2s;\n }\n .saved-indicator.show { opacity: 1; }\n .edit-hint {\n font-size: 12px;\n color: var(--faint);\n margin-top: 8px;\n line-height: 1.5;\n }\n\n /* Toggle */\n .toggle-row {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 14px;\n background: var(--surface);\n border: 1px solid var(--line);\n border-radius: 8px;\n }\n .switch {\n width: 40px;\n height: 22px;\n border-radius: 11px;\n background: var(--surface-raised);\n border: 1px solid var(--line);\n position: relative;\n cursor: pointer;\n transition: all 0.2s;\n flex-shrink: 0;\n }\n .switch::after {\n content: \"\";\n position: absolute;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n background: var(--dim);\n top: 2px;\n left: 2px;\n transition: all 0.2s;\n }\n .switch[aria-checked=\"true\"] {\n background: var(--accent);\n border-color: var(--accent);\n }\n .switch[aria-checked=\"true\"]::after {\n left: 20px;\n background: white;\n }\n .toggle-copy { font-size: 13px; line-height: 1.5; }\n .toggle-copy strong { display: block; margin-bottom: 2px; }\n\n /* Try it */\n .try-section {\n background: var(--surface);\n border: 1px solid var(--line);\n border-radius: 8px;\n overflow: hidden;\n }\n .try-header {\n padding: 14px 16px;\n border-bottom: 1px solid var(--line-subtle);\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n .try-header h3 {\n margin: 0;\n font-size: 13px;\n font-weight: 600;\n }\n .try-note {\n font-size: 11px;\n color: var(--faint);\n }\n .try-body { padding: 16px; }\n .auth-note {\n background: var(--signal-dim);\n border: 1px solid var(--signal);\n color: var(--signal);\n padding: 10px 12px;\n border-radius: 6px;\n font-size: 12px;\n margin-bottom: 14px;\n line-height: 1.5;\n }\n .base-url-input {\n width: 100%;\n background: var(--baseline);\n border: 1px solid var(--line);\n border-radius: 6px;\n padding: 8px 12px;\n color: var(--ink);\n font-size: 13px;\n font-family: var(--mono);\n margin-bottom: 14px;\n }\n .base-url-input:focus {\n outline: none;\n border-color: var(--accent);\n }\n .param-list { margin-bottom: 14px; }\n .param {\n margin-bottom: 12px;\n }\n .param-label {\n display: block;\n font-size: 12px;\n font-weight: 500;\n margin-bottom: 4px;\n color: var(--dim);\n }\n .param-label .req { color: var(--fault); }\n .param-hint {\n font-size: 11px;\n color: var(--faint);\n margin-top: 2px;\n }\n .param-input {\n width: 100%;\n background: var(--baseline);\n border: 1px solid var(--line);\n border-radius: 6px;\n padding: 8px 12px;\n color: var(--ink);\n font-size: 13px;\n font-family: var(--mono);\n }\n .param-input:focus {\n outline: none;\n border-color: var(--accent);\n }\n .run-btn {\n width: 100%;\n padding: 10px;\n background: var(--accent);\n border: none;\n border-radius: 6px;\n color: var(--baseline);\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n transition: background 0.15s;\n }\n .run-btn:hover { background: #4a95ee; }\n .run-btn:disabled { opacity: 0.5; cursor: not-allowed; }\n .result {\n margin-top: 14px;\n padding: 12px;\n background: var(--baseline);\n border: 1px solid var(--line);\n border-radius: 6px;\n font-family: var(--mono);\n font-size: 12px;\n white-space: pre-wrap;\n word-break: break-all;\n max-height: 300px;\n overflow-y: auto;\n }\n .result.ok { border-color: var(--accent); }\n .result.err { border-color: var(--fault); }\n\n /* Findings */\n .findings {\n margin-bottom: 20px;\n }\n .finding {\n display: flex;\n gap: 8px;\n padding: 10px 12px;\n background: var(--surface);\n border: 1px solid var(--line);\n border-radius: 6px;\n margin-bottom: 8px;\n font-size: 13px;\n line-height: 1.5;\n }\n .finding.warning { border-left: 3px solid var(--signal); }\n .finding.error { border-left: 3px solid var(--fault); }\n .finding-icon { flex-shrink: 0; }\n\n /* Scrollbar */\n ::-webkit-scrollbar { width: 8px; height: 8px; }\n ::-webkit-scrollbar-track { background: transparent; }\n ::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }\n ::-webkit-scrollbar-thumb:hover { background: var(--ghost); }\n</style>\n</head>\n<body>\n<div class=\"app\">\n <aside class=\"sidebar\">\n <div class=\"sidebar-header\">\n <div class=\"brand\">\n <div class=\"brand-mark\">W</div>\n <span>webmcp-codegen</span>\n </div>\n <div class=\"brand-sub\" id=\"tool-count\"></div>\n </div>\n <div class=\"search-wrap\">\n <svg class=\"search-icon\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"></circle>\n <path d=\"m21 21-4.35-4.35\"></path>\n </svg>\n <input type=\"text\" class=\"search\" id=\"search\" placeholder=\"Search tools...\" spellcheck=\"false\" />\n </div>\n <div class=\"tool-list\" id=\"tool-list\"></div>\n </aside>\n <main class=\"main\" id=\"main\">\n <div class=\"placeholder\" id=\"placeholder\">\n <div class=\"placeholder-icon\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\">\n <path d=\"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z\"/>\n </svg>\n </div>\n <p>Select a tool to view details</p>\n <p style=\"font-size: 12px; margin-top: 8px;\">\n <kbd>↑</kbd> <kbd>↓</kbd> to navigate · <kbd>⌘K</kbd> to search\n </p>\n </div>\n <div class=\"detail\" id=\"detail\" hidden></div>\n </main>\n</div>\n\n<script>\n(function () {\n var state = null;\n var selected = null;\n var filter = \"\";\n\n var listEl = document.getElementById(\"tool-list\");\n var detailEl = document.getElementById(\"detail\");\n var placeholderEl = document.getElementById(\"placeholder\");\n var searchEl = document.getElementById(\"search\");\n var countEl = document.getElementById(\"tool-count\");\n\n function esc(text) {\n var div = document.createElement(\"div\");\n div.textContent = text == null ? \"\" : String(text);\n return div.innerHTML;\n }\n\n function api(path, options) {\n return fetch(path, options).then(function (res) {\n if (!res.ok) throw new Error(\"Request failed: \" + res.status);\n return res.json();\n });\n }\n\n function load() {\n api(\"/api/state\").then(function (data) {\n state = data;\n countEl.textContent = data.tools.length + \" tools from \" + data.label;\n renderList();\n renderDetail();\n }).catch(function (error) {\n console.error(\"Failed to load tools:\", error);\n countEl.textContent = \"Failed to load\";\n listEl.innerHTML = '<div style=\"padding: 20px; text-align: center; color: var(--fault);\">Error loading tools: ' + esc(error.message) + '</div>';\n });\n }\n\n function visibleTools() {\n if (!state) return [];\n var f = filter.toLowerCase();\n return state.tools.filter(function (tool) {\n return tool.name.toLowerCase().indexOf(f) !== -1 ||\n (tool.description && tool.description.toLowerCase().indexOf(f) !== -1);\n });\n }\n\n function groupTools(tools) {\n var groups = { read: [], write: [], destructive: [] };\n tools.forEach(function (tool) {\n var key = tool.sideEffect || \"read\";\n if (!groups[key]) groups[key] = [];\n groups[key].push(tool);\n });\n return groups;\n }\n\n function renderList() {\n var tools = visibleTools();\n var groups = groupTools(tools);\n var html = \"\";\n\n [\"read\", \"write\", \"destructive\"].forEach(function (risk) {\n var group = groups[risk];\n if (!group || group.length === 0) return;\n html += '<div class=\"tool-group\">' + risk + ' (' + group.length + ')</div>';\n group.forEach(function (tool) {\n var isSelected = tool.name === selected;\n html += '<button class=\"tool\" data-name=\"' + esc(tool.name) + '\" aria-selected=\"' + isSelected + '\">' +\n '<span class=\"tool-indicator ' + risk + '\"></span>' +\n '<span class=\"tool-name\">' + esc(tool.name) + \"</span>\" +\n (!tool.enabled ? '<span class=\"tool-badge disabled\">off</span>' : \"\") +\n \"</button>\";\n });\n });\n\n if (tools.length === 0) {\n html = '<div style=\"padding: 20px; text-align: center; color: var(--faint);\">No tools match your search</div>';\n }\n\n listEl.innerHTML = html;\n\n Array.prototype.forEach.call(listEl.querySelectorAll(\".tool\"), function (btn) {\n btn.addEventListener(\"click\", function () {\n selected = btn.getAttribute(\"data-name\");\n renderList();\n renderDetail();\n });\n });\n }\n\n function currentTool() {\n if (!state || !selected) return null;\n return state.tools.find(function (tool) { return tool.name === selected; });\n }\n\n function renderDetail() {\n var tool = currentTool();\n if (!tool) {\n detailEl.hidden = true;\n placeholderEl.hidden = false;\n return;\n }\n\n placeholderEl.hidden = true;\n detailEl.hidden = false;\n\n var badges = [\n '<span class=\"badge ' + tool.sideEffect + '\">' + tool.sideEffect + \"</span>\",\n !tool.enabled ? '<span class=\"badge disabled\">starts disabled</span>' : \"\",\n tool.endpointRole !== \"endpoint\" ? '<span class=\"badge auth\">' + tool.endpointRole + \"</span>\" : \"\",\n tool.piiInOutput.length > 0 ? '<span class=\"badge write\">pii: ' + esc(tool.piiInOutput.join(\", \")) + \"</span>\" : \"\",\n ].filter(Boolean).join(\"\");\n\n var findings = tool.findings.map(function (finding) {\n var icon = finding.level === \"error\" ? \"✖\" : \"⚠\";\n return '<div class=\"finding ' + finding.level + '\"><span class=\"finding-icon\">' + icon + \"</span><span>\" + esc(finding.message) + \"</span></div>\";\n }).join(\"\");\n\n var schema = tool.inputSchema || {};\n var properties = schema.properties || {};\n var required = schema.required || [];\n var fields = Object.keys(properties).map(function (key) {\n var field = properties[key];\n var type = field.type === \"number\" || field.type === \"integer\" ? \"number\" : \"text\";\n var req = required.indexOf(key) !== -1 ? ' <span class=\"req\">*</span>' : \"\";\n var hint = field.description ? '<div class=\"param-hint\">' + esc(field.description) + \"</div>\" : \"\";\n return '<div class=\"param\"><label class=\"param-label\">' + esc(key) + req + '</label>' +\n '<input class=\"param-input\" data-field=\"' + esc(key) + '\" data-type=\"' + esc(field.type || \"string\") + '\" type=\"' + type + '\" spellcheck=\"false\" />' +\n hint + \"</div>\";\n }).join(\"\");\n\n var baseUrl = \"\";\n try { baseUrl = localStorage.getItem(\"webmcp-codegen:baseUrl\") || tool.serverUrl || \"\"; } catch (e) {}\n\n detailEl.innerHTML =\n '<div class=\"detail-header\">' +\n '<div class=\"detail-crumb\">' + esc(state.label) + (state.outDir ? \" → \" + esc(state.outDir) : \"\") + \"</div>\" +\n '<h1 class=\"detail-title\">' + esc(tool.name) + \"</h1>\" +\n '<div class=\"detail-route\">' +\n '<span class=\"verb ' + tool.sideEffect + '\">' + esc(tool.verb || \"GET\") + \"</span>\" +\n \"<span>\" + esc(tool.path || \"\") + \"</span>\" +\n \"</div>\" +\n '<div class=\"badges\">' + badges + \"</div>\" +\n \"</div>\" +\n\n (findings ? '<div class=\"section\"><div class=\"section-label\">Audit findings</div>' + findings + \"</div>\" : \"\") +\n\n '<div class=\"section\">' +\n '<div class=\"section-label\">Description</div>' +\n '<textarea class=\"description-edit\" id=\"desc\" spellcheck=\"false\">' + esc(tool.description) + \"</textarea>\" +\n '<div class=\"edit-actions\">' +\n '<button class=\"btn btn-primary\" id=\"save-desc\">Save</button>' +\n '<span class=\"saved-indicator\" id=\"saved\">Saved</span>' +\n \"</div>\" +\n '<div class=\"edit-hint\">Agents pick tools by this text. Saved to .webmcp-codegen.json, so it survives regeneration. ⌘S to save.</div>' +\n \"</div>\" +\n\n '<div class=\"section\">' +\n '<div class=\"section-label\">Status</div>' +\n '<div class=\"toggle-row\">' +\n '<button class=\"switch\" id=\"toggle-enabled\" role=\"switch\" aria-checked=\"' + tool.enabled + '\" aria-label=\"Enabled\"></button>' +\n '<div class=\"toggle-copy\"><strong>' + (tool.enabled ? \"Enabled\" : \"Disabled\") + \"</strong>\" +\n (tool.enabled\n ? \"This tool works as soon as the app registers it.\"\n : \"The generated code is there, commented out. Flipping this regenerates it enabled on the next run.\") +\n \"</div></div>\" +\n \"</div>\" +\n\n '<div class=\"section\">' +\n '<div class=\"section-label\">Test</div>' +\n '<div class=\"try-section\">' +\n '<div class=\"try-header\"><h3>Run this tool</h3><span class=\"try-note\">server-side, no browser session</span></div>' +\n '<div class=\"try-body\">' +\n (tool.requiresAuth\n ? '<div class=\"auth-note\">⚠ This endpoint requires a browser session. The dashboard runs server-side, so you will get a 401. Test it in Chrome DevTools where you are signed in.</div>'\n : \"\") +\n '<input class=\"base-url-input\" id=\"base-url\" type=\"text\" placeholder=\"Base URL (e.g. http://localhost:3000)\" value=\"' + esc(baseUrl) + '\" spellcheck=\"false\" />' +\n (fields || '<div style=\"color: var(--faint); font-size: 13px; margin-bottom: 14px;\">This tool takes no inputs.</div>') +\n '<button class=\"run-btn\" id=\"run\">Run tool</button>' +\n '<pre class=\"result\" id=\"result\" hidden></pre>' +\n \"</div></div>\" +\n \"</div>\";\n\n document.getElementById(\"save-desc\").addEventListener(\"click\", saveDescription);\n document.getElementById(\"toggle-enabled\").addEventListener(\"click\", toggleEnabled);\n document.getElementById(\"run\").addEventListener(\"click\", runTool);\n document.getElementById(\"base-url\").addEventListener(\"change\", function (event) {\n try { localStorage.setItem(\"webmcp-codegen:baseUrl\", event.target.value); } catch (e) {}\n });\n }\n\n function saveDescription() {\n var tool = currentTool();\n var desc = document.getElementById(\"desc\").value.trim();\n if (!tool || !desc) return;\n api(\"/api/override\", {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ name: tool.name, description: desc }),\n }).then(function () {\n tool.description = desc;\n var saved = document.getElementById(\"saved\");\n saved.classList.add(\"show\");\n setTimeout(function () { saved.classList.remove(\"show\"); }, 2000);\n }).catch(function (error) { alert(error.message); });\n }\n\n function toggleEnabled() {\n var tool = currentTool();\n if (!tool) return;\n var next = !tool.enabled;\n api(\"/api/override\", {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ name: tool.name, enabled: next }),\n }).then(function () {\n tool.enabled = next;\n renderList();\n renderDetail();\n }).catch(function (error) { alert(error.message); });\n }\n\n function runTool() {\n var tool = currentTool();\n if (!tool) return;\n var input = {};\n Array.prototype.forEach.call(document.querySelectorAll(\"[data-field]\"), function (field) {\n var value = field.value;\n if (value === \"\") return;\n var type = field.getAttribute(\"data-type\");\n if (type === \"number\" || type === \"integer\") value = Number(value);\n if (type === \"boolean\") value = value === \"true\";\n if (type === \"object\" || type === \"array\") {\n try { value = JSON.parse(value); } catch (e) { /* keep as string */ }\n }\n input[field.getAttribute(\"data-field\")] = value;\n });\n var baseUrl = document.getElementById(\"base-url\").value.trim();\n var resultEl = document.getElementById(\"result\");\n var runEl = document.getElementById(\"run\");\n runEl.disabled = true;\n runEl.textContent = \"Running...\";\n resultEl.hidden = true;\n api(\"/api/run\", {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ name: tool.name, input: input, baseUrl: baseUrl || undefined }),\n }).then(function (result) {\n resultEl.hidden = false;\n resultEl.className = \"result \" + (result.ok ? \"ok\" : \"err\");\n resultEl.textContent =\n (result.status ? \"HTTP \" + result.status + \"\\n\\n\" : \"\") +\n (result.error ? result.error : JSON.stringify(result.body, null, 2));\n }).catch(function (error) {\n resultEl.hidden = false;\n resultEl.className = \"result err\";\n resultEl.textContent = error.message;\n }).finally(function () {\n runEl.disabled = false;\n runEl.textContent = \"Run tool\";\n });\n }\n\n /* Keyboard navigation */\n document.addEventListener(\"keydown\", function (event) {\n if ((event.metaKey || event.ctrlKey) && event.key === \"k\") {\n event.preventDefault();\n searchEl.focus();\n return;\n }\n if ((event.metaKey || event.ctrlKey) && event.key === \"s\") {\n event.preventDefault();\n saveDescription();\n return;\n }\n if (event.target === searchEl || event.target.tagName === \"TEXTAREA\" || event.target.tagName === \"INPUT\") {\n return;\n }\n if (event.key !== \"ArrowDown\" && event.key !== \"ArrowUp\") return;\n var tools = visibleTools();\n var index = tools.findIndex(function (tool) { return tool.name === selected; });\n var next = event.key === \"ArrowDown\" ? index + 1 : index - 1;\n if (next < 0 || next >= tools.length) return;\n event.preventDefault();\n selected = tools[next].name;\n renderList();\n renderDetail();\n var button = listEl.querySelector('[aria-selected=\"true\"]');\n if (button) button.scrollIntoView({ block: \"nearest\" });\n });\n\n searchEl.addEventListener(\"input\", function (event) {\n filter = event.target.value;\n renderList();\n });\n\n load();\n})();\n</script>\n</body>\n</html>`;\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,SAAS,aAAa;AACtB,SAAS,oBAAiC;;;ACG1C,SAAS,UAAU,iBAAiB;AACpC,SAAS,YAAY;AAGd,IAAM,iBAAiB;AAW9B,eAAsB,aAAa,KAAgC;AACjE,MAAI;AACF,UAAM,SAAS,KAAK,MAAM,MAAM,SAAS,KAAK,KAAK,cAAc,GAAG,MAAM,CAAC;AAC3E,WAAO,UAAU,OAAO,WAAW,WAAW,SAAS,CAAC;AAAA,EAC1D,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAOA,eAAsB,aAAa,KAAa,OAAyC;AACvF,QAAM,UAAU,MAAM,aAAa,GAAG;AACtC,QAAM,OAAiB,EAAE,GAAG,SAAS,GAAG,MAAM;AAC9C,MAAI,KAAK,UAAU,IAAI,MAAM,KAAK,UAAU,OAAO,EAAG;AACtD,QAAM,UAAU,KAAK,KAAK,cAAc,GAAG,GAAG,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC;AAAA,GAAM,MAAM;AACzF;;;ACpCA,SAAS,kBAAkB;AAC3B,SAAS,UAAU,QAAAA,aAAY;AAC/B,SAAS,uBAAuB;;;ACPhC,SAAS,eAAe;AACxB,SAAS,QAAAC,OAAM,gBAAgB;AAGxB,IAAM,oBAAoB;AAGjC,IAAM,eAAe,oBAAI,IAAI;AAAA,EAC3B;AAAA,EAC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YAAQ,GAAG,OAAO,MAAM;AACtB,UAAI;AACF,oBAAY,OAAO,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC;AAAA,MAC1C,QAAQ;AACN,eAAO,IAAI,MAAM,mBAAmB,CAAC;AAAA,MACvC;AAAA,IACF,CAAC;AACD,YAAQ,GAAG,SAAS,MAAM;AAAA,EAC5B,CAAC;AACH;AAEA,SAAS,YAAY,KAAmB;AACtC,QAAM,UACJ,QAAQ,aAAa,WAAW,SAAS,QAAQ,aAAa,UAAU,UAAU;AACpF,QAAM,SAAS,CAAC,GAAG,GAAG,EAAE,OAAO,UAAU,OAAO,QAAQ,aAAa,QAAQ,CAAC,EAAE,MAAM;AACxF;","names":["join","join","readdir","readFile","join","join","data","app"]}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* webmcp-codegen's command line.
|
|
4
|
+
*
|
|
5
|
+
* Design goals, in order:
|
|
6
|
+
* 1. The default output is the summary you need, not a log dump.
|
|
7
|
+
* 2. Every line earns its place; if it doesn't help you decide, it's gone.
|
|
8
|
+
* 3. The next step is always visible, never assumed.
|
|
9
|
+
* 4. Beautiful enough that developers screenshot it.
|
|
10
|
+
*
|
|
11
|
+
* Commands:
|
|
12
|
+
* webmcp-codegen the interactive dashboard (same as `dev`)
|
|
13
|
+
* webmcp-codegen generate write tool files from your spec
|
|
14
|
+
* webmcp-codegen init write a codegen.config.mjs for full control
|
|
15
|
+
* webmcp-codegen --help detailed help with examples
|
|
16
|
+
*
|
|
17
|
+
* Zero dependencies: argument parsing is Node's util.parseArgs, output is
|
|
18
|
+
* ANSI escapes we control character by character.
|
|
19
|
+
*/
|
|
20
|
+
interface CliFlags {
|
|
21
|
+
dryRun: boolean;
|
|
22
|
+
skipAudit: boolean;
|
|
23
|
+
force: boolean;
|
|
24
|
+
verbose: boolean;
|
|
25
|
+
watch: boolean;
|
|
26
|
+
config?: string;
|
|
27
|
+
spec?: string;
|
|
28
|
+
out?: string;
|
|
29
|
+
port?: number;
|
|
30
|
+
help: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type { CliFlags };
|