@adobe/design-data-agent-mcp 1.3.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/.claude-plugin/plugin.json +10 -0
- package/LICENSE +201 -0
- package/README.md +114 -0
- package/package.json +54 -0
- package/skills/design-data/SKILL.md +187 -0
- package/src/cli.js +40 -0
- package/src/config.js +19 -0
- package/src/index.js +97 -0
- package/src/tools/authoring.js +313 -0
- package/src/tools/diff.js +48 -0
- package/src/tools/read.js +135 -0
- package/src/tools/validate.js +49 -0
- package/src/tools/write.js +48 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "design-data-agent",
|
|
3
|
+
"description": "Spec-conformant design token lookup, validation, diff, and authoring for any dataset via the design-data CLI.",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "Adobe"
|
|
6
|
+
},
|
|
7
|
+
"homepage": "https://github.com/adobe/spectrum-design-data/tree/main/tools/design-data-agent-mcp",
|
|
8
|
+
"repository": "https://github.com/adobe/spectrum-design-data",
|
|
9
|
+
"license": "Apache-2.0"
|
|
10
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# `@adobe/design-data-agent-mcp`
|
|
2
|
+
|
|
3
|
+
MCP server and Claude Code skill for the [Spectrum Design Data](../../packages/design-data-spec/) agent surface. Shells out to the `design-data` CLI — all logic stays in the Rust SDK.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
### Claude Code (skill + optional MCP)
|
|
8
|
+
|
|
9
|
+
Add the Spectrum Design Data marketplace, then install the spec-generic skill:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
/plugin marketplace add adobe/spectrum-design-data
|
|
13
|
+
/plugin install design-data-agent@spectrum-design-data
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
For Spectrum tokens with zero setup (embedded snapshot), install `design-data@spectrum-design-data` instead — see [`tools/design-data-skill/`](../design-data-skill/).
|
|
17
|
+
|
|
18
|
+
### Cursor (skill)
|
|
19
|
+
|
|
20
|
+
Cursor Settings → Rules → **Add Rule** → **Remote Rule (GitHub)** → paste:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
https://github.com/adobe/spectrum-design-data/tree/main/tools/design-data-agent-mcp/skills/design-data
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### npm (MCP server)
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
npx @adobe/design-data-agent-mcp
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Requires the `@adobe/design-data` CLI on `PATH` (or set `DESIGN_DATA_BIN`).
|
|
33
|
+
|
|
34
|
+
## MCP server
|
|
35
|
+
|
|
36
|
+
Configure your MCP client to run:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npx -y @adobe/design-data-agent-mcp
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Or from a repo clone:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
node tools/design-data-agent-mcp/src/index.js
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Environment variables
|
|
49
|
+
|
|
50
|
+
| Variable | Default | Description |
|
|
51
|
+
| ------------------------ | ------------- | ----------------------------------------- |
|
|
52
|
+
| `DESIGN_DATA_BIN` | `design-data` | Path to the `design-data` binary |
|
|
53
|
+
| `DESIGN_DATA_PATH` | `.` | Dataset root path |
|
|
54
|
+
| `DESIGN_DATA_COMPONENTS` | — | Override components directory |
|
|
55
|
+
| `DESIGN_DATA_FIELDS` | — | Override fields directory |
|
|
56
|
+
| `DESIGN_DATA_DIMENSIONS` | — | Override dimensions directory |
|
|
57
|
+
| `DESIGN_DATA_SCHEMAS` | — | Override schema path (for `validate`) |
|
|
58
|
+
| `DESIGN_DATA_EXCEPTIONS` | — | Override exceptions path (for `validate`) |
|
|
59
|
+
|
|
60
|
+
### Example (Cursor `.cursor/mcp.json`)
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"design-data-agent": {
|
|
66
|
+
"command": "npx",
|
|
67
|
+
"args": ["-y", "@adobe/design-data-agent-mcp"],
|
|
68
|
+
"env": {
|
|
69
|
+
"DESIGN_DATA_PATH": "./packages/tokens/src",
|
|
70
|
+
"DESIGN_DATA_COMPONENTS": "./packages/design-data-spec/components",
|
|
71
|
+
"DESIGN_DATA_FIELDS": "./packages/design-data-spec/fields",
|
|
72
|
+
"DESIGN_DATA_DIMENSIONS": "./packages/design-data-spec/dimensions"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Example (Claude Desktop `claude_desktop_config.json`)
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"design-data-agent": {
|
|
85
|
+
"command": "npx",
|
|
86
|
+
"args": ["-y", "@adobe/design-data-agent-mcp"],
|
|
87
|
+
"env": {
|
|
88
|
+
"DESIGN_DATA_BIN": "design-data",
|
|
89
|
+
"DESIGN_DATA_PATH": "/path/to/your/dataset"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Tools exposed
|
|
97
|
+
|
|
98
|
+
| Tool | Description |
|
|
99
|
+
| -------------------- | --------------------------------------------------------------- |
|
|
100
|
+
| `primer` | Load full token taxonomy, component list, and field definitions |
|
|
101
|
+
| `resolve_token` | Resolve a token property to its literal value |
|
|
102
|
+
| `query_tokens` | Filter tokens by expression |
|
|
103
|
+
| `describe_component` | Fetch component schema and token bindings |
|
|
104
|
+
| `validate_usage` | Validate token usage and return a diagnostic report |
|
|
105
|
+
| `diff_datasets` | Compare two datasets and return a semantic diff |
|
|
106
|
+
| `write` | Write agent-generated product context to the dataset |
|
|
107
|
+
|
|
108
|
+
## Skill
|
|
109
|
+
|
|
110
|
+
The Claude Code skill lives at [`skills/design-data/SKILL.md`](skills/design-data/SKILL.md). It shells out to `npx @adobe/design-data` for validate, query, resolve, diff, and write operations against local datasets.
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
Apache-2.0
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@adobe/design-data-agent-mcp",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "MCP server and Claude Code skill for the design-data agent surface — shells out to the design-data CLI",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./src/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"design-data-agent-mcp": "./src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"src/",
|
|
12
|
+
".claude-plugin/",
|
|
13
|
+
"skills/",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"start": "node src/index.js",
|
|
19
|
+
"test": "ava"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/adobe/spectrum-design-data.git",
|
|
24
|
+
"directory": "tools/design-data-agent-mcp"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/adobe/spectrum-design-data/issues"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/adobe/spectrum-design-data/tree/main/tools/design-data-agent-mcp#readme",
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public",
|
|
32
|
+
"registry": "https://registry.npmjs.org/",
|
|
33
|
+
"provenance": true
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@modelcontextprotocol/sdk": "^1.27.1"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"ava": "^6.0.1"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20.12.0"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"mcp",
|
|
46
|
+
"design-system",
|
|
47
|
+
"design-tokens",
|
|
48
|
+
"design-data",
|
|
49
|
+
"agent-surface",
|
|
50
|
+
"cli"
|
|
51
|
+
],
|
|
52
|
+
"author": "Adobe",
|
|
53
|
+
"license": "Apache-2.0"
|
|
54
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: design-data-agent
|
|
3
|
+
description: >
|
|
4
|
+
Validate, query, resolve, diff, and author spec-conformant design tokens and components using the
|
|
5
|
+
design-data CLI against a local dataset. Use when the user asks about design tokens, a design
|
|
6
|
+
system, token lookup, spec-conformance, drift detection, or token authoring on custom data.
|
|
7
|
+
when_to_use: >
|
|
8
|
+
Trigger on: design system, design tokens, spec-conformant, drift, validate tokens, token
|
|
9
|
+
authoring, custom dataset, DESIGN_DATA_PATH, design-data validate, design-data diff,
|
|
10
|
+
design-data write, product-context.json.
|
|
11
|
+
allowed-tools: Bash(npx @adobe/design-data *)
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# design-data agent skill
|
|
15
|
+
|
|
16
|
+
`design-data` is the reference CLI for the Spectrum Design Data specification. It validates, queries, resolves, and authors spec-conformant tokens and components from any dataset on the local filesystem.
|
|
17
|
+
|
|
18
|
+
Set two path variables once and reference them throughout. The token dataset and the spec catalog (components, fields, dimensions) live in separate directories:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
export DESIGN_DATA_PATH=./packages/tokens/src
|
|
22
|
+
export DESIGN_DATA_SPEC_PATH=./packages/design-data-spec
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For Spectrum tokens with zero setup (embedded snapshot), use the `design-data` skill instead — this skill targets custom or repo-local datasets.
|
|
26
|
+
|
|
27
|
+
## Bootstrap
|
|
28
|
+
|
|
29
|
+
On first use, ensure the CLI is available:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
npx @adobe/design-data --version
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
***
|
|
36
|
+
|
|
37
|
+
## Session start — call `primer` first
|
|
38
|
+
|
|
39
|
+
Call `primer` at the start of every session that touches design data. It returns the active dimensions, component list, taxonomy fields, and token count — structural context that scopes all subsequent lookups.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx @adobe/design-data primer "$DESIGN_DATA_PATH" --format json \
|
|
43
|
+
--components-dir "$DESIGN_DATA_SPEC_PATH/components" \
|
|
44
|
+
--fields-dir "$DESIGN_DATA_SPEC_PATH/fields" \
|
|
45
|
+
--dimensions-dir "$DESIGN_DATA_SPEC_PATH/dimensions"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Always pass `--components-dir`, `--fields-dir`, and `--dimensions-dir` explicitly. These directories live under `packages/design-data-spec/`, not under the token dataset. The CLI defaults probe those paths relative to CWD, so omitting the flags when running from an arbitrary directory (or with an absolute `DESIGN_DATA_PATH`) produces empty `components`, `taxonomyFields`, and `dimensions`.
|
|
49
|
+
|
|
50
|
+
The payload includes `specVersion`, `manifest`, `dimensions`, `components`, `taxonomyFields`, and `tokenCount`.
|
|
51
|
+
|
|
52
|
+
***
|
|
53
|
+
|
|
54
|
+
## Token lookup
|
|
55
|
+
|
|
56
|
+
### Resolve a token to its literal value
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx @adobe/design-data resolve <property> "$DESIGN_DATA_PATH" --format json \
|
|
60
|
+
[--color-scheme light|dark] \
|
|
61
|
+
[--scale desktop|mobile] \
|
|
62
|
+
[--contrast regular|high]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Example:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx @adobe/design-data resolve accent-background-color-default "$DESIGN_DATA_PATH" \
|
|
69
|
+
--format json --color-scheme dark --scale desktop
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Query tokens by filter expression
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npx @adobe/design-data query "$DESIGN_DATA_PATH" --filter "<expr>" --format json
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Valid filter keys: `property`, `component`, `variant`, `state`, `colorScheme`, `scale`, `contrast`, `uuid`, `$schema`. Any other key is a parse error. The dimension keys (`colorScheme`, `scale`, `contrast`) accept the same enum values as the `resolve` flags (`light`/`dark`, `desktop`/`mobile`, `regular`/`high`).
|
|
79
|
+
|
|
80
|
+
Filter syntax examples:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
property=background-color
|
|
84
|
+
property=*background*
|
|
85
|
+
component=button
|
|
86
|
+
component=button,state=hover
|
|
87
|
+
property=background-color|property=border-color
|
|
88
|
+
$schema=https://spectrum.adobe.com/page/design-token/
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
> **Exit codes:** `0` = matches found; `1` = no matches (returns `[]` — not an error); `>1` = error.
|
|
92
|
+
|
|
93
|
+
***
|
|
94
|
+
|
|
95
|
+
## Component info
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx @adobe/design-data component <id> --components-dir "$DESIGN_DATA_SPEC_PATH/components"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Returns the component contract: `name`, `displayName`, `options`, `anatomy`, `states`, and `tokenBindings`. Output is always JSON; there is no `--format` flag on this subcommand.
|
|
102
|
+
|
|
103
|
+
Pass `--components-dir` explicitly for the same reason as `primer` — the default probes CWD-relative paths that won't resolve in agent contexts.
|
|
104
|
+
|
|
105
|
+
Example:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npx @adobe/design-data component button --components-dir "$DESIGN_DATA_SPEC_PATH/components"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
***
|
|
112
|
+
|
|
113
|
+
## Validation
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npx @adobe/design-data validate "$DESIGN_DATA_PATH" --format json \
|
|
117
|
+
[--schema-path <path>] \
|
|
118
|
+
[--exceptions-path <path>] \
|
|
119
|
+
[--strict]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Returns a `ValidationReport` object: `{ layer: 1|2, errors: [...], warnings: [...] }` where each diagnostic has `rule_id` (e.g. `"SPEC-002"`), `severity` (`"error"` | `"warning"`), and `message`. Layer 1 is schema validation; Layer 2 is cascade-rule validation. `--strict` treats warnings as errors.
|
|
123
|
+
|
|
124
|
+
***
|
|
125
|
+
|
|
126
|
+
## Dataset diff
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
npx @adobe/design-data diff <old-path> <new-path> --format json [--filter <expr>]
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
> **Exit codes:** `0` = no changes; `1` = differences found (returns JSON diff — not an error); `>1` = error.
|
|
133
|
+
|
|
134
|
+
***
|
|
135
|
+
|
|
136
|
+
## Product-layer authoring
|
|
137
|
+
|
|
138
|
+
Write or update the product context document in the dataset:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npx @adobe/design-data write \
|
|
142
|
+
--output "$DESIGN_DATA_PATH/product-context.json" \
|
|
143
|
+
--rationale "Why these overrides exist"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Always pass `--output` with an explicit path inside the dataset. The default resolves relative to CWD, which is rarely correct in agent contexts.
|
|
147
|
+
|
|
148
|
+
Generates a product-context scaffold at the output path (`specVersion`, `layer: "product"`, `rationale`, attribution metadata). Creates the file if absent; overwrites if it already exists. The confirmation string returned to stdout on success is a plain text message — not JSON.
|
|
149
|
+
|
|
150
|
+
***
|
|
151
|
+
|
|
152
|
+
## Gotchas
|
|
153
|
+
|
|
154
|
+
* **Scale values:** `desktop` and `mobile` — not `medium`/`large`.
|
|
155
|
+
* **Contrast values:** `regular` and `high` — not `standard`/`high`.
|
|
156
|
+
* **`query` exit 1** means no matches and still emits `[]`. Only `>1` is an error.
|
|
157
|
+
* **`diff` exit 1** means changes were found. The JSON diff is in stdout — still a success result.
|
|
158
|
+
* **`--format json`** — always pass this in agent and script contexts; the CLI pretty-prints when stdout is a TTY.
|
|
159
|
+
|
|
160
|
+
## When working in Cursor
|
|
161
|
+
|
|
162
|
+
Cursor Settings → Rules → **Add Rule** → **Remote Rule (GitHub)** → paste this URL:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
https://github.com/adobe/spectrum-design-data/tree/main/tools/design-data-agent-mcp/skills/design-data
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
For always-available tool access (higher context cost), add `@adobe/design-data-agent-mcp` to `.cursor/mcp.json`:
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"mcpServers": {
|
|
173
|
+
"design-data-agent": {
|
|
174
|
+
"command": "npx",
|
|
175
|
+
"args": ["-y", "@adobe/design-data-agent-mcp"],
|
|
176
|
+
"env": {
|
|
177
|
+
"DESIGN_DATA_PATH": "./packages/tokens/src",
|
|
178
|
+
"DESIGN_DATA_COMPONENTS": "./packages/design-data-spec/components",
|
|
179
|
+
"DESIGN_DATA_FIELDS": "./packages/design-data-spec/fields",
|
|
180
|
+
"DESIGN_DATA_DIMENSIONS": "./packages/design-data-spec/dimensions"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Adjust paths to match your dataset layout.
|
package/src/cli.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright 2026 Adobe. All rights reserved.
|
|
2
|
+
// This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
+
// of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
//
|
|
6
|
+
// Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
+
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
+
// OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
+
// governing permissions and limitations under the License.
|
|
10
|
+
|
|
11
|
+
import { spawn } from "child_process";
|
|
12
|
+
import { config } from "./config.js";
|
|
13
|
+
|
|
14
|
+
export function runCli(args, { timeout = 10_000 } = {}) {
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
const proc = spawn(config.bin, args, {
|
|
17
|
+
// isolates CLI stdout from the MCP JSON-RPC stream on the parent's stdout
|
|
18
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
19
|
+
});
|
|
20
|
+
let stdout = "";
|
|
21
|
+
let stderr = "";
|
|
22
|
+
proc.stdout.on("data", (d) => {
|
|
23
|
+
stdout += d;
|
|
24
|
+
});
|
|
25
|
+
proc.stderr.on("data", (d) => {
|
|
26
|
+
stderr += d;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const timer = setTimeout(() => {
|
|
30
|
+
proc.kill();
|
|
31
|
+
reject(new Error(`design-data timed out after ${timeout}ms`));
|
|
32
|
+
}, timeout);
|
|
33
|
+
|
|
34
|
+
proc.on("close", (code) => {
|
|
35
|
+
clearTimeout(timer);
|
|
36
|
+
resolve({ exitCode: code, stdout: stdout.trim(), stderr: stderr.trim() });
|
|
37
|
+
});
|
|
38
|
+
proc.on("error", reject);
|
|
39
|
+
});
|
|
40
|
+
}
|
package/src/config.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright 2026 Adobe. All rights reserved.
|
|
2
|
+
// This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
+
// of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
//
|
|
6
|
+
// Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
+
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
+
// OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
+
// governing permissions and limitations under the License.
|
|
10
|
+
|
|
11
|
+
export const config = {
|
|
12
|
+
bin: process.env.DESIGN_DATA_BIN ?? "design-data",
|
|
13
|
+
dataPath: process.env.DESIGN_DATA_PATH ?? ".",
|
|
14
|
+
schemaPath: process.env.DESIGN_DATA_SCHEMAS ?? null,
|
|
15
|
+
exceptionsPath: process.env.DESIGN_DATA_EXCEPTIONS ?? null,
|
|
16
|
+
componentsDir: process.env.DESIGN_DATA_COMPONENTS ?? null,
|
|
17
|
+
fieldsDir: process.env.DESIGN_DATA_FIELDS ?? null,
|
|
18
|
+
dimensionsDir: process.env.DESIGN_DATA_DIMENSIONS ?? null,
|
|
19
|
+
};
|
package/src/index.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
// This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
// of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
//
|
|
7
|
+
// Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
// OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
// governing permissions and limitations under the License.
|
|
11
|
+
|
|
12
|
+
import { readFileSync } from "fs";
|
|
13
|
+
import { fileURLToPath } from "url";
|
|
14
|
+
import { resolve, dirname } from "path";
|
|
15
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
16
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
17
|
+
import {
|
|
18
|
+
CallToolRequestSchema,
|
|
19
|
+
ListToolsRequestSchema,
|
|
20
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
21
|
+
import { createAuthoringTools } from "./tools/authoring.js";
|
|
22
|
+
import { createReadTools } from "./tools/read.js";
|
|
23
|
+
import { createValidateTools } from "./tools/validate.js";
|
|
24
|
+
import { createDiffTools } from "./tools/diff.js";
|
|
25
|
+
import { createWriteTools } from "./tools/write.js";
|
|
26
|
+
|
|
27
|
+
export function createAllTools() {
|
|
28
|
+
return [
|
|
29
|
+
...createReadTools(),
|
|
30
|
+
...createValidateTools(),
|
|
31
|
+
...createDiffTools(),
|
|
32
|
+
...createWriteTools(),
|
|
33
|
+
...createAuthoringTools(),
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function createMCPServer() {
|
|
38
|
+
const pkg = JSON.parse(
|
|
39
|
+
readFileSync(
|
|
40
|
+
resolve(dirname(fileURLToPath(import.meta.url)), "../package.json"),
|
|
41
|
+
"utf8",
|
|
42
|
+
),
|
|
43
|
+
);
|
|
44
|
+
const allTools = createAllTools();
|
|
45
|
+
const server = new Server(
|
|
46
|
+
{ name: "design-data-agent-mcp", version: pkg.version },
|
|
47
|
+
{ capabilities: { tools: {} } },
|
|
48
|
+
);
|
|
49
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
50
|
+
tools: allTools.map(({ name, description, inputSchema }) => ({
|
|
51
|
+
name,
|
|
52
|
+
description,
|
|
53
|
+
inputSchema,
|
|
54
|
+
})),
|
|
55
|
+
}));
|
|
56
|
+
server.setRequestHandler(
|
|
57
|
+
CallToolRequestSchema,
|
|
58
|
+
async ({ params: { name, arguments: args } }) => {
|
|
59
|
+
const tool = allTools.find((t) => t.name === name);
|
|
60
|
+
if (!tool) throw new Error(`Unknown tool: ${name}`);
|
|
61
|
+
try {
|
|
62
|
+
const result = await tool.handler(args ?? {});
|
|
63
|
+
return {
|
|
64
|
+
content: [
|
|
65
|
+
{
|
|
66
|
+
type: "text",
|
|
67
|
+
text:
|
|
68
|
+
typeof result === "string"
|
|
69
|
+
? result
|
|
70
|
+
: JSON.stringify(result, null, 2),
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
} catch (err) {
|
|
75
|
+
return {
|
|
76
|
+
content: [{ type: "text", text: err.message }],
|
|
77
|
+
isError: true,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
return server;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function startServer() {
|
|
86
|
+
const server = createMCPServer();
|
|
87
|
+
const transport = new StdioServerTransport();
|
|
88
|
+
await server.connect(transport);
|
|
89
|
+
console.error("design-data-agent-mcp started");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
93
|
+
startServer().catch((err) => {
|
|
94
|
+
console.error(err);
|
|
95
|
+
process.exit(1);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
// Copyright 2026 Adobe. All rights reserved.
|
|
2
|
+
// This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
+
// of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
//
|
|
6
|
+
// Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
+
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
+
// OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
+
// governing permissions and limitations under the License.
|
|
10
|
+
|
|
11
|
+
//! MCP authoring-session tools (RFC #973 Q4).
|
|
12
|
+
//!
|
|
13
|
+
//! Each tool maps to one `design-data authoring-session` CLI subcommand.
|
|
14
|
+
//! State is held on disk (one JSON file per session); the CLI is stateless.
|
|
15
|
+
|
|
16
|
+
import { runCli } from "../cli.js";
|
|
17
|
+
import { config } from "../config.js";
|
|
18
|
+
|
|
19
|
+
async function callCli(args) {
|
|
20
|
+
const { exitCode, stdout, stderr } = await runCli(args, { timeout: 30_000 });
|
|
21
|
+
if (exitCode !== 0)
|
|
22
|
+
throw new Error(stderr || `authoring-session exited ${exitCode}`);
|
|
23
|
+
return JSON.parse(stdout);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function createAuthoringTools() {
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
name: "start_authoring_session",
|
|
30
|
+
description:
|
|
31
|
+
"Start a new token authoring session. Returns a session_id and the initial wizard state. " +
|
|
32
|
+
"The session persists across calls — use the returned session_id in subsequent steps.",
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: "object",
|
|
35
|
+
properties: {
|
|
36
|
+
dataset_path: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description:
|
|
39
|
+
"Path to the token dataset directory. Defaults to DESIGN_DATA_PATH.",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
additionalProperties: false,
|
|
43
|
+
},
|
|
44
|
+
async handler({ dataset_path } = {}) {
|
|
45
|
+
const path = dataset_path ?? config.dataPath;
|
|
46
|
+
if (!path) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
"dataset_path is required (or set DESIGN_DATA_PATH in the environment)",
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return callCli(["authoring-session", "start", path]);
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
{
|
|
56
|
+
name: "authoring_session_step_intent",
|
|
57
|
+
description:
|
|
58
|
+
"Update the intent for a session and get ranked existing-token suggestions. " +
|
|
59
|
+
"Returns suggestions and can_alias (true when a high-confidence match exists).",
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: "object",
|
|
62
|
+
required: ["session_id", "intent"],
|
|
63
|
+
properties: {
|
|
64
|
+
session_id: { type: "string" },
|
|
65
|
+
intent: {
|
|
66
|
+
type: "string",
|
|
67
|
+
description:
|
|
68
|
+
"Natural-language description of what the token is for, e.g. 'accent background color'.",
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
additionalProperties: false,
|
|
72
|
+
},
|
|
73
|
+
async handler({ session_id, intent }) {
|
|
74
|
+
return callCli([
|
|
75
|
+
"authoring-session",
|
|
76
|
+
"step",
|
|
77
|
+
"intent",
|
|
78
|
+
"--session-id",
|
|
79
|
+
session_id,
|
|
80
|
+
"--intent",
|
|
81
|
+
intent,
|
|
82
|
+
]);
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
{
|
|
87
|
+
name: "authoring_session_step_classification",
|
|
88
|
+
description:
|
|
89
|
+
"Set the layer, property, and name-object fields for the token. " +
|
|
90
|
+
"name_fields is an array of {key, value} objects.",
|
|
91
|
+
inputSchema: {
|
|
92
|
+
type: "object",
|
|
93
|
+
required: ["session_id", "layer", "property"],
|
|
94
|
+
properties: {
|
|
95
|
+
session_id: { type: "string" },
|
|
96
|
+
layer: {
|
|
97
|
+
type: "string",
|
|
98
|
+
enum: ["foundation", "platform", "product"],
|
|
99
|
+
description: "Token layer.",
|
|
100
|
+
},
|
|
101
|
+
property: {
|
|
102
|
+
type: "string",
|
|
103
|
+
description: "Token property, e.g. 'background-color'.",
|
|
104
|
+
},
|
|
105
|
+
name_fields: {
|
|
106
|
+
type: "array",
|
|
107
|
+
items: {
|
|
108
|
+
type: "object",
|
|
109
|
+
required: ["key", "value"],
|
|
110
|
+
properties: {
|
|
111
|
+
key: { type: "string" },
|
|
112
|
+
value: { type: "string" },
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
description: "Additional name-object fields beyond property.",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
additionalProperties: false,
|
|
119
|
+
},
|
|
120
|
+
async handler({ session_id, layer, property, name_fields = [] }) {
|
|
121
|
+
const args = [
|
|
122
|
+
"authoring-session",
|
|
123
|
+
"step",
|
|
124
|
+
"classification",
|
|
125
|
+
"--session-id",
|
|
126
|
+
session_id,
|
|
127
|
+
"--layer",
|
|
128
|
+
layer,
|
|
129
|
+
"--property",
|
|
130
|
+
property,
|
|
131
|
+
];
|
|
132
|
+
for (const { key, value } of name_fields) {
|
|
133
|
+
args.push("--name-field", `${key}=${value}`);
|
|
134
|
+
}
|
|
135
|
+
return callCli(args);
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
{
|
|
140
|
+
name: "authoring_session_step_values",
|
|
141
|
+
description:
|
|
142
|
+
"Set the value rows for the token. Each row specifies mode conditions and either " +
|
|
143
|
+
"a literal value or an alias target. Most tokens need one row with empty mode_combo.",
|
|
144
|
+
inputSchema: {
|
|
145
|
+
type: "object",
|
|
146
|
+
required: ["session_id", "rows"],
|
|
147
|
+
properties: {
|
|
148
|
+
session_id: { type: "string" },
|
|
149
|
+
rows: {
|
|
150
|
+
type: "array",
|
|
151
|
+
description:
|
|
152
|
+
"Value rows. Each: { mode_combo: [[key,val],...], kind: 'Literal'|'Alias', " +
|
|
153
|
+
"alias_target: string, literal: string }",
|
|
154
|
+
items: {
|
|
155
|
+
type: "object",
|
|
156
|
+
required: ["mode_combo", "kind", "alias_target", "literal"],
|
|
157
|
+
properties: {
|
|
158
|
+
mode_combo: {
|
|
159
|
+
type: "array",
|
|
160
|
+
items: {
|
|
161
|
+
type: "array",
|
|
162
|
+
items: { type: "string" },
|
|
163
|
+
minItems: 2,
|
|
164
|
+
maxItems: 2,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
kind: { type: "string", enum: ["Literal", "Alias"] },
|
|
168
|
+
alias_target: { type: "string" },
|
|
169
|
+
literal: { type: "string" },
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
additionalProperties: false,
|
|
175
|
+
},
|
|
176
|
+
async handler({ session_id, rows }) {
|
|
177
|
+
return callCli([
|
|
178
|
+
"authoring-session",
|
|
179
|
+
"step",
|
|
180
|
+
"values",
|
|
181
|
+
"--session-id",
|
|
182
|
+
session_id,
|
|
183
|
+
"--rows",
|
|
184
|
+
JSON.stringify(rows),
|
|
185
|
+
]);
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
{
|
|
190
|
+
name: "authoring_session_commit",
|
|
191
|
+
description:
|
|
192
|
+
"Build and write the token to disk, then remove the session. " +
|
|
193
|
+
"Requires schema_url (the JSON Schema URL for the token type) and target (output file path).",
|
|
194
|
+
inputSchema: {
|
|
195
|
+
type: "object",
|
|
196
|
+
required: ["session_id", "schema_url", "target"],
|
|
197
|
+
properties: {
|
|
198
|
+
session_id: { type: "string" },
|
|
199
|
+
schema_url: {
|
|
200
|
+
type: "string",
|
|
201
|
+
description:
|
|
202
|
+
"The $schema URL for the token type, e.g. https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
|
|
203
|
+
},
|
|
204
|
+
target: {
|
|
205
|
+
type: "string",
|
|
206
|
+
description:
|
|
207
|
+
"Target legacy JSON file to write to (created if absent, merged if present).",
|
|
208
|
+
},
|
|
209
|
+
rationale: {
|
|
210
|
+
type: "string",
|
|
211
|
+
description: "Why this token is being created.",
|
|
212
|
+
},
|
|
213
|
+
product_context: {
|
|
214
|
+
type: "string",
|
|
215
|
+
description: "Path to product-context.json for rationale capture.",
|
|
216
|
+
},
|
|
217
|
+
schema_path: {
|
|
218
|
+
type: "string",
|
|
219
|
+
description:
|
|
220
|
+
"Path to schemas directory. Defaults to packages/tokens/schemas relative to target.",
|
|
221
|
+
},
|
|
222
|
+
is_override: {
|
|
223
|
+
type: "boolean",
|
|
224
|
+
description:
|
|
225
|
+
"True when this token overrides an existing foundation/platform token.",
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
additionalProperties: false,
|
|
229
|
+
},
|
|
230
|
+
async handler({
|
|
231
|
+
session_id,
|
|
232
|
+
schema_url,
|
|
233
|
+
target,
|
|
234
|
+
rationale = "",
|
|
235
|
+
product_context,
|
|
236
|
+
schema_path,
|
|
237
|
+
is_override = false,
|
|
238
|
+
}) {
|
|
239
|
+
const args = [
|
|
240
|
+
"authoring-session",
|
|
241
|
+
"commit",
|
|
242
|
+
"--session-id",
|
|
243
|
+
session_id,
|
|
244
|
+
"--schema-url",
|
|
245
|
+
schema_url,
|
|
246
|
+
"--target",
|
|
247
|
+
target,
|
|
248
|
+
"--rationale",
|
|
249
|
+
rationale,
|
|
250
|
+
];
|
|
251
|
+
if (product_context) args.push("--product-context", product_context);
|
|
252
|
+
if (schema_path) args.push("--schema-path", schema_path);
|
|
253
|
+
if (is_override) args.push("--is-override");
|
|
254
|
+
return callCli(args);
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
{
|
|
259
|
+
name: "authoring_session_cancel",
|
|
260
|
+
description: "Cancel a session and delete its on-disk file.",
|
|
261
|
+
inputSchema: {
|
|
262
|
+
type: "object",
|
|
263
|
+
required: ["session_id"],
|
|
264
|
+
properties: {
|
|
265
|
+
session_id: { type: "string" },
|
|
266
|
+
},
|
|
267
|
+
additionalProperties: false,
|
|
268
|
+
},
|
|
269
|
+
async handler({ session_id }) {
|
|
270
|
+
return callCli([
|
|
271
|
+
"authoring-session",
|
|
272
|
+
"cancel",
|
|
273
|
+
"--session-id",
|
|
274
|
+
session_id,
|
|
275
|
+
]);
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
{
|
|
280
|
+
name: "authoring_session_get",
|
|
281
|
+
description: "Get the current state of an authoring session.",
|
|
282
|
+
inputSchema: {
|
|
283
|
+
type: "object",
|
|
284
|
+
required: ["session_id"],
|
|
285
|
+
properties: {
|
|
286
|
+
session_id: { type: "string" },
|
|
287
|
+
},
|
|
288
|
+
additionalProperties: false,
|
|
289
|
+
},
|
|
290
|
+
async handler({ session_id }) {
|
|
291
|
+
return callCli([
|
|
292
|
+
"authoring-session",
|
|
293
|
+
"get",
|
|
294
|
+
"--session-id",
|
|
295
|
+
session_id,
|
|
296
|
+
]);
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
{
|
|
301
|
+
name: "authoring_session_list",
|
|
302
|
+
description: "List all active authoring sessions.",
|
|
303
|
+
inputSchema: {
|
|
304
|
+
type: "object",
|
|
305
|
+
properties: {},
|
|
306
|
+
additionalProperties: false,
|
|
307
|
+
},
|
|
308
|
+
async handler() {
|
|
309
|
+
return callCli(["authoring-session", "list"]);
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
];
|
|
313
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright 2026 Adobe. All rights reserved.
|
|
2
|
+
// This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
+
// of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
//
|
|
6
|
+
// Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
+
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
+
// OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
+
// governing permissions and limitations under the License.
|
|
10
|
+
|
|
11
|
+
import { runCli } from "../cli.js";
|
|
12
|
+
|
|
13
|
+
export function createDiffTools() {
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
name: "diff_datasets",
|
|
17
|
+
description:
|
|
18
|
+
"Compare two design data datasets and return a JSON diff of added, removed, and changed tokens.",
|
|
19
|
+
inputSchema: {
|
|
20
|
+
type: "object",
|
|
21
|
+
required: ["oldPath", "newPath"],
|
|
22
|
+
properties: {
|
|
23
|
+
oldPath: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "Path to the old/baseline dataset",
|
|
26
|
+
},
|
|
27
|
+
newPath: {
|
|
28
|
+
type: "string",
|
|
29
|
+
description: "Path to the new/updated dataset",
|
|
30
|
+
},
|
|
31
|
+
filter: {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: "Optional filter expression to narrow results",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
additionalProperties: false,
|
|
37
|
+
},
|
|
38
|
+
async handler({ oldPath, newPath, filter }) {
|
|
39
|
+
const args = ["diff", oldPath, newPath, "--format", "json"];
|
|
40
|
+
if (filter) args.push("--filter", filter);
|
|
41
|
+
const { exitCode, stdout, stderr } = await runCli(args);
|
|
42
|
+
// exit code 1 means differences found — that is a valid result, not an error
|
|
43
|
+
if (exitCode > 1) throw new Error(stderr || `diff exited ${exitCode}`);
|
|
44
|
+
return JSON.parse(stdout);
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// Copyright 2026 Adobe. All rights reserved.
|
|
2
|
+
// This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
+
// of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
//
|
|
6
|
+
// Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
+
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
+
// OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
+
// governing permissions and limitations under the License.
|
|
10
|
+
|
|
11
|
+
import { runCli } from "../cli.js";
|
|
12
|
+
import { config } from "../config.js";
|
|
13
|
+
|
|
14
|
+
export function createReadTools() {
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
name: "primer",
|
|
18
|
+
description:
|
|
19
|
+
"Load the design data primer: full token taxonomy, resolved values, component list, and field definitions. Call this at the start of an agent session.",
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {},
|
|
23
|
+
additionalProperties: false,
|
|
24
|
+
},
|
|
25
|
+
async handler() {
|
|
26
|
+
const args = ["primer", config.dataPath, "--format", "json"];
|
|
27
|
+
if (config.componentsDir)
|
|
28
|
+
args.push("--components-dir", config.componentsDir);
|
|
29
|
+
if (config.fieldsDir) args.push("--fields-dir", config.fieldsDir);
|
|
30
|
+
if (config.dimensionsDir)
|
|
31
|
+
args.push("--dimensions-dir", config.dimensionsDir);
|
|
32
|
+
const { exitCode, stdout, stderr } = await runCli(args);
|
|
33
|
+
if (exitCode !== 0)
|
|
34
|
+
throw new Error(stderr || `primer exited ${exitCode}`);
|
|
35
|
+
return JSON.parse(stdout);
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "resolve_token",
|
|
40
|
+
description:
|
|
41
|
+
"Resolve a design token property to its final value for a given color scheme, scale, and contrast level.",
|
|
42
|
+
inputSchema: {
|
|
43
|
+
type: "object",
|
|
44
|
+
required: ["property"],
|
|
45
|
+
properties: {
|
|
46
|
+
property: {
|
|
47
|
+
type: "string",
|
|
48
|
+
description:
|
|
49
|
+
"Token property name, e.g. accent-background-color-default",
|
|
50
|
+
},
|
|
51
|
+
colorScheme: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "Color scheme: light or dark",
|
|
54
|
+
},
|
|
55
|
+
scale: {
|
|
56
|
+
type: "string",
|
|
57
|
+
enum: ["desktop", "mobile"],
|
|
58
|
+
description: "Scale: desktop or mobile",
|
|
59
|
+
},
|
|
60
|
+
contrast: {
|
|
61
|
+
type: "string",
|
|
62
|
+
enum: ["regular", "high"],
|
|
63
|
+
description: "Contrast: regular or high",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
additionalProperties: false,
|
|
67
|
+
},
|
|
68
|
+
async handler({ property, colorScheme, scale, contrast }) {
|
|
69
|
+
const args = ["resolve", property, config.dataPath, "--format", "json"];
|
|
70
|
+
// resolve uses --dimensions-path (old flag name, not --dimensions-dir)
|
|
71
|
+
if (config.dimensionsDir)
|
|
72
|
+
args.push("--dimensions-path", config.dimensionsDir);
|
|
73
|
+
if (colorScheme) args.push("--color-scheme", colorScheme);
|
|
74
|
+
if (scale) args.push("--scale", scale);
|
|
75
|
+
if (contrast) args.push("--contrast", contrast);
|
|
76
|
+
const { exitCode, stdout, stderr } = await runCli(args);
|
|
77
|
+
if (exitCode !== 0)
|
|
78
|
+
throw new Error(stderr || `resolve exited ${exitCode}`);
|
|
79
|
+
return JSON.parse(stdout);
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "query_tokens",
|
|
84
|
+
description:
|
|
85
|
+
"Query design tokens using a filter expression. Returns matching token entries.",
|
|
86
|
+
inputSchema: {
|
|
87
|
+
type: "object",
|
|
88
|
+
required: ["filter"],
|
|
89
|
+
properties: {
|
|
90
|
+
filter: {
|
|
91
|
+
type: "string",
|
|
92
|
+
description: 'Filter expression, e.g. "category=color"',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
additionalProperties: false,
|
|
96
|
+
},
|
|
97
|
+
async handler({ filter }) {
|
|
98
|
+
const args = [
|
|
99
|
+
"query",
|
|
100
|
+
config.dataPath,
|
|
101
|
+
"--filter",
|
|
102
|
+
filter,
|
|
103
|
+
"--format",
|
|
104
|
+
"json",
|
|
105
|
+
];
|
|
106
|
+
const { exitCode, stdout, stderr } = await runCli(args);
|
|
107
|
+
// exit code 1 means no matches — still valid JSON []
|
|
108
|
+
if (exitCode > 1) throw new Error(stderr || `query exited ${exitCode}`);
|
|
109
|
+
return JSON.parse(stdout);
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "describe_component",
|
|
114
|
+
description:
|
|
115
|
+
"Return the JSON schema and token bindings for a design system component by its ID.",
|
|
116
|
+
inputSchema: {
|
|
117
|
+
type: "object",
|
|
118
|
+
required: ["id"],
|
|
119
|
+
properties: {
|
|
120
|
+
id: { type: "string", description: "Component ID, e.g. button" },
|
|
121
|
+
},
|
|
122
|
+
additionalProperties: false,
|
|
123
|
+
},
|
|
124
|
+
async handler({ id }) {
|
|
125
|
+
const args = ["component", id];
|
|
126
|
+
if (config.componentsDir)
|
|
127
|
+
args.push("--components-dir", config.componentsDir);
|
|
128
|
+
const { exitCode, stdout, stderr } = await runCli(args);
|
|
129
|
+
if (exitCode !== 0)
|
|
130
|
+
throw new Error(stderr || `component exited ${exitCode}`);
|
|
131
|
+
return JSON.parse(stdout);
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
];
|
|
135
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Copyright 2026 Adobe. All rights reserved.
|
|
2
|
+
// This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
+
// of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
//
|
|
6
|
+
// Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
+
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
+
// OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
+
// governing permissions and limitations under the License.
|
|
10
|
+
|
|
11
|
+
import { runCli } from "../cli.js";
|
|
12
|
+
import { config } from "../config.js";
|
|
13
|
+
|
|
14
|
+
export function createValidateTools() {
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
name: "validate_usage",
|
|
18
|
+
description:
|
|
19
|
+
"Validate design token usage in a dataset. Returns a JSON report of violations and warnings.",
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
path: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description:
|
|
26
|
+
"Path to dataset to validate (defaults to DESIGN_DATA_PATH)",
|
|
27
|
+
},
|
|
28
|
+
strict: { type: "boolean", description: "Treat warnings as errors" },
|
|
29
|
+
},
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
},
|
|
32
|
+
async handler({ path, strict } = {}) {
|
|
33
|
+
const target = path ?? config.dataPath;
|
|
34
|
+
const args = ["validate", target, "--format", "json"];
|
|
35
|
+
if (config.schemaPath) args.push("--schema-path", config.schemaPath);
|
|
36
|
+
if (config.exceptionsPath)
|
|
37
|
+
args.push("--exceptions-path", config.exceptionsPath);
|
|
38
|
+
// validate uses --dimensions-path (old flag name, not --dimensions-dir)
|
|
39
|
+
if (config.dimensionsDir)
|
|
40
|
+
args.push("--dimensions-path", config.dimensionsDir);
|
|
41
|
+
if (strict === true) args.push("--strict");
|
|
42
|
+
const { exitCode, stdout, stderr } = await runCli(args);
|
|
43
|
+
if (exitCode !== 0 && !stdout)
|
|
44
|
+
throw new Error(stderr || `validate exited ${exitCode}`);
|
|
45
|
+
return JSON.parse(stdout);
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright 2026 Adobe. All rights reserved.
|
|
2
|
+
// This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
|
+
// of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
//
|
|
6
|
+
// Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
+
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
+
// OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
+
// governing permissions and limitations under the License.
|
|
10
|
+
|
|
11
|
+
import { join } from "path";
|
|
12
|
+
import { runCli } from "../cli.js";
|
|
13
|
+
import { config } from "../config.js";
|
|
14
|
+
|
|
15
|
+
export function createWriteTools() {
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
name: "write",
|
|
19
|
+
description:
|
|
20
|
+
"Write agent-generated design context to the dataset (e.g. product-context.json). Returns a confirmation message.",
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: {
|
|
24
|
+
output: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description:
|
|
27
|
+
"Output file path (defaults to product-context.json inside DESIGN_DATA_PATH)",
|
|
28
|
+
},
|
|
29
|
+
rationale: {
|
|
30
|
+
type: "string",
|
|
31
|
+
description: "Rationale or summary to embed in the written file",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
additionalProperties: false,
|
|
35
|
+
},
|
|
36
|
+
async handler({ output, rationale } = {}) {
|
|
37
|
+
const resolvedOutput =
|
|
38
|
+
output ?? join(config.dataPath, "product-context.json");
|
|
39
|
+
const args = ["write", "--output", resolvedOutput];
|
|
40
|
+
if (rationale) args.push("--rationale", rationale);
|
|
41
|
+
const { exitCode, stdout, stderr } = await runCli(args);
|
|
42
|
+
if (exitCode !== 0)
|
|
43
|
+
throw new Error(stderr || `write exited ${exitCode}`);
|
|
44
|
+
return stdout;
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
}
|