@getvitops/cli 0.4.0 → 0.6.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/README.md +28 -13
- package/dist/cli.mjs +182 -26
- package/dist/cli.mjs.map +1 -1
- package/package.json +8 -4
- package/skill/SKILL.md +46 -0
package/README.md
CHANGED
|
@@ -23,7 +23,8 @@ npx vitops generate --format bricks,css --out dist
|
|
|
23
23
|
| `vitops validate <file>` | schema-check (non-zero exit on error) |
|
|
24
24
|
| `vitops generate -i <file> -f <formats> -o <dir>` | generate `bricks` / `css` / `tailwind` output |
|
|
25
25
|
| `vitops favicon -i <svg\|png> -o <dir>` | generate a favicon set from a source image |
|
|
26
|
-
| `vitops agents [-o AGENTS.md] [--docs-dir <dir>]` |
|
|
26
|
+
| `vitops agents [-o AGENTS.md] [--docs-dir <dir>]` | link the agent skill + AGENTS.md pointer |
|
|
27
|
+
| `vitops docs [topic] [--all]` | print live reference docs to stdout |
|
|
27
28
|
|
|
28
29
|
## Using the output
|
|
29
30
|
|
|
@@ -79,22 +80,36 @@ The CLI only writes files — how they reach WordPress is up to you:
|
|
|
79
80
|
- **CI:** run `vitops generate --format bricks` in your pipeline and deploy the artifact the
|
|
80
81
|
same way you deploy the rest of the theme.
|
|
81
82
|
|
|
82
|
-
## Teaching AI agents (`vitops agents`)
|
|
83
|
+
## Teaching AI agents (`vitops agents` + `vitops docs`)
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
This package **ships an agent skill** (`skill/SKILL.md`, the [Agent Skills](https://code.claude.com/docs/en/skills)
|
|
86
|
+
format) that teaches AI coding agents to fetch design-system context on demand. Nothing is
|
|
87
|
+
generated into your repo — reference docs print live via `vitops docs`:
|
|
87
88
|
|
|
88
89
|
```sh
|
|
89
|
-
vitops
|
|
90
|
-
vitops
|
|
90
|
+
vitops docs # list topics
|
|
91
|
+
vitops docs classes # the class vocabulary, rendered from YOUR design-system.json
|
|
92
|
+
vitops docs authoring # every config field, from the JSON Schema
|
|
93
|
+
vitops docs formats # tailwind vs css vs bricks (incl. which utilities Tailwind owns)
|
|
91
94
|
```
|
|
92
95
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
Because output is rendered at call time from your config + the installed package version, it is
|
|
97
|
+
never stale. `vitops agents` wires up discovery:
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
vitops agents # links the skill + updates ./AGENTS.md
|
|
101
|
+
vitops agents --out CLAUDE.md # different pointer file
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
It symlinks `.agents/skills/vitops-design-system` and `.claude/skills/vitops-design-system` to the
|
|
105
|
+
skill inside the installed package (the links target the logical `node_modules/@getvitops/cli/skill`
|
|
106
|
+
path, so they survive version bumps and reinstalls — re-run only if you delete them), and writes a
|
|
107
|
+
marker-delimited **managed block** into your `AGENTS.md` listing the CLI commands and `vitops docs`
|
|
108
|
+
topics. Re-running only replaces the content between the `<!-- vitops:start -->` /
|
|
109
|
+
`<!-- vitops:end -->` markers.
|
|
110
|
+
|
|
111
|
+
Prefer materialized files (offline/CI contexts, or agents that can't run commands)? The legacy
|
|
112
|
+
layout still works: `vitops agents --docs-dir .vitops/docs` writes the full docs bundle as files
|
|
113
|
+
and points the AGENTS.md block at them (no skill link).
|
|
99
114
|
|
|
100
115
|
Powered by [`@getvitops/generator`](https://www.npmjs.com/package/@getvitops/generator).
|
package/dist/cli.mjs
CHANGED
|
@@ -1,11 +1,100 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { parseArgs } from "node:util";
|
|
4
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
|
-
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, readlinkSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { dirname, join, parse, relative, resolve } from "node:path";
|
|
6
6
|
import { SCHEMA_URL, defaultConfig, generate, generateDocs, validate } from "@getvitops/generator";
|
|
7
7
|
import { generateFavicons } from "@getvitops/utils";
|
|
8
8
|
|
|
9
|
+
//#region src/agents.ts
|
|
10
|
+
/**
|
|
11
|
+
* Side-effect-free helpers for the `vitops agents` / `vitops docs` commands.
|
|
12
|
+
* Kept out of cli.ts (which runs main() on import) so they are unit-testable.
|
|
13
|
+
*/
|
|
14
|
+
const SKILL_NAME = "vitops-design-system";
|
|
15
|
+
/** Marker the 0.5.0-era generated skill carried; lets us migrate that layout. */
|
|
16
|
+
const GENERATED_MARKER = "<!-- GENERATED by @getvitops/cli";
|
|
17
|
+
/**
|
|
18
|
+
* `vitops docs` topics → docs-bundle paths (as returned by `generateDocs`).
|
|
19
|
+
* Order is the `--all` concatenation order.
|
|
20
|
+
*/
|
|
21
|
+
const TOPICS = {
|
|
22
|
+
classes: {
|
|
23
|
+
path: "css/classes.md",
|
|
24
|
+
summary: "CSS framework class vocabulary (colour, type, space, layout, animation, patterns)"
|
|
25
|
+
},
|
|
26
|
+
authoring: {
|
|
27
|
+
path: "authoring.md",
|
|
28
|
+
summary: "every design-system.json field, rendered from the JSON Schema"
|
|
29
|
+
},
|
|
30
|
+
formats: {
|
|
31
|
+
path: "formats.md",
|
|
32
|
+
summary: "tailwind vs css vs bricks: what's emitted vs what the platform provides"
|
|
33
|
+
},
|
|
34
|
+
color: {
|
|
35
|
+
path: "concepts/color.md",
|
|
36
|
+
summary: "seeded OKLCH scales, functional tokens, automatic dark mode"
|
|
37
|
+
},
|
|
38
|
+
scales: {
|
|
39
|
+
path: "concepts/scales.md",
|
|
40
|
+
summary: "fluid modular type & space scales"
|
|
41
|
+
},
|
|
42
|
+
patterns: {
|
|
43
|
+
path: "concepts/patterns.md",
|
|
44
|
+
summary: "pattern CSS: token cascade, override hooks, states, role variants"
|
|
45
|
+
},
|
|
46
|
+
elements: {
|
|
47
|
+
path: "bricks/elements.md",
|
|
48
|
+
summary: "Bricks Builder custom elements, controls, defaults"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Find the installed package's skill directory by walking up from `cwd` looking
|
|
53
|
+
* for `node_modules/@getvitops/cli/skill/SKILL.md`. Returns the LOGICAL path
|
|
54
|
+
* (through the `node_modules/@getvitops/cli` link, unresolved) or null.
|
|
55
|
+
*
|
|
56
|
+
* Deliberately not derived from import.meta.url: under pnpm the running module's
|
|
57
|
+
* URL is the realpath in `node_modules/.pnpm/@getvitops+cli@<version>/…`, which
|
|
58
|
+
* changes on every version bump — a symlink to it would dangle after upgrades.
|
|
59
|
+
* The logical path is recreated by the package manager on every install, so a
|
|
60
|
+
* link through it always resolves to the currently installed version.
|
|
61
|
+
*/
|
|
62
|
+
function findSkillTarget(cwd) {
|
|
63
|
+
let dir = resolve(cwd);
|
|
64
|
+
const { root } = parse(dir);
|
|
65
|
+
for (;;) {
|
|
66
|
+
const skillDir = join(dir, "node_modules", "@getvitops", "cli", "skill");
|
|
67
|
+
if (existsSync(join(skillDir, "SKILL.md"))) return skillDir;
|
|
68
|
+
if (dir === root) return null;
|
|
69
|
+
dir = dirname(dir);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Idempotently symlink `linkPath` → `targetDir` (relative target). Replaces a
|
|
74
|
+
* stale symlink; migrates a real directory left by the old emitting `vitops
|
|
75
|
+
* agents` (identified by GENERATED_MARKER in its SKILL.md); refuses to clobber
|
|
76
|
+
* anything else. Returns a warning string, or null on success / no-op.
|
|
77
|
+
*/
|
|
78
|
+
function linkSkill(linkPath, targetDir) {
|
|
79
|
+
const target = relative(dirname(linkPath), resolve(targetDir));
|
|
80
|
+
try {
|
|
81
|
+
const st = lstatSync(linkPath, { throwIfNoEntry: false });
|
|
82
|
+
if (st && !st.isSymbolicLink()) {
|
|
83
|
+
const oldSkill = join(linkPath, "SKILL.md");
|
|
84
|
+
if (!(st.isDirectory() && existsSync(oldSkill) && readFileSync(oldSkill, "utf8").includes("<!-- GENERATED by @getvitops/cli"))) return `left ${linkPath} alone (exists and is not a symlink) — link it to ${targetDir} yourself if wanted`;
|
|
85
|
+
rmSync(linkPath, { recursive: true });
|
|
86
|
+
} else if (st) {
|
|
87
|
+
if (readlinkSync(linkPath) === target) return null;
|
|
88
|
+
rmSync(linkPath);
|
|
89
|
+
} else mkdirSync(dirname(linkPath), { recursive: true });
|
|
90
|
+
symlinkSync(target, linkPath);
|
|
91
|
+
return null;
|
|
92
|
+
} catch (err) {
|
|
93
|
+
return `could not symlink ${linkPath}: ${err.message}`;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
//#endregion
|
|
9
98
|
//#region src/cli.ts
|
|
10
99
|
/**
|
|
11
100
|
* `vitops` — CLI for the Vitops design-system generator.
|
|
@@ -15,6 +104,7 @@ import { generateFavicons } from "@getvitops/utils";
|
|
|
15
104
|
* vitops validate <design-system.json>
|
|
16
105
|
* vitops favicon --input <svg|png> --out <dir> [--low-res <svg|png>]
|
|
17
106
|
* vitops agents [--input <json>] [--out AGENTS.md] [--docs-dir <dir>]
|
|
107
|
+
* vitops docs [topic] [--input <json>] [--all]
|
|
18
108
|
*
|
|
19
109
|
* Thin wrapper over @getvitops/generator (generation) and @getvitops/utils (favicons).
|
|
20
110
|
* Every client brings their own consumer-editable design-system.json.
|
|
@@ -31,7 +121,8 @@ Usage:
|
|
|
31
121
|
vitops init [options] Scaffold a starter design-system.json
|
|
32
122
|
vitops validate <file> Validate a config against the schema
|
|
33
123
|
vitops favicon [options] Generate a favicon set from a source image
|
|
34
|
-
vitops agents [options]
|
|
124
|
+
vitops agents [options] Link the design-system agent skill + AGENTS.md pointer
|
|
125
|
+
vitops docs [topic] Print live design-system reference docs to stdout
|
|
35
126
|
|
|
36
127
|
Generate options:
|
|
37
128
|
-i, --input <path> Config file (default: ./design-system.json)
|
|
@@ -48,9 +139,16 @@ Favicon options:
|
|
|
48
139
|
--low-res <path> Optional simplified source for the 16px icon
|
|
49
140
|
|
|
50
141
|
Agents options:
|
|
51
|
-
-i, --input <path> Config file (default: ./design-system.json)
|
|
142
|
+
-i, --input <path> Config file (default: ./design-system.json; validated if present)
|
|
52
143
|
-o, --out <path> Doc file to update, idempotently (default: ./AGENTS.md)
|
|
53
|
-
--docs-dir <dir>
|
|
144
|
+
--docs-dir <dir> Legacy layout: write the docs bundle as files to this dir
|
|
145
|
+
instead of linking the packaged skill
|
|
146
|
+
|
|
147
|
+
Docs options:
|
|
148
|
+
<topic> classes | authoring | formats | color | scales | patterns | elements
|
|
149
|
+
(no topic: list topics with summaries)
|
|
150
|
+
-i, --input <path> Config file (default: ./design-system.json)
|
|
151
|
+
--all Print every topic, concatenated
|
|
54
152
|
|
|
55
153
|
Common:
|
|
56
154
|
-h, --help Show this help
|
|
@@ -204,6 +302,34 @@ function generatorAssetsDir() {
|
|
|
204
302
|
}
|
|
205
303
|
const AGENTS_START = "<!-- vitops:start -->";
|
|
206
304
|
const AGENTS_END = "<!-- vitops:end -->";
|
|
305
|
+
/** Print a live reference doc (rendered from the project's config) to stdout. */
|
|
306
|
+
function cmdDocs(argv) {
|
|
307
|
+
const { values, positionals } = parseArgs({
|
|
308
|
+
args: argv,
|
|
309
|
+
options: {
|
|
310
|
+
input: {
|
|
311
|
+
type: "string",
|
|
312
|
+
short: "i",
|
|
313
|
+
default: "design-system.json"
|
|
314
|
+
},
|
|
315
|
+
all: {
|
|
316
|
+
type: "boolean",
|
|
317
|
+
default: false
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
allowPositionals: true
|
|
321
|
+
});
|
|
322
|
+
const topic = positionals[0];
|
|
323
|
+
const topicList = () => Object.entries(TOPICS).map(([name, t]) => ` ${name.padEnd(10)} ${t.summary}`).join("\n");
|
|
324
|
+
if (!topic && !values.all) {
|
|
325
|
+
console.log(`vitops docs <topic> — print a live design-system reference to stdout\n\nTopics:\n${topicList()}\n\nAlso: vitops docs --all (every topic, concatenated)`);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
if (topic && !TOPICS[topic]) fail(`unknown topic "${topic}". Valid topics:\n${topicList()}`);
|
|
329
|
+
const docs = generateDocs(loadConfig(resolve(values.input)), generatorAssetsDir());
|
|
330
|
+
const paths = values.all ? Object.values(TOPICS).map((t) => t.path) : [TOPICS[topic].path];
|
|
331
|
+
process.stdout.write(paths.map((p) => docs[p]).join("\n"));
|
|
332
|
+
}
|
|
207
333
|
function cmdAgents(argv) {
|
|
208
334
|
const { values } = parseArgs({
|
|
209
335
|
args: argv,
|
|
@@ -218,26 +344,57 @@ function cmdAgents(argv) {
|
|
|
218
344
|
short: "o",
|
|
219
345
|
default: "AGENTS.md"
|
|
220
346
|
},
|
|
221
|
-
"docs-dir": {
|
|
222
|
-
type: "string",
|
|
223
|
-
default: ".vitops/docs"
|
|
224
|
-
}
|
|
347
|
+
"docs-dir": { type: "string" }
|
|
225
348
|
},
|
|
226
349
|
allowPositionals: false
|
|
227
350
|
});
|
|
228
351
|
const inputRel = values.input;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
352
|
+
let ds = null;
|
|
353
|
+
if (existsSync(resolve(inputRel))) ds = loadConfig(resolve(inputRel));
|
|
354
|
+
else console.warn(` ⚠ ${inputRel} not found — run \`vitops init\` to scaffold one`);
|
|
355
|
+
const legacyDocsDir = values["docs-dir"];
|
|
356
|
+
let summary;
|
|
357
|
+
let pointer;
|
|
358
|
+
if (legacyDocsDir) {
|
|
359
|
+
if (!ds) fail(`--docs-dir needs a config to render docs from (${inputRel} not found)`);
|
|
360
|
+
let docs = {};
|
|
361
|
+
try {
|
|
362
|
+
docs = generateDocs(ds, generatorAssetsDir());
|
|
363
|
+
} catch (err) {
|
|
364
|
+
fail(`could not generate docs: ${err.message}`);
|
|
365
|
+
}
|
|
366
|
+
for (const [rel, content] of Object.entries(docs)) {
|
|
367
|
+
const p = resolve(legacyDocsDir, rel);
|
|
368
|
+
mkdirSync(dirname(p), { recursive: true });
|
|
369
|
+
writeFileSync(p, content);
|
|
370
|
+
}
|
|
371
|
+
summary = `wrote ${Object.keys(docs).length} docs to ${legacyDocsDir}/`;
|
|
372
|
+
pointer = [
|
|
373
|
+
"Prefer the framework’s utility + component classes over hand-written CSS.",
|
|
374
|
+
`Reference docs (regenerate with \`vitops agents --docs-dir ${legacyDocsDir}\`): \`${legacyDocsDir}/css/classes.md\`,`,
|
|
375
|
+
`\`${legacyDocsDir}/authoring.md\`, \`${legacyDocsDir}/formats.md\`, \`${legacyDocsDir}/bricks/elements.md\`.`
|
|
376
|
+
];
|
|
377
|
+
} else {
|
|
378
|
+
const target = findSkillTarget(process.cwd());
|
|
379
|
+
if (target) {
|
|
380
|
+
for (const dir of [".agents", ".claude"]) {
|
|
381
|
+
const warn = linkSkill(resolve(dir, "skills", SKILL_NAME), target);
|
|
382
|
+
if (warn) console.warn(` ⚠ ${warn}`);
|
|
383
|
+
}
|
|
384
|
+
summary = `linked {.agents,.claude}/skills/${SKILL_NAME} → ${target}`;
|
|
385
|
+
} else {
|
|
386
|
+
console.warn(` ⚠ could not find node_modules/@getvitops/cli/skill — install @getvitops/cli as a devDependency, then re-run \`vitops agents\``);
|
|
387
|
+
summary = "no skill linked";
|
|
388
|
+
}
|
|
389
|
+
pointer = [
|
|
390
|
+
"Prefer the framework’s utility + component classes over hand-written CSS.",
|
|
391
|
+
`Full design-system context lives in the \`${SKILL_NAME}\` skill (linked from`,
|
|
392
|
+
"`.agents/skills/` and `.claude/skills/` into the installed `@getvitops/cli`;",
|
|
393
|
+
"re-link with `vitops agents` if the links are deleted — they survive version",
|
|
394
|
+
"bumps). Reference docs print live, from this project’s config, via:",
|
|
395
|
+
"",
|
|
396
|
+
...Object.entries(TOPICS).map(([name, t]) => `- \`vitops docs ${name}\` — ${t.summary}`)
|
|
397
|
+
];
|
|
241
398
|
}
|
|
242
399
|
const block = [
|
|
243
400
|
AGENTS_START,
|
|
@@ -251,9 +408,7 @@ function cmdAgents(argv) {
|
|
|
251
408
|
"- `vitops generate --format bricks --out <theme>/dist` — WordPress / Bricks",
|
|
252
409
|
"- `vitops init` · `vitops validate` · `vitops favicon`",
|
|
253
410
|
"",
|
|
254
|
-
|
|
255
|
-
`Full class vocabulary + Bricks element reference: \`${docsDir}/css/classes.md\`,`,
|
|
256
|
-
`\`${docsDir}/bricks/elements.md\` (regenerate both with \`vitops agents\`).`,
|
|
411
|
+
...pointer,
|
|
257
412
|
"",
|
|
258
413
|
`<!-- regenerate: vitops agents · @getvitops/cli@${cliVersion()} -->`,
|
|
259
414
|
AGENTS_END
|
|
@@ -278,7 +433,7 @@ function cmdAgents(argv) {
|
|
|
278
433
|
action = "created";
|
|
279
434
|
}
|
|
280
435
|
writeFileSync(outPath, next);
|
|
281
|
-
console.log(`✓ ${action} ${values.out} +
|
|
436
|
+
console.log(`✓ ${action} ${values.out} + ${summary}`);
|
|
282
437
|
}
|
|
283
438
|
async function main() {
|
|
284
439
|
const [command, ...rest] = process.argv.slice(2);
|
|
@@ -292,7 +447,8 @@ async function main() {
|
|
|
292
447
|
case "validate": return cmdValidate(rest);
|
|
293
448
|
case "favicon": return cmdFavicon(rest);
|
|
294
449
|
case "agents": return cmdAgents(rest);
|
|
295
|
-
|
|
450
|
+
case "docs": return cmdDocs(rest);
|
|
451
|
+
default: fail(`unknown command "${command}" (expected: generate | init | validate | favicon | agents | docs). Try: vitops --help`);
|
|
296
452
|
}
|
|
297
453
|
}
|
|
298
454
|
main().catch((err) => fail(err.message));
|
package/dist/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * `vitops` — CLI for the Vitops design-system generator.\n *\n * vitops generate --input <json> --format <bricks|css|tailwind[,…]> --out <dir>\n * vitops init [--out design-system.json] [--force]\n * vitops validate <design-system.json>\n * vitops favicon --input <svg|png> --out <dir> [--low-res <svg|png>]\n * vitops agents [--input <json>] [--out AGENTS.md] [--docs-dir <dir>]\n *\n * Thin wrapper over @getvitops/generator (generation) and @getvitops/utils (favicons).\n * Every client brings their own consumer-editable design-system.json.\n */\nimport { parseArgs } from 'node:util';\nimport { writeFileSync, existsSync, readFileSync, mkdirSync } from 'node:fs';\nimport { resolve, join, dirname } from 'node:path';\nimport { createRequire } from 'node:module';\nimport {\n generate,\n validate,\n defaultConfig,\n generateDocs,\n SCHEMA_URL,\n type Format,\n type DesignSystem,\n} from '@getvitops/generator';\nimport { generateFavicons } from '@getvitops/utils';\n\nconst FORMATS = new Set<Format>(['bricks', 'css', 'tailwind']);\n\nconst HELP = `vitops — generate design-system outputs from a design-system.json\n\nUsage:\n vitops generate [options] Generate platform output from a config\n vitops init [options] Scaffold a starter design-system.json\n vitops validate <file> Validate a config against the schema\n vitops favicon [options] Generate a favicon set from a source image\n vitops agents [options] Write design-system docs into AGENTS.md (for AI agents)\n\nGenerate options:\n -i, --input <path> Config file (default: ./design-system.json)\n -f, --format <list> bricks | css | tailwind (comma-separated; default: bricks)\n -o, --out <dir> Output directory (default: ./dist)\n\nInit options:\n -o, --out <path> Where to write (default: ./design-system.json)\n --force Overwrite an existing file\n\nFavicon options:\n -i, --input <path> Source SVG or PNG (required)\n -o, --out <dir> Output directory (default: ./public)\n --low-res <path> Optional simplified source for the 16px icon\n\nAgents options:\n -i, --input <path> Config file (default: ./design-system.json)\n -o, --out <path> Doc file to update, idempotently (default: ./AGENTS.md)\n --docs-dir <dir> Where to write the reference docs bundle (default: ./.vitops/docs)\n\nCommon:\n -h, --help Show this help\n`;\n\nfunction fail(msg: string): never {\n console.error(`✖ ${msg}`);\n process.exit(1);\n}\n\nasync function cmdGenerate(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n input: { type: 'string', short: 'i', default: 'design-system.json' },\n format: { type: 'string', short: 'f', default: 'bricks' },\n out: { type: 'string', short: 'o', default: 'dist' },\n },\n allowPositionals: false,\n });\n const input = resolve(values.input as string);\n if (!existsSync(input)) fail(`config not found: ${input}`);\n const formats = (values.format as string)\n .split(',')\n .map((f) => f.trim())\n .filter(Boolean);\n for (const f of formats)\n if (!FORMATS.has(f as Format))\n fail(`unknown format \"${f}\" (expected: bricks | css | tailwind)`);\n\n for (const format of formats as Format[]) {\n try {\n const res = await generate({ input, format, outDir: values.out as string });\n console.log(`✓ ${format} → ${res.outDir} (${res.written.length} paths)`);\n } catch (err) {\n fail((err as Error).message);\n }\n }\n}\n\nfunction cmdInit(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n out: { type: 'string', short: 'o', default: 'design-system.json' },\n force: { type: 'boolean', default: false },\n },\n allowPositionals: false,\n });\n const out = resolve(values.out as string);\n if (existsSync(out) && !values.force) fail(`${out} already exists (use --force to overwrite)`);\n writeFileSync(out, JSON.stringify(defaultConfig(), null, 2) + '\\n');\n console.log(`✓ wrote ${out}`);\n console.log(\n ` Edit it, then: vitops generate --input ${values.out} --format tailwind --out src/styles`,\n );\n console.log(` Editors read the \"$schema\" (${SCHEMA_URL}) for autocomplete + validation.`);\n}\n\nfunction cmdValidate(argv: string[]) {\n const { values, positionals } = parseArgs({\n args: argv,\n options: { input: { type: 'string', short: 'i' } },\n allowPositionals: true,\n });\n const path = resolve((positionals[0] ?? values.input ?? 'design-system.json') as string);\n if (!existsSync(path)) fail(`config not found: ${path}`);\n let raw: unknown;\n try {\n raw = JSON.parse(readFileSync(path, 'utf8'));\n } catch (err) {\n fail(`could not parse JSON: ${(err as Error).message}`);\n }\n const result = validate(raw);\n if (result.ok) {\n console.log(`✓ ${path} is valid`);\n return;\n }\n console.error(`✖ ${path} is invalid:`);\n for (const e of result.errors) console.error(` • ${e.path.join('.') || '(root)'}: ${e.message}`);\n process.exit(1);\n}\n\nasync function cmdFavicon(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n input: { type: 'string', short: 'i' },\n out: { type: 'string', short: 'o', default: 'public' },\n 'low-res': { type: 'string' },\n },\n allowPositionals: false,\n });\n if (!values.input) fail('favicon: --input <svg|png> is required');\n const source = resolve(values.input as string);\n if (!existsSync(source)) fail(`source not found: ${source}`);\n try {\n const written = await generateFavicons({\n source,\n outputDir: values.out as string,\n ...(values['low-res'] ? { lowResSource: resolve(values['low-res'] as string) } : {}),\n });\n console.log(`✓ favicons → ${values.out} (${written.length} files)`);\n } catch (err) {\n fail((err as Error).message);\n }\n}\n\n// Read + parse + validate a design-system.json, or exit with a message.\nfunction loadConfig(path: string): DesignSystem {\n if (!existsSync(path)) fail(`config not found: ${path}`);\n let raw: unknown;\n try {\n raw = JSON.parse(readFileSync(path, 'utf8'));\n } catch (err) {\n fail(`could not parse JSON: ${(err as Error).message}`);\n }\n const result = validate(raw);\n if (!result.ok) {\n console.error(`✖ ${path} is invalid:`);\n for (const e of result.errors)\n console.error(` • ${e.path.join('.') || '(root)'}: ${e.message}`);\n process.exit(1);\n }\n return result.data;\n}\n\n// This CLI's own version (dist/cli.mjs → package-root package.json).\nfunction cliVersion(): string {\n try {\n return (\n JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version ??\n '0.0.0'\n );\n } catch {\n return '0.0.0';\n }\n}\n\n// The framework asset root shipped inside @getvitops/generator (holds the Bricks\n// PHP that generateDocs reads for the element reference).\nfunction generatorAssetsDir(): string {\n const pkg = createRequire(import.meta.url).resolve('@getvitops/generator/package.json');\n return join(dirname(pkg), 'assets');\n}\n\nconst AGENTS_START = '<!-- vitops:start -->';\nconst AGENTS_END = '<!-- vitops:end -->';\n\nfunction cmdAgents(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n input: { type: 'string', short: 'i', default: 'design-system.json' },\n out: { type: 'string', short: 'o', default: 'AGENTS.md' },\n 'docs-dir': { type: 'string', default: '.vitops/docs' },\n },\n allowPositionals: false,\n });\n const inputRel = values.input as string;\n const ds = loadConfig(resolve(inputRel));\n const docsDir = values['docs-dir'] as string;\n\n // Emit the OKF docs bundle so the AGENTS.md pointer resolves for every consumer\n // (only the `bricks` generate format writes docs/ otherwise).\n let docs: Record<string, string> = {};\n try {\n docs = generateDocs(ds, generatorAssetsDir());\n } catch (err) {\n fail(`could not generate docs: ${(err as Error).message}`);\n }\n for (const [rel, content] of Object.entries(docs)) {\n const p = resolve(docsDir, rel);\n mkdirSync(dirname(p), { recursive: true });\n writeFileSync(p, content);\n }\n\n const block = [\n AGENTS_START,\n '## Vitops design system',\n '',\n `Styled with the Vitops design system (\\`@getvitops/*\\`); tokens live in \\`${inputRel}\\`.`,\n 'Generate output with the CLI:',\n '',\n '- `vitops generate --format tailwind --out src/styles` — Tailwind v4 / Astro',\n '- `vitops generate --format css --out dist` — standalone CSS',\n '- `vitops generate --format bricks --out <theme>/dist` — WordPress / Bricks',\n '- `vitops init` · `vitops validate` · `vitops favicon`',\n '',\n 'Prefer the framework’s utility + component classes over hand-written CSS.',\n `Full class vocabulary + Bricks element reference: \\`${docsDir}/css/classes.md\\`,`,\n `\\`${docsDir}/bricks/elements.md\\` (regenerate both with \\`vitops agents\\`).`,\n '',\n `<!-- regenerate: vitops agents · @getvitops/cli@${cliVersion()} -->`,\n AGENTS_END,\n ].join('\\n');\n\n const outPath = resolve(values.out as string);\n let next: string;\n let action: string;\n if (existsSync(outPath)) {\n const cur = readFileSync(outPath, 'utf8');\n const s = cur.indexOf(AGENTS_START);\n const e = cur.indexOf(AGENTS_END);\n if (s !== -1 && e !== -1 && e > s) {\n next = cur.slice(0, s) + block + cur.slice(e + AGENTS_END.length);\n action = 'updated block in';\n } else {\n next = cur.replace(/\\s*$/, '') + '\\n\\n' + block + '\\n';\n action = 'appended block to';\n }\n } else {\n mkdirSync(dirname(outPath), { recursive: true });\n next = block + '\\n';\n action = 'created';\n }\n writeFileSync(outPath, next);\n console.log(`✓ ${action} ${values.out} + wrote ${Object.keys(docs).length} docs to ${docsDir}/`);\n}\n\nasync function main() {\n const [command, ...rest] = process.argv.slice(2);\n if (!command || command === '-h' || command === '--help' || command === 'help') {\n console.log(HELP);\n return;\n }\n switch (command) {\n case 'generate':\n return cmdGenerate(rest);\n case 'init':\n return cmdInit(rest);\n case 'validate':\n return cmdValidate(rest);\n case 'favicon':\n return cmdFavicon(rest);\n case 'agents':\n return cmdAgents(rest);\n default:\n fail(\n `unknown command \"${command}\" (expected: generate | init | validate | favicon | agents). Try: vitops --help`,\n );\n }\n}\n\nmain().catch((err) => fail((err as Error).message));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4BA,MAAM,UAAU,IAAI,IAAY;CAAC;CAAU;CAAO;AAAU,CAAC;AAE7D,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCb,SAAS,KAAK,KAAoB;CAChC,QAAQ,MAAM,KAAK,KAAK;CACxB,QAAQ,KAAK,CAAC;AAChB;AAEA,eAAe,YAAY,MAAgB;CACzC,MAAM,EAAE,WAAW,UAAU;EAC3B,MAAM;EACN,SAAS;GACP,OAAO;IAAE,MAAM;IAAU,OAAO;IAAK,SAAS;GAAqB;GACnE,QAAQ;IAAE,MAAM;IAAU,OAAO;IAAK,SAAS;GAAS;GACxD,KAAK;IAAE,MAAM;IAAU,OAAO;IAAK,SAAS;GAAO;EACrD;EACA,kBAAkB;CACpB,CAAC;CACD,MAAM,QAAQ,QAAQ,OAAO,KAAe;CAC5C,IAAI,CAAC,WAAW,KAAK,GAAG,KAAK,qBAAqB,OAAO;CACzD,MAAM,UAAW,OAAO,OACrB,MAAM,GAAG,CAAC,CACV,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,CACpB,OAAO,OAAO;CACjB,KAAK,MAAM,KAAK,SACd,IAAI,CAAC,QAAQ,IAAI,CAAW,GAC1B,KAAK,mBAAmB,EAAE,sCAAsC;CAEpE,KAAK,MAAM,UAAU,SACnB,IAAI;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["../src/agents.ts","../src/cli.ts"],"sourcesContent":["/**\n * Side-effect-free helpers for the `vitops agents` / `vitops docs` commands.\n * Kept out of cli.ts (which runs main() on import) so they are unit-testable.\n */\nimport {\n existsSync,\n lstatSync,\n mkdirSync,\n readFileSync,\n readlinkSync,\n rmSync,\n symlinkSync,\n} from 'node:fs';\nimport { dirname, join, parse, relative, resolve } from 'node:path';\n\nexport const SKILL_NAME = 'vitops-design-system';\n\n/** Marker the 0.5.0-era generated skill carried; lets us migrate that layout. */\nexport const GENERATED_MARKER = '<!-- GENERATED by @getvitops/cli';\n\n/**\n * `vitops docs` topics → docs-bundle paths (as returned by `generateDocs`).\n * Order is the `--all` concatenation order.\n */\nexport const TOPICS: Record<string, { path: string; summary: string }> = {\n classes: {\n path: 'css/classes.md',\n summary: 'CSS framework class vocabulary (colour, type, space, layout, animation, patterns)',\n },\n authoring: {\n path: 'authoring.md',\n summary: 'every design-system.json field, rendered from the JSON Schema',\n },\n formats: {\n path: 'formats.md',\n summary: \"tailwind vs css vs bricks: what's emitted vs what the platform provides\",\n },\n color: {\n path: 'concepts/color.md',\n summary: 'seeded OKLCH scales, functional tokens, automatic dark mode',\n },\n scales: {\n path: 'concepts/scales.md',\n summary: 'fluid modular type & space scales',\n },\n patterns: {\n path: 'concepts/patterns.md',\n summary: 'pattern CSS: token cascade, override hooks, states, role variants',\n },\n elements: {\n path: 'bricks/elements.md',\n summary: 'Bricks Builder custom elements, controls, defaults',\n },\n};\n\n/**\n * Find the installed package's skill directory by walking up from `cwd` looking\n * for `node_modules/@getvitops/cli/skill/SKILL.md`. Returns the LOGICAL path\n * (through the `node_modules/@getvitops/cli` link, unresolved) or null.\n *\n * Deliberately not derived from import.meta.url: under pnpm the running module's\n * URL is the realpath in `node_modules/.pnpm/@getvitops+cli@<version>/…`, which\n * changes on every version bump — a symlink to it would dangle after upgrades.\n * The logical path is recreated by the package manager on every install, so a\n * link through it always resolves to the currently installed version.\n */\nexport function findSkillTarget(cwd: string): string | null {\n let dir = resolve(cwd);\n const { root } = parse(dir);\n for (;;) {\n const skillDir = join(dir, 'node_modules', '@getvitops', 'cli', 'skill');\n if (existsSync(join(skillDir, 'SKILL.md'))) return skillDir;\n if (dir === root) return null;\n dir = dirname(dir);\n }\n}\n\n/**\n * Idempotently symlink `linkPath` → `targetDir` (relative target). Replaces a\n * stale symlink; migrates a real directory left by the old emitting `vitops\n * agents` (identified by GENERATED_MARKER in its SKILL.md); refuses to clobber\n * anything else. Returns a warning string, or null on success / no-op.\n */\nexport function linkSkill(linkPath: string, targetDir: string): string | null {\n const target = relative(dirname(linkPath), resolve(targetDir));\n try {\n const st = lstatSync(linkPath, { throwIfNoEntry: false });\n if (st && !st.isSymbolicLink()) {\n const oldSkill = join(linkPath, 'SKILL.md');\n const isGenerated =\n st.isDirectory() &&\n existsSync(oldSkill) &&\n readFileSync(oldSkill, 'utf8').includes(GENERATED_MARKER);\n if (!isGenerated)\n return `left ${linkPath} alone (exists and is not a symlink) — link it to ${targetDir} yourself if wanted`;\n rmSync(linkPath, { recursive: true }); // old generated skill layout → replace\n } else if (st) {\n if (readlinkSync(linkPath) === target) return null;\n rmSync(linkPath);\n } else {\n mkdirSync(dirname(linkPath), { recursive: true });\n }\n symlinkSync(target, linkPath);\n return null;\n } catch (err) {\n return `could not symlink ${linkPath}: ${(err as Error).message}`;\n }\n}\n","#!/usr/bin/env node\n/**\n * `vitops` — CLI for the Vitops design-system generator.\n *\n * vitops generate --input <json> --format <bricks|css|tailwind[,…]> --out <dir>\n * vitops init [--out design-system.json] [--force]\n * vitops validate <design-system.json>\n * vitops favicon --input <svg|png> --out <dir> [--low-res <svg|png>]\n * vitops agents [--input <json>] [--out AGENTS.md] [--docs-dir <dir>]\n * vitops docs [topic] [--input <json>] [--all]\n *\n * Thin wrapper over @getvitops/generator (generation) and @getvitops/utils (favicons).\n * Every client brings their own consumer-editable design-system.json.\n */\nimport { parseArgs } from 'node:util';\nimport { writeFileSync, existsSync, readFileSync, mkdirSync } from 'node:fs';\nimport { resolve, join, dirname } from 'node:path';\nimport { createRequire } from 'node:module';\nimport {\n generate,\n validate,\n defaultConfig,\n generateDocs,\n SCHEMA_URL,\n type Format,\n type DesignSystem,\n} from '@getvitops/generator';\nimport { generateFavicons } from '@getvitops/utils';\nimport { findSkillTarget, linkSkill, SKILL_NAME, TOPICS } from './agents.ts';\n\nconst FORMATS = new Set<Format>(['bricks', 'css', 'tailwind']);\n\nconst HELP = `vitops — generate design-system outputs from a design-system.json\n\nUsage:\n vitops generate [options] Generate platform output from a config\n vitops init [options] Scaffold a starter design-system.json\n vitops validate <file> Validate a config against the schema\n vitops favicon [options] Generate a favicon set from a source image\n vitops agents [options] Link the design-system agent skill + AGENTS.md pointer\n vitops docs [topic] Print live design-system reference docs to stdout\n\nGenerate options:\n -i, --input <path> Config file (default: ./design-system.json)\n -f, --format <list> bricks | css | tailwind (comma-separated; default: bricks)\n -o, --out <dir> Output directory (default: ./dist)\n\nInit options:\n -o, --out <path> Where to write (default: ./design-system.json)\n --force Overwrite an existing file\n\nFavicon options:\n -i, --input <path> Source SVG or PNG (required)\n -o, --out <dir> Output directory (default: ./public)\n --low-res <path> Optional simplified source for the 16px icon\n\nAgents options:\n -i, --input <path> Config file (default: ./design-system.json; validated if present)\n -o, --out <path> Doc file to update, idempotently (default: ./AGENTS.md)\n --docs-dir <dir> Legacy layout: write the docs bundle as files to this dir\n instead of linking the packaged skill\n\nDocs options:\n <topic> classes | authoring | formats | color | scales | patterns | elements\n (no topic: list topics with summaries)\n -i, --input <path> Config file (default: ./design-system.json)\n --all Print every topic, concatenated\n\nCommon:\n -h, --help Show this help\n`;\n\nfunction fail(msg: string): never {\n console.error(`✖ ${msg}`);\n process.exit(1);\n}\n\nasync function cmdGenerate(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n input: { type: 'string', short: 'i', default: 'design-system.json' },\n format: { type: 'string', short: 'f', default: 'bricks' },\n out: { type: 'string', short: 'o', default: 'dist' },\n },\n allowPositionals: false,\n });\n const input = resolve(values.input as string);\n if (!existsSync(input)) fail(`config not found: ${input}`);\n const formats = (values.format as string)\n .split(',')\n .map((f) => f.trim())\n .filter(Boolean);\n for (const f of formats)\n if (!FORMATS.has(f as Format))\n fail(`unknown format \"${f}\" (expected: bricks | css | tailwind)`);\n\n for (const format of formats as Format[]) {\n try {\n const res = await generate({ input, format, outDir: values.out as string });\n console.log(`✓ ${format} → ${res.outDir} (${res.written.length} paths)`);\n } catch (err) {\n fail((err as Error).message);\n }\n }\n}\n\nfunction cmdInit(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n out: { type: 'string', short: 'o', default: 'design-system.json' },\n force: { type: 'boolean', default: false },\n },\n allowPositionals: false,\n });\n const out = resolve(values.out as string);\n if (existsSync(out) && !values.force) fail(`${out} already exists (use --force to overwrite)`);\n writeFileSync(out, JSON.stringify(defaultConfig(), null, 2) + '\\n');\n console.log(`✓ wrote ${out}`);\n console.log(\n ` Edit it, then: vitops generate --input ${values.out} --format tailwind --out src/styles`,\n );\n console.log(` Editors read the \"$schema\" (${SCHEMA_URL}) for autocomplete + validation.`);\n}\n\nfunction cmdValidate(argv: string[]) {\n const { values, positionals } = parseArgs({\n args: argv,\n options: { input: { type: 'string', short: 'i' } },\n allowPositionals: true,\n });\n const path = resolve((positionals[0] ?? values.input ?? 'design-system.json') as string);\n if (!existsSync(path)) fail(`config not found: ${path}`);\n let raw: unknown;\n try {\n raw = JSON.parse(readFileSync(path, 'utf8'));\n } catch (err) {\n fail(`could not parse JSON: ${(err as Error).message}`);\n }\n const result = validate(raw);\n if (result.ok) {\n console.log(`✓ ${path} is valid`);\n return;\n }\n console.error(`✖ ${path} is invalid:`);\n for (const e of result.errors) console.error(` • ${e.path.join('.') || '(root)'}: ${e.message}`);\n process.exit(1);\n}\n\nasync function cmdFavicon(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n input: { type: 'string', short: 'i' },\n out: { type: 'string', short: 'o', default: 'public' },\n 'low-res': { type: 'string' },\n },\n allowPositionals: false,\n });\n if (!values.input) fail('favicon: --input <svg|png> is required');\n const source = resolve(values.input as string);\n if (!existsSync(source)) fail(`source not found: ${source}`);\n try {\n const written = await generateFavicons({\n source,\n outputDir: values.out as string,\n ...(values['low-res'] ? { lowResSource: resolve(values['low-res'] as string) } : {}),\n });\n console.log(`✓ favicons → ${values.out} (${written.length} files)`);\n } catch (err) {\n fail((err as Error).message);\n }\n}\n\n// Read + parse + validate a design-system.json, or exit with a message.\nfunction loadConfig(path: string): DesignSystem {\n if (!existsSync(path)) fail(`config not found: ${path}`);\n let raw: unknown;\n try {\n raw = JSON.parse(readFileSync(path, 'utf8'));\n } catch (err) {\n fail(`could not parse JSON: ${(err as Error).message}`);\n }\n const result = validate(raw);\n if (!result.ok) {\n console.error(`✖ ${path} is invalid:`);\n for (const e of result.errors)\n console.error(` • ${e.path.join('.') || '(root)'}: ${e.message}`);\n process.exit(1);\n }\n return result.data;\n}\n\n// This CLI's own version (dist/cli.mjs → package-root package.json).\nfunction cliVersion(): string {\n try {\n return (\n JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version ??\n '0.0.0'\n );\n } catch {\n return '0.0.0';\n }\n}\n\n// The framework asset root shipped inside @getvitops/generator (holds the Bricks\n// PHP that generateDocs reads for the element reference).\nfunction generatorAssetsDir(): string {\n const pkg = createRequire(import.meta.url).resolve('@getvitops/generator/package.json');\n return join(dirname(pkg), 'assets');\n}\n\nconst AGENTS_START = '<!-- vitops:start -->';\nconst AGENTS_END = '<!-- vitops:end -->';\n\n/** Print a live reference doc (rendered from the project's config) to stdout. */\nfunction cmdDocs(argv: string[]) {\n const { values, positionals } = parseArgs({\n args: argv,\n options: {\n input: { type: 'string', short: 'i', default: 'design-system.json' },\n all: { type: 'boolean', default: false },\n },\n allowPositionals: true,\n });\n const topic = positionals[0];\n const topicList = () =>\n Object.entries(TOPICS)\n .map(([name, t]) => ` ${name.padEnd(10)} ${t.summary}`)\n .join('\\n');\n if (!topic && !values.all) {\n console.log(\n `vitops docs <topic> — print a live design-system reference to stdout\\n\\nTopics:\\n${topicList()}\\n\\nAlso: vitops docs --all (every topic, concatenated)`,\n );\n return;\n }\n if (topic && !TOPICS[topic]) fail(`unknown topic \"${topic}\". Valid topics:\\n${topicList()}`);\n const ds = loadConfig(resolve(values.input as string));\n const docs = generateDocs(ds, generatorAssetsDir());\n const paths = values.all\n ? Object.values(TOPICS).map((t) => t.path)\n : [TOPICS[topic as string]!.path];\n process.stdout.write(paths.map((p) => docs[p]).join('\\n'));\n}\n\nfunction cmdAgents(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n input: { type: 'string', short: 'i', default: 'design-system.json' },\n out: { type: 'string', short: 'o', default: 'AGENTS.md' },\n 'docs-dir': { type: 'string' },\n },\n allowPositionals: false,\n });\n const inputRel = values.input as string;\n // The command is pure wiring: validate the config when present (fail on an\n // invalid one), but don't require it — docs are rendered live by `vitops docs`.\n let ds: DesignSystem | null = null;\n if (existsSync(resolve(inputRel))) ds = loadConfig(resolve(inputRel));\n else console.warn(` ⚠ ${inputRel} not found — run \\`vitops init\\` to scaffold one`);\n\n // Explicit --docs-dir = legacy layout: write the docs bundle as files, no skill.\n const legacyDocsDir = values['docs-dir'] as string | undefined;\n let summary: string;\n let pointer: string[];\n\n if (legacyDocsDir) {\n if (!ds) fail(`--docs-dir needs a config to render docs from (${inputRel} not found)`);\n let docs: Record<string, string> = {};\n try {\n docs = generateDocs(ds, generatorAssetsDir());\n } catch (err) {\n fail(`could not generate docs: ${(err as Error).message}`);\n }\n for (const [rel, content] of Object.entries(docs)) {\n const p = resolve(legacyDocsDir, rel);\n mkdirSync(dirname(p), { recursive: true });\n writeFileSync(p, content);\n }\n summary = `wrote ${Object.keys(docs).length} docs to ${legacyDocsDir}/`;\n pointer = [\n 'Prefer the framework’s utility + component classes over hand-written CSS.',\n `Reference docs (regenerate with \\`vitops agents --docs-dir ${legacyDocsDir}\\`): \\`${legacyDocsDir}/css/classes.md\\`,`,\n `\\`${legacyDocsDir}/authoring.md\\`, \\`${legacyDocsDir}/formats.md\\`, \\`${legacyDocsDir}/bricks/elements.md\\`.`,\n ];\n } else {\n // Link the packaged skill (ships inside @getvitops/cli) into the agent\n // discovery locations; nothing is generated into the repo.\n const target = findSkillTarget(process.cwd());\n if (target) {\n for (const dir of ['.agents', '.claude']) {\n const warn = linkSkill(resolve(dir, 'skills', SKILL_NAME), target);\n if (warn) console.warn(` ⚠ ${warn}`);\n }\n summary = `linked {.agents,.claude}/skills/${SKILL_NAME} → ${target}`;\n } else {\n console.warn(\n ` ⚠ could not find node_modules/@getvitops/cli/skill — install @getvitops/cli as a devDependency, then re-run \\`vitops agents\\``,\n );\n summary = 'no skill linked';\n }\n pointer = [\n 'Prefer the framework’s utility + component classes over hand-written CSS.',\n `Full design-system context lives in the \\`${SKILL_NAME}\\` skill (linked from`,\n '`.agents/skills/` and `.claude/skills/` into the installed `@getvitops/cli`;',\n 're-link with `vitops agents` if the links are deleted — they survive version',\n 'bumps). Reference docs print live, from this project’s config, via:',\n '',\n ...Object.entries(TOPICS).map(([name, t]) => `- \\`vitops docs ${name}\\` — ${t.summary}`),\n ];\n }\n\n const block = [\n AGENTS_START,\n '## Vitops design system',\n '',\n `Styled with the Vitops design system (\\`@getvitops/*\\`); tokens live in \\`${inputRel}\\`.`,\n 'Generate output with the CLI:',\n '',\n '- `vitops generate --format tailwind --out src/styles` — Tailwind v4 / Astro',\n '- `vitops generate --format css --out dist` — standalone CSS',\n '- `vitops generate --format bricks --out <theme>/dist` — WordPress / Bricks',\n '- `vitops init` · `vitops validate` · `vitops favicon`',\n '',\n ...pointer,\n '',\n `<!-- regenerate: vitops agents · @getvitops/cli@${cliVersion()} -->`,\n AGENTS_END,\n ].join('\\n');\n\n const outPath = resolve(values.out as string);\n let next: string;\n let action: string;\n if (existsSync(outPath)) {\n const cur = readFileSync(outPath, 'utf8');\n const s = cur.indexOf(AGENTS_START);\n const e = cur.indexOf(AGENTS_END);\n if (s !== -1 && e !== -1 && e > s) {\n next = cur.slice(0, s) + block + cur.slice(e + AGENTS_END.length);\n action = 'updated block in';\n } else {\n next = cur.replace(/\\s*$/, '') + '\\n\\n' + block + '\\n';\n action = 'appended block to';\n }\n } else {\n mkdirSync(dirname(outPath), { recursive: true });\n next = block + '\\n';\n action = 'created';\n }\n writeFileSync(outPath, next);\n console.log(`✓ ${action} ${values.out} + ${summary}`);\n}\n\nasync function main() {\n const [command, ...rest] = process.argv.slice(2);\n if (!command || command === '-h' || command === '--help' || command === 'help') {\n console.log(HELP);\n return;\n }\n switch (command) {\n case 'generate':\n return cmdGenerate(rest);\n case 'init':\n return cmdInit(rest);\n case 'validate':\n return cmdValidate(rest);\n case 'favicon':\n return cmdFavicon(rest);\n case 'agents':\n return cmdAgents(rest);\n case 'docs':\n return cmdDocs(rest);\n default:\n fail(\n `unknown command \"${command}\" (expected: generate | init | validate | favicon | agents | docs). Try: vitops --help`,\n );\n }\n}\n\nmain().catch((err) => fail((err as Error).message));\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAa,aAAa;;AAG1B,MAAa,mBAAmB;;;;;AAMhC,MAAa,SAA4D;CACvE,SAAS;EACP,MAAM;EACN,SAAS;CACX;CACA,WAAW;EACT,MAAM;EACN,SAAS;CACX;CACA,SAAS;EACP,MAAM;EACN,SAAS;CACX;CACA,OAAO;EACL,MAAM;EACN,SAAS;CACX;CACA,QAAQ;EACN,MAAM;EACN,SAAS;CACX;CACA,UAAU;EACR,MAAM;EACN,SAAS;CACX;CACA,UAAU;EACR,MAAM;EACN,SAAS;CACX;AACF;;;;;;;;;;;;AAaA,SAAgB,gBAAgB,KAA4B;CAC1D,IAAI,MAAM,QAAQ,GAAG;CACrB,MAAM,EAAE,SAAS,MAAM,GAAG;CAC1B,SAAS;EACP,MAAM,WAAW,KAAK,KAAK,gBAAgB,cAAc,OAAO,OAAO;EACvE,IAAI,WAAW,KAAK,UAAU,UAAU,CAAC,GAAG,OAAO;EACnD,IAAI,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CACF,OAAO;EACL,UAAU,QAAQ,OAAO,GAAG,EAAE,WAAW,KAAK,CAAC;EAC/C,OAAO,QAAQ;EACf,SAAS;CACX;CACA,cAAc,SAAS,IAAI;CAC3B,QAAQ,IAAI,KAAK,OAAO,GAAG,OAAO,IAAI,KAAK,SAAS;AACtD;AAEA,eAAe,OAAO;CACpB,MAAM,CAAC,SAAS,GAAG,QAAQ,QAAQ,KAAK,MAAM,CAAC;CAC/C,IAAI,CAAC,WAAW,YAAY,QAAQ,YAAY,YAAY,YAAY,QAAQ;EAC9E,QAAQ,IAAI,IAAI;EAChB;CACF;CACA,QAAQ,SAAR;EACE,KAAK,YACH,OAAO,YAAY,IAAI;EACzB,KAAK,QACH,OAAO,QAAQ,IAAI;EACrB,KAAK,YACH,OAAO,YAAY,IAAI;EACzB,KAAK,WACH,OAAO,WAAW,IAAI;EACxB,KAAK,UACH,OAAO,UAAU,IAAI;EACvB,KAAK,QACH,OAAO,QAAQ,IAAI;EACrB,SACE,KACE,oBAAoB,QAAQ,uFAC9B;CACJ;AACF;AAEA,KAAK,CAAC,CAAC,OAAO,QAAQ,KAAM,IAAc,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getvitops/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "CLI for the Vitops design-system generator: generate, init, and validate a design-system.json.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
7
7
|
"vitops": "./dist/cli.mjs"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
10
|
+
"dist",
|
|
11
|
+
"skill"
|
|
11
12
|
],
|
|
12
13
|
"type": "module",
|
|
13
14
|
"exports": {
|
|
@@ -20,7 +21,10 @@
|
|
|
20
21
|
"access": "public"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"@getvitops/generator": "0.
|
|
24
|
-
"@getvitops/utils": "0.
|
|
24
|
+
"@getvitops/generator": "0.6.0",
|
|
25
|
+
"@getvitops/utils": "0.6.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"vitest": "^4.1.9"
|
|
25
29
|
}
|
|
26
30
|
}
|
package/skill/SKILL.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vitops-design-system
|
|
3
|
+
description: >-
|
|
4
|
+
Work with this project's Vitops design system. Use when styling or authoring
|
|
5
|
+
pages or components (choosing utility/pattern classes, colours, spacing,
|
|
6
|
+
typography), when editing design-system.json (tokens, palette, patterns,
|
|
7
|
+
scales, animations), when generating output (vitops generate --format
|
|
8
|
+
tailwind|css|bricks), or when asking what the design system provides on a
|
|
9
|
+
given platform (Tailwind vs Bricks vs standalone CSS).
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Vitops design system
|
|
13
|
+
|
|
14
|
+
This project is styled with the Vitops design system (`@getvitops/*`): a variable-driven
|
|
15
|
+
CSS framework generated from `design-system.json` (the single source of truth — semantic
|
|
16
|
+
colour roles, fluid type/space scales, component patterns, animation effects).
|
|
17
|
+
|
|
18
|
+
**Core rule:** prefer the framework's utility + component classes over hand-written CSS or
|
|
19
|
+
ad-hoc values — they encode the tokens, respond to dark mode, and update with the system.
|
|
20
|
+
|
|
21
|
+
## Getting the current reference docs
|
|
22
|
+
|
|
23
|
+
Run **`vitops docs <topic>`** — it prints the reference as markdown to stdout, generated
|
|
24
|
+
live from this project's `design-system.json` and the installed package version, so it is
|
|
25
|
+
never stale and always names the project's actual tokens. (If `vitops` isn't on PATH, use
|
|
26
|
+
`pnpm exec vitops docs <topic>` or `npx vitops docs <topic>`.)
|
|
27
|
+
|
|
28
|
+
| Run | When you need |
|
|
29
|
+
| ----------------------- | ---------------------------------------------------------------------- |
|
|
30
|
+
| `vitops docs classes` | which class to apply — the full class vocabulary as naming rules |
|
|
31
|
+
| `vitops docs authoring` | what a `design-system.json` field means / what's valid |
|
|
32
|
+
| `vitops docs formats` | tailwind vs css vs bricks output — incl. which utilities Tailwind owns |
|
|
33
|
+
| `vitops docs color` | how the colour system works (seeded OKLCH scales, roles, dark mode) |
|
|
34
|
+
| `vitops docs scales` | how the fluid type/space scales work |
|
|
35
|
+
| `vitops docs patterns` | how pattern CSS is assembled (token cascade, override hooks, states) |
|
|
36
|
+
| `vitops docs elements` | the custom Bricks Builder elements and their controls |
|
|
37
|
+
|
|
38
|
+
`vitops docs` (no topic) lists the topics; `vitops docs --all` prints everything.
|
|
39
|
+
|
|
40
|
+
## Other commands
|
|
41
|
+
|
|
42
|
+
- `vitops generate --format <tailwind|css|bricks>` — generate the platform output.
|
|
43
|
+
- `vitops init` / `vitops validate` — scaffold / check a `design-system.json`.
|
|
44
|
+
- `vitops agents` — (re-)link this skill into `.agents/skills/` + `.claude/skills/` and
|
|
45
|
+
refresh the AGENTS.md pointer block. The links point into the installed package and
|
|
46
|
+
survive version bumps; re-run only if they were deleted.
|