@tanrei/mcp 0.1.0-next.0 → 0.1.0-next.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/NOTICE +4 -5
- package/README.md +21 -6
- package/bin/tanrei-mcp.js +3 -3
- package/dist/server.js +2218 -711
- package/dist/vocabulary/docs/governance/mimicry-gaps.json +95 -21
- package/dist/vocabulary/packages/tokens-build/generated/component-catalog.json +1825 -0
- package/dist/vocabulary/specs/accordion.spec.json +1 -0
- package/dist/vocabulary/specs/app-bar.spec.json +1 -0
- package/dist/vocabulary/specs/app-shell.spec.json +1 -0
- package/dist/vocabulary/specs/avatar.spec.json +1 -0
- package/dist/vocabulary/specs/badge.spec.json +1 -0
- package/dist/vocabulary/specs/bottom-sheet.spec.json +1 -0
- package/dist/vocabulary/specs/breadcrumbs.spec.json +1 -0
- package/dist/vocabulary/specs/button-group.spec.json +1 -0
- package/dist/vocabulary/specs/button-with-menu.spec.json +1 -0
- package/dist/vocabulary/specs/button.spec.json +1 -0
- package/dist/vocabulary/specs/calendar.spec.json +1 -0
- package/dist/vocabulary/specs/callout.spec.json +1 -0
- package/dist/vocabulary/specs/card.spec.json +1 -0
- package/dist/vocabulary/specs/carousel.spec.json +1 -0
- package/dist/vocabulary/specs/chat-composer.spec.json +1 -0
- package/dist/vocabulary/specs/checkbox-group.spec.json +1 -0
- package/dist/vocabulary/specs/checkbox.spec.json +1 -0
- package/dist/vocabulary/specs/chip-field.spec.json +1 -0
- package/dist/vocabulary/specs/chip.spec.json +1 -0
- package/dist/vocabulary/specs/code-block.spec.json +1 -0
- package/dist/vocabulary/specs/color-field.spec.json +1 -0
- package/dist/vocabulary/specs/color-input.spec.json +1 -0
- package/dist/vocabulary/specs/combobox-field.spec.json +1 -0
- package/dist/vocabulary/specs/combobox.spec.json +1 -0
- package/dist/vocabulary/specs/component.schema.json +1 -0
- package/dist/vocabulary/specs/copy-button.spec.json +1 -0
- package/dist/vocabulary/specs/date-time-picker.spec.json +1 -0
- package/dist/vocabulary/specs/description-list.spec.json +1 -0
- package/dist/vocabulary/specs/dialog.spec.json +1 -0
- package/dist/vocabulary/specs/divider.spec.json +1 -0
- package/dist/vocabulary/specs/drop-zone.spec.json +1 -0
- package/dist/vocabulary/specs/embedded-text-input.spec.json +1 -0
- package/dist/vocabulary/specs/empty-state.spec.json +1 -0
- package/dist/vocabulary/specs/fab-menu.spec.json +1 -0
- package/dist/vocabulary/specs/field-group.spec.json +1 -0
- package/dist/vocabulary/specs/field.spec.json +1 -0
- package/dist/vocabulary/specs/figure.spec.json +1 -0
- package/dist/vocabulary/specs/file-item.spec.json +1 -0
- package/dist/vocabulary/specs/file-picker.spec.json +1 -0
- package/dist/vocabulary/specs/file-upload.spec.json +1 -0
- package/dist/vocabulary/specs/handle.spec.json +1 -0
- package/dist/vocabulary/specs/image-preview.spec.json +1 -0
- package/dist/vocabulary/specs/inline-code.spec.json +1 -0
- package/dist/vocabulary/specs/inventory.json +1 -0
- package/dist/vocabulary/specs/keyboard-shortcut.spec.json +1 -0
- package/dist/vocabulary/specs/link-card.spec.json +1 -0
- package/dist/vocabulary/specs/link.spec.json +1 -0
- package/dist/vocabulary/specs/list-row.spec.json +1 -0
- package/dist/vocabulary/specs/list.spec.json +1 -0
- package/dist/vocabulary/specs/loading-indicator.spec.json +1 -0
- package/dist/vocabulary/specs/main-action-button.spec.json +1 -0
- package/dist/vocabulary/specs/marquee-text.spec.json +1 -0
- package/dist/vocabulary/specs/menu.spec.json +1 -0
- package/dist/vocabulary/specs/menubar.spec.json +1 -0
- package/dist/vocabulary/specs/meter.spec.json +1 -0
- package/dist/vocabulary/specs/modal-layer.spec.json +1 -0
- package/dist/vocabulary/specs/navigation-bar.spec.json +1 -0
- package/dist/vocabulary/specs/navigation-drawer.spec.json +1 -0
- package/dist/vocabulary/specs/number-field.spec.json +1 -0
- package/dist/vocabulary/specs/number-input.spec.json +1 -0
- package/dist/vocabulary/specs/number-ticker.spec.json +1 -0
- package/dist/vocabulary/specs/one-time-code-field.spec.json +1 -0
- package/dist/vocabulary/specs/one-time-code-input.spec.json +1 -0
- package/dist/vocabulary/specs/page-header.spec.json +1 -0
- package/dist/vocabulary/specs/pagination.spec.json +1 -0
- package/dist/vocabulary/specs/popover.spec.json +1 -0
- package/dist/vocabulary/specs/previous-next-links.spec.json +1 -0
- package/dist/vocabulary/specs/progress-indicator.spec.json +1 -0
- package/dist/vocabulary/specs/prose.spec.json +1 -0
- package/dist/vocabulary/specs/radio-button.spec.json +1 -0
- package/dist/vocabulary/specs/radio-group.spec.json +1 -0
- package/dist/vocabulary/specs/rating.spec.json +1 -0
- package/dist/vocabulary/specs/resizable-frame.spec.json +1 -0
- package/dist/vocabulary/specs/scroll-area.spec.json +1 -0
- package/dist/vocabulary/specs/search.spec.json +1 -0
- package/dist/vocabulary/specs/segmented-button.spec.json +1 -0
- package/dist/vocabulary/specs/select-field.spec.json +1 -0
- package/dist/vocabulary/specs/select.spec.json +1 -0
- package/dist/vocabulary/specs/side-sheet.spec.json +1 -0
- package/dist/vocabulary/specs/size-transition.spec.json +1 -0
- package/dist/vocabulary/specs/skeleton.spec.json +1 -0
- package/dist/vocabulary/specs/slider-field.spec.json +1 -0
- package/dist/vocabulary/specs/slider.spec.json +1 -0
- package/dist/vocabulary/specs/snackbar.spec.json +1 -0
- package/dist/vocabulary/specs/split-view.spec.json +1 -0
- package/dist/vocabulary/specs/stepper.spec.json +1 -0
- package/dist/vocabulary/specs/steps.spec.json +1 -0
- package/dist/vocabulary/specs/swatch.spec.json +1 -0
- package/dist/vocabulary/specs/switch.spec.json +1 -0
- package/dist/vocabulary/specs/tab-view.spec.json +1 -0
- package/dist/vocabulary/specs/table-of-contents.spec.json +1 -0
- package/dist/vocabulary/specs/table.spec.json +1 -0
- package/dist/vocabulary/specs/tabs.spec.json +1 -0
- package/dist/vocabulary/specs/tag-group.spec.json +1 -0
- package/dist/vocabulary/specs/tag.spec.json +1 -0
- package/dist/vocabulary/specs/text-field.spec.json +1 -0
- package/dist/vocabulary/specs/text-input.spec.json +1 -0
- package/dist/vocabulary/specs/timeline.spec.json +1 -0
- package/dist/vocabulary/specs/toolbar.spec.json +1 -0
- package/dist/vocabulary/specs/tooltip.spec.json +1 -0
- package/dist/vocabulary/specs/tree-view.spec.json +1 -0
- package/dist/vocabulary/tanrei.config.json +2 -1
- package/dist/vocabulary/tokens/comp/accordion.tokens.json +70 -47
- package/dist/vocabulary/tokens/comp/app-bar.tokens.json +99 -2
- package/dist/vocabulary/tokens/comp/app-shell.tokens.json +1 -1
- package/dist/vocabulary/tokens/comp/avatar.tokens.json +17 -5
- package/dist/vocabulary/tokens/comp/badge.tokens.json +2 -1
- package/dist/vocabulary/tokens/comp/bottom-sheet.tokens.json +143 -73
- package/dist/vocabulary/tokens/comp/breadcrumbs.tokens.json +3 -3
- package/dist/vocabulary/tokens/comp/button-group.tokens.json +26 -4
- package/dist/vocabulary/tokens/comp/button-with-menu.tokens.json +256 -28
- package/dist/vocabulary/tokens/comp/button.tokens.json +275 -22
- package/dist/vocabulary/tokens/comp/calendar.tokens.json +28 -18
- package/dist/vocabulary/tokens/comp/callout.tokens.json +55 -299
- package/dist/vocabulary/tokens/comp/card.tokens.json +3 -3
- package/dist/vocabulary/tokens/comp/carousel.tokens.json +70 -10
- package/dist/vocabulary/tokens/comp/chat-composer.tokens.json +37 -3
- package/dist/vocabulary/tokens/comp/checkbox.tokens.json +18 -22
- package/dist/vocabulary/tokens/comp/chip.tokens.json +67 -16
- package/dist/vocabulary/tokens/comp/code-block.tokens.json +15 -1
- package/dist/vocabulary/tokens/comp/combobox.tokens.json +202 -33
- package/dist/vocabulary/tokens/comp/copy-button.tokens.json +19 -2
- package/dist/vocabulary/tokens/comp/date-time-picker.tokens.json +66 -35
- package/dist/vocabulary/tokens/comp/description-list.tokens.json +45 -23
- package/dist/vocabulary/tokens/comp/dialog.tokens.json +95 -35
- package/dist/vocabulary/tokens/comp/drop-zone.tokens.json +151 -0
- package/dist/vocabulary/tokens/comp/embedded-text-input.tokens.json +2 -2
- package/dist/vocabulary/tokens/comp/field-group.tokens.json +21 -1
- package/dist/vocabulary/tokens/comp/field.tokens.json +33 -4
- package/dist/vocabulary/tokens/comp/figure.tokens.json +56 -2
- package/dist/vocabulary/tokens/comp/file-item.tokens.json +4 -4
- package/dist/vocabulary/tokens/comp/file-picker.tokens.json +3 -3
- package/dist/vocabulary/tokens/comp/file-upload.tokens.json +2 -7
- package/dist/vocabulary/tokens/comp/handle.tokens.json +343 -0
- package/dist/vocabulary/tokens/comp/image-preview.tokens.json +53 -23
- package/dist/vocabulary/tokens/comp/input-box.tokens.json +161 -26
- package/dist/vocabulary/tokens/comp/keyboard-shortcut.tokens.json +5 -3
- package/dist/vocabulary/tokens/comp/link-card.tokens.json +24 -4
- package/dist/vocabulary/tokens/comp/link.tokens.json +3 -3
- package/dist/vocabulary/tokens/comp/list-row.tokens.json +249 -0
- package/dist/vocabulary/tokens/comp/list.tokens.json +106 -225
- package/dist/vocabulary/tokens/comp/loading-indicator.tokens.json +13 -3
- package/dist/vocabulary/tokens/comp/main-action-button.tokens.json +96 -23
- package/dist/vocabulary/tokens/comp/marquee-text.tokens.json +110 -0
- package/dist/vocabulary/tokens/comp/menu.tokens.json +248 -43
- package/dist/vocabulary/tokens/comp/menubar.tokens.json +63 -12
- package/dist/vocabulary/tokens/comp/meter.tokens.json +173 -0
- package/dist/vocabulary/tokens/comp/modal-layer.tokens.json +69 -0
- package/dist/vocabulary/tokens/comp/navigation-bar.tokens.json +5 -36
- package/dist/vocabulary/tokens/comp/navigation-drawer.tokens.json +478 -122
- package/dist/vocabulary/tokens/comp/number-input.tokens.json +2 -2
- package/dist/vocabulary/tokens/comp/number-ticker.tokens.json +77 -0
- package/dist/vocabulary/tokens/comp/one-time-code-input.tokens.json +22 -7
- package/dist/vocabulary/tokens/comp/pagination.tokens.json +118 -79
- package/dist/vocabulary/tokens/comp/popover.tokens.json +84 -13
- package/dist/vocabulary/tokens/comp/previous-next-links.tokens.json +194 -0
- package/dist/vocabulary/tokens/comp/progress-indicator.tokens.json +14 -4
- package/dist/vocabulary/tokens/comp/prose.tokens.json +16 -0
- package/dist/vocabulary/tokens/comp/radio-button.tokens.json +16 -20
- package/dist/vocabulary/tokens/comp/rating.tokens.json +230 -0
- package/dist/vocabulary/tokens/comp/resizable-frame.tokens.json +166 -0
- package/dist/vocabulary/tokens/comp/scroll-area.tokens.json +99 -0
- package/dist/vocabulary/tokens/comp/search.tokens.json +144 -58
- package/dist/vocabulary/tokens/comp/segmented-button.tokens.json +75 -21
- package/dist/vocabulary/tokens/comp/select.tokens.json +168 -34
- package/dist/vocabulary/tokens/comp/side-sheet.tokens.json +60 -13
- package/dist/vocabulary/tokens/comp/size-transition.tokens.json +49 -0
- package/dist/vocabulary/tokens/comp/skeleton.tokens.json +5 -2
- package/dist/vocabulary/tokens/comp/slider.tokens.json +11 -10
- package/dist/vocabulary/tokens/comp/snackbar.tokens.json +81 -255
- package/dist/vocabulary/tokens/comp/split-view.tokens.json +52 -0
- package/dist/vocabulary/tokens/comp/stepper.tokens.json +538 -0
- package/dist/vocabulary/tokens/comp/swatch.tokens.json +208 -0
- package/dist/vocabulary/tokens/comp/switch.tokens.json +19 -18
- package/dist/vocabulary/tokens/comp/tab-view.tokens.json +5 -5
- package/dist/vocabulary/tokens/comp/table-of-contents.tokens.json +58 -33
- package/dist/vocabulary/tokens/comp/table.tokens.json +141 -30
- package/dist/vocabulary/tokens/comp/tabs.tokens.json +132 -44
- package/dist/vocabulary/tokens/comp/tag-group.tokens.json +15 -4
- package/dist/vocabulary/tokens/comp/tag.tokens.json +32 -8
- package/dist/vocabulary/tokens/comp/text-input.tokens.json +18 -88
- package/dist/vocabulary/tokens/comp/timeline.tokens.json +15 -19
- package/dist/vocabulary/tokens/comp/toolbar.tokens.json +121 -6
- package/dist/vocabulary/tokens/comp/tooltip.tokens.json +8 -32
- package/dist/vocabulary/tokens/comp/tree-view.tokens.json +136 -51
- package/dist/vocabulary/tokens/dial/dial.tokens.json +23 -3
- package/dist/vocabulary/tokens/fidelity/cupertino.fidelity.json +165 -0
- package/dist/vocabulary/tokens/fidelity/m3-like.fidelity.json +215 -5
- package/dist/vocabulary/tokens/fidelity/reference/androidx-material3.json +144 -0
- package/dist/vocabulary/tokens/fidelity/reference/apple-hig.json +196 -0
- package/dist/vocabulary/tokens/generated/cupertino/components.json +1749 -0
- package/dist/vocabulary/tokens/generated/cupertino/fidelity.json +162 -0
- package/dist/vocabulary/tokens/generated/m3-like/components.json +1761 -0
- package/dist/vocabulary/tokens/generated/m3-like/fidelity.json +182 -12
- package/dist/vocabulary/tokens/generated/tanrei/components.json +1764 -0
- package/dist/vocabulary/tokens/icon-sets/material-symbols.icon-set.json +2 -1
- package/dist/vocabulary/tokens/schema/system.schema.json +324 -35
- package/dist/vocabulary/tokens/sys/behavior.tokens.json +66 -1
- package/dist/vocabulary/tokens/sys/measure.tokens.json +105 -21
- package/dist/vocabulary/tokens/sys/motion.tokens.json +474 -2
- package/dist/vocabulary/tokens/sys/scroll-edge.tokens.json +50 -0
- package/dist/vocabulary/tokens/sys/shape.tokens.json +1 -1
- package/dist/vocabulary/tokens/sys/state.tokens.json +16 -3
- package/dist/vocabulary/tokens/sys/typescale.tokens.json +5 -5
- package/dist/vocabulary/tokens/systems/core.system.json +1889 -0
- package/dist/vocabulary/tokens/systems/cupertino.system.json +298 -79
- package/dist/vocabulary/tokens/{comp → systems/m3-like/comp}/fab-menu.tokens.json +5 -15
- package/dist/vocabulary/tokens/systems/m3-like.system.json +451 -125
- package/dist/vocabulary/tokens/systems/tanrei.system.json +619 -321
- package/dist/vocabulary/tokens/tanrei.resolver.json +48 -6
- package/package.json +22 -6
- package/dist/vocabulary/tokens/AGENTS.md +0 -15
- package/dist/vocabulary/tokens/comp/navigation-rail.tokens.json +0 -254
- package/dist/vocabulary/tokens/fidelity/m3-expressive-like.fidelity.json +0 -68
- package/dist/vocabulary/tokens/fidelity/reference/androidx-material3-buttons.json +0 -67
- package/dist/vocabulary/tokens/generated/m3-expressive-like/fidelity.json +0 -99
- package/dist/vocabulary/tokens/systems/m3-expressive-like.system.json +0 -83
- package/dist/vocabulary/tokens/vocabulary.lock.json +0 -7052
package/NOTICE
CHANGED
|
@@ -25,10 +25,10 @@ under the Apache License, Version 2.0:
|
|
|
25
25
|
Copyright The Android Open Source Project
|
|
26
26
|
https://github.com/androidx/androidx
|
|
27
27
|
The token names and values in
|
|
28
|
-
tokens/fidelity/reference/androidx-material3
|
|
29
|
-
|
|
30
|
-
m3-
|
|
31
|
-
|
|
28
|
+
tokens/fidelity/reference/androidx-material3.json are taken from the
|
|
29
|
+
published token files, versions v0_11_0, v0_7_0 and 14_1_0. Values of the
|
|
30
|
+
m3-like preset (tokens/systems/m3-like.system.json and the files generated
|
|
31
|
+
from it) are taken from the same token files.
|
|
32
32
|
|
|
33
33
|
The source repository also contains the Gradle wrapper
|
|
34
34
|
(packages/compose/gradlew, gradlew.bat and gradle/wrapper/) — Copyright 2015
|
|
@@ -46,7 +46,6 @@ The design system presets other than tanrei (tokens/systems/) are independent
|
|
|
46
46
|
approximations, named for what they resemble:
|
|
47
47
|
|
|
48
48
|
m3-like — resembles Material Design 3.
|
|
49
|
-
m3-expressive-like — resembles Material Design 3 Expressive.
|
|
50
49
|
cupertino — resembles what the Apple Human Interface Guidelines describe.
|
|
51
50
|
|
|
52
51
|
Tanrei is not affiliated with, endorsed by, or sponsored by Google LLC,
|
package/README.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# @tanrei/mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<!-- tanrei:status -->
|
|
4
|
+
<!-- Written by `pnpm generate` (packages/tools/src/readme.js) from the specs and tanrei.config.json: edit those, not this block. -->
|
|
5
|
+
> **Prerelease.** `0.1.0-next.1` is published under the npm dist-tag `next`: until `0.1.0`, install `@tanrei/mcp@next`. During the 0.x prereleases backward compatibility is not kept: any prerelease may break anything, with no deprecation period first, and its changeset says what broke.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<!-- /tanrei:status -->
|
|
8
|
+
|
|
9
|
+
A [Model Context Protocol](https://modelcontextprotocol.io) server for [Tanrei](https://github.com/chnotchy/tanrei). It lets an AI agent working in **your product's repository** write UI with **only the components your design system has**, discover the token vocabulary, see where a value comes from, and write a **valid** edit to your design system's layer file — a changed value, or an extension of the vocabulary. It works from the two ideals Tanrei holds together:
|
|
6
10
|
|
|
7
11
|
> **A small core** — Tanrei's own tokens are a necessary and sufficient set, simply named, fitted to no one design system.
|
|
8
12
|
> **Exact reproduction** — by customizing Tanrei, any design system can be matched exactly.
|
|
@@ -37,12 +41,16 @@ Node.js 20 or newer. Relative `layerFile` paths are resolved from the server's w
|
|
|
37
41
|
|
|
38
42
|
| Tool | What it answers |
|
|
39
43
|
|---|---|
|
|
40
|
-
| `list_systems` | The shipped systems — the
|
|
44
|
+
| `list_systems` | The shipped systems — the default `tanrei` and the presets `m3-like` (which adds the button sizes `xlarge` and `xxlarge`) and `cupertino` — and, with `layerFile`, your product's chain (every chain starts at the root layer `core`, which values the vocabulary for all of them and is not listed itself; `root` and `default` name the two): id, name, `extends`, description, declared palettes, number of value changes and pattern rules, **the extensions that exist in it** (count, by kind, the first few, each with `declaredBy`), and the accessibility findings: a warning count for the default system and a product (none for the default system, whose violations fail its build), and for an imitation preset `accessibility: { criteria: "not-applied", measurements, because }` — its contrast measured with the fixed ruler and shown as information, since Tanrei's accessibility criteria do not apply to a preset in any contrast scheme. A preset that is measured against the published system it reproduces also carries **`fidelity`**: `{ equal, measured, different, unmapped, reference: { name, version, source } }` — of `measured` reference tokens, `equal` have exactly the reference's value, `different` do not, and `unmapped` have no counterpart in Tanrei yet (see `mimicry_gaps`). It is the report of the preset's last build (`tokens/generated/<id>/fidelity.json`), read as it is; a system without one claims nothing. |
|
|
45
|
+
| `list_components` | The components a system ships, from its **components manifest** (`tokens/generated/<id>/components.json`; for a `layerFile`, the product's own, worked out as `tanrei build` works it out): name, title, category, level, listing (`advanced`: a building block a composed component wraps), a short summary, the web element with the module that registers it, the React wrapper with the entry to import it from, the `variant` values the system offers and the status on one platform (`platform`, default web). `omitted` lists what the system does not have — the layer that left it out and why, or the layer it lives in — with `insteadUse` (what the system ships for the same job), `availableIn` (the shipped systems that have it) and `howToInclude` (the line of a product's layer that takes it); `omittedVariants` the variant values it leaves out. Filters: `listing`, `category`, `level`, `status`. Paginated. Call it first. |
|
|
46
|
+
| `get_component` | One component, from its spec, for one system: props (`variant` narrowed to the values the system offers; a composed component's props are its members', written out), events, slots, the elements it holds (`items`), states, the behaviour as **EARS rules with their stable ids**, accessibility, and one fixture as an example. `name` is the component's name, its element (`tanrei-text-field`) or its React wrapper (`TextField`). `sections` narrows the answer or adds `anatomy`, `tokens`, `platforms`, `fixtures`. A component the system does not have answers `available: false` with what to use instead. |
|
|
47
|
+
| `find_component` | `need` in plain words ("pick a date") → the components of the system whose name, summary and props meet those words, best first; one that matches but the system does not have is listed apart (`notInThisSystem`), with what to use instead. |
|
|
48
|
+
| `check_usage` | `code` (with a `path` whose extension says how to read it) or `files` + a system → the check `tanrei audit` runs: every element (`<tanrei-…>`, a tag in a string, an imported React wrapper) and CSS selector of a component the system does not have, every import of an entry that does not fit the system (another system's, or `@tanrei/react/all`) or of a module or wrapper it does not have, and every literal `variant` it leaves out, with file, line, column and what to write instead; an unknown `tanrei-` element with the nearest components. Comments are skipped. Reads, never writes. |
|
|
41
49
|
| `search_tokens` | Find tokens by id: substring, or a glob (`tanrei.comp.button.*.hovered.*`, `sys.color.on-*`, `**.opacity`, `acme.comp.*` for a layer's own tokens). Filters: `tier` (dial, ref, sys, comp), `type`, `kind`, `extensions` (only / no vocabulary added by a layer). Returns id, `$type`, kind (derived, fixed, alias, dial), `extension: true` + `declaredBy` where a layer added the token, and a short description. Paginated. |
|
|
42
50
|
| `resolve` | Token id(s) + system + scheme → the resolved value (a choice of kind — `sys.behavior.*` — as its **name**, with `choice: { name, index, of }`), the alias chain, the derive rule with the current value of its inputs, the layer that set it (and, for an extension, the layer that declared it), and the CSS custom property name — `--tanrei-…`, or `--<namespace>-…` for a layer's own tokens. A palette tone that the palette states exactly (`source.tones`) says so: `rule.exact`. |
|
|
43
51
|
| `explain_token` | One token in one system: why it exists (the core's one-product rationale — or, for an extension, `declaredBy` and its `rationale`), usage guidance (`dev.tanrei.llm`, when the vocabulary carries it), which layers and pattern rules touch it, root first — every matching pattern rule says whether it `wins` and `because` (an explicit entry beats patterns, fewer wildcards beat more, the later layer wins a tie), and `winningRule` names the one that values the token — **what follows it** (`followers`: every token that moves when this token or dial does), **the operations a layer may legally write for it** (`howToChange`; a choice of kind offers **choose** with its names, a typeface **set the font stack**) and **how to add vocabulary next to it** (`howToExtend`: one more step of its series, one more size/variant of its axis, a token of your own). Every `write` is a ready-to-edit fragment of a layer. |
|
|
44
52
|
| `diff_systems` | Two systems → the tokens whose resolved value differs in a scheme. Counts by tier and group first; details paginated, narrowed with `group`. Ids that exist on one side only are reported apart: extensions (with `declaredBy`), and what declared palettes bring. |
|
|
45
|
-
| `validate_layer` | A layer (object or file; with an object, `parents` — other layers of the request it extends — and `dir` — where the product's other layer files live) → JSON Schema problems of every layer of the chain; then every problem at once, with the way out: `vocabulary` declarations as the engine judges them (rationale, own namespace, declared once, an existing axis and `from`, never an interaction state), ids under `tokens`/`rules` that are neither core nor declared, a pinned literal without `reason`, a `$type` change, leftover placeholders; then the real build, which is the final authority. Ids declared under `vocabulary` — including the member tokens a new size generates and a new variant's state tokens — are valid targets. If valid: the accessibility/structure warnings `tanrei build` would print. Writes nothing. |
|
|
53
|
+
| `validate_layer` | A layer (object or file; with an object, `parents` — other layers of the request it extends — and `dir` — where the product's other layer files live) → JSON Schema problems of every layer of the chain; then every problem at once, with the way out: `vocabulary` declarations as the engine judges them (rationale, own namespace, declared once, an existing axis and `from`, never an interaction state), ids under `tokens`/`rules` that are neither core nor declared, a pinned literal without `reason`, a `$type` change, leftover placeholders; then the real build, which is the final authority, and what it refuses in every layer, a product layer's too: `tanrei.sys.target.pointer` or `.touch` under `tanrei.sys.target.minimum`. Ids declared under `vocabulary` — including the member tokens a new size generates and a new variant's state tokens — are valid targets. If valid: the accessibility/structure warnings `tanrei build` would print — a target (`sys.target.minimum`, `.pointer`, `.touch`) under 24px (WCAG 2.5.8) or a pressable height under `sys.target.minimum` among them. Writes nothing. |
|
|
46
54
|
| `propose_extension` | `{ kind: "step" \| "axis-value" \| "own-token", … }` → a ready `vocabulary` fragment for the layer, checked (the id is new, names are valid, an own token uses the layer's namespace, the axis and `from` exist, it is not a state) and **verified by a trial build**: the new token ids with their values, and any new warnings. The `rationale` is a placeholder the agent must fill — `validate_layer` rejects it as it stands. Writes nothing. |
|
|
47
55
|
| `mimicry_gaps` | Tanrei's registry of traits it cannot reproduce yet — behaviours and mechanisms no token can express. A shipped preset's accessibility measurements are not gaps. Missing vocabulary is not a gap: a layer declares it. Filter by `status`, `kind`, `system`. |
|
|
48
56
|
|
|
@@ -54,18 +62,25 @@ Systems are built once and cached; a layer file is rebuilt when it, or a layer i
|
|
|
54
62
|
|
|
55
63
|
| URI | |
|
|
56
64
|
|---|---|
|
|
57
|
-
| `tanrei://philosophy` | One page: the two ideals, the one-product test for the core, tiers and kinds, the layer operations, the three kinds of extension, accessibility severity. Read once. |
|
|
65
|
+
| `tanrei://philosophy` | One page: the two ideals, the one-product test for the core, tiers and kinds, the eight dials and the minimum target, the layer operations, the three kinds of extension, accessibility severity. Read once. |
|
|
58
66
|
| `tanrei://schema/system` | The JSON Schema of a layer file. |
|
|
59
67
|
| `tanrei://systems/<id>` | Each shipped layer file as authored — worked examples of every operation. |
|
|
68
|
+
| `tanrei://components/<id>` | Each shipped system's components manifest, as the repository generates it. |
|
|
60
69
|
|
|
61
70
|
The server's `instructions` give the agent the hard rules up front — the same ones the tools enforce:
|
|
62
71
|
|
|
72
|
+
- **Components: settle the system first.** Call `list_components` and use no component it does not list (`omitted` says what to use instead); to rebuild a product with Tanrei, use the default system, `tanrei`. `check_usage` checks code before it is kept.
|
|
73
|
+
|
|
63
74
|
- **Values first.** Find the token that exists and change it in the layer: set a dial, `scale`, re-point an alias, replace `derive`, and only then pin a literal `$value`, which needs a `reason`. Color families are `palettes`.
|
|
64
75
|
- **If the word is missing, add it — in the layer, under `vocabulary`, with a `rationale`** (8+ characters). Three kinds: a step in a series inside Tanrei's tree (`tanrei.sys.space.space1200`, or a single color role with its `onRole`); a value on a component axis (`tanrei.comp.button.size.3x`, `tanrei.comp.button.variant.danger` — one line values every member; a variant's state tokens come from the system's pattern rules); the layer's own tokens in its own namespace, which is the layer's id (`acme.comp.rating.star.size` → `--acme-comp-rating-star-size`). They may reference `tanrei.*`; nothing in `tanrei.*` may reference them.
|
|
65
76
|
- **Additive only.** Extensions are inherited down `extends` and stay attributed to the layer that declared them. Nothing is removed or retyped; re-declaring what core or an ancestor declared is an error — change its value under `tokens`. Interaction states (hovered, focused, pressed, disabled) are not extensible.
|
|
66
77
|
- **Accessibility thresholds are constants**, for extensions too; a violation in a product layer is a warning every build prints.
|
|
67
78
|
- Never edit generated files; run `tanrei build` after editing the layer.
|
|
68
79
|
|
|
80
|
+
## Size and targets
|
|
81
|
+
|
|
82
|
+
Three values decide how big things are. `tanrei.dial.control.height` (40px) is the height controls and rows are drawn at in their default size; `tanrei.dial.size.unit` (4px) is the distance between the sizes: small is two size units below the control height and large four above it. `tanrei.sys.target.minimum` (36px) is the least height anything a person presses is drawn at: no dial scales it, every pressable height is derived with `"min": "{tanrei.sys.target.minimum}"`, and `tanrei.sys.target.pointer` and `.touch`, the least areas a press is taken from, alias it — a layer that follows a platform guideline sets them higher. `validate_layer` and `tanrei build` refuse a pointer or touch target under the minimum, and a minimum above the control height, in every layer; a target under 24px or a pressable height under the minimum is a warning in a product layer.
|
|
83
|
+
|
|
69
84
|
## An example session
|
|
70
85
|
|
|
71
86
|
> **You:** Our buttons should be rounder, and links should use the brand red `#e60012`.
|
|
@@ -131,6 +146,6 @@ Had the agent written `"tanrei.comp.button.container.height.3x": { … }` under
|
|
|
131
146
|
|
|
132
147
|
## Inside the Tanrei monorepo
|
|
133
148
|
|
|
134
|
-
`bin/tanrei-mcp.js` runs the bundled `dist/server.js` with its copy of the vocabulary (`dist/vocabulary`: the sources under `tokens/` plus the presets' `fidelity.json` reports — no other build output —, `tanrei.config.json`, the mimicry-gaps registry) when `dist/` exists. Set `TANREI_MCP_FROM_SOURCE=1` to run `src/` against the repository's own `tokens/`. `pnpm --filter @tanrei/mcp build` produces `dist/`; `node --test` covers both modes over stdio.
|
|
149
|
+
`bin/tanrei-mcp.js` runs the bundled `dist/server.js` with its copy of the vocabulary (`dist/vocabulary`: the sources under `tokens/` plus the presets' `fidelity.json` reports and each system's `components.json` — no other build output —, the component catalog, the specs, `tanrei.config.json`, the mimicry-gaps registry; only what the server reads, so a spec leaves out what no tool returns, such as each rule's `verify`) when `dist/` exists. Set `TANREI_MCP_FROM_SOURCE=1` to run `src/` against the repository's own `tokens/`. `pnpm --filter @tanrei/mcp build` produces `dist/`; `node --test` covers both modes over stdio.
|
|
135
150
|
|
|
136
151
|
License: Apache-2.0.
|
package/bin/tanrei-mcp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// The published package carries a bundled server and its own copy of the vocabulary (dist/vocabulary): tokens/,
|
|
3
|
-
// tanrei.config.json and the mimicry-gaps registry. Inside the Tanrei monorepo the
|
|
4
|
-
// when there is no dist/, or when TANREI_MCP_FROM_SOURCE is set.
|
|
2
|
+
// The published package carries a bundled server and its own copy of the vocabulary (dist/vocabulary): tokens/, the
|
|
3
|
+
// component specs and catalog, tanrei.config.json and the mimicry-gaps registry. Inside the Tanrei monorepo the
|
|
4
|
+
// sources are used directly when there is no dist/, or when TANREI_MCP_FROM_SOURCE is set.
|
|
5
5
|
import fs from 'node:fs';
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|