@archstone/cli 0.3.1 → 0.4.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.
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -37,9 +37,18 @@ archstone apply ${dir}
|
|
|
37
37
|
console.log(` semantic ${errors.length} error(s), ${warnings.length} warning(s)`);
|
|
38
38
|
for (const d of errors) console.log(` \u2717 ${d.message}`);
|
|
39
39
|
for (const d of warnings) console.log(` \u26A0 ${d.message}`);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const shapesAndSemanticsOk = res.ok && errors.length === 0;
|
|
41
|
+
const registry = shapesAndSemanticsOk ? new Registry(compile(res)) : void 0;
|
|
42
|
+
const collisions = registry?.toolNameCollisions ?? [];
|
|
43
|
+
if (collisions.length > 0) {
|
|
44
|
+
console.log(`
|
|
45
|
+
\u2717 ${collisions.length} tool-name collision(s):`);
|
|
46
|
+
for (const c of collisions) {
|
|
47
|
+
console.log(` - tool name '${c.name}' is ambiguous \u2014 capabilities ${c.ids.join(", ")} all sanitize to it`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const ok = shapesAndSemanticsOk && collisions.length === 0;
|
|
51
|
+
if (ok && registry) {
|
|
43
52
|
const invocable = registry.listCapabilities().filter((t) => t.connector).length;
|
|
44
53
|
console.log(` registry IR v${registry.ir.version} \u2014 ${registry.size} capabilities, ${invocable} invocable (bound)`);
|
|
45
54
|
console.log(`
|
|
@@ -60,6 +69,14 @@ function runBuild(dir, outPath) {
|
|
|
60
69
|
process.exit(1);
|
|
61
70
|
}
|
|
62
71
|
const ir = compile(res);
|
|
72
|
+
const registry = new Registry(ir);
|
|
73
|
+
if (registry.toolNameCollisions.length > 0) {
|
|
74
|
+
console.error(`archstone build ${dir}: refusing to write artifact \u2014 tool-name collision(s):`);
|
|
75
|
+
for (const c of registry.toolNameCollisions) {
|
|
76
|
+
console.error(` - tool name '${c.name}' is ambiguous \u2014 capabilities ${c.ids.join(", ")} all sanitize to it`);
|
|
77
|
+
}
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
63
80
|
const stripped = { ...ir, tools: ir.tools.map(({ contract: _contract, ...t }) => t) };
|
|
64
81
|
const outFile = resolve(process.cwd(), outPath ?? "archstone.ir.json");
|
|
65
82
|
writeFileSync(outFile, `${JSON.stringify(stripped, null, 2)}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n// @archstone/cli — `archstone apply` (#1) + `archstone serve` (#7, + `--http` ADD-0008 #29)\n// + `archstone verify` (#18-20) + `archstone build` (ADD-0008 #27)\n//\n// apply: parse → shape-validate (#2) → semantic-validate (#3) → compile IR (#4)\n// → index Registry (#5), and REPORT (human output, exits).\n// serve: build the registry and expose it as an MCP server over stdio (#7),\n// so Claude/Cursor/ChatGPT can discover and invoke the tools. Blocks.\n// serve --http: same registry, served over real Streamable-HTTP instead of stdio —\n// `@archstone/runtime/http`'s createHttpHandler (Web-standard Request/Response,\n// bearer-token gated, shared with @archstone/agent/mcp's mcpHandler(), ADD-0008 D-3)\n// behind a thin Node-http adapter. Blocks.\n// verify: replay each bound capability's golden fixture against the LIVE backend\n// and report a per-binding health status (ADD-18). The only command that\n// makes a network call outside a real MCP invocation — on demand, never\n// scheduled by Archstone itself (wire it into your own CI/cron).\n// build: run the same compile pipeline as `apply`, strip each tool's `contract`\n// (D-8 — the fingerprint/golden-fixture path is meaningless once the fixture\n// file isn't shipping), and write the IR as a standalone JSON artifact —\n// the substrate `@archstone/agent`'s `fromIR()` will consume (RFC-0008).\n\nimport { writeFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { createServer, type IncomingMessage, type ServerResponse } from \"node:http\";\nimport { load } from \"@archstone/schema\";\nimport { validateSemantics, compile, type IR } from \"@archstone/compiler\";\nimport { Registry, buildRegistry, serveStdio, runVerify, type HealthStatus } from \"@archstone/runtime\";\nimport { createHttpHandler } from \"@archstone/runtime/http\";\n\nfunction runApply(dir: string): void {\n const res = load(dir);\n console.log(`\\narchstone apply ${dir}\\n`);\n\n if (res.capabilities) {\n const c = res.capabilities;\n console.log(` company ${c.company.name ?? c.company.id} (${c.company.id})`);\n console.log(` providers ${c.providers.join(\", \")}`);\n console.log(` declared ${c.capabilities.length} capabilities`);\n }\n console.log(` loaded ${res.capabilityDocs.length} capability docs, ${res.bindings.length} bindings`);\n for (const d of res.capabilityDocs) {\n console.log(` ✓ ${d.capability.id} [${d.capability.effect}] → ${d.capability.provider ?? \"?\"}`);\n }\n\n // Shape (schema) issues from #2 — \"valid shapes\" is not \"deployable\".\n if (res.issues.length > 0) {\n console.log(`\\n ✗ ${res.issues.length} shape issue(s):`);\n for (const i of res.issues) console.log(` - ${i.file}: ${i.message}`);\n } else {\n console.log(`\\n ✓ shapes valid`);\n }\n\n // Semantic pass (#3) — cross-file resolution; errors block, warnings inform.\n const diags = validateSemantics(res);\n const errors = diags.filter((d) => d.severity === \"error\");\n const warnings = diags.filter((d) => d.severity === \"warning\");\n console.log(` semantic ${errors.length} error(s), ${warnings.length} warning(s)`);\n for (const d of errors) console.log(` ✗ ${d.message}`);\n for (const d of warnings) console.log(` ⚠ ${d.message}`);\n\n const ok = res.ok && errors.length === 0;\n\n // Compile to IR (#4) + index into the Registry (#5) — only when valid enough to emit.\n if (ok) {\n const registry = new Registry(compile(res));\n const invocable = registry.listCapabilities().filter((t) => t.connector).length;\n console.log(` registry IR v${registry.ir.version} — ${registry.size} capabilities, ${invocable} invocable (bound)`);\n console.log(`\\n → run 'archstone serve ${dir}' to expose ${invocable} tool(s) to an AI agent over MCP`);\n }\n\n console.log(\"\");\n process.exit(ok ? 0 : 1);\n}\n\nfunction runBuild(dir: string, outPath: string | undefined): void {\n const res = load(dir);\n const diags = validateSemantics(res);\n const errors = diags.filter((d) => d.severity === \"error\");\n const ok = res.ok && errors.length === 0;\n\n if (!ok) {\n console.error(`archstone build ${dir}: manifest invalid — run 'archstone apply ${dir}' for details`);\n for (const i of res.issues) console.error(` - ${i.file}: ${i.message}`);\n for (const d of errors) console.error(` - ${d.message}`);\n process.exit(1);\n }\n\n const ir = compile(res);\n // D-8: the artifact ships with no code alongside it — the fingerprint + golden-fixture\n // path have no meaning without the fixture file / `archstone verify`, so strip `contract`\n // from every tool before writing.\n const stripped: IR = { ...ir, tools: ir.tools.map(({ contract: _contract, ...t }) => t) };\n\n const outFile = resolve(process.cwd(), outPath ?? \"archstone.ir.json\");\n writeFileSync(outFile, `${JSON.stringify(stripped, null, 2)}\\n`);\n console.log(`archstone build ${dir} → ${outFile} (${stripped.tools.length} tool(s))`);\n process.exit(0);\n}\n\nfunction runServeHttp(dir: string, port: number, token: string | undefined): void {\n // Rule #7 / ADD-0008 R-5: fail closed before touching the network — a missing token is a\n // startup error, never a silently-open endpoint. `--token` wins over the env var if both\n // are set; createHttpHandler itself would also throw on empty, but checking here first\n // gives a CLI-appropriate error message instead of an uncaught exception.\n if (!token) {\n console.error(\n \"archstone serve --http: bearer token required — set ARCHSTONE_HTTP_TOKEN or pass --token <value>\",\n );\n process.exit(1);\n }\n\n const built = buildRegistry(dir);\n if (!built.ok || !built.registry) {\n console.error(`archstone: cannot serve '${dir}' — manifest invalid:`);\n for (const i of built.issues) console.error(` - ${i.file}: ${i.message}`);\n for (const d of built.diagnostics.filter((x) => x.severity === \"error\")) console.error(` - ${d.message}`);\n process.exit(1);\n }\n\n const handler = createHttpHandler(built.registry, { bearerToken: token });\n const server = createServer((req, res) => {\n void handleHttpRequest(handler, req, res);\n });\n server.listen(port, () => {\n console.error(`archstone: serving MCP over HTTP on http://localhost:${port}/ (bearer-token gated)`);\n });\n}\n\n// D-3's \"~20-line wrapper\": Node's http.IncomingMessage/ServerResponse <-> Web-standard\n// Request/Response, so createHttpHandler (already Web-standard, shared with\n// @archstone/agent/mcp's mcpHandler()) can serve real Node HTTP traffic without a second\n// transport implementation. CLI-level plumbing only — HTTP itself still lives in\n// providers/rest for business-backend calls; this adapter never touches a backend.\nasync function handleHttpRequest(\n handler: (request: Request) => Promise<Response>,\n req: IncomingMessage,\n res: ServerResponse,\n): Promise<void> {\n const chunks: Buffer[] = [];\n for await (const chunk of req) chunks.push(chunk as Buffer);\n const headers = new Headers();\n for (const [key, value] of Object.entries(req.headers)) {\n if (value !== undefined) headers.set(key, Array.isArray(value) ? value.join(\", \") : value);\n }\n const hasBody = req.method !== \"GET\" && req.method !== \"HEAD\" && chunks.length > 0;\n const request = new Request(`http://${req.headers.host ?? \"localhost\"}${req.url ?? \"/\"}`, {\n method: req.method ?? \"GET\",\n headers,\n body: hasBody ? Buffer.concat(chunks) : undefined,\n });\n\n const response = await handler(request);\n res.statusCode = response.status;\n response.headers.forEach((value, key) => res.setHeader(key, value));\n res.end(response.body ? Buffer.from(await response.arrayBuffer()) : undefined);\n}\n\nconst HEALTH_ICON: Record<HealthStatus, string> = { green: \"🟢\", yellow: \"🟡\", red: \"🔴\" };\n\nasync function runVerifyCmd(dir: string, json: boolean): Promise<void> {\n const res = load(dir);\n const diags = validateSemantics(res);\n const errors = diags.filter((d) => d.severity === \"error\");\n const ok = res.ok && errors.length === 0;\n if (!ok) {\n if (json) {\n // ADD-20 D-2: this shape is strictly disjoint from the `{results}` shape below —\n // never add a shared \"envelope\" field (e.g. `ok`) to either.\n console.log(JSON.stringify({ error: \"manifest_invalid\", issues: res.issues, errors }));\n } else {\n console.error(`archstone verify ${dir}: manifest invalid — run 'archstone apply ${dir}' for details`);\n }\n process.exit(2);\n }\n\n const registry = new Registry(compile(res));\n const reports = await runVerify(registry.listCapabilities(), dir, registry.ir.resources);\n\n if (json) {\n // ADD-20 D-2: strictly disjoint from the `{error, issues, errors}` shape above.\n console.log(JSON.stringify({ results: reports }));\n process.exit(reports.some((r) => r.status === \"red\") ? 1 : 0);\n }\n\n console.log(`\\narchstone verify ${dir}\\n`);\n if (reports.length === 0) {\n console.log(\" (no bindings declare a contract: — nothing to verify)\\n\");\n process.exit(0);\n }\n for (const r of reports) {\n console.log(` ${HEALTH_ICON[r.status]} ${r.capabilityId} — ${r.detail}`);\n }\n console.log(\"\");\n process.exit(reports.some((r) => r.status === \"red\") ? 1 : 0);\n}\n\n/** Value of a `--name value` flag pair, plus the index it was found at (-1 if absent) —\n * used both to read the value and to exclude both tokens from the positional args. */\nfunction flagArg(argv: string[], name: string): { value?: string; idx: number } {\n const idx = argv.indexOf(name);\n return { value: idx !== -1 ? argv[idx + 1] : undefined, idx };\n}\n\nasync function main(): Promise<void> {\n const argv = process.argv.slice(2);\n const json = argv.includes(\"--json\");\n const http = argv.includes(\"--http\");\n const out = flagArg(argv, \"--out\");\n const port = flagArg(argv, \"--port\");\n const token = flagArg(argv, \"--token\");\n\n const consumed = new Set<number>();\n for (const f of [out, port, token]) {\n if (f.idx !== -1) {\n consumed.add(f.idx);\n consumed.add(f.idx + 1);\n }\n }\n const positional = argv.filter((a, i) => !consumed.has(i) && a !== \"--json\" && a !== \"--http\");\n const [cmd, dir] = positional;\n\n if (cmd === \"apply\" && dir) {\n runApply(dir);\n return;\n }\n if (cmd === \"serve\" && dir && http) {\n // Bearer token: --token wins over ARCHSTONE_HTTP_TOKEN if both are set (Rule #7 —\n // required, never defaults open).\n runServeHttp(dir, Number(port.value ?? 8787), token.value ?? process.env.ARCHSTONE_HTTP_TOKEN);\n return; // blocks on the HTTP server\n }\n if (cmd === \"serve\" && dir) {\n await serveStdio(dir); // blocks on the stdio transport\n return;\n }\n if (cmd === \"verify\" && dir) {\n await runVerifyCmd(dir, json);\n return;\n }\n if (cmd === \"build\" && dir) {\n runBuild(dir, out.value);\n return;\n }\n\n console.error(\n \"usage: archstone <apply|serve|verify|build> <manifest-dir> [--json] [--out path]\\n\" +\n \" archstone serve --http <manifest-dir> [--port <n>] [--token <value>]\\n\" +\n \" bearer token: --token <value>, or the ARCHSTONE_HTTP_TOKEN env var (required — never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;AAEnB,MAAI,QAAQ,WAAW,KAAK;AAC1B,aAAS,GAAG;AACZ;AAAA,EACF;AACA,MAAI,QAAQ,WAAW,OAAO,MAAM;AAGlC,iBAAa,KAAK,OAAO,KAAK,SAAS,IAAI,GAAG,MAAM,SAAS,QAAQ,IAAI,oBAAoB;AAC7F;AAAA,EACF;AACA,MAAI,QAAQ,WAAW,KAAK;AAC1B,UAAM,WAAW,GAAG;AACpB;AAAA,EACF;AACA,MAAI,QAAQ,YAAY,KAAK;AAC3B,UAAM,aAAa,KAAK,IAAI;AAC5B;AAAA,EACF;AACA,MAAI,QAAQ,WAAW,KAAK;AAC1B,aAAS,KAAK,IAAI,KAAK;AACvB;AAAA,EACF;AAEA,UAAQ;AAAA,IACN;AAAA,EAGF;AACA,UAAQ,KAAK,CAAC;AAChB;AAEA,KAAK;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n// @archstone/cli — `archstone apply` (#1) + `archstone serve` (#7, + `--http` ADD-0008 #29)\n// + `archstone verify` (#18-20) + `archstone build` (ADD-0008 #27)\n//\n// apply: parse → shape-validate (#2) → semantic-validate (#3) → compile IR (#4)\n// → index Registry (#5), and REPORT (human output, exits).\n// serve: build the registry and expose it as an MCP server over stdio (#7),\n// so Claude/Cursor/ChatGPT can discover and invoke the tools. Blocks.\n// serve --http: same registry, served over real Streamable-HTTP instead of stdio —\n// `@archstone/runtime/http`'s createHttpHandler (Web-standard Request/Response,\n// bearer-token gated, shared with @archstone/agent/mcp's mcpHandler(), ADD-0008 D-3)\n// behind a thin Node-http adapter. Blocks.\n// verify: replay each bound capability's golden fixture against the LIVE backend\n// and report a per-binding health status (ADD-18). The only command that\n// makes a network call outside a real MCP invocation — on demand, never\n// scheduled by Archstone itself (wire it into your own CI/cron).\n// build: run the same compile pipeline as `apply`, strip each tool's `contract`\n// (D-8 — the fingerprint/golden-fixture path is meaningless once the fixture\n// file isn't shipping), and write the IR as a standalone JSON artifact —\n// the substrate `@archstone/agent`'s `fromIR()` will consume (RFC-0008).\n\nimport { writeFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { createServer, type IncomingMessage, type ServerResponse } from \"node:http\";\nimport { load } from \"@archstone/schema\";\nimport { validateSemantics, compile, type IR } from \"@archstone/compiler\";\nimport { Registry, buildRegistry, serveStdio, runVerify, type HealthStatus } from \"@archstone/runtime\";\nimport { createHttpHandler } from \"@archstone/runtime/http\";\n\nfunction runApply(dir: string): void {\n const res = load(dir);\n console.log(`\\narchstone apply ${dir}\\n`);\n\n if (res.capabilities) {\n const c = res.capabilities;\n console.log(` company ${c.company.name ?? c.company.id} (${c.company.id})`);\n console.log(` providers ${c.providers.join(\", \")}`);\n console.log(` declared ${c.capabilities.length} capabilities`);\n }\n console.log(` loaded ${res.capabilityDocs.length} capability docs, ${res.bindings.length} bindings`);\n for (const d of res.capabilityDocs) {\n console.log(` ✓ ${d.capability.id} [${d.capability.effect}] → ${d.capability.provider ?? \"?\"}`);\n }\n\n // Shape (schema) issues from #2 — \"valid shapes\" is not \"deployable\".\n if (res.issues.length > 0) {\n console.log(`\\n ✗ ${res.issues.length} shape issue(s):`);\n for (const i of res.issues) console.log(` - ${i.file}: ${i.message}`);\n } else {\n console.log(`\\n ✓ shapes valid`);\n }\n\n // Semantic pass (#3) — cross-file resolution; errors block, warnings inform.\n const diags = validateSemantics(res);\n const errors = diags.filter((d) => d.severity === \"error\");\n const warnings = diags.filter((d) => d.severity === \"warning\");\n console.log(` semantic ${errors.length} error(s), ${warnings.length} warning(s)`);\n for (const d of errors) console.log(` ✗ ${d.message}`);\n for (const d of warnings) console.log(` ⚠ ${d.message}`);\n\n const shapesAndSemanticsOk = res.ok && errors.length === 0;\n\n // Compile to IR (#4) + index into the Registry (#5) — only when valid enough to emit.\n // ADD-30: a tool-name collision (two capability ids sanitizing to the same advertised\n // name) is checked here, before the final `ok`, alongside the semantic errors above —\n // 'apply' must refuse the same manifest 'build'/'serve' would refuse (D-2).\n const registry = shapesAndSemanticsOk ? new Registry(compile(res)) : undefined;\n const collisions = registry?.toolNameCollisions ?? [];\n if (collisions.length > 0) {\n console.log(`\\n ✗ ${collisions.length} tool-name collision(s):`);\n for (const c of collisions) {\n console.log(` - tool name '${c.name}' is ambiguous — capabilities ${c.ids.join(\", \")} all sanitize to it`);\n }\n }\n\n const ok = shapesAndSemanticsOk && collisions.length === 0;\n\n if (ok && registry) {\n const invocable = registry.listCapabilities().filter((t) => t.connector).length;\n console.log(` registry IR v${registry.ir.version} — ${registry.size} capabilities, ${invocable} invocable (bound)`);\n console.log(`\\n → run 'archstone serve ${dir}' to expose ${invocable} tool(s) to an AI agent over MCP`);\n }\n\n console.log(\"\");\n process.exit(ok ? 0 : 1);\n}\n\nfunction runBuild(dir: string, outPath: string | undefined): void {\n const res = load(dir);\n const diags = validateSemantics(res);\n const errors = diags.filter((d) => d.severity === \"error\");\n const ok = res.ok && errors.length === 0;\n\n if (!ok) {\n console.error(`archstone build ${dir}: manifest invalid — run 'archstone apply ${dir}' for details`);\n for (const i of res.issues) console.error(` - ${i.file}: ${i.message}`);\n for (const d of errors) console.error(` - ${d.message}`);\n process.exit(1);\n }\n\n const ir = compile(res);\n\n // ADD-30 R-2: `runBuild` didn't construct a Registry at all, so it could ship a broken\n // artifact whose ambiguous tool name only surfaces later, inside a third party's\n // `fromIR()` call. Refuse to write on a collision — fail at `build` time instead\n // (the same \"ambiguous is a compile-time error, never a guess\" pattern this repo already\n // applies to resource-name resolution, compiler/src/resolve.ts).\n const registry = new Registry(ir);\n if (registry.toolNameCollisions.length > 0) {\n console.error(`archstone build ${dir}: refusing to write artifact — tool-name collision(s):`);\n for (const c of registry.toolNameCollisions) {\n console.error(` - tool name '${c.name}' is ambiguous — capabilities ${c.ids.join(\", \")} all sanitize to it`);\n }\n process.exit(1);\n }\n\n // D-8: the artifact ships with no code alongside it — the fingerprint + golden-fixture\n // path have no meaning without the fixture file / `archstone verify`, so strip `contract`\n // from every tool before writing.\n const stripped: IR = { ...ir, tools: ir.tools.map(({ contract: _contract, ...t }) => t) };\n\n const outFile = resolve(process.cwd(), outPath ?? \"archstone.ir.json\");\n writeFileSync(outFile, `${JSON.stringify(stripped, null, 2)}\\n`);\n console.log(`archstone build ${dir} → ${outFile} (${stripped.tools.length} tool(s))`);\n process.exit(0);\n}\n\nfunction runServeHttp(dir: string, port: number, token: string | undefined): void {\n // Rule #7 / ADD-0008 R-5: fail closed before touching the network — a missing token is a\n // startup error, never a silently-open endpoint. `--token` wins over the env var if both\n // are set; createHttpHandler itself would also throw on empty, but checking here first\n // gives a CLI-appropriate error message instead of an uncaught exception.\n if (!token) {\n console.error(\n \"archstone serve --http: bearer token required — set ARCHSTONE_HTTP_TOKEN or pass --token <value>\",\n );\n process.exit(1);\n }\n\n const built = buildRegistry(dir);\n if (!built.ok || !built.registry) {\n console.error(`archstone: cannot serve '${dir}' — manifest invalid:`);\n for (const i of built.issues) console.error(` - ${i.file}: ${i.message}`);\n for (const d of built.diagnostics.filter((x) => x.severity === \"error\")) console.error(` - ${d.message}`);\n process.exit(1);\n }\n\n const handler = createHttpHandler(built.registry, { bearerToken: token });\n const server = createServer((req, res) => {\n void handleHttpRequest(handler, req, res);\n });\n server.listen(port, () => {\n console.error(`archstone: serving MCP over HTTP on http://localhost:${port}/ (bearer-token gated)`);\n });\n}\n\n// D-3's \"~20-line wrapper\": Node's http.IncomingMessage/ServerResponse <-> Web-standard\n// Request/Response, so createHttpHandler (already Web-standard, shared with\n// @archstone/agent/mcp's mcpHandler()) can serve real Node HTTP traffic without a second\n// transport implementation. CLI-level plumbing only — HTTP itself still lives in\n// providers/rest for business-backend calls; this adapter never touches a backend.\nasync function handleHttpRequest(\n handler: (request: Request) => Promise<Response>,\n req: IncomingMessage,\n res: ServerResponse,\n): Promise<void> {\n const chunks: Buffer[] = [];\n for await (const chunk of req) chunks.push(chunk as Buffer);\n const headers = new Headers();\n for (const [key, value] of Object.entries(req.headers)) {\n if (value !== undefined) headers.set(key, Array.isArray(value) ? value.join(\", \") : value);\n }\n const hasBody = req.method !== \"GET\" && req.method !== \"HEAD\" && chunks.length > 0;\n const request = new Request(`http://${req.headers.host ?? \"localhost\"}${req.url ?? \"/\"}`, {\n method: req.method ?? \"GET\",\n headers,\n body: hasBody ? Buffer.concat(chunks) : undefined,\n });\n\n const response = await handler(request);\n res.statusCode = response.status;\n response.headers.forEach((value, key) => res.setHeader(key, value));\n res.end(response.body ? Buffer.from(await response.arrayBuffer()) : undefined);\n}\n\nconst HEALTH_ICON: Record<HealthStatus, string> = { green: \"🟢\", yellow: \"🟡\", red: \"🔴\" };\n\nasync function runVerifyCmd(dir: string, json: boolean): Promise<void> {\n const res = load(dir);\n const diags = validateSemantics(res);\n const errors = diags.filter((d) => d.severity === \"error\");\n const ok = res.ok && errors.length === 0;\n if (!ok) {\n if (json) {\n // ADD-20 D-2: this shape is strictly disjoint from the `{results}` shape below —\n // never add a shared \"envelope\" field (e.g. `ok`) to either.\n console.log(JSON.stringify({ error: \"manifest_invalid\", issues: res.issues, errors }));\n } else {\n console.error(`archstone verify ${dir}: manifest invalid — run 'archstone apply ${dir}' for details`);\n }\n process.exit(2);\n }\n\n const registry = new Registry(compile(res));\n const reports = await runVerify(registry.listCapabilities(), dir, registry.ir.resources);\n\n if (json) {\n // ADD-20 D-2: strictly disjoint from the `{error, issues, errors}` shape above.\n console.log(JSON.stringify({ results: reports }));\n process.exit(reports.some((r) => r.status === \"red\") ? 1 : 0);\n }\n\n console.log(`\\narchstone verify ${dir}\\n`);\n if (reports.length === 0) {\n console.log(\" (no bindings declare a contract: — nothing to verify)\\n\");\n process.exit(0);\n }\n for (const r of reports) {\n console.log(` ${HEALTH_ICON[r.status]} ${r.capabilityId} — ${r.detail}`);\n }\n console.log(\"\");\n process.exit(reports.some((r) => r.status === \"red\") ? 1 : 0);\n}\n\n/** Value of a `--name value` flag pair, plus the index it was found at (-1 if absent) —\n * used both to read the value and to exclude both tokens from the positional args. */\nfunction flagArg(argv: string[], name: string): { value?: string; idx: number } {\n const idx = argv.indexOf(name);\n return { value: idx !== -1 ? argv[idx + 1] : undefined, idx };\n}\n\nasync function main(): Promise<void> {\n const argv = process.argv.slice(2);\n const json = argv.includes(\"--json\");\n const http = argv.includes(\"--http\");\n const out = flagArg(argv, \"--out\");\n const port = flagArg(argv, \"--port\");\n const token = flagArg(argv, \"--token\");\n\n const consumed = new Set<number>();\n for (const f of [out, port, token]) {\n if (f.idx !== -1) {\n consumed.add(f.idx);\n consumed.add(f.idx + 1);\n }\n }\n const positional = argv.filter((a, i) => !consumed.has(i) && a !== \"--json\" && a !== \"--http\");\n const [cmd, dir] = positional;\n\n if (cmd === \"apply\" && dir) {\n runApply(dir);\n return;\n }\n if (cmd === \"serve\" && dir && http) {\n // Bearer token: --token wins over ARCHSTONE_HTTP_TOKEN if both are set (Rule #7 —\n // required, never defaults open).\n runServeHttp(dir, Number(port.value ?? 8787), token.value ?? process.env.ARCHSTONE_HTTP_TOKEN);\n return; // blocks on the HTTP server\n }\n if (cmd === \"serve\" && dir) {\n await serveStdio(dir); // blocks on the stdio transport\n return;\n }\n if (cmd === \"verify\" && dir) {\n await runVerifyCmd(dir, json);\n return;\n }\n if (cmd === \"build\" && dir) {\n runBuild(dir, out.value);\n return;\n }\n\n console.error(\n \"usage: archstone <apply|serve|verify|build> <manifest-dir> [--json] [--out path]\\n\" +\n \" archstone serve --http <manifest-dir> [--port <n>] [--token <value>]\\n\" +\n \" bearer token: --token <value>, or the ARCHSTONE_HTTP_TOKEN env var (required — never serves open)\",\n );\n process.exit(2);\n}\n\nmain();\n"],"mappings":";;;AAqBA,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,oBAA+D;AACxE,SAAS,YAAY;AACrB,SAAS,mBAAmB,eAAwB;AACpD,SAAS,UAAU,eAAe,YAAY,iBAAoC;AAClF,SAAS,yBAAyB;AAElC,SAAS,SAAS,KAAmB;AACnC,QAAM,MAAM,KAAK,GAAG;AACpB,UAAQ,IAAI;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oBAAI,IAAY;AACjC,aAAW,KAAK,CAAC,KAAK,MAAM,KAAK,GAAG;AAClC,QAAI,EAAE,QAAQ,IAAI;AAChB,eAAS,IAAI,EAAE,GAAG;AAClB,eAAS,IAAI,EAAE,MAAM,CAAC;AAAA,IACxB;AAAA,EACF;AACA,QAAM,aAAa,KAAK,OAAO,CAAC,GAAG,MAAM,CAAC,SAAS,IAAI,CAAC,KAAK,MAAM,YAAY,MAAM,QAAQ;AAC7F,QAAM,CAAC,KAAK,GAAG,IAAI;AAEnB,MAAI,QAAQ,WAAW,KAAK;AAC1B,aAAS,GAAG;AACZ;AAAA,EACF;AACA,MAAI,QAAQ,WAAW,OAAO,MAAM;AAGlC,iBAAa,KAAK,OAAO,KAAK,SAAS,IAAI,GAAG,MAAM,SAAS,QAAQ,IAAI,oBAAoB;AAC7F;AAAA,EACF;AACA,MAAI,QAAQ,WAAW,KAAK;AAC1B,UAAM,WAAW,GAAG;AACpB;AAAA,EACF;AACA,MAAI,QAAQ,YAAY,KAAK;AAC3B,UAAM,aAAa,KAAK,IAAI;AAC5B;AAAA,EACF;AACA,MAAI,QAAQ,WAAW,KAAK;AAC1B,aAAS,KAAK,IAAI,KAAK;AACvB;AAAA,EACF;AAEA,UAAQ;AAAA,IACN;AAAA,EAGF;AACA,UAAQ,KAAK,CAAC;AAChB;AAEA,KAAK;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archstone/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "CLI (#1): archstone apply — wires the pipeline (parse -> validate -> IR -> runtime).",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@archstone/compiler": "0.
|
|
26
|
-
"@archstone/
|
|
27
|
-
"@archstone/
|
|
25
|
+
"@archstone/compiler": "0.4.0",
|
|
26
|
+
"@archstone/schema": "0.4.0",
|
|
27
|
+
"@archstone/runtime": "0.4.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"tsup": "^8.5.1"
|