githolon 0.22.1 → 0.23.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +43 -11
  2. package/package.json +3 -3
package/dist/cli.mjs CHANGED
@@ -657,11 +657,32 @@ async function deploy(ws, opts) {
657
657
  return 1;
658
658
  }
659
659
  const phase = d.installation?.[0]?.data?.["status.phase"];
660
- out2(`\u2713 deployed ${file.split("/").pop()} \u2192 ${ws}${typeof phase === "string" ? ` (${phase})` : ""}`);
661
- if (typeof d.domainHash === "string") {
662
- out2(` law ${describeLawMove(before, d.domainHash)}`);
660
+ const fileName = file.split("/").pop();
661
+ const phaseSuffix = typeof phase === "string" ? ` (${phase})` : "";
662
+ const deployedHash = typeof d.domainHash === "string" ? d.domainHash : void 0;
663
+ const after = await fetch(`${cloud}/v2/workspaces/${ws}/domains`).then((ar) => ar.json()).then((ad) => ad.ok === true ? ad : {}).catch(() => ({}));
664
+ const currentHashes = new Set(Object.values(after.currentLaw ?? {}));
665
+ const hasCurrencyData = Object.keys(after.currentLaw ?? {}).length > 0;
666
+ const isCurrent = deployedHash !== void 0 && (currentHashes.has(deployedHash) || (after.domains ?? []).some((x) => x.domainHash === deployedHash && x.current === true));
667
+ if (deployedHash !== void 0 && isCurrent) {
668
+ out2(`\u2713 deployed ${fileName} \u2192 ${ws}${phaseSuffix}`);
669
+ out2(` law ${describeLawMove(before, deployedHash)}`);
670
+ out2(` \u2713 current \u2014 dispatch + reads now resolve ${deployedHash.slice(0, 16)}\u2026`);
671
+ return 0;
663
672
  }
664
- return 0;
673
+ if (deployedHash === void 0 || !hasCurrencyData) {
674
+ out2(`\u2713 deployed ${fileName} \u2192 ${ws}${phaseSuffix}`);
675
+ if (deployedHash !== void 0) out2(` law ${describeLawMove(before, deployedHash)}`);
676
+ out2(` \u26A0 couldn't confirm it is the current serving law (this workspace did not report current-law resolution).`);
677
+ return 0;
678
+ }
679
+ err2(`deployed ${fileName} \u2192 ${ws}${phaseSuffix}, but it is NOT the current serving law \u2014 the upgrade did not take effect`);
680
+ out2(` law ${describeLawMove(before, deployedHash)} (committed as an install, but the holon does not resolve it as current)`);
681
+ const leads = (after.domains ?? []).filter((x) => x.current === true && typeof x.domainHash === "string").map((x) => x.domainHash);
682
+ if (leads.length > 0) err2(` current serving: ${leads.map((h) => h.slice(0, 16) + "\u2026").join(", ")}`);
683
+ else err2(` the workspace resolves NO current law for this domain (materialisation wedged \u2014 the evolve gate did not advance it)`);
684
+ err2(` re-run \`githolon deploy ${ws}\`; if it persists, the deploy committed but the workspace kept the old law (report it).`);
685
+ return 2;
665
686
  }
666
687
  function describeLawMove(before, newHash) {
667
688
  const activeBefore = before.filter((x) => x.phase === "Active" && typeof x.domainHash === "string").map((x) => x.domainHash);
@@ -2753,23 +2774,33 @@ init_cloud();
2753
2774
  import { readFileSync as readFileSync9 } from "node:fs";
2754
2775
  var out9 = (s) => void process.stdout.write(s + "\n");
2755
2776
  var err9 = (s) => void process.stderr.write("error: " + s + "\n");
2756
- function lawDiffVerdict(localHash, installed, ws) {
2777
+ function lawDiffVerdict(localHash, installed, ws, hasCurrencyData) {
2757
2778
  const active = installed.filter((d) => d.phase === "Active" && typeof d.domainHash === "string");
2758
2779
  const currents = active.filter((d) => d.current === true);
2759
2780
  const priors = active.filter((d) => d.current !== true);
2760
2781
  const localActive = active.find((d) => d.domainHash === localHash);
2761
2782
  const localIsCurrent = currents.some((d) => d.domainHash === localHash);
2762
2783
  const lines = [];
2763
- if (localIsCurrent || currents.length === 0 && localActive !== void 0) {
2764
- lines.push(`\u2713 in sync \u2014 the deployed law IS your local build (${localHash.slice(0, 16)}\u2026)`);
2765
- if (priors.length > 0) lines.push(` (${priors.length} prior deploy(s) remain Active under install-beside; yours is the current one resolution serves)`);
2784
+ if (localIsCurrent) {
2785
+ lines.push(`\u2713 in sync \u2014 your local build IS the current serving law (${localHash.slice(0, 16)}\u2026)`);
2786
+ if (priors.length > 0) lines.push(` (${priors.length} prior deploy(s) remain Active under install-beside; yours is the one dispatch resolves)`);
2787
+ return { inSync: true, lines };
2788
+ }
2789
+ if (!hasCurrencyData && localActive !== void 0) {
2790
+ lines.push(`~ your local build (${localHash.slice(0, 16)}\u2026) is an ACTIVE install on '${ws}'`);
2791
+ lines.push(` \u26A0 this workspace did not report current-law resolution \u2014 matched by active presence only; can't confirm it is serving`);
2766
2792
  return { inSync: true, lines };
2767
2793
  }
2768
2794
  if (active.length === 0) {
2769
2795
  lines.push(`\u2717 workspace '${ws}' has NO active tenant law \u2014 your local build is not deployed`);
2770
2796
  } else if (localActive !== void 0) {
2771
- lines.push(`~ your build (${localHash.slice(0, 16)}\u2026) is an ACTIVE install on '${ws}', but SUPERSEDED \u2014 a newer deploy is current:`);
2772
- for (const c of currents) lines.push(` current ${c.domainHash.slice(0, 16)}\u2026 (${c.installedBy ?? "?"}) \u2190 resolution serves this`);
2797
+ if (currents.length > 0) {
2798
+ lines.push(`~ your build (${localHash.slice(0, 16)}\u2026) is an ACTIVE install on '${ws}', but SUPERSEDED \u2014 a newer deploy is current:`);
2799
+ for (const c of currents) lines.push(` current ${c.domainHash.slice(0, 16)}\u2026 (${c.installedBy ?? "?"}) \u2190 resolution serves this`);
2800
+ } else {
2801
+ lines.push(`\u2717 your build (${localHash.slice(0, 16)}\u2026) is ACTIVE on '${ws}' but is NOT the current serving law \u2014 the deploy did not take effect:`);
2802
+ lines.push(` the workspace resolves NO current law for this domain (materialisation wedged \u2014 the evolve gate did not advance it)`);
2803
+ }
2773
2804
  lines.push(` redeploy to make your build current: githolon deploy ${ws}`);
2774
2805
  return { inSync: false, lines };
2775
2806
  } else if (currents.length > 0) {
@@ -2829,7 +2860,8 @@ async function status(wsArg, opts) {
2829
2860
  return 0;
2830
2861
  }
2831
2862
  out9(`local ${localHash.slice(0, 16)}\u2026 (build/*.deploy.json)`);
2832
- const verdict = lawDiffVerdict(localHash, domains, ws);
2863
+ const hasCurrencyData = Object.keys(d.currentLaw ?? {}).length > 0;
2864
+ const verdict = lawDiffVerdict(localHash, domains, ws, hasCurrencyData);
2833
2865
  for (const line of verdict.lines) out9(line);
2834
2866
  return verdict.inSync ? 0 : 2;
2835
2867
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "githolon",
3
- "version": "0.22.1",
3
+ "version": "0.23.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,8 +27,8 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@bjorn3/browser_wasi_shim": "0.4.2",
30
- "@githolon/client": "^0.22.1",
31
- "@githolon/dsl": "^0.22.1",
30
+ "@githolon/client": "^0.23.1",
31
+ "@githolon/dsl": "^0.23.1",
32
32
  "isomorphic-git": "^1.38.4"
33
33
  },
34
34
  "devDependencies": {