groundwork-mcp 0.0.0-stage → 0.2.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli.ts","../src/store/import.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { parseArgs } from \"node:util\";\nimport { KIND, type Kind } from \"./core/schemas\";\nimport type { Requirement } from \"./core/types\";\nimport { kindOf } from \"./core/requirements\";\nimport { ConfigError, DIR, findRoot, isInitialized, readConfig, writeConfig } from \"./store/config\";\nimport { COLLECTIONS, load, type Loaded } from \"./store/files\";\nimport { validate } from \"./store/validate\";\nimport { outgoing } from \"./mcp/server\";\nimport { runMcp } from \"./mcp/run\";\nimport { ImportError, runImport } from \"./store/import\";\n\ndeclare const __VERSION__: string;\nconst VERSION = typeof __VERSION__ === \"string\" ? __VERSION__ : \"0.0.0-dev\";\n\nconst HELP = `groundwork ${VERSION}: product evidence as linked files in your repo\n\nUsage:\n groundwork init [--name <product>] Create groundwork/config.yml in this folder\n groundwork validate [--json] Check every item and link. Exits 1 on errors (use it in CI)\n groundwork trace <ID> Show the evidence chain behind an item, e.g. REQ-0003\n groundwork list [kind] List items, optionally only one kind\n groundwork import --to <web app url> Move this project into the Groundwork web app\n [--dry-run] [--overwrite] (token from $GROUNDWORK_TOKEN)\n groundwork mcp Run the MCP server over stdio (same as groundwork-mcp)\n\nConnect your agent (Claude Code):\n claude mcp add groundwork -- npx -y groundwork-mcp\n`;\n\nconst useColor = process.stdout.isTTY && !process.env.NO_COLOR;\nconst paint = (code: number) => (s: string) => (useColor ? `\\x1b[${code}m${s}\\x1b[0m` : s);\nconst dim = paint(2);\nconst red = paint(31);\nconst yellow = paint(33);\nconst green = paint(32);\nconst bold = paint(1);\n\ntype Item = { id: string; title: string; status?: string; verdict?: string };\n\nfunction index(loaded: Loaded) {\n const byId = new Map<string, { kind: Kind; item: Item }>();\n for (const kind of KIND.options) for (const item of loaded.items[COLLECTIONS[kind]] as Item[]) byId.set(item.id, { kind, item });\n return byId;\n}\n\nfunction label(kind: Kind, item: Item) {\n const tags = [\n kind === \"requirement\" ? kindOf(item as unknown as Requirement) : undefined,\n item.status,\n item.verdict && item.verdict !== item.status ? item.verdict : undefined,\n ].filter(Boolean);\n return `${bold(item.id)} ${item.title}${tags.length ? dim(` (${tags.join(\", \")})`) : \"\"}`;\n}\n\nfunction cmdInit(name?: string) {\n const root = process.cwd();\n if (isInitialized(root)) {\n console.log(`${DIR}/config.yml already exists.`);\n return 0;\n }\n const config = readConfig(root);\n writeConfig(root, name ? { ...config, name } : config);\n console.log(`Created ${DIR}/config.yml. Add your product areas, products and people there.`);\n console.log(`\\nConnect your agent:\\n claude mcp add groundwork -- npx -y groundwork-mcp`);\n return 0;\n}\n\nfunction cmdValidate(json: boolean) {\n const root = findRoot();\n const problems = validate(load(root), readConfig(root));\n const errors = problems.filter((p) => p.level === \"error\");\n if (json) {\n console.log(JSON.stringify({ ok: !errors.length, problems }, null, 2));\n } else {\n for (const p of problems) console.log(`${p.level === \"error\" ? red(\"error\") : yellow(\"warning\")} ${p.file}: ${p.message}`);\n const counts = `${errors.length} error${errors.length === 1 ? \"\" : \"s\"}, ${problems.length - errors.length} warning${problems.length - errors.length === 1 ? \"\" : \"s\"}`;\n console.log(errors.length ? red(counts) : green(problems.length ? counts : \"All items and links are valid.\"));\n }\n return errors.length ? 1 : 0;\n}\n\nfunction cmdTrace(id: string) {\n const loaded = load(findRoot());\n const byId = index(loaded);\n const root = byId.get(id);\n if (!root) {\n console.error(red(`No item with id ${id}.`));\n return 1;\n }\n console.log(label(root.kind, root.item));\n const seen = new Set([id]);\n const walk = (cur: string, prefix: string) => {\n const hit = byId.get(cur)!;\n const next = outgoing(hit.kind, hit.item as never).filter((x) => byId.has(x));\n next.forEach((x, i) => {\n const last = i === next.length - 1;\n const child = byId.get(x)!;\n const again = seen.has(x);\n console.log(`${prefix}${last ? \"└─ \" : \"├─ \"}${dim(child.kind)} ${label(child.kind, child.item)}${again ? dim(\" (shown above)\") : \"\"}`);\n if (!again) {\n seen.add(x);\n walk(x, prefix + (last ? \" \" : \"│ \"));\n }\n });\n };\n walk(id, \"\");\n const dangling = outgoing(root.kind, root.item as never).filter((x) => !byId.has(x));\n if (dangling.length) console.log(red(`Links to missing items: ${dangling.join(\", \")}`));\n return 0;\n}\n\nfunction cmdList(kind?: string) {\n if (kind && !KIND.options.includes(kind as Kind)) {\n console.error(red(`Unknown kind \"${kind}\". Use one of: ${KIND.options.join(\", \")}.`));\n return 1;\n }\n const loaded = load(findRoot());\n for (const k of kind ? [kind as Kind] : KIND.options) {\n const items = loaded.items[COLLECTIONS[k]] as Item[];\n if (!items.length) continue;\n console.log(bold(`${COLLECTIONS[k]} (${items.length})`));\n for (const item of [...items].sort((a, b) => a.id.localeCompare(b.id))) console.log(` ${label(k, item)}`);\n }\n return 0;\n}\n\nasync function cmdImport(to: string | undefined, token: string | undefined, dryRun: boolean, overwrite: boolean) {\n if (!to || !token) {\n console.error(\"Usage: GROUNDWORK_TOKEN=gw_… groundwork import --to https://<your Groundwork web app> [--dry-run] [--overwrite]\");\n console.error(\"Create the token in the web app: Settings → Connect an agent.\");\n return 1;\n }\n const root = findRoot();\n const already = readConfig(root).migrated;\n if (already && !dryRun) console.log(dim(`This folder was imported before (${already}). Items already there are ${overwrite ? \"replaced\" : \"skipped\"}.`));\n try {\n const r = await runImport({ root, to, token, dryRun, overwrite });\n console.log(`${dryRun ? bold(\"Dry run, nothing saved. \") : \"\"}${r.workspace}: ${r.created} new, ${r.updated} replaced, ${r.skipped} already there.`);\n if (r.addedAreas.length) console.log(`Product areas added: ${r.addedAreas.join(\", \")}`);\n if (r.addedProducts.length) console.log(`Products added: ${r.addedProducts.join(\", \")}`);\n for (const w of r.warnings) console.log(`${yellow(\"warning\")} ${w}`);\n if (!dryRun) {\n console.log(green(`Imported. Open ${r.url}`));\n console.log(`\\n${DIR}/config.yml now says migrated, so local tools only read these files. Point your agent at the web app:`);\n console.log(` claude mcp remove groundwork`);\n console.log(` claude mcp add --transport http groundwork ${new URL(r.url).origin}/api/mcp --header \"Authorization: Bearer $GROUNDWORK_TOKEN\"`);\n }\n return 0;\n } catch (e) {\n if (!(e instanceof ImportError)) throw e;\n console.error(red(e.message));\n for (const p of e.problems.slice(0, 20)) console.error(` ${p.file}: ${p.message}`);\n return 1;\n }\n}\n\nasync function main(): Promise<number> {\n const { values, positionals } = parseArgs({\n allowPositionals: true,\n options: {\n name: { type: \"string\" },\n json: { type: \"boolean\" },\n to: { type: \"string\" },\n token: { type: \"string\" },\n \"dry-run\": { type: \"boolean\" },\n overwrite: { type: \"boolean\" }, help: { type: \"boolean\", short: \"h\" }, version: { type: \"boolean\", short: \"v\" } },\n });\n const [cmd, arg] = positionals;\n if (values.version) return console.log(VERSION), 0;\n if (values.help || !cmd || cmd === \"help\") return console.log(HELP), 0;\n switch (cmd) {\n case \"init\":\n return cmdInit(values.name);\n case \"validate\":\n return cmdValidate(Boolean(values.json));\n case \"trace\":\n if (!arg) return console.error(\"Usage: groundwork trace <ID>\"), 1;\n return cmdTrace(arg.toUpperCase());\n case \"list\":\n return cmdList(arg);\n case \"import\":\n return cmdImport(values.to, values.token ?? process.env.GROUNDWORK_TOKEN, Boolean(values[\"dry-run\"]), Boolean(values.overwrite));\n case \"mcp\":\n await runMcp();\n return -1; // keep running\n default:\n console.error(`Unknown command \"${cmd}\".\\n\\n${HELP}`);\n return 1;\n }\n}\n\nmain()\n .then((code) => {\n if (code >= 0) process.exit(code);\n })\n .catch((e) => {\n console.error(red(e instanceof ConfigError ? e.message : `groundwork: ${(e as Error).message}`));\n process.exit(1);\n });\n","import { readConfig, writeConfig } from \"./config\";\nimport { load } from \"./files\";\nimport { validate, type Problem } from \"./validate\";\n\n/**\n * Moving a project into the Groundwork web app: send every item to its /api/import endpoint, then mark the folder\n * as migrated so local tools stop writing (the web app is where changes go from then on).\n */\n\nexport const BUNDLE_FORMAT = \"groundwork-files\";\n/** Hosting platforms cap request bodies around 4.5 MB. */\nconst MAX_BYTES = 4_000_000;\n\nexport interface ImportReport {\n workspace: string;\n url: string;\n dryRun: boolean;\n created: number;\n updated: number;\n skipped: number;\n addedAreas: string[];\n addedProducts: string[];\n warnings: string[];\n ids: Record<string, string>;\n}\n\nexport class ImportError extends Error {\n constructor(\n message: string,\n readonly problems: Problem[] = [],\n ) {\n super(message);\n }\n}\n\nexport function buildBundle(root: string, opts: { dryRun?: boolean; overwrite?: boolean } = {}) {\n const config = readConfig(root);\n const loaded = load(root);\n const problems = validate(loaded, config).filter((p) => p.level === \"error\");\n if (problems.length) throw new ImportError(`Fix ${problems.length} error${problems.length === 1 ? \"\" : \"s\"} first (run groundwork validate).`, problems);\n const { activity: _activity, ...items } = loaded.items;\n void _activity;\n return {\n format: BUNDLE_FORMAT,\n schemaVersion: 1,\n config: { name: config.name, productAreas: config.productAreas, products: config.products, people: config.people },\n items,\n dryRun: Boolean(opts.dryRun),\n overwrite: Boolean(opts.overwrite),\n };\n}\n\nexport async function runImport(opts: {\n root: string;\n /** The web app's address, e.g. https://groundwork.example.com */\n to: string;\n token: string;\n dryRun?: boolean;\n overwrite?: boolean;\n fetch?: typeof fetch;\n}): Promise<ImportReport> {\n let origin: string;\n try {\n const u = new URL(opts.to);\n if (u.protocol !== \"https:\" && ![\"localhost\", \"127.0.0.1\"].includes(u.hostname)) throw new Error();\n origin = u.origin;\n } catch {\n throw new ImportError(`--to must be the web app's https address, e.g. https://groundwork.example.com (got \"${opts.to}\").`);\n }\n if (!/^gw_[A-Za-z0-9_-]{20,100}$/.test(opts.token)) {\n throw new ImportError(\"That doesn't look like a Groundwork agent token (gw_…). Create one in the web app: Settings → Connect an agent.\");\n }\n const body = JSON.stringify(buildBundle(opts.root, opts));\n if (body.length > MAX_BYTES) throw new ImportError(`This project is ${(body.length / 1e6).toFixed(1)} MB, more than an import can take (4 MB).`);\n\n const res = await (opts.fetch ?? fetch)(`${origin}/api/import`, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\", authorization: `Bearer ${opts.token}` },\n body,\n });\n const text = await res.text();\n let data: unknown;\n try {\n data = JSON.parse(text);\n } catch {\n throw new ImportError(`The web app answered ${res.status} without JSON. Is ${origin} a Groundwork web app?`);\n }\n if (!res.ok) throw new ImportError((data as { error?: { message?: string } }).error?.message ?? `The import failed (${res.status}).`);\n const report = data as ImportReport;\n if (!report.dryRun) writeConfig(opts.root, { ...readConfig(opts.root), migrated: report.url });\n return report;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,SAAS,iBAAiB;;;ACQnB,IAAM,gBAAgB;AAE7B,IAAM,YAAY;AAeX,IAAM,cAAN,cAA0B,MAAM;AAAA,EACrC,YACE,SACS,WAAsB,CAAC,GAChC;AACA,UAAM,OAAO;AAFJ;AAAA,EAGX;AAAA,EAHW;AAIb;AAEO,SAAS,YAAY,MAAc,OAAkD,CAAC,GAAG;AAC9F,QAAM,SAAS,WAAW,IAAI;AAC9B,QAAM,SAAS,KAAK,IAAI;AACxB,QAAM,WAAW,SAAS,QAAQ,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,UAAU,OAAO;AAC3E,MAAI,SAAS,OAAQ,OAAM,IAAI,YAAY,OAAO,SAAS,MAAM,SAAS,SAAS,WAAW,IAAI,KAAK,GAAG,qCAAqC,QAAQ;AACvJ,QAAM,EAAE,UAAU,WAAW,GAAG,MAAM,IAAI,OAAO;AACjD,OAAK;AACL,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,eAAe;AAAA,IACf,QAAQ,EAAE,MAAM,OAAO,MAAM,cAAc,OAAO,cAAc,UAAU,OAAO,UAAU,QAAQ,OAAO,OAAO;AAAA,IACjH;AAAA,IACA,QAAQ,QAAQ,KAAK,MAAM;AAAA,IAC3B,WAAW,QAAQ,KAAK,SAAS;AAAA,EACnC;AACF;AAEA,eAAsB,UAAU,MAQN;AACxB,MAAI;AACJ,MAAI;AACF,UAAM,IAAI,IAAI,IAAI,KAAK,EAAE;AACz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