design-spine 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Elizabeth Stein
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,118 @@
1
- # Temporary Holding Version
1
+ # Design Spine
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Look at every screen before you ship it.
4
+
5
+ Design Spine screenshots every route of your Next.js app in every state, width and theme, flags what broke, and gives you one contact sheet to approve or reject each screen. Approved screens become baselines, and `spine diff` fails CI when a screen drifts from what a person approved.
6
+
7
+ Everything runs on your machine. No account, no upload, no per-snapshot bill.
8
+
9
+ ![Design Spine contact sheet](docs/images/contact-sheet.png)
10
+
11
+ ## Why
12
+
13
+ Most UI gets built and checked in one state: the happy path, at desktop width, in light mode. AI coding agents make this worse, because they build screen by screen and never open the 390px dark-mode empty state. Design Spine makes the full matrix visible and makes "someone looked at it" a recorded fact instead of a hope.
14
+
15
+ ## Quick start
16
+
17
+ Requires [Bun](https://bun.sh) 1.3+ and a running copy of your app.
18
+
19
+ ```bash
20
+ npm install -D design-spine
21
+ npx playwright install chromium
22
+
23
+ npx spine plan # reads app/ and drafts design-spine.json
24
+ npx spine capture # screenshots route x state x 390/1280 x light/dark
25
+ npx spine review # opens the contact sheet at http://localhost:4747
26
+ ```
27
+
28
+ In the contact sheet, press `j`/`k` to move, `a` to approve, `r` to reject and `Enter` to inspect a screenshot at full size against its baseline.
29
+
30
+ ## What it checks on every screenshot
31
+
32
+ - HTTP errors, redirects and failed captures
33
+ - Console errors and uncaught page errors
34
+ - Horizontal overflow (the classic mobile bug)
35
+ - Near-blank regions, such as cards that rendered empty
36
+ - Broken images and clipped text
37
+ - Fixed overlays covering content, such as cookie banners and chat widgets
38
+ - Optional: axe accessibility scan, repeat-capture stability, and a Claude vision critique
39
+
40
+ Automatic checks never count as approval. Only a person approves.
41
+
42
+ ## Reach the states nobody opens
43
+
44
+ Empty, loading and error states need data. Describe them in `design-spine.json` with mocked responses and interaction steps instead of seeding a database:
45
+
46
+ ```json
47
+ {
48
+ "path": "/dashboard",
49
+ "states": [
50
+ { "name": "ideal", "storageState": "auth/populated.json" },
51
+ {
52
+ "name": "error",
53
+ "responses": [{ "url": "**/api/dashboard", "status": 503, "body": "Unavailable" }],
54
+ "ready": { "selector": "[role=alert]" }
55
+ }
56
+ ]
57
+ }
58
+ ```
59
+
60
+ `spine doctor` lists every state you have not made capturable yet, so missing coverage stays visible instead of silently passing.
61
+
62
+ ## Gate CI on approved screens
63
+
64
+ ```bash
65
+ spine approve # approved tiles become baselines
66
+ spine diff # exit 1 when a screen differs from its approved baseline
67
+ spine diff --strict # also require full coverage and a person's approval on this run
68
+ spine report --out review.html # portable offline record of what was approved and why
69
+ ```
70
+
71
+ In CI, add the action after the step that starts your app, and commit `design-spine.json` and `.design-spine/baselines/`:
72
+
73
+ ```yaml
74
+ - run: npm run build && (npm start &) && npx wait-on http://localhost:3000
75
+ - uses: forbiddenlink/design-spine@main
76
+ with:
77
+ base-url: http://localhost:3000
78
+ ```
79
+
80
+ The job fails when any screen changes from its approved baseline, and uploads the run as an artifact. To accept a change, download the artifact into `.design-spine/runs/`, run `spine review --run <id>`, approve, then `spine approve --run <id>` and commit the new baselines. Fonts render differently on macOS and Linux, so approve baselines from a CI (Linux) run.
81
+
82
+ ## Commands
83
+
84
+ | Command | What it does |
85
+ |---|---|
86
+ | `plan` | Drafts `design-spine.json` from `app/` or `src/app/` |
87
+ | `doctor` | Validates the manifest and lists unfinished coverage, without a browser |
88
+ | `capture` | Screenshots every route x state x viewport x theme and runs the checks |
89
+ | `review` | Local contact sheet for approve, reject and notes |
90
+ | `critique` | Optional Claude vision pass through the `claude` CLI |
91
+ | `approve` | Promotes approved tiles to baselines |
92
+ | `diff` | Compares a run with baselines; `--strict` requires complete approved evidence |
93
+ | `report` | Self-contained HTML record of a review |
94
+ | `lint` | Ratchet on arbitrary Tailwind values such as `w-[37px]` |
95
+ | `status` | Writes `.design-spine/status.json` for dashboards |
96
+
97
+ Full reference: [docs/USAGE.md](docs/USAGE.md).
98
+
99
+ ## How it compares
100
+
101
+ | | Design Spine | Chromatic, Percy, Argos | Playwright `toHaveScreenshot` |
102
+ |---|---|---|---|
103
+ | Runs locally, no upload | Yes | No | Yes |
104
+ | Plans the route x state matrix from your app | Yes | No | No |
105
+ | Human approval ledger per screenshot | Yes | Yes, in the cloud | No |
106
+ | Coverage gaps shown as unfinished | Yes | No | No |
107
+ | Needs Storybook | No | Chromatic: mostly | No |
108
+ | Pricing | Free | Per snapshot | Free |
109
+
110
+ ## Limits
111
+
112
+ - Next.js App Router only for `plan`. Other apps can write the manifest by hand.
113
+ - Chromium only. Tested on macOS, and the test suite runs on Linux in CI. Windows is not verified.
114
+ - Requires Bun to run the CLI.
115
+
116
+ ## License
117
+
118
+ MIT
package/bin/spine.js ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ // Thin launcher: Design Spine needs Bun (HTML imports, Bun.serve), so hand off to it.
3
+ import { spawnSync } from 'node:child_process'
4
+ import { fileURLToPath } from 'node:url'
5
+
6
+ const MESSAGE = 'Design Spine runs on Bun 1.3+. Install: curl -fsSL https://bun.sh/install | bash'
7
+ const cli = fileURLToPath(new URL('../src/cli.ts', import.meta.url))
8
+ const version = spawnSync('bun', ['--version'], { encoding: 'utf8' })
9
+ const [major = 0, minor = 0] = (version.stdout ?? '').trim().split('.').map(Number)
10
+ if (version.error || version.status !== 0 || major < 1 || (major === 1 && minor < 3)) {
11
+ console.error(MESSAGE)
12
+ process.exit(1)
13
+ }
14
+ const result = spawnSync('bun', [cli, ...process.argv.slice(2)], { stdio: 'inherit' })
15
+ process.exit(result.status ?? 1)
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "design-spine",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Screenshot every route and state of your Next.js app, then approve each screen by eye. Local, no account.",
5
+ "license": "MIT",
6
+ "author": "Elizabeth Stein",
7
+ "homepage": "https://github.com/forbiddenlink/design-spine#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/forbiddenlink/design-spine.git"
11
+ },
12
+ "bugs": "https://github.com/forbiddenlink/design-spine/issues",
13
+ "keywords": [
14
+ "visual-regression",
15
+ "screenshot",
16
+ "nextjs",
17
+ "playwright",
18
+ "design-review",
19
+ "ui-testing",
20
+ "cli",
21
+ "claude-code"
22
+ ],
23
+ "files": [
24
+ "bin/",
25
+ "src/",
26
+ "README.md",
27
+ "LICENSE"
28
+ ],
29
+ "packageManager": "pnpm@12.6.0",
30
+ "engines": {
31
+ "node": ">=22.12",
32
+ "bun": ">=1.3.13"
33
+ },
34
+ "type": "module",
35
+ "bin": {
36
+ "spine": "bin/spine.js"
37
+ },
38
+ "scripts": {
39
+ "build": "bun build --compile src/cli.ts src/lib/comparison-worker.ts --external 'chromium-bidi/*' --external electron --define 'import.meta.spineWorker=\"./lib/comparison-worker.js\"' --outfile dist/spine",
40
+ "spine": "bun src/cli.ts",
41
+ "test": "vitest run",
42
+ "lint": "biome check .",
43
+ "format": "biome format --write ."
44
+ },
45
+ "dependencies": {
46
+ "@axe-core/playwright": "^4.13.0",
47
+ "commander": "^15.0.0",
48
+ "pixelmatch": "^7.2.0",
49
+ "playwright": "^1.63.0",
50
+ "pngjs": "^7.0.0"
51
+ },
52
+ "devDependencies": {
53
+ "@biomejs/biome": "^2.5.15",
54
+ "@types/bun": "^1.4.2",
55
+ "@types/pngjs": "^6.0.5",
56
+ "typescript": "^7.0.2",
57
+ "vitest": "^5.0.3"
58
+ }
59
+ }
@@ -0,0 +1,3 @@
1
+ interface ImportMeta {
2
+ readonly spineWorker?: string
3
+ }