docs: trim CLAUDE.md 305->179 lines; extract code descriptions to docs/
CLAUDE.md is loaded into context on every request, so every line has a recurring cost. Applies one rule to decide what earns its place: keep what changes behaviour (rules and gotchas Claude cannot discover before it acts); extract what merely describes code (Claude reads the code anyway, and prose about code silently drifts). The four stale facts fixed in the previous commit were all in the "describes code" class -- active_trip, the Admin2 version, demo-load's scope, the gitignore list. None were rules. That is the argument for moving this material next to what it documents. Extracted (kept as pointers): - entry-map + trip-feed-col parameter contracts (56 lines) -> reference/ architecture.md "Shared partial contracts". CLAUDE.md keeps only the invariants: single map path, must assign window.tripMap/homeMap, keep trip-feed-col single-purpose, initTripStats depends on MapUtils. - Prod override runbook (49 -> 9 lines) -> guides/deploy-cycle.md "The env override tree", incl. the Twig dev/prod table and WEB_HOST. CLAUDE.md keeps the two behavioural rules: never commit prod values, and Admin on the server writes to the env tree (so check both config paths, env wins). - GPX API routes, session auth and the Blob/FormData upload gotcha -> guides/gpx-manager.md "How the manager is wired". - Trip-switch procedure -> guides/trip-switching.md. CLAUDE.md keeps the one rule that matters: never re-add pageconfig.parent to post-form.md. - Also trimmed the dev-command table and custom-plugin table added in the previous commit; both largely restated the Makefile and blueprints. Fixed the guides being pointed into, so the pointers lead to truth: - trip-switching.md instructed editing a pageconfig.parent that no longer exists -- its whole "two files must be updated together" premise was obsolete and would have reintroduced the desync it warned about. - architecture.md: Grav 2.0.4->2.0.7, Admin2 2.0.10->2.0.12, corrected the posting pipeline to show cache-on-save injecting parent before the write, added entry-actions to the custom-plugin list. - japan-korea-2026 -> denmark-2026 across guides/reference (docs/solutions keeps its historical references intact -- those are incident records). Verified: every markdown link resolves, every referenced section heading exists, and each extracted item was confirmed present in its new home. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,52 @@ servers use. See `docs/solutions/tooling-decisions/upgrade-local-grav-core-rebui
|
||||
|
||||
---
|
||||
|
||||
## The env override tree (`user/env/<host>/`)
|
||||
|
||||
Prod needs different Twig settings than dev. These are **never** committed to
|
||||
`user/config/system.yaml` — `twig.cache: false` and `debug`/`auto_reload: true`
|
||||
are the *intended dev values*, and committing prod values there breaks local
|
||||
development for everyone. Instead they ship as a per-environment override via
|
||||
Grav's `environment://config`, keyed on the request hostname.
|
||||
|
||||
| Setting | Dev (committed) | Prod (override) | Why prod differs |
|
||||
|---|---|---|---|
|
||||
| `twig.cache` | `false` | `true` | Compile templates once and reuse |
|
||||
| `twig.debug` | `true` | `false` | No debug functions in prod |
|
||||
| `twig.auto_reload` | `true` | `false` | Don't stat templates every request |
|
||||
|
||||
- **Source of truth:** `deploy/env/prod/system.yaml` (version-controlled).
|
||||
- **Deploy:** `make remote-apply-env-prod` — writes it to
|
||||
`<webroot>/user/env/<hostname>/config/system.yaml` and clears cache. It
|
||||
deep-merges over the committed `system.yaml`.
|
||||
- **Hostname segment** defaults to `REMOTE_HOST`; override with `WEB_HOST` in
|
||||
`.env.<env>` if Grav sees a different host than the SSH host.
|
||||
- **Not restored by anything.** `user/env/` is outside the content repo's tracked
|
||||
folders, so `content-push` / git-sync / `remote-fetch-content` do **not** bring
|
||||
it back. **Re-run `make remote-apply-env-<env>` after any fresh install.**
|
||||
|
||||
### Side effect: Admin writes ALL config into the env tree
|
||||
|
||||
Once `user/env/<hostname>/` exists, Grav's Admin saves **every** config change
|
||||
(system *and* plugin) there — e.g. editing a plugin on prod writes
|
||||
`user/env/intotheeast.com/config/plugins/<name>.yaml`, **not**
|
||||
`user/config/plugins/<name>.yaml`. Consequences:
|
||||
|
||||
- Config edited via **Admin on the server is server-only**: the env tree is not
|
||||
committed and not synced by git-sync (which syncs only `pages`/`config`/
|
||||
`themes`), so prod Admin edits silently never reach Gitea or local. This is
|
||||
*good* for secrets — `git-sync.yaml` (token), the JWT and CSRF salt safely
|
||||
live there — but it means config drift is invisible to the repo.
|
||||
- When reading or writing server config, check **both** `user/config/…` and
|
||||
`user/env/<host>/config/…` (env wins). Server tooling must search the env path
|
||||
first — see `scripts/git-sync-toggle.sh` and `make remote-diag`.
|
||||
- Repo-authored config (`user/config/…` via `make content-push`) still applies
|
||||
everywhere; the env tree holds only per-host overrides + Admin-on-server edits.
|
||||
|
||||
Full details: `docs/working/git-sync-notes.md`.
|
||||
|
||||
---
|
||||
|
||||
## Phase 0 — Local (author + prove the change)
|
||||
|
||||
1. Make the change in the repo:
|
||||
|
||||
Reference in New Issue
Block a user