spec-layer 0.3.0 → 0.4.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.
Files changed (3) hide show
  1. package/README.md +47 -11
  2. package/dist/cli.js +1376 -28
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -51,17 +51,21 @@ npm install --save-dev spec-layer
51
51
 
52
52
  `npx spec-layer` then runs the pinned local copy, no `--yes` needed. Pinning
53
53
  also keeps `.speclayer/manifest.json` on one format: 0.1.0 wrote no
54
- `selection` field, and 0.2.0 does.
54
+ `selection` field, and 0.2.0 onward does. `setup` needs 0.3.0 or later; earlier
55
+ versions have no such command, so the setup command the plugin copies fails
56
+ against them. The Foundation landing under `tokens/` as Design Tokens Format
57
+ Module 2025.10 files, rather than `ai/foundation.yaml`, needs 0.4.0 or later.
55
58
 
56
59
  ## Commands
57
60
 
58
61
  | Command | What it does |
59
62
  |---|---|
60
- | `init --id lib_... [--out DIR] [selection]` | Writes `speclayer.json` so later commands need no flags. |
63
+ | `setup --id lib_... --key sl_... [--out DIR] [selection]` | Writes `speclayer.json`, stores the key in `speclayer.local.json`, then pulls. The command the plugin copies. |
64
+ | `init --id lib_... [--out DIR] [selection]` | Writes `speclayer.json` so later commands need no flags. No key, no network. |
61
65
  | `pull [--id lib_...] [--key sl_...] [selection]` | Fetches the library and writes it into `DIR` (default `.speclayer`). |
62
66
  | `status [--id lib_...] [--key sl_...]` | Checks freshness without writing. Exits `2` when the local copy is behind. |
63
67
  | `list` | Lists every artifact in the last pull, with its file path or `not written`. |
64
- | `show foundation [--canonical]` | Prints the Foundation's AI YAML to stdout. |
68
+ | `show foundation [--canonical]` | Prints the Foundation's DTCG document to stdout. |
65
69
  | `show component NAME [--canonical]` | Prints one component's AI YAML to stdout. |
66
70
 
67
71
  `--api URL` overrides the API origin (default `https://api.spec-layer.com`).
@@ -166,15 +170,22 @@ matter what the ignore rules say.
166
170
 
167
171
  ```text
168
172
  .speclayer/
169
- bundle.json the published bundle, verbatim
170
- manifest.json every artifact indexed by content hash and ai path, plus the selection
171
- ai/foundation.yaml tokens, styles, and modes (when selected and the library has a Foundation)
172
- ai/components/<name>.yaml one file per selected component
173
+ bundle.json the published bundle, verbatim
174
+ manifest.json every artifact indexed by content hash and path, plus the selection
175
+ tokens/ the Foundation as Design Tokens Format Module 2025.10 files
176
+ <collection>.<mode>.json one file per collection and mode, rooted at the collection name
177
+ styles.typography.json text styles as typography composites (when present)
178
+ styles.effects.json effect styles as shadow composites (when present)
179
+ resolver.json Design Tokens Resolver Module 2025.10: sets, modifiers, order
180
+ spec-layer.meta.json Figma ids, scopes, code syntax, publication, keyed by DTCG path
181
+ report.json what DTCG could not express, with reasons and stable ids
182
+ ai/components/<name>.yaml one file per selected component
173
183
  ```
174
184
 
175
- Point your agent at `.speclayer/ai/`. The YAML there is the same compact form
176
- the plugin's **Copy for AI** puts on your clipboard; `bundle.json` additionally
177
- holds the full canonical artifacts if you need them.
185
+ Point your agent at `.speclayer/ai/` and `.speclayer/tokens/`. The component
186
+ YAML is the same compact form the plugin's **Copy for AI** puts on your
187
+ clipboard; `bundle.json` additionally holds the full canonical artifacts if
188
+ you need them.
178
189
 
179
190
  In `manifest.json`, an artifact the selection left unwritten has `"aiPath":
180
191
  null`. A manifest from CLI 0.1.0 has no `selection` field and means
@@ -189,7 +200,32 @@ When nothing changed since the last pull with the same selection, `pull`
189
200
  prints `Already up to date` and writes nothing. Every republish stamps a new
190
201
  export id and time into the canonical artifacts, so `bundle.json` and
191
202
  `manifest.json` change on each republish even when the content did not. The
192
- `ai/` YAML files and the content hashes stay stable.
203
+ `ai/` YAML files, the `tokens/` files, and the content hashes stay stable.
204
+
205
+ ## Configuring the token output
206
+
207
+ `speclayer.json` may carry a `dtcg` block:
208
+
209
+ {
210
+ "libraryId": "lib_...",
211
+ "outDir": ".speclayer",
212
+ "dtcg": {
213
+ "values": "standard",
214
+ "units": { "Foundation/spacing/*": "px", "Foundation/radius/*": "px" }
215
+ }
216
+ }
217
+
218
+ `values` is `standard` (the 2025.10 object forms, the default) or `legacy`
219
+ (the string forms Style Dictionary 4 and Tokens Studio read today). `units`
220
+ promotes a number whose Figma scopes state no unit to a dimension. Keys are a
221
+ collection name, a slash, and a glob over the variable name. An override that
222
+ contradicts a stated scope is ignored and listed in `report.json`. Nothing is
223
+ inferred from a name. Changing the `dtcg` block re-projects `tokens/` on the
224
+ next `pull` even when the library has not been republished.
225
+
226
+ Point Style Dictionary at `.speclayer/tokens/` and load the files
227
+ `resolver.json` names for the mode you are building. The metadata sidecar and
228
+ the report are not token files; exclude them from token globs.
193
229
 
194
230
  ## Exit codes
195
231