From b4f1c1786e7f23b55923f55f9661c640fb11e3f7 Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Mon, 27 Jul 2026 19:03:39 -0700 Subject: [PATCH] docs: trim live.md hot path from 740 to 330 lines First-time setup (config schema, framework table, adapters, drift, the whole CSP flow) moves to reference/live-setup.md, loaded only when the boot reports config_missing/config_invalid or cspChecked is absent. The per-session prose is compressed without dropping any pinned phrase, MUST rule, schema, or example; the boot payload documentation now names the inlined surface brief. All live-reference pins and both prose gates pass. This work was produced with AI assistance (Claude Code). Co-Authored-By: Claude Code --- skill/reference/live-setup.md | 102 ++++++ skill/reference/live.md | 633 ++++++---------------------------- 2 files changed, 212 insertions(+), 523 deletions(-) create mode 100644 skill/reference/live-setup.md diff --git a/skill/reference/live-setup.md b/skill/reference/live-setup.md new file mode 100644 index 000000000..d767c3ee2 --- /dev/null +++ b/skill/reference/live-setup.md @@ -0,0 +1,102 @@ +One-time live-mode project setup. Loaded from [live.md](live.md) only when `live.mjs` reports `config_missing` / `config_invalid`, when `configDrift` needs handling, or when the config lacks `cspChecked`. Not part of the per-session hot path. + +## Write the config + +Create the file at the `path` the boot reported (default `.impeccable/live/config.json`): + +```json +{ + "files": ["", "", ...], + "exclude": ["", ...], + "insertBefore": "", + "commentSyntax": "html", + "cspChecked": true +} +``` + +`files` is the inject target: **the HTML files the browser actually loads**, not necessarily source (tracked vs generated does not matter here; wrap has its own generated-file guard). Entries are literal paths or globs. `exclude` (optional) skips files a `files` glob would otherwise include (email templates, demo fixtures). `cspChecked` records that the CSP step below has run; absent on first setup. + +**Hard-excluded paths (cannot be overridden):** `**/node_modules/**` and `**/.git/**`; injecting there would instrument third-party code. + +**Glob syntax:** `**` matches any number of segments (including zero), `*` matches within a segment, `?` matches one character. Paths are project-root-relative with forward slashes. + +| Framework | `files` | `insertBefore` | `commentSyntax` | +|-----------|---------|----------------|-----------------| +| SPA with single shell (Vite / React / Plain HTML) | `["index.html"]` | `` | `html` | +| Next.js (App Router) | `["app/layout.tsx"]` | `` | `jsx` | +| Next.js (Pages) | `["pages/_document.tsx"]` | `` | `jsx` | +| Nuxt | `["app.vue"]` | `` | `html` | +| Svelte / SvelteKit | `["src/app.html"]` | `` | `html` | +| TanStack Router (SPA, Vite) | `["index.html"]` | `` | `html` | +| TanStack Start (SSR) | `["src/routes/__root.tsx"]` | `"]` | `` | `html` | +| Multi-page (separate HTML per route) | `["public/**/*.html"]` glob over the served dir | `` | `html` | + +Pick an anchor that exists in every file (`` almost always works); `insertAfter` matches after a line instead. For multi-page sites prefer a glob so new pages are picked up automatically. For sites whose pages are rebuilt by a generator, the inject survives only until the next regeneration: re-run `live.mjs` after each build (accept is unaffected; it writes true source via the fallback flow). + +**Framework adapters (auto-detected at inject time).** Every inject records what it wrote in `.impeccable/live/inject-journal.json`; the next inject or remove heals artifacts a crash or wrong-directory stop left behind. SvelteKit, Nuxt, and TanStack Start server-render their document shell, so a raw `