diff --git a/.claude/settings.json b/.claude/settings.json index d830974e36..d5b77b87ab 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -25,6 +25,16 @@ "timeout": 10 } ] + }, + { + "matcher": "Read|Bash|Edit|Write|MultiEdit|NotebookEdit", + "hooks": [ + { + "type": "command", + "command": "\"$CLAUDE_PROJECT_DIR\"/scripts/hooks/design-guide-first.sh", + "timeout": 10 + } + ] } ] } diff --git a/.github/workflows/design-contract.yml b/.github/workflows/design-contract.yml index f47aa2e7c7..545f164121 100644 --- a/.github/workflows/design-contract.yml +++ b/.github/workflows/design-contract.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/setup-node@v7 with: node-version: 22 - - name: Check public tokens, contrast and bundled agent marks + - name: Check public tokens, contrast, bundled agent marks and raw controls run: | node scripts/check-design-contract.mjs - node --test scripts/tests/token-contrast.test.mjs + node --test scripts/tests/token-contrast.test.mjs scripts/tests/ui-parts.test.mjs diff --git a/AGENTS.md b/AGENTS.md index d4de71a4af..78c876b17a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -186,11 +186,11 @@ Conventions: ## Design Reference Read [docs/UI_BEHAVIOR.md](docs/UI_BEHAVIOR.md) before changing any surface a user looks at; it owns what the UI does. -Read [docs/DESIGN_WORKFLOW.md](docs/DESIGN_WORKFLOW.md) before making a design change; it owns how a change moves from scratch to a shipped PR, including the token/System-part/Component procedures and the screen transplant procedure. +Read [docs/DESIGN_GUIDE.md](docs/DESIGN_GUIDE.md) before changing a screen or a token; it says which part to build from and the rules that keep screens alike, and a `PreToolUse` hook (`scripts/hooks/design-guide-first.sh`, registered for Claude Code in `.claude/settings.json` and for Codex in `~/.codex/hooks.json`) refuses the first such edit of a session until it has been read. +Read [docs/DESIGN_WORKFLOW.md](docs/DESIGN_WORKFLOW.md) before making a design change; it owns how a change moves from proposal to a shipped PR and how it is visually reviewed. Numeric authority is `design/tokens.json`, and code authority is `web/src/components/ui` and `web/src/components`. `scripts/gen-tokens.mjs` writes `web/src/tokens.css` and `web/src/generated/accents.ts` from the tokens. Run `node scripts/check-design-contract.mjs` before delivery; it is the entrypoint `design-contract.yml` runs. -Original design boards, proposal tools and maintainer skills are maintained separately. -The public checkout must build and pass its gates without access to them. -Use the production gallery and isolated app captures for public visual review, following [DESIGN_WORKFLOW.md](docs/DESIGN_WORKFLOW.md). +The public checkout builds and passes its gates without any design tool or private repository. +The production gallery and isolated app captures are the visual reference and the review evidence, following [DESIGN_WORKFLOW.md](docs/DESIGN_WORKFLOW.md). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2548d21bd9..66f1379038 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -74,7 +74,7 @@ The rest of this file is for the people who open pull requests. hide is a macOS app over the [Herdr](https://herdr.dev) runtime. The Rust core in `herdr-core/` owns every piece of state; the `hided` daemon serves a snapshot of it to the web shell in `web/`, which the Electron host in `desktop/` shows in its own window and dispatches typed events back from. `AGENTS.md` keeps the rules; [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) owns the architecture and the Herdr wire boundary with their reasons, [docs/BUILD.md](docs/BUILD.md) the build output and worktree rules, and [docs/PERFORMANCE_TESTING.md](docs/PERFORMANCE_TESTING.md) the performance rules that came out of real incidents. -Read `AGENTS.md` and the architecture guide before changing anything under `herdr-core/`, `hided/` or `desktop/`; [docs/UI_BEHAVIOR.md](docs/UI_BEHAVIOR.md) before changing anything a user looks at, and [docs/DESIGN_WORKFLOW.md](docs/DESIGN_WORKFLOW.md) before making a design change. +Read `AGENTS.md` and the architecture guide before changing anything under `herdr-core/`, `hided/` or `desktop/`; [docs/UI_BEHAVIOR.md](docs/UI_BEHAVIOR.md) before changing anything a user looks at, [docs/DESIGN_GUIDE.md](docs/DESIGN_GUIDE.md) before changing a screen or a token, and [docs/DESIGN_WORKFLOW.md](docs/DESIGN_WORKFLOW.md) before making a design change. Use [docs/README.md](docs/README.md) to find current guides and distinguish historical/reference-only material. ## Before you open a pull request @@ -280,9 +280,8 @@ It starts only private Herdr servers and a loopback SSH account, with no externa The additional gates that read an existing Herdr server, drive an installed app, or reach an external device are local steps and are not required in CI. They are listed under "Local gates" below; every script in `scripts/` is either a required gate above, a local gate there, or a generator named in [docs/DESIGN_WORKFLOW.md](docs/DESIGN_WORKFLOW.md). -The separate `design-contract.yml` workflow runs `node scripts/check-design-contract.mjs` and `node --test scripts/tests/token-contrast.test.mjs`. -The shared entrypoint checks public web token usage, token contrast and bundled agent marks through `check-web-tokens.mjs`, `check-token-contrast.mjs` and `check-agent-logos.mjs`. -Original design boards and their authoring tools are maintained separately with their own checks. +The separate `design-contract.yml` workflow runs `node scripts/check-design-contract.mjs` and `node --test scripts/tests/token-contrast.test.mjs scripts/tests/ui-parts.test.mjs`. +The shared entrypoint checks public web token usage, token contrast, bundled agent marks and raw controls outside the parts through `check-web-tokens.mjs`, `check-token-contrast.mjs`, `check-agent-logos.mjs` and `check-ui-parts.mjs`. Public builds and contribution checks require no private repository or design-tool login. These are static checks; [docs/DESIGN_WORKFLOW.md](docs/DESIGN_WORKFLOW.md) owns visual review with the production gallery and isolated app captures. diff --git a/docs/DESIGN_GUIDE.md b/docs/DESIGN_GUIDE.md new file mode 100644 index 0000000000..563a7e9b85 --- /dev/null +++ b/docs/DESIGN_GUIDE.md @@ -0,0 +1,86 @@ +# Design guide + +Read this before changing anything a user looks at in `web/src` or a value in `design/tokens.json`. +It says which part to build a screen from and the few rules that keep screens alike. +[UI_BEHAVIOR.md](UI_BEHAVIOR.md) owns what each screen does; [DESIGN_WORKFLOW.md](DESIGN_WORKFLOW.md) owns how a change is proposed, reviewed and delivered. +A project hook refuses the first edit of a web source or the tokens in an agent session until this file has been read in that session (`scripts/hooks/design-guide-first.sh`). + +## Three rules + +1. Build from a part in `web/src/components/ui`, and from a product composite in `web/src/components` when one already draws the thing. + When no part fits, extend the part (a variant, a size, a slot) with its gallery states in the same pull request; never restyle a raw `