Skip to content

Generated files — the contract

Which files in this repo are generated, from what and by which command, and the header, determinism and action-pinning guarantees that compiled workflows carry.

Landed here from a ⚙ GENERATED BY GITFACTORY header? That file is compiler output. Edit the blueprint it names, regenerate, commit both. Never hand-edit it (golden rule #2).

This page is the one place that says which files in this repo the compiler and the generators write, how to tell, how to regenerate them, and what guarantees (determinism, action pinning) the output carries. Every claim below is checked against app/src/compiler/compile.ts and the scripts in app/scripts/ and tools/; when you change one of those, change this page in the same PR.

What is generated, from what, by what

Generated path Source of truth Regenerate with (from app/)
.github/workflows/factory--gitorio-factory-{1,2,3,4}.yml .factory/blueprint.json (+ prompts in .factory/prompts/) compile() over the blueprint — the app's Deploy button, or npx vite-node scripts/compile-blueprint.ts ../.factory/blueprint.json ../.github/workflows .factory/blueprint.json (refuses to write on an error diagnostic)
.github/workflows/factory--docs-gardener.yml, .factory/docs-gardener.blueprint.json, .factory/config.yml the docs-gardener gallery template in app/src/templates/catalog.ts + app/src/content/model.ts npx vite-node scripts/gen-docs-gardener.ts
examples/compiled/factory--*.yml (the golden anchors) examples/*.blueprint.json npx vite-node scripts/regen-examples.ts — owns the directory: stale files are removed
examples/issue-factory/issue-factory.blueprint.json, examples/issue-factory/workflows/factory--issue-factory-{1,2}.yml the issue-factory gallery template in app/src/templates/catalog.ts (the prompts beside them are hand-written content) npx vite-node scripts/gen-issue-factory.ts
app/public/maps/* (archify maps + manifest.json) .factory/*.blueprint.json and the demo fixtures npm run maps — owns the directory; npm run maps:check is the CI diagram-gate
docs/reference/machines.md app/src/machines/registry.ts npm run reference; npm run reference:check and npm test (reference.test.ts) fail when it is stale
the AUTO:docs-index span in docs/README.md each document's summary line (front-matter description: or the > line under its H1) python3 tools/docs_index.py --write, from the repo root; --check fails when it is stale
app/dist/ the app source npm run build — a build artifact, not committed

Everything else in .github/workflows/ is hand-written or seeded by a bamr87 hub kit (ci.yml, claude.yml, conformance.yml, deploy-pages.yml, evolve.yml, markdown-oneline.yml, release.yml, verify.yml): only files named factory--<slug>.yml are compiler output. .factory/ is source (blueprints, prompts, config.yml), not output — the one exception being the docs-gardener trio above, which a script materialises from the template so the committed dogfood can never drift from the gallery.

The map manifest

app/public/maps/manifest.json is written by the same npm run maps run, beside the maps: one entry per delivered map (slug, type, source, hash), sorted by slug so the file is byte-stable, and covered by npm run maps:check like every other file in that directory. The app imports it at build time (app/src/map/manifest.ts) to decide where an "Open delivered map" link or a Docs ::map <slug> figure may point; a slug that is not listed renders a note, never a broken frame. Edit a blueprint or a demo fixture and regenerate — never the manifest.

How to recognise a generated file

Every compiled workflow starts with exactly this two-line header (inline in compile(), compile.ts):

# ⚙ GENERATED BY GITFACTORY — edit the blueprint, not this file.
# blueprint: .factory/blueprint.json  hash: 038bb273

The path is whatever blueprintPath the caller passed (default .factory/blueprint.json). The hash is blueprintHash(bp) in app/src/blueprint/types.ts: a 32-bit FNV-1a over JSON.stringify({ nodes, edges, meta }), rendered as 8 lowercase hex digits. It fingerprints the blueprint, not the YAML, so:

  • header hash ≠ hash of the blueprint next to it → the blueprint moved and nobody regenerated (or someone hand-edited the YAML);
  • the Deploy planner (app/src/github/deploy.ts) reads this header from the target repo and shows the drift banner when it disagrees with the blueprint it is about to deploy — a missing or garbled header counts as drifted.

Prompts (.factory/prompts/*.md) are deliberately not hashed: they are read by the agent at run time, so editing one is a hot change that needs no recompile (ARCHITECTURE § prompts).

Determinism

compile() is a pure function of the blueprint plus explicit CompileOptions (blueprintPath, pinActions) — no I/O, no clock, no environment reads (golden rule #3). Compiling the same blueprint twice yields identical bytes; regen-examples.ts is idempotent for that reason, and examples/compiled/ is the committed proof. If you ever want a timestamp, run id, hostname, or absolute path in generated output: don't — it belongs in git log, and it would break the reference-output tests.

Action pinning

Compiled workflows reference exactly the third-party actions in the exported PINNED_ACTIONS table in compile.ts (actions/checkout, anthropics/claude-code-action, dependabot/fetch-metadata, actions/upload-artifact, actions/download-artifact, peter-evans/create-pull-request). Two modes:

  • Default — floating major tags (actions/checkout@v7). Chosen so factories deployed into repos that keep tags by convention (law-ai) don't fight the target's style.
  • meta.pinActions: true on the blueprint (or the pinActions compile option, ADR-026) — every emitted uses: becomes owner/action@<40-char sha> # <tag>, the tag restored as a trailing comment in a deterministic post-stringify pass.

Bumping a version is therefore a compiler change, never an edit to a factory--*.yml: Dependabot's github-actions ecosystem will keep opening PRs against the generated files (it did — #3, #55), and each one is reverted by the next regen. The procedure is: resolve the new tag (git ls-remote https://github.com/<owner>/<repo> refs/tags/<tag>, or gh api repos/<owner>/<repo>/git/ref/tags/<tag> — dereference annotated tags via /git/tags/<sha>), update the ref and the SHA in PINNED_ACTIONS, note the verification date in the comment above the table, regenerate everything in the table at the top of this page, and let the invariant tests confirm it. There is no separate "pin-check" CI job; the guard is the pinned-actions test in compile.test.ts, which fails if a pinRef() call site's ref is missing from the table or a bare uses: literal bypasses the wrapper. Re-verifying the table against live upstream refs from /compile-check is BL-20260818-02.

Reviewing a PR that touches generated files

  • A factory--*.yml diff with no blueprint / template / compiler diff is a hand edit — ask where it came from, then bounce it to the source.
  • A blueprint or compiler diff with no regenerated output means the change isn't live yet; regenerate in the same PR.
  • Review the blueprint for intent and the YAML for fidelity; the compiler invariant tests (cd app && npm test) plus /compile-check do the byte-level comparison.

See also