Repository navigation
feat(terragucci): serve --terragucci draws an estate from its reports, locally and read-only (#490) - #494
Merged
Conversation
…, locally and read-only (#490) `behold serve . --terragucci <dir|s3://bucket/prefix|https://…>` draws the checkout's Terraform roots and marks each card with what terragucci's newest runs found. index.json gives each run's directory; one GET of a run's report.json follows, only for the newest tf-plan, tf-drift and tf-apply runs that hold each root. No cloud is read and nothing writes _status: every mark is dated by its run ("drift found 06:04 UTC, 4h ago") and links its report, job, pull request and trace. - src/terragucci-source.ts: a directory, s3:// through the operator's own `aws s3 cp <key> -` (GetObject only, no SDK, no credentials held), or an https address serving the bucket. - src/terragucci-reports.ts: the reads. Each document is checked against terragucci's JSON Schemas when @intentius/terragucci resolves (ajv, draft 2020-12), structurally otherwise; refusals are `code: "terragucci-report"` with a remedy. Waiting waves and counts come from estate.json when the source has one, else terragucci's own rule over the index. - src/terragucci-overlay.ts: root path to attrs.root, instance address to block path. Changes no card is, and reported roots the checkout lacks, are listed, never dropped. - src/terragucci-view.ts: GET /api/terragucci (the marks, roots, waiting waves, estate counts) and GET /api/terragucci/file (a report file from the same source, sandboxed). No approve route. - web/terragucci.js and app.js: a corner glyph and age on each flagged card, the marks with links in the inspect pane, and a Terragucci tab: a legend that says "not live", terragucci's estate counts linking estate.html, each waiting wave as a gate card whose only action is copying `npx terragucci approve wave-<k> --plan <digest>`, and every root's newest drift, plan and apply ("no report" kept apart from "no changes"). example-terragucci-reports/ is a bucket for terragucci's own example estate, written by terragucci's buildReport, uploadReport and buildEstate at cb2381d2 (scripts/terragucci-example-reports.ts supplies only the plans), and valid against @intentius/terragucci 0.4.4's schemas. The tests read it; e2e/terragucci-e2e.sh (`just e2e-terragucci`) serves a copy of terragucci's example with it through the built CLI and the real Terraform read. ajv becomes a declared dependency (already in the tree through chant) and stays outside the bundle. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #490.
npx @intentius/behold serve . --terragucci <dir|s3://bucket/prefix|https://…>draws the checkout's roots and marks each card with what terragucci's newest runs found. The marks are dated, never a fill and never "live".Done-when, item by item
index.jsongives each run's path. Then behold makes one GET ofreport.json, only for the newest runs that hold each root (bounded at 12 runs per stage). No cloud read. On terragucci's example that is 5 report GETs.⚠ drift · 4h,~ plan · 2hor⏸ wave · 1h. The inspect pane says "drift found 06:04 UTC, 4h ago: deleted outside Terraform" with links to the report, job, PR and trace. Nothing sets_status, and a test asserts it.npx terragucci approve wave-<k> --plan <digest>, which is terragucci's own wording, bound to the set digest. There is no approve route, and the route test asserts one doesn't exist. Every behold write already refuses on a terragucci repo (Never in the way: behold refuses to apply a terragucci repo, export works, an empty workspace draws instead of crashing #489).estate.html. Withoutestate.json, it falls back to terragucci's rule over the index (projectState). behold's part is the resource graph.@intentius/terragucciresolvable from the repo or beside behold, behold checks each document with ajv against the package'sreport,report-indexandestateschemas. Without it, behold checks the schema id and the fields it reads. Refusals come back as422 {code: "terragucci-report", error, remedy}.example-terragucci-reports/is a bucket for terragucci's own example. It was written by terragucci'sbuildReport/uploadReport/buildEstateatcb2381d2; the script only supplies the plans. All 9 JSON documents validate against the schemas in 0.4.4 and on main. Its README lists the runs.src/terragucci-{reports,overlay,route}.test.tsandweb/terragucci.test.js.e2e/terragucci-e2e.sh(just e2e-terragucci) serves a copy of terragucci'sexample/with the built CLI and the real Terraform read. It asserts 15 roots, the 4 flagged cards, every change placed, the waiting wave's line, the sandboxed report page, and the write refusals. It passes locally both without@intentius/terragucci("structural") and with 0.4.4 installed ("schema"). Without the lexicon orTERRAGUCCIit skips, so CI is unaffected.Notes
aws s3 cp <key> -. It needs GetObject only, never a list call, and behold ships no SDK and holds no credentials.GET /api/terragucci/file, which reads them from the same source, so links work for a private bucket. Keys are relative paths with a report file's extension, and the page is served withcontent-security-policy: sandbox, so its scripts can't reach behold's routes.ajvbecomes a declared dependency (it was already in the tree through chant) and stays external to the bundle.--terragucci-projectpicks a project when a bucket holds several and none is the checkout's git remote.Tests
events.test.ts > watchSources, the real-fs.watchtiming test, which also fails 1 run in 3 on a clean copy ofmainon this machine.🤖 Generated with Claude Code