@intentius/behold 0.29.43 → 0.29.45

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 (67) hide show
  1. package/AGENTS.md +77 -0
  2. package/dist/cli.js +4065 -1918
  3. package/package.json +1 -1
  4. package/web/app.js +1469 -74
  5. package/web/carve-narration.js +33 -1
  6. package/web/chant-live-pace.js +138 -0
  7. package/web/chant-live-pace.test.js +116 -0
  8. package/web/chant-pr-marks.js +417 -39
  9. package/web/chant-pr-marks.test.js +208 -4
  10. package/web/collision-marks.js +124 -0
  11. package/web/collision-marks.test.js +89 -0
  12. package/web/cone.js +269 -0
  13. package/web/cone.test.js +213 -0
  14. package/web/dots-live.test.js +151 -1
  15. package/web/dots-lod.js +20 -0
  16. package/web/dots-lod.test.js +19 -1
  17. package/web/dots-scene.js +110 -10
  18. package/web/dots.js +144 -31
  19. package/web/embed.js +1 -1
  20. package/web/event-help-modal.js +98 -3
  21. package/web/event-help-modal.test.js +85 -1
  22. package/web/feature-flags.js +143 -0
  23. package/web/feature-flags.test.js +96 -0
  24. package/web/index.html +33 -0
  25. package/web/kiosk-carve.js +59 -6
  26. package/web/kiosk-demo-frame.test.js +27 -0
  27. package/web/kiosk-event-help-ui.js +186 -20
  28. package/web/kiosk-event-help.js +175 -15
  29. package/web/kiosk-event-help.test.js +58 -1
  30. package/web/kiosk-highlight.test.js +249 -0
  31. package/web/kiosk-metrics.js +4 -3
  32. package/web/kiosk-runs.js +8 -5
  33. package/web/kiosk-shot.js +157 -3
  34. package/web/kiosk-shot.test.js +223 -1
  35. package/web/kiosk-source.js +43 -0
  36. package/web/kiosk-source.test.js +39 -0
  37. package/web/kiosk-story-gate.test.js +44 -0
  38. package/web/kiosk-track.js +312 -0
  39. package/web/kiosk-track.test.js +148 -0
  40. package/web/kiosk-unknown-step.test.js +58 -0
  41. package/web/kiosk-vendor.js +73 -4
  42. package/web/kiosk-vendor.test.js +103 -3
  43. package/web/kiosk-watch.js +154 -1
  44. package/web/kiosk-watch.test.js +53 -1
  45. package/web/kiosk.html +57 -22
  46. package/web/kiosk.js +583 -53
  47. package/web/kiosk.test.js +2 -1
  48. package/web/small-stage.test.js +150 -0
  49. package/web/terragucci-blocked.test.js +192 -0
  50. package/web/terragucci-change.js +197 -17
  51. package/web/terragucci-components-live.js +189 -13
  52. package/web/terragucci-live-pace.js +92 -0
  53. package/web/terragucci-wave-results.test.js +125 -0
  54. package/web/terralith.html +7 -7
  55. package/web/tg-outside.js +124 -0
  56. package/web/tg-outside.test.js +100 -0
  57. package/web/tg-read-pills.js +145 -0
  58. package/web/tg-read-pills.test.js +158 -0
  59. package/web/theme.js +13 -1
  60. package/web/theme.test.js +21 -1
  61. package/web/tooltip.js +19 -7
  62. package/web/tooltip.test.js +15 -0
  63. package/web/tours/terralith.json +4 -4
  64. package/web/trunk-lane.test.js +1 -1
  65. package/web/view-url.js +8 -2
  66. package/web/why.js +129 -1
  67. package/web/why.test.js +113 -1
package/web/why.test.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import { seconds, whyQuery, whyView } from "./why.js";
2
+ import { readFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { chainView, letThrough, seconds, sourceLine, whyQuery, whyView } from "./why.js";
3
5
 
4
6
  const answer = (over = {}) => ({
5
7
  workspace: true,
@@ -67,3 +69,113 @@ describe("whyView (#471)", () => {
67
69
  expect(seconds(29_400)).toBe("29 s");
68
70
  });
69
71
  });
72
+
73
+ // #682: the chain, drawn from what chant 0.124.29 wrote for a resource shipped
74
+ // through a gate (src/__fixtures__/why-trace/, recorded from chant main; see
75
+ // src/why-trace.test.ts). The server adds each commit's subject and each work
76
+ // item's title from the document's nodes; the rest is chant's trace.
77
+ const recorded = JSON.parse(readFileSync(join(import.meta.dirname, "..", "src", "__fixtures__", "why-trace", "intent-node.json"), "utf8"));
78
+ const subjects = { [recorded.trace.commits[0].sha]: "serve the app on 8081", [recorded.trace.commits[1].sha]: "the shop and W-001" };
79
+ const chained = (edit = (t) => t) => {
80
+ const trace = structuredClone(recorded.trace);
81
+ for (const c of trace.commits) {
82
+ c.subject = subjects[c.sha];
83
+ if (c.work) for (const w of c.work.items) w.title = "Serve the app on 8081";
84
+ }
85
+ return answer({ trace: edit(trace), chain: { full: true, floor: "0.124.29", note: null } });
86
+ };
87
+ const LINKED = recorded.trace.commits[0].sha;
88
+ const BASE = recorded.trace.commits[1].sha;
89
+ const DIGEST = recorded.trace.releases[0].releaseDigest;
90
+ const CHANGE_SET = recorded.trace.releases[0].gates[0].changeSet;
91
+
92
+ describe("chainView (#682)", () => {
93
+ it("shows the chain for a resource shipped through a gate, each link with the line that opens its source", () => {
94
+ const v = chainView(chained());
95
+ expect(v.note).toBeNull();
96
+ expect(v.commits.map((c) => [c.sha, c.subject])).toEqual([
97
+ [LINKED.slice(0, 8), "serve the app on 8081"],
98
+ [BASE.slice(0, 8), "the shop and W-001"],
99
+ ]);
100
+ const rows = v.commits[0].rows;
101
+ expect(rows.map((r) => [r.label, r.text, r.missing])).toEqual([
102
+ ["asked for by", "work:W-001", false],
103
+ ["in the window of", "work:W-001", false],
104
+ ["ci tag", `ci/green/${LINKED}`, false],
105
+ ["release", "v1", false],
106
+ ["gate", "let through by bob on cli at 2026-10-16T10:30:00.000Z", false],
107
+ ["change set", `chant change-set show ${CHANGE_SET} --member delivery`, false],
108
+ ["deploy prod", "app run run-9 at 2026-10-16T10:40:00.000Z", false],
109
+ ["deploy staging", "app run run-1 at 2026-10-16T09:30:00.000Z", false],
110
+ ]);
111
+ expect(rows[0].meta).toBe("Serve the app on 8081");
112
+ expect(rows[0].source.open).toBe(`git show ${LINKED}`);
113
+ expect(rows[0].source.title).toContain("Chant-Record: work:W-001");
114
+ // The window is listed apart and is never a link.
115
+ expect(rows[1].source).toBeNull();
116
+ expect(rows[1].meta).toBe("the commit fell in its window, which does not link them");
117
+ expect(rows[2].source.open).toBe(`git show refs/tags/ci/green/${LINKED}`);
118
+ expect(rows[2].meta).toBe("counts unsigned");
119
+ expect(rows[3].meta).toBe("cut from this commit · cut by alice at 2026-10-16T10:00:00.000Z");
120
+ expect(rows[3].source.open).toBe(`git show chant/lifecycle:_members/delivery/_releases/${DIGEST.replace(/:/g, "_")}.json`);
121
+ expect(rows[4].meta).toBe("prod-release in prod");
122
+ expect(rows[4].source.open).toBe("git show chant/lifecycle:_members/delivery/_gates/release.jsonl");
123
+ expect(rows[5].source.open).toBe(`git show chant/lifecycle:_members/delivery/_change-sets/${CHANGE_SET.replace(/:/g, "_")}.json`);
124
+ expect(rows[6].meta).toBe("release v1 · admitted by prod-release, let through by bob on cli at 2026-10-16T10:30:00.000Z · approved by bob");
125
+ expect(rows[6].source.open).toBe("git show chant/lifecycle:_members/delivery/prod/releases.jsonl");
126
+ expect(rows[7].meta).toBe("names no release · admitted by no gate resolution chant could find");
127
+ });
128
+
129
+ it("shows a missing link as missing, with chant's reason where it gives one", () => {
130
+ const base = chainView(chained()).commits[1].rows;
131
+ expect(base.filter((r) => r.missing).map((r) => [r.label, r.text, r.meta])).toEqual([
132
+ ["asked for by", "missing", "no work item: the commit names none in a Chant-Record or Chant-Lease trailer"],
133
+ ["ci tag", "no green tag", ""],
134
+ ]);
135
+ // It still shipped: v1 contains it.
136
+ expect(base.find((r) => r.label === "release").meta).toContain(`contains this commit; cut from ${LINKED.slice(0, 8)}`);
137
+
138
+ const v = chainView(
139
+ chained((t) => {
140
+ t.commits[0].work = { state: "wrong", items: [{ id: "work:W-404", node: null, source: { ref: LINKED, field: "Chant-Record", value: "work:W-404" } }], problems: [{ trailer: "Chant-Record", message: "work:W-404 is not a work item in this workspace" }] };
141
+ t.commits[1].tag.ignored = [{ tag: `ci/green/${BASE}`, status: "unsigned", reason: "the tag carries no signature, and ci.green requires one" }];
142
+ t.commits[1].releases = [];
143
+ t.commits[1].deploys = [];
144
+ t.releases[0].gates = [];
145
+ return t;
146
+ }),
147
+ );
148
+ const [linked, bare] = v.commits.map((c) => c.rows.filter((r) => r.missing));
149
+ expect(linked.map((r) => [r.label, r.text, r.meta])).toEqual([
150
+ ["asked for by", "work:W-404", "the commit names a work item chant could not take as its link · chant read no record with this id · Chant-Record: work:W-404 is not a work item in this workspace"],
151
+ ["gate", "missing", "no release gate resolution names v1"],
152
+ ]);
153
+ expect(bare.map((r) => [r.label, r.text, r.meta])).toEqual([
154
+ ["asked for by", "missing", "no work item: the commit names none in a Chant-Record or Chant-Lease trailer"],
155
+ ["ci tag", "no green tag", `ci/green/${BASE} is unsigned: the tag carries no signature, and ci.green requires one`],
156
+ ["release", "missing", "no release is cut from this commit or from one that has it in its history"],
157
+ ["deploy", "missing", "no deploy record is built from this commit or from one that has it in its history"],
158
+ ]);
159
+ });
160
+
161
+ it("says when part of the chain could not be read, and keeps the rest", () => {
162
+ const v = chainView(chained((t) => ({ ...t, reasons: [{ code: "ledger-unreadable", message: "delivery's ledger on chant/lifecycle: bad object" }] })));
163
+ expect(v.reasons).toEqual(["Part of the chain could not be read (ledger-unreadable): delivery's ledger on chant/lifecycle: bad object"]);
164
+ expect(v.commits).toHaveLength(2);
165
+ expect(chainView(chained((t) => ({ ...t, commits: [] }))).note).toBe("chant walked no commit for this region, so there is no chain to show.");
166
+ });
167
+
168
+ it("on a chant below 0.124.29 keeps today's view and says the chain needs 0.124.29", () => {
169
+ const v = whyView(answer({ trace: null, chain: { full: false, floor: "0.124.29", note: "Why chain needs chant 0.124.29 or newer. This project has chant 0.124.28." } }));
170
+ expect(v.decisions).toHaveLength(2);
171
+ expect(v.chain).toEqual({ note: "Why chain needs chant 0.124.29 or newer. This project has chant 0.124.28.", reasons: [], commits: [], more: 0 });
172
+ // A server before #682 sends no chain field, and the section draws none.
173
+ expect(whyView(answer()).chain).toBeNull();
174
+ });
175
+
176
+ it("opens each kind of source with git, and words a gate resolution as 'let through by'", () => {
177
+ expect(sourceLine({ ref: "work/W-001-serve-on-8081.md", field: "window", value: "worked" }).open).toBe("git show HEAD:work/W-001-serve-on-8081.md");
178
+ expect(sourceLine(null)).toBeNull();
179
+ expect(letThrough({ resolvedBy: "bob", channel: null, at: "2026-10-16T10:30:00.000Z" })).toBe("let through by bob at 2026-10-16T10:30:00.000Z");
180
+ });
181
+ });