githolon 0.5.0 → 0.5.1
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/cli.mjs +65 -16
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -832,14 +832,28 @@ function runOfflineLegs(eng, ws, lawHash, legs) {
|
|
|
832
832
|
}
|
|
833
833
|
return done(true, lines);
|
|
834
834
|
}
|
|
835
|
-
async function runOfflineProofStandalone(proofPath, cloud) {
|
|
835
|
+
async function runOfflineProofStandalone(proofPath, cloud, domain) {
|
|
836
836
|
const src = readFileSync3(proofPath, "utf8");
|
|
837
|
-
const legs = parseOfflineLegs(src);
|
|
838
837
|
const packageName = basename(proofPath).replace(/\.proof\.mts$/, "");
|
|
839
838
|
const deployFile = join6(dirname3(proofPath), `${packageName}.deploy.json`);
|
|
840
839
|
if (!existsSync5(deployFile)) {
|
|
841
840
|
throw new Error(`missing ${deployFile} \u2014 run \`githolon compile\` (the proof and the deploy body are built together)`);
|
|
842
841
|
}
|
|
842
|
+
let legs;
|
|
843
|
+
const legsFile = join6(dirname3(proofPath), `${packageName}.proof-legs.json`);
|
|
844
|
+
if (existsSync5(legsFile)) {
|
|
845
|
+
const index = JSON.parse(readFileSync3(legsFile, "utf8"));
|
|
846
|
+
const keys = Object.keys(index.domains);
|
|
847
|
+
const chosen = domain ?? index.default;
|
|
848
|
+
if (index.domains[chosen] === void 0) {
|
|
849
|
+
throw new Error(`no provable domain '${chosen}' in this package \u2014 it proves: ${keys.join(", ")} (pick one: githolon proof --domain <key>)`);
|
|
850
|
+
}
|
|
851
|
+
legs = index.domains[chosen];
|
|
852
|
+
if (keys.length > 1) console.log(`githolon proof \u2014 domain '${chosen}' (of ${keys.length}: ${keys.join(", ")}; --domain <key> to switch)`);
|
|
853
|
+
} else {
|
|
854
|
+
if (domain !== void 0) throw new Error(`--domain needs a per-domain legs index (build/${packageName}.proof-legs.json) \u2014 recompile with \`githolon compile\` to emit it`);
|
|
855
|
+
legs = parseOfflineLegs(src);
|
|
856
|
+
}
|
|
843
857
|
const deployBody = JSON.parse(readFileSync3(deployFile, "utf8"));
|
|
844
858
|
const lawHash = await sha256hex(deployBody.packageUsda);
|
|
845
859
|
console.log(`githolon proof \u2014 OFFLINE legs on a local holon (the cloud loop: githolon proof --live)`);
|
|
@@ -1744,9 +1758,9 @@ var HELP = {
|
|
|
1744
1758
|
examples: ["githolon compile", "githolon compile nomos.package.mjs --layered"]
|
|
1745
1759
|
},
|
|
1746
1760
|
proof: {
|
|
1747
|
-
usage: "githolon proof [build/<name>.proof.mts] [--live] [--keep]",
|
|
1748
|
-
what: "Run the proof GENERATED from your law. DEFAULT: the OFFLINE legs on a LOCAL holon \u2014 the\nsame engine plane the cloud edge runs; no cloud workspace is touched (develop/play/understand\nhere, deploy with confidence after). --live runs the full cloud loop (throwaway
|
|
1749
|
-
examples: ["githolon proof", "githolon proof --live", "githolon proof --live --keep"]
|
|
1761
|
+
usage: "githolon proof [build/<name>.proof.mts] [--domain <key>] [--live] [--keep]",
|
|
1762
|
+
what: "Run the proof GENERATED from your law. DEFAULT: the OFFLINE legs on a LOCAL holon \u2014 the\nsame engine plane the cloud edge runs; no cloud workspace is touched (develop/play/understand\nhere, deploy with confidence after). --domain <key> proves a SPECIFIC domain of a multi-domain\npackage (offline; the default is the first). --live runs the full cloud loop (throwaway\nworkspace \u2192 deploy \u2192 offline write \u2192 admission \u2192 cloud reads \u2192 convergence), RETIRED on every\nexit; --keep keeps it and prints the secret once. ALL GREEN or it names the jam. The offline\nlegs also rerun on every save in `githolon dev`.",
|
|
1763
|
+
examples: ["githolon proof", "githolon proof --domain co2_platform", "githolon proof --live", "githolon proof --live --keep"]
|
|
1750
1764
|
},
|
|
1751
1765
|
dev: {
|
|
1752
1766
|
usage: "githolon dev [--port <n>] [--cloud <url>] [--once]",
|
|
@@ -2155,20 +2169,35 @@ var out8 = (s) => void process.stdout.write(s + "\n");
|
|
|
2155
2169
|
var err8 = (s) => void process.stderr.write("error: " + s + "\n");
|
|
2156
2170
|
function lawDiffVerdict(localHash, installed, ws) {
|
|
2157
2171
|
const active = installed.filter((d) => d.phase === "Active" && typeof d.domainHash === "string");
|
|
2158
|
-
const
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2172
|
+
const currents = active.filter((d) => d.current === true);
|
|
2173
|
+
const priors = active.filter((d) => d.current !== true);
|
|
2174
|
+
const localActive = active.find((d) => d.domainHash === localHash);
|
|
2175
|
+
const localIsCurrent = currents.some((d) => d.domainHash === localHash);
|
|
2162
2176
|
const lines = [];
|
|
2177
|
+
if (localIsCurrent || currents.length === 0 && localActive !== void 0) {
|
|
2178
|
+
lines.push(`\u2713 in sync \u2014 the deployed law IS your local build (${localHash.slice(0, 16)}\u2026)`);
|
|
2179
|
+
if (priors.length > 0) lines.push(` (${priors.length} prior deploy(s) remain Active under install-beside; yours is the current one resolution serves)`);
|
|
2180
|
+
return { inSync: true, lines };
|
|
2181
|
+
}
|
|
2163
2182
|
if (active.length === 0) {
|
|
2164
2183
|
lines.push(`\u2717 workspace '${ws}' has NO active tenant law \u2014 your local build is not deployed`);
|
|
2184
|
+
} else if (localActive !== void 0) {
|
|
2185
|
+
lines.push(`~ your build (${localHash.slice(0, 16)}\u2026) is an ACTIVE install on '${ws}', but SUPERSEDED \u2014 a newer deploy is current:`);
|
|
2186
|
+
for (const c of currents) lines.push(` current ${c.domainHash.slice(0, 16)}\u2026 (${c.installedBy ?? "?"}) \u2190 resolution serves this`);
|
|
2187
|
+
lines.push(` redeploy to make your build current: githolon deploy ${ws}`);
|
|
2188
|
+
return { inSync: false, lines };
|
|
2189
|
+
} else if (currents.length > 0) {
|
|
2190
|
+
lines.push(`\u2717 local law differs from the current install${currents.length > 1 ? "s" : ""} on '${ws}':`);
|
|
2191
|
+
for (const c of currents) lines.push(` current ${c.domainHash.slice(0, 16)}\u2026 (${c.installedBy ?? "?"}) \u2190 resolution serves this`);
|
|
2192
|
+
if (priors.length > 0) lines.push(` + ${priors.length} prior active install(s) (install-beside \u2014 historical, not served)`);
|
|
2165
2193
|
} else {
|
|
2166
|
-
lines.push(`\u2717 local law differs from every active installation on '${ws}':`);
|
|
2194
|
+
lines.push(`\u2717 local law differs from every active installation on '${ws}' (${active.length}):`);
|
|
2167
2195
|
for (const d of active) lines.push(` deployed ${d.domainHash.slice(0, 16)}\u2026 (${d.installedBy ?? "?"})`);
|
|
2168
2196
|
}
|
|
2169
|
-
lines.push(` remedy: githolon deploy ${ws} (installs ${localHash.slice(0, 16)}\u2026)`);
|
|
2197
|
+
lines.push(` remedy: githolon deploy ${ws} (installs ${localHash.slice(0, 16)}\u2026 and makes it current)`);
|
|
2170
2198
|
return { inSync: false, lines };
|
|
2171
2199
|
}
|
|
2200
|
+
var CONTROL_PLANE_KEYS = ["nomos", "bootstrap", "workspaces"];
|
|
2172
2201
|
async function status(wsArg, opts) {
|
|
2173
2202
|
const cloud = cloudBase(opts.cloud);
|
|
2174
2203
|
let ws;
|
|
@@ -2197,11 +2226,18 @@ async function status(wsArg, opts) {
|
|
|
2197
2226
|
return 1;
|
|
2198
2227
|
}
|
|
2199
2228
|
out8(`workspace ${ws} on ${cloud}`);
|
|
2200
|
-
const
|
|
2201
|
-
|
|
2229
|
+
const allDomains = d.domains ?? [];
|
|
2230
|
+
const controlPlaneHashes = new Set(CONTROL_PLANE_KEYS.map((k) => d.currentLaw?.[k]).filter(Boolean));
|
|
2231
|
+
const domains = allDomains.filter((dm) => !controlPlaneHashes.has(dm.domainHash));
|
|
2232
|
+
const controllerCount = allDomains.length - domains.length;
|
|
2233
|
+
if (allDomains.length === 0) out8(`installed (none \u2014 not even the controller; the workspace may be unborn)`);
|
|
2202
2234
|
for (const dom of domains) {
|
|
2203
|
-
|
|
2235
|
+
const mark = dom.current === true ? " \u2190 current (the holon resolves dispatch here)" : "";
|
|
2236
|
+
out8(`installed ${(dom.domainHash ?? "?").slice(0, 16)}\u2026 ${dom.phase ?? "?"} by ${dom.installedBy ?? "?"}${mark}`);
|
|
2204
2237
|
}
|
|
2238
|
+
if (controllerCount > 0) out8(` (+ ${controllerCount} control-plane install(s) \u2014 the nomos lifecycle controller; not tenant law)`);
|
|
2239
|
+
const tenantActive = domains.filter((dm) => dm.phase === "Active").length;
|
|
2240
|
+
if (tenantActive > 1) out8(` (${tenantActive} active tenant installs \u2014 install-beside keeps every prior deploy Active; the holon serves the current one per domain)`);
|
|
2205
2241
|
if (localHash === void 0) {
|
|
2206
2242
|
out8(`local (no build/*.deploy.json here \u2014 run \`githolon compile\` to build the law this project authors)`);
|
|
2207
2243
|
return 0;
|
|
@@ -2381,7 +2417,20 @@ async function runProof(args) {
|
|
|
2381
2417
|
const live = args.includes("--live");
|
|
2382
2418
|
const keep = args.includes("--keep");
|
|
2383
2419
|
if (keep && !live) return refuse("--keep only applies to --live (the offline proof creates no cloud workspace to keep)");
|
|
2384
|
-
|
|
2420
|
+
let domain;
|
|
2421
|
+
let domainValueIdx = -1;
|
|
2422
|
+
const di = args.findIndex((a) => a === "--domain" || a.startsWith("--domain="));
|
|
2423
|
+
if (di >= 0) {
|
|
2424
|
+
const a = args[di];
|
|
2425
|
+
if (a.includes("=")) domain = a.slice(a.indexOf("=") + 1);
|
|
2426
|
+
else {
|
|
2427
|
+
domain = args[di + 1];
|
|
2428
|
+
domainValueIdx = di + 1;
|
|
2429
|
+
}
|
|
2430
|
+
if (domain === void 0 || domain === "" || domain.startsWith("--")) return refuse("--domain needs a domain key: githolon proof --domain <key>");
|
|
2431
|
+
}
|
|
2432
|
+
if (domain !== void 0 && live) return refuse("--domain is an OFFLINE-lane selector (the --live proof runs the package's primary domain end-to-end); drop --live or drop --domain");
|
|
2433
|
+
const explicit = args.find((a, i) => !a.startsWith("--") && i !== domainValueIdx);
|
|
2385
2434
|
let proofPath;
|
|
2386
2435
|
if (explicit !== void 0) {
|
|
2387
2436
|
proofPath = resolve2(process.cwd(), explicit);
|
|
@@ -2404,7 +2453,7 @@ async function runProof(args) {
|
|
|
2404
2453
|
try {
|
|
2405
2454
|
const { runOfflineProofStandalone: runOfflineProofStandalone2 } = await Promise.resolve().then(() => (init_proof_offline(), proof_offline_exports));
|
|
2406
2455
|
const { cloudBase: cloudBase2 } = await Promise.resolve().then(() => (init_cloud(), cloud_exports));
|
|
2407
|
-
return await runOfflineProofStandalone2(proofPath, cloudBase2());
|
|
2456
|
+
return await runOfflineProofStandalone2(proofPath, cloudBase2(), domain);
|
|
2408
2457
|
} catch (e) {
|
|
2409
2458
|
return refuse(`${e.message ?? e}`);
|
|
2410
2459
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "githolon",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "githolon — the Nomos developer CLI: Rails-style generators for @githolon/dsl domains + the package compiler. Kernel-independent.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@bjorn3/browser_wasi_shim": "0.4.2",
|
|
30
|
-
"@githolon/dsl": "^0.5.
|
|
30
|
+
"@githolon/dsl": "^0.5.1",
|
|
31
31
|
"isomorphic-git": "^1.38.4"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|