Skip to content

docs(site): implement three-zone governance and strict pretty YAML - #58

Merged
thxCode merged 4 commits into
mainfrom
docs/three-zone-governance
Nov 24, 2026
Merged

thxCode merged 4 commits into
mainfrom
docs/three-zone-governance

Conversation

@thxCode

@thxCode thxCode commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind documentation
/area docs
/area site

Summary

  • Three-zone documentation governance: Partitions docs/ into three explicit zones driven by three top-level tables in docs/README.md (## All pages for the 15 concise human-first public site pages, ## Reference for 6 flat machine-oriented docs/references/*.md files, and ## Contribute for the 12 repository-only contributor pages).
  • llms.txt isolation and flat reference pipeline: Updates site/layouts/home.llms.txt, site/hugo.toml, site/layouts/partials/{readme-table-rows,link-destination,markdown-content}.html, and scripts/site.mjs (stageReferenceDocs(), rewriteReferenceMarkdown(), syncGhPagesRoot(), verifySite()) so llms.txt isolates public pages (/docs/.../index.md), static flat references (/references/*.md), and optional contributor guides (https://github.com/gpustack/loopwright/blob/<sourceRef>/...), while keeping references/, development.md, and contribute/** out of site navigation, sitemap.xml, and index.json. Also updates resolveHugo() to prefer Hugo >= 0.153.0 (0.170.1 in CI) and migrates the Hugo mount to files = ["*.md"].
  • Navigation plurality fix (Evolutionary Campaign): Renames docs/walkthroughs/evolutionary-campaigns.md to docs/walkthroughs/evolutionary-campaign.md (# Evolutionary Campaign) and aligns navigation labels, indexes, llms.txt, and skill references to match sibling singular walkthrough titles (Declarative Taskpack, Managed Controller, Evolutionary Campaign).
  • Concise public guides + flat LLM references: Slims the 15 public site pages from 3,541 to 2,676 lines (-24.4%) while preserving all normative contracts and exhaustive schema, flag, and protocol dictionaries in 6 flat docs/references/*.md files (README.md, bootstrap-interview.md, taskpack-and-contract-schema.md, controller-and-registry-schema.md, cli-and-action-reference.md, coding-agent-protocol.md).
  • Strict Pretty Block-Style YAML rule & AST linter: Expands all 150 non-empty YAML flow mappings ({ ... }) and flow sequences ([ ... ]) across README.md and docs/**/*.md into pure 2-space block-style YAML, enforces this via yaml's parseDocument(..., { version: "1.2", schema: "core", uniqueKeys: true }) AST in scripts/check-docs.mjs alongside H1–H3 depth caps, <= 8 public H2 caps, layout-container heading noun bans, one-way public link isolation, checked kind-plural rules, and site/content/docs/_index.md + site/layouts/index.html 15-page parity. Updates .agents/skills/loopwright-docs/** (and sibling skills) plus packages/cli/test/{check-docs-rules,docs-and-site}.test.ts.
  • Verification scope: Verified locally with full build, typecheck, ESLint, check-docs.mjs, Hugo v0.170.1 site build/link verification, CLI closure audit, and 20 docs/site/gh-pages unit and E2E tests. Live GitHub Pages deployment occurs on merge to main.

Related Issues

None.

Verification

  • npm run build passed cleanly
  • npm run typecheck passed cleanly
  • npm run lint passed cleanly
  • npm run lint:docs passed cleanly (Checked 34 docs pages and 44 linked sources; 0 error(s).)
  • npm run site built and verified with zero broken links (Verified 18 HTML pages and 15 Markdown exports; 0 broken link(s) (6 reference file(s)).)
  • Focused tests passed (node --test --test-concurrency=1 .test-build/packages/cli/test/check-docs-rules.test.js .test-build/packages/cli/test/docs-and-site.test.js .test-build/packages/github-app/test/site-gh-pages.test.js — 20/20 passed)
  • Verified node packages/cli/dist/main.js closure passed cleanly
  • Verified .github/workflows/ was not modified and remains protected against untrusted taskpack/sandbox writes
  • Signed-off-by: Full Name <email> Developer Certificate of Origin (DCO) included on all commits

Does this PR introduce a user-facing change?

Documentation site updated to three-zone governance: public walkthrough renamed from `/docs/walkthroughs/evolutionary-campaigns/` to `/docs/walkthroughs/evolutionary-campaign/`, detailed machine references exported under `/references/*.md` via `llms.txt`, and strict 2-space block-style Pretty YAML enforced across all documentation examples.

Signed-off-by: thxCode <thxcode0824@gmail.com>
@gpustack-code-review

gpustack-code-review Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

🔍 OpenCodeReview found 2 issue(s) in this PR.

  • ✅ Successfully posted inline: 0 comment(s)
  • 📋 Routed to summary by policy: 2 comment(s)

maintainability · low

📄 scripts/site.mjs (L37-L37)

⚠️ GitHub could not post this as an inline comment: Routed to summary (severity low · category maintainability)

DEFAULT_REPO_BLOB_BASE is now computed at module import time via a filesystem read. Two concerns: (1) the eager fs.readFileSync is an import-time side effect with no error handling — if site/hugo.toml exists but is unreadable, merely importing this module crashes with an unhandled ENOENT/EACCES rather than at a call site where it could be diagnosed; (2) the exported constant is no longer a stable literal, so external consumers/tests that import it get a value that depends on the repo checkout's site/hugo.toml. Consider making this lazy (e.g. a memoized getter) or keeping the constant as a safe fallback used only when site/hugo.toml is absent/unreadable (wrap the read in try/catch).


performance · low

📄 scripts/site.mjs (L31-L33)

⚠️ GitHub could not post this as an inline comment: Routed to summary (severity low · category performance)

repoBlobBaseForRoot() re-reads and re-parses site/hugo.toml on every call, and verifySite() additionally calls readSiteHugoParams(root) separately — so a single verifySite run parses the same config file twice (and buildSite/serveSite/stageReferenceDocs each parse it again). Trivial cost today, but a simple memoization keyed by resolved root would remove the redundancy: const hugoParamsCache = new Map(); function readSiteHugoParams(rootDir) { const key = path.resolve(rootDir); if (!hugoParamsCache.has(key)) hugoParamsCache.set(key, parseHugoParams(key)); return hugoParamsCache.get(key); }. Alternatively, have repoBlobBaseForRoot reuse the result verifySite already holds.

Reviewed 77d5af6..4506b82 only; earlier commits in this PR were reviewed in a previous run.

Comment thread docs/operations/cli.md
Comment on lines 148 to +150
| Code | Meaning |
| --- | --- |
| 0 | Completed, no change, successful static command, or `suite` `eligible`/`deferred`/`ignored` |
| 2 | Usage, configuration, unknown `--domain`, or `TaskpackSuite`/`EvolutionCampaign` manifest rejected |
| 3 | Unsupported capability, blocked work, `TEAM_ENVELOPE_VIOLATION`, `EXPORT_UNVERIFIED_FORBIDDEN`, or `WORKER_DEVICE_QUARANTINED` |
| 4 | Execution, acceptance, or artifact validation failed |
| 5 | Allowance or campaign budget exhausted |
| 6 | Deadline expired |
| 7 | Reconciliation, `EVOLUTION_CONFLICT`, `EVOLUTION_LEASE_FENCED`, `EVOLUTION_CLOCK_DRIFT`, or fenced runner lease |
| 8 | Authoritative result unavailable, incident, store corruption, or runner teardown failure |
| 130 | Step cancellation, paused evolution campaign, or accounted SIGINT, subject to uncertainty precedence |
| 143 | Accounted SIGTERM, subject to uncertainty precedence |
| `0` | Completed, no change, successful static command, or `suite` `eligible`/`deferred`/`ignored` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentation · medium
The detailed per-code diagnostics dropped from this table (e.g. WORKER_DEVICE_QUARANTINED from code 3, RUNNER_TEARDOWN_FAILED from code 8) and the full subcommand flag table now live only in CLI and Action Reference, but this page never links there. Please add a cross-link (e.g. in the "Exit codes" intro or "See also") so automation consumers matching on specific codes can find the complete dictionary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentionally not changed: under three-zone governance, public site/ pages must not link outward to docs/references/** (enforced by scripts/check-docs.mjs and site/layouts/partials/link-destination.html). Coding agents and automation consumers discover /references/cli-and-action-reference.md via llms.txt and docs/references/README.md.

```

Verify `$INSPECT_DIR/result.json` settled `completed`, confirm your local Git working tree is clean and `HEAD` matches the immutable baseline commit OID, and apply `$INSPECT_DIR/candidate.files.json` onto your branch. `candidate.files.json` exports `version: 2` CAS pointers (`{ name, mode, sha256, byteLength, uri, blobPath }`, verified via `O_NOFOLLOW`, `nlink === 1`, and `1 MiB` streaming SHA-256 while preserving `100644`/`100755` modes), with passive fallback for legacy `version: 1` base64 `body` bundles:
Before applying `$INSPECT_DIR/candidate.files.json` onto your branch (either via the `loopwright-step` skill or an atomic script), verify five invariants:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentation · medium
The ~150-line verified overlay-apply script was replaced by a five-point checklist, and the script itself was relocated to Coding Agent Protocol Reference. Without a link here, agents following this page will improvise an apply routine instead of using the fail-closed reference implementation. Please link the reference (e.g. "apply candidate.files.json via the verified apply script").

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentionally not changed: under three-zone one-way link isolation, public site/ pages cannot link to docs/references/**. Coding agents discover /references/coding-agent-protocol.md (and the verbatim overlay-apply script) via llms.txt, docs/references/README.md, and .agents/skills/loopwright-step/SKILL.md.

## Core inputs

All Action inputs are optional. Conditional credentials, endpoint bindings, and event payloads depend on the taskpack and trigger.
All Action inputs are optional. Precedence is `Action with:` inputs > `taskpack.yaml` `spec.limits` > `LOOPWRIGHT_*` env vars > compiler defaults.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentation · medium
The example workflow dropped baseline-alignment and github-app-installation-id lines while the "Core inputs" table still documents baseline-alignment — the input still exists in action.yml, so this is only example/table drift, not a removed feature. More importantly, this page no longer lists ~25 of the 44 inputs; add a pointer to CLI and Action Reference so readers of this page can find the complete input list.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentionally not adding a ../references/... link: public site/ pages are strictly isolated from docs/references/** by scripts/check-docs.mjs and Hugo's link-destination.html guard; the complete 44-input reference lives at /references/cli-and-action-reference.md via llms.txt.

Comment thread scripts/check-docs.mjs
Comment on lines +162 to +178
const marker = line.match(BQ_FENCE);
if (marker && !fence) {
if (!(marker[1][0] === "`" && marker[2].includes("`"))) {
fence = marker[1];
continue;
}
} else if (fence) {
if (marker && marker[1][0] === fence[0] && marker[1].length >= fence.length && !marker[2].trim()) {
fence = "";
}
continue;
}
const stripped = line.trim();
if (comment) {
if (stripped.includes("-->")) comment = false;
continue;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maintainability · medium
The same fence/comment state machine (BQ_FENCE open/close, HTML comment tracking) is now duplicated across ~10 functions in this file (getAnchors, maskExemptMarkdownRegions, checkProseHtml, checkInterrogatives, checkHeadingDepthCeiling, checkHeadingCaps, checkSectionAndLineCaps, checkProseParagraphCaps, checkTables, checkBannedAiFiller, checkKindPlurals, checkReferenceEvidenceHeader). The copies already diverge subtly (e.g. getAnchors uses the plain /^#{1,6}\s+/ heading regex without the blockquote prefix the other checkers use). Extract a shared line iterator/generator (e.g. forEachProseLine(content, cb) that skips fences/comments and indented code) so future fixes land in one place.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aligned getAnchors() in 833aa00 to use the same blockquote-aware heading regex as the other checkers. Kept the broader 10-function prose-iterator refactor out of scope for this docs-governance PR because paragraph and table checkers require fence/blank-line flush semantics; can be followed up separately if needed.

Comment thread scripts/site.mjs Resolved
Comment thread scripts/site.mjs Resolved
Signed-off-by: thxCode <thxcode0824@gmail.com>
@thxCode

thxCode commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Addressed PR review feedback in commit 833aa00:

Addressed (12 items)

  • docs/configuration/controller-and-registry.md (#4681919485): Restored mcp-token in credentialBindings, LOOPWRIGHT_MCP_TOKEN in environmentBindings, and ControllerConfig.spec.credentials in 2-space block-style Pretty YAML; re-validated with validateRegistry().
  • docs/walkthroughs/declarative-taskpack.md (#4681919541): Unified all manifest paths and CLI commands to .loopwright/taskpack.yaml (noting --taskpack <dir>/taskpack.yaml for custom roots); re-validated with validateTaskpackManifestObject().
  • scripts/site.mjs (#4681919616): Added a fail-closed guard in stageReferenceDocs() rejecting any stagingDir equal to or containing rootDir, docsDir, or siteDir, plus unit test coverage in packages/cli/test/docs-and-site.test.ts.
  • scripts/site.mjs (#4681919636): Centralized repoNavLabel and repoNavDescription in site/hugo.toml [params] for both home.llms.txt and verifySite().
  • site/layouts/partials/markdown-content.html (#4681919650): Removed the 44-line duplicate trailing paragraph flush via a sentinel empty line.
  • site/layouts/partials/readme-table-rows.html (#4681919668): Handled escaped pipes (\|) before splitting and added errorf on malformed table data rows.
  • scripts/check-docs.mjs (#4681919605, partial): Aligned getAnchors() heading regex with the blockquote-aware pattern used by sibling checkers; deferred a full 10-function iterator rewrite to keep this PR scoped.
  • docs/references/taskpack-and-contract-schema.md (summary): Added spec.output (formats) to ### Manifest fields and limits (triggers.commentPrefixes with default /loopwright was already documented on line 59).
  • .gitignore (summary): Removed redundant site/resources/references/ line already covered by site/resources/.
  • scripts/site.mjs (summary): Replaced nested ternary in stageReferenceDocs() with if/else, and made resolveHugo() fail loudly when only < 0.153 Hugo binaries are found.
  • site/layouts/partials/link-destination.html (summary): Parameterized siteHost and repoSlug via site/hugo.toml [params].

Intentionally Not Changed — Three-Zone One-Way Link Isolation (4 items)

  • docs/operations/cli.md (#4681919494), docs/operations/coding-agents.md (#4681919512), docs/operations/github-action.md (#4681919525), and docs/operations/github-app.md (summary): Public human site pages are intentionally prevented from linking outward to docs/references/** (enforced by scripts/check-docs.mjs and site/layouts/partials/link-destination.html). Machine consumers and coding agents discover /references/*.md via llms.txt and docs/references/README.md.

Verification

  • npm run lint:docs: Checked 34 docs pages and 44 linked sources; 0 error(s).
  • npm run site: Hugo v0.170.1, Verified 18 HTML pages and 15 Markdown exports; 0 broken link(s) (6 reference file(s)).
  • npm run typecheck && npm run lint: clean
  • node --test --test-concurrency=1 (check-docs-rules.test.js, docs-and-site.test.js, site-gh-pages.test.js): 20/20 passed

Comment thread scripts/site.mjs Resolved
Signed-off-by: thxCode <thxcode0824@gmail.com>
@thxCode

thxCode commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Addressed all 3 incremental review items in 77d5af6:

  • scripts/site.mjs (#4682129753): Added readSiteHugoParams(root) so verifySite() derives the default repoBlobBase from site/hugo.toml repoSlug alongside repoNavLabel and repoNavDescription.
  • scripts/check-docs.mjs (summary): Extracted BQ_HEADING_RE as a shared module constant used by both getAnchors() and checkInterrogatives().
  • site/layouts/partials/link-destination.html (summary): Escaped regex metacharacters in $repoName and $repoSlug before interpolating into exclusion patterns.

Verified with npm run lint:docs, npm run site, npm run lint, and node --test (19/19 passing).

Comment thread scripts/site.mjs Resolved
Signed-off-by: thxCode <thxcode0824@gmail.com>
@thxCode

thxCode commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both incremental review items in 4506b82:

  • scripts/site.mjs (#4682207161): Derived DEFAULT_REPO_BLOB_BASE and repoBlobBaseForRoot(rootDir) from site/hugo.toml repoSlug across stageReferenceDocs(), verifySite(), buildSite(), and serveSite().
  • scripts/site.mjs (summary): Removed the unused siteHost field from readSiteHugoParams().

Verified with npm run lint:docs, npm run site, npm run lint, and node --test (8/8 passing).

@thxCode
thxCode merged commit dedec1d into main Nov 24, 2026
24 of 25 checks passed
@thxCode
thxCode deleted the docs/three-zone-governance branch November 24, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant