@westonkd/sprint 0.1.1

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 Weston Dransfield
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 ADDED
@@ -0,0 +1,146 @@
1
+ # Sprint
2
+
3
+ A React component library for products that people and AI agents both use. Sprint components
4
+ look and behave like any other interface, and can describe themselves to an agent on request.
5
+
6
+ Status: experimental. A full catalog of components on top of the agent runtime, verified in jsdom
7
+ and normal browsers; no real WebMCP implementation has accepted a descriptor yet.
8
+
9
+ ## What a Sprint component does
10
+
11
+ - **Two views, one component.** Humans see the rendered interface; agents switch the same
12
+ component to a minimal text view, with no second implementation behind it.
13
+ - **Names you can rely on.** A `div` tells an agent nothing; every Sprint component publishes
14
+ its identity, parts, and current state as attributes it promises not to rename.
15
+ - **Actions, not clicks.** In Chrome 149 a component registers what it can do with the browser,
16
+ so an agent calls the action instead of aiming a click at it.
17
+
18
+ ```tsx
19
+ <Button tone="action" block onClick={prepare}>Prepare launch</Button>
20
+ ```
21
+
22
+ A person sees a flat acid action bar. Flip the containing provider to agent view and the same
23
+ component renders as text, with no HTML elements at all:
24
+
25
+ ```
26
+ - **Button** "Prepare launch" [block, tone=action] → tool `press-prepare-launch`
27
+ ```
28
+
29
+ Both renderings are built from one `AgentNode` created during the same render, so they cannot
30
+ disagree. The tool name comes from the button's own label. Nothing here is written by hand, and
31
+ switching views does not unmount anything: `press-prepare-launch` stays registered in both.
32
+
33
+ ```tsx
34
+ <SprintProvider view={agentMode ? "agent" : "human"}>
35
+ ```
36
+
37
+ An agent with WebMCP can flip it itself by calling `set-page-view`.
38
+
39
+ ## If you are an agent
40
+
41
+ Everything on the published site is there for you to read directly. Start with the manifest.
42
+
43
+ - [`agent-manifest.json`](https://westonkd.github.io/sprint/agent-manifest.json) — every
44
+ component, what it is for, when not to use it, and the tools it registers.
45
+ - [`llms.txt`](https://westonkd.github.io/sprint/llms.txt) — the same catalogue as plain text,
46
+ in one request.
47
+ - [`components/Button.md`](https://westonkd.github.io/sprint/components/Button.md) — one
48
+ Markdown page per component, if you only need one.
49
+ - [The workbench as text](https://westonkd.github.io/sprint/workbench.html#/?view=agent) — any
50
+ documentation page, rendered as the text you would read.
51
+
52
+ In Chrome 149 the components on the site also register their actions as WebMCP tools, so you
53
+ can call them rather than click them.
54
+
55
+ ## Requirements
56
+
57
+ Docker with Compose v2. Nothing else, everything runs in containers.
58
+
59
+ ## Getting started
60
+
61
+ ```bash
62
+ docker compose watch dev
63
+ ```
64
+
65
+ Use `watch` rather than `up`. Compose syncs your edits into the container as you save them; plain
66
+ `up` serves the snapshot baked into the image.
67
+
68
+ The workbench serves on http://localhost:5173. It is the documentation. Component pages are
69
+ generated entirely from `agent-manifest.json` — props, state attributes, tool descriptors, and every
70
+ code snippet come from the same metadata an agent reads. Each example can be toggled between the
71
+ human and agent view, individually or a whole page at once.
72
+
73
+ Four written guides sit alongside them:
74
+
75
+ - **WebMCP** — the platform API: both forms, availability, hard limits, and security.
76
+ - **Integration philosophy** — the decisions behind how Sprint uses it, and what each costs.
77
+ - **Composing a page** — Shell, PageHeader, Panel, and Stack, top down.
78
+ - **Composing a form** — fields, tool naming, and the submit lifecycle.
79
+
80
+ ```bash
81
+ docker compose run --rm verify
82
+ ```
83
+
84
+ Runs typecheck, lint, tests, and the library build.
85
+
86
+ ```bash
87
+ docker compose run --rm format
88
+ ```
89
+
90
+ Applies Biome's safe fixes, formatting, and import sorting in place.
91
+
92
+ ## Layout
93
+
94
+ ```
95
+ src/
96
+ agent/
97
+ attributes.ts the data-sprint* contract
98
+ registry.ts component metadata, manifest assembly
99
+ view/ agent view: DOM serializer and Markdown formatter
100
+ webmcp/ the single document.modelContext call site, plus useAgentTool
101
+ components/ one directory each, see Button for the reference shape
102
+ provider/ SprintProvider, AgentRegion, page-level read tools
103
+ styles/ token primitives, semantic roles, base resets
104
+ test/ Vitest setup and the WebMCP test double
105
+ dev/ local workbench, not published
106
+ scripts/ manifest generation, build output checks
107
+ ```
108
+
109
+ ## Consuming it
110
+
111
+ React 19 and TypeScript, no runtime dependencies. Not published to npm yet. Once it is, the
112
+ package name is `@westonkd/sprint`:
113
+
114
+ ```tsx
115
+ import { Button, SprintProvider } from "@westonkd/sprint";
116
+ import "@westonkd/sprint/styles.css";
117
+ ```
118
+
119
+ ```ts
120
+ import manifest from "@westonkd/sprint/agent-manifest.json" with { type: "json" };
121
+ ```
122
+
123
+ Wrap your app in `SprintProvider` to register the page-level `list-page-regions` and `read-region`
124
+ tools. Components work without it.
125
+
126
+ ## WebMCP
127
+
128
+ Tools use the [web platform WebMCP API](https://developer.chrome.com/docs/ai/webmcp)
129
+ (`document.modelContext`), which currently ships in Chrome 149 behind an origin trial or
130
+ `chrome://flags/#enable-webmcp-testing`. Everywhere else, registration is a no-op and the components
131
+ work normally — the agent view does not depend on it.
132
+
133
+ ## Documentation
134
+
135
+ The site is published at [westonkd.github.io/sprint](https://westonkd.github.io/sprint/): a
136
+ landing page, the workbench with live documentation for every component, and the agent surfaces
137
+ listed above.
138
+
139
+ - [AGENTS.md](AGENTS.md) — contribution workflow and the agent contract.
140
+ - `.claude/skills/sprint/references/PRD.md` — what this is and why.
141
+ - `.claude/skills/sprint/references/DESIGN.md` — the visual language.
142
+ - `.claude/skills/sprint/references/ADR/` — why it is built this way.
143
+
144
+ ## License
145
+
146
+ [MIT](LICENSE)