@intentius/behold 0.30.2 → 0.31.0
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/AGENTS.md +444 -15
- package/README.md +14 -13
- package/demos.json +14 -9
- package/dist/cli.js +53928 -26475
- package/example-carve/README.md +19 -23
- package/example-carve/app/package.json +1 -1
- package/example-carve/app/src/carved.ts +3 -3
- package/example-carve/carve-report.json +1 -1
- package/example-carve/{legacy-tf → tf-root}/terraform.tfstate +1 -1
- package/example-choudoufu-estate/README.md +7 -0
- package/example-choudoufu-estate/chant.workspace.json +1 -1
- package/example-choudoufu-estate/scripts/choudoufu-down.sh +2 -1
- package/example-choudoufu-estate/scripts/choudoufu-up.sh +10 -3
- package/example-terraform-estate/README.md +32 -5
- package/example-terraform-estate/chant.workspace.json +1 -1
- package/example-terraform-estate/recorded/adoption/platform.json +72 -0
- package/example-terraform-estate/recorded/adoption/prod.json +224 -0
- package/example-three-cloud/README.md +111 -18
- package/example-three-cloud/aws/Pulumi.yaml +15 -0
- package/example-three-cloud/aws/index.ts +174 -0
- package/example-three-cloud/aws/package-lock.json +2725 -0
- package/example-three-cloud/aws/package.json +14 -0
- package/example-three-cloud/aws/tsconfig.json +17 -0
- package/example-three-cloud/azure/main.tf +48 -0
- package/example-three-cloud/azure/site.tf +104 -0
- package/example-three-cloud/chant.config.json +9 -0
- package/example-three-cloud/chant.workspace.json +30 -4
- package/example-three-cloud/dns/chant.config.ts +26 -1
- package/example-three-cloud/dns/src/records.component.ts +32 -6
- package/example-three-cloud/package-lock.json +48 -27
- package/example-three-cloud/package.json +8 -6
- package/example-three-cloud/scripts/emulators-up.sh +28 -1
- package/example-three-cloud/scripts/front-door.ts +679 -86
- package/package.json +13 -6
- package/web/adopt-pulumi.js +114 -0
- package/web/adopt-pulumi.test.js +28 -0
- package/web/adopt.js +203 -0
- package/web/adopt.test.js +27 -0
- package/web/app.js +358 -10
- package/web/carve-steps.js +1 -1
- package/web/carve-steps.test.js +2 -2
- package/web/change-set-overlay.js +12 -5
- package/web/change-set-overlay.test.js +22 -0
- package/web/drift-stream.js +241 -0
- package/web/drift-stream.test.js +146 -0
- package/web/edge-weight.d.ts +1 -1
- package/web/edge-weight.js +5 -1
- package/web/edge-weight.test.js +19 -0
- package/web/graph-query.js +180 -0
- package/web/graph-query.test.js +49 -0
- package/web/graph.html +107 -0
- package/web/index-diff.js +109 -0
- package/web/index-diff.test.js +39 -0
- package/web/index.html +37 -0
- package/web/kiosk-ask-tips.js +15 -5
- package/web/kiosk-ask-tips.test.js +14 -1
- package/web/kiosk-estate-scene.js +72 -8
- package/web/kiosk-light-frame.js +1 -0
- package/web/kiosk-light.js +41 -3
- package/web/kiosk-member-kind.test.js +140 -0
- package/web/kiosk-popover.js +4 -1
- package/web/kiosk-side.js +296 -0
- package/web/kiosk-side.test.js +249 -0
- package/web/kiosk-watch.js +12 -0
- package/web/kiosk-watch.test.js +15 -1
- package/web/kiosk.html +47 -1
- package/web/kiosk.js +106 -7
- package/web/member-kind.js +31 -0
- package/web/template-apps.js +245 -0
- package/web/template-apps.test.js +252 -0
- package/web/templates.js +285 -0
- package/web/templates.test.js +155 -0
- package/web/terragucci-lifecycle.js +112 -62
- package/web/terragucci-lifecycle.test.js +29 -1
- package/web/terragucci-timeline.js +39 -2
- package/web/terragucci-timeline.test.js +42 -1
- package/example-three-cloud/aws/chant.config.ts +0 -8
- package/example-three-cloud/aws/site.component.ts +0 -13
- package/example-three-cloud/aws/src/site.ts +0 -27
- package/example-three-cloud/azure/chant.config.ts +0 -1
- package/example-three-cloud/azure/src/site.component.ts +0 -13
- package/example-three-cloud/azure/src/site.ts +0 -18
- /package/example-carve/{legacy-tf → tf-root}/cdn.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/compute.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/floci-override.tf.disabled +0 -0
- /package/example-carve/{legacy-tf → tf-root}/modules/cdn/main.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/naming.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/network.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/observability.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/outputs.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/storage.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/versions.tf +0 -0
|
@@ -24,18 +24,54 @@ const KIND_WORDS = {
|
|
|
24
24
|
"state-export": "state exported",
|
|
25
25
|
"ephemeral-apply": "ephemeral copy applied",
|
|
26
26
|
"ephemeral-destroy": "ephemeral copy destroyed",
|
|
27
|
+
"unrecorded-write": "write no run recorded",
|
|
28
|
+
"agent-run": "agent run",
|
|
29
|
+
request: "app requested",
|
|
30
|
+
"action-requested": "action requested",
|
|
31
|
+
action: "action",
|
|
27
32
|
};
|
|
28
33
|
|
|
34
|
+
/** behold#1037: an action entry's name, root and address, from its detail, else its gate `<root>:<address>`. */
|
|
35
|
+
export function actionOf(entry) {
|
|
36
|
+
const d = entry.detail || {};
|
|
37
|
+
const gate = String(entry.what || "");
|
|
38
|
+
const address = typeof d.address === "string" ? d.address : gate.slice(gate.indexOf(":") + 1);
|
|
39
|
+
const root = typeof d.root === "string" ? d.root : gate.endsWith(`:${address}`) ? gate.slice(0, -address.length - 1) : (entry.roots || [])[0] || "";
|
|
40
|
+
return { name: address.split(".").pop() || address, root, address };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The page of the CI run behind an entry, when the record names its run id
|
|
45
|
+
* and its ledger commit is on a forge page: `<repo>/actions/runs/<id>`, as
|
|
46
|
+
* GitHub and Forgejo both lay it out.
|
|
47
|
+
*/
|
|
48
|
+
export function runUrlOf(entry) {
|
|
49
|
+
const id = entry.run && entry.run.run_id;
|
|
50
|
+
const url = entry.evidence && entry.evidence.url;
|
|
51
|
+
if (!id || !/^\d+$/.test(String(id)) || typeof url !== "string") return null;
|
|
52
|
+
const m = /^(https?:\/\/[^/]+\/[^/]+\/[^/]+)\/commit\/[0-9a-f]+$/i.exec(url);
|
|
53
|
+
return m ? `${m[1]}/actions/runs/${id}` : null;
|
|
54
|
+
}
|
|
55
|
+
|
|
29
56
|
/** The tone an entry is drawn in: a refusal or a failure stands out, a wait is pending, the rest is quiet. */
|
|
30
57
|
export function toneOf(entry) {
|
|
31
58
|
if (entry.kind === "refused" || entry.result === "failed" || entry.result === "denied") return "failed";
|
|
32
|
-
if (entry.result === "waiting" || entry.kind === "approval-requested" || entry.kind === "override-requested") return "wave";
|
|
59
|
+
if (entry.result === "waiting" || entry.kind === "approval-requested" || entry.kind === "override-requested" || entry.kind === "action-requested") return "wave";
|
|
33
60
|
if (entry.kind.endsWith("-revoked")) return "drift";
|
|
34
61
|
return "ok";
|
|
35
62
|
}
|
|
36
63
|
|
|
37
|
-
/** One entry as a line: "approved wave-2 by dana · plan 4be1…". */
|
|
64
|
+
/** One entry as a line: "approved wave-2 by dana · plan 4be1…", or for an action "rotate on apps/orders, approved by dana, ok". */
|
|
38
65
|
export function entryLine(entry) {
|
|
66
|
+
if (entry.kind === "action") {
|
|
67
|
+
const a = actionOf(entry);
|
|
68
|
+
return `${a.name} on ${a.root}${entry.who ? `, approved by ${entry.who}` : ""}${entry.result ? `, ${entry.result}` : ""}`;
|
|
69
|
+
}
|
|
70
|
+
if (entry.kind === "action-requested") {
|
|
71
|
+
const a = actionOf(entry);
|
|
72
|
+
const digest = entry.digest ? ` · plan ${entry.digest.replace(/^(jcs1-)?sha256:/, "").slice(0, 12)}` : "";
|
|
73
|
+
return `${a.name} on ${a.root} requested${entry.who ? ` by ${entry.who}` : ""}${entry.result ? `, ${entry.result}` : ""}${digest}`;
|
|
74
|
+
}
|
|
39
75
|
const what = KIND_WORDS[entry.kind] || entry.kind;
|
|
40
76
|
const by = entry.who ? ` by ${entry.who}` : "";
|
|
41
77
|
// Signing is opt-in: an unsigned approval is the normal case and goes unmarked.
|
|
@@ -63,6 +99,7 @@ export function laneRows(answer, { root = null, now = new Date() } = {}) {
|
|
|
63
99
|
const links = [];
|
|
64
100
|
if (e.run && e.run.report) links.push({ text: "report", href: hrefOf(answer, e.run.report) });
|
|
65
101
|
if (e.run && e.run.job_url) links.push({ text: "job", href: e.run.job_url });
|
|
102
|
+
else if (runUrlOf(e)) links.push({ text: "run", href: runUrlOf(e) });
|
|
66
103
|
if (e.evidence && e.evidence.source === "ledger" && /^https?:\/\//.test(e.evidence.url || "")) links.push({ text: "ledger commit", href: e.evidence.url });
|
|
67
104
|
return {
|
|
68
105
|
id: e.id,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { entryLine, laneLegend, laneRows, rootOfCard, toneOf } from "./terragucci-timeline.js";
|
|
2
|
+
import { actionOf, entryLine, laneLegend, laneRows, rootOfCard, runUrlOf, toneOf } from "./terragucci-timeline.js";
|
|
3
3
|
|
|
4
4
|
// #506: the lane's words, from answers shaped like /api/terragucci/timeline.
|
|
5
5
|
const NOW = new Date("2026-10-08T13:31:00Z");
|
|
@@ -54,3 +54,44 @@ describe("the timeline lane (#506)", () => {
|
|
|
54
54
|
expect(laneLegend({ error: "audit.jsonl in /r, line 2, is not JSON.", code: "terragucci-report" })).toContain("line 2");
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
|
+
|
|
58
|
+
describe("a day-2 action's history (behold#1037)", () => {
|
|
59
|
+
const GATE = "apps/orders:module.app.action.aws_lambda_invoke.rotate";
|
|
60
|
+
const DIGEST = `sha256:${"a1".repeat(32)}`;
|
|
61
|
+
const action = {
|
|
62
|
+
id: "act",
|
|
63
|
+
kind: "action",
|
|
64
|
+
at: "2026-10-08T10:30:00.000Z",
|
|
65
|
+
who: "dana",
|
|
66
|
+
what: GATE,
|
|
67
|
+
digest: DIGEST,
|
|
68
|
+
result: "ok",
|
|
69
|
+
roots: ["apps/orders"],
|
|
70
|
+
run: { run_id: "402" },
|
|
71
|
+
evidence: { source: "ledger", path: "_gates/tf-action/applied.jsonl", url: `https://github.com/acme/shop/commit/${"b".repeat(40)}` },
|
|
72
|
+
detail: { root: "apps/orders", address: "module.app.action.aws_lambda_invoke.rotate", approved_by: "dana", requester: "lee" },
|
|
73
|
+
};
|
|
74
|
+
const asked = { ...action, id: "ask", kind: "action-requested", at: "2026-10-08T10:00:00.000Z", who: "lee", result: "waiting", run: { run_id: "401" }, evidence: { ...action.evidence, path: "_gates/tf-action.jsonl" } };
|
|
75
|
+
|
|
76
|
+
it("renders an action entry as its name on its root, who approved it and how it ended, with its run link", () => {
|
|
77
|
+
expect(entryLine(action)).toBe("rotate on apps/orders, approved by dana, ok");
|
|
78
|
+
const rows = laneRows({ ...answer, entries: [action, asked] }, { root: "apps/orders", now: NOW });
|
|
79
|
+
expect(rows[0].text).toBe("rotate on apps/orders, approved by dana, ok");
|
|
80
|
+
expect(rows[0].tone).toBe("ok");
|
|
81
|
+
expect(rows[0].links).toEqual([
|
|
82
|
+
{ text: "run", href: "https://github.com/acme/shop/actions/runs/402" },
|
|
83
|
+
{ text: "ledger commit", href: action.evidence.url },
|
|
84
|
+
]);
|
|
85
|
+
expect(runUrlOf(action)).toBe("https://github.com/acme/shop/actions/runs/402");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("renders the request as who asked, waiting, with its digest, and a failed run as failed", () => {
|
|
89
|
+
expect(entryLine(asked)).toBe(`rotate on apps/orders requested by lee, waiting · plan ${"a1".repeat(6)}`);
|
|
90
|
+
expect(toneOf(asked)).toBe("wave");
|
|
91
|
+
expect(toneOf({ ...action, result: "failed" })).toBe("failed");
|
|
92
|
+
expect(entryLine({ ...action, result: "failed" })).toBe("rotate on apps/orders, approved by dana, failed");
|
|
93
|
+
// An entry with no detail still reads from its gate.
|
|
94
|
+
expect(actionOf({ what: GATE, roots: [] })).toEqual({ name: "rotate", root: "apps/orders", address: "module.app.action.aws_lambda_invoke.rotate" });
|
|
95
|
+
expect(runUrlOf({ ...action, evidence: { source: "ledger" } })).toBeNull();
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// The aws member's stack is named for the workspace, so it doesn't share the
|
|
2
|
-
// stack named after the environment ("local") with the dns member.
|
|
3
|
-
export default {
|
|
4
|
-
lexicons: ["aws"],
|
|
5
|
-
sourceDir: "src",
|
|
6
|
-
environments: [{ name: "local", endpoint: "http://localhost:4566" }],
|
|
7
|
-
stacks: [{ name: "three-cloud-aws", src: "src" }],
|
|
8
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { phase, type Component } from "@intentius/chant/components";
|
|
2
|
-
|
|
3
|
-
// The aws member as one component: build its template, then apply it as the
|
|
4
|
-
// stack three-cloud-aws, the name the dns member reads its output from.
|
|
5
|
-
export const site: Component = {
|
|
6
|
-
name: "site",
|
|
7
|
-
archetype: "infra",
|
|
8
|
-
dependsOn: [],
|
|
9
|
-
deploy: [
|
|
10
|
-
phase("Build", [{ kind: "shell", cmd: "npx chant build src -o dist/site.json", reason: "the template cfn-deploy applies is this member's own build" }]),
|
|
11
|
-
phase("Apply", [{ kind: "cfn-deploy", stack: "three-cloud-aws", template: "dist/site.json" }]),
|
|
12
|
-
],
|
|
13
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { FargateAlb, VpcDefault, output } from "@intentius/chant-lexicon-aws";
|
|
2
|
-
|
|
3
|
-
// The website on ECS Fargate in us-east-1, behind its own load balancer: the
|
|
4
|
-
// ALB's DNS name is the stable hostname Route 53 points at. The network is
|
|
5
|
-
// declared here as production has it: a VPC across two zones, public subnets
|
|
6
|
-
// for the load balancer and private ones for the tasks, which reach out
|
|
7
|
-
// through a NAT gateway.
|
|
8
|
-
export const network = VpcDefault({
|
|
9
|
-
cidr: "10.20.0.0/16",
|
|
10
|
-
publicSubnet1Cidr: "10.20.0.0/24",
|
|
11
|
-
publicSubnet2Cidr: "10.20.1.0/24",
|
|
12
|
-
privateSubnet1Cidr: "10.20.10.0/24",
|
|
13
|
-
privateSubnet2Cidr: "10.20.11.0/24",
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export const web = FargateAlb({
|
|
17
|
-
image: "traefik/whoami:v1.10",
|
|
18
|
-
containerPort: 80,
|
|
19
|
-
desiredCount: 1,
|
|
20
|
-
vpcId: network.vpc.VpcId,
|
|
21
|
-
publicSubnetIds: [network.publicSubnet1.SubnetId, network.publicSubnet2.SubnetId],
|
|
22
|
-
privateSubnetIds: [network.privateSubnet1.SubnetId, network.privateSubnet2.SubnetId],
|
|
23
|
-
logRetentionDays: 7,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
// The dns member reads this as its `awsEndpoint` parameter.
|
|
27
|
-
export const awsEndpoint = output(web.alb.DNSName, "awsEndpoint");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default { lexicons: ["azure"], sourceDir: "src", environments: [{ name: "local", endpoint: "http://localhost:4577" }] };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { phase, type Component } from "@intentius/chant/components";
|
|
2
|
-
|
|
3
|
-
// The azure member as one component: build its ARM template, then deploy it
|
|
4
|
-
// into the resource group named after the environment.
|
|
5
|
-
export const site: Component = {
|
|
6
|
-
name: "site",
|
|
7
|
-
archetype: "infra",
|
|
8
|
-
dependsOn: [],
|
|
9
|
-
deploy: [
|
|
10
|
-
phase("Build", [{ kind: "shell", cmd: "npx chant build src -o dist/site.json", reason: "the template arm-deploy applies is this member's own build" }]),
|
|
11
|
-
phase("Apply", [{ kind: "arm-deploy", template: "dist/site.json", resourceGroup: "local", location: "westeurope", noRollback: "a failed deploy is fixed forward by deploying the template again" }]),
|
|
12
|
-
],
|
|
13
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ContainerAppNetwork, ContainerAppSite, output } from "@intentius/chant-lexicon-azure";
|
|
2
|
-
|
|
3
|
-
// The website on Azure Container Apps in West Europe, from the lexicon's
|
|
4
|
-
// composites: its network, and the site in it.
|
|
5
|
-
export const network = ContainerAppNetwork({ name: "three-cloud", location: "westeurope", addressSpace: "10.40.0.0/16", subnetPrefix: "10.40.0.0/23" });
|
|
6
|
-
|
|
7
|
-
export const web = ContainerAppSite({
|
|
8
|
-
name: "three-cloud",
|
|
9
|
-
app: "web",
|
|
10
|
-
location: "westeurope",
|
|
11
|
-
subnetId: network.subnet.id as unknown as string,
|
|
12
|
-
image: "traefik/whoami:v1.10",
|
|
13
|
-
port: 80,
|
|
14
|
-
replicas: 1,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
// The dns member reads this as its `azureEndpoint` parameter.
|
|
18
|
-
export const azureEndpoint = output(web.containerApp.configuration_ingress_fqdn, "azureEndpoint");
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|