@reqvire-org/ads 0.3.25 → 0.3.27
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/README.md +28 -15
- package/dist/bootstrap-ds/ADS.md +28 -30
- package/dist/bootstrap-ds/README.md +13 -11
- package/dist/bootstrap-ds/design-system/assets/brand/README.md +3 -2
- package/dist/bootstrap-ds/ds.config.json +1 -1
- package/dist/bootstrap-ds/scripts/build-mcp-previews.mjs +1 -1
- package/dist/boundaries.mjs +0 -3
- package/dist/capture.mjs +1 -1
- package/dist/check.mjs +15 -22
- package/dist/config.mjs +3 -7
- package/dist/contract-migration.mjs +2 -2
- package/dist/contracts.d.mts +0 -1
- package/dist/design-values.mjs +81 -0
- package/dist/development-runtime.mjs +17 -0
- package/dist/evidence.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/init.mjs +14 -12
- package/dist/mcp/apps.mjs +1 -1
- package/dist/mcp/context.mjs +8 -7
- package/dist/mcp/mutations.mjs +3 -2
- package/dist/mcp/preview-watch.mjs +2 -1
- package/dist/mcp/prompts.mjs +4 -4
- package/dist/mcp/reports.mjs +101 -0
- package/dist/mcp/server.mjs +41 -3
- package/dist/mcp/widget.bundle.js +1 -1
- package/dist/paint-contracts.mjs +4 -5
- package/dist/preview-files.mjs +33 -0
- package/dist/preview-inputs.mjs +6 -5
- package/dist/preview-resources.mjs +1 -2
- package/dist/scenarios-compiler.mjs +7 -7
- package/dist/scenarios.mjs +14 -14
- package/dist/showcase/sandbox.bundle.js +1 -1
- package/dist/skills/README.md +14 -4
- package/dist/skills/ads-break-ui/SKILL.md +29 -15
- package/dist/skills/ads-break-ui/references/atomic-styles.md +9 -2
- package/dist/skills/ads-break-ui/references/behaviors.md +396 -0
- package/dist/skills/ads-break-ui/references/captures.md +1 -1
- package/dist/skills/ads-break-ui/references/contracts.md +18 -37
- package/dist/skills/ads-break-ui/references/design-data.md +91 -0
- package/dist/skills/ads-break-ui/references/evidence.md +4 -0
- package/dist/skills/ads-break-ui/references/guarded-editing.md +7 -11
- package/dist/skills/ads-break-ui/references/layers.md +16 -0
- package/dist/skills/ads-break-ui/references/reporting.md +101 -0
- package/dist/skills/ads-break-ui/references/runtimes.md +110 -0
- package/dist/skills/ads-break-ui/references/scenarios.md +9 -15
- package/dist/skills/ads-designer/README.md +6 -0
- package/dist/skills/ads-designer/SKILL.md +35 -20
- package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +28 -30
- package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +13 -11
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/README.md +3 -2
- package/dist/skills/ads-designer/assets/bootstrap-ds/ds.config.json +1 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/scripts/build-mcp-previews.mjs +1 -1
- package/dist/skills/ads-designer/references/atomic-styles.md +9 -2
- package/dist/skills/ads-designer/references/behaviors.md +396 -0
- package/dist/skills/ads-designer/references/captures.md +1 -1
- package/dist/skills/ads-designer/references/cli.md +10 -7
- package/dist/skills/ads-designer/references/contracts.md +18 -37
- package/dist/skills/ads-designer/references/design-craft.md +32 -1
- package/dist/skills/ads-designer/references/design-data.md +91 -0
- package/dist/skills/ads-designer/references/evidence.md +4 -0
- package/dist/skills/ads-designer/references/guarded-editing.md +7 -11
- package/dist/skills/ads-designer/references/layers.md +16 -0
- package/dist/skills/ads-designer/references/mobile.md +1 -1
- package/dist/skills/ads-designer/references/reporting.md +101 -0
- package/dist/skills/ads-designer/references/runtimes.md +110 -0
- package/dist/skills/ads-designer/references/scenarios.md +9 -15
- package/dist/skills/ads-import/SKILL.md +51 -20
- package/dist/skills/ads-import/agents/openai.yaml +2 -2
- package/dist/skills/ads-import/references/atomic-styles.md +9 -2
- package/dist/skills/ads-import/references/behaviors.md +396 -0
- package/dist/skills/ads-import/references/branding.md +1 -1
- package/dist/skills/ads-import/references/captures.md +1 -1
- package/dist/skills/ads-import/references/cli.md +10 -7
- package/dist/skills/ads-import/references/compatibility.md +113 -0
- package/dist/skills/ads-import/references/contracts.md +18 -37
- package/dist/skills/ads-import/references/design-data.md +91 -0
- package/dist/skills/ads-import/references/evidence.md +4 -0
- package/dist/skills/ads-import/references/guarded-editing.md +7 -11
- package/dist/skills/ads-import/references/implementation.md +9 -2
- package/dist/skills/ads-import/references/layers.md +16 -0
- package/dist/skills/ads-import/references/reporting.md +101 -0
- package/dist/skills/ads-import/references/runtimes.md +110 -0
- package/dist/skills/ads-import/references/scenarios.md +9 -15
- package/dist/skills/ads-import/references/tokens.md +11 -9
- package/dist/skills/ads-motion/SKILL.md +28 -14
- package/dist/skills/ads-motion/references/atomic-styles.md +9 -2
- package/dist/skills/ads-motion/references/behaviors.md +396 -0
- package/dist/skills/ads-motion/references/captures.md +1 -1
- package/dist/skills/ads-motion/references/contracts.md +18 -37
- package/dist/skills/ads-motion/references/design-data.md +91 -0
- package/dist/skills/ads-motion/references/evidence.md +4 -0
- package/dist/skills/ads-motion/references/guarded-editing.md +7 -11
- package/dist/skills/ads-motion/references/layers.md +16 -0
- package/dist/skills/ads-motion/references/reporting.md +101 -0
- package/dist/skills/ads-motion/references/runtimes.md +110 -0
- package/dist/skills/ads-motion/references/scenarios.md +9 -15
- package/dist/skills/{ads-migrate → ads-port}/SKILL.md +64 -33
- package/dist/skills/ads-port/agents/openai.yaml +4 -0
- package/dist/skills/{ads-migrate → ads-port}/references/atomic-styles.md +9 -2
- package/dist/skills/ads-port/references/behaviors.md +396 -0
- package/dist/skills/{ads-migrate → ads-port}/references/captures.md +1 -1
- package/dist/skills/{ads-migrate → ads-port}/references/cli.md +10 -7
- package/dist/skills/{ads-migrate → ads-port}/references/contracts.md +18 -37
- package/dist/skills/ads-port/references/design-data.md +91 -0
- package/dist/skills/{ads-migrate → ads-port}/references/evidence.md +4 -0
- package/dist/skills/{ads-migrate → ads-port}/references/guarded-editing.md +7 -11
- package/dist/skills/{ads-migrate → ads-port}/references/layers.md +16 -0
- package/dist/skills/{ads-migrate → ads-port}/references/lint-and-docs.md +5 -0
- package/dist/skills/{ads-migrate → ads-port}/references/native-implementation.md +49 -15
- package/dist/skills/ads-port/references/reporting.md +101 -0
- package/dist/skills/ads-port/references/runtimes.md +110 -0
- package/dist/skills/{ads-migrate → ads-port}/references/scenarios.md +9 -15
- package/dist/skills/{ads-migrate → ads-port}/references/testing.md +11 -1
- package/dist/tokens.mjs +5 -8
- package/dist/unit-contracts.mjs +1 -8
- package/dist/verification.mjs +4 -3
- package/docs/ADS.md +59 -73
- package/docs/ARCHITECTURE.md +68 -20
- package/docs/BEHAVIORS.md +46 -41
- package/docs/CHANGELOG.md +44 -1
- package/docs/COMPARISON.md +63 -0
- package/docs/CONTRACTS.md +18 -37
- package/docs/GUIDE.md +41 -23
- package/docs/MCP.md +100 -15
- package/package.json +5 -4
- package/dist/scoped-tokens.mjs +0 -68
- package/dist/skills/ads-migrate/agents/openai.yaml +0 -4
- /package/dist/skills/{ads-migrate → ads-port}/references/review.md +0 -0
package/README.md
CHANGED
|
@@ -3,14 +3,22 @@
|
|
|
3
3
|
**A design system your agent can see and shape. Your components. Your look. Your code.**
|
|
4
4
|
|
|
5
5
|
ADS gives coding agents MCP tools and skills to build and maintain a design system
|
|
6
|
-
inside your project.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
inside your project.
|
|
7
|
+
|
|
8
|
+
- **One UI for websites and MCP Apps.** Reuse the same project-owned components,
|
|
9
|
+
behavior, tokens and styles across both.
|
|
10
|
+
- **Real UI. Guarded changes.** Humans and agents review the actual implementation;
|
|
11
|
+
agent patches pass architecture and configured project checks before they land.
|
|
12
|
+
- **Colocated code, clearer ownership.** Related implementation, styles, scenarios
|
|
13
|
+
and checks stay near their owner, reducing the search for change context.
|
|
14
|
+
- **Compiled styles, efficient delivery.** Linaria extracts CSS ahead of time.
|
|
15
|
+
Modular source and extracted styles support tree shaking, code splitting and
|
|
16
|
+
independent asset caching.
|
|
11
17
|
|
|
12
18
|
**Inspired by any library. Bound to none. Owned by your project.**
|
|
13
19
|
|
|
20
|
+
[Compare ADS with traditional component libraries and shadcn/ui](docs/COMPARISON.md).
|
|
21
|
+
|
|
14
22
|
ADS requires Linaria for component and pattern styling; your project chooses its
|
|
15
23
|
UI framework and visual design. The [architecture](docs/ARCHITECTURE.md) explains
|
|
16
24
|
Data, UX, Skin, and the performance reasons behind that choice.
|
|
@@ -34,7 +42,9 @@ uses Preact. See [implementation support](docs/GUIDE.md#implementation-support).
|
|
|
34
42
|
- **Keep contracts explicit** for typed paint inputs, scoped data bindings and
|
|
35
43
|
declarative APIs, without adding ADS to production components.
|
|
36
44
|
- **Guide agents** with prompts and portable skills for building, importing,
|
|
37
|
-
|
|
45
|
+
porting, motion and UI stress testing.
|
|
46
|
+
- **Collect feedback** as local bug reports and feature requests with compact
|
|
47
|
+
evidence, deduplication and submission receipts.
|
|
38
48
|
|
|
39
49
|
See [using ADS through MCP](docs/GUIDE.md#use-ads-through-mcp) for the workflow and
|
|
40
50
|
[visual captures](docs/MCP.md#screenshots-and-candidate-comparison) for screenshot
|
|
@@ -42,7 +52,7 @@ setup and comparison.
|
|
|
42
52
|
|
|
43
53
|
## Set up your project
|
|
44
54
|
|
|
45
|
-
Run **inside your project**, where `package.json` lives.
|
|
55
|
+
Run **inside your project**, where `package.json` lives. Use Node 22.12+ or Bun 1.3.13+.
|
|
46
56
|
|
|
47
57
|
```sh
|
|
48
58
|
npx @reqvire-org/ads init --framework react
|
|
@@ -54,13 +64,15 @@ Use `--framework preact` for native Preact. Init saves the choice in
|
|
|
54
64
|
`ds.config.json`; later runs can use plain `ads init`. A copied starter that
|
|
55
65
|
already declares its framework can also omit the flag.
|
|
56
66
|
|
|
57
|
-
For a Bun project,
|
|
67
|
+
For a Bun project, Node is unnecessary:
|
|
58
68
|
|
|
59
69
|
```sh
|
|
70
|
+
bunx --bun @reqvire-org/ads init --framework react
|
|
60
71
|
bun install
|
|
61
|
-
bun run build
|
|
72
|
+
bun --bun run build
|
|
62
73
|
```
|
|
63
74
|
|
|
75
|
+
`--bun` keeps package executables on Bun even when they have a Node shebang.
|
|
64
76
|
`init` detects npm or Bun from your project. It adds ADS and Oxlint as development
|
|
65
77
|
dependencies, sets up an empty local ADS if needed, and adds ADS checks before your
|
|
66
78
|
existing build. The default layout is root `design-system/`, alongside `src/`.
|
|
@@ -238,13 +250,13 @@ app's bundler. With no icon source, generation is skipped. See the
|
|
|
238
250
|
Install skills with `npx skills`:
|
|
239
251
|
|
|
240
252
|
```sh
|
|
241
|
-
npx skills add reqvire-org/ads --skill ads-designer --skill ads-import --skill ads-
|
|
253
|
+
npx skills add reqvire-org/ads --skill ads-designer --skill ads-import --skill ads-port --skill ads-break-ui --skill ads-motion
|
|
242
254
|
```
|
|
243
255
|
|
|
244
256
|
For local development, install from this checkout:
|
|
245
257
|
|
|
246
258
|
```sh
|
|
247
|
-
npx skills add ./skills --skill ads-designer --skill ads-import --skill ads-
|
|
259
|
+
npx skills add ./skills --skill ads-designer --skill ads-import --skill ads-port --skill ads-break-ui --skill ads-motion
|
|
248
260
|
```
|
|
249
261
|
|
|
250
262
|
Acknowledgments: `ads-designer`'s craft/mobile guidance, `ads-break-ui`, and
|
|
@@ -256,7 +268,7 @@ notice beside its files.
|
|
|
256
268
|
|
|
257
269
|
- [ads-designer](skills/ads-designer/SKILL.md): start an ADS or build UI with your local ADS.
|
|
258
270
|
- [ads-import](skills/ads-import/SKILL.md): import external components, patterns, styles, token values, or brand artwork.
|
|
259
|
-
- [ads-
|
|
271
|
+
- [ads-port](skills/ads-port/SKILL.md): port library components into your ADS using shared tokens and primitives.
|
|
260
272
|
- [ads-break-ui](skills/ads-break-ui/SKILL.md): stress-test real components and patterns with difficult content.
|
|
261
273
|
- [ads-motion](skills/ads-motion/SKILL.md): implement, review, audit, or profile component animation.
|
|
262
274
|
|
|
@@ -296,8 +308,9 @@ npm test # Tool guards and packed npm install/build tests
|
|
|
296
308
|
npm run build:project # ADS guards, type checking, example build and showcase
|
|
297
309
|
```
|
|
298
310
|
|
|
299
|
-
Set `ADS_TEST_BUN=1` when running `npm test` to
|
|
300
|
-
|
|
311
|
+
Set `ADS_TEST_BUN=1` when running `npm test` to test the installed package with
|
|
312
|
+
Node/npm/npx unavailable, including Bun builds, MCP previews and guarded checks.
|
|
313
|
+
Browser behavior/capture checks also run when a supported browser is installed.
|
|
301
314
|
|
|
302
315
|
Tool source lives in `src/`; tests and the dummy project live in `tests/`.
|
|
303
316
|
|
|
@@ -308,7 +321,7 @@ The [dummy project](tests/fixtures/guard-project/README.md) tests the generic gu
|
|
|
308
321
|
There are two different starting points in this checkout:
|
|
309
322
|
|
|
310
323
|
- [bootstrap-ds/](bootstrap-ds/README.md) is an empty React application starter:
|
|
311
|
-
token defaults, build setup, empty product component folders, a
|
|
324
|
+
token defaults, build setup, empty product component folders, a development-only token review renderer, and a project preview compiler adapter. It is bundled with `ads-designer` so an agent can copy it when starting
|
|
312
325
|
from zero. `ads init` uses its empty foundation files when a project has no ADS.
|
|
313
326
|
- [design-system/](design-system/README.md) is this repository's working example,
|
|
314
327
|
with real components, patterns, and scenarios inspected through the built-in showcase. It demonstrates the architecture
|
package/dist/bootstrap-ds/ADS.md
CHANGED
|
@@ -34,18 +34,16 @@ Keep public exports in `design-system/index.ts`; consumers use its `@ds` alias.
|
|
|
34
34
|
Use semantic CSS tokens for visual values. Raw values belong in the token files.
|
|
35
35
|
Projects sharing this ADS use the same token names, meanings, and value types;
|
|
36
36
|
their concrete values and theme overrides can differ. Reuse existing local values
|
|
37
|
-
when importing components/patterns
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
`--ds-*`, patterns `--ux-*`, and the showcase `--showcase-*`; token files cannot
|
|
48
|
-
assign those local variables or override component state.
|
|
37
|
+
when importing components/patterns. Existing font, text, spacing and other roles
|
|
38
|
+
take precedence over divergent upstream constants. Add genuinely missing shared
|
|
39
|
+
decisions, and import source token values only when adopting that theme is requested.
|
|
40
|
+
Shared token names and prefixes follow the ADS contract. All design values live
|
|
41
|
+
in the shared foundation; reuse meaningful project roles before adding new ones.
|
|
42
|
+
Components own `--ds-*` mappings and runtime mechanics, patterns own `--ux-*`, and
|
|
43
|
+
the showcase owns `--showcase-*`. These variables consume shared Data; they do
|
|
44
|
+
not create independent token catalogues. Private value sheets and namespace
|
|
45
|
+
registrations are not supported. Shared token files cannot assign runtime state
|
|
46
|
+
variables. Every shared token needs a real sample in a shared token scenario.
|
|
49
47
|
|
|
50
48
|
Foundation roles are enforced by `foundation-role`, `foundation-selector` and
|
|
51
49
|
`foundation-import`, alongside the regular token checks. Shared definitions
|
|
@@ -107,7 +105,7 @@ The shell owns section tabs, collapsible navigation, theme controls and the App
|
|
|
107
105
|
slot. Components, patterns, token values, scenarios, fixtures and their Linaria
|
|
108
106
|
styles remain project-owned. Only the sandboxed App loads and applies project
|
|
109
107
|
runtime, CSS and fonts, through MCP resources. App presentation comes from the
|
|
110
|
-
selected compiled scenario; reusable review layouts live in public
|
|
108
|
+
selected compiled scenario; reusable review layouts live in development-only `review/` through its separate public entry. Do not recreate
|
|
111
109
|
production widgets inside the client or scenario.
|
|
112
110
|
|
|
113
111
|
There are four sections: Tokens, Components, Patterns and Composition. There are
|
|
@@ -129,25 +127,25 @@ Colocate development entries and fixture inputs:
|
|
|
129
127
|
design-system/
|
|
130
128
|
tokens/
|
|
131
129
|
typography.css
|
|
132
|
-
Typography.scenario.tsx
|
|
133
|
-
Typography.fixture.ts
|
|
130
|
+
Typography.ads.scenario.tsx
|
|
131
|
+
Typography.ads.fixture.ts
|
|
134
132
|
components/core/Button/
|
|
135
133
|
Button.tsx
|
|
136
|
-
|
|
137
|
-
fixture.ts
|
|
134
|
+
Button.ads.scenario.tsx
|
|
135
|
+
Button.ads.fixture.ts
|
|
138
136
|
patterns/Editor/
|
|
139
137
|
Editor.tsx
|
|
140
|
-
|
|
141
|
-
fixture.ts
|
|
138
|
+
Editor.ads.scenario.tsx
|
|
139
|
+
Editor.ads.fixture.ts
|
|
142
140
|
composition/Workspace/
|
|
143
|
-
|
|
144
|
-
fixture.ts
|
|
141
|
+
Workspace.ads.scenario.tsx
|
|
142
|
+
Workspace.ads.fixture.ts
|
|
145
143
|
showcase/mcp/ Project compiler adapter
|
|
146
144
|
main.tsx
|
|
147
145
|
```
|
|
148
146
|
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
Use `<Owner>.ads.scenario.tsx` and `<Owner>.ads.fixture.ts` for new entries.
|
|
148
|
+
The scenario exports a default independently mountable view and literal metadata
|
|
151
149
|
`export const scenario = { title: "Button states", covers: ["Button"] };`.
|
|
152
150
|
Token entries under the configured token directory declare
|
|
153
151
|
`export const scenario = { title: fixture.title, covers: ["TokenSamples"], samples: fixture.samples };`.
|
|
@@ -155,7 +153,7 @@ Token entries under the configured token directory declare
|
|
|
155
153
|
Its colocated fixture declares literal `samples: [{ token, property, probe }]`.
|
|
156
154
|
Each token must exist and have sample coverage; duplicate bindings, missing probes,
|
|
157
155
|
empty covers and value-only inspectors fail. The default entry passes the declared
|
|
158
|
-
samples to a rendered public
|
|
156
|
+
samples to a rendered public review renderer's `samples` prop. No token-name/property mapping
|
|
159
157
|
or sample values are embedded in the tool. Display values come from foundation CSS;
|
|
160
158
|
probes are isolated verification inputs owned by the fixture.
|
|
161
159
|
|
|
@@ -173,12 +171,12 @@ mandatory caller inputs or prior page initialization. Related parts may share a
|
|
|
173
171
|
scenario containing their required public parent. Larger composition scenarios
|
|
174
172
|
reuse production screen patterns; that screen reuse remains skill guidance.
|
|
175
173
|
|
|
176
|
-
IDs derive from the ADS-relative path: `components/core/Button/
|
|
177
|
-
`components/core/Button.scenario.tsx` both identify `components/core/Button`.
|
|
174
|
+
IDs derive from the ADS-relative path: `components/core/Button/Button.ads.scenario.tsx` and
|
|
175
|
+
`components/core/Button.ads.scenario.tsx` both identify `components/core/Button`.
|
|
178
176
|
Use one form per owner. Renaming moves the ID. No manually assigned ID or parallel
|
|
179
|
-
registry is maintained.
|
|
180
|
-
|
|
181
|
-
|
|
177
|
+
registry is maintained. New fixture files use `<Owner>.ads.fixture.ts`; extra development
|
|
178
|
+
adapters use `<Owner>.ads.helpers.ts`. An empty fixture is valid without inputs.
|
|
179
|
+
Keep all `.ads.` files outside production imports and exports.
|
|
182
180
|
|
|
183
181
|
`scenario-contract`, `scenario-render` and `scenario-coverage` checks require valid
|
|
184
182
|
entries and reachable public render references for every public renderable
|
|
@@ -189,7 +187,7 @@ mounting, correct props, every branch/state or visual parity. The older
|
|
|
189
187
|
|
|
190
188
|
`token-scenario-reference` rejects undeclared token names in metadata and reachable
|
|
191
189
|
inputs. `token-scenario-render` rejects claimed tokens with no reachable input
|
|
192
|
-
reference; `token-scenario-coverage` requires every discovered shared
|
|
190
|
+
reference; `token-scenario-coverage` requires every discovered shared token
|
|
193
191
|
to have coverage. A new or removed token therefore needs a scenario/fixture
|
|
194
192
|
update. All three are errors in `ads check`, run by `lint:ds` and the build.
|
|
195
193
|
Coverage is static reachability, not proof that every branch actually renders
|
|
@@ -12,8 +12,8 @@ Read the local [contract](ADS.md) and the
|
|
|
12
12
|
|
|
13
13
|
Copy the contents of `bootstrap-ds/`, including dotfiles, into a new project.
|
|
14
14
|
The installed `ads-designer` skill contains the same files in
|
|
15
|
-
`assets/bootstrap-ds/`. Set the project name in `package.json`. Use Node 22.12
|
|
16
|
-
|
|
15
|
+
`assets/bootstrap-ds/`. Set the project name in `package.json`. Use Node 22.12+
|
|
16
|
+
or Bun 1.3.13+ with a current ADS release.
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
19
|
npx @reqvire-org/ads init --framework react
|
|
@@ -32,10 +32,12 @@ npm run build
|
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
For a new Bun workspace, declare Bun in `packageManager`, omit the copied npm
|
|
35
|
-
lockfile and translate nested npm scripts to `bun run`.
|
|
35
|
+
lockfile and translate nested npm scripts to `bun --bun run`. Initialize with
|
|
36
|
+
`bunx --bun @reqvire-org/ads init`. Init detects existing
|
|
36
37
|
Bun projects and preserves their scripts/lockfiles. Use `bun install` and
|
|
37
|
-
`bun run build`/`bun run dev:showcase`.
|
|
38
|
-
|
|
38
|
+
`bun --bun run build`/`bun --bun run dev:showcase`. Node is unnecessary with Bun
|
|
39
|
+
1.3.13+. The supplied preview watcher's `command: "runtime"` inherits the
|
|
40
|
+
interpreter that launched ADS and runs the project's installed checks.
|
|
39
41
|
|
|
40
42
|
For an existing application, merge only the ADS source and required extraction,
|
|
41
43
|
aliases and preview adapter. Preserve its framework, entry points and build.
|
|
@@ -58,18 +60,18 @@ files, and no separate project browser app to implement or rebuild.
|
|
|
58
60
|
|
|
59
61
|
The existing `tokens/Foundation.ads.scenario.tsx` and colocated fixture visually demonstrate all
|
|
60
62
|
starter token values. The fixture owns `{ token, property, probe }` bindings;
|
|
61
|
-
the
|
|
63
|
+
the development-only `TokenPreview` renderer, exported through `@ds/review`, owns their presentation and applies the real CSS
|
|
62
64
|
variables. Add/remove samples alongside token definitions. `ads check` rejects
|
|
63
65
|
missing coverage and invented names; the App verifies the declared CSS bindings
|
|
64
|
-
in the browser. Extend or replace the project-owned
|
|
66
|
+
in the browser. Extend or replace the project-owned review renderer as your tokens evolve.
|
|
65
67
|
`ads_prepare_token_samples` can prepare a fixture patch from explicit project
|
|
66
68
|
property/probe bindings. It preserves existing samples and reports unmapped tokens;
|
|
67
|
-
it does not guess how a new value should look.
|
|
68
|
-
|
|
69
|
+
it does not guess how a new value should look. Design values belong in the shared
|
|
70
|
+
foundation. Component/pattern variables map shared roles; they do not define
|
|
71
|
+
independent token catalogues. See [ADS.md](ADS.md).
|
|
69
72
|
|
|
70
73
|
Create a component under `design-system/components/`, export it through `@ds`,
|
|
71
|
-
and colocate
|
|
72
|
-
`<Owner>.fixture.ts`). Reusable compositions belong under `patterns/`; larger
|
|
74
|
+
and colocate `<Owner>.ads.scenario.tsx` plus `<Owner>.ads.fixture.ts`. Reusable compositions belong under `patterns/`; larger
|
|
73
75
|
scenarios live under `composition/`. Each entry mounts independently with its
|
|
74
76
|
fixture inputs and state/callback adapter. Use public ADS APIs and owned Linaria
|
|
75
77
|
styles, keeping business data/services in the application.
|
|
@@ -4,9 +4,10 @@ Keep original logos, app icons, and artwork variants here. This starter contains
|
|
|
4
4
|
no artwork. Record each asset's purpose, suitable backgrounds, usage, source
|
|
5
5
|
credits, and applicable licenses when adding it.
|
|
6
6
|
|
|
7
|
-
UI branding uses the
|
|
7
|
+
UI branding uses the project-owned shared roles in `tokens/`: change values such as
|
|
8
8
|
`--accent`, `--font-sans`, and `--radius-md`. Components own `--ds-*` variables;
|
|
9
|
-
patterns own `--ux-*`; the showcase owns
|
|
9
|
+
patterns and development review helpers own `--ux-*`; the showcase owns
|
|
10
|
+
`--showcase-*`. Do not introduce a
|
|
10
11
|
brand-prefixed token vocabulary or override component state variables.
|
|
11
12
|
|
|
12
13
|
Put licensed font files in `assets/fonts/` and their declarations in
|
|
@@ -17,7 +17,7 @@ await runScenarioCompiler(root, {
|
|
|
17
17
|
watched: process.argv.includes("--watch"),
|
|
18
18
|
compilerFiles: [import.meta.filename],
|
|
19
19
|
async validate() {
|
|
20
|
-
try { await runScript(manager, ["run", "lint"], { cwd: root }); }
|
|
20
|
+
try { await runScript(manager, [...(manager === "bun" ? ["--bun"] : []), "run", "lint"], { cwd: root }); }
|
|
21
21
|
catch (error) { throw new Error([error.stdout, error.stderr].map(value => value?.toString() ?? "").join("\n") || error.message); }
|
|
22
22
|
},
|
|
23
23
|
async buildGraph(entries, options, track) {
|
package/dist/boundaries.mjs
CHANGED
|
@@ -3,7 +3,6 @@ import ts from "typescript";
|
|
|
3
3
|
import { importedUiName } from "./ui-framework.mjs";
|
|
4
4
|
import { isInside, isStateVariable, isTestFile, isDevelopmentFile } from "./config.mjs";
|
|
5
5
|
import { isSharedToken } from "./token-policy.mjs";
|
|
6
|
-
import { scopedTokenOwner } from "./scoped-tokens.mjs";
|
|
7
6
|
import { runtimeBindingOwner } from "./unit-contracts.mjs";
|
|
8
7
|
|
|
9
8
|
export function projectCompilerOptions({ root, config, dsRoot }) {
|
|
@@ -63,8 +62,6 @@ export function checkComponentVariable(name, filename, options) {
|
|
|
63
62
|
const components = !development && isInside(path.join(dsRoot, "components"), filename);
|
|
64
63
|
const patterns = !development && isInside(path.join(dsRoot, "patterns"), filename);
|
|
65
64
|
const showcase = development;
|
|
66
|
-
const owned = scopedTokenOwner(options, name);
|
|
67
|
-
if (owned) return path.resolve(options.root, owned.file) === filename ? null : { rule: "token-ownership", message: `Define ${name} only in ${owned.file}, owned by ${owned.unit}. Consume it with var(); runtime geometry remains a separate styleWrites boundary.` };
|
|
68
65
|
if (runtimeBindingOwner(options, name)) return { rule: "binding-ownership", message: `${name} belongs to a declared runtime producer. Do not redefine instance bindings in CSS or arbitrary style objects.` };
|
|
69
66
|
if (isSharedToken(name)) return tokens ? null : { rule: "token-ownership", message: `Define ${name} in ADS tokens, not component, pattern, showcase, or app styles.` };
|
|
70
67
|
if (name.startsWith("--ux-")) return patterns || showcase ? null : { rule: "variable-ownership", message: "--ux-* variables belong to ADS patterns and showcase composition." };
|
package/dist/capture.mjs
CHANGED
|
@@ -87,7 +87,7 @@ export function createCaptureController(root) {
|
|
|
87
87
|
const settings = { browser: "chromium", timeoutMs: 60000, ...options.config.mcp.capture };
|
|
88
88
|
writeFileSync(request, JSON.stringify({ schemaVersion: 1, runId, playwright, settings, apps, output: temporary }));
|
|
89
89
|
update("rendering", 0, apps.length);
|
|
90
|
-
const run = await executeDevelopmentCommand({ command: "
|
|
90
|
+
const run = await executeDevelopmentCommand({ command: "runtime", timeoutMs: settings.timeoutMs, label: "Screenshot capture" }, [fileURLToPath(new URL("./capture/worker.mjs", import.meta.url)), request], root, {}, signal);
|
|
91
91
|
if (run.code !== 0) throw new Error(`Screenshot browser failed (${run.code}): ${run.output.slice(-3000)}`);
|
|
92
92
|
if (!existsSync(report) || realpathSync(report) !== report || lstatSync(report).size > 128 * 1024) throw new Error("Screenshot runner produced no bounded report.");
|
|
93
93
|
const value = JSON.parse(readFileSync(report, "utf8"));
|
package/dist/check.mjs
CHANGED
|
@@ -22,7 +22,7 @@ import { inspectStyleBoundaries, pointerCaptureAdvisories } from "./style-bounda
|
|
|
22
22
|
import { inspectBehaviors, inspectControllers } from "./behaviors.mjs";
|
|
23
23
|
import { numericCssUnit, tokenLengthLiteral } from "./css-values.mjs";
|
|
24
24
|
import { foundationDeclaration, foundationSelector } from "./foundation.mjs";
|
|
25
|
-
import {
|
|
25
|
+
import { inspectUnits } from "./units.mjs";
|
|
26
26
|
import { createAtomicCompositionReview } from "./atomic-composition.mjs";
|
|
27
27
|
import { createScenarioTrace } from "./scenario-trace.mjs";
|
|
28
28
|
import { createScenarioSlots } from "./scenario-slots.mjs";
|
|
@@ -30,6 +30,7 @@ import { createScenarioSelectors } from "./scenario-selectors.mjs";
|
|
|
30
30
|
import { architectureEvidence, failure } from "./evidence.mjs";
|
|
31
31
|
import { propertyRegistration } from "./property-registrations.mjs";
|
|
32
32
|
import { createLayerBoundaries, layerSourceFiles } from "./layers.mjs";
|
|
33
|
+
import { createDesignValues, inspectDesignAliases, isColorKeyword } from "./design-values.mjs";
|
|
33
34
|
|
|
34
35
|
const scenarioLayoutGuidance = "Put demo-only sizing and framing in the development-only review/ layer, imported through the separate review entry. Patterns are production UI. Keep required behavior in the runtime owner; add component props for deliberate product API needs.";
|
|
35
36
|
const inlineStyleGuidance = `Own visual styles in component/pattern Linaria. ${scenarioLayoutGuidance} Reserve inlineStyleFiles for documented measured geometry, not demo layout.`;
|
|
@@ -52,8 +53,7 @@ export function checkProject(directory, { trackingRoot } = {}) {
|
|
|
52
53
|
diagnostics.push(...tokenInventory.diagnostics);
|
|
53
54
|
diagnostics.push(...inspectAssets(options));
|
|
54
55
|
const resolveImport = importResolver(options);
|
|
55
|
-
const
|
|
56
|
-
const scopedFiles = new Set(scoped.definitions.map(entry => path.resolve(root, entry.file)));
|
|
56
|
+
const units = inspectUnits(options);
|
|
57
57
|
const rootHtml = path.join(root, "index.html");
|
|
58
58
|
const files = [...new Set([...sourceFiles(sourceRoot), ...sourceFiles(dsRoot), ...(existsSync(rootHtml) ? [rootHtml] : [])])];
|
|
59
59
|
const boundaryFiles = [...config.inlineStyleFiles, ...config.boundaries.styleWrites.map(entry => entry.file)].map(file => path.resolve(root, file)).filter(file => existsSync(file) && statSync(file).isFile());
|
|
@@ -61,11 +61,11 @@ export function checkProject(directory, { trackingRoot } = {}) {
|
|
|
61
61
|
const compiler = projectCompilerOptions(options);
|
|
62
62
|
const program = ts.createProgram(scriptFiles, { ...compiler, paths: { ...compiler.paths, [config.publicAlias]: [path.join(dsRoot, config.publicEntry)] }, allowJs: true, noResolve: true, noLib: true, types: [], target: ts.ScriptTarget.Latest, module: ts.ModuleKind.ESNext, jsx: ts.JsxEmit.Preserve });
|
|
63
63
|
const checker = program.getTypeChecker();
|
|
64
|
+
const designValues = createDesignValues(program,options);
|
|
64
65
|
const paintContracts = inspectPaintContracts(options);
|
|
65
66
|
diagnostics.push(...paintContracts.diagnostics);
|
|
66
67
|
const runtimeContracts = inspectRuntimeContracts(options, program);
|
|
67
68
|
diagnostics.push(...runtimeContracts.diagnostics);
|
|
68
|
-
for (const binding of runtimeContracts.bindings) if (scoped.definitions.some(entry=>entry.namespace.startsWith(binding.prefix)||binding.prefix.startsWith(entry.namespace))) diagnostics.push({file:binding.file,rule:"binding-collision",line:1,column:1,message:`Runtime family ${binding.variable} overlaps an owner-local design-token namespace. Keep instance bindings separate from token definitions.`});
|
|
69
69
|
const atomicCompositionReview = createAtomicCompositionReview(program, options);
|
|
70
70
|
const scenarioTrace = createScenarioTrace(program, options);
|
|
71
71
|
let scenarioSlot, scenarioSelector;
|
|
@@ -74,7 +74,7 @@ export function checkProject(directory, { trackingRoot } = {}) {
|
|
|
74
74
|
}
|
|
75
75
|
const layers = createLayerBoundaries(program, options, report), layerStyles = [];
|
|
76
76
|
layers.inspectDependencies();
|
|
77
|
-
inspectTokenValueFlows(program, options, tokenInventory,
|
|
77
|
+
inspectTokenValueFlows(program, options, tokenInventory, units, report);
|
|
78
78
|
for (const file of layers.runtimeHelpers()) if (!files.includes(file)) files.push(file);
|
|
79
79
|
inspectStyleBoundaries(options, program, report);
|
|
80
80
|
inspectShowcasePages(options, program, resolveImport, report);
|
|
@@ -90,8 +90,8 @@ export function checkProject(directory, { trackingRoot } = {}) {
|
|
|
90
90
|
css.walkAtRules(/^property$/i,rule=>{
|
|
91
91
|
const line=offset.line+(rule.source?.start.line??1)-1;
|
|
92
92
|
try{
|
|
93
|
-
const registration=propertyRegistration(rule),relative=
|
|
94
|
-
const owner=
|
|
93
|
+
const registration=propertyRegistration(rule),relative=units.relative(path.relative(root,file));
|
|
94
|
+
const owner=units.owner(relative),foundation=isInside(path.join(dsRoot,config.tokenDir),file);
|
|
95
95
|
if(foundation){
|
|
96
96
|
let defined=false;css.walkDecls(registration.name,()=>{defined=true;});
|
|
97
97
|
if(!isSharedToken(registration.name)||!declaredTokens.has(registration.name)||!defined||["base.css","fonts.css"].includes(path.basename(file)))throw new Error("Shared @property registrations belong beside their real token definitions in foundation value sheets, not base.css or fonts.css.");
|
|
@@ -100,8 +100,7 @@ export function checkProject(directory, { trackingRoot } = {}) {
|
|
|
100
100
|
const violation=checkComponentVariable(registration.name,file,options);if(violation)throw new Error(violation.message);
|
|
101
101
|
}
|
|
102
102
|
for(const descriptor of rule.nodes??[])if(descriptor.type==="decl")for(const ref of references(descriptor.value)){
|
|
103
|
-
|
|
104
|
-
if(tokenOwner&&(tokenOwner.unit!==owner||!declaredTokens.has(ref.name))||!tokenOwner&&!/^(?:--ds-|--ux-|--showcase-)/.test(ref.name)&&(!isSharedToken(ref.name)||!declaredTokens.has(ref.name)&&!ref.fallback))throw new Error(`Invalid or cross-owner token reference ${ref.name} in registration metadata.`);
|
|
103
|
+
if(!/^(?:--ds-|--ux-|--showcase-)/.test(ref.name)&&(!isSharedToken(ref.name)||!declaredTokens.has(ref.name)&&!ref.fallback))throw new Error(`Invalid or cross-owner token reference ${ref.name} in registration metadata.`);
|
|
105
104
|
}
|
|
106
105
|
const previous=registeredProperties.get(registration.name);
|
|
107
106
|
if(previous&&(previous.owner!==owner||previous.signature!==registration.signature))throw new Error(`Conflicting @property registration for ${registration.name}; ${path.relative(root,previous.file)} already registers it. Keep one owner and identical descriptors across that owner's modules.`);
|
|
@@ -166,12 +165,7 @@ export function checkProject(directory, { trackingRoot } = {}) {
|
|
|
166
165
|
for (const ref of references(decl.value)) {
|
|
167
166
|
const binding = runtimeBindingOwner(options, ref.name);
|
|
168
167
|
if (binding) {
|
|
169
|
-
if (
|
|
170
|
-
continue;
|
|
171
|
-
}
|
|
172
|
-
const owned = scopedTokenOwner(options, ref.name);
|
|
173
|
-
if (owned) {
|
|
174
|
-
if (scoped.inventory.owner(scoped.inventory.relative(path.relative(root, file))) !== owned.unit || !declaredTokens.has(ref.name)) report(file, "token-reference", `${ref.name} belongs to ${owned.unit}. Use shared tokens across owners; owner-local tokens must be defined and consumed by their owner.`, offset.line + decl.source.start.line - 1, decl.source.start.column);
|
|
168
|
+
if (units.owner(units.relative(path.relative(root, file))) !== binding.unit) report(file, "binding-ownership", `${ref.name} is an instance binding owned by ${binding.unit}, not a shared design token.`, offset.line + decl.source.start.line - 1, decl.source.start.column);
|
|
175
169
|
continue;
|
|
176
170
|
}
|
|
177
171
|
const local = /^(?:--ds-|--ux-|--showcase-)/.test(ref.name);
|
|
@@ -181,8 +175,10 @@ export function checkProject(directory, { trackingRoot } = {}) {
|
|
|
181
175
|
}
|
|
182
176
|
if (fontDescriptor || propertyDescriptor) return; // Font metadata defines source assets, not token-backed UI styles.
|
|
183
177
|
const violations = new Set();
|
|
178
|
+
if(decl.value.includes("__ds_expression__"))violations.add("Cannot establish this interpolated design value from source. Use a source-resolvable shared token/mapping; unknown interpolation does not grant permission for private design values.");
|
|
184
179
|
valueParser(decl.value).walk((node) => {
|
|
185
180
|
if (node.type === "function" && node.value === "url") return false;
|
|
181
|
+
if (node.type === "word" && decl.prop.startsWith("--") && isColorKeyword(node.value)) violations.add("Component variables map shared Data; named colors also require shared tokens.");
|
|
186
182
|
if (node.type === "word" && (/^#[\da-f]{3,8}$/i.test(node.value) || tokenLengthLiteral(node.value) || ["s", "ms"].includes(numericCssUnit(node.value)))) violations.add("Use a token for colors, absolute/font-relative lengths (including ch), and durations. Unitless geometry and structural angle/viewport/container relationships remain valid.");
|
|
187
183
|
if (node.type === "function" && /^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|cubic-bezier)$/.test(node.value)) violations.add("Define color formulas and easing in tokens.");
|
|
188
184
|
if (node.type === "function" && /^(?:blur|brightness|contrast|drop-shadow|grayscale|hue-rotate|invert|saturate|sepia)$/.test(node.value)) violations.add("Define visual filter effects in tokens.");
|
|
@@ -197,7 +193,6 @@ export function checkProject(directory, { trackingRoot } = {}) {
|
|
|
197
193
|
const role = adsFileRole(file);
|
|
198
194
|
const roleExtension=role==="contract"?/\.[cm]?ts$/.test(file):["fixture","fixtures"].includes(role)?/\.(?:[cm]?[jt]sx?|json)$/.test(file):/\.[cm]?[jt]sx?$/.test(file);
|
|
199
195
|
if (role && (!["contract", "scenario", "fixture", "fixtures", "helpers", "test", "spec", "behavior.spec"].includes(role)||!roleExtension)) report(file, "development-role", `Unknown .ads. role or unsupported extension: ${role}. Use a TypeScript contract, a script scenario/fixture/helpers/test/behavior.spec, or JSON fixture; marking development code does not grant styling or mutation permissions.`);
|
|
200
|
-
if (scopedFiles.has(file)) { try{checkRegistrations(file,postcss.parse(readFileSync(file,"utf8"),{from:file}));}catch{/* Token inspection reports malformed sheets. */} continue; } // Closed definition-only contract checked by inspectTokens.
|
|
201
196
|
if (file.endsWith(".css") && isInside(path.join(dsRoot, config.tokenDir), file) && !isDevelopmentFile(file, options)) { checkCss(file, readFileSync(file, "utf8"), undefined, true); continue; }
|
|
202
197
|
if (file.endsWith(".html")) { inspectHtml(readFileSync(file, "utf8"), (rule, message, line) => report(file, rule, message, line)); continue; }
|
|
203
198
|
if (file.endsWith(".css")) {
|
|
@@ -306,10 +301,6 @@ export function checkProject(directory, { trackingRoot } = {}) {
|
|
|
306
301
|
if ((ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) && node.moduleSpecifier && ts.isStringLiteral(node.moduleSpecifier)) specifier = node.moduleSpecifier.text;
|
|
307
302
|
if (ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword && node.arguments[0] && ts.isStringLiteral(node.arguments[0])) specifier = node.arguments[0].text;
|
|
308
303
|
if (specifier && importViolation(specifier, file, options, resolveImport)) nodeReport(node, "public-import", `Import through ${config.publicAlias}, not ADS implementation paths.`);
|
|
309
|
-
if (specifier) for (const target of resolveImport(specifier, file)) {
|
|
310
|
-
const tokenOwner = scoped.definitions.find(entry => path.resolve(root, entry.file) === target);
|
|
311
|
-
if (tokenOwner && scoped.inventory.owner(scoped.inventory.relative(path.relative(root, file))) !== tokenOwner.unit) nodeReport(node, "token-ownership", `Only ${tokenOwner.unit} imports its token sheet. Import the public component/pattern to consume its design.`);
|
|
312
|
-
}
|
|
313
304
|
if (specifier && resolveImport(specifier, file).some((target) => (specifier.startsWith(".") || existsSync(target)) && target.endsWith(".css") && isInside(root, target) && !isInside(dsRoot, target) && target !== path.join(sourceRoot, "app-mount.css") && !isInside(path.join(root, "node_modules"), target))) nodeReport(node, "style-ownership", "Imported project CSS belongs to ADS components, patterns, or the foundation. Only structural app-mount.css is allowed outside the ADS.");
|
|
314
305
|
if (specifier && appImportViolation(specifier, file, options, resolveImport)) nodeReport(node, "no-app-import", "ADS implementations and showcase fixtures must not import app code. Use public ADS APIs with local fixture data; keep application integration harnesses in application tests.");
|
|
315
306
|
if (specifier && showcaseImportViolation(specifier, file, options, resolveImport)) nodeReport(node, "showcase-import", "Showcase code and styles are development fixtures; runtime code must not import them.");
|
|
@@ -326,16 +317,18 @@ export function checkProject(directory, { trackingRoot } = {}) {
|
|
|
326
317
|
}
|
|
327
318
|
if (ts.isTaggedTemplateExpression(node) && isLinariaTag(node.tag)) {
|
|
328
319
|
const template = node.template;
|
|
329
|
-
const
|
|
320
|
+
const texts = ts.isNoSubstitutionTemplateLiteral(template) ? [template.text] : template.templateSpans.reduce((prefixes,span)=>{const parts=designValues(span.expression);return prefixes.flatMap(prefix=>(parts.length?parts:["__ds_expression__"]).map(value=>prefix+value+span.literal.text)).slice(0,32);},[template.head.text]);
|
|
330
321
|
const position = source.getLineAndCharacterOfPosition(template.getStart(source) + 1);
|
|
331
|
-
checkCss(file, text, { line: position.line + 1, column: position.character + 1 });
|
|
322
|
+
for(const text of texts)checkCss(file, text, { line: position.line + 1, column: position.character + 1 });
|
|
332
323
|
}
|
|
333
324
|
ts.forEachChild(node, visit);
|
|
334
325
|
}
|
|
335
326
|
visit(source);
|
|
336
327
|
}
|
|
328
|
+
inspectDesignAliases(layerStyles,options,report);
|
|
337
329
|
// Bounded clients should see actionable warnings before source-analysis limits.
|
|
338
330
|
for (const { file, css, offset } of layerStyles) layers.inspectStyles(file, css, offset);
|
|
331
|
+
advisories.push(...(tokenInventory.advisories??[]));
|
|
339
332
|
advisories.sort((first, second) => Number(first.severity === "info") - Number(second.severity === "info"));
|
|
340
333
|
const uniqueDiagnostics=[...new Map(diagnostics.map(diagnostic=>[JSON.stringify([diagnostic.file,diagnostic.rule,diagnostic.line,diagnostic.column,diagnostic.message]),diagnostic])).values()];
|
|
341
334
|
return architectureEvidence({ ok: uniqueDiagnostics.length === 0, diagnostics:uniqueDiagnostics, ...(advisories.length ? { advisories } : {}) });
|
package/dist/config.mjs
CHANGED
|
@@ -160,10 +160,6 @@ export function isBehaviorFile(file) {
|
|
|
160
160
|
return /(?:^|[\\/])behavior\.json$|\.behavior\.json$/.test(file);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
export function isTokenManifestFile(file) {
|
|
164
|
-
return /(?:^|[\\/])tokens\.json$|\.tokens\.json$/.test(file);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
163
|
/** A visible development boundary, independent of whether its role is supported. */
|
|
168
164
|
export function adsFileRole(file) {
|
|
169
165
|
const match = path.basename(file).match(/\.ads\.(.+)\.[^.]+$/);
|
|
@@ -184,7 +180,7 @@ export function scenarioIdentity(file, dsRoot) {
|
|
|
184
180
|
export function isDevelopmentFile(file, { dsRoot }) {
|
|
185
181
|
if (!isInside(dsRoot, file)) return isTestFile(file) || adsFileRole(file) !== null;
|
|
186
182
|
const relative = path.relative(dsRoot, file).replaceAll("\\", "/");
|
|
187
|
-
return adsFileRole(file) !== null || isTestFile(file) || isScenarioFile(file) || isFixtureFile(file) || isBehaviorFile(file)
|
|
183
|
+
return adsFileRole(file) !== null || isTestFile(file) || isScenarioFile(file) || isFixtureFile(file) || isBehaviorFile(file)
|
|
188
184
|
|| /^(?:showcase|composition|review)\//.test(relative)
|
|
189
185
|
|| /(?:^|\/)(?:scenario|fixtures)(?:\/|$)/.test(relative)
|
|
190
186
|
|| /\.scenario(?:-adapter)?\.[cm]?[jt]sx?$/.test(relative);
|
|
@@ -192,7 +188,7 @@ export function isDevelopmentFile(file, { dsRoot }) {
|
|
|
192
188
|
|
|
193
189
|
/** Review implementations may own demo presentation; scenarios/fixtures may not. */
|
|
194
190
|
export function isReviewFile(file, { dsRoot }) {
|
|
195
|
-
return isInside(path.join(dsRoot, "review"), file) && adsFileRole(file) === null && !isTestFile(file) && !isScenarioFile(file) && !isFixtureFile(file) && !isBehaviorFile(file)
|
|
191
|
+
return isInside(path.join(dsRoot, "review"), file) && adsFileRole(file) === null && !isTestFile(file) && !isScenarioFile(file) && !isFixtureFile(file) && !isBehaviorFile(file);
|
|
196
192
|
}
|
|
197
193
|
|
|
198
194
|
const ignored = new Set(["node_modules", "dist", "dist-showcase", "dist-kit", ".git", ".vite", ".ds", "coverage"]);
|
|
@@ -204,7 +200,7 @@ export function sourceFiles(root) {
|
|
|
204
200
|
if (ignored.has(entry.name) || entry.isSymbolicLink()) continue;
|
|
205
201
|
const file = path.join(root, entry.name);
|
|
206
202
|
if (entry.isDirectory()) files.push(...sourceFiles(file));
|
|
207
|
-
else if (entry.isFile() && (/\.(css|html|[cm]?[jt]sx?)$/.test(entry.name) || isBehaviorFile(entry.name)
|
|
203
|
+
else if (entry.isFile() && (/\.(css|html|[cm]?[jt]sx?)$/.test(entry.name) || isBehaviorFile(entry.name))) files.push(file);
|
|
208
204
|
}
|
|
209
205
|
return files.sort();
|
|
210
206
|
}
|
|
@@ -39,7 +39,7 @@ export function migrateContractDraft(options, prepared) {
|
|
|
39
39
|
else renames.delete(fixture);
|
|
40
40
|
}
|
|
41
41
|
if(new Set(renames.values()).size!==renames.size)throw new Error("Migration has colliding development filenames; resolve the owner draft deliberately.");
|
|
42
|
-
const jsonFiles=owned.filter(
|
|
42
|
+
const jsonFiles=owned.filter(isBehaviorFile);
|
|
43
43
|
for(const [from,to]of renames)if(isScenarioFile(from)&&scenarioIdentity(path.join(options.root,from),options.dsRoot)!==scenarioIdentity(path.join(options.root,to),options.dsRoot)) {
|
|
44
44
|
const text=readFileSync(resolve(from),"utf8"),source=ts.createSourceFile(from,text,ts.ScriptTarget.Latest,true,ts.ScriptKind.TSX);
|
|
45
45
|
const declaration=source.statements.filter(ts.isVariableStatement).flatMap(statement=>statement.declarationList.declarations).find(declaration=>ts.isIdentifier(declaration.name)&&declaration.name.text==="scenario");
|
|
@@ -80,7 +80,7 @@ export function migrateContractDraft(options, prepared) {
|
|
|
80
80
|
}
|
|
81
81
|
const {schemaVersion:_version,...behavior}=value;contract.behavior={...behavior,subjects};remove.push(file);
|
|
82
82
|
}catch(error){notes.push(error.message);}
|
|
83
|
-
}
|
|
83
|
+
}
|
|
84
84
|
}
|
|
85
85
|
for(const file of files) {
|
|
86
86
|
if(!/\.[cm]?[jt]sx?$|\.json$|\.md$/.test(file)||remove.includes(file))continue;
|
package/dist/contracts.d.mts
CHANGED
|
@@ -3,7 +3,6 @@ export type Implementation = ((...args: never[]) => unknown) | (abstract new (..
|
|
|
3
3
|
export interface BehaviorCheck { file: string; case: string; scenario?: string; profile: string; }
|
|
4
4
|
export interface UnitContract {
|
|
5
5
|
schemaVersion: 1;
|
|
6
|
-
tokens?: { namespace: string; stylesheet: string };
|
|
7
6
|
paintInputs?: readonly { api: Implementation; property: string; kind: "paint-reference"; bindings?: readonly string[] }[];
|
|
8
7
|
bindings?: Readonly<Record<string, {
|
|
9
8
|
input: { api: Implementation; property: string };
|