01ca965c7f
Coordinate registered resource edits bottom-up into retained exact remote sources. Use one Nix-owned source graph for provisional checking, template publication, explicit baseline upgrades and host activation; retain independent runtime pins. Add scoped contract inspection, historical recovery, derived worklists, crash-safe locks, named dependency adoption and plain-QX structural editing. Repair TODO ownership and template instantiation, and document the supported agent workflow. Validated with protocol and command suites, real jj/Nix convergence and cache checks, TS/React installed-command acceptance, and fresh TODO first-edit acceptance. No live deployment or public publication performed. Props projection generation and a one-command rich feature generator remain explicitly outside this delivery.
29 lines
1.4 KiB
JavaScript
29 lines
1.4 KiB
JavaScript
#!/usr/bin/env node
|
|
// Data only: never load files, resolve repositories, or evaluate code.
|
|
import { parseQx } from "./source.js";
|
|
import { parseQuixosLockDocument } from "../resource-lock/parser.js";
|
|
import { instantiateWorkspaceIdentity } from "./structural-edits.js";
|
|
let input = "";
|
|
for await (const chunk of process.stdin) {
|
|
input += chunk;
|
|
if (Buffer.byteLength(input) > 6 * 1024 * 1024) throw new Error("Inspection input exceeds limit");
|
|
}
|
|
const document = JSON.parse(input);
|
|
if (!Array.isArray(document) && document?.operation === "instantiate-workspace") {
|
|
if (typeof document.source !== "string" || document.source.length > 262144 || typeof document.workspaceId !== "string") throw new Error("Invalid template identity request");
|
|
process.stdout.write(JSON.stringify({ source: instantiateWorkspaceIdentity(document.source, document.workspaceId) }));
|
|
process.exit(0);
|
|
}
|
|
const files: { path: string; source: string }[] = document;
|
|
if (!Array.isArray(files) || files.length > 128) throw new Error("Too many source files");
|
|
const result = files.map(({ path, source }) => {
|
|
if (typeof path !== "string" || typeof source !== "string" || source.length > 262144)
|
|
throw new Error("Invalid source input");
|
|
if (path.endsWith(".qx")) {
|
|
const parsed = parseQx(source, path);
|
|
return { path, root: parsed.root, diagnostics: parsed.diagnostics };
|
|
}
|
|
return { path, lock: parseQuixosLockDocument(source, path) };
|
|
});
|
|
process.stdout.write(JSON.stringify(result));
|