返回 CodeWhale
README.md
根目录 / web / maintainer / README.md
1 # Web maintainer
2
3 A scheduled GitHub workflow (`.github/workflows/web-maintainer.yml`) that keeps
4 codewhale.net current by opening pull requests. It never pushes to `main`, never
5 deploys and never posts to issues. It is off until the founder enables it.
6
7 ## What runs
8
9 | Lane | Model | May change |
10 | --- | --- | --- |
11 | `derived` | none | Regenerated files only: `web/lib/facts.generated.ts`, `web/data/features.generated.json`, `web/lib/released-capture.generated.ts`, `web/data/latest-published-release.json`, `docs/public-surface-facts.json`, `docs/cloud-facts/stable.json` |
12 | `copy-freshness` | DeepSeek | Stale version, model, provider or command mentions in the explicit file list in `allowlist.txt` (install, getting started, models, tools, plugins, native terminal, runtime and a few English dictionaries) |
13 | `link-health` | DeepSeek | A moved URL in the same listed files, only where a probe saw a permanent redirect |
14 | `docs-drift` | DeepSeek | `web/lib/content/docs-*.ts` and `web/lib/i18n/dictionaries/en/docs-*.ts`, to match `docs/*.md` |
15
16 Each lane has its prompt in `lanes/<lane>.md` and its allowed paths in
17 `allowlist.txt` (the `derived` lane's are in `derived.txt`). Legal, constitution,
18 enterprise, partner, merch, availability, pricing, roadmap and project copy is
19 never editable: the lists are explicit and a deny list repeats it. Translations
20 (zh and the other locales) are not touched; they follow `npm run i18n:gt`.
21
22 ## How it is contained
23
24 - Before the model runs, a fail-closed probe installs bubblewrap and proves that
25 a child process cannot write outside the workspace or open a network
26 connection. If it cannot prove that, the job stops and the model is never
27 started. The model step runs `codewhale exec --auto --sandbox workspace-write`
28 with `deepseek-flash`, a pinned CLI release (install.sh verifies sha256), a
29 checkout with no persisted credentials, and a scrubbed environment holding
30 only `DEEPSEEK_API_KEY`. No GitHub token is present in that step. The
31 provider-side monthly cap on the key is the last backstop, not the first:
32 the runner has no egress filter of its own beyond the sandbox.
33 - After the run the job fails unless every changed path is an in-place edit of
34 an allowlisted file: no untracked or ignored files, no changes to `.git/config`
35 or hooks, and no additions, deletions, renames or mode changes. The allowlist
36 script and prompt are copied before the model runs.
37 - `npm run check` and `vitest` run on the proposal in a fresh checkout with the
38 patch applied and no secrets or token in the environment, so model-edited
39 files never execute where the key or a token is present.
40 - A separate `publish` job holds the GitHub App token (contents and pull
41 requests write), re-applies each patch to current `main`, re-checks the
42 allowlist, and opens or updates one pull request per lane on
43 `web-maintainer/<lane>`. PR bodies list every changed file and the diffstat, never model text.
44 - Files, issues and fetched pages are data in every prompt, not instructions.
45 - One run at a time (`concurrency: web-maintainer`), job timeouts, and a step
46 summary for every lane. The workflow uses no `pull_request_target`.
47
48 ## Enable it
49
50 1. Create a DeepSeek API key used only for this workflow and set a monthly
51 spend cap on the provider side.
52 2. Add it as the repository secret `WEB_MAINTAINER_DEEPSEEK_API_KEY`.
53 3. Set the repository variable `WEB_MAINTAINER_ENABLED` to `true`.
54 4. Run the workflow once by hand (`workflow_dispatch`, lane `derived` first) and
55 read the summary. The model lanes fail with a clear message when the secret
56 is missing.
57
58 `CODEWHALE_APP_ID` and `CODEWHALE_APP_PRIVATE_KEY` are the same App credentials
59 the catalog refresh uses.
60
61 ## Stop it
62
63 Unset `WEB_MAINTAINER_ENABLED` (or set it to anything but `true`). Every job is
64 skipped and nothing spends. To stop the spend itself, revoke the key or lower
65 its cap at the provider.
66
67 ## Known limits
68
69 - Only the English dictionaries are edited; locale copy lags until translated.
70 - The link probe reads only the content and English dictionary files.
71 - A proposal is as good as the checks; a person reviews every pull request.
72
72 lines MARKDOWN