From 878f766e842184a95007dd46addfe975eb7154a2 Mon Sep 17 00:00:00 2001 From: Simon Prosen <38320875+simpros@users.noreply.github.com> Date: Thu, 29 Oct 2026 15:47:30 +0100 Subject: [PATCH 01/11] chore: slim agent docs and ADRs Fold docs/agents into AGENTS.md and a new CODE-STYLE.md, cut ADRs from 13 to 8 renumbered, drop the setup-matt-pocock-skills skill. --- .../skills/setup-matt-pocock-skills/SKILL.md | 116 ------------------ .../agents/openai.yaml | 5 - .../skills/setup-matt-pocock-skills/domain.md | 51 -------- .../issue-tracker-github.md | 45 ------- .../issue-tracker-gitlab.md | 46 ------- .../issue-tracker-local.md | 30 ----- .../setup-matt-pocock-skills/triage-labels.md | 15 --- AGENTS.md | 51 +------- CODE-STYLE.md | 19 +++ CONTEXT.md | 1 - apps/cli/src/worktree-db/env-file.test.ts | 2 +- ...> 0003-ci-driven-lifecycle-no-webhooks.md} | 0 ...ens.md => 0004-self-made-bearer-tokens.md} | 0 ...er-image.md => 0005-seed-as-user-image.md} | 0 docs/adr/0006-sprout-durable-identity.md | 17 +-- docs/adr/0007-preview-db-providers.md | 16 +++ docs/adr/0007-preview-env-injection-names.md | 34 ----- docs/adr/0008-preview-access-gate.md | 15 +++ docs/adr/0008-preview-db-providers.md | 66 ---------- docs/adr/0009-preview-db-provider-none.md | 55 --------- docs/adr/0010-preview-label-ownership.md | 23 ---- docs/adr/0011-agent-first-docs.md | 44 ------- docs/adr/0012-preview-db-roles-opt-in.md | 76 ------------ docs/adr/0013-preview-access-gate.md | 37 ------ docs/adr/README.md | 21 ---- docs/agents/comment-style.md | 29 ----- docs/agents/domain.md | 51 -------- docs/agents/issue-tracker.md | 45 ------- docs/agents/pull-requests.md | 51 -------- docs/agents/triage-labels.md | 15 --- skills-lock.json | 6 - 31 files changed, 63 insertions(+), 919 deletions(-) delete mode 100644 .agents/skills/setup-matt-pocock-skills/SKILL.md delete mode 100644 .agents/skills/setup-matt-pocock-skills/agents/openai.yaml delete mode 100644 .agents/skills/setup-matt-pocock-skills/domain.md delete mode 100644 .agents/skills/setup-matt-pocock-skills/issue-tracker-github.md delete mode 100644 .agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md delete mode 100644 .agents/skills/setup-matt-pocock-skills/issue-tracker-local.md delete mode 100644 .agents/skills/setup-matt-pocock-skills/triage-labels.md create mode 100644 CODE-STYLE.md rename docs/adr/{0004-ci-driven-lifecycle-no-webhooks.md => 0003-ci-driven-lifecycle-no-webhooks.md} (100%) rename docs/adr/{0005-self-made-bearer-tokens.md => 0004-self-made-bearer-tokens.md} (100%) rename docs/adr/{0003-seed-as-user-image.md => 0005-seed-as-user-image.md} (100%) create mode 100644 docs/adr/0007-preview-db-providers.md delete mode 100644 docs/adr/0007-preview-env-injection-names.md create mode 100644 docs/adr/0008-preview-access-gate.md delete mode 100644 docs/adr/0008-preview-db-providers.md delete mode 100644 docs/adr/0009-preview-db-provider-none.md delete mode 100644 docs/adr/0010-preview-label-ownership.md delete mode 100644 docs/adr/0011-agent-first-docs.md delete mode 100644 docs/adr/0012-preview-db-roles-opt-in.md delete mode 100644 docs/adr/0013-preview-access-gate.md delete mode 100644 docs/adr/README.md delete mode 100644 docs/agents/comment-style.md delete mode 100644 docs/agents/domain.md delete mode 100644 docs/agents/issue-tracker.md delete mode 100644 docs/agents/pull-requests.md delete mode 100644 docs/agents/triage-labels.md diff --git a/.agents/skills/setup-matt-pocock-skills/SKILL.md b/.agents/skills/setup-matt-pocock-skills/SKILL.md deleted file mode 100644 index 7f6f576e..00000000 --- a/.agents/skills/setup-matt-pocock-skills/SKILL.md +++ /dev/null @@ -1,116 +0,0 @@ ---- -name: setup-matt-pocock-skills -description: "Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills." -disable-model-invocation: true ---- - -# Setup Matt Pocock's Skills - -Scaffold the per-repo configuration that the engineering skills assume: - -- **Issue tracker**: where issues live (GitHub by default; local markdown is also supported out of the box) -- **Triage labels**: the strings used for the five canonical triage roles -- **Domain docs**: where `CONTEXT.md` and ADRs live, and the consumer rules for reading them - -This is a prompt-driven skill, not a deterministic script. Explore, present what you found, confirm with the user, then write. - -## Process - -### 1. Explore - -Look at the current repo to understand its starting state. Read whatever exists; don't assume: - -- `git remote -v` and `.git/config`: is this a GitHub repo? Which one? -- `AGENTS.md` and `CLAUDE.md` at the repo root: does either exist? Is there already an `## Agent skills` section in either? -- `CONTEXT.md` and `CONTEXT-MAP.md` at the repo root -- `docs/adr/` and any `src/*/docs/adr/` directories -- `docs/agents/`: does this skill's prior output already exist? -- `.scratch/`: a sign that a local-markdown issue tracker convention is already in use -- Is the `triage` skill installed? (a `triage` skill folder alongside this one, or `triage` in your available skills.) This decides whether Section B runs at all. -- Monorepo signals: a `pnpm-workspace.yaml`, a `workspaces` field in `package.json`, or a populated `packages/*` with its own `src/`. These are present only in a genuinely large multi-package repo; their absence means single-context, which is almost every repo. - -### 2. Present findings and ask - -Summarise what's present and what's missing. Then take the sections in order. One section, one answer, then the next. - -Lead each section with the recommended answer so the user can accept it in a word. Give a one-line explainer only when the choice genuinely branches; skip the section entirely when exploration already settled it (Section B when `triage` isn't installed, Section C when there's no monorepo). - -**Section A: Issue tracker.** - -> Explainer: The "issue tracker" is where issues live for this repo. Skills like `to-tickets`, `triage`, and `to-spec` read from and write to it. They need to know whether to call `gh issue create`, write a markdown file under `.scratch/`, or follow some other workflow you describe. Pick the place you actually track work for this repo. - -Default posture: these skills were designed for GitHub. If a `git remote` points at GitHub, propose that. If a `git remote` points at GitLab (`gitlab.com` or a self-hosted host), propose GitLab. Otherwise (or if the user prefers), offer: - -- **GitHub**: issues live in the repo's GitHub Issues (uses the `gh` CLI) -- **GitLab**: issues live in the repo's GitLab Issues (uses the [`glab`](https://gitlab.com/gitlab-org/cli) CLI) -- **Local markdown**: issues live as files under `.scratch//` in this repo (good for solo projects or repos without a remote) -- **Other** (Jira, Linear, etc.): ask the user to describe the workflow in one paragraph; the skill will record it as freeform prose - -Record the choice in `docs/agents/issue-tracker.md`. The GitHub and GitLab templates carry a "PRs as a request surface" flag, defaulted **off**. Leave it off and don't raise it: a user who wants external PRs in the triage queue can flip the flag in the file later. - -**Section B: Triage label vocabulary.** Skip this section entirely if the `triage` skill isn't installed (exploration told you), since an uninstalled skill needs no labels. - -If it is installed, ask exactly one question: - -> Do you want to keep the default triage labels? (recommended: **yes**) - -The defaults are the five canonical roles, each label string equal to its name: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`. On **yes**, write them as-is. Only if the user says no, usually because their tracker already uses other names (e.g. `bug:triage` for `needs-triage`), collect the overrides so `triage` applies existing labels instead of creating duplicates. - -**Section C: Domain docs.** Default to **single-context** (one `CONTEXT.md` + `docs/adr/` at the repo root). This fits almost every repo; write it without asking. - -Offer **multi-context** (a root `CONTEXT-MAP.md` pointing to per-context `CONTEXT.md` files) only when exploration found monorepo signals. Then confirm which layout they want. - -### 3. Confirm and edit - -Show the user a draft of: - -- The `## Agent skills` block to add to whichever of `CLAUDE.md` / `AGENTS.md` is being edited (see step 4 for selection rules) -- The contents of `docs/agents/issue-tracker.md`, `docs/agents/domain.md`, and `docs/agents/triage-labels.md` (the last only when `triage` is installed) - -Let them edit before writing. - -### 4. Write - -**Pick the file to edit:** - -- If `CLAUDE.md` exists, edit it. -- Else if `AGENTS.md` exists, edit it. -- If neither exists, ask the user which one to create; don't pick for them. - -Never create `AGENTS.md` when `CLAUDE.md` already exists (or vice versa); always edit the one that's already there. - -If an `## Agent skills` block already exists in the chosen file, update its contents in-place rather than appending a duplicate. Don't overwrite user edits to the surrounding sections. - -The block: - -```markdown -## Agent skills - -### Issue tracker - -[one-line summary of where issues are tracked]. See `docs/agents/issue-tracker.md`. - -### Triage labels - -[one-line summary of the label vocabulary]. See `docs/agents/triage-labels.md`. - -### Domain docs - -[one-line summary of layout: "single-context" or "multi-context"]. See `docs/agents/domain.md`. -``` - -Include the `### Triage labels` sub-block, and write `docs/agents/triage-labels.md`, only when `triage` is installed and Section B ran. When it isn't, both are omitted. - -Then write the docs files using the seed templates in this skill folder as a starting point: - -- [issue-tracker-github.md](./issue-tracker-github.md): GitHub issue tracker -- [issue-tracker-gitlab.md](./issue-tracker-gitlab.md): GitLab issue tracker -- [issue-tracker-local.md](./issue-tracker-local.md): local-markdown issue tracker -- [triage-labels.md](./triage-labels.md): label mapping (only if `triage` is installed) -- [domain.md](./domain.md): domain doc consumer rules + layout - -For "other" issue trackers, write `docs/agents/issue-tracker.md` from scratch using the user's description. - -### 5. Done - -Tell the user the setup is complete and which engineering skills will now read from these files. Mention they can edit `docs/agents/*.md` directly later; re-running this skill is only necessary if they want to switch issue trackers or restart from scratch. diff --git a/.agents/skills/setup-matt-pocock-skills/agents/openai.yaml b/.agents/skills/setup-matt-pocock-skills/agents/openai.yaml deleted file mode 100644 index 65a0da81..00000000 --- a/.agents/skills/setup-matt-pocock-skills/agents/openai.yaml +++ /dev/null @@ -1,5 +0,0 @@ -interface: - display_name: "Setup Matt Pocock Skills" - short_description: "Configure a repo for the skills" -policy: - allow_implicit_invocation: false diff --git a/.agents/skills/setup-matt-pocock-skills/domain.md b/.agents/skills/setup-matt-pocock-skills/domain.md deleted file mode 100644 index 35249041..00000000 --- a/.agents/skills/setup-matt-pocock-skills/domain.md +++ /dev/null @@ -1,51 +0,0 @@ -# Domain Docs - -How the engineering skills should consume this repo's domain documentation when exploring the codebase. - -## Before exploring, read these - -- **`CONTEXT.md`** at the repo root, or -- **`CONTEXT-MAP.md`** at the repo root if it exists: it points at one `CONTEXT.md` per context. Read each one relevant to the topic. -- **`docs/adr/`**: read ADRs that touch the area you're about to work in. In multi-context repos, also check `src//docs/adr/` for context-scoped decisions. - -If any of these files don't exist, **proceed silently**. Don't flag their absence; don't suggest creating them upfront. The `/domain-modeling` skill (reached via `/grill-with-docs` and `/improve-codebase-architecture`) creates them lazily when terms or decisions actually get resolved. - -## File structure - -Single-context repo (most repos): - -``` -/ -├── CONTEXT.md -├── docs/adr/ -│ ├── 0001-event-sourced-orders.md -│ └── 0002-postgres-for-write-model.md -└── src/ -``` - -Multi-context repo (presence of `CONTEXT-MAP.md` at the root): - -``` -/ -├── CONTEXT-MAP.md -├── docs/adr/ ← system-wide decisions -└── src/ - ├── ordering/ - │ ├── CONTEXT.md - │ └── docs/adr/ ← context-specific decisions - └── billing/ - ├── CONTEXT.md - └── docs/adr/ -``` - -## Use the glossary's vocabulary - -When your output names a domain concept (in an issue title, a refactor proposal, a hypothesis, a test name), use the term as defined in `CONTEXT.md`. Don't drift to synonyms the glossary explicitly avoids. - -If the concept you need isn't in the glossary yet, that's a signal: either you're inventing language the project doesn't use (reconsider) or there's a real gap (note it for `/domain-modeling`). - -## Flag ADR conflicts - -If your output contradicts an existing ADR, surface it explicitly rather than silently overriding: - -> _Contradicts ADR-0007 (event-sourced orders), but worth reopening because…_ diff --git a/.agents/skills/setup-matt-pocock-skills/issue-tracker-github.md b/.agents/skills/setup-matt-pocock-skills/issue-tracker-github.md deleted file mode 100644 index b258aeb3..00000000 --- a/.agents/skills/setup-matt-pocock-skills/issue-tracker-github.md +++ /dev/null @@ -1,45 +0,0 @@ -# Issue tracker: GitHub - -Issues and specs for this repo live as GitHub issues. Use the `gh` CLI for all operations. - -## Conventions - -- **Create an issue**: `gh issue create --title "..." --body "..."`. Use a heredoc for multi-line bodies. -- **Read an issue**: `gh issue view --comments`, filtering comments by `jq` and also fetching labels. -- **List issues**: `gh issue list --state open --json number,title,body,labels,comments --jq '[.[] | {number, title, body, labels: [.labels[].name], comments: [.comments[].body]}]'` with appropriate `--label` and `--state` filters. -- **Comment on an issue**: `gh issue comment --body "..."` -- **Apply / remove labels**: `gh issue edit --add-label "..."` / `--remove-label "..."` -- **Close**: `gh issue close --comment "..."` - -Infer the repo from `git remote -v`; `gh` does this automatically when run inside a clone. - -## Pull requests as a triage surface - -**PRs as a request surface: no.** _(Set to `yes` if this repo treats external PRs as feature requests; `/triage` reads this flag.)_ - -When set to `yes`, PRs run through the same labels and states as issues, using the `gh pr` equivalents: - -- **Read a PR**: `gh pr view --comments` and `gh pr diff ` for the diff. -- **List external PRs for triage**: `gh pr list --state open --json number,title,body,labels,author,authorAssociation,comments` then keep only `authorAssociation` of `CONTRIBUTOR`, `FIRST_TIME_CONTRIBUTOR`, or `NONE` (drop `OWNER`/`MEMBER`/`COLLABORATOR`). -- **Comment / label / close**: `gh pr comment`, `gh pr edit --add-label`/`--remove-label`, `gh pr close`. - -GitHub shares one number space across issues and PRs, so a bare `#42` may be either: resolve with `gh pr view 42` and fall back to `gh issue view 42`. - -## When a skill says "publish to the issue tracker" - -Create a GitHub issue. - -## When a skill says "fetch the relevant ticket" - -Run `gh issue view --comments`. - -## Wayfinding operations - -Used by `/wayfinder`. The **map** is a single issue with **child** issues as tickets. - -- **Map**: a single issue labelled `wayfinder:map`, holding the Notes / Decisions-so-far / Fog body. `gh issue create --label wayfinder:map`. -- **Child ticket**: an issue linked to the map as a GitHub sub-issue (`gh api` on the sub-issues endpoint). Where sub-issues aren't enabled, add the child to a task list in the map body and put `Part of #` at the top of the child body. Labels: `wayfinder:` (`research`/`prototype`/`grilling`/`task`). Once claimed, the ticket is assigned to the driving dev. -- **Blocking**: GitHub's **native issue dependencies**, the canonical, UI-visible representation. Add an edge with `gh api --method POST repos///issues//dependencies/blocked_by -F issue_id=`, where `` is the blocker's numeric **database id** (`gh api repos///issues/ --jq .id`, _not_ the `#number` or `node_id`). GitHub reports `issue_dependencies_summary.blocked_by` (open blockers only, the live gate). Where dependencies aren't available, fall back to a `Blocked by: #, #` line at the top of the child body. A ticket is unblocked when every blocker is closed. -- **Frontier query**: list the map's open children (`gh issue list --state open`, scoped to the map's sub-issues / task list), drop any with an open blocker (`issue_dependencies_summary.blocked_by > 0`, or an open issue in the `Blocked by` line) or an assignee; first in map order wins. -- **Claim**: `gh issue edit --add-assignee @me`, the session's first write. -- **Resolve**: `gh issue comment --body ""`, then `gh issue close `, then append a context pointer (gist + link) to the map's Decisions-so-far. diff --git a/.agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md b/.agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md deleted file mode 100644 index 251035a6..00000000 --- a/.agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +++ /dev/null @@ -1,46 +0,0 @@ -# Issue tracker: GitLab - -Issues and specs for this repo live as GitLab issues. Use the [`glab`](https://gitlab.com/gitlab-org/cli) CLI for all operations. - -## Conventions - -- **Create an issue**: `glab issue create --title "..." --description "..."`. Use a heredoc for multi-line descriptions. Pass `--description -` to open an editor. -- **Read an issue**: `glab issue view --comments`. Use `-F json` for machine-readable output. -- **List issues**: `glab issue list -F json` with appropriate `--label` filters. -- **Comment on an issue**: `glab issue note --message "..."`. GitLab calls comments "notes". -- **Apply / remove labels**: `glab issue update --label "..."` / `--unlabel "..."`. Multiple labels can be comma-separated or by repeating the flag. -- **Close**: `glab issue close `. `glab issue close` does not accept a closing comment, so post the explanation first with `glab issue note --message "..."`, then close. -- **Merge requests**: GitLab calls PRs "merge requests". Use `glab mr create`, `glab mr view`, `glab mr note`, etc., the same shape as `gh pr ...` with `mr` in place of `pr` and `note`/`--message` in place of `comment`/`--body`. - -Infer the repo from `git remote -v`; `glab` does this automatically when run inside a clone. - -## Merge requests as a triage surface - -**MRs as a request surface: no.** _(Set to `yes` if this repo treats external merge requests as feature requests; `/triage` reads this flag.)_ - -When set to `yes`, MRs run through the same labels and states as issues, using the `glab mr` equivalents: - -- **Read an MR**: `glab mr view --comments` and `glab mr diff ` for the diff. -- **List external MRs for triage**: `glab mr list -F json`, then keep only MRs whose author is not a project member/owner (a contributor's MR, not a maintainer's in-flight work). -- **Comment / label / close**: `glab mr note`, `glab mr update --label`/`--unlabel`, `glab mr close`. - -Unlike GitHub, GitLab numbers issues and MRs separately, so `#42` is unambiguous once you know which surface the maintainer means. - -## When a skill says "publish to the issue tracker" - -Create a GitLab issue. - -## When a skill says "fetch the relevant ticket" - -Run `glab issue view --comments`. - -## Wayfinding operations - -Used by `/wayfinder`. The **map** is a single issue with **child** issues as tickets. - -- **Map**: a single issue labelled `wayfinder:map`, holding the Notes / Decisions-so-far / Fog body. `glab issue create --label wayfinder:map`. (On GitLab tiers with native epics, an epic may hold the map instead; a labelled issue works everywhere.) -- **Child ticket**: an issue carrying `Part of #` at the top of its description and labels `wayfinder:` (`research`/`prototype`/`grilling`/`task`). Once claimed, the ticket is assigned to the driving dev. -- **Blocking**: GitLab's **native blocking link**, the canonical, UI-visible representation. Add it with the `/blocked_by #` quick action, posted as a note (`glab issue note --message "/blocked_by #"`). Native blocking links are a Premium/Ultimate feature; on the free tier (or where unavailable) fall back to a `Blocked by: #, #` line at the top of the description. A ticket is unblocked when every blocker is closed. -- **Frontier query**: `glab issue list -F json` scoped to the map's children, drop any with an open blocker: a native `blocked_by` link to an open issue (`glab api projects/:id/issues/:iid/links`), or an open issue in the `Blocked by` line, or an assignee; first in map order wins. -- **Claim**: `glab issue update --assignee @me`, the session's first write. -- **Resolve**: `glab issue note --message ""`, then `glab issue close `, then append a context pointer (gist + link) to the map's Decisions-so-far. diff --git a/.agents/skills/setup-matt-pocock-skills/issue-tracker-local.md b/.agents/skills/setup-matt-pocock-skills/issue-tracker-local.md deleted file mode 100644 index 0209a19a..00000000 --- a/.agents/skills/setup-matt-pocock-skills/issue-tracker-local.md +++ /dev/null @@ -1,30 +0,0 @@ -# Issue tracker: Local Markdown - -Issues and specs for this repo live as markdown files in `.scratch/`. - -## Conventions - -- One feature per directory: `.scratch//` -- The spec is `.scratch//spec.md` -- Implementation issues are one file per ticket at `.scratch//issues/-.md`, numbered from `01`, never a single combined tickets file -- Triage state is recorded as a `Status:` line near the top of each issue file (see `triage-labels.md` for the role strings) -- Comments and conversation history append to the bottom of the file under a `## Comments` heading - -## When a skill says "publish to the issue tracker" - -Create a new file under `.scratch//` (creating the directory if needed). - -## When a skill says "fetch the relevant ticket" - -Read the file at the referenced path. The user will normally pass the path or the issue number directly. - -## Wayfinding operations - -Used by `/wayfinder`. The **map** is a file with one **child** file per ticket. - -- **Map**: `.scratch//map.md` (the Notes / Decisions-so-far / Fog body). -- **Child ticket**: `.scratch//issues/NN-.md`, numbered from `01`, with the question in the body. A `Type:` line records the ticket type (`research`/`prototype`/`grilling`/`task`); a `Status:` line records `claimed`/`resolved`. -- **Blocking**: a `Blocked by: NN, NN` line near the top. A ticket is unblocked when every file it lists is `resolved`. -- **Frontier**: scan `.scratch//issues/` for files that are open, unblocked, and unclaimed; first by number wins. -- **Claim**: set `Status: claimed` and save before any work. -- **Resolve**: append the answer under an `## Answer` heading, set `Status: resolved`, then append a context pointer (gist + link) to the map's Decisions-so-far in `map.md`. diff --git a/.agents/skills/setup-matt-pocock-skills/triage-labels.md b/.agents/skills/setup-matt-pocock-skills/triage-labels.md deleted file mode 100644 index b716855d..00000000 --- a/.agents/skills/setup-matt-pocock-skills/triage-labels.md +++ /dev/null @@ -1,15 +0,0 @@ -# Triage Labels - -The skills speak in terms of five canonical triage roles. This file maps those roles to the actual label strings used in this repo's issue tracker. - -| Label in mattpocock/skills | Label in our tracker | Meaning | -| -------------------------- | -------------------- | ---------------------------------------- | -| `needs-triage` | `needs-triage` | Maintainer needs to evaluate this issue | -| `needs-info` | `needs-info` | Waiting on reporter for more information | -| `ready-for-agent` | `ready-for-agent` | Fully specified, ready for an AFK agent | -| `ready-for-human` | `ready-for-human` | Requires human implementation | -| `wontfix` | `wontfix` | Will not be actioned | - -When a skill mentions a role (e.g. "apply the AFK-ready triage label"), use the corresponding label string from this table. - -Edit the right-hand column to match whatever vocabulary you actually use. diff --git a/AGENTS.md b/AGENTS.md index d2cd3587..ae0c704e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -31,50 +31,11 @@ bun run db:migrate # runtime migrator (apps/server; same as boot) - `apps/cli` — `sprout` CLI (uses api-client) - `packages/api-client` — typed Eden client against `@sprout/server/api-type` - `packages/preview-db` — shared Postgres catalog DDL (ensure-role, worktree provision/drop) -- `packages/preview-env` — preview wire grammar: PG* env remap (ADR-0007), hostname templates, health request-shape +- `packages/preview-env` — preview wire grammar: PG* env remap, hostname templates, health request-shape -## Style +## Conventions -- Plain functions, no classes. -- Periodic work uses `Bun.cron`, never `setTimeout`/`setInterval`. -- Keep modules small and focused. -- Fail fast at config load for required env vars. -- DB schema lives in `apps/server/src/infrastructure/db/`; migrations in `apps/server/drizzle/`. - -## Comment style - -Comments state the why only — never tickets, history, or restatements. -See `docs/agents/comment-style.md`. - -## Agent skills - -### Issue tracker - -Issues are tracked as GitHub issues on `simpros/sprout`, via the `gh` CLI. See `docs/agents/issue-tracker.md`. - -### Triage labels - -Default label vocabulary (`needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`). See `docs/agents/triage-labels.md`. - -### Domain docs - -Single-context: one `CONTEXT.md` + `docs/adr/` at the repo root. See `docs/agents/domain.md`. - -### Pull requests - -Open and describe every PR with the `visual-pr` skill vendored in this repo at -`.agents/skills/visual-pr/` — Why in one sentence, 1-3 special notes, and a -structural Change outline. Its frontmatter says explicit-invoke-only; that -default is overridden here: use it for every PR body. See -`docs/agents/pull-requests.md` for the publishing steps and the show-me-comment -rule. - -### Vendored skills - -- `documentation-writer` (`.agents/skills/documentation-writer/`) — every docs or - prose task: Diátaxis page types (tutorial / how-to / reference / explanation) and - its clarify → outline → write workflow. -- `emil-design-eng` (`.agents/skills/emil-design-eng/`) — building or reviewing UI: - animation decisions, easing and duration, component feel, motion performance, a11y. -- `review-animations` (`.agents/skills/review-animations/`) — reviewing animation and - motion code against the craft bar; it defaults to flagging. +- Code and comment style: `CODE-STYLE.md`. +- Domain vocabulary: `CONTEXT.md`. Decisions: `docs/adr/` (only hard-to-reverse, hard-to-understand ones). +- Issues: GitHub issues on `simpros/sprout` via `gh`. Labels: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`. +- PRs: always describe with the `visual-pr` skill (`.agents/skills/visual-pr/`), even though it is explicit-invoke by default. `show-me` goes in a comment, never the body. diff --git a/CODE-STYLE.md b/CODE-STYLE.md new file mode 100644 index 00000000..88a12929 --- /dev/null +++ b/CODE-STYLE.md @@ -0,0 +1,19 @@ +# Code style + +- Plain functions, no classes. +- Periodic work uses `Bun.cron`, never `setTimeout`/`setInterval`. +- Keep modules small and focused. +- Fail fast at config load for required env vars. +- DB schema lives in `apps/server/src/infrastructure/db/`; migrations in `apps/server/drizzle/`. + +## Comments + +State the why only, and only when the code cannot say it. + +- No restating code, signatures or types. +- No tickets, PRs, review feedback or people. No history ("previously", "now uses"). +- No commented-out code. No "hack" / "for now" / emoji. +- Keep real whys: invariants, ordering/locking, observed external behaviour, + security tradeoffs, magic constants. +- One line, not a paragraph. A paragraph is a decision: put it in `CONTEXT.md` or an ADR. +- A comment that contradicts the code is a bug; fix one of them. diff --git a/CONTEXT.md b/CONTEXT.md index eea634bd..1710ce70 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -125,4 +125,3 @@ _Avoid_: Root token, master key ## See also - The normative v0.1 specification (tracked in the GitHub issue tracker) -- `docs/agents/` — how agents consume this documentation diff --git a/apps/cli/src/worktree-db/env-file.test.ts b/apps/cli/src/worktree-db/env-file.test.ts index 6e136f2e..faa7e130 100644 --- a/apps/cli/src/worktree-db/env-file.test.ts +++ b/apps/cli/src/worktree-db/env-file.test.ts @@ -70,7 +70,7 @@ describe("parseEnvRenames", () => { expect(parseEnvRenames(["databaseUrl=X"]).ok).toBe(false); }); - test("rejects target collisions (ADR-0007)", () => { + test("rejects target collisions", () => { const result = parseEnvRenames(["PGHOST=FOO", "PGUSER=FOO"]); expect(result.ok).toBe(false); if (result.ok) throw new Error("expected failure"); diff --git a/docs/adr/0004-ci-driven-lifecycle-no-webhooks.md b/docs/adr/0003-ci-driven-lifecycle-no-webhooks.md similarity index 100% rename from docs/adr/0004-ci-driven-lifecycle-no-webhooks.md rename to docs/adr/0003-ci-driven-lifecycle-no-webhooks.md diff --git a/docs/adr/0005-self-made-bearer-tokens.md b/docs/adr/0004-self-made-bearer-tokens.md similarity index 100% rename from docs/adr/0005-self-made-bearer-tokens.md rename to docs/adr/0004-self-made-bearer-tokens.md diff --git a/docs/adr/0003-seed-as-user-image.md b/docs/adr/0005-seed-as-user-image.md similarity index 100% rename from docs/adr/0003-seed-as-user-image.md rename to docs/adr/0005-seed-as-user-image.md diff --git a/docs/adr/0006-sprout-durable-identity.md b/docs/adr/0006-sprout-durable-identity.md index 2cf58766..23be2efc 100644 --- a/docs/adr/0006-sprout-durable-identity.md +++ b/docs/adr/0006-sprout-durable-identity.md @@ -1,12 +1,7 @@ -# Product `sprout*` durable runtime identity +# Durable runtime identity is `sprout*` -**Status:** accepted, implemented. - -Durable runtime identity uses the product name `sprout` — compose project, -networks, SQLite path, Postgres roles, preview container names -`sprout--pr-`, preview databases `sprout__pr` — -replacing the legacy opaque `preview-buddy` / `pb` / `prev_` prefixes kept -after the package rename. Operators upgrading from those defaults wipe -volumes/networks/state and redeploy; there is no migrator (v0.1 pre-release). - -Adopter-configurable injection names are a separate decision (ADR-0007). +Compose project, networks, SQLite path, Postgres roles, container names +(`sprout--pr-`) and preview databases (`sprout__pr`) all +carry the product name, replacing the legacy `preview-buddy` / `pb` / `prev_` +prefixes. These names are persisted in operator state, so renaming again means +wiping volumes, networks and state; there is no migrator. diff --git a/docs/adr/0007-preview-db-providers.md b/docs/adr/0007-preview-db-providers.md new file mode 100644 index 00000000..ba4e8a49 --- /dev/null +++ b/docs/adr/0007-preview-db-providers.md @@ -0,0 +1,16 @@ +# Preview database providers: Postgres, SQLite, none + +`db.provider` in `.sprout.yaml` (`postgres` default | `sqlite` | `none`) selects +the backend per repo, not per gateway, so one gateway serves mixed fleets and a +sqlite-only gateway boots without Postgres env. The deploy route resolves the +provider once into a materialization plan; lifecycle and app-deployment consume +the plan and never branch on provider. + +- The provider is stored on the preview row. Teardown and sweep drop via the + stored provider; only row-less orphans fall back to broadcast. +- `previews.db_name` is nullable for `none`. A sentinel name would leak into + every read and could collide with the catalog namespace. +- Contradictory manifests (`seed` or DB env remaps with `none`, `PG*` with + `sqlite`) fail fast at manifest parse and at the deploy route. +- Switching provider redeploys as a fresh generation: the old backend is dropped + before the new one is created. diff --git a/docs/adr/0007-preview-env-injection-names.md b/docs/adr/0007-preview-env-injection-names.md deleted file mode 100644 index df9931a0..00000000 --- a/docs/adr/0007-preview-env-injection-names.md +++ /dev/null @@ -1,34 +0,0 @@ -# Adopter-configurable injection env names (`preview.env`) - -**Status:** accepted, implemented. - -Adopters remap the canonical connection env names the gateway injects -into preview app and seed containers via optional `preview.env` in -`.sprout.yaml` (keys `PGHOST`…`PGDATABASE`, plus companion -`PGAPPUSER` / `PGAPPPASSWORD` → adopter names). Unmapped keys still -inject under their canonical names. Remapping replaces the name (no dual -alias). - -Owner values (`PGUSER` / `PGPASSWORD`) come from the gateway's static -preview login. Companion values are a per-preview-DB restricted LOGIN -(`_app`) with a password derived from the owner preview password -— dual-role / RLS apps use the companion for runtime queries and the -owner for migrations. Product durable identity rename is a separate -decision (ADR-0006). - -Mail follows the same grammar: canonical `MAILHOST`…`MAILREPLYTO` keys are -injected into app, companion service and seed containers and remappable -through `preview.env` with the same replace-not-alias rule. `MAILFROM` / -`MAILREPLYTO` carry the per-preview send-from identity -(`-pr@`), `MAILFROMNAME` its display -label; a `mail.from` `{pr_id}` template overrides the address. - -## Amendment 2026-09-24: companion keys are dual-only (ADR-0012) - -The companion `PGAPPUSER` / `PGAPPPASSWORD` keys above are canonical -only for `dual` previews. Since ADR-0012 the restricted companion role -is opt-in via `db.roles` (`single` | `dual`, Postgres only; default -`dual` when `preview.env` remaps a companion key, else `single`): -`single` previews inject no `PGAPP*` names anywhere, and an explicit -`db.roles: single` plus a companion remap fails fast at manifest parse -and at the deploy route. diff --git a/docs/adr/0008-preview-access-gate.md b/docs/adr/0008-preview-access-gate.md new file mode 100644 index 00000000..c74b3e81 --- /dev/null +++ b/docs/adr/0008-preview-access-gate.md @@ -0,0 +1,15 @@ +# Preview access gate is gateway-native (`preview.auth`) + +Previews are open by default; `preview.auth` (`basic` | `link`) gates one +preview via a per-preview Traefik middleware on the app router only. + +The gate lives in the gateway, not an external forward-auth service. That was +tried and abandoned: every Cloudflare path rewrites `X-Forwarded-Host`, and the +service rebuilt its URL from that header, hit its self-request shortcut, and +authorised everything. + +- `basic`: gateway-generated credential, htpasswd entry inline in the label (no + volume is shared with Traefik). +- `link`: HMAC-signed token with a per-preview version; revoking rotates the + version, no redeploy needed. +- The app receives no identity header and no new env. diff --git a/docs/adr/0008-preview-db-providers.md b/docs/adr/0008-preview-db-providers.md deleted file mode 100644 index 8778c891..00000000 --- a/docs/adr/0008-preview-db-providers.md +++ /dev/null @@ -1,66 +0,0 @@ -# Preview database providers: Postgres + SQLite behind one port - -**Status:** accepted, implemented. - -## The noun - -`provider` now names the preview-database axis only: the value of -`db.provider` in `.sprout.yaml` (`postgres` | `sqlite`). It never -describes the app-deployment module — the CONTEXT.md avoid list for that -module still stands. At the deploy boundary the axis is resolved once -into a concrete materialization plan (`provider`, `gatewayEnv`, -`volumes`, `appNetworks`, `seedNetworks`); lifecycle and -app-deployment consume the plan and never see raw `DbSpec`. The two -backends are the Postgres adapter and the SQLite volume adapter behind -the `PreviewDb` port, selected up front by the router. - -## Decision - -- The manifest owns provider selection (`db:` block, default `postgres`), - not a gateway-wide env switch. One gateway serves both backends at - once: mixed fleets deploy without operator reconfiguration, and a - sqlite-only gateway boots with no Postgres env at all. -- `PreviewDb` stays provider-agnostic (`createDatabase(dbName)`). - `createRoutingPreviewDb.forCreate(provider)` is the sole selector; - adapters trust the router instead of re-validating dispatch. - `sqlite.ts` implements the port over one named Docker volume per - preview (`sprout--pr--sqlite`), derived from the logical - database name. The `index.ts` wiring is the single place that decides - which adapters exist. A literal single static selection in `index.ts` - would be a gateway-wide switch, which the manifest-owned selection - above rules out. -- Provider is state: the preview row carries `db_provider` (default - `"postgres"`), written at claim time. Teardown and sweep route drops - from the stored provider (`forDrop`); only row-less sweep orphans - fall back to broadcast, which aggregates real failures instead of - surfacing the first. The merged catalog dedups on `dbName`, since - both backends share one name space. A provider switch redeploys as a - fresh generation: bring-up drops the old backend first, then creates - the new one, so no resource strands. -- The canonical SQLite key is `DATABASE_URL` with value - `file:/`, remappable through `preview.env` under the - ADR-0007 grammar (remap replaces the name, no dual alias). SQLite - previews mount the volume at `db.path` in app, service, and seed - containers and join the Traefik network only; no `PG*` keys are - injected for them. -- Gateway boot requires only the Traefik network. Postgres config is an - all-or-nothing optional (`config.postgres`); a partial Postgres env - fails boot instead of limping. A `postgres` deploy on a gateway - without Postgres env fails fast at the deploy route with - `postgres_not_configured`, naming the repo, the provider, and the - missing variables. The check lives at deploy time rather than boot - time because repos onboard dynamically through the API — boot cannot - know which providers will be declared, and a sqlite-only gateway must - boot clean. `preview.env` keys are validated against the provider at - manifest parse and at the deploy route (`PG*` needs `postgres`, - `DATABASE_URL` needs `sqlite`) through one shared preview-env entry - point. - -## Consequences - -- Existing manifests behave exactly as before (default `postgres`, same - container env, DB names, and networks). -- An app-image replace keeps the SQLite volume (data survives); - teardown removes it on the same paths that drop a Postgres database. -- `sprout worktree-db` stays Postgres-only; previews without a database - are a separate change on top of this seam. diff --git a/docs/adr/0009-preview-db-provider-none.md b/docs/adr/0009-preview-db-provider-none.md deleted file mode 100644 index 167f404b..00000000 --- a/docs/adr/0009-preview-db-provider-none.md +++ /dev/null @@ -1,55 +0,0 @@ -# Previews without a database: `db.provider: none` - -**Status:** accepted, implemented. - -## The noun - -`none` is the third value of the preview-database axis (`db.provider` in -`.sprout.yaml`: `postgres` | `sqlite` | `none`), reusing the provider seam -from the SQLite change. It never describes the app-deployment module — -the CONTEXT.md avoid list for that module still stands. A `none` preview -is app container + optional companion services + routing + health, with -no database at all. - -## Decision - -- The manifest owns the choice (`db.provider: none`, default stays - `postgres`), not a gateway-wide switch and not a parallel flag. The - deploy boundary resolves `none` into a concrete materialization plan - with empty `gatewayEnv`/`volumes` and Traefik-only networks; lifecycle - and app-deployment consume the plan and never branch on the provider. - `forCreate("none")` throws (there is no backend to select), so the - deploy path calling it is a bug; `forDrop("none")` is a no-op safety - net, but teardown skips the catalog lock and the drop call entirely. -- `previews.db_name` is **nullable**, not a reserved sentinel. A sentinel - keeps `NOT NULL` but leaks a fake name into every `db_name` read - (snapshots, list, sweep, doctor) and risks colliding with the catalog - namespace; `NULL` renders cleanly (`db_name: null`) and can never match - a `sprout__pr` catalog entry, so sweep TTL, PR-close, status, - and orphan planning keep working with null-aware comparisons. The - migration rebuilds the table with `db_name` nullable and copies rows - verbatim. -- Contradictory combinations fail fast with named errors rather than - silent no-ops: a `seed:` block or any `preview.env` database-key remap - combined with `none` is rejected at manifest parse and at the gateway - deploy route (`seed requires db.provider postgres or sqlite - (db.provider is none)`; `preview.env. requires db.provider - `), and `-s` / `--reseed` / `sprout ci reseed -s …` fail fast on - the CLI before any network call. The seed gate reads the provider, so - no seed phase ever runs for `none`. -- Gateway boot is unchanged (Traefik network only): a gateway whose - repos are all `none` needs no `SPROUT_*PG*` / - `SPROUT_POSTGRES_NETWORK`; a `postgres` deploy without them still fails - fast with `postgres_not_configured`. Provider switching redeploys as a - fresh generation — the claim intent preserves the old name through the - switch so bring-up drops the old backend before nulling the column. - -## Consequences - -- `postgres` and `sqlite` paths are untouched: same container env, DB - names, volumes, and networks. Companion services work as today minus - the database env. -- No new CLI flags; `sprout list` and the status endpoint render - `db_name: null` for `none` previews. -- A test with a throwing `PreviewDb` port proves zero database calls on - the `none` deploy path by construction, not by review. diff --git a/docs/adr/0010-preview-label-ownership.md b/docs/adr/0010-preview-label-ownership.md deleted file mode 100644 index 593252d4..00000000 --- a/docs/adr/0010-preview-label-ownership.md +++ /dev/null @@ -1,23 +0,0 @@ -# Preview label ownership (`preview.labels`) - -**Status:** accepted, implemented. - -Container labels on a preview have two owners. The gateway owns the -Traefik routing set it emits per container (`traefik.enable`, the router -rule, the loadbalancer server port, plus the TLS and forwardAuth keys -when that gateway configures them). The adopting repo owns everything -else via optional `preview.labels` (app container and every service -container) and `preview.services[].labels` (that service container -only), merged verbatim — `traefik.*` keys included, so a preview can -attach to a router or middleware defined outside the gateway. - -A silently overridden rule, port, or TLS label is how a preview goes -dark with no error, so collision fails fast instead: the gateway -computes its own label set for each container first and rejects any -adopter key already present in it (`reserved_preview_label`, quoting -the manifest path). The reserved set is derived from the emission -itself, never a hard-coded list, so it tracks the gateway's TLS and -forwardAuth policy without drifting. - -Label values are literal (no `{pr_id}` interpolation); the seed -container is a one-shot job and carries no adopter labels. diff --git a/docs/adr/0011-agent-first-docs.md b/docs/adr/0011-agent-first-docs.md deleted file mode 100644 index ece6b9c6..00000000 --- a/docs/adr/0011-agent-first-docs.md +++ /dev/null @@ -1,44 +0,0 @@ -# Agent-first multi-page docs + onboarding prompt - -**Status:** accepted, implemented. - -## Context - -Two long guides carried the whole contract. Agents are the primary consumer -now and there was nothing agent-shaped: no per-topic pages, no index, no -machine-readable catalogue, no paste-into-a-harness prompt. - -## Decision - -- Markdown stays canonical under `docs/`: one topic per page with a stable - URL (`getting-started`, `adopting-a-repo`, `ci-integration`, - `operator-deploy`, `previews`, `cli-reference`, `troubleshooting`, - `onboarding-prompt`; `herdr-integration` joins the same section). -- `docs/site/assemble.ts` renders each page markdown to HTML at assemble - time; both `.md` (agents) and `.html` (humans) ship from one source, and - the link gate runs over the whole artifact. -- `docs/index.html` lists every page with its one-line description. - `llms.txt` at the site root lists every page with its canonical URL and - marks the onboarding prompt as the entry point. -- `docs/onboarding-prompt.md` is one copy-paste block: fetch index then - config then CI docs, inspect the repo, confirm slug and hostname template - with the user, write only `.sprout.yaml` / optional `Dockerfile.seed` / - the CI file, name the masked variables the user sets, verify with the CLI - loader, next step `sprout doctor` / first `sprout ci preview`. - -## Consequences - -- New pages join `publishFiles` in `docs/site/assemble.ts`; the assemble - and check suites assert the page set and the render step. -- Inbound references point at the real pages; the removed thin maps - (`docs/adoption.md`, `docs/deploy.md`) are gone, so their old anchors 404. -- Published pages never carry maintainer internals; the gate enforces it on - markdown sources and rendered HTML alike. - -## Amendment 2026-09-23: legacy moved-content pages removed - -The thin landing pages (`adoption.md` and `deploy.md`) are deleted -along with the `legacy` manifest branch and the "Legacy entry points" -index paragraph. There is no redirect shim: `docs/deploy.html` and -`docs/adoption.html` now 404, and all inbound references point at -`docs/operator-deploy.md` / `docs/adopting-a-repo.md`. diff --git a/docs/adr/0012-preview-db-roles-opt-in.md b/docs/adr/0012-preview-db-roles-opt-in.md deleted file mode 100644 index 22867d30..00000000 --- a/docs/adr/0012-preview-db-roles-opt-in.md +++ /dev/null @@ -1,76 +0,0 @@ -# Preview DB roles: restricted companion opt-in (`db.roles`) - -**Status:** accepted, implemented. - -## The noun - -`roles` names the Postgres preview-database credential axis only: the -value of `db.roles` in `.sprout.yaml` (`single` | `dual`, Postgres -only). It never describes the app-deployment module or the companion -**service** containers — the CONTEXT.md avoid lists for both still -stand. A `single` preview is one Postgres LOGIN (the static preview -owner); a `dual` preview adds the per-database restricted companion -LOGIN (`_app`) exactly as before. - -## Decision - -- The manifest owns the choice (`db.roles`, Postgres only), not a - gateway-wide switch and not a parallel flag. `dual` is byte-for-byte - today's contract: one role named `_app`, the same HMAC-derived - password, the same `GRANT CONNECT` + schema `USAGE`, the same - `PGAPPUSER` / `PGAPPPASSWORD` names injected into app, - companion-service, and seed containers, remappable via `preview.env`. - `single` provisions no companion role and injects no `PGAPPUSER` / - `PGAPPPASSWORD` anywhere. -- The default is derived by one rule, not two mechanisms: `dual` when - `preview.env` remaps `PGAPPUSER` or `PGAPPPASSWORD`, otherwise - `single`. An explicit `db.roles` wins over the derivation. The - resolver lives in `@sprout/preview-env` (`resolveDbRoles`) and both - the CLI manifest parse and the gateway deploy route call it — the - shared-package pattern the provider guard already uses. -- Contradictory combinations fail fast with named errors rather than - silent disagreement: explicit `db.roles: single` plus a `preview.env` - entry for a companion key is rejected at manifest parse and at the - gateway deploy route - (`preview.env. conflicts with db.roles single (remove the remap - or use db.roles dual)`), naming both sides. The remap is the adopter - literally saying "I use this credential", so the two must never - disagree silently. `db.roles` on `sqlite` / `none` is rejected like an - out-of-scope env key - (`db.roles requires db.provider postgres`). -- The role lifecycle follows the resolved mode: `createDatabase` - provisions the companion only in `dual`, taking the mode as an - explicit options argument (per-repo manifest state resolved at deploy - time, never module state). Teardown keeps calling `DROP ROLE IF - EXISTS` unconditionally so a preview created while dual still cleans - up after the repo flips to single. -- Env injection follows the resolved mode in `pgConnectionEnv`; the - `withGatewayConnectionEnv` reservation set is unchanged (every - `PREVIEW_ENV_KEYS` name stays stripped from adopter env in both - modes). -- The name budget follows the mode at the deploy boundary only: - `validatePreviewIdentity` allows db names up to `PG_IDENT_MAX` in - `single` and stays at `PG_IDENT_MAX - len("_app")` in `dual`. The - catalog read path (`isPreviewDbName` / `parsePreviewDatabaseName`, - which list/teardown/sweep run over historical rows) stays permissive - at `PG_IDENT_MAX` so flipping a repo never makes an existing preview - unlistable or unremovable. - -## Consequences - -- Adopters who never mention the companion get none: no role - create/sync per deploy, no `PGAPP*` names in container env, no - per-migration `GRANT` obligation, and four more characters of db-name - budget. Adopters who remap a companion key keep working with zero - config change (derived `dual`). -- No `dual`/`legacy` alias for the injected names; no change to the - `mail.*` grammar, hostname templates, or `preview.env` keys beyond - the new guard. Automatically `GRANT`ing table privileges / - `ALTER DEFAULT PRIVILEGES` stays a separate change. -- Amends ADR-0007: the companion `PGAPPUSER` / `PGAPPPASSWORD` keys are - canonical only for `dual` previews (see the amendment note there). - -## Amendment 2026-09-24: see ADR-0007 amendment - -ADR-0007 carries the one-line amendment pointing at this decision; this -file stays the record of the roles axis itself. diff --git a/docs/adr/0013-preview-access-gate.md b/docs/adr/0013-preview-access-gate.md deleted file mode 100644 index 37abf433..00000000 --- a/docs/adr/0013-preview-access-gate.md +++ /dev/null @@ -1,37 +0,0 @@ -# Preview access gate (`preview.auth`) - -**Status:** accepted, implemented. - -Previews are open by design, so sharing one preview means gating one -preview: `preview.auth` (`none` default, `basic`, `link`) attaches a -per-preview Traefik middleware to the app router only. Companion -services are never double-gated, and reset/reseed/teardown bypass the -gate because they act through the gateway and the forge, not the gated -host. - -The gate is gateway-native. An external forward-auth service was tried -and abandoned for two structural reasons: there is no Cloudflare-free -path from the preview edge to that service, and every Cloudflare path -rewrites `X-Forwarded-Host`, so the service rebuilt its URL from the -header, took its self-request shortcut, and authorised everything. The -`link` forwardAuth address is therefore the gateway's in-network name, -which the operator configures as `SPROUT_PREVIEW_AUTH_ADDRESS` next to -the token-signing root `SPROUT_PREVIEW_AUTH_SECRET` (partial sets fail -boot). - -Two postures, two mechanisms. `basic` is a gateway-generated credential -enforced by Traefik's `basicAuth` middleware with the htpasswd entry -inline in the label — there is no volume shared with Traefik for a file, -so a file path would be fiction. `link` is a token (repository, PR id, -expiry, per-preview version, HMAC-signed) consumed at -`/__sprout/auth?t=` on the preview's own host: the forwardAuth handler -answers that path with a `302` plus a host-scoped cookie, and checks the -cookie or Basic credentials on every other request. Revocation rotates -the per-preview version, which invalidates outstanding links with no -redeploy; basic password rotation lands on the next deploy because the -hash is label-embedded. - -Wire contract: by default the app receives no identity header at all — -the gate either keeps traffic out or passes it through unmodified. This -adds no app env and changes no injection names, so the preview wire -grammar is unchanged. diff --git a/docs/adr/README.md b/docs/adr/README.md deleted file mode 100644 index 128eb9f6..00000000 --- a/docs/adr/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Architecture decision records - -Flat numbering. All three ADR criteria (hard to reverse, surprising, real -trade-off) were applied — most v0.1 choices are documented in the normative spec issue -only. - -| ADR | Decision | -|---|---| -| [0001](0001-one-process-two-modules.md) | One Docker image, one process, preview-db + app-deployment modules | -| [0002](0002-shared-logical-databases.md) | Shared Postgres instance, logical per-PR databases | -| [0003](0003-seed-as-user-image.md) | Seeding via user-built one-shot seed image, no gateway clone | -| [0004](0004-ci-driven-lifecycle-no-webhooks.md) | Symmetric CI lifecycle; no forge webhooks in v0.1 | -| [0005](0005-self-made-bearer-tokens.md) | Self-made bearer tokens in SQLite, not better-auth | -| [0006](0006-sprout-durable-identity.md) | `sprout*` durable identity (accepted, implemented) | -| [0007](0007-preview-env-injection-names.md) | Adopter `preview.env` remaps injection names (accepted, implemented) | -| [0008](0008-preview-db-providers.md) | Preview database providers: Postgres + SQLite behind one port (accepted, implemented) | -| [0009](0009-preview-db-provider-none.md) | Previews without a database: `db.provider: none` (accepted, implemented) | -| [0010](0010-preview-label-ownership.md) | Preview label ownership: gateway Traefik set vs adopter `preview.labels`, fail-fast collision (accepted, implemented) | -| [0011](0011-agent-first-docs.md) | Agent-first multi-page docs + onboarding prompt (accepted, implemented) | -| [0012](0012-preview-db-roles-opt-in.md) | Preview DB roles: restricted companion opt-in (`db.roles`) | -| [0013](0013-preview-access-gate.md) | Preview access gate: per-preview `basic` / `link`, gateway-native (`preview.auth`) | diff --git a/docs/agents/comment-style.md b/docs/agents/comment-style.md deleted file mode 100644 index dea27544..00000000 --- a/docs/agents/comment-style.md +++ /dev/null @@ -1,29 +0,0 @@ -# Comment style - -1. **A comment earns its place only when the code cannot say it.** If the line below - already says it, delete the comment: no restating signatures, types or obvious - control flow. -2. **Never cite tickets, issues, PRs/MRs, review feedback or people** — no `PRO-12`, - `#128`, `issue #92`, "per review", "per the ticket". The tracker and git history - hold that; the code holds the *reason*. -3. **No history narration.** "Previously…", "now uses X after the refactor", "fixed in - v0.6.0" — git remembers; the file should read as the current truth. -4. **No commented-out code.** Git is the archive. -5. **An ADR reference is allowed only to mark a deliberate deviation/exception**, and the - deviation must be named in the same line ("exempt from ADR-0007 because …"). Never as a - substitute for stating the reason. -6. **Keep the why when it is real:** invariants, ordering/locking requirements, observed - external behaviour and workarounds (say what was observed), security/privacy decisions, - performance or safety tradeoffs, back-compat and migration constraints, unexplained - magic constants. -7. **Public API docs keep the contract, drop the echo.** Keep non-obvious parameters, - invariants, thrown errors and side effects; delete restatements of the signature and of - the types. -8. **Banner/section comments only where they name a boundary the code cannot.** One-line - module header is fine; a table of contents is not. -9. **One line beats three.** If the explanation needs a paragraph it is a decision → put it - in `CONTEXT.md` / `docs/adr/` and leave at most a one-line pointer in the code. -10. **A comment that contradicts the code is a bug** — fix one of the two in the same - change; never leave both standing. -11. **No editorializing or decoration:** no "ugly hack", "for now", "should be fine", no - changelog notes, no emoji. diff --git a/docs/agents/domain.md b/docs/agents/domain.md deleted file mode 100644 index b548c538..00000000 --- a/docs/agents/domain.md +++ /dev/null @@ -1,51 +0,0 @@ -# Domain Docs - -How the engineering skills should consume this repo's domain documentation when exploring the codebase. - -## Before exploring, read these - -- **`CONTEXT.md`** at the repo root, or -- **`CONTEXT-MAP.md`** at the repo root if it exists — it points at one `CONTEXT.md` per context. Read each one relevant to the topic. -- **`docs/adr/`** — read ADRs that touch the area you're about to work in. In multi-context repos, also check `src//docs/adr/` for context-scoped decisions. - -If any of these files don't exist, **proceed silently**. Don't flag their absence; don't suggest creating them upfront. The `/domain-modeling` skill (reached via `/grill-with-docs` and `/improve-codebase-architecture`) creates them lazily when terms or decisions actually get resolved. - -## File structure - -Single-context repo (most repos): - -``` -/ -├── CONTEXT.md -├── docs/adr/ -│ ├── 0001-event-sourced-orders.md -│ └── 0002-postgres-for-write-model.md -└── src/ -``` - -Multi-context repo (presence of `CONTEXT-MAP.md` at the root): - -``` -/ -├── CONTEXT-MAP.md -├── docs/adr/ ← system-wide decisions -└── src/ - ├── ordering/ - │ ├── CONTEXT.md - │ └── docs/adr/ ← context-specific decisions - └── billing/ - ├── CONTEXT.md - └── docs/adr/ -``` - -## Use the glossary's vocabulary - -When your output names a domain concept (in an issue title, a refactor proposal, a hypothesis, a test name), use the term as defined in `CONTEXT.md`. Don't drift to synonyms the glossary explicitly avoids. - -If the concept you need isn't in the glossary yet, that's a signal — either you're inventing language the project doesn't use (reconsider) or there's a real gap (note it for `/domain-modeling`). - -## Flag ADR conflicts - -If your output contradicts an existing ADR, surface it explicitly rather than silently overriding: - -> _Contradicts ADR-0007 (event-sourced orders) — but worth reopening because…_ diff --git a/docs/agents/issue-tracker.md b/docs/agents/issue-tracker.md deleted file mode 100644 index b812b355..00000000 --- a/docs/agents/issue-tracker.md +++ /dev/null @@ -1,45 +0,0 @@ -# Issue tracker: GitHub - -Issues and PRDs for this repo live as GitHub issues on `simpros/sprout`. Use the `gh` CLI for all operations. - -## Conventions - -- **Create an issue**: `gh issue create --title "..." --body "..."`. Use a heredoc for multi-line bodies. -- **Read an issue**: `gh issue view --comments`, filtering comments by `jq` and also fetching labels. -- **List issues**: `gh issue list --state open --json number,title,body,labels,comments --jq '[.[] | {number, title, body, labels: [.labels[].name], comments: [.comments[].body]}]'` with appropriate `--label` and `--state` filters. -- **Comment on an issue**: `gh issue comment --body "..."` -- **Apply / remove labels**: `gh issue edit --add-label "..."` / `--remove-label "..."` -- **Close**: `gh issue close --comment "..."` - -Infer the repo from `git remote -v` — `gh` does this automatically when run inside a clone. - -## Pull requests as a triage surface - -**PRs as a request surface: no.** _(Set to `yes` if this repo treats external PRs as feature requests; `/triage` reads this flag.)_ - -When set to `yes`, PRs run through the same labels and states as issues, using the `gh pr` equivalents: - -- **Read a PR**: `gh pr view --comments` and `gh pr diff ` for the diff. -- **List external PRs for triage**: `gh pr list --state open --json number,title,body,labels,author,authorAssociation,comments` then keep only `authorAssociation` of `CONTRIBUTOR`, `FIRST_TIME_CONTRIBUTOR`, or `NONE` (drop `OWNER`/`MEMBER`/`COLLABORATOR`). -- **Comment / label / close**: `gh pr comment`, `gh pr edit --add-label`/`--remove-label`, `gh pr close`. - -GitHub shares one number space across issues and PRs, so a bare `#42` may be either — resolve with `gh pr view 42` and fall back to `gh issue view 42`. - -## When a skill says "publish to the issue tracker" - -Create a GitHub issue. - -## When a skill says "fetch the relevant ticket" - -Run `gh issue view --comments`. - -## Wayfinding operations - -Used by `/wayfinder`. The **map** is a single issue with **child** issues as tickets. - -- **Map**: a single issue labelled `wayfinder:map`, holding the Notes / Decisions-so-far / Fog body. `gh issue create --label wayfinder:map`. -- **Child ticket**: an issue linked to the map as a GitHub sub-issue (`gh api` on the sub-issues endpoint). Where sub-issues aren't enabled, add the child to a task list in the map body and put `Part of #` at the top of the child body. Labels: `wayfinder:` (`research`/`prototype`/`grilling`/`task`). Once claimed, the ticket is assigned to the driving dev. -- **Blocking**: GitHub's **native issue dependencies** — the canonical, UI-visible representation. Add an edge with `gh api --method POST repos///issues//dependencies/blocked_by -F issue_id=`, where `` is the blocker's numeric **database id** (`gh api repos///issues/ --jq .id`, _not_ the `#number` or `node_id`). GitHub reports `issue_dependencies_summary.blocked_by` (open blockers only — the live gate). Where dependencies aren't available, fall back to a `Blocked by: #, #` line at the top of the child body. A ticket is unblocked when every blocker is closed. -- **Frontier query**: list the map's open children (`gh issue list --state open`, scoped to the map's sub-issues / task list), drop any with an open blocker (`issue_dependencies_summary.blocked_by > 0`, or an open issue in the `Blocked by` line) or an assignee; first in map order wins. -- **Claim**: `gh issue edit --add-assignee @me` — the session's first write. -- **Resolve**: `gh issue comment --body ""`, then `gh issue close `, then append a context pointer (gist + link) to the map's Decisions-so-far. diff --git a/docs/agents/pull-requests.md b/docs/agents/pull-requests.md deleted file mode 100644 index 337e53a9..00000000 --- a/docs/agents/pull-requests.md +++ /dev/null @@ -1,51 +0,0 @@ -# Pull requests - -Every pull request is opened and described with the `visual-pr` skill vendored at -`.agents/skills/visual-pr/` (from [`humanlayer/skills`](https://github.com/humanlayer/skills), -pinned commit `ca7c8088`). The skill is the source of truth for the body shape; -this file carries the publishing steps and the fallback template. - -The skill is the source of truth, not a copy of it: -`npx skills add humanlayer/skills --skill visual-pr`, then invoke `/visual-pr` -(or read `plugins/visual-pr/skills/visual-pr/SKILL.md` in -[`humanlayer/skills`](https://github.com/humanlayer/skills) at commit `ca7c8088`). -The skill owns the body template (`references/pr_description_template.md`) and the -visuals (`references/show-me.md`). Do not reimplement that template here — this -file's template is only the fallback for when the skill is unavailable. - -## Body template - -**Why the change** — one sentence. A reviewer reads it first and it decides -whether the rest is worth reading. - -**Special things to note** — 1-3 bullets: reviewer warnings, migrations, compat -constraints, things deliberately left out, surprising decisions. `- None.` when -there are none. - -**Change outline** — a compact structural view of the change, not prose and not a -file-by-file changelog. Use only the views that explain this pull request: - -- call tree or component tree for a new flow, -- shallow file tree with responsibilities for a broad change, -- SQL schema and endpoint contract changes, -- key type changes, -- control/data flow pseudocode, -- `diff` blocks when an existing shape changes. - -## Publishing - -Save the description to `.humanlayer/tasks/{task-slug}/pr-description.md` when -that task directory exists, otherwise -`.humanlayer/tasks/pr-{number}/description.md`, then publish and re-read it: - -```bash -gh pr edit --body-file # GitHub -glab mr update --description-file # GitLab -``` - -## show-me is a comment, never a body section - -`show-me` (same source repo) is used only when a pull request's design moves -**dramatically** after it was opened — a structural redesign, not local fixes — -and then **as a comment**. The body is never rewritten: it records the design the -pull request opened with. diff --git a/docs/agents/triage-labels.md b/docs/agents/triage-labels.md deleted file mode 100644 index b716855d..00000000 --- a/docs/agents/triage-labels.md +++ /dev/null @@ -1,15 +0,0 @@ -# Triage Labels - -The skills speak in terms of five canonical triage roles. This file maps those roles to the actual label strings used in this repo's issue tracker. - -| Label in mattpocock/skills | Label in our tracker | Meaning | -| -------------------------- | -------------------- | ---------------------------------------- | -| `needs-triage` | `needs-triage` | Maintainer needs to evaluate this issue | -| `needs-info` | `needs-info` | Waiting on reporter for more information | -| `ready-for-agent` | `ready-for-agent` | Fully specified, ready for an AFK agent | -| `ready-for-human` | `ready-for-human` | Requires human implementation | -| `wontfix` | `wontfix` | Will not be actioned | - -When a skill mentions a role (e.g. "apply the AFK-ready triage label"), use the corresponding label string from this table. - -Edit the right-hand column to match whatever vocabulary you actually use. diff --git a/skills-lock.json b/skills-lock.json index 3e7163d7..005ed04f 100644 --- a/skills-lock.json +++ b/skills-lock.json @@ -85,12 +85,6 @@ "skillPath": "skills/review-animations/SKILL.md", "computedHash": "b4e5f0f4fe3e2743c85bf7354108f48a0b9d502cb20ef5c4a9c195da91f93736" }, - "setup-matt-pocock-skills": { - "source": "mattpocock/skills", - "sourceType": "github", - "skillPath": "skills/engineering/setup-matt-pocock-skills/SKILL.md", - "computedHash": "552b0f48b9fe054aa93c5d432fefbd7bd9645e3f2d20b4e22432453a81800b21" - }, "tdd": { "source": "mattpocock/skills", "sourceType": "github", From e0fc0b7496244d18106fa11e9a66d6476f6eb18c Mon Sep 17 00:00:00 2001 From: simpros <38320875+simpros@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:59:57 +0100 Subject: [PATCH 02/11] address review feedback on #282 Restore immutable ADR numbers (revert 0003/0004/0005 rotation; providers back at 0008 with 0009 fold note; access gate back at 0013; 0007/0009/0012 as pointer stubs; 0010/0011 stay deleted), re-add docs/adr/README index, add .agents/README tracker redirect for vendored skill pointers, and scope CODE-STYLE comment/env rules to match the codebase. --- .agents/README.md | 14 +++++++++++ AGENTS.md | 1 + CODE-STYLE.md | 4 ++-- ...er-image.md => 0003-seed-as-user-image.md} | 0 ...> 0004-ci-driven-lifecycle-no-webhooks.md} | 0 ...ens.md => 0005-self-made-bearer-tokens.md} | 0 docs/adr/0007-preview-env-injection-names.md | 5 ++++ ...viders.md => 0008-preview-db-providers.md} | 3 +++ docs/adr/0009-preview-db-provider-none.md | 5 ++++ docs/adr/0012-preview-db-roles-opt-in.md | 7 ++++++ ...ss-gate.md => 0013-preview-access-gate.md} | 0 docs/adr/README.md | 24 +++++++++++++++++++ 12 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 .agents/README.md rename docs/adr/{0005-seed-as-user-image.md => 0003-seed-as-user-image.md} (100%) rename docs/adr/{0003-ci-driven-lifecycle-no-webhooks.md => 0004-ci-driven-lifecycle-no-webhooks.md} (100%) rename docs/adr/{0004-self-made-bearer-tokens.md => 0005-self-made-bearer-tokens.md} (100%) create mode 100644 docs/adr/0007-preview-env-injection-names.md rename docs/adr/{0007-preview-db-providers.md => 0008-preview-db-providers.md} (90%) create mode 100644 docs/adr/0009-preview-db-provider-none.md create mode 100644 docs/adr/0012-preview-db-roles-opt-in.md rename docs/adr/{0008-preview-access-gate.md => 0013-preview-access-gate.md} (100%) create mode 100644 docs/adr/README.md diff --git a/.agents/README.md b/.agents/README.md new file mode 100644 index 00000000..cc76c60e --- /dev/null +++ b/.agents/README.md @@ -0,0 +1,14 @@ +# Agent tooling + +Vendored skills live in `.agents/skills/`; invoke by trigger: + +- `code-review`, `to-spec`, `to-tickets`, `triage`, `wayfinder` — tracker-backed workflow (redirect below). +- `documentation-writer` — every docs/prose task. +- `emil-design-eng` — building or reviewing UI. +- `review-animations` — reviewing motion code; defaults to flagging. +- `visual-pr` — every PR body; `show-me` goes in a comment, never the body. + +Tracker redirect: any vendored reference to `docs/agents/*` or +`/setup-matt-pocock-skills` resolves to GitHub issues/PRs on +`simpros/sprout` via `gh`; labels: `needs-triage`, `needs-info`, +`ready-for-agent`, `ready-for-human`, `wontfix`. diff --git a/AGENTS.md b/AGENTS.md index ae0c704e..a615b9e2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -39,3 +39,4 @@ bun run db:migrate # runtime migrator (apps/server; same as boot) - Domain vocabulary: `CONTEXT.md`. Decisions: `docs/adr/` (only hard-to-reverse, hard-to-understand ones). - Issues: GitHub issues on `simpros/sprout` via `gh`. Labels: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`. - PRs: always describe with the `visual-pr` skill (`.agents/skills/visual-pr/`), even though it is explicit-invoke by default. `show-me` goes in a comment, never the body. +- Agent tooling (vendored skill index, tracker redirect): `.agents/README.md`. diff --git a/CODE-STYLE.md b/CODE-STYLE.md index 88a12929..9a7290f2 100644 --- a/CODE-STYLE.md +++ b/CODE-STYLE.md @@ -3,7 +3,7 @@ - Plain functions, no classes. - Periodic work uses `Bun.cron`, never `setTimeout`/`setInterval`. - Keep modules small and focused. -- Fail fast at config load for required env vars. +- Fail fast at the boundary that owns the value: boot for gateway-scope config, the deploy route for per-repo provider config (a sqlite-only gateway boots with no Postgres env). - DB schema lives in `apps/server/src/infrastructure/db/`; migrations in `apps/server/drizzle/`. ## Comments @@ -15,5 +15,5 @@ State the why only, and only when the code cannot say it. - No commented-out code. No "hack" / "for now" / emoji. - Keep real whys: invariants, ordering/locking, observed external behaviour, security tradeoffs, magic constants. -- One line, not a paragraph. A paragraph is a decision: put it in `CONTEXT.md` or an ADR. +- Inline comments: one line. Module/function docstrings: one invariant, ≤3 lines. Longer reasoning is a decision: put it in `CONTEXT.md` or an ADR. - A comment that contradicts the code is a bug; fix one of them. diff --git a/docs/adr/0005-seed-as-user-image.md b/docs/adr/0003-seed-as-user-image.md similarity index 100% rename from docs/adr/0005-seed-as-user-image.md rename to docs/adr/0003-seed-as-user-image.md diff --git a/docs/adr/0003-ci-driven-lifecycle-no-webhooks.md b/docs/adr/0004-ci-driven-lifecycle-no-webhooks.md similarity index 100% rename from docs/adr/0003-ci-driven-lifecycle-no-webhooks.md rename to docs/adr/0004-ci-driven-lifecycle-no-webhooks.md diff --git a/docs/adr/0004-self-made-bearer-tokens.md b/docs/adr/0005-self-made-bearer-tokens.md similarity index 100% rename from docs/adr/0004-self-made-bearer-tokens.md rename to docs/adr/0005-self-made-bearer-tokens.md diff --git a/docs/adr/0007-preview-env-injection-names.md b/docs/adr/0007-preview-env-injection-names.md new file mode 100644 index 00000000..5579c061 --- /dev/null +++ b/docs/adr/0007-preview-env-injection-names.md @@ -0,0 +1,5 @@ +# Adopter-configurable injection env names (`preview.env`) + +Superseded: the contract now lives in `docs/adopting-a-repo.md` (the +`preview.env` remap grammar and its `db.provider` / `db.roles` interaction). +This stub keeps the number so historical ADR-0007 citations still resolve. diff --git a/docs/adr/0007-preview-db-providers.md b/docs/adr/0008-preview-db-providers.md similarity index 90% rename from docs/adr/0007-preview-db-providers.md rename to docs/adr/0008-preview-db-providers.md index ba4e8a49..35bb7325 100644 --- a/docs/adr/0007-preview-db-providers.md +++ b/docs/adr/0008-preview-db-providers.md @@ -1,5 +1,8 @@ # Preview database providers: Postgres, SQLite, none +*Folds ADR-0009: `none` is the third provider value below, so ADR-0009 stays +as a stub pointer.* + `db.provider` in `.sprout.yaml` (`postgres` default | `sqlite` | `none`) selects the backend per repo, not per gateway, so one gateway serves mixed fleets and a sqlite-only gateway boots without Postgres env. The deploy route resolves the diff --git a/docs/adr/0009-preview-db-provider-none.md b/docs/adr/0009-preview-db-provider-none.md new file mode 100644 index 00000000..fd7b0c7d --- /dev/null +++ b/docs/adr/0009-preview-db-provider-none.md @@ -0,0 +1,5 @@ +# Previews without a database: `db.provider: none` + +Folded into ADR-0008: `none` is the third `db.provider` value there +(nullable `db_name`, fail-fast contradictions, fresh-generation switch). +This stub keeps the number so historical ADR-0009 citations still resolve. diff --git a/docs/adr/0012-preview-db-roles-opt-in.md b/docs/adr/0012-preview-db-roles-opt-in.md new file mode 100644 index 00000000..7b521f48 --- /dev/null +++ b/docs/adr/0012-preview-db-roles-opt-in.md @@ -0,0 +1,7 @@ +# Preview DB roles: restricted companion opt-in (`db.roles`) + +Folded out of the log: the contract lives in `docs/adopting-a-repo.md` and +the invariants in code (the one-rule derivation in `resolveDbRoles`, +`packages/preview-env/src/db.ts`; the dual/single name budget, +`apps/server/src/preview-db/names.ts`). This stub keeps the number so +historical ADR-0012 citations still resolve. diff --git a/docs/adr/0008-preview-access-gate.md b/docs/adr/0013-preview-access-gate.md similarity index 100% rename from docs/adr/0008-preview-access-gate.md rename to docs/adr/0013-preview-access-gate.md diff --git a/docs/adr/README.md b/docs/adr/README.md new file mode 100644 index 00000000..60e16c3e --- /dev/null +++ b/docs/adr/README.md @@ -0,0 +1,24 @@ +# Architecture decision records + +Record a decision here only when it is hard to reverse *and* hard to +understand — everything else lives in `CONTEXT.md`, code docstrings, or the +normative spec issue. + +| ADR | Decision | +|---|---| +| [0001](0001-one-process-two-modules.md) | One Docker image, one process, preview-db + app-deployment modules | +| [0002](0002-shared-logical-databases.md) | Shared Postgres instance, logical per-PR databases | +| [0003](0003-seed-as-user-image.md) | Seeding via user-built one-shot seed image, no gateway clone | +| [0004](0004-ci-driven-lifecycle-no-webhooks.md) | Symmetric CI lifecycle; no forge webhooks in v0.1 | +| [0005](0005-self-made-bearer-tokens.md) | Self-made bearer tokens in SQLite, not better-auth | +| [0006](0006-sprout-durable-identity.md) | `sprout*` durable identity (accepted, implemented) | +| [0007](0007-preview-env-injection-names.md) | Stub: superseded by `docs/adopting-a-repo.md` | +| [0008](0008-preview-db-providers.md) | Preview database providers: Postgres, SQLite, none (folds 0009) | +| [0009](0009-preview-db-provider-none.md) | Stub: folded into 0008 | +| [0012](0012-preview-db-roles-opt-in.md) | Stub: contract in `docs/adopting-a-repo.md`, invariants in code | +| [0013](0013-preview-access-gate.md) | Preview access gate: per-preview `basic` / `link`, gateway-native | + +History: ADR numbers are immutable. 0010 (label ownership) and 0011 +(agent-first docs) were dropped outright — the label-collision invariant +lives in `apps/server/src/app-deployment/label-collisions.ts`, the docs-site +rules in `docs/site/adr-policy.ts`. From a216fde84c43ea2e283ba0ee3af7c3a216bbbe30 Mon Sep 17 00:00:00 2001 From: simpros <38320875+simpros@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:06:13 +0100 Subject: [PATCH 03/11] address review feedback on #282 Round-2 remedies: drop numeric docstring budget in CODE-STYLE.md, extend tracker redirect with PR/ticket/gh recipes, fix ADR-0011 history pointer, dedupe visual-pr policy to AGENTS.md --- .agents/README.md | 7 ++++++- CODE-STYLE.md | 2 +- docs/adr/README.md | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.agents/README.md b/.agents/README.md index cc76c60e..6e14178f 100644 --- a/.agents/README.md +++ b/.agents/README.md @@ -6,9 +6,14 @@ Vendored skills live in `.agents/skills/`; invoke by trigger: - `documentation-writer` — every docs/prose task. - `emil-design-eng` — building or reviewing UI. - `review-animations` — reviewing motion code; defaults to flagging. -- `visual-pr` — every PR body; `show-me` goes in a comment, never the body. +- `visual-pr` — PR bodies (policy in `AGENTS.md`). Tracker redirect: any vendored reference to `docs/agents/*` or `/setup-matt-pocock-skills` resolves to GitHub issues/PRs on `simpros/sprout` via `gh`; labels: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`. +PRs as a request surface: no. Tickets: `gh issue create`, parent map = +issue labelled `wayfinder:map`, child = sub-issue with `Part of #`, +blocking = `Blocked by: #` (or native dependencies), frontier = open +unassigned unblocked children. Read/fetch/comment/close via +`gh issue view|comment|close`. diff --git a/CODE-STYLE.md b/CODE-STYLE.md index 9a7290f2..e9e7f6a7 100644 --- a/CODE-STYLE.md +++ b/CODE-STYLE.md @@ -15,5 +15,5 @@ State the why only, and only when the code cannot say it. - No commented-out code. No "hack" / "for now" / emoji. - Keep real whys: invariants, ordering/locking, observed external behaviour, security tradeoffs, magic constants. -- Inline comments: one line. Module/function docstrings: one invariant, ≤3 lines. Longer reasoning is a decision: put it in `CONTEXT.md` or an ADR. +- Inline comments: one line. Module/function docstrings: one invariant, no headings or bullet lists. Longer reasoning is a decision: put it in `CONTEXT.md` or an ADR. - A comment that contradicts the code is a bug; fix one of them. diff --git a/docs/adr/README.md b/docs/adr/README.md index 60e16c3e..2773d068 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -20,5 +20,7 @@ normative spec issue. History: ADR numbers are immutable. 0010 (label ownership) and 0011 (agent-first docs) were dropped outright — the label-collision invariant -lives in `apps/server/src/app-deployment/label-collisions.ts`, the docs-site -rules in `docs/site/adr-policy.ts`. +lives in `apps/server/src/app-deployment/label-collisions.ts`, the page set +and onboarding prompt in `docs/site/assemble.ts` (`publishFiles`) and +`docs/onboarding-prompt.md`, the ADR-hygiene rules in +`docs/site/adr-policy.ts`. From 49e55549f6787ebea15e1a789155b5f2012990b5 Mon Sep 17 00:00:00 2001 From: simpros <38320875+simpros@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:10 +0100 Subject: [PATCH 04/11] address review feedback on #282 Round-3: drop nonexistent wayfinder:map label for title-based map identity, dedupe tracker label list into AGENTS.md, add Wayfinding operations heading matching the vendored skill pointer --- .agents/README.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.agents/README.md b/.agents/README.md index 6e14178f..d6590a14 100644 --- a/.agents/README.md +++ b/.agents/README.md @@ -8,12 +8,16 @@ Vendored skills live in `.agents/skills/`; invoke by trigger: - `review-animations` — reviewing motion code; defaults to flagging. - `visual-pr` — PR bodies (policy in `AGENTS.md`). -Tracker redirect: any vendored reference to `docs/agents/*` or -`/setup-matt-pocock-skills` resolves to GitHub issues/PRs on -`simpros/sprout` via `gh`; labels: `needs-triage`, `needs-info`, -`ready-for-agent`, `ready-for-human`, `wontfix`. -PRs as a request surface: no. Tickets: `gh issue create`, parent map = -issue labelled `wayfinder:map`, child = sub-issue with `Part of #`, -blocking = `Blocked by: #` (or native dependencies), frontier = open -unassigned unblocked children. Read/fetch/comment/close via -`gh issue view|comment|close`. +### Tracker + +Tracker: the one `AGENTS.md` names. Any vendored reference to +`docs/agents/*` or `/setup-matt-pocock-skills` resolves to it. +Operations: `gh issue view|comment|close|edit`; tickets = +`gh issue create`. PRs as a request surface: no. + +### Wayfinding operations + +Parent map = one open issue titled `Map: `; child = +native sub-issue (`Part of #` in the body only where sub-issues +are unavailable); blocking = `Blocked by: #` (or native +dependencies); frontier = open unassigned unblocked children. From 8c348ac6c3531dc00c725f5647789938a1498222 Mon Sep 17 00:00:00 2001 From: simpros <38320875+simpros@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:34:11 +0100 Subject: [PATCH 05/11] address review feedback on #282 Round-4: restore docs/agents/issue-tracker.md as the canonical tracker spec (body-line map/child/blocking forms; wayfinder:* labels documented as nonexistent), reduce .agents/README.md to a skill index with a pointer, note generic skills, point AGENTS.md at both files. --- .agents/README.md | 16 ++++------------ AGENTS.md | 2 +- docs/agents/issue-tracker.md | 11 +++++++++++ 3 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 docs/agents/issue-tracker.md diff --git a/.agents/README.md b/.agents/README.md index d6590a14..e4e64375 100644 --- a/.agents/README.md +++ b/.agents/README.md @@ -2,22 +2,14 @@ Vendored skills live in `.agents/skills/`; invoke by trigger: -- `code-review`, `to-spec`, `to-tickets`, `triage`, `wayfinder` — tracker-backed workflow (redirect below). +- `code-review`, `to-spec`, `to-tickets`, `triage`, `wayfinder` — tracker-backed workflow (see `docs/agents/issue-tracker.md`). - `documentation-writer` — every docs/prose task. - `emil-design-eng` — building or reviewing UI. - `review-animations` — reviewing motion code; defaults to flagging. - `visual-pr` — PR bodies (policy in `AGENTS.md`). -### Tracker - -Tracker: the one `AGENTS.md` names. Any vendored reference to -`docs/agents/*` or `/setup-matt-pocock-skills` resolves to it. -Operations: `gh issue view|comment|close|edit`; tickets = -`gh issue create`. PRs as a request surface: no. +Everything else in `.agents/skills/` is generic; invoke from its own description (or explicitly, where its frontmatter disables model invocation). -### Wayfinding operations +### Tracker -Parent map = one open issue titled `Map: `; child = -native sub-issue (`Part of #` in the body only where sub-issues -are unavailable); blocking = `Blocked by: #` (or native -dependencies); frontier = open unassigned unblocked children. +Tracker operations live in `docs/agents/issue-tracker.md` (canonical — any vendored reference to `docs/agents/*` or `/setup-matt-pocock-skills` resolves to it). diff --git a/AGENTS.md b/AGENTS.md index a615b9e2..c1ff32eb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -39,4 +39,4 @@ bun run db:migrate # runtime migrator (apps/server; same as boot) - Domain vocabulary: `CONTEXT.md`. Decisions: `docs/adr/` (only hard-to-reverse, hard-to-understand ones). - Issues: GitHub issues on `simpros/sprout` via `gh`. Labels: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`. - PRs: always describe with the `visual-pr` skill (`.agents/skills/visual-pr/`), even though it is explicit-invoke by default. `show-me` goes in a comment, never the body. -- Agent tooling (vendored skill index, tracker redirect): `.agents/README.md`. +- Agent tooling (vendored skill index): `.agents/README.md`. Issue tracker operations: `docs/agents/issue-tracker.md`. diff --git a/docs/agents/issue-tracker.md b/docs/agents/issue-tracker.md new file mode 100644 index 00000000..d9f7f674 --- /dev/null +++ b/docs/agents/issue-tracker.md @@ -0,0 +1,11 @@ +# Issue tracker: GitHub + +Issues for this repo live as GitHub issues on `simpros/sprout`. Use `gh` for all operations. + +PRs as a request surface: no. Triage labels: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`. + +Operations: `gh issue view|comment|close|edit`; tickets = `gh issue create`. + +## Wayfinding operations + +Parent map = one open issue titled `Map: `. The skill's `wayfinder:map` and `wayfinder:` labels do not exist in this repo — omit `--label`, name the ticket type in the body instead. Child = issue with `Part of #` in the body. Blocking = `Blocked by: #` line in the body (not a comment). Frontier = open unassigned child with no open issue in its `Blocked by` line. Claim = assign to yourself first. Resolve = comment the answer, close, append a pointer to the map's Decisions-so-far. From ab5a381cd95a655abff9809475759a47b51464b9 Mon Sep 17 00:00:00 2001 From: simpros <38320875+simpros@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:53:44 +0100 Subject: [PATCH 06/11] address review feedback on #282 Round-5 findings: single owner for triage labels (AGENTS.md points at tracker spec); drop redundant Tracker redirect in .agents/README.md and defuse /setup-matt-pocock-skills fallback in the tracker doc; restore 0010/0011 as stubs so ADR numbers stay immutable; fix ADR README pointers (0006 status, 0011 homes). --- .agents/README.md | 4 ---- AGENTS.md | 2 +- docs/adr/0010-preview-label-ownership.md | 6 ++++++ docs/adr/0011-agent-first-docs.md | 7 +++++++ docs/adr/README.md | 13 ++++++------- docs/agents/issue-tracker.md | 2 ++ 6 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 docs/adr/0010-preview-label-ownership.md create mode 100644 docs/adr/0011-agent-first-docs.md diff --git a/.agents/README.md b/.agents/README.md index e4e64375..5cdd673b 100644 --- a/.agents/README.md +++ b/.agents/README.md @@ -9,7 +9,3 @@ Vendored skills live in `.agents/skills/`; invoke by trigger: - `visual-pr` — PR bodies (policy in `AGENTS.md`). Everything else in `.agents/skills/` is generic; invoke from its own description (or explicitly, where its frontmatter disables model invocation). - -### Tracker - -Tracker operations live in `docs/agents/issue-tracker.md` (canonical — any vendored reference to `docs/agents/*` or `/setup-matt-pocock-skills` resolves to it). diff --git a/AGENTS.md b/AGENTS.md index c1ff32eb..d410341c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -37,6 +37,6 @@ bun run db:migrate # runtime migrator (apps/server; same as boot) - Code and comment style: `CODE-STYLE.md`. - Domain vocabulary: `CONTEXT.md`. Decisions: `docs/adr/` (only hard-to-reverse, hard-to-understand ones). -- Issues: GitHub issues on `simpros/sprout` via `gh`. Labels: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`. +- Issues: GitHub issues on `simpros/sprout` via `gh`; tracker spec and triage labels: `docs/agents/issue-tracker.md`. - PRs: always describe with the `visual-pr` skill (`.agents/skills/visual-pr/`), even though it is explicit-invoke by default. `show-me` goes in a comment, never the body. - Agent tooling (vendored skill index): `.agents/README.md`. Issue tracker operations: `docs/agents/issue-tracker.md`. diff --git a/docs/adr/0010-preview-label-ownership.md b/docs/adr/0010-preview-label-ownership.md new file mode 100644 index 00000000..7c8b5a54 --- /dev/null +++ b/docs/adr/0010-preview-label-ownership.md @@ -0,0 +1,6 @@ +# Preview label ownership (`preview.labels`) + +Dropped from the log: the invariant lives in code (`resolveLabelCollisions`, +`apps/server/src/app-deployment/label-collisions.ts` — the reserved set is +derived from the emission seam so it cannot drift). This stub keeps the number +so historical ADR-0010 citations still resolve. diff --git a/docs/adr/0011-agent-first-docs.md b/docs/adr/0011-agent-first-docs.md new file mode 100644 index 00000000..c0ab2dcc --- /dev/null +++ b/docs/adr/0011-agent-first-docs.md @@ -0,0 +1,7 @@ +# Agent-first multi-page docs + onboarding prompt + +Dropped from the log: the page set and onboarding prompt live in +`docs/site/assemble.ts` (`publishFiles`) and `docs/onboarding-prompt.md`; +ADRs never reach published pages (`docs/site/adr-policy.ts` enforces it on +sources and rendered HTML). This stub keeps the number so historical ADR-0011 +citations still resolve. diff --git a/docs/adr/README.md b/docs/adr/README.md index 2773d068..1aaa5525 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -11,16 +11,15 @@ normative spec issue. | [0003](0003-seed-as-user-image.md) | Seeding via user-built one-shot seed image, no gateway clone | | [0004](0004-ci-driven-lifecycle-no-webhooks.md) | Symmetric CI lifecycle; no forge webhooks in v0.1 | | [0005](0005-self-made-bearer-tokens.md) | Self-made bearer tokens in SQLite, not better-auth | -| [0006](0006-sprout-durable-identity.md) | `sprout*` durable identity (accepted, implemented) | +| [0006](0006-sprout-durable-identity.md) | `sprout*` durable identity | | [0007](0007-preview-env-injection-names.md) | Stub: superseded by `docs/adopting-a-repo.md` | | [0008](0008-preview-db-providers.md) | Preview database providers: Postgres, SQLite, none (folds 0009) | | [0009](0009-preview-db-provider-none.md) | Stub: folded into 0008 | +| [0010](0010-preview-label-ownership.md) | Stub: invariant in `apps/server/src/app-deployment/label-collisions.ts` | +| [0011](0011-agent-first-docs.md) | Stub: page set in `docs/site/assemble.ts`, prompt in `docs/onboarding-prompt.md` | | [0012](0012-preview-db-roles-opt-in.md) | Stub: contract in `docs/adopting-a-repo.md`, invariants in code | | [0013](0013-preview-access-gate.md) | Preview access gate: per-preview `basic` / `link`, gateway-native | -History: ADR numbers are immutable. 0010 (label ownership) and 0011 -(agent-first docs) were dropped outright — the label-collision invariant -lives in `apps/server/src/app-deployment/label-collisions.ts`, the page set -and onboarding prompt in `docs/site/assemble.ts` (`publishFiles`) and -`docs/onboarding-prompt.md`, the ADR-hygiene rules in -`docs/site/adr-policy.ts`. +History: ADR numbers are immutable. 0010/0011 survive as stubs above; the +label-collision invariant lives in code, the page set and onboarding prompt +where the 0011 stub points. diff --git a/docs/agents/issue-tracker.md b/docs/agents/issue-tracker.md index d9f7f674..2418dcfb 100644 --- a/docs/agents/issue-tracker.md +++ b/docs/agents/issue-tracker.md @@ -9,3 +9,5 @@ Operations: `gh issue view|comment|close|edit`; tickets = `gh issue create`. ## Wayfinding operations Parent map = one open issue titled `Map: `. The skill's `wayfinder:map` and `wayfinder:` labels do not exist in this repo — omit `--label`, name the ticket type in the body instead. Child = issue with `Part of #` in the body. Blocking = `Blocked by: #` line in the body (not a comment). Frontier = open unassigned child with no open issue in its `Blocked by` line. Claim = assign to yourself first. Resolve = comment the answer, close, append a pointer to the map's Decisions-so-far. + +A skill's `/setup-matt-pocock-skills` fallback means this file; that skill no longer exists here. From b38e7a012990da06a763076095850e75b3178728 Mon Sep 17 00:00:00 2001 From: simpros <38320875+simpros@users.noreply.github.com> Date: Thu, 29 Oct 2026 18:11:49 +0100 Subject: [PATCH 07/11] address review feedback on #282 - .agents/README.md: split skill index into trigger-invokable vs user-invoked-only per frontmatter; redirect /setup-matt-pocock-skills fallback to the tracker doc - docs/agents/issue-tracker.md: wayfinding ops as one-line bullets, drop history narration - docs/adr: README table is the single redirect surface, delete the five retired-number stubs, keep numbers immutable - CODE-STYLE.md: no ADR numbers in comments or test names - 0013: record the none default; AGENTS.md: fix visual-pr clause, collapse duplicate tracker pointer --- .agents/README.md | 12 +++++++++--- AGENTS.md | 4 ++-- CODE-STYLE.md | 1 + docs/adr/0007-preview-env-injection-names.md | 5 ----- docs/adr/0008-preview-db-providers.md | 3 +-- docs/adr/0009-preview-db-provider-none.md | 5 ----- docs/adr/0010-preview-label-ownership.md | 6 ------ docs/adr/0011-agent-first-docs.md | 7 ------- docs/adr/0012-preview-db-roles-opt-in.md | 7 ------- docs/adr/0013-preview-access-gate.md | 2 +- docs/adr/README.md | 18 +++++++----------- docs/agents/issue-tracker.md | 10 +++++++--- 12 files changed, 28 insertions(+), 52 deletions(-) delete mode 100644 docs/adr/0007-preview-env-injection-names.md delete mode 100644 docs/adr/0009-preview-db-provider-none.md delete mode 100644 docs/adr/0010-preview-label-ownership.md delete mode 100644 docs/adr/0011-agent-first-docs.md delete mode 100644 docs/adr/0012-preview-db-roles-opt-in.md diff --git a/.agents/README.md b/.agents/README.md index 5cdd673b..dcb7e792 100644 --- a/.agents/README.md +++ b/.agents/README.md @@ -1,11 +1,17 @@ # Agent tooling -Vendored skills live in `.agents/skills/`; invoke by trigger: +Vendored skills live in `.agents/skills/`; invoke as each skill's frontmatter allows: -- `code-review`, `to-spec`, `to-tickets`, `triage`, `wayfinder` — tracker-backed workflow (see `docs/agents/issue-tracker.md`). +- `code-review` — review since a fixed point, Standards + Spec axes. - `documentation-writer` — every docs/prose task. - `emil-design-eng` — building or reviewing UI. -- `review-animations` — reviewing motion code; defaults to flagging. - `visual-pr` — PR bodies (policy in `AGENTS.md`). +User-invoked only (frontmatter disables model invocation); do not self-invoke: + +- `to-spec`, `to-tickets`, `triage`, `wayfinder` — tracker-backed workflow (see `docs/agents/issue-tracker.md`). +- `review-animations` — reviewing motion code; defaults to flagging. + Everything else in `.agents/skills/` is generic; invoke from its own description (or explicitly, where its frontmatter disables model invocation). + +A skill's `/setup-matt-pocock-skills` fallback means `docs/agents/issue-tracker.md`. diff --git a/AGENTS.md b/AGENTS.md index d410341c..3f01c826 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -38,5 +38,5 @@ bun run db:migrate # runtime migrator (apps/server; same as boot) - Code and comment style: `CODE-STYLE.md`. - Domain vocabulary: `CONTEXT.md`. Decisions: `docs/adr/` (only hard-to-reverse, hard-to-understand ones). - Issues: GitHub issues on `simpros/sprout` via `gh`; tracker spec and triage labels: `docs/agents/issue-tracker.md`. -- PRs: always describe with the `visual-pr` skill (`.agents/skills/visual-pr/`), even though it is explicit-invoke by default. `show-me` goes in a comment, never the body. -- Agent tooling (vendored skill index): `.agents/README.md`. Issue tracker operations: `docs/agents/issue-tracker.md`. +- PRs: always describe with the `visual-pr` skill (`.agents/skills/visual-pr/`). `show-me` goes in a comment, never the body. +- Agent tooling (vendored skill index): `.agents/README.md`. diff --git a/CODE-STYLE.md b/CODE-STYLE.md index e9e7f6a7..3f382e89 100644 --- a/CODE-STYLE.md +++ b/CODE-STYLE.md @@ -12,6 +12,7 @@ State the why only, and only when the code cannot say it. - No restating code, signatures or types. - No tickets, PRs, review feedback or people. No history ("previously", "now uses"). +- No ADR numbers in comments or test names; if the deviation matters, name the deviation. - No commented-out code. No "hack" / "for now" / emoji. - Keep real whys: invariants, ordering/locking, observed external behaviour, security tradeoffs, magic constants. diff --git a/docs/adr/0007-preview-env-injection-names.md b/docs/adr/0007-preview-env-injection-names.md deleted file mode 100644 index 5579c061..00000000 --- a/docs/adr/0007-preview-env-injection-names.md +++ /dev/null @@ -1,5 +0,0 @@ -# Adopter-configurable injection env names (`preview.env`) - -Superseded: the contract now lives in `docs/adopting-a-repo.md` (the -`preview.env` remap grammar and its `db.provider` / `db.roles` interaction). -This stub keeps the number so historical ADR-0007 citations still resolve. diff --git a/docs/adr/0008-preview-db-providers.md b/docs/adr/0008-preview-db-providers.md index 35bb7325..ec2c58b3 100644 --- a/docs/adr/0008-preview-db-providers.md +++ b/docs/adr/0008-preview-db-providers.md @@ -1,7 +1,6 @@ # Preview database providers: Postgres, SQLite, none -*Folds ADR-0009: `none` is the third provider value below, so ADR-0009 stays -as a stub pointer.* +*Folds ADR-0009: `none` is the third provider value below.* `db.provider` in `.sprout.yaml` (`postgres` default | `sqlite` | `none`) selects the backend per repo, not per gateway, so one gateway serves mixed fleets and a diff --git a/docs/adr/0009-preview-db-provider-none.md b/docs/adr/0009-preview-db-provider-none.md deleted file mode 100644 index fd7b0c7d..00000000 --- a/docs/adr/0009-preview-db-provider-none.md +++ /dev/null @@ -1,5 +0,0 @@ -# Previews without a database: `db.provider: none` - -Folded into ADR-0008: `none` is the third `db.provider` value there -(nullable `db_name`, fail-fast contradictions, fresh-generation switch). -This stub keeps the number so historical ADR-0009 citations still resolve. diff --git a/docs/adr/0010-preview-label-ownership.md b/docs/adr/0010-preview-label-ownership.md deleted file mode 100644 index 7c8b5a54..00000000 --- a/docs/adr/0010-preview-label-ownership.md +++ /dev/null @@ -1,6 +0,0 @@ -# Preview label ownership (`preview.labels`) - -Dropped from the log: the invariant lives in code (`resolveLabelCollisions`, -`apps/server/src/app-deployment/label-collisions.ts` — the reserved set is -derived from the emission seam so it cannot drift). This stub keeps the number -so historical ADR-0010 citations still resolve. diff --git a/docs/adr/0011-agent-first-docs.md b/docs/adr/0011-agent-first-docs.md deleted file mode 100644 index c0ab2dcc..00000000 --- a/docs/adr/0011-agent-first-docs.md +++ /dev/null @@ -1,7 +0,0 @@ -# Agent-first multi-page docs + onboarding prompt - -Dropped from the log: the page set and onboarding prompt live in -`docs/site/assemble.ts` (`publishFiles`) and `docs/onboarding-prompt.md`; -ADRs never reach published pages (`docs/site/adr-policy.ts` enforces it on -sources and rendered HTML). This stub keeps the number so historical ADR-0011 -citations still resolve. diff --git a/docs/adr/0012-preview-db-roles-opt-in.md b/docs/adr/0012-preview-db-roles-opt-in.md deleted file mode 100644 index 7b521f48..00000000 --- a/docs/adr/0012-preview-db-roles-opt-in.md +++ /dev/null @@ -1,7 +0,0 @@ -# Preview DB roles: restricted companion opt-in (`db.roles`) - -Folded out of the log: the contract lives in `docs/adopting-a-repo.md` and -the invariants in code (the one-rule derivation in `resolveDbRoles`, -`packages/preview-env/src/db.ts`; the dual/single name budget, -`apps/server/src/preview-db/names.ts`). This stub keeps the number so -historical ADR-0012 citations still resolve. diff --git a/docs/adr/0013-preview-access-gate.md b/docs/adr/0013-preview-access-gate.md index c74b3e81..968759d6 100644 --- a/docs/adr/0013-preview-access-gate.md +++ b/docs/adr/0013-preview-access-gate.md @@ -1,6 +1,6 @@ # Preview access gate is gateway-native (`preview.auth`) -Previews are open by default; `preview.auth` (`basic` | `link`) gates one +Previews are open by default (`preview.auth: none`); `basic` | `link` gates one preview via a per-preview Traefik middleware on the app router only. The gate lives in the gateway, not an external forward-auth service. That was diff --git a/docs/adr/README.md b/docs/adr/README.md index 1aaa5525..de3f891d 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -2,7 +2,7 @@ Record a decision here only when it is hard to reverse *and* hard to understand — everything else lives in `CONTEXT.md`, code docstrings, or the -normative spec issue. +normative spec issue. ADR numbers are immutable: never reuse a number. | ADR | Decision | |---|---| @@ -12,14 +12,10 @@ normative spec issue. | [0004](0004-ci-driven-lifecycle-no-webhooks.md) | Symmetric CI lifecycle; no forge webhooks in v0.1 | | [0005](0005-self-made-bearer-tokens.md) | Self-made bearer tokens in SQLite, not better-auth | | [0006](0006-sprout-durable-identity.md) | `sprout*` durable identity | -| [0007](0007-preview-env-injection-names.md) | Stub: superseded by `docs/adopting-a-repo.md` | +| 0007 | Retired → `docs/adopting-a-repo.md` (`preview.env` remap grammar) | | [0008](0008-preview-db-providers.md) | Preview database providers: Postgres, SQLite, none (folds 0009) | -| [0009](0009-preview-db-provider-none.md) | Stub: folded into 0008 | -| [0010](0010-preview-label-ownership.md) | Stub: invariant in `apps/server/src/app-deployment/label-collisions.ts` | -| [0011](0011-agent-first-docs.md) | Stub: page set in `docs/site/assemble.ts`, prompt in `docs/onboarding-prompt.md` | -| [0012](0012-preview-db-roles-opt-in.md) | Stub: contract in `docs/adopting-a-repo.md`, invariants in code | -| [0013](0013-preview-access-gate.md) | Preview access gate: per-preview `basic` / `link`, gateway-native | - -History: ADR numbers are immutable. 0010/0011 survive as stubs above; the -label-collision invariant lives in code, the page set and onboarding prompt -where the 0011 stub points. +| 0009 | Retired → ADR-0008 | +| 0010 | Retired → `apps/server/src/app-deployment/label-collisions.ts` (reserved set derived from the emission seam) | +| 0011 | Retired → `docs/site/assemble.ts` (`publishFiles`) and `docs/onboarding-prompt.md` | +| 0012 | Retired → `docs/adopting-a-repo.md` (`db.roles` contract) and `packages/preview-env/src/db.ts` | +| [0013](0013-preview-access-gate.md) | Preview access gate: per-preview `none` default \| `basic` \| `link`, gateway-native | diff --git a/docs/agents/issue-tracker.md b/docs/agents/issue-tracker.md index 2418dcfb..69bdacb4 100644 --- a/docs/agents/issue-tracker.md +++ b/docs/agents/issue-tracker.md @@ -8,6 +8,10 @@ Operations: `gh issue view|comment|close|edit`; tickets = `gh issue create`. ## Wayfinding operations -Parent map = one open issue titled `Map: `. The skill's `wayfinder:map` and `wayfinder:` labels do not exist in this repo — omit `--label`, name the ticket type in the body instead. Child = issue with `Part of #` in the body. Blocking = `Blocked by: #` line in the body (not a comment). Frontier = open unassigned child with no open issue in its `Blocked by` line. Claim = assign to yourself first. Resolve = comment the answer, close, append a pointer to the map's Decisions-so-far. - -A skill's `/setup-matt-pocock-skills` fallback means this file; that skill no longer exists here. +- Parent map = one open issue titled `Map: `. +- The skill's `wayfinder:map` and `wayfinder:` labels do not exist in this repo — omit `--label`, name the ticket type in the body instead. +- Child = issue with `Part of #` in the body. +- Blocking = `Blocked by: #` line in the body (not a comment). +- Frontier = open unassigned child with no open issue in its `Blocked by` line. +- Claim = assign to yourself first. +- Resolve = comment the answer, close, append a pointer to the map's Decisions-so-far. From 6ebcf410ba4a21ee37abad044b338b13eb4a5303 Mon Sep 17 00:00:00 2001 From: simpros <38320875+simpros@users.noreply.github.com> Date: Thu, 29 Oct 2026 18:16:51 +0100 Subject: [PATCH 08/11] address review feedback on #282 Round-7 finding 1: drop the hand-synced invocation-mode enumeration from .agents/README.md (it listed 5 of 9 disable-model-invocation skills, misrouting the 4 omitted ones under the generic line). Mode is now stated once at :3 ('invoke as each skill's frontmatter allows'); routing list carries no mode claim. Fold the unheaded /setup-matt-pocock-skills trailing sentence into the tracker bullet. --- .agents/README.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.agents/README.md b/.agents/README.md index dcb7e792..d303e4d5 100644 --- a/.agents/README.md +++ b/.agents/README.md @@ -6,12 +6,7 @@ Vendored skills live in `.agents/skills/`; invoke as each skill's frontmatter al - `documentation-writer` — every docs/prose task. - `emil-design-eng` — building or reviewing UI. - `visual-pr` — PR bodies (policy in `AGENTS.md`). - -User-invoked only (frontmatter disables model invocation); do not self-invoke: - -- `to-spec`, `to-tickets`, `triage`, `wayfinder` — tracker-backed workflow (see `docs/agents/issue-tracker.md`). +- `to-spec`, `to-tickets`, `triage`, `wayfinder` — tracker-backed workflow (see `docs/agents/issue-tracker.md`; a skill's `/setup-matt-pocock-skills` fallback means that file). - `review-animations` — reviewing motion code; defaults to flagging. -Everything else in `.agents/skills/` is generic; invoke from its own description (or explicitly, where its frontmatter disables model invocation). - -A skill's `/setup-matt-pocock-skills` fallback means `docs/agents/issue-tracker.md`. +Everything else in `.agents/skills/` is generic; invoke from its own description. From a7206299c54a65910e51e896892560828425a31e Mon Sep 17 00:00:00 2001 From: simpros <38320875+simpros@users.noreply.github.com> Date: Thu, 29 Oct 2026 18:24:32 +0100 Subject: [PATCH 09/11] address review feedback on #282 Round-8: drop the generic-invocation sentence in .agents/README.md so frontmatter owns invocation policy; restate the inline-comment rule as one claim (wrap as needed) to match the tree. --- .agents/README.md | 2 -- CODE-STYLE.md | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.agents/README.md b/.agents/README.md index d303e4d5..0860e924 100644 --- a/.agents/README.md +++ b/.agents/README.md @@ -8,5 +8,3 @@ Vendored skills live in `.agents/skills/`; invoke as each skill's frontmatter al - `visual-pr` — PR bodies (policy in `AGENTS.md`). - `to-spec`, `to-tickets`, `triage`, `wayfinder` — tracker-backed workflow (see `docs/agents/issue-tracker.md`; a skill's `/setup-matt-pocock-skills` fallback means that file). - `review-animations` — reviewing motion code; defaults to flagging. - -Everything else in `.agents/skills/` is generic; invoke from its own description. diff --git a/CODE-STYLE.md b/CODE-STYLE.md index 3f382e89..848d6f11 100644 --- a/CODE-STYLE.md +++ b/CODE-STYLE.md @@ -16,5 +16,5 @@ State the why only, and only when the code cannot say it. - No commented-out code. No "hack" / "for now" / emoji. - Keep real whys: invariants, ordering/locking, observed external behaviour, security tradeoffs, magic constants. -- Inline comments: one line. Module/function docstrings: one invariant, no headings or bullet lists. Longer reasoning is a decision: put it in `CONTEXT.md` or an ADR. +- Inline comments: one claim; wrap as needed. Module/function docstrings: one invariant, no headings or bullet lists. Longer reasoning is a decision: put it in `CONTEXT.md` or an ADR. - A comment that contradicts the code is a bug; fix one of them. From 710e824710b11cece45ebbfca841e59e6253a22e Mon Sep 17 00:00:00 2001 From: simpros <38320875+simpros@users.noreply.github.com> Date: Thu, 29 Oct 2026 18:35:12 +0100 Subject: [PATCH 10/11] address review feedback on #282 round-9: fold db.roles read-permissive invariant into ADR-0008 plus names.ts docstrings; move setup-skill shim to issue-tracker.md; point retired ADR rows at stable docs; fix 0002 sprout_ prefix --- .agents/README.md | 2 +- apps/server/src/preview-db/names.ts | 2 ++ docs/adr/0002-shared-logical-databases.md | 2 +- docs/adr/0008-preview-db-providers.md | 7 +++++++ docs/adr/README.md | 6 +++--- docs/agents/issue-tracker.md | 2 ++ 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.agents/README.md b/.agents/README.md index 0860e924..d0da12f0 100644 --- a/.agents/README.md +++ b/.agents/README.md @@ -6,5 +6,5 @@ Vendored skills live in `.agents/skills/`; invoke as each skill's frontmatter al - `documentation-writer` — every docs/prose task. - `emil-design-eng` — building or reviewing UI. - `visual-pr` — PR bodies (policy in `AGENTS.md`). -- `to-spec`, `to-tickets`, `triage`, `wayfinder` — tracker-backed workflow (see `docs/agents/issue-tracker.md`; a skill's `/setup-matt-pocock-skills` fallback means that file). +- `to-spec`, `to-tickets`, `triage`, `wayfinder` — tracker-backed workflow (see `docs/agents/issue-tracker.md`). - `review-animations` — reviewing motion code; defaults to flagging. diff --git a/apps/server/src/preview-db/names.ts b/apps/server/src/preview-db/names.ts index 533092f8..c67cb154 100644 --- a/apps/server/src/preview-db/names.ts +++ b/apps/server/src/preview-db/names.ts @@ -50,6 +50,7 @@ export function validatePreviewIdentity( return null; } +/** Reads stay permissive at the full identifier budget on purpose: a repo flipped to single must still list and drop previews created while dual. */ export function isPreviewDbName(dbName: string): boolean { return ( PREVIEW_DB_NAME_RE.test(dbName) && @@ -63,6 +64,7 @@ export function assertPreviewDbName(dbName: string): void { } } +/** Same permissive read budget as isPreviewDbName: never strand historical rows on a mode flip. */ export function parsePreviewDatabaseName( datname: string, ): { slug: string; prId: number } | null { diff --git a/docs/adr/0002-shared-logical-databases.md b/docs/adr/0002-shared-logical-databases.md index f7b58d61..ac3802ae 100644 --- a/docs/adr/0002-shared-logical-databases.md +++ b/docs/adr/0002-shared-logical-databases.md @@ -1,6 +1,6 @@ # Shared instance with logical per-PR databases -Each preview gets its own **logical database** (`prev__pr`) on one +Each preview gets its own **logical database** (`sprout__pr`) on one shared Postgres instance. sprout does not spawn Postgres containers per PR in v0.1. diff --git a/docs/adr/0008-preview-db-providers.md b/docs/adr/0008-preview-db-providers.md index ec2c58b3..87007508 100644 --- a/docs/adr/0008-preview-db-providers.md +++ b/docs/adr/0008-preview-db-providers.md @@ -16,3 +16,10 @@ the plan and never branch on provider. `sqlite`) fail fast at manifest parse and at the deploy route. - Switching provider redeploys as a fresh generation: the old backend is dropped before the new one is created. + +`db.roles` selects the Postgres credential axis (`single` | `dual`; contract in +`docs/adopting-a-repo.md`, derivation in `resolveDbRoles`). Name validation is +mode-scoped — `dual` reserves budget for the `_app` companion role — +while catalog reads stay permissive at the full identifier budget, so flipping +a repo to `single` never makes existing previews unlistable or undeletable and +teardown still drops a companion role left over from `dual`. diff --git a/docs/adr/README.md b/docs/adr/README.md index de3f891d..cfc3ad1e 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -15,7 +15,7 @@ normative spec issue. ADR numbers are immutable: never reuse a number. | 0007 | Retired → `docs/adopting-a-repo.md` (`preview.env` remap grammar) | | [0008](0008-preview-db-providers.md) | Preview database providers: Postgres, SQLite, none (folds 0009) | | 0009 | Retired → ADR-0008 | -| 0010 | Retired → `apps/server/src/app-deployment/label-collisions.ts` (reserved set derived from the emission seam) | -| 0011 | Retired → `docs/site/assemble.ts` (`publishFiles`) and `docs/onboarding-prompt.md` | -| 0012 | Retired → `docs/adopting-a-repo.md` (`db.roles` contract) and `packages/preview-env/src/db.ts` | +| 0010 | Retired → `docs/previews.md` (Preview labels: reserved set derived from the gateway's label emission) | +| 0011 | Retired → `docs/onboarding-prompt.md` (page set lives in `docs/site/assemble.ts` `publishFiles`) | +| 0012 | Retired → ADR-0008 (`db.roles` invariant) and `docs/adopting-a-repo.md` (`db.roles` contract) | | [0013](0013-preview-access-gate.md) | Preview access gate: per-preview `none` default \| `basic` \| `link`, gateway-native | diff --git a/docs/agents/issue-tracker.md b/docs/agents/issue-tracker.md index 69bdacb4..66e082c8 100644 --- a/docs/agents/issue-tracker.md +++ b/docs/agents/issue-tracker.md @@ -1,5 +1,7 @@ # Issue tracker: GitHub +This file is what `/setup-matt-pocock-skills` would have generated; when a skill asks for that setup, read this file instead. + Issues for this repo live as GitHub issues on `simpros/sprout`. Use `gh` for all operations. PRs as a request surface: no. Triage labels: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`. From 1429aa3088603fa7f459513233e0b1d535c7b8c9 Mon Sep 17 00:00:00 2001 From: simpros <38320875+simpros@users.noreply.github.com> Date: Thu, 29 Oct 2026 18:46:43 +0100 Subject: [PATCH 11/11] address review feedback on #282 Correct the db.roles read-budget invariant direction (round 10): reads are permissive so a single-era row survives a later flip to dual, not the reverse. Teardown direction split into its own sentence; name the owning package for resolveDbRoles. --- apps/server/src/preview-db/names.ts | 4 ++-- docs/adr/0008-preview-db-providers.md | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/server/src/preview-db/names.ts b/apps/server/src/preview-db/names.ts index c67cb154..3ec26ba0 100644 --- a/apps/server/src/preview-db/names.ts +++ b/apps/server/src/preview-db/names.ts @@ -50,7 +50,7 @@ export function validatePreviewIdentity( return null; } -/** Reads stay permissive at the full identifier budget on purpose: a repo flipped to single must still list and drop previews created while dual. */ +/** Reads take no mode: a row created while `single` may run to `PG_IDENT_MAX`, so list/teardown must accept the full budget or a later flip to `dual` strands it. */ export function isPreviewDbName(dbName: string): boolean { return ( PREVIEW_DB_NAME_RE.test(dbName) && @@ -64,7 +64,7 @@ export function assertPreviewDbName(dbName: string): void { } } -/** Same permissive read budget as isPreviewDbName: never strand historical rows on a mode flip. */ +/** Same permissive budget as isPreviewDbName (see above): reads take no mode. */ export function parsePreviewDatabaseName( datname: string, ): { slug: string; prId: number } | null { diff --git a/docs/adr/0008-preview-db-providers.md b/docs/adr/0008-preview-db-providers.md index 87007508..dc9006e1 100644 --- a/docs/adr/0008-preview-db-providers.md +++ b/docs/adr/0008-preview-db-providers.md @@ -18,8 +18,10 @@ the plan and never branch on provider. before the new one is created. `db.roles` selects the Postgres credential axis (`single` | `dual`; contract in -`docs/adopting-a-repo.md`, derivation in `resolveDbRoles`). Name validation is -mode-scoped — `dual` reserves budget for the `_app` companion role — -while catalog reads stay permissive at the full identifier budget, so flipping -a repo to `single` never makes existing previews unlistable or undeletable and -teardown still drops a companion role left over from `dual`. +`docs/adopting-a-repo.md`, derivation in `@sprout/preview-env` `resolveDbRoles`). +Name validation is mode-scoped — `dual` reserves budget for the `_app` +companion role — while catalog reads (`isPreviewDbName`/`parsePreviewDatabaseName`) +take no mode and accept the full identifier budget: a row created while `single` +may run to `PG_IDENT_MAX`, so a later flip to `dual` must not make it unlistable. +Teardown drops the companion role unconditionally, so a preview created while +`dual` still cleans up after the repo flips to `single`.