Skip to content

Commit b565746

Browse files
authored
feat: driga.dev site with generated reference and real footage (#57)
A Starlight site for driga.dev, built from the code where it can be: - cmd/driga-docgen writes the CLI, settings, MCP tools and hooks reference pages from the parser, the settings table, the MCP server and dry-run hook installers; `just docs-check` and the docgen tests fail on a stale page. - llms.txt, llms-full.txt and a Markdown alternate of every page, including the landing page's headings, commands and install line. - Catppuccin Mocha and Latte as in the app, Geist and Geist Mono, one heading scale and focus ring, state colours at 4.5:1 or better. The landing page leads with real-time screen recordings of the shipped binary: the terminal from typing `driga` to an allowed permission prompt, then the same prompt allowed in the browser, then the install command, with a Terminal · Browser · Install chapter bar. Feature sections play tight crops of the same takes, light or dark with the site theme; phones get the Needs-you crop in the hero. - cmd/driga-demo plays scripted sessions into a private temporary data directory: it holds the collector lock, writes the store and runs the real prompt broker, so `driga` and `driga web` read it as a live collector. It never reads the process table, agent files or Git. - site/footage records the TUI with VHS and `driga web` with Playwright (a drawn pointer, both themes), refusing to film unless the viewer reads the demo, and cuts the films with Remotion from film/cut.json. - Videos live in the R2 bucket driga-assets under content-hashed keys, served from assets.driga.dev and listed in src/data/media.json; posters are committed. `just site-footage` re-records, `just site-footage-publish` uploads. Docs follow #58 (one-time macOS notification prompt) and #59 (bare `driga` opens the viewer; no activity, conflicts or --watch). Deployed to Cloudflare Pages by .github/workflows/site.yml. Claude-Session: https://claude.ai/code/session_01T2vtcW6ihn1ywy9vxUq9a4
1 parent dcae568 commit b565746

94 files changed

Lines changed: 20601 additions & 6 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/site.yml‎

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Publishing the documentation site at https://driga.dev.
2+
#
3+
# The reference under site/src/content/docs/reference is generated from the
4+
# code by cmd/driga-docgen and committed, and `just check` fails a change that
5+
# edits the code without regenerating. Publication deploys from main, where the
6+
# documentation and the code it describes agree.
7+
name: Site
8+
9+
on:
10+
push:
11+
branches: [main]
12+
# Every source the generator reads is listed: the command tree in
13+
# internal/cli, settings in internal/config, MCP tools in internal/mcp and
14+
# internal/chat, hook installers in internal/hooks, and the TUI golden
15+
# frames the site renders from internal/tui/testdata.
16+
paths:
17+
- "site/**"
18+
- "cmd/driga-docgen/**"
19+
- "internal/cli/**"
20+
- "internal/config/**"
21+
- "internal/mcp/**"
22+
- "internal/chat/**"
23+
- "internal/hooks/**"
24+
- "internal/tui/testdata/**"
25+
- "internal/web/static/brand/**"
26+
- "go.mod"
27+
- "go.sum"
28+
- ".github/workflows/site.yml"
29+
workflow_dispatch:
30+
31+
permissions:
32+
contents: read
33+
34+
concurrency:
35+
# One publication at a time; a newer build supersedes an older one.
36+
group: site
37+
cancel-in-progress: true
38+
39+
jobs:
40+
publish:
41+
runs-on: ubuntu-24.04
42+
steps:
43+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
44+
with:
45+
persist-credentials: false
46+
47+
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
48+
with:
49+
go-version-file: go.mod
50+
cache: true
51+
52+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
53+
with:
54+
node-version: 24.19.0
55+
cache: npm
56+
cache-dependency-path: site/package-lock.json
57+
58+
# Publishing a reference that is behind the code would document flags
59+
# and settings the binary no longer accepts.
60+
- name: Refuse a reference that is behind the code
61+
env:
62+
CGO_ENABLED: "0"
63+
run: go run ./cmd/driga-docgen --check
64+
65+
- name: Install dependencies
66+
working-directory: site
67+
run: npm ci
68+
69+
# astro check, the build, and the table, social-card, canonical and link
70+
# checks.
71+
- name: Build
72+
working-directory: site
73+
env:
74+
SITE_URL: https://driga.dev
75+
# A GA4 measurement id is public in the delivered page, so this is a
76+
# repository variable rather than a secret. When absent, the build
77+
# emits no analytics script or request.
78+
PUBLIC_GA_MEASUREMENT_ID: ${{ vars.PUBLIC_GA_MEASUREMENT_ID }}
79+
run: npm run build
80+
81+
# main is the production branch of the Cloudflare Pages project.
82+
- name: Publish
83+
working-directory: site
84+
env:
85+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
86+
CLOUDFLARE_ACCOUNT_ID: e6379d37f788129207ab5f566abfb4ff
87+
run: |
88+
npx --yes wrangler@4.123.0 pages deploy dist \
89+
--project-name driga \
90+
--branch main \
91+
--commit-hash "${GITHUB_SHA}"

‎Justfile‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ clean:
3434
# ---------- Verification ----------
3535

3636
# Local pre-commit gate.
37-
check: _fmt-check tidy-check vet generate-check test
37+
check: _fmt-check tidy-check vet generate-check docs-check test
3838
@echo "All checks passed"
3939

4040
# Adds race, vulnerability, workflow and release-snapshot checks.
@@ -76,6 +76,37 @@ generate-check:
7676
go generate ./internal/config
7777
git diff --exit-code -- .env.example
7878

79+
# Rewrite the generated reference pages under site/ from the code.
80+
docs:
81+
go run ./cmd/driga-docgen
82+
83+
# Fail when a committed reference page is behind the code it documents.
84+
docs-check:
85+
go run ./cmd/driga-docgen --check
86+
87+
# ---------- Documentation site ----------
88+
89+
# Install the site's dependencies from the lockfile.
90+
site-deps:
91+
cd site && npm ci --no-audit --no-fund
92+
93+
# Serve the site locally with live reload on http://localhost:7431.
94+
site: docs site-deps
95+
cd site && npm run dev
96+
97+
# Re-record site footage of the real TUI and web on demo data (needs vhs, ffmpeg).
98+
site-footage:
99+
site/footage/record.sh
100+
101+
# Publish the rendered footage to R2 (assets.driga.dev) and update the manifest.
102+
site-footage-publish:
103+
cd site/footage && node upload.mjs
104+
105+
# Build the site into site/dist: astro check, build, then the output checks.
106+
# Depends on the checking recipe, not the writing one, so it cannot hide a stale page.
107+
site-build: docs-check site-deps
108+
cd site && npm run build
109+
79110
# Run tests with a disposable home and Driga data (scripts/isolated.sh).
80111
test *args:
81112
scripts/isolated.sh go test {{ args }} ./...

0 commit comments

Comments
 (0)