Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .archgate/adrs/GEN-001-documentation-site.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ Starlight is the natural choice for Archgate: it aligns with the Bun-first toolc

## Decision

The documentation site MUST be an Astro 5 / Starlight project in the `docs/` directory. The docs site is a **separate concern** from the CLI codebase — it has its own `package.json`, `tsconfig.json`, `bun.lock`, and build pipeline. It does NOT participate in the CLI's `bun run validate` pipeline. Deployment is handled externally via Cloudflare Pages and is not managed by this repository.
The documentation site MUST be an Astro 5 / Starlight project in the `docs/` directory. The docs site is a **separate concern** from the CLI codebase — it has its own `package.json`, `tsconfig.json`, `bun.lock`, and build pipeline. It does NOT participate in the CLI's `bun run validate` script. Deployment is handled externally via Cloudflare Pages and is not managed by this repository.

**CI gate:** the `Docs Build` job in the Validate workflow runs the Cloudflare Pages build (`bun run build` in `docs/`) whenever a change touches `docs/` or that workflow, and `Validate Code` requires it. CLI-only changes skip it.

**Scope:** the site's structure, tooling, and content organization. NOT the content itself (what to document) — that is editorial, not architectural.

Expand Down Expand Up @@ -65,9 +67,9 @@ Every content page MUST appear both in the file system (`docs/src/content/docs/<

### Don't

- **DON'T** add the docs build to the CLI `validate` pipeline — docs build failures MUST NOT block CLI development or CI
- **DON'T** add the docs build to `bun run validate` — docs failures MUST NOT block CLI-only changes or the offline pre-push hook
- **DON'T** drop `Docs Build` from the `Validate Code` gate, narrow its trigger below `docs/`, or let its commands drift from the Cloudflare Pages build
- **DON'T** share `tsconfig.json` with the CLI project — docs use `astro/tsconfigs/strict`, the CLI its own
- **DON'T** use bare `{}` in MDX content — always escape as `\{\}` for literal curly braces in prose or code fence labels
- **DON'T** add CLI source dependencies (`@commander-js/extra-typings`, `zod`, `@modelcontextprotocol/sdk`, `inquirer`) to `docs/package.json`
- **DON'T** create content files outside `docs/src/content/docs/` — `docsLoader()` expects exactly this directory structure
- **DON'T** use auto-generated content collections — Astro 5 requires an explicit `docs/src/content.config.ts` with `docsLoader()` and `docsSchema()`
Expand Down Expand Up @@ -167,7 +169,7 @@ Code reviewers MUST verify during docs PRs:
3. Curly braces in prose are escaped (`\{\}`) when showing template syntax
4. Reference pages are updated when the corresponding CLI API changes
5. No CLI source dependencies are added to `docs/package.json`
6. The docs build succeeds locally (`bun run docs:build`) before merging
6. The `Docs Build` job in the Validate workflow passed on the pull request

## References

Expand Down
74 changes: 73 additions & 1 deletion .github/workflows/code-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,65 @@ jobs:
echo "Generated winget artifacts:"
ls -la dist/winget

docs-changes:
name: Detect Docs Changes
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
outputs:
docs_changed: ${{ steps.changes.outputs.docs_changed }}
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Check for docs changes
id: changes
env:
# Passed via env, not inlined into the script, to avoid template-injection
# (zizmor: code injection via template expansion).
BASE_REF: ${{ github.base_ref }}
BEFORE: ${{ github.event.before }}
EVENT_NAME: ${{ github.event_name }}
run: |
# This workflow file is included so a change to the docs-build job
# runs the job it changes (GEN-001).
PATHS=(docs/ .github/workflows/code-pull-request.yml)
RANGE=""
if [ "$EVENT_NAME" = "pull_request" ]; then
RANGE="origin/$BASE_REF...HEAD"
elif [ "$EVENT_NAME" = "push" ] && [ -n "$BEFORE" ] && [ "$BEFORE" != "0000000000000000000000000000000000000000" ]; then
RANGE="$BEFORE..HEAD"
fi
# Without a range, or when the diff fails, the docs are built: only a
# successful comparison can establish that no docs changed.
DOCS_CHANGED=true
if [ -n "$RANGE" ] && CHANGED=$(git diff --name-only "$RANGE" -- "${PATHS[@]}"); then
if [ -z "$CHANGED" ]; then DOCS_CHANGED=false; fi
fi
echo "docs_changed=$DOCS_CHANGED" >> "$GITHUB_OUTPUT"

# Builds the docs with the same commands Cloudflare Pages runs, so a change
# that would break the cli.archgate.dev deploy cannot merge (GEN-001).
docs-build:
name: Docs Build
runs-on: ubuntu-latest
timeout-minutes: 10
needs: docs-changes
if: needs.docs-changes.outputs.docs_changed == 'true'
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: $/.github/actions/setup-bun-project
- name: Install docs dependencies
working-directory: docs
run: bun install --frozen-lockfile
- name: Build docs
working-directory: docs
run: bun run build

smoke-windows:
name: Smoke Test (Windows)
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
Expand Down Expand Up @@ -405,6 +464,8 @@ jobs:
validate,
shim-changes,
shim-tests,
docs-changes,
docs-build,
smoke-windows,
smoke-linux,
zizmor,
Expand All @@ -414,13 +475,23 @@ jobs:
]
steps:
- name: Check job results
env:
# Passed via env, not inlined into the script, to avoid template-injection
# (zizmor: code injection via template expansion).
DOCS_BUILD_RESULT: ${{ needs.docs-build.result }}
DOCS_CHANGES_RESULT: ${{ needs.docs-changes.result }}
DOCS_CHANGED: ${{ needs.docs-changes.outputs.docs_changed }}
run: |
# shim-tests is skipped when no shim files changed — treat skipped as success.
SHIM_OK="${{ needs.shim-tests.result }}"
if [[ "$SHIM_OK" == "skipped" ]]; then SHIM_OK="success"; fi
# docs-build is skipped when nothing under docs/ changed. A skip is only
# a pass when docs-changes itself succeeded and found no change.
DOCS_OK="$DOCS_BUILD_RESULT"
if [[ "$DOCS_OK" == "skipped" && "$DOCS_CHANGES_RESULT" == "success" && "$DOCS_CHANGED" == "false" ]]; then DOCS_OK="success"; fi

if [[ "${{ needs.validate.result }}" != "success" ]] || \
[[ "$SHIM_OK" != "success" ]] || \
[[ "$SHIM_OK" != "success" ]] || [[ "$DOCS_OK" != "success" ]] || \
[[ "${{ needs.smoke-windows.result }}" != "success" ]] || \
[[ "${{ needs.smoke-linux.result }}" != "success" ]] || \
[[ "${{ needs.zizmor.result }}" != "success" ]] || \
Expand All @@ -430,6 +501,7 @@ jobs:
echo "::error::One or more jobs failed:"
echo " validate: ${{ needs.validate.result }}"
echo " shim-tests: ${{ needs.shim-tests.result }}"
echo " docs-build: ${{ needs.docs-build.result }}"
echo " smoke-windows: ${{ needs.smoke-windows.result }}"
echo " smoke-linux: ${{ needs.smoke-linux.result }}"
echo " zizmor: ${{ needs.zizmor.result }}"
Expand Down
Loading