@soleur/opencode 3.378.0 → 3.378.2

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.
@@ -20,6 +20,76 @@
20
20
  // @likec4/diagram, LikeC4Model or this repo reads, and the likec4 CLI never
21
21
  // reads the exported artifact back. The key is kept (value "") because the
22
22
  // ViewWithHash type declares it.
23
+ //
24
+ // Relation IDs are additionally RE-KEYED to a content hash and the map is
25
+ // emitted SORTED by the new key. Since likec4 1.60 the CLI derives relation
26
+ // ids — and the `relations` map's emission order with them — from the absolute
27
+ // workspace path, so two renders of identical .c4 sources at different roots
28
+ // differ on every relation id AND on map order; the only other movers are
29
+ // each relation's `id` field and `views[*].edges[*].relations[]` referents
30
+ // (element ids, edge ids, and view/node/edge ordering are content-stable).
31
+ // Without a re-key + sort the committed artifact can never byte-match a render
32
+ // at CI's checkout path (#11915). The new id is a 64-bit FNV-1a hash (base36)
33
+ // of the relation's content minus `id`; `edges[].relations` is sorted after
34
+ // rewriting — it is a referent set, not an ordering. A repeated content hash
35
+ // (duplicate relations, or a freak collision) is disambiguated with a `-N`
36
+ // suffix in insertion order, which is deterministic for a given input.
37
+
38
+ const FNV_OFFSET = 0xcbf29ce484222325n;
39
+ const FNV_PRIME = 0x100000001b3n;
40
+ const FNV_MASK = 0xffffffffffffffffn;
41
+
42
+ function fnv1a64Base36(str) {
43
+ let h = FNV_OFFSET;
44
+ for (let i = 0; i < str.length; i++) {
45
+ h = (h ^ BigInt(str.charCodeAt(i))) * FNV_PRIME & FNV_MASK;
46
+ }
47
+ return h.toString(36);
48
+ }
49
+
50
+ function rekeyRelations(model) {
51
+ const relations = model.relations;
52
+ if (relations === null || typeof relations !== "object" || Array.isArray(relations)) {
53
+ return;
54
+ }
55
+ const idMap = new Map();
56
+ const seen = new Map();
57
+ const next = Object.create(null);
58
+ for (const [oldId, rel] of Object.entries(relations)) {
59
+ if (rel === null || typeof rel !== "object" || Array.isArray(rel)) {
60
+ next[oldId] = rel;
61
+ continue;
62
+ }
63
+ const { id: oldRelId, ...content } = rel;
64
+ const base = fnv1a64Base36(JSON.stringify(content));
65
+ const n = (seen.get(base) ?? 0) + 1;
66
+ seen.set(base, n);
67
+ const newId = n === 1 ? base : `${base}-${n}`;
68
+ idMap.set(oldId, newId);
69
+ if (typeof oldRelId === "string") idMap.set(oldRelId, newId);
70
+ if (Object.prototype.hasOwnProperty.call(rel, "id")) rel.id = newId;
71
+ next[newId] = rel;
72
+ }
73
+ // Upstream emission order follows the path-derived ids, so it drifts across
74
+ // render roots too; emit the re-keyed map sorted by the new id.
75
+ const sorted = Object.create(null);
76
+ for (const k of Object.keys(next).sort()) sorted[k] = next[k];
77
+ model.relations = sorted;
78
+ const views = model.views;
79
+ if (views === null || typeof views !== "object" || Array.isArray(views)) {
80
+ return;
81
+ }
82
+ for (const view of Object.values(views)) {
83
+ if (view === null || typeof view !== "object" || !Array.isArray(view.edges)) {
84
+ continue;
85
+ }
86
+ for (const edge of view.edges) {
87
+ if (edge !== null && typeof edge === "object" && Array.isArray(edge.relations)) {
88
+ edge.relations = edge.relations.map((r) => idMap.get(r) ?? r).sort();
89
+ }
90
+ }
91
+ }
92
+ }
23
93
 
24
94
  /**
25
95
  * @param {string} json raw `likec4 export json` output (or an already-canonical file)
@@ -30,6 +100,7 @@ export function canonicalizeC4Model(json) {
30
100
  if (model === null || typeof model !== "object" || Array.isArray(model)) {
31
101
  throw new TypeError("c4 model must be a JSON object");
32
102
  }
103
+ rekeyRelations(model);
33
104
  const views = model.views;
34
105
  if (views !== null && typeof views === "object" && !Array.isArray(views)) {
35
106
  for (const view of Object.values(views)) {
@@ -18,7 +18,7 @@
18
18
  // drifts across patch versions — correct for a RUNTIME save path that cannot
19
19
  // pin the CLI (its element/view COUNT gates are identical to this module's).
20
20
  // This
21
- // producer pins `likec4@1.50.0` (asserted by a drift guard against both
21
+ // producer pins `likec4@1.60.0` (asserted by a drift guard against both
22
22
  // precedents), so the wording is fixed and both gates are safe. That pin is load
23
23
  // bearing: if it moves, the diagnostic gate is the thing that breaks.
24
24
  //
@@ -35,13 +35,13 @@ import { join } from "node:path";
35
35
  * plugins/soleur/scripts/render-c4-model.sh and the `likec4@…` pin in
36
36
  * apps/web-platform/server/c4-render.ts — a drift guard asserts all three.
37
37
  */
38
- export const LIKEC4_VERSION = "1.50.0";
38
+ export const LIKEC4_VERSION = "1.60.0";
39
39
 
40
40
  /**
41
41
  * `--before` cutoff for the `npx` resolve. MUST stay equal to `LIKEC4_BEFORE` in
42
42
  * plugins/soleur/scripts/render-c4-model.sh (BUMPING LIKEC4 there) — a drift guard asserts it.
43
43
  */
44
- export const LIKEC4_BEFORE = "2026-09-28";
44
+ export const LIKEC4_BEFORE = "2026-10-16";
45
45
 
46
46
  /** Provenance stamp. A file without this as its FIRST line is never overwritten. */
47
47
  export const GENERATED_HEADER =
@@ -49,7 +49,7 @@ export const GENERATED_HEADER =
49
49
 
50
50
  /**
51
51
  * Source-fault detector, behaviourally equivalent to `DIAG_RE` in
52
- * plugins/soleur/scripts/render-c4-model.sh. likec4@1.50.0 exits 0 on a syntax error —
52
+ * plugins/soleur/scripts/render-c4-model.sh. likec4@1.60.0 exits 0 on a syntax error —
53
53
  * it drops the bad fragment, prints `Invalid <file>` / `Line N:`, and still emits
54
54
  * a non-empty but INCOMPLETE model, which element-count alone cannot see.
55
55
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleur/opencode",
3
- "version": "3.378.0",
3
+ "version": "3.378.2",
4
4
  "description": "Soleur AI organization plugin for OpenCode",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,7 +21,7 @@
21
21
  # to a temp path with identical logic, then byte-diff against the committed
22
22
  # artifact. Default: <root>/.../diagrams/model.likec4.json.
23
23
  #
24
- # Pinned to likec4@1.50.0 — MUST match apps/web-platform/Dockerfile +
24
+ # Pinned to likec4@1.60.0 — MUST match apps/web-platform/Dockerfile +
25
25
  # package.json @likec4/core/@likec4/diagram (guarded by c4-likec4-version-pin.test.ts).
26
26
  # A CLI/client version skew silently desyncs the rendered diagram.
27
27
  #
@@ -70,8 +70,8 @@
70
70
 
71
71
  set -euo pipefail
72
72
 
73
- LIKEC4_VERSION="1.50.0"
74
- LIKEC4_BEFORE="2026-09-28"
73
+ LIKEC4_VERSION="1.60.0"
74
+ LIKEC4_BEFORE="2026-10-16"
75
75
 
76
76
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
77
77
  CANONICAL_CLI="$SCRIPT_DIR/../lib/c4-canonical-cli.mjs"
@@ -150,7 +150,7 @@ if ! ( cd "$DIAGRAMS_DIR" && env -u CI -u FORCE_COLOR NO_COLOR=1 npx -y --ignore
150
150
  exit 1
151
151
  fi
152
152
 
153
- # exit-0 is NOT proof. likec4@1.50.0 has TWO source-fault modes that both exit 0:
153
+ # exit-0 is NOT proof. likec4@1.60.0 has TWO source-fault modes that both exit 0:
154
154
  # (1) unresolved reference / missing spec.c4 -> an EMPTY-elements model
155
155
  # (the #4966 case; see apps/web-platform/server/c4-render.ts).
156
156
  # (2) a syntax error -> likec4 recovers by dropping the bad fragment, prints
@@ -298,7 +298,7 @@ bash "${CLAUDE_PLUGIN_ROOT}/scripts/render-c4-model.sh"
298
298
  # --no-use-dot keeps the drift check on the same wasm layout the artifact was
299
299
  # rendered with — a dot-layout verdict would disagree with committed bytes.
300
300
  cd knowledge-base/engineering/architecture/diagrams
301
- npx -y likec4@1.50.0 validate --no-use-dot .
301
+ npx -y likec4@1.60.0 validate --no-use-dot .
302
302
  ```
303
303
 
304
304
  The pinned `1.50.0` is load-bearing: it MUST match `apps/web-platform/Dockerfile`
@@ -109,14 +109,14 @@ includes.
109
109
  ## Validate
110
110
 
111
111
  ```bash
112
- npx -y likec4@1.50.0 validate --no-use-dot . # parse + check references
112
+ npx -y likec4@1.60.0 validate --no-use-dot . # parse + check references
113
113
  _c4_out=$(mktemp -p "$(mktemp -d -t soleur-run.$$.XXXXXXXX)")
114
- npx -y likec4@1.50.0 export json --no-use-dot -o "$_c4_out" . # element/relation/view counts
114
+ npx -y likec4@1.60.0 export json --no-use-dot -o "$_c4_out" . # element/relation/view counts
115
115
  # ... read the counts from "$_c4_out" (jq) — then `rm -f "$_c4_out"; rmdir "$(dirname "$_c4_out")"`; an
116
116
  # anonymous `"$(mktemp)"` path can never be found again, so name it (#10017)
117
117
  ```
118
118
 
119
- Pin the version every writer pins (`likec4@1.50.0`, the `LIKEC4_VERSION` constant) and always pass
119
+ Pin the version every writer pins (`likec4@1.60.0`, the `LIKEC4_VERSION` constant) and always pass
120
120
  `--no-use-dot`: inside a container likec4 defaults to the graphviz `dot` binary, which produces a
121
121
  different layout than the server's wasm render — or, without graphviz, a zero-view model.
122
122