Skip to content

Export writes graph.json and the single-file viewer beside today's bundle #1071

Closed

Description

@lex00

behold export should leave a graph document at a fixed path, so a dashboard, a portal or a later bot can point at one URL, and a one-file viewer that opens from disk or as a single CI artifact. The first half needs only the document and can ship well before the reader work in phase 1. Part of #1049, phase 2.

Today

  • The export writes snapshots/<key>.<sha16>.json, manifest.json, index.html with a copy of web/, a README, the licence notices, wrangler.jsonc and .assetsignore (src/export.ts). Snapshot names change with their bytes, so nothing outside behold can name "the graph".
  • --no-source drops attrs.source (src/export.ts:521). --publish s3://<bucket>/<prefix>/views/<name> uploads one folder per commit with history.json and latest.json (docs/src/content/docs/using/export.mdx:65).
  • On the 49-root kubernetes/k8s.io infra/ folder, an export with --no-source took 128.7 s and wrote 28 MB of snapshots. One detail-2 snapshot held 1.5 MB of SVG and 661 KB of IR for 570 drawn nodes.
  • actions/upload-artifact v7 with archive: false uploads one file unzipped, and the browser opens simple HTML directly. Today's export is a folder of more than 300 files.

Change

  • Write graph.json at the bundle root: the opening view's snapshot through toDocument, at detail 2, following --no-source. List it in manifest.json and carry it in each --publish folder.
  • Once the single-file viewer exists, also write behold.html (the one-file viewer) with the document inlined, opening on the same view as index.html.
  • --single-file <path> writes only that one file, for CI artifacts.
  • Keep the multi-file export as it is for Pages and docs sites.

Done when

  • behold export example-terraform-estate --out x writes x/graph.json, and it validates against the behold-graph/1 schema.
  • jq '.nodes | length' x/graph.json equals the node count of the opening view's snapshot IR.
  • With --no-source, a fixture whose .tf file holds a marker comment gives a graph.json without the marker.
  • x/behold.html opened from file:// in headless Chrome draws the same cards as x/index.html served over HTTP.
  • --single-file on the 49-root folder writes one file and the PR records its size.

Depends on

"behold-graph/1 document and schema" for graph.json. "Single-file viewer build" for behold.html and --single-file. Neither half needs #1057 or #1058, since the export drives the in-process app as it does now.

Not in this issue

The Pages workflow. A faster export that skips the lens matrix.

Activity

  1. added
    wave:2
    epic:surfaces
    on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic:surfaceswave:2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions