Browse immutable workspace source and jj history in Central

This commit is contained in:
Timothy J. Aveni
2026-09-10 00:07:05 -07:00
parent 4e17693d82
commit 1e25f391e7
2 changed files with 40 additions and 0 deletions
+19
View File
@@ -108,6 +108,25 @@ EOF
}; };
in { in {
packages.default = quixos-protocol; packages.default = quixos-protocol;
packages.inspector = (pkgs.callPackage ./yarn-project.nix { inherit nodejs; }) {
src = pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.unions [ ./package.json ./yarn.lock ./.yarnrc.yml ./.yarn/plugins ./src ];
};
overrideAttrs = old: {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ pkgs.esbuild ];
doCheck = false;
buildPhase = ''
esbuild src/capability-language/inspect-cli.ts --bundle --platform=node --target=node24 --format=esm --outfile=inspect.mjs
'';
installPhase = ''
mkdir -p "$out/bin" "$out/lib"
cp inspect.mjs "$out/lib/inspect.mjs"
printf '#!${pkgs.runtimeShell}\nexec ${nodejs}/bin/node --max-old-space-size=128 %s/lib/inspect.mjs\n' "$out" > "$out/bin/quixos-qx-inspect"
chmod +x "$out/bin/quixos-qx-inspect"
'';
};
};
checks.default = quixos-protocol; checks.default = quixos-protocol;
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
packages = [ packages = [
+21
View File
@@ -0,0 +1,21 @@
#!/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";
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 files: { path: string; source: string }[] = JSON.parse(input);
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));