@getvitops/cli 2.0.0 → 3.0.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/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":[],"sources":["../src/agents.ts","../src/css-scan.ts","../src/lint-css.ts","../src/lint.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 icons: {\n path: 'concepts/icons.md',\n summary: 'semantic icon names across sets, bundle derivation, sprite delivery',\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","/**\n * A minimal reader for hand-written CSS: rule selector, declarations as authored,\n * and the at-rule conditions the rule sits inside.\n *\n * **Why not lightningcss.** The generator owns it, and exposing an `analyzeCss`\n * from there was the obvious move — but lightningcss parses declarations into a\n * typed value model, and the typed model is exactly what these rules need to see\n * through. `display: flex` comes back as `pair`, `grid-template-columns: 1fr 1fr`\n * as `track-list`, and `margin-inline: auto` as an empty structured node. Every\n * rule here matches on *authored text*, so recovering it property-by-property\n * would mean re-implementing a serialiser for each one.\n *\n * A brace-depth scanner keeps the text intact, needs no native binary in the\n * CLI's dependency tree, and follows what `generate.ts` already does twice\n * (`stripForTailwind`, `isVariantBlock`).\n *\n * It is deliberately shallow: no specificity, no cascade, no `@supports`\n * semantics. It answers \"what did someone type in this rule\", which is all a\n * reuse suggestion needs.\n */\n\nexport interface CssDeclaration {\n property: string;\n value: string;\n}\n\nexport interface CssRule {\n selector: string;\n declarations: CssDeclaration[];\n /** Enclosing at-rule preludes, outermost first (`@media (min-width: 48rem)`). */\n conditions: string[];\n /** 1-indexed line of the selector. */\n line: number;\n}\n\n/** Strip comments, preserving newlines so line numbers survive. */\nfunction stripComments(css: string): string {\n return css.replace(/\\/\\*[\\s\\S]*?\\*\\//g, (m) => m.replace(/[^\\n]/g, ''));\n}\n\nconst lineAt = (src: string, index: number) => src.slice(0, index).split('\\n').length;\n\n/**\n * Parse declarations from a rule body. Splits on top-level `;` only, so a\n * `var(--x, a; b)` or a data URI cannot end a declaration early.\n */\nfunction parseDeclarations(body: string): CssDeclaration[] {\n const out: CssDeclaration[] = [];\n let depth = 0;\n let start = 0;\n const push = (chunk: string) => {\n const colon = chunk.indexOf(':');\n if (colon < 0) return;\n const property = chunk.slice(0, colon).trim();\n const value = chunk.slice(colon + 1).trim();\n // A nested block leaks in as a property containing `{`; skip it rather than\n // reporting a declaration that was never written.\n if (!property || property.includes('{') || !value) return;\n out.push({ property, value });\n };\n for (let i = 0; i < body.length; i++) {\n const ch = body[i];\n if (ch === '(' || ch === '[') depth++;\n else if (ch === ')' || ch === ']') depth--;\n else if (ch === ';' && depth === 0) {\n push(body.slice(start, i));\n start = i + 1;\n }\n }\n push(body.slice(start));\n return out;\n}\n\n/**\n * Scan a stylesheet into its style rules.\n *\n * Never throws: this runs over consumer source that may be a fragment, and a\n * linter that dies on one unparseable file is one nobody keeps in CI.\n */\nexport function scanCss(css: string): CssRule[] {\n const src = stripComments(css);\n const rules: CssRule[] = [];\n // Each open brace pushes its prelude; at-rule preludes become `conditions` for\n // everything nested inside, style-rule preludes become a selector.\n const stack: { prelude: string; index: number }[] = [];\n let depth = 0;\n let preludeStart = 0;\n\n for (let i = 0; i < src.length; i++) {\n const ch = src[i];\n if (ch === '\"' || ch === \"'\") {\n // Skip strings whole — a brace inside content: \"{\" would desync the depth.\n const quote = ch;\n i++;\n while (i < src.length && src[i] !== quote) {\n if (src[i] === '\\\\') i++;\n i++;\n }\n continue;\n }\n if (ch === '{') {\n const raw = src.slice(preludeStart, i);\n const prelude = raw.trim();\n // Offset of the first non-whitespace character, not of `preludeStart` —\n // that sits where the previous rule ended, so a rule's reported line would\n // be the blank line above it.\n stack.push({ prelude, index: preludeStart + raw.indexOf(prelude.slice(0, 1)) });\n depth++;\n preludeStart = i + 1;\n continue;\n }\n if (ch === '}') {\n const frame = stack.pop();\n depth--;\n if (frame && !frame.prelude.startsWith('@')) {\n // A style rule: its body is everything since it opened, minus any nested\n // blocks, which `parseDeclarations` discards.\n const bodyStart = src.indexOf('{', frame.index) + 1;\n rules.push({\n selector: frame.prelude,\n declarations: parseDeclarations(src.slice(bodyStart, i)),\n conditions: stack.filter((f) => f.prelude.startsWith('@')).map((f) => f.prelude),\n line: lineAt(src, frame.index),\n });\n }\n preludeStart = i + 1;\n continue;\n }\n }\n // Unbalanced braces (a fragment, a truncated file) leave frames on the stack;\n // returning what was parsed beats reporting nothing.\n return rules.filter((r) => r.selector && depth >= 0);\n}\n\n/** `<style>` block contents from an .astro/.vue/.svelte/.html file. */\nexport function extractStyleBlocks(src: string): { css: string; line: number }[] {\n const out: { css: string; line: number }[] = [];\n for (const m of src.matchAll(/<style\\b[^>]*>([\\s\\S]*?)<\\/style>/gi)) {\n // Offset so a finding's line number points into the original file, not into\n // the extracted block.\n const line = lineAt(src, (m.index ?? 0) + m[0].indexOf('>') + 1);\n out.push({ css: m[1] ?? '', line });\n }\n return out;\n}\n","/**\n * The inverse of `lint.ts`: hand-written CSS that re-implements a framework\n * primitive.\n *\n * `lint.ts` catches a class that resolves to nothing — you named something and it\n * isn't there. This catches the costlier direction, where the code *works*: a\n * centred container written by hand, a two-column split behind a media query, a\n * flex row. Nothing is broken, so nothing ever surfaces it, and the design system\n * quietly stops being the place those decisions live.\n *\n * Every finding here is a `suggestion`, never an `error`. These are judgement\n * calls — a rule can be right about the pattern and wrong about the intent — and\n * a reuse hint that failed CI on the day it shipped would be a worse defect than\n * the drift it reports. `--strict` is there for consumers who want the ratchet.\n *\n * Rules stay conservative on purpose: each requires the *combination* that makes\n * the intent unambiguous. `margin-inline: auto` alone is not a centred track;\n * `display: flex` alone is not a cluster.\n */\nimport type { Format } from '@getvitops/generator';\nimport { type CssRule, extractStyleBlocks, scanCss } from './css-scan.ts';\nimport type { LintFinding } from './lint.ts';\n\n/**\n * The framework's own track widths. Declared in two places today\n * (`core/css/layout.css` and the tailwind emitter), so a rule keyed to the token\n * NAME rather than to a value survives either one moving.\n */\nconst TRACK_WIDTHS = ['--width-measure', '--width-breakout', '--width-spotlight'];\n\n/**\n * Column ratios that correspond to a `split-<a>-<b>` class.\n *\n * `.split` is FLEX, not grid — `display: flex` with `flex: 1` children, and a\n * ratio class setting `--_split-a`/`--_split-b`. Equal columns are the base\n * `.split` with no ratio class, which is why `1fr 1fr` is deliberately absent:\n * suggesting `split-1-1` would name a class that does not exist, and this file\n * would then be committing the very defect `lint.ts` reports.\n */\nconst SPLITS: Record<string, string> = {\n '1fr 2fr': '1-2',\n '2fr 1fr': '2-1',\n '1fr 3fr': '1-3',\n '3fr 1fr': '3-1',\n '1fr 4fr': '1-4',\n '4fr 1fr': '4-1',\n '2fr 3fr': '2-3',\n '3fr 2fr': '3-2',\n};\n\nconst decl = (rule: CssRule, property: string) =>\n rule.declarations.find((d) => d.property === property)?.value;\n\n/** Is this rule inside a `min-width` media or container query? */\nconst inMinWidthQuery = (rule: CssRule) => rule.conditions.some((c) => /min-width\\s*:/.test(c));\n\n/** The framework breakpoint a `min-width` condition corresponds to, if any. */\nfunction breakpointOf(rule: CssRule): string | null {\n const rem = rule.conditions.map((c) => /min-width\\s*:\\s*([\\d.]+)rem/.exec(c)?.[1]).find(Boolean);\n if (!rem) return null;\n const n = Number(rem);\n // The framework's container breakpoints: sm/md/lg/xl = 30/48/64/80rem.\n return n >= 80 ? 'xl' : n >= 64 ? 'lg' : n >= 48 ? 'md' : n >= 30 ? 'sm' : null;\n}\n\n/** Spell a responsive utility the way the target format actually emits it. */\nconst responsive = (bp: string, base: string, format: Format) =>\n format === 'tailwind' ? `@${bp}:${base}` : `${bp}-${base}`;\n\ntype Verdict = Omit<LintFinding, 'file' | 'line'>;\n\n/**\n * One rule = one check. Kept as data rather than a chain of ifs so adding a\n * primitive is adding an entry, and so each carries its own explanation.\n */\nconst RULES: ((rule: CssRule, format: Format) => Verdict | null)[] = [\n // ── a centred track, written by hand ──────────────────────────────────────\n (rule) => {\n const token = TRACK_WIDTHS.find(\n (t) => decl(rule, 'max-inline-size')?.includes(t) || decl(rule, 'max-width')?.includes(t),\n );\n const centred = /\\bauto\\b/.test(decl(rule, 'margin-inline') ?? decl(rule, 'margin') ?? '');\n if (!token || !centred) return null;\n return {\n cls: `${rule.selector} { max-inline-size: var(${token}); margin-inline: auto }`,\n severity: 'suggestion',\n reason:\n '`.centered` is this pattern — a grid of named tracks, not a max-width plus auto margins',\n suggestion:\n 'use `.centered`, and widen an individual child with `breakout`, `spotlight` or ' +\n '`fullbleed` on that child rather than overriding the parent',\n };\n },\n\n // ── a two-column split behind a breakpoint ────────────────────────────────\n (rule, format) => {\n const cols = decl(rule, 'grid-template-columns');\n if (!cols || !inMinWidthQuery(rule)) return null;\n const ratio = SPLITS[cols.replace(/\\s+/g, ' ').trim()];\n const bp = ratio && breakpointOf(rule);\n if (!ratio || !bp) return null;\n return {\n cls: `${rule.selector} { grid-template-columns: ${cols} }`,\n severity: 'suggestion',\n reason: `a ${cols} split behind a min-width query is the \\`split-${ratio}\\` utility`,\n suggestion:\n `${responsive(bp, `split-${ratio}`, format)} on the container — the responsive form is ` +\n 'equal below the breakpoint and takes the ratio above it, which is what the query is doing by hand',\n };\n },\n\n // ── a flex row with centred items ─────────────────────────────────────────\n (rule, format) => {\n if (decl(rule, 'display') !== 'flex') return null;\n if (decl(rule, 'align-items') !== 'center') return null;\n if (/column/.test(decl(rule, 'flex-direction') ?? '')) return null;\n return {\n cls: `${rule.selector} { display: flex; align-items: center }`,\n severity: 'suggestion',\n reason: 'the framework has this as utilities',\n suggestion:\n format === 'tailwind'\n ? \"Tailwind's own `flex items-center` (the framework drops these names in this format)\"\n : '`flex items-center`, or `.cluster-start` if this is a row of related controls',\n };\n },\n];\n\n/**\n * Lint stylesheets and the `<style>` blocks of component files.\n *\n * `files` carries raw text, same as `lintSource` — this module stays free of the\n * filesystem so the caller owns discovery.\n */\n/**\n * The banner every generated stylesheet opens with.\n *\n * Linting the generator's own output is the worst false positive this tool can\n * produce: the emitted bundle contains the framework's real implementations of\n * these very patterns, so it reports `.split` as reinventing `.split`. The\n * `css` format writes `styles.css` into the consumer's source tree (`src/styles`\n * by default), which is squarely inside what `--src` scans.\n *\n * Matched on the banner rather than on a path, because the output directory is\n * configurable and a path rule would silently stop working when someone changes\n * it.\n */\n// Case-sensitive on purpose: the banner shouts `GENERATED`, and matching it\n// case-insensitively also swallowed an authored `/* generated content here */`.\nconst GENERATED = /^\\s*\\/\\*!?\\s*GENERATED\\b|do not edit by hand\\./;\n\nexport function lintCss(files: { path: string; text: string }[], format: Format): LintFinding[] {\n const findings: LintFinding[] = [];\n const seen = new Set<string>();\n for (const file of files) {\n if (GENERATED.test(file.text.slice(0, 400))) continue;\n // A .css file is one block starting at line 1; a component file may hold\n // several, each offset to where its <style> opens so a reported line points\n // into the original file rather than into the extracted block.\n const blocks = file.path.endsWith('.css')\n ? [{ css: file.text, line: 1 }]\n : extractStyleBlocks(file.text);\n for (const block of blocks)\n for (const rule of scanCss(block.css))\n for (const check of RULES) {\n const verdict = check(rule, format);\n if (!verdict) continue;\n const line = block.line + rule.line - 1;\n const key = `${file.path}:${line}:${verdict.reason}`;\n if (seen.has(key)) continue;\n seen.add(key);\n findings.push({ file: file.path, line, ...verdict });\n break; // one suggestion per rule — the first match wins\n }\n }\n return findings;\n}\n","/**\n * `vitops lint` — find framework classes in consumer source that resolve to\n * nothing in the format being built.\n *\n * The problem this exists for: an unknown utility class is indistinguishable\n * from a working one. Nothing errors, nothing warns, the element just doesn't\n * get the style. Two shapes of that were found in a real consumer site:\n *\n * • `bg-navy-d` — a leftover from the named-step scale (`d`/`xd`/`xxd`)\n * deleted in favour of numeric steps. The hue is real, the step is not.\n * It appeared ~10× and looked fine only because the `.card` it sat on\n * supplied its own background.\n * • `md-flex-row` — the css/bricks spelling of a responsive variant, used in\n * a `tailwind`-format project where that class is never emitted (Tailwind\n * regenerates those on demand as `@md:`). Silently inert.\n *\n * DESIGN: this deliberately only inspects classes ANCHORED TO THE CONSUMER'S\n * OWN CONFIG — a hue name, a role name, a type role, a shadow, a pattern. It\n * never tries to enumerate \"all valid classes\", because in the tailwind format\n * that would mean knowing Tailwind's entire built-in vocabulary, and every\n * unknown would be a false positive. Anchoring means a finding is always\n * actionable: you named something from your design system, and it doesn't\n * resolve.\n */\nimport { NUMERIC_STEPS, type DesignSystem, type Format } from '@getvitops/generator';\n\n/**\n * `error` — you named something from your design system and it resolves to\n * nothing. Always actionable, and fails the command.\n *\n * `suggestion` — the code works, but the framework already has a primitive for\n * it. Advisory by design: these are judgement calls, and a new rule that failed\n * CI on first run would be a worse defect than the drift it reports. `--strict`\n * promotes them for consumers who want the ratchet.\n */\nexport type LintSeverity = 'error' | 'suggestion';\n\nexport interface LintFinding {\n file: string;\n line: number;\n /** The class token, or for a CSS rule the declaration that triggered it. */\n cls: string;\n reason: string;\n suggestion?: string;\n severity: LintSeverity;\n}\n\nconst UTIL_FAMILIES = ['bg', 'text', 'icon', 'border', 'outline', 'fill', 'stroke'];\nconst BREAKPOINTS = ['sm', 'md', 'lg', 'xl'];\n\n/**\n * The modifiers actually emitted for one family + role, read back out of the\n * generator's own class list.\n *\n * This used to be a hand-maintained array, which is the wrong shape for a\n * suggestion: the two role kinds emit different modifiers (a chromatic role has\n * `solid` and no bare form; a surface role the reverse), so a single list was\n * wrong for one of them no matter what it said.\n */\nconst emittedModifiers = (roleClasses: Set<string>, fam: string, role: string): string[] => {\n const prefix = `${fam}-${role}`;\n return [...roleClasses]\n .filter((c) => c === prefix || c.startsWith(`${prefix}-`))\n .map((c) => c.slice(prefix.length + 1))\n .filter(Boolean)\n .sort();\n};\n\n/** Everything the config makes namable, so we only judge classes we can judge. */\ninterface Vocabulary {\n roles: string[];\n hues: string[];\n steps: string[];\n typeRoles: string[];\n shadows: string[];\n patterns: string[];\n /** Every role utility the generator actually emits, e.g. `bg-surface-x-muted`. */\n roleClasses: Set<string>;\n}\n\nexport function vocabulary(ds: DesignSystem, roleClasses: Iterable<string>): Vocabulary {\n return {\n roles: Object.keys(ds.colors?.roles ?? {}),\n hues: Object.keys(ds.colors?.palette ?? {}),\n steps: [...NUMERIC_STEPS],\n typeRoles: Object.keys(ds.typography?.roles ?? {}),\n shadows: Object.keys(ds.shadows ?? {}),\n patterns: Object.keys(ds.patterns?.items ?? {}),\n roleClasses: new Set(roleClasses),\n };\n}\n\n/**\n * Strip variant prefixes (`@md:`, `hover:`, `dark:`) from a candidate.\n *\n * Format-aware, because the container-query spelling only exists in tailwind.\n * Stripping `@md:` unconditionally made the check asymmetric: `md-split-1-2` in a\n * tailwind project was caught, but `@md:split-1-2` in a css/bricks project became\n * a bare `split-1-2` that matched nothing and returned null — the same silent\n * no-op, in the other direction, unreported.\n */\nconst stripVariants = (cls: string, format: Format): string => {\n let out = cls;\n while (/^@?[a-zA-Z0-9_-]+:/.test(out)) {\n if (format !== 'tailwind' && out.startsWith('@')) break;\n out = out.slice(out.indexOf(':') + 1);\n }\n return out;\n};\n\nconst nearest = (want: string, pool: string[]): string | undefined =>\n pool.find((p) => p.startsWith(want) || want.startsWith(p));\n\n/**\n * Judge one class token. Returns null when the class is none of our business —\n * which is the common case and the whole reason this is low-noise.\n */\nexport function judge(\n raw: string,\n v: Vocabulary,\n format: Format,\n): Omit<LintFinding, 'file' | 'line'> | null {\n const cls = stripVariants(raw, format);\n\n // ── the `@<bp>:` container-query spelling, in a format that has none ───────\n // Tailwind's engine expands these; css/bricks ship pre-expanded `<bp>-` classes\n // instead, so this spelling resolves to nothing there.\n const cq = /^@(sm|md|lg|xl):(.+)$/.exec(cls);\n if (cq && format !== 'tailwind')\n return {\n cls: raw,\n severity: 'error' as const,\n reason: `\\`@${cq[1]}:\\` container-query variants are a tailwind-format spelling; the ${format} format emits pre-expanded classes`,\n suggestion: `${cq[1]}-${cq[2]}`,\n };\n\n // ── the `<bp>-` responsive spelling ────────────────────────────────────────\n const bp = /^(sm|md|lg|xl)-(.+)$/.exec(cls);\n if (bp && format === 'tailwind')\n return {\n cls: raw,\n severity: 'error' as const,\n reason: `\\`${bp[1]}-\\` responsive classes are not emitted in the tailwind format`,\n suggestion: `@${bp[1]}:${bp[2]} (framework breakpoints) or ${bp[1]}:${bp[2]} (Tailwind's)`,\n };\n // In css/bricks the bare-prefix form is real; fall through and judge the base\n // against the rest of the vocabulary.\n const base = bp && format !== 'tailwind' ? (bp[2] as string) : cls;\n\n // ── <util>-<hue>-<step> ────────────────────────────────────────────────────\n const util = new RegExp(`^(${UTIL_FAMILIES.join('|')})-(.+)$`).exec(base);\n if (util) {\n const [, fam, rest] = util as unknown as [string, string, string];\n // Anything the generator actually emits is valid, full stop. Checking this\n // first also settles the ambiguity below for every well-formed class.\n if (v.roleClasses.has(base)) return null;\n\n // Role and hue names can share a prefix — `defaultConfig()` has the hue\n // `brand` and the role `brand-primary`, so matching hues first would read\n // `bg-brand-primary-x-muted` as hue `brand` + step `primary-x-muted` and\n // report a bogus bad step. Take the LONGEST match across both vocabularies.\n const prefix = (names: string[]) =>\n names\n .filter((n) => rest === n || rest.startsWith(`${n}-`))\n .sort((a, b) => b.length - a.length)[0];\n const hue = prefix(v.hues);\n const role = prefix(v.roles);\n const useRole = role && (!hue || role.length > hue.length);\n\n if (useRole) {\n const mod = rest.slice((role as string).length + 1);\n const valid = emittedModifiers(v.roleClasses, fam as string, role as string);\n return {\n cls: raw,\n severity: 'error' as const,\n reason: `\\`${fam}-${role}${mod ? `-${mod}` : ''}\\` is not emitted for the \\`${role}\\` role`,\n suggestion: valid.length\n ? `valid modifiers: ${valid.join(', ')}`\n : `the \\`${role}\\` role emits no \\`${fam}-*\\` utilities`,\n };\n }\n if (hue) {\n const step = rest.slice(hue.length + 1);\n if (step === '')\n return {\n cls: raw,\n severity: 'error' as const,\n reason: `\\`${fam}-${hue}\\` names a palette hue with no step`,\n suggestion: `${fam}-${hue}-500, or a role such as ${fam}-${v.roles[0] ?? 'neutral'}`,\n };\n if (!v.steps.includes(step))\n return {\n cls: raw,\n severity: 'error' as const,\n reason: `\\`${step}\\` is not a step on the \\`${hue}\\` scale (steps are 50…950)`,\n suggestion: `${fam}-${hue}-500, or a role such as ${fam}-${v.roles[0] ?? 'neutral'} which also flips in dark mode`,\n };\n return null; // valid raw step\n }\n return null; // not anchored to this config — not ours to judge\n }\n\n // ── font-<type-role> ───────────────────────────────────────────────────────\n const font = /^font-(.+)$/.exec(base);\n if (font && v.typeRoles.length && !v.typeRoles.includes(font[1] as string)) {\n const near = nearest(font[1] as string, v.typeRoles);\n // Only complain when it looks like a type role attempt, not e.g. font-bold.\n if (near)\n return {\n cls: raw,\n severity: 'error' as const,\n reason: `\\`${font[1]}\\` is not a typography role`,\n suggestion: `font-${near}`,\n };\n }\n\n // ── drop-shadow-<name> ─────────────────────────────────────────────────────\n const ds = /^drop-shadow-(.+)$/.exec(base);\n if (ds && v.shadows.length && !v.shadows.includes(ds[1] as string))\n return {\n cls: raw,\n severity: 'error' as const,\n reason: `\\`${ds[1]}\\` is not a defined shadow`,\n suggestion: `drop-shadow-${v.shadows[0]}`,\n };\n\n return null;\n}\n\nconst CLASS_ATTR = /(?:class|className|:class)\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|\\{`([^`]*)`\\})/g;\n\n/** Extract class tokens from a source file, with line numbers. */\nexport function extractClasses(src: string): { cls: string; line: number }[] {\n const out: { cls: string; line: number }[] = [];\n for (const m of src.matchAll(CLASS_ATTR)) {\n const value = m[1] ?? m[2] ?? m[3] ?? '';\n const line = src.slice(0, m.index).split('\\n').length;\n for (const tok of value.split(/\\s+/))\n // Skip template holes and dynamic fragments — a partial token would be\n // judged as a typo and this must not cry wolf.\n if (tok && !tok.includes('${') && !tok.includes('{') && /^[@\\w:[\\]().%/-]+$/.test(tok))\n out.push({ cls: tok, line });\n }\n return out;\n}\n\nexport function lintSource(\n files: { path: string; text: string }[],\n v: Vocabulary,\n format: Format,\n): LintFinding[] {\n const findings: LintFinding[] = [];\n const seen = new Set<string>();\n for (const f of files)\n for (const { cls, line } of extractClasses(f.text)) {\n const verdict = judge(cls, v, format);\n if (!verdict) continue;\n const key = `${f.path}:${line}:${cls}`;\n if (seen.has(key)) continue;\n seen.add(key);\n findings.push({ file: f.path, line, ...verdict });\n }\n return findings;\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|design[,…]> --out <dir>\n * vitops init [--out design-system.json] [--force]\n * vitops validate <design-system.json|site.json>\n * vitops favicon --input <svg|png> --out <dir> [--low-res <svg|png>] [--background <hex>]\n * vitops agents [--input <json>] [--out AGENTS.md] [--docs-dir <dir>]\n * vitops docs [topic] [--input <json>] [--all]\n * vitops lint [--input <json>] [--format <fmt>] [--src <dir>]\n * vitops legal [--input <site.json>] [--doc <name>] [--format <md|html|portable-text>] [--out <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, relative } from 'node:path';\nimport { createRequire } from 'node:module';\nimport { pathToFileURL } from 'node:url';\nimport {\n buildIconSprite,\n generate,\n validate,\n defaultConfig,\n generateDocs,\n generateLegal,\n enabledDocs,\n isSiteConfig,\n resolveInput,\n resolveSiteConfig,\n resolveTheme,\n roleColorUtilities,\n functionalRole,\n expandPalette,\n roleHue,\n roleKind,\n SCHEMA_URL,\n type Format,\n type StylesheetFormat,\n type DesignSystem,\n type LegalDoc,\n type LegalOutput,\n type ResolvedInput,\n type SiteConfig,\n} from '@getvitops/generator';\nimport {\n collectIconRefs,\n generateFavicons,\n generateIconInclude,\n resolveIcon,\n scanFiles,\n} from '@getvitops/utils';\nimport { findSkillTarget, linkSkill, SKILL_NAME, TOPICS } from './agents.ts';\nimport { lintCss } from './lint-css.ts';\nimport { lintSource, vocabulary } from './lint.ts';\n\nconst FORMATS = new Set<Format>(['bricks', 'css', 'tailwind', 'design']);\n// `lint` judges class names against what a build emits, and the `design` format\n// emits no CSS at all — so it is a valid target for `generate` and a category\n// error for `lint`.\nconst LINT_FORMATS = new Set<StylesheetFormat>(['bricks', 'css', 'tailwind']);\n\n// `legal` reads a *site* config, not a design-system.json, and has its own\n// output set — it renders documents, not stylesheets.\nconst LEGAL_DOCS = new Set<LegalDoc>(['privacy', 'terms', 'cookies']);\nconst LEGAL_OUTPUTS = new Set<LegalOutput>(['md', 'html', 'portable-text']);\n\nconst HELP = `vitops — generate design-system outputs from a design-system.json\n\nAnywhere a command takes --input, that file may be a design-system.json OR the\nlarger site config that embeds one (company.json / site.json). The two are told\napart by shape, and a site config also supplies the site-level facts generation\nreads — its default colour scheme, its legal documents, its icon sprite.\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 it says it is\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 vitops lint [options] Report framework classes in your source that resolve to nothing\n vitops legal [options] Render legal documents from a site config\n vitops icons [options] Report which icons your source uses, and build the sprite\n\nGenerate options:\n -i, --input <path> design-system.json or site config (default: ./design-system.json)\n -f, --format <list> bricks | css | tailwind | design (comma-separated; default: bricks)\n design emits DESIGN.md only (the agent-facing brief) — pair it\n with --out . to write it beside AGENTS.md, or compose:\n --format css,design\n -o, --out <dir> Output directory (default: ./dist)\n --theme <name> Which designSystem.themes entry to build, when --input is\n a site config (default: its defaultTheme, else \"default\")\n --site <path> Site config, when it is a different file from --input.\n Emits legal/*.html into the output directory (see:\n vitops legal). Omitted with a plain design-system.json:\n no legal files.\n --site-env <env> Environment whose A/B variant applies (default: production)\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 --background <hex> Background under the maskable icons, which must be\n opaque (default: #ffffff)\n\nAgents options:\n -i, --input <path> design-system.json or site config (default: ./design-system.json;\n validated if present)\n --theme <name> Theme to read, when --input is a site config\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> design-system.json or site config (default: ./design-system.json)\n --theme <name> Theme to render docs from, when --input is a site config\n --all Print every topic, concatenated\n\nIcons options:\n --site <path> Site config carrying the \"icons\" block (default: ./site.json)\n --src <dir> Source to scan for icon usage (default: ./src)\n --sprite Also build the SVG sprite\n -o, --out <dir> Where to write icons.svg with --sprite (default: ./dist)\n --json Machine-readable report on stdout\n\nLint options:\n -i, --input <path> design-system.json or site config (default: ./design-system.json)\n --theme <name> Theme to judge classes against, when --input is a site config\n -f, --format <fmt> Format you build (bricks | css | tailwind; default: bricks).\n Responsive md-* classes are real in css/bricks, inert in tailwind.\n -s, --src <dir> Directory to scan (default: ./src)\n --strict Also fail on suggestions (reuse hints), not just on\n classes that resolve to nothing\n\nLegal options:\n -i, --input <path> Site config: .json, or a .js/.ts module with a default\n export (default: ./site.json)\n -d, --doc <name> privacy | terms | cookies (repeatable; default: those\n enabled in the config)\n -f, --format <fmt> md | html | portable-text (default: md)\n html suits WordPress/Bricks and plain sites;\n portable-text suits EmDash\n -o, --out <dir> Write files here (default: print to stdout)\n --site-env <env> Environment whose A/B variant applies (default: production)\n\n Generated from your config — a starting point, not legal advice. Review before\n publishing, and make sure the config describes what your site actually does.\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 site: { type: 'string' },\n theme: { type: 'string' },\n 'site-env': { type: 'string' },\n },\n allowPositionals: false,\n });\n const input = resolve(values.input as string);\n if (!existsSync(input)) fail(`config not found: ${input}`);\n const site = values.site ? resolve(values.site as string) : undefined;\n if (site && !existsSync(site)) fail(`site config not found: ${site}`);\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 | design)`);\n\n for (const format of formats as Format[]) {\n try {\n const res = await generate({\n input,\n format,\n outDir: values.out as string,\n ...(site ? { site } : {}),\n ...(values.theme ? { theme: values.theme as string } : {}),\n ...(values['site-env'] ? { siteEnv: values['site-env'] as string } : {}),\n });\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\n/**\n * Validate a config against the schema its shape says it is.\n *\n * Routing on kind rather than asking the caller matters here: pointed at a site\n * config, the design-system schema used to report a single `unrecognized_keys`\n * for `designSystem` and nothing about the file's actual contents — a wrong\n * answer that reads like a right one. A site config is validated whole, which\n * also covers the cross-field integrity JSON Schema can't express.\n */\nfunction cmdValidate(argv: string[]) {\n const { values, positionals } = parseArgs({\n args: argv,\n options: { input: { type: 'string', short: 'i' }, 'site-env': { type: 'string' } },\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\n if (isSiteConfig(raw)) {\n let site: SiteConfig;\n try {\n site = resolveSiteConfig(raw, values['site-env'] as string | undefined);\n } catch (err) {\n // Already formatted as one issue per line, with field paths.\n console.error(`✖ ${path} is invalid as a site config:`);\n console.error((err as Error).message.replace(/^Invalid site config:\\n/, ''));\n process.exit(1);\n }\n // Each theme is validated in turn: `validateSite` checks the `extends` chain\n // resolves, not that what it resolves to is a complete design system, so a\n // theme could pass there and still fail to build.\n const themes = (site.designSystem?.themes ?? {}) as Parameters<typeof resolveTheme>[0];\n let bad = false;\n for (const name of Object.keys(themes)) {\n const result = validate(resolveTheme(themes, name));\n for (const w of result.warnings) console.warn(` ! designSystem.themes.${name}: ${w}`);\n if (result.ok) continue;\n bad = true;\n console.error(`✖ ${path} — designSystem.themes.${name} is not a complete design system:`);\n for (const e of result.errors)\n console.error(` • ${e.path.join('.') || '(root)'}: ${e.message}`);\n }\n if (bad) process.exit(1);\n const n = Object.keys(themes).length;\n console.log(`✓ ${path} is a valid site config (${n} theme${n === 1 ? '' : 's'})`);\n return;\n }\n\n const result = validate(raw);\n for (const w of result.warnings) console.warn(` ! ${w}`);\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 // The maskable outputs must be opaque — the OS crops them to its own shape,\n // so transparency there becomes a black frame, not \"no background\".\n background: { 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 ...(values.background ? { backgroundColor: values.background 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/**\n * Read + parse + validate the design system at `path`, or exit with a message.\n *\n * `path` may be a `design-system.json` **or** the larger site config that embeds\n * one — every command that judges source against the design system (`docs`,\n * `lint`, `agents`) accepts either, so a consumer who keeps their tokens in\n * `company.json` doesn't have to maintain a second file for the tooling's sake.\n * `resolveInput` tells them apart by shape and resolves the theme.\n */\nfunction loadConfig(path: string, theme?: 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 let resolved: ResolvedInput;\n try {\n resolved = resolveInput(raw, theme != null ? { theme } : {});\n } catch (err) {\n // resolveSiteConfig formats one issue per line; a bad --theme is one line.\n fail(`${path}: ${(err as Error).message}`);\n }\n const result = validate(resolved.designSystem);\n if (!result.ok) {\n const where = resolved.theme != null ? ` (designSystem.themes.${resolved.theme})` : '';\n console.error(`✖ ${path}${where} is invalid:`);\n for (const e of result.errors)\n console.error(` • ${e.path.join('.') || '(root)'}: ${e.message}`);\n process.exit(1);\n }\n // Warnings go to stderr, not stdout: `vitops docs <topic>` is designed to be\n // piped, so anything here must not land in the piped document. They used to\n // be dropped entirely on this path, which meant `docs` and `agents` stayed\n // silent about collisions that `generate` and `validate` both reported.\n for (const w of result.warnings) console.warn(` ! ${w}`);\n return result.data;\n}\n\n/**\n * Read + resolve a site config, or exit with a message.\n *\n * Accepts JSON, or a JS/TS module with a default export — deliberately not YAML,\n * which would mean a parser dependency for one command. `resolveSiteConfig` is\n * documented as taking an already-parsed object precisely so the loader is the\n * consumer's choice; anyone on YAML can convert it or export from a module.\n */\nasync function loadSiteConfig(path: string, siteEnv: string): Promise<SiteConfig> {\n if (!existsSync(path)) fail(`site config not found: ${path}`);\n let raw: unknown;\n if (/\\.(json)$/.test(path)) {\n try {\n raw = JSON.parse(readFileSync(path, 'utf8'));\n } catch (err) {\n fail(`could not parse JSON: ${(err as Error).message}`);\n }\n } else {\n try {\n raw = (await import(pathToFileURL(path).href)).default;\n } catch (err) {\n fail(`could not import ${path}: ${(err as Error).message}`);\n }\n if (raw == null) fail(`${path} has no default export`);\n }\n try {\n return resolveSiteConfig(raw, siteEnv);\n } catch (err) {\n // resolveSiteConfig already formats one issue per line.\n fail((err as Error).message);\n }\n}\n\n/**\n * Render the site's legal documents.\n *\n * The universal delivery path: every consumer has this CLI regardless of stack,\n * so a WordPress theme, an Eleventy build or a hand-written HTML site all get\n * the same documents without any integration code. Prints to stdout like\n * `vitops docs`, or writes files when given `--out`.\n */\n/**\n * Report the icon vocabulary a project actually uses, and optionally build the\n * sprite from it.\n *\n * A sibling of `legal` rather than a widening of `lint`: `lint` judges classes\n * against a design-system.json, whereas icons are anchored to a SiteConfig.\n *\n * Exit codes carry the same distinction the Astro integration makes. A name the\n * config DECLARES but that doesn't resolve is a config error and fails the\n * command; a name only the SCAN found is reported and tolerated, because a bare\n * unmapped name is more often a local src/icons/*.svg than a mistake. Runtime-\n * computed names are listed with file and line so they can be declared, never\n * guessed at.\n */\nasync function cmdIcons(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n site: { type: 'string', default: 'site.json' },\n src: { type: 'string', default: 'src' },\n sprite: { type: 'boolean', default: false },\n out: { type: 'string', short: 'o', default: 'dist' },\n json: { type: 'boolean', default: false },\n 'site-env': { type: 'string', default: 'production' },\n },\n allowPositionals: false,\n });\n\n const sitePath = resolve(values.site as string);\n const icons = existsSync(sitePath)\n ? (((await loadSiteConfig(sitePath, values['site-env'] as string)).icons ?? {}) as Record<\n string,\n unknown\n >)\n : {};\n const ui = (icons.ui as string) ?? 'fa7-solid';\n const brand = (icons.brand as string) ?? 'simple-icons';\n const weight = icons.weight as string | undefined;\n const weightOpt = weight ? { weight } : {};\n\n // Declared first — this throws on an unresolvable name, by design.\n let include: Record<string, string[]> = {};\n try {\n include = generateIconInclude({ ...(icons as object) } as Parameters<\n typeof generateIconInclude\n >[0]);\n } catch (e) {\n fail((e as Error).message);\n }\n const add = (prefix: string, name: string) => {\n const list = (include[prefix] ??= []);\n if (!list.includes(name)) list.push(name);\n };\n\n const srcDir = resolve(values.src as string);\n const scanned = existsSync(srcDir) ? collectIconRefs(scanFiles(srcDir)) : null;\n const unmapped: string[] = [];\n for (const name of scanned?.names ?? []) {\n const colon = name.indexOf(':');\n if (colon > 0) {\n add(name.slice(0, colon), name.slice(colon + 1));\n continue;\n }\n try {\n const q = resolveIcon(name, ui, weightOpt);\n add(q.slice(0, q.indexOf(':')), q.slice(q.indexOf(':') + 1));\n } catch {\n unmapped.push(name);\n }\n }\n\n const dynamic = (scanned?.dynamic ?? []).map((d) => ({\n file: relative(process.cwd(), d.file),\n line: d.line,\n expr: d.expr,\n }));\n const total = Object.values(include).flat().length;\n\n let sprite: { ids: string[]; missing: string[] } | null = null;\n if (values.sprite) {\n const aliases: Record<string, string> = {};\n for (const name of (icons.semantic as string[]) ?? []) {\n try {\n aliases[`icon-${name}`] = resolveIcon(name, ui, weightOpt);\n } catch {\n /* already reported by generateIconInclude above */\n }\n }\n const built = await buildIconSprite({ include, aliases });\n const outDir = resolve(values.out as string);\n mkdirSync(outDir, { recursive: true });\n writeFileSync(join(outDir, 'icons.svg'), built.svg);\n sprite = { ids: built.ids, missing: built.missing };\n }\n\n if (values.json) {\n process.stdout.write(\n `${JSON.stringify({ ui, brand, weight: weight ?? null, include, unmapped, dynamic, sprite }, null, 2)}\\n`,\n );\n } else {\n console.log(`icon sets: ui=${ui} brand=${brand}${weight ? ` weight=${weight}` : ''}`);\n for (const [prefix, names] of Object.entries(include))\n console.log(` ${prefix}: ${names.length} — ${names.join(', ')}`);\n console.log(`✓ ${total} icon(s) across ${Object.keys(include).length} set(s)`);\n if (sprite)\n console.log(\n `✓ sprite → ${resolve(values.out as string)}/icons.svg (${sprite.ids.length} symbols)`,\n );\n for (const d of dynamic)\n console.log(` ! ${d.file}:${d.line} ${d.expr} — computed at runtime, declare it in icons`);\n if (unmapped.length)\n console.log(\n ` ! not in the '${ui}' map: ${unmapped.join(', ')} (fine for a local svg or sprite id)`,\n );\n if (sprite?.missing.length)\n console.log(` ! absent from the sprite: ${sprite.missing.join(', ')}`);\n }\n\n // Dynamic holes and unmapped bare names are warnings, not failures — same\n // tolerance `lint` shows template holes, but visible rather than silent.\n if (sprite?.missing.length) process.exitCode = 1;\n}\n\nasync function cmdLegal(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n input: { type: 'string', short: 'i', default: 'site.json' },\n doc: { type: 'string', short: 'd', multiple: true },\n format: { type: 'string', short: 'f', default: 'md' },\n out: { type: 'string', short: 'o' },\n 'site-env': { type: 'string', default: 'production' },\n },\n allowPositionals: false,\n });\n\n const output = values.format as LegalOutput;\n if (!LEGAL_OUTPUTS.has(output))\n fail(`unknown format \"${output}\" (expected: ${[...LEGAL_OUTPUTS].join(' | ')})`);\n\n const requested = (values.doc ?? []) as string[];\n for (const d of requested)\n if (!LEGAL_DOCS.has(d as LegalDoc))\n fail(`unknown doc \"${d}\" (expected: ${[...LEGAL_DOCS].join(' | ')})`);\n\n const site = await loadSiteConfig(resolve(values.input as string), values['site-env'] as string);\n const docs = requested.length ? (requested as LegalDoc[]) : enabledDocs(site);\n if (docs.length === 0)\n fail(\n 'no legal documents are enabled — set legal.privacyPolicy.enabled (or termsOfService / cookieConsent) in your site config, or name one with --doc',\n );\n\n const files = generateLegal(site, { docs, output });\n\n if (!values.out) {\n process.stdout.write(Object.values(files).join('\\n'));\n return;\n }\n const outDir = resolve(values.out as string);\n mkdirSync(outDir, { recursive: true });\n for (const [name, content] of Object.entries(files)) writeFileSync(join(outDir, name), content);\n console.log(`✓ legal → ${outDir} (${Object.keys(files).length} files)`);\n console.log(\n ' These are generated from your config and are not legal advice — review them before publishing.',\n );\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 theme: { type: 'string' },\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), values.theme as string | undefined);\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 cmdLint(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n input: { type: 'string', short: 'i', default: 'design-system.json' },\n theme: { type: 'string' },\n format: { type: 'string', short: 'f', default: 'bricks' },\n src: { type: 'string', short: 's', default: 'src' },\n // Suggestions are advisory: a reuse rule that failed CI the day it shipped\n // would be a worse defect than the drift it reports.\n strict: { type: 'boolean', default: false },\n },\n allowPositionals: false,\n });\n const format = values.format as StylesheetFormat;\n if (!LINT_FORMATS.has(format))\n fail(`unknown format \"${format}\" (expected: bricks | css | tailwind)`);\n const ds = loadConfig(resolve(values.input as string), values.theme as string | undefined);\n const srcDir = resolve(values.src as string);\n if (!existsSync(srcDir)) fail(`source directory not found: ${srcDir}`);\n\n // Ask the generator what it actually emits rather than re-deriving the rules\n // here — a linter that models the vocabulary separately just drifts into\n // reporting classes that do exist.\n const palette = expandPalette(ds.colors.palette);\n const roleClasses = roleColorUtilities(\n Object.entries(ds.colors.roles).map(([role, spec]) =>\n functionalRole(role, roleHue(spec), palette[roleHue(spec)]!, roleKind(spec)),\n ),\n ds.colors.utilities ?? ['bg', 'text', 'icon', 'border'],\n ).map((u) => u.cls);\n\n const files = scanFiles(srcDir);\n // `.css` is not in the default extension set — the class linter reads markup,\n // not stylesheets — so the reuse rules get their own pass. Component files are\n // scanned twice on purpose: once for their class attributes, once for any\n // `<style>` block, which is where hand-rolled layout tends to accumulate.\n const cssFiles = [...files, ...scanFiles(srcDir, { exts: ['.css'] })];\n const findings = [\n ...lintSource(files, vocabulary(ds, roleClasses), format),\n ...lintCss(cssFiles, format),\n ];\n\n if (!findings.length) {\n console.log(\n `✓ no unresolvable framework classes in ${values.src} ` +\n `(${files.length} file${files.length === 1 ? '' : 's'} scanned)`,\n );\n return;\n }\n\n const errors = findings.filter((f) => f.severity === 'error');\n const suggestions = findings.filter((f) => f.severity === 'suggestion');\n // Errors first: a class that resolves to nothing is a defect, a reuse\n // suggestion is a judgement call, and mixing them buries the former.\n for (const f of [...errors, ...suggestions]) {\n console.error(`${f.file}:${f.line} ${f.severity === 'error' ? f.cls : `(${f.cls})`}`);\n console.error(` ${f.reason}`);\n if (f.suggestion) console.error(` try: ${f.suggestion}`);\n }\n\n const count = (n: number, one: string, many: string) => `${n} ${n === 1 ? one : many}`;\n const parts: string[] = [];\n if (errors.length) parts.push(count(errors.length, 'unresolvable class', 'unresolvable classes'));\n if (suggestions.length) parts.push(count(suggestions.length, 'suggestion', 'suggestions'));\n const failing = errors.length > 0 || (values.strict === true && suggestions.length > 0);\n console.error(\n `\\n${failing ? '✖' : '!'} ${parts.join(', ')} in ` +\n `${files.length} file${files.length === 1 ? '' : 's'}` +\n (suggestions.length && !values.strict ? ' (suggestions do not fail; use --strict)' : ''),\n );\n if (failing) process.exit(1);\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 theme: { type: 'string' },\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)))\n ds = loadConfig(resolve(inputRel), values.theme as string | undefined);\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 generate --format design --out .` — `DESIGN.md`, the agent-facing brief',\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 case 'lint':\n return cmdLint(rest);\n case 'legal':\n return cmdLegal(rest);\n case 'icons':\n return cmdIcons(rest);\n default:\n fail(\n `unknown command \"${command}\" (expected: generate | init | validate | favicon | agents | docs | lint | legal | icons). 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,OAAO;EACL,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,QAAQ,MAAM,OAAO;EACzB,MAAM,QAAQ,GAAG;CACnB;AACF;;;;;;;AAQA,SAAgB,UAAU,UAAkB,WAAkC;CAC5E,MAAM,SAAS,SAAS,QAAQ,QAAQ,GAAG,QAAQ,SAAS,CAAC;CAC7D,IAAI;EACF,MAAM,KAAK,UAAU,UAAU,EAAE,gBAAgB,MAAM,CAAC;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,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,KAAK,QACH,OAAO,QAAQ,IAAI;EACrB,KAAK,SACH,OAAO,SAAS,IAAI;EACtB,KAAK,SACH,OAAO,SAAS,IAAI;EACtB,SACE,KACE,oBAAoB,QAAQ,8GAC9B;CACJ;AACF;AAEA,KAAK,CAAC,CAAC,OAAO,QAAQ,KAAM,IAAc,OAAO,CAAC"}
1
+ {"version":3,"file":"cli.mjs","names":["formatMediaPlan"],"sources":["../src/agents.ts","../src/css-scan.ts","../src/lint-css.ts","../src/lint.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 config: {\n path: 'config.md',\n summary:\n 'every field of the three-section config (designSystem / organization / site), 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 icons: {\n path: 'concepts/icons.md',\n summary: 'semantic icon names across sets, bundle derivation, sprite delivery',\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","/**\n * A minimal reader for hand-written CSS: rule selector, declarations as authored,\n * and the at-rule conditions the rule sits inside.\n *\n * **Why not lightningcss.** The generator owns it, and exposing an `analyzeCss`\n * from there was the obvious move — but lightningcss parses declarations into a\n * typed value model, and the typed model is exactly what these rules need to see\n * through. `display: flex` comes back as `pair`, `grid-template-columns: 1fr 1fr`\n * as `track-list`, and `margin-inline: auto` as an empty structured node. Every\n * rule here matches on *authored text*, so recovering it property-by-property\n * would mean re-implementing a serialiser for each one.\n *\n * A brace-depth scanner keeps the text intact, needs no native binary in the\n * CLI's dependency tree, and follows what `generate.ts` already does twice\n * (`stripForTailwind`, `isVariantBlock`).\n *\n * It is deliberately shallow: no specificity, no cascade, no `@supports`\n * semantics. It answers \"what did someone type in this rule\", which is all a\n * reuse suggestion needs.\n */\n\nexport interface CssDeclaration {\n property: string;\n value: string;\n}\n\nexport interface CssRule {\n selector: string;\n declarations: CssDeclaration[];\n /** Enclosing at-rule preludes, outermost first (`@media (min-width: 48rem)`). */\n conditions: string[];\n /** 1-indexed line of the selector. */\n line: number;\n}\n\n/** Strip comments, preserving newlines so line numbers survive. */\nfunction stripComments(css: string): string {\n return css.replace(/\\/\\*[\\s\\S]*?\\*\\//g, (m) => m.replace(/[^\\n]/g, ''));\n}\n\nconst lineAt = (src: string, index: number) => src.slice(0, index).split('\\n').length;\n\n/**\n * Parse declarations from a rule body. Splits on top-level `;` only, so a\n * `var(--x, a; b)` or a data URI cannot end a declaration early.\n */\nfunction parseDeclarations(body: string): CssDeclaration[] {\n const out: CssDeclaration[] = [];\n let depth = 0;\n let start = 0;\n const push = (chunk: string) => {\n const colon = chunk.indexOf(':');\n if (colon < 0) return;\n const property = chunk.slice(0, colon).trim();\n const value = chunk.slice(colon + 1).trim();\n // A nested block leaks in as a property containing `{`; skip it rather than\n // reporting a declaration that was never written.\n if (!property || property.includes('{') || !value) return;\n out.push({ property, value });\n };\n for (let i = 0; i < body.length; i++) {\n const ch = body[i];\n if (ch === '(' || ch === '[') depth++;\n else if (ch === ')' || ch === ']') depth--;\n else if (ch === ';' && depth === 0) {\n push(body.slice(start, i));\n start = i + 1;\n }\n }\n push(body.slice(start));\n return out;\n}\n\n/**\n * Scan a stylesheet into its style rules.\n *\n * Never throws: this runs over consumer source that may be a fragment, and a\n * linter that dies on one unparseable file is one nobody keeps in CI.\n */\nexport function scanCss(css: string): CssRule[] {\n const src = stripComments(css);\n const rules: CssRule[] = [];\n // Each open brace pushes its prelude; at-rule preludes become `conditions` for\n // everything nested inside, style-rule preludes become a selector.\n const stack: { prelude: string; index: number }[] = [];\n let depth = 0;\n let preludeStart = 0;\n\n for (let i = 0; i < src.length; i++) {\n const ch = src[i];\n if (ch === '\"' || ch === \"'\") {\n // Skip strings whole — a brace inside content: \"{\" would desync the depth.\n const quote = ch;\n i++;\n while (i < src.length && src[i] !== quote) {\n if (src[i] === '\\\\') i++;\n i++;\n }\n continue;\n }\n if (ch === '{') {\n const raw = src.slice(preludeStart, i);\n const prelude = raw.trim();\n // Offset of the first non-whitespace character, not of `preludeStart` —\n // that sits where the previous rule ended, so a rule's reported line would\n // be the blank line above it.\n stack.push({ prelude, index: preludeStart + raw.indexOf(prelude.slice(0, 1)) });\n depth++;\n preludeStart = i + 1;\n continue;\n }\n if (ch === '}') {\n const frame = stack.pop();\n depth--;\n if (frame && !frame.prelude.startsWith('@')) {\n // A style rule: its body is everything since it opened, minus any nested\n // blocks, which `parseDeclarations` discards.\n const bodyStart = src.indexOf('{', frame.index) + 1;\n rules.push({\n selector: frame.prelude,\n declarations: parseDeclarations(src.slice(bodyStart, i)),\n conditions: stack.filter((f) => f.prelude.startsWith('@')).map((f) => f.prelude),\n line: lineAt(src, frame.index),\n });\n }\n preludeStart = i + 1;\n continue;\n }\n }\n // Unbalanced braces (a fragment, a truncated file) leave frames on the stack;\n // returning what was parsed beats reporting nothing.\n return rules.filter((r) => r.selector && depth >= 0);\n}\n\n/** `<style>` block contents from an .astro/.vue/.svelte/.html file. */\nexport function extractStyleBlocks(src: string): { css: string; line: number }[] {\n const out: { css: string; line: number }[] = [];\n for (const m of src.matchAll(/<style\\b[^>]*>([\\s\\S]*?)<\\/style>/gi)) {\n // Offset so a finding's line number points into the original file, not into\n // the extracted block.\n const line = lineAt(src, (m.index ?? 0) + m[0].indexOf('>') + 1);\n out.push({ css: m[1] ?? '', line });\n }\n return out;\n}\n","/**\n * The inverse of `lint.ts`: hand-written CSS that re-implements a framework\n * primitive.\n *\n * `lint.ts` catches a class that resolves to nothing — you named something and it\n * isn't there. This catches the costlier direction, where the code *works*: a\n * centred container written by hand, a two-column split behind a media query, a\n * flex row. Nothing is broken, so nothing ever surfaces it, and the design system\n * quietly stops being the place those decisions live.\n *\n * Every finding here is a `suggestion`, never an `error`. These are judgement\n * calls — a rule can be right about the pattern and wrong about the intent — and\n * a reuse hint that failed CI on the day it shipped would be a worse defect than\n * the drift it reports. `--strict` is there for consumers who want the ratchet.\n *\n * Rules stay conservative on purpose: each requires the *combination* that makes\n * the intent unambiguous. `margin-inline: auto` alone is not a centred track;\n * `display: flex` alone is not a cluster.\n */\nimport type { Format } from '@getvitops/generator';\nimport { type CssRule, extractStyleBlocks, scanCss } from './css-scan.ts';\nimport type { LintFinding } from './lint.ts';\n\n/**\n * The framework's own track widths. Declared in two places today\n * (`core/css/layout.css` and the tailwind emitter), so a rule keyed to the token\n * NAME rather than to a value survives either one moving.\n */\nconst TRACK_WIDTHS = ['--width-measure', '--width-breakout', '--width-spotlight'];\n\n/**\n * Column ratios that correspond to a `split-<a>-<b>` class.\n *\n * `.split` is FLEX, not grid — `display: flex` with `flex: 1` children, and a\n * ratio class setting `--_split-a`/`--_split-b`. Equal columns are the base\n * `.split` with no ratio class, which is why `1fr 1fr` is deliberately absent:\n * suggesting `split-1-1` would name a class that does not exist, and this file\n * would then be committing the very defect `lint.ts` reports.\n */\nconst SPLITS: Record<string, string> = {\n '1fr 2fr': '1-2',\n '2fr 1fr': '2-1',\n '1fr 3fr': '1-3',\n '3fr 1fr': '3-1',\n '1fr 4fr': '1-4',\n '4fr 1fr': '4-1',\n '2fr 3fr': '2-3',\n '3fr 2fr': '3-2',\n};\n\nconst decl = (rule: CssRule, property: string) =>\n rule.declarations.find((d) => d.property === property)?.value;\n\n/** Is this rule inside a `min-width` media or container query? */\nconst inMinWidthQuery = (rule: CssRule) => rule.conditions.some((c) => /min-width\\s*:/.test(c));\n\n/** The framework breakpoint a `min-width` condition corresponds to, if any. */\nfunction breakpointOf(rule: CssRule): string | null {\n const rem = rule.conditions.map((c) => /min-width\\s*:\\s*([\\d.]+)rem/.exec(c)?.[1]).find(Boolean);\n if (!rem) return null;\n const n = Number(rem);\n // The framework's container breakpoints: sm/md/lg/xl = 30/48/64/80rem.\n return n >= 80 ? 'xl' : n >= 64 ? 'lg' : n >= 48 ? 'md' : n >= 30 ? 'sm' : null;\n}\n\n/** Spell a responsive utility the way the target format actually emits it. */\nconst responsive = (bp: string, base: string, format: Format) =>\n format === 'tailwind' ? `@${bp}:${base}` : `${bp}-${base}`;\n\ntype Verdict = Omit<LintFinding, 'file' | 'line'>;\n\n/**\n * One rule = one check. Kept as data rather than a chain of ifs so adding a\n * primitive is adding an entry, and so each carries its own explanation.\n */\nconst RULES: ((rule: CssRule, format: Format) => Verdict | null)[] = [\n // ── a centred track, written by hand ──────────────────────────────────────\n (rule) => {\n const token = TRACK_WIDTHS.find(\n (t) => decl(rule, 'max-inline-size')?.includes(t) || decl(rule, 'max-width')?.includes(t),\n );\n const centred = /\\bauto\\b/.test(decl(rule, 'margin-inline') ?? decl(rule, 'margin') ?? '');\n if (!token || !centred) return null;\n return {\n cls: `${rule.selector} { max-inline-size: var(${token}); margin-inline: auto }`,\n severity: 'suggestion',\n reason:\n '`.centered` is this pattern — a grid of named tracks, not a max-width plus auto margins',\n suggestion:\n 'use `.centered`, and widen an individual child with `breakout`, `spotlight` or ' +\n '`fullbleed` on that child rather than overriding the parent',\n };\n },\n\n // ── a two-column split behind a breakpoint ────────────────────────────────\n (rule, format) => {\n const cols = decl(rule, 'grid-template-columns');\n if (!cols || !inMinWidthQuery(rule)) return null;\n const ratio = SPLITS[cols.replace(/\\s+/g, ' ').trim()];\n const bp = ratio && breakpointOf(rule);\n if (!ratio || !bp) return null;\n return {\n cls: `${rule.selector} { grid-template-columns: ${cols} }`,\n severity: 'suggestion',\n reason: `a ${cols} split behind a min-width query is the \\`split-${ratio}\\` utility`,\n suggestion:\n `${responsive(bp, `split-${ratio}`, format)} on the container — the responsive form is ` +\n 'equal below the breakpoint and takes the ratio above it, which is what the query is doing by hand',\n };\n },\n\n // ── a flex row with centred items ─────────────────────────────────────────\n (rule, format) => {\n if (decl(rule, 'display') !== 'flex') return null;\n if (decl(rule, 'align-items') !== 'center') return null;\n if (/column/.test(decl(rule, 'flex-direction') ?? '')) return null;\n return {\n cls: `${rule.selector} { display: flex; align-items: center }`,\n severity: 'suggestion',\n reason: 'the framework has this as utilities',\n suggestion:\n format === 'tailwind'\n ? \"Tailwind's own `flex items-center` (the framework drops these names in this format)\"\n : '`flex items-center`, or `.cluster-start` if this is a row of related controls',\n };\n },\n];\n\n/**\n * Lint stylesheets and the `<style>` blocks of component files.\n *\n * `files` carries raw text, same as `lintSource` — this module stays free of the\n * filesystem so the caller owns discovery.\n */\n/**\n * The banner every generated stylesheet opens with.\n *\n * Linting the generator's own output is the worst false positive this tool can\n * produce: the emitted bundle contains the framework's real implementations of\n * these very patterns, so it reports `.split` as reinventing `.split`. The\n * `css` format writes `styles.css` into the consumer's source tree (`src/styles`\n * by default), which is squarely inside what `--src` scans.\n *\n * Matched on the banner rather than on a path, because the output directory is\n * configurable and a path rule would silently stop working when someone changes\n * it.\n */\n// Case-sensitive on purpose: the banner shouts `GENERATED`, and matching it\n// case-insensitively also swallowed an authored `/* generated content here */`.\nconst GENERATED = /^\\s*\\/\\*!?\\s*GENERATED\\b|do not edit by hand\\./;\n\nexport function lintCss(files: { path: string; text: string }[], format: Format): LintFinding[] {\n const findings: LintFinding[] = [];\n const seen = new Set<string>();\n for (const file of files) {\n if (GENERATED.test(file.text.slice(0, 400))) continue;\n // A .css file is one block starting at line 1; a component file may hold\n // several, each offset to where its <style> opens so a reported line points\n // into the original file rather than into the extracted block.\n const blocks = file.path.endsWith('.css')\n ? [{ css: file.text, line: 1 }]\n : extractStyleBlocks(file.text);\n for (const block of blocks)\n for (const rule of scanCss(block.css))\n for (const check of RULES) {\n const verdict = check(rule, format);\n if (!verdict) continue;\n const line = block.line + rule.line - 1;\n const key = `${file.path}:${line}:${verdict.reason}`;\n if (seen.has(key)) continue;\n seen.add(key);\n findings.push({ file: file.path, line, ...verdict });\n break; // one suggestion per rule — the first match wins\n }\n }\n return findings;\n}\n","/**\n * `vitops lint` — find framework classes in consumer source that resolve to\n * nothing in the format being built.\n *\n * The problem this exists for: an unknown utility class is indistinguishable\n * from a working one. Nothing errors, nothing warns, the element just doesn't\n * get the style. Two shapes of that were found in a real consumer site:\n *\n * • `bg-navy-d` — a leftover from the named-step scale (`d`/`xd`/`xxd`)\n * deleted in favour of numeric steps. The hue is real, the step is not.\n * It appeared ~10× and looked fine only because the `.card` it sat on\n * supplied its own background.\n * • `md-flex-row` — the css/bricks spelling of a responsive variant, used in\n * a `tailwind`-format project where that class is never emitted (Tailwind\n * regenerates those on demand as `@md:`). Silently inert.\n *\n * DESIGN: this deliberately only inspects classes ANCHORED TO THE CONSUMER'S\n * OWN CONFIG — a hue name, a role name, a type role, a shadow, a pattern. It\n * never tries to enumerate \"all valid classes\", because in the tailwind format\n * that would mean knowing Tailwind's entire built-in vocabulary, and every\n * unknown would be a false positive. Anchoring means a finding is always\n * actionable: you named something from your design system, and it doesn't\n * resolve.\n */\nimport { NUMERIC_STEPS, type DesignSystem, type Format } from '@getvitops/generator';\n\n/**\n * `error` — you named something from your design system and it resolves to\n * nothing. Always actionable, and fails the command.\n *\n * `suggestion` — the code works, but the framework already has a primitive for\n * it. Advisory by design: these are judgement calls, and a new rule that failed\n * CI on first run would be a worse defect than the drift it reports. `--strict`\n * promotes them for consumers who want the ratchet.\n */\nexport type LintSeverity = 'error' | 'suggestion';\n\nexport interface LintFinding {\n file: string;\n line: number;\n /** The class token, or for a CSS rule the declaration that triggered it. */\n cls: string;\n reason: string;\n suggestion?: string;\n severity: LintSeverity;\n}\n\nconst UTIL_FAMILIES = ['bg', 'text', 'icon', 'border', 'outline', 'fill', 'stroke'];\nconst BREAKPOINTS = ['sm', 'md', 'lg', 'xl'];\n\n/**\n * The modifiers actually emitted for one family + role, read back out of the\n * generator's own class list.\n *\n * This used to be a hand-maintained array, which is the wrong shape for a\n * suggestion: the two role kinds emit different modifiers (a chromatic role has\n * `solid` and no bare form; a surface role the reverse), so a single list was\n * wrong for one of them no matter what it said.\n */\nconst emittedModifiers = (roleClasses: Set<string>, fam: string, role: string): string[] => {\n const prefix = `${fam}-${role}`;\n return [...roleClasses]\n .filter((c) => c === prefix || c.startsWith(`${prefix}-`))\n .map((c) => c.slice(prefix.length + 1))\n .filter(Boolean)\n .sort();\n};\n\n/** Everything the config makes namable, so we only judge classes we can judge. */\ninterface Vocabulary {\n roles: string[];\n hues: string[];\n steps: string[];\n typeRoles: string[];\n shadows: string[];\n patterns: string[];\n /** Every role utility the generator actually emits, e.g. `bg-surface-x-muted`. */\n roleClasses: Set<string>;\n}\n\nexport function vocabulary(ds: DesignSystem, roleClasses: Iterable<string>): Vocabulary {\n return {\n roles: Object.keys(ds.colors?.roles ?? {}),\n hues: Object.keys(ds.colors?.palette ?? {}),\n steps: [...NUMERIC_STEPS],\n typeRoles: Object.keys(ds.typography?.roles ?? {}),\n shadows: Object.keys(ds.shadows ?? {}),\n patterns: Object.keys(ds.patterns?.items ?? {}),\n roleClasses: new Set(roleClasses),\n };\n}\n\n/**\n * Strip variant prefixes (`@md:`, `hover:`, `dark:`) from a candidate.\n *\n * Format-aware, because the container-query spelling only exists in tailwind.\n * Stripping `@md:` unconditionally made the check asymmetric: `md-split-1-2` in a\n * tailwind project was caught, but `@md:split-1-2` in a css/bricks project became\n * a bare `split-1-2` that matched nothing and returned null — the same silent\n * no-op, in the other direction, unreported.\n */\nconst stripVariants = (cls: string, format: Format): string => {\n let out = cls;\n while (/^@?[a-zA-Z0-9_-]+:/.test(out)) {\n if (format !== 'tailwind' && out.startsWith('@')) break;\n out = out.slice(out.indexOf(':') + 1);\n }\n return out;\n};\n\nconst nearest = (want: string, pool: string[]): string | undefined =>\n pool.find((p) => p.startsWith(want) || want.startsWith(p));\n\n/**\n * Judge one class token. Returns null when the class is none of our business —\n * which is the common case and the whole reason this is low-noise.\n */\nexport function judge(\n raw: string,\n v: Vocabulary,\n format: Format,\n): Omit<LintFinding, 'file' | 'line'> | null {\n const cls = stripVariants(raw, format);\n\n // ── the `@<bp>:` container-query spelling, in a format that has none ───────\n // Tailwind's engine expands these; css/bricks ship pre-expanded `<bp>-` classes\n // instead, so this spelling resolves to nothing there.\n const cq = /^@(sm|md|lg|xl):(.+)$/.exec(cls);\n if (cq && format !== 'tailwind')\n return {\n cls: raw,\n severity: 'error' as const,\n reason: `\\`@${cq[1]}:\\` container-query variants are a tailwind-format spelling; the ${format} format emits pre-expanded classes`,\n suggestion: `${cq[1]}-${cq[2]}`,\n };\n\n // ── the `<bp>-` responsive spelling ────────────────────────────────────────\n const bp = /^(sm|md|lg|xl)-(.+)$/.exec(cls);\n if (bp && format === 'tailwind')\n return {\n cls: raw,\n severity: 'error' as const,\n reason: `\\`${bp[1]}-\\` responsive classes are not emitted in the tailwind format`,\n suggestion: `@${bp[1]}:${bp[2]} (framework breakpoints) or ${bp[1]}:${bp[2]} (Tailwind's)`,\n };\n // In css/bricks the bare-prefix form is real; fall through and judge the base\n // against the rest of the vocabulary.\n const base = bp && format !== 'tailwind' ? (bp[2] as string) : cls;\n\n // ── <util>-<hue>-<step> ────────────────────────────────────────────────────\n const util = new RegExp(`^(${UTIL_FAMILIES.join('|')})-(.+)$`).exec(base);\n if (util) {\n const [, fam, rest] = util as unknown as [string, string, string];\n // Anything the generator actually emits is valid, full stop. Checking this\n // first also settles the ambiguity below for every well-formed class.\n if (v.roleClasses.has(base)) return null;\n\n // Role and hue names can share a prefix — `defaultConfig()` has the hue\n // `brand` and the role `brand-primary`, so matching hues first would read\n // `bg-brand-primary-x-muted` as hue `brand` + step `primary-x-muted` and\n // report a bogus bad step. Take the LONGEST match across both vocabularies.\n const prefix = (names: string[]) =>\n names\n .filter((n) => rest === n || rest.startsWith(`${n}-`))\n .sort((a, b) => b.length - a.length)[0];\n const hue = prefix(v.hues);\n const role = prefix(v.roles);\n const useRole = role && (!hue || role.length > hue.length);\n\n if (useRole) {\n const mod = rest.slice((role as string).length + 1);\n const valid = emittedModifiers(v.roleClasses, fam as string, role as string);\n return {\n cls: raw,\n severity: 'error' as const,\n reason: `\\`${fam}-${role}${mod ? `-${mod}` : ''}\\` is not emitted for the \\`${role}\\` role`,\n suggestion: valid.length\n ? `valid modifiers: ${valid.join(', ')}`\n : `the \\`${role}\\` role emits no \\`${fam}-*\\` utilities`,\n };\n }\n if (hue) {\n const step = rest.slice(hue.length + 1);\n if (step === '')\n return {\n cls: raw,\n severity: 'error' as const,\n reason: `\\`${fam}-${hue}\\` names a palette hue with no step`,\n suggestion: `${fam}-${hue}-500, or a role such as ${fam}-${v.roles[0] ?? 'neutral'}`,\n };\n if (!v.steps.includes(step))\n return {\n cls: raw,\n severity: 'error' as const,\n reason: `\\`${step}\\` is not a step on the \\`${hue}\\` scale (steps are 50…950)`,\n suggestion: `${fam}-${hue}-500, or a role such as ${fam}-${v.roles[0] ?? 'neutral'} which also flips in dark mode`,\n };\n return null; // valid raw step\n }\n return null; // not anchored to this config — not ours to judge\n }\n\n // ── font-<type-role> ───────────────────────────────────────────────────────\n const font = /^font-(.+)$/.exec(base);\n if (font && v.typeRoles.length && !v.typeRoles.includes(font[1] as string)) {\n const near = nearest(font[1] as string, v.typeRoles);\n // Only complain when it looks like a type role attempt, not e.g. font-bold.\n if (near)\n return {\n cls: raw,\n severity: 'error' as const,\n reason: `\\`${font[1]}\\` is not a typography role`,\n suggestion: `font-${near}`,\n };\n }\n\n // ── drop-shadow-<name> ─────────────────────────────────────────────────────\n const ds = /^drop-shadow-(.+)$/.exec(base);\n if (ds && v.shadows.length && !v.shadows.includes(ds[1] as string))\n return {\n cls: raw,\n severity: 'error' as const,\n reason: `\\`${ds[1]}\\` is not a defined shadow`,\n suggestion: `drop-shadow-${v.shadows[0]}`,\n };\n\n return null;\n}\n\nconst CLASS_ATTR = /(?:class|className|:class)\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|\\{`([^`]*)`\\})/g;\n\n/** Extract class tokens from a source file, with line numbers. */\nexport function extractClasses(src: string): { cls: string; line: number }[] {\n const out: { cls: string; line: number }[] = [];\n for (const m of src.matchAll(CLASS_ATTR)) {\n const value = m[1] ?? m[2] ?? m[3] ?? '';\n const line = src.slice(0, m.index).split('\\n').length;\n for (const tok of value.split(/\\s+/))\n // Skip template holes and dynamic fragments — a partial token would be\n // judged as a typo and this must not cry wolf.\n if (tok && !tok.includes('${') && !tok.includes('{') && /^[@\\w:[\\]().%/-]+$/.test(tok))\n out.push({ cls: tok, line });\n }\n return out;\n}\n\nexport function lintSource(\n files: { path: string; text: string }[],\n v: Vocabulary,\n format: Format,\n): LintFinding[] {\n const findings: LintFinding[] = [];\n const seen = new Set<string>();\n for (const f of files)\n for (const { cls, line } of extractClasses(f.text)) {\n const verdict = judge(cls, v, format);\n if (!verdict) continue;\n const key = `${f.path}:${line}:${cls}`;\n if (seen.has(key)) continue;\n seen.add(key);\n findings.push({ file: f.path, line, ...verdict });\n }\n return findings;\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|design[,…]> --out <dir>\n * vitops init [--out design-system.json] [--force]\n * vitops validate <design-system.json|site.json>\n * vitops favicon --input <svg|png> --out <dir> [--low-res <svg|png>] [--background <hex>]\n * vitops agents [--input <json>] [--out AGENTS.md] [--docs-dir <dir>]\n * vitops docs [topic] [--input <json>] [--all]\n * vitops lint [--input <json>] [--format <fmt>] [--src <dir>]\n * vitops legal [--input <site.json>] [--doc <name>] [--format <md|html|portable-text>] [--out <dir>]\n * vitops indexing [--input <site.json>] [--dry] [--all] [--check]\n * vitops media [--raw <dir>] [--out <dir>] [--force] [--dry]\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, relative } from 'node:path';\nimport { createRequire } from 'node:module';\nimport { pathToFileURL } from 'node:url';\nimport {\n buildIconSprite,\n generate,\n validate,\n defaultConfig,\n generateDocs,\n generateLegal,\n enabledDocs,\n isConfig,\n resolveInput,\n resolveConfig,\n resolveTheme,\n roleColorUtilities,\n functionalRole,\n expandPalette,\n roleHue,\n roleKind,\n SCHEMA_URL,\n type Format,\n type StylesheetFormat,\n type DesignSystem,\n type LegalDoc,\n type LegalOutput,\n type ResolvedInput,\n type Config,\n} from '@getvitops/generator';\nimport {\n collectIconRefs,\n generateFavicons,\n generateIconInclude,\n resolveIcon,\n scanFiles,\n} from '@getvitops/utils';\n// Its own subpath: `indexing` is the only network-touching module in utils, and the\n// other commands should not pull it in.\nimport {\n SNAPSHOT_PATH,\n collectEntries,\n formatPlan,\n getAccessToken,\n inspectUrl,\n keyFileContents,\n newKey,\n parseServiceAccount,\n plan,\n readSnapshot,\n resolveKeyLocation,\n resolveSitemapUrl,\n submitBatch,\n submitSitemap,\n toSnapshot,\n verifyKeyFile,\n writeSnapshot,\n type IndexingConfig,\n type ServiceAccount,\n} from '@getvitops/utils/indexing';\n// Its own subpath for the same reason: `media` shells out to ffmpeg, and no other\n// command should carry it. `formatPlan` is aliased — indexing exports one too.\nimport {\n MEDIA_MANIFEST_PATH,\n formatPlan as formatMediaPlan,\n processMedia,\n type MediaConfig,\n type OutputKind,\n} from '@getvitops/utils/media';\nimport { findSkillTarget, linkSkill, SKILL_NAME, TOPICS } from './agents.ts';\nimport { lintCss } from './lint-css.ts';\nimport { lintSource, vocabulary } from './lint.ts';\n\nconst FORMATS = new Set<Format>(['bricks', 'css', 'tailwind', 'design']);\n// `lint` judges class names against what a build emits, and the `design` format\n// emits no CSS at all — so it is a valid target for `generate` and a category\n// error for `lint`.\nconst LINT_FORMATS = new Set<StylesheetFormat>(['bricks', 'css', 'tailwind']);\n\n// `legal` reads a *site* config, not a design-system.json, and has its own\n// output set — it renders documents, not stylesheets.\nconst LEGAL_DOCS = new Set<LegalDoc>(['privacy', 'terms', 'cookies']);\nconst LEGAL_OUTPUTS = new Set<LegalOutput>(['md', 'html', 'portable-text']);\n\nconst HELP = `vitops — generate design-system outputs from a design-system.json\n\nAnywhere a command takes --input, that file may be a design-system.json OR the\nlarger site config that embeds one (company.json / site.json). The two are told\napart by shape, and a site config also supplies the site-level facts generation\nreads — its default colour scheme, its legal documents, its icon sprite.\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 it says it is\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 vitops lint [options] Report framework classes in your source that resolve to nothing\n vitops legal [options] Render legal documents from a site config\n vitops icons [options] Report which icons your source uses, and build the sprite\n vitops indexing [options] Tell search engines about a deploy (sitemap + IndexNow)\n vitops media [options] Encode raw video into web-ready WebM + MP4 + poster\n\nGenerate options:\n -i, --input <path> design-system.json or site config (default: ./design-system.json)\n -f, --format <list> bricks | css | tailwind | design (comma-separated; default: bricks)\n design emits DESIGN.md only (the agent-facing brief) — pair it\n with --out . to write it beside AGENTS.md, or compose:\n --format css,design\n -o, --out <dir> Output directory (default: ./dist)\n --theme <name> Which designSystem.themes entry to build, when --input is\n a site config (default: its defaultTheme, else \"default\")\n --site <path> Site config, when it is a different file from --input.\n Emits legal/*.html into the output directory (see:\n vitops legal). Omitted with a plain design-system.json:\n no legal files.\n --site-env <env> Environment whose A/B variant applies (default: production)\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 --background <hex> Background under the maskable icons, which must be\n opaque (default: #ffffff)\n\nAgents options:\n -i, --input <path> design-system.json or site config (default: ./design-system.json;\n validated if present)\n --theme <name> Theme to read, when --input is a site config\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> design-system.json or site config (default: ./design-system.json)\n --theme <name> Theme to render docs from, when --input is a site config\n --all Print every topic, concatenated\n\nIcons options:\n --site <path> Site config carrying the \"icons\" block (default: ./site.json)\n --src <dir> Source to scan for icon usage (default: ./src)\n --sprite Also build the SVG sprite\n -o, --out <dir> Where to write icons.svg with --sprite (default: ./dist)\n --json Machine-readable report on stdout\n\nLint options:\n -i, --input <path> design-system.json or site config (default: ./design-system.json)\n --theme <name> Theme to judge classes against, when --input is a site config\n -f, --format <fmt> Format you build (bricks | css | tailwind; default: bricks).\n Responsive md-* classes are real in css/bricks, inert in tailwind.\n -s, --src <dir> Directory to scan (default: ./src)\n --strict Also fail on suggestions (reuse hints), not just on\n classes that resolve to nothing\n\nLegal options:\n -i, --input <path> Site config: .json, or a .js/.ts module with a default\n export (default: ./site.json)\n -d, --doc <name> privacy | terms | cookies (repeatable; default: those\n enabled in the config)\n -f, --format <fmt> md | html | portable-text (default: md)\n html suits WordPress/Bricks and plain sites;\n portable-text suits EmDash\n -o, --out <dir> Write files here (default: print to stdout)\n --site-env <env> Environment whose A/B variant applies (default: production)\n\n Generated from your config — a starting point, not legal advice. Review before\n publishing, and make sure the config describes what your site actually does.\n\nIndexing options:\n -i, --input <path> Site config carrying seo.indexing (default: ./site.json)\n --site-env <env> Environment to notify for (default: production). An\n environment whose robots policy says noindex is refused.\n --sitemap <src> Sitemap URL or local path (default: from the config)\n --urls <list> Comma-separated URLs to submit, skipping the diff\n --all Submit every URL in the sitemap, not just what changed\n --dry Print the plan and exit. Makes no requests.\n --check Read-only: ask Google whether seo.indexing.priorityUrls\n are indexed. Exits non-zero if one is not.\n --new-key Print a fresh IndexNow key and exit\n --write-key <dir> Write the IndexNow key file into <dir> (for stacks with\n no Astro integration to do it — Bricks, WordPress)\n --snapshot <path> Changed-URL state file (default: .vitops/sitemap-snapshot.json).\n Persist it between runs (a CI cache) or every run submits\n everything.\n\n What this can and cannot do: Google exposes no \"request indexing\" API, and its\n sitemap ping endpoint was removed in 2023 — so it resubmits your sitemap\n through the Search Console API and verifies the result with --check. IndexNow\n reaches Bing, Yandex, Naver, Seznam and Yep; Google does not participate.\n Search Console needs a service account in VITOPS_GSC_SERVICE_ACCOUNT (inline\n JSON) or GOOGLE_APPLICATION_CREDENTIALS (a path), added as an owner of the\n property.\n\nMedia options:\n --raw <dir> Directory of unprocessed video, walked recursively\n (default: ./raw)\n -o, --out <dir> Where the encoded outputs go (default: ./src/assets/processed).\n Subdirectories under --raw are preserved.\n --max-width <px> Cap the output width, keeping aspect ratio (default: 1920;\n 0 disables scaling)\n --crf <n> Quality on VP9's scale, 0-63, lower is better (default: 32).\n The MP4 fallback uses the equivalent on H.264's scale.\n --max-bitrate <r> Optional ceiling, e.g. 2M or 800k (default: none, which is\n constant quality rather than constrained)\n --audio Keep the audio track (default: dropped — the common case is\n a muted autoplay loop)\n --poster-time <s> Timestamp the poster frame is taken from (default: 0, which\n is often black on a clip that fades in)\n --outputs <list> Comma-separated: webm | mp4 | poster (default: all three)\n --manifest <path> Cache file (default: .vitops/media-manifest.json)\n --force Re-encode everything, ignoring the cache\n --dry Print the plan and exit. Encodes nothing.\n\n Needs ffmpeg on PATH — it is an external tool, not an npm dependency, and this\n command fails rather than quietly skipping. Commit the outputs and the manifest:\n ffmpeg output is not reproducible across versions, so re-encoding in CI churns\n the diff on every toolchain bump. Use --force when you mean to re-encode.\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 site: { type: 'string' },\n theme: { type: 'string' },\n 'site-env': { type: 'string' },\n },\n allowPositionals: false,\n });\n const input = resolve(values.input as string);\n if (!existsSync(input)) fail(`config not found: ${input}`);\n const site = values.site ? resolve(values.site as string) : undefined;\n if (site && !existsSync(site)) fail(`site config not found: ${site}`);\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 | design)`);\n\n for (const format of formats as Format[]) {\n try {\n const res = await generate({\n input,\n format,\n outDir: values.out as string,\n ...(site ? { site } : {}),\n ...(values.theme ? { theme: values.theme as string } : {}),\n ...(values['site-env'] ? { siteEnv: values['site-env'] as string } : {}),\n });\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\n/**\n * Validate a config against the schema its shape says it is.\n *\n * Routing on kind rather than asking the caller matters here: pointed at a site\n * config, the design-system schema used to report a single `unrecognized_keys`\n * for `designSystem` and nothing about the file's actual contents — a wrong\n * answer that reads like a right one. A site config is validated whole, which\n * also covers the cross-field integrity JSON Schema can't express.\n */\nfunction cmdValidate(argv: string[]) {\n const { values, positionals } = parseArgs({\n args: argv,\n options: { input: { type: 'string', short: 'i' }, 'site-env': { type: 'string' } },\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\n if (isConfig(raw)) {\n let site: Config;\n try {\n site = resolveConfig(raw, values['site-env'] as string | undefined);\n } catch (err) {\n // Already formatted as one issue per line, with field paths.\n console.error(`✖ ${path} is invalid as a site config:`);\n console.error((err as Error).message.replace(/^Invalid site config:\\n/, ''));\n process.exit(1);\n }\n // Each theme is validated in turn: `validateConfig` checks the `extends` chain\n // resolves, not that what it resolves to is a complete design system, so a\n // theme could pass there and still fail to build.\n const themes = (site.designSystem?.themes ?? {}) as Parameters<typeof resolveTheme>[0];\n let bad = false;\n for (const name of Object.keys(themes)) {\n const result = validate(resolveTheme(themes, name));\n for (const w of result.warnings) console.warn(` ! designSystem.themes.${name}: ${w}`);\n if (result.ok) continue;\n bad = true;\n console.error(`✖ ${path} — designSystem.themes.${name} is not a complete design system:`);\n for (const e of result.errors)\n console.error(` • ${e.path.join('.') || '(root)'}: ${e.message}`);\n }\n if (bad) process.exit(1);\n const n = Object.keys(themes).length;\n console.log(`✓ ${path} is a valid site config (${n} theme${n === 1 ? '' : 's'})`);\n return;\n }\n\n const result = validate(raw);\n for (const w of result.warnings) console.warn(` ! ${w}`);\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 // The maskable outputs must be opaque — the OS crops them to its own shape,\n // so transparency there becomes a black frame, not \"no background\".\n background: { 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 ...(values.background ? { backgroundColor: values.background as string } : {}),\n });\n console.log(`✓ favicons → ${values.out} (${written.length} files)`);\n } catch (err) {\n fail((err as Error).message);\n }\n}\n\nconst OUTPUT_KINDS = new Set<OutputKind>(['webm', 'mp4', 'poster']);\n\n/**\n * `vitops media` — encode a directory of raw video into web-ready outputs.\n *\n * Flags only, with no config file, following `favicon`: `site.favicon` exists in\n * the schema and `cmdFavicon` still doesn't read it. The same reasoning applies\n * more strongly here — `legal`, `icons` and `indexing` are anchored to a\n * `Config` because what they emit *describes the site*, and an encoder setting\n * describes a build step.\n */\nasync function cmdMedia(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n raw: { type: 'string', default: 'raw' },\n out: { type: 'string', short: 'o', default: 'src/assets/processed' },\n 'max-width': { type: 'string' },\n crf: { type: 'string' },\n 'max-bitrate': { type: 'string' },\n audio: { type: 'boolean', default: false },\n 'poster-time': { type: 'string' },\n outputs: { type: 'string' },\n manifest: { type: 'string', default: MEDIA_MANIFEST_PATH },\n force: { type: 'boolean', default: false },\n dry: { type: 'boolean', default: false },\n },\n allowPositionals: false,\n });\n\n // Parsed here rather than passed through as strings, so a typo is caught before\n // ffmpeg spends minutes encoding at a quality nobody asked for.\n const num = (flag: string, raw: string | undefined): number | undefined => {\n if (raw === undefined) return undefined;\n const n = Number(raw);\n if (!Number.isFinite(n) || n < 0) fail(`media: --${flag} must be a non-negative number`);\n return n;\n };\n\n let outputs: OutputKind[] | undefined;\n if (values.outputs) {\n outputs = (values.outputs as string).split(',').map((s) => s.trim()) as OutputKind[];\n for (const kind of outputs)\n if (!OUTPUT_KINDS.has(kind))\n fail(`media: unknown output \"${kind}\" (expected: webm | mp4 | poster)`);\n }\n\n const maxWidth = num('max-width', values['max-width'] as string | undefined);\n const crf = num('crf', values.crf as string | undefined);\n const posterTime = num('poster-time', values['poster-time'] as string | undefined);\n\n const config: MediaConfig = {\n ...(maxWidth !== undefined ? { maxWidth } : {}),\n ...(crf !== undefined ? { crf } : {}),\n ...(values['max-bitrate'] ? { maxBitrate: values['max-bitrate'] as string } : {}),\n ...(values.audio ? { audio: true } : {}),\n ...(posterTime !== undefined ? { posterTime } : {}),\n ...(outputs ? { outputs } : {}),\n };\n\n try {\n const result = await processMedia({\n raw: values.raw as string,\n out: values.out as string,\n config,\n manifest: values.manifest as string,\n force: values.force as boolean,\n dry: values.dry as boolean,\n // An encode is minutes of silence otherwise, which reads as a hang.\n onProgress: (message) => console.error(` … ${message}`),\n });\n\n if (values.dry) {\n console.log(formatMediaPlan(result.plan));\n return;\n }\n console.log(\n `✓ media → ${values.out} (${result.written.length} written, ${result.skipped} unchanged)`,\n );\n for (const note of result.plan.notes) console.error(` ! ${note}`);\n } catch (err) {\n fail((err as Error).message);\n }\n}\n\n/**\n * Read + parse + validate the design system at `path`, or exit with a message.\n *\n * `path` may be a `design-system.json` **or** the larger site config that embeds\n * one — every command that judges source against the design system (`docs`,\n * `lint`, `agents`) accepts either, so a consumer who keeps their tokens in\n * `company.json` doesn't have to maintain a second file for the tooling's sake.\n * `resolveInput` tells them apart by shape and resolves the theme.\n */\nfunction loadDesignSystem(path: string, theme?: 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 let resolved: ResolvedInput;\n try {\n resolved = resolveInput(raw, theme != null ? { theme } : {});\n } catch (err) {\n // resolveConfig formats one issue per line; a bad --theme is one line.\n fail(`${path}: ${(err as Error).message}`);\n }\n const result = validate(resolved.designSystem);\n if (!result.ok) {\n const where = resolved.theme != null ? ` (designSystem.themes.${resolved.theme})` : '';\n console.error(`✖ ${path}${where} is invalid:`);\n for (const e of result.errors)\n console.error(` • ${e.path.join('.') || '(root)'}: ${e.message}`);\n process.exit(1);\n }\n // Warnings go to stderr, not stdout: `vitops docs <topic>` is designed to be\n // piped, so anything here must not land in the piped document. They used to\n // be dropped entirely on this path, which meant `docs` and `agents` stayed\n // silent about collisions that `generate` and `validate` both reported.\n for (const w of result.warnings) console.warn(` ! ${w}`);\n return result.data;\n}\n\n/**\n * Read + resolve a site config, or exit with a message.\n *\n * Accepts JSON, or a JS/TS module with a default export — deliberately not YAML,\n * which would mean a parser dependency for one command. `resolveConfig` is\n * documented as taking an already-parsed object precisely so the loader is the\n * consumer's choice; anyone on YAML can convert it or export from a module.\n */\nasync function loadConfig(path: string, siteEnv: string): Promise<Config> {\n if (!existsSync(path)) fail(`site config not found: ${path}`);\n let raw: unknown;\n if (/\\.(json)$/.test(path)) {\n try {\n raw = JSON.parse(readFileSync(path, 'utf8'));\n } catch (err) {\n fail(`could not parse JSON: ${(err as Error).message}`);\n }\n } else {\n try {\n raw = (await import(pathToFileURL(path).href)).default;\n } catch (err) {\n fail(`could not import ${path}: ${(err as Error).message}`);\n }\n if (raw == null) fail(`${path} has no default export`);\n }\n try {\n return resolveConfig(raw, siteEnv);\n } catch (err) {\n // resolveConfig already formats one issue per line.\n fail((err as Error).message);\n }\n}\n\n/**\n * Render the site's legal documents.\n *\n * The universal delivery path: every consumer has this CLI regardless of stack,\n * so a WordPress theme, an Eleventy build or a hand-written HTML site all get\n * the same documents without any integration code. Prints to stdout like\n * `vitops docs`, or writes files when given `--out`.\n */\n/**\n * Report the icon vocabulary a project actually uses, and optionally build the\n * sprite from it.\n *\n * A sibling of `legal` rather than a widening of `lint`: `lint` judges classes\n * against a design-system.json, whereas icons are anchored to a Config.\n *\n * Exit codes carry the same distinction the Astro integration makes. A name the\n * config DECLARES but that doesn't resolve is a config error and fails the\n * command; a name only the SCAN found is reported and tolerated, because a bare\n * unmapped name is more often a local src/icons/*.svg than a mistake. Runtime-\n * computed names are listed with file and line so they can be declared, never\n * guessed at.\n */\nasync function cmdIcons(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n site: { type: 'string', default: 'site.json' },\n src: { type: 'string', default: 'src' },\n sprite: { type: 'boolean', default: false },\n out: { type: 'string', short: 'o', default: 'dist' },\n json: { type: 'boolean', default: false },\n 'site-env': { type: 'string', default: 'production' },\n },\n allowPositionals: false,\n });\n\n const sitePath = resolve(values.site as string);\n const icons = existsSync(sitePath)\n ? (((await loadConfig(sitePath, values['site-env'] as string)).site.icons ?? {}) as Record<\n string,\n unknown\n >)\n : {};\n const ui = (icons.ui as string) ?? 'fa7-solid';\n const brand = (icons.brand as string) ?? 'simple-icons';\n const weight = icons.weight as string | undefined;\n const weightOpt = weight ? { weight } : {};\n\n // Declared first — this throws on an unresolvable name, by design.\n let include: Record<string, string[]> = {};\n try {\n include = generateIconInclude({ ...(icons as object) } as Parameters<\n typeof generateIconInclude\n >[0]);\n } catch (e) {\n fail((e as Error).message);\n }\n const add = (prefix: string, name: string) => {\n const list = (include[prefix] ??= []);\n if (!list.includes(name)) list.push(name);\n };\n\n const srcDir = resolve(values.src as string);\n const scanned = existsSync(srcDir) ? collectIconRefs(scanFiles(srcDir)) : null;\n const unmapped: string[] = [];\n for (const name of scanned?.names ?? []) {\n const colon = name.indexOf(':');\n if (colon > 0) {\n add(name.slice(0, colon), name.slice(colon + 1));\n continue;\n }\n try {\n const q = resolveIcon(name, ui, weightOpt);\n add(q.slice(0, q.indexOf(':')), q.slice(q.indexOf(':') + 1));\n } catch {\n unmapped.push(name);\n }\n }\n\n const dynamic = (scanned?.dynamic ?? []).map((d) => ({\n file: relative(process.cwd(), d.file),\n line: d.line,\n expr: d.expr,\n }));\n const total = Object.values(include).flat().length;\n\n let sprite: { ids: string[]; missing: string[] } | null = null;\n if (values.sprite) {\n const aliases: Record<string, string> = {};\n for (const name of (icons.semantic as string[]) ?? []) {\n try {\n aliases[`icon-${name}`] = resolveIcon(name, ui, weightOpt);\n } catch {\n /* already reported by generateIconInclude above */\n }\n }\n const built = await buildIconSprite({ include, aliases });\n const outDir = resolve(values.out as string);\n mkdirSync(outDir, { recursive: true });\n writeFileSync(join(outDir, 'icons.svg'), built.svg);\n sprite = { ids: built.ids, missing: built.missing };\n }\n\n if (values.json) {\n process.stdout.write(\n `${JSON.stringify({ ui, brand, weight: weight ?? null, include, unmapped, dynamic, sprite }, null, 2)}\\n`,\n );\n } else {\n console.log(`icon sets: ui=${ui} brand=${brand}${weight ? ` weight=${weight}` : ''}`);\n for (const [prefix, names] of Object.entries(include))\n console.log(` ${prefix}: ${names.length} — ${names.join(', ')}`);\n console.log(`✓ ${total} icon(s) across ${Object.keys(include).length} set(s)`);\n if (sprite)\n console.log(\n `✓ sprite → ${resolve(values.out as string)}/icons.svg (${sprite.ids.length} symbols)`,\n );\n for (const d of dynamic)\n console.log(` ! ${d.file}:${d.line} ${d.expr} — computed at runtime, declare it in icons`);\n if (unmapped.length)\n console.log(\n ` ! not in the '${ui}' map: ${unmapped.join(', ')} (fine for a local svg or sprite id)`,\n );\n if (sprite?.missing.length)\n console.log(` ! absent from the sprite: ${sprite.missing.join(', ')}`);\n }\n\n // Dynamic holes and unmapped bare names are warnings, not failures — same\n // tolerance `lint` shows template holes, but visible rather than silent.\n if (sprite?.missing.length) process.exitCode = 1;\n}\n\nasync function cmdLegal(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n input: { type: 'string', short: 'i', default: 'site.json' },\n doc: { type: 'string', short: 'd', multiple: true },\n format: { type: 'string', short: 'f', default: 'md' },\n out: { type: 'string', short: 'o' },\n 'site-env': { type: 'string', default: 'production' },\n },\n allowPositionals: false,\n });\n\n const output = values.format as LegalOutput;\n if (!LEGAL_OUTPUTS.has(output))\n fail(`unknown format \"${output}\" (expected: ${[...LEGAL_OUTPUTS].join(' | ')})`);\n\n const requested = (values.doc ?? []) as string[];\n for (const d of requested)\n if (!LEGAL_DOCS.has(d as LegalDoc))\n fail(`unknown doc \"${d}\" (expected: ${[...LEGAL_DOCS].join(' | ')})`);\n\n const site = await loadConfig(resolve(values.input as string), values['site-env'] as string);\n const docs = requested.length ? (requested as LegalDoc[]) : enabledDocs(site);\n if (docs.length === 0)\n fail(\n 'no legal documents are enabled — set site.legal.privacyPolicy.enabled (or termsOfService / cookieConsent) in your config, or name one with --doc',\n );\n\n const files = generateLegal(site, { docs, output });\n\n if (!values.out) {\n process.stdout.write(Object.values(files).join('\\n'));\n return;\n }\n const outDir = resolve(values.out as string);\n mkdirSync(outDir, { recursive: true });\n for (const [name, content] of Object.entries(files)) writeFileSync(join(outDir, name), content);\n console.log(`✓ legal → ${outDir} (${Object.keys(files).length} files)`);\n console.log(\n ' These are generated from your config and are not legal advice — review them before publishing.',\n );\n}\n\n/**\n * Adapt a `Config` to the indexing module's own option shape.\n *\n * A flat field map, as intended: `@getvitops/utils` cannot import from the\n * generator (the generator already depends on it), so `IndexingConfig` mirrors the\n * `seo.indexing` block rather than being it. The one piece of judgment here is the\n * origin — see below.\n */\nfunction toIndexingConfig(cfg: Config, siteEnv: string): IndexingConfig {\n const site = cfg.site;\n const indexing = site.seo?.indexing ?? {};\n const env = site.environments?.[siteEnv];\n /*\n * The environment's own URL wins over `domains.canonical`.\n *\n * `domains.canonical` is the production origin — it is what absolute URLs and\n * SEO tags resolve against. Notifying a non-production environment while\n * deriving URLs from the canonical origin would submit *production* URLs under\n * the belief they were staging's, which the noindex gate below would then not\n * catch, because the gate reads the environment and the URLs would not.\n */\n const canonical = env?.url ?? site.domains?.canonical;\n return {\n ...(canonical ? { canonical } : {}),\n ...(indexing.sitemapUrl ? { sitemapUrl: indexing.sitemapUrl } : {}),\n ...(indexing.indexNow ? { indexNow: indexing.indexNow } : {}),\n ...(indexing.searchConsole ? { searchConsole: indexing.searchConsole } : {}),\n ...(indexing.priorityUrls ? { priorityUrls: indexing.priorityUrls } : {}),\n // Fall back to the site-wide policy so a site that states `noindex` once,\n // globally, is still protected.\n ...((env?.robots ?? site.seo?.robots) ? { robots: env?.robots ?? site.seo?.robots } : {}),\n };\n}\n\n/**\n * The Search Console credential, from either supported source.\n *\n * Never from the config file: it is the one genuine secret in this command, and a\n * `site.json` is committed. Returns `undefined` rather than failing, so a site\n * running IndexNow alone doesn't need a GCP project at all.\n */\nfunction loadServiceAccount(): ServiceAccount | undefined {\n const inline = process.env.VITOPS_GSC_SERVICE_ACCOUNT;\n const path = process.env.GOOGLE_APPLICATION_CREDENTIALS;\n const raw = inline ?? (path && existsSync(path) ? readFileSync(path, 'utf8') : undefined);\n if (!raw) return undefined;\n try {\n return parseServiceAccount(raw);\n } catch (err) {\n fail(\n `${inline ? 'VITOPS_GSC_SERVICE_ACCOUNT' : `GOOGLE_APPLICATION_CREDENTIALS (${path})`}: ${(err as Error).message}`,\n );\n }\n}\n\n/** Read a sitemap from a URL or a local path. */\nconst readSitemap = async (source: string): Promise<string> => {\n if (/^https?:\\/\\//i.test(source)) {\n const res = await fetch(source);\n if (!res.ok) fail(`could not fetch ${source}: ${res.status}`);\n return res.text();\n }\n if (!existsSync(source)) fail(`sitemap not found: ${source}`);\n return readFileSync(source, 'utf8');\n};\n\n/**\n * Tell search engines a deploy happened.\n *\n * Worth being precise about what this is, because the obvious expectation is\n * wrong: **Google has no API that requests indexing.** The Search Console button\n * is not exposed anywhere, URL Inspection is read-only, and the sitemap ping\n * endpoint was removed in 2023. So the Google half of this command resubmits the\n * sitemap and then *verifies* the outcome with `--check`; the immediate-push half\n * is IndexNow, which Google does not participate in.\n *\n * The Indexing API is deliberately absent — see `@getvitops/utils/indexing`'s\n * `gsc.ts`.\n */\nasync function cmdIndexing(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n input: { type: 'string', short: 'i', default: 'site.json' },\n 'site-env': { type: 'string', default: 'production' },\n sitemap: { type: 'string' },\n urls: { type: 'string' },\n all: { type: 'boolean', default: false },\n dry: { type: 'boolean', default: false },\n check: { type: 'boolean', default: false },\n 'new-key': { type: 'boolean', default: false },\n 'write-key': { type: 'string' },\n snapshot: { type: 'string', default: SNAPSHOT_PATH },\n },\n allowPositionals: false,\n });\n\n // Stands alone: generating a key is what you do *before* there is a config to\n // put it in.\n if (values['new-key']) {\n const key = newKey();\n console.log(key);\n console.log(\n `\\n Add to your site config:\\n \"seo\": { \"indexing\": { \"indexNow\": { \"key\": \"${key}\" } } }`,\n );\n console.log(` Then serve it at /${key}.txt — \\`vitops indexing --write-key public\\`.`);\n return;\n }\n\n const site = await loadConfig(resolve(values.input as string), values['site-env'] as string);\n const config = toIndexingConfig(site, values['site-env'] as string);\n\n if (values['write-key'] !== undefined) {\n const key = config.indexNow?.key;\n if (!key) fail('no site.seo.indexing.indexNow.key in the config — generate one with --new-key');\n const dir = resolve(values['write-key']);\n mkdirSync(dir, { recursive: true });\n const file = join(dir, `${key}.txt`);\n writeFileSync(file, keyFileContents(key));\n console.log(`✓ IndexNow key file → ${file}`);\n console.log(` It must be served at ${resolveKeyLocation(config) ?? `/${key}.txt`}`);\n return;\n }\n\n const sitemapUrl = (values.sitemap as string | undefined) ?? resolveSitemapUrl(config);\n if (!sitemapUrl)\n fail(\n 'no sitemap to read — set seo.indexing.sitemapUrl or domains.canonical, or pass --sitemap',\n );\n\n const explicitUrls = values.urls\n ? (values.urls as string)\n .split(',')\n .map((u) => u.trim())\n .filter(Boolean)\n : undefined;\n\n // The sitemap is only needed when the URL set comes from it.\n const current =\n explicitUrls?.length && !values.check\n ? []\n : (await collectEntries(sitemapUrl, readSitemap)).entries;\n\n const snapshotPath = resolve(values.snapshot as string);\n const p = plan({\n config: { ...config, sitemapUrl },\n current,\n previous: readSnapshot(snapshotPath),\n explicitUrls,\n all: values.all as boolean,\n });\n\n console.log(formatPlan(p));\n\n if (p.blocked) {\n // Not a failure. Running this against a `noindex` environment is a coherent\n // thing for a deploy script to do — the config said not to index it, and the\n // command honoured that. Failing the build would punish the correct setup.\n return;\n }\n if (values.dry) {\n console.log('\\n(--dry: nothing was submitted)');\n return;\n }\n\n const account = loadServiceAccount();\n let failed = false;\n\n // ── --check: read-only, and nothing else runs ───────────────────────────────\n if (values.check) {\n if (!p.searchConsole.siteUrl)\n fail('--check needs seo.indexing.searchConsole.siteUrl (the Search Console property)');\n if (!account)\n fail(\n '--check needs a Search Console service account in VITOPS_GSC_SERVICE_ACCOUNT or GOOGLE_APPLICATION_CREDENTIALS',\n );\n if (p.check.length === 0)\n fail('--check needs seo.indexing.priorityUrls — the pages whose indexing matters');\n\n const token = await getAccessToken(account);\n console.log(`\\nInspecting ${p.check.length} priority URL(s):`);\n for (const url of p.check) {\n const r = await inspectUrl(token, p.searchConsole.siteUrl, url);\n if (r.error) {\n console.log(` ? ${url} — ${r.error}`);\n failed = true;\n } else {\n console.log(\n ` ${r.indexed ? '✓' : '✗'} ${url} — ${r.coverageState ?? r.verdict ?? 'unknown'}`,\n );\n if (!r.indexed) failed = true;\n }\n }\n if (failed) {\n console.error('\\n✖ one or more priority URLs are not indexed');\n process.exit(1);\n }\n console.log('\\n✓ every priority URL is indexed');\n return;\n }\n\n // ── IndexNow ────────────────────────────────────────────────────────────────\n if (p.indexNow.enabled) {\n const { key, keyLocation } = p.indexNow;\n const check = await verifyKeyFile(keyLocation!, key!);\n if (!check.ok) {\n // Hard stop rather than \"submit and hope\": IndexNow answers 202 and then\n // discards the batch when the key doesn't verify, so submitting anyway\n // would print a success it did not earn.\n console.error(`✖ IndexNow key file check failed — ${check.reason}`);\n console.error(` Write it with: vitops indexing --write-key <public dir>`);\n failed = true;\n } else {\n let sent = 0;\n for (const batch of p.indexNow.batches) {\n const r = await submitBatch(p.indexNow, batch);\n if (!r.ok) {\n console.error(`✖ IndexNow: ${r.message ?? r.status}`);\n failed = true;\n break;\n }\n sent += r.urls;\n }\n if (!failed) console.log(`✓ IndexNow: ${sent} URL(s) submitted`);\n }\n }\n\n // ── Search Console ──────────────────────────────────────────────────────────\n if (p.searchConsole.enabled) {\n if (!account) {\n console.log(\n '· Search Console: skipped — no VITOPS_GSC_SERVICE_ACCOUNT / GOOGLE_APPLICATION_CREDENTIALS',\n );\n } else {\n const token = await getAccessToken(account);\n const r = await submitSitemap(token, p.searchConsole.siteUrl!, sitemapUrl);\n if (r.ok) console.log(`✓ Search Console: sitemap resubmitted`);\n else {\n console.error(`✖ Search Console: ${r.message}`);\n failed = true;\n }\n }\n }\n\n if (failed) process.exit(1);\n\n /*\n * The snapshot is written last, and only on success.\n *\n * Writing it eagerly would record URLs as notified that never were — and since\n * the next run diffs against it, a single transient 503 would drop those pages\n * from every future run, silently and permanently.\n */\n if (current.length > 0) {\n writeSnapshot(snapshotPath, toSnapshot(sitemapUrl, current, new Date().toISOString()));\n console.log(` state → ${relative(process.cwd(), snapshotPath)}`);\n }\n if (p.check.length > 0)\n console.log(\n `\\n Indexing is not instant. Run \\`vitops indexing --check\\` in a day or two to see what Google actually did.`,\n );\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 theme: { type: 'string' },\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 = loadDesignSystem(resolve(values.input as string), values.theme as string | undefined);\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 cmdLint(argv: string[]) {\n const { values } = parseArgs({\n args: argv,\n options: {\n input: { type: 'string', short: 'i', default: 'design-system.json' },\n theme: { type: 'string' },\n format: { type: 'string', short: 'f', default: 'bricks' },\n src: { type: 'string', short: 's', default: 'src' },\n // Suggestions are advisory: a reuse rule that failed CI the day it shipped\n // would be a worse defect than the drift it reports.\n strict: { type: 'boolean', default: false },\n },\n allowPositionals: false,\n });\n const format = values.format as StylesheetFormat;\n if (!LINT_FORMATS.has(format))\n fail(`unknown format \"${format}\" (expected: bricks | css | tailwind)`);\n const ds = loadDesignSystem(resolve(values.input as string), values.theme as string | undefined);\n const srcDir = resolve(values.src as string);\n if (!existsSync(srcDir)) fail(`source directory not found: ${srcDir}`);\n\n // Ask the generator what it actually emits rather than re-deriving the rules\n // here — a linter that models the vocabulary separately just drifts into\n // reporting classes that do exist.\n const palette = expandPalette(ds.colors.palette);\n const roleClasses = roleColorUtilities(\n Object.entries(ds.colors.roles).map(([role, spec]) =>\n functionalRole(role, roleHue(spec), palette[roleHue(spec)]!, roleKind(spec)),\n ),\n ds.colors.utilities ?? ['bg', 'text', 'icon', 'border'],\n ).map((u) => u.cls);\n\n const files = scanFiles(srcDir);\n // `.css` is not in the default extension set — the class linter reads markup,\n // not stylesheets — so the reuse rules get their own pass. Component files are\n // scanned twice on purpose: once for their class attributes, once for any\n // `<style>` block, which is where hand-rolled layout tends to accumulate.\n const cssFiles = [...files, ...scanFiles(srcDir, { exts: ['.css'] })];\n const findings = [\n ...lintSource(files, vocabulary(ds, roleClasses), format),\n ...lintCss(cssFiles, format),\n ];\n\n if (!findings.length) {\n console.log(\n `✓ no unresolvable framework classes in ${values.src} ` +\n `(${files.length} file${files.length === 1 ? '' : 's'} scanned)`,\n );\n return;\n }\n\n const errors = findings.filter((f) => f.severity === 'error');\n const suggestions = findings.filter((f) => f.severity === 'suggestion');\n // Errors first: a class that resolves to nothing is a defect, a reuse\n // suggestion is a judgement call, and mixing them buries the former.\n for (const f of [...errors, ...suggestions]) {\n console.error(`${f.file}:${f.line} ${f.severity === 'error' ? f.cls : `(${f.cls})`}`);\n console.error(` ${f.reason}`);\n if (f.suggestion) console.error(` try: ${f.suggestion}`);\n }\n\n const count = (n: number, one: string, many: string) => `${n} ${n === 1 ? one : many}`;\n const parts: string[] = [];\n if (errors.length) parts.push(count(errors.length, 'unresolvable class', 'unresolvable classes'));\n if (suggestions.length) parts.push(count(suggestions.length, 'suggestion', 'suggestions'));\n const failing = errors.length > 0 || (values.strict === true && suggestions.length > 0);\n console.error(\n `\\n${failing ? '✖' : '!'} ${parts.join(', ')} in ` +\n `${files.length} file${files.length === 1 ? '' : 's'}` +\n (suggestions.length && !values.strict ? ' (suggestions do not fail; use --strict)' : ''),\n );\n if (failing) process.exit(1);\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 theme: { type: 'string' },\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)))\n ds = loadDesignSystem(resolve(inputRel), values.theme as string | undefined);\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 generate --format design --out .` — `DESIGN.md`, the agent-facing brief',\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 case 'lint':\n return cmdLint(rest);\n case 'legal':\n return cmdLegal(rest);\n case 'icons':\n return cmdIcons(rest);\n case 'indexing':\n return cmdIndexing(rest);\n case 'media':\n return cmdMedia(rest);\n default:\n fail(\n `unknown command \"${command}\" (expected: generate | init | validate | favicon | agents | docs | lint | legal | icons | indexing | media). 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,QAAQ;EACN,MAAM;EACN,SACE;CACJ;CACA,SAAS;EACP,MAAM;EACN,SAAS;CACX;CACA,OAAO;EACL,MAAM;EACN,SAAS;CACX;CACA,QAAQ;EACN,MAAM;EACN,SAAS;CACX;CACA,OAAO;EACL,MAAM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AK,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,KAAK,QACH,OAAO,QAAQ,IAAI;EACrB,KAAK,SACH,OAAO,SAAS,IAAI;EACtB,KAAK,SACH,OAAO,SAAS,IAAI;EACtB,KAAK,YACH,OAAO,YAAY,IAAI;EACzB,KAAK,SACH,OAAO,SAAS,IAAI;EACtB,SACE,KACE,oBAAoB,QAAQ,iIAC9B;CACJ;AACF;AAEA,KAAK,CAAC,CAAC,OAAO,QAAQ,KAAM,IAAc,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getvitops/cli",
3
- "version": "2.0.0",
3
+ "version": "3.0.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": {
@@ -22,8 +22,8 @@
22
22
  "access": "public"
23
23
  },
24
24
  "dependencies": {
25
- "@getvitops/generator": "2.0.0",
26
- "@getvitops/utils": "2.0.0"
25
+ "@getvitops/generator": "3.0.0",
26
+ "@getvitops/utils": "3.0.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "vitest": "^4.1.9"
package/skill/SKILL.md CHANGED
@@ -29,6 +29,7 @@ never stale and always names the project's actual tokens. (If `vitops` isn't on
29
29
  | ----------------------- | ---------------------------------------------------------------------- |
30
30
  | `vitops docs classes` | which class to apply — the full class vocabulary as naming rules |
31
31
  | `vitops docs authoring` | what a `design-system.json` field means / what's valid |
32
+ | `vitops docs config` | the three-section config: `designSystem` / `organization` / `site` |
32
33
  | `vitops docs formats` | tailwind vs css vs bricks output — incl. which utilities Tailwind owns |
33
34
  | `vitops docs color` | how the colour system works (seeded OKLCH scales, roles, dark mode) |
34
35
  | `vitops docs scales` | how the fluid type/space scales work |
@@ -97,6 +98,22 @@ where no provider covers the family.
97
98
  `legal.privacyPolicy.processors`.
98
99
  Generated from config, not legal advice — always tell the user to have it reviewed
99
100
  before publishing.
101
+ - `vitops indexing` — tell search engines a deploy happened, from a **site config**'s
102
+ `seo.indexing` block. Run `--dry` first: it prints the full plan and makes no requests.
103
+ **Be accurate about what this does, because the obvious assumption is wrong.** Google
104
+ has no API that requests indexing — the Search Console button is not exposed anywhere,
105
+ URL Inspection is read-only, and the sitemap ping endpoint was removed in 2023. So:
106
+ it resubmits the sitemap through the Search Console API, pings **IndexNow**
107
+ (Bing, Yandex, Naver, Seznam, Yep — _not_ Google), and `--check` verifies afterwards
108
+ whether Google actually indexed `seo.indexing.priorityUrls`, exiting non-zero if not.
109
+ Never tell a user this makes Google re-index faster; it automates the sanctioned steps
110
+ and makes the result visible.
111
+ Two things decide whether it works at all: the sitemap needs real per-page `<lastmod>`
112
+ (wire `gitLastmod()` from `@getvitops/astro` into the `sitemap` option — without it
113
+ only added/removed pages are detectable, never an edit), and `.vitops/` must persist
114
+ between runs or every run submits everything. Google's **Indexing API is deliberately
115
+ not wired**: it is scoped to `JobPosting`/`BroadcastEvent`, and using it for ordinary
116
+ pages violates its terms — don't suggest it as a workaround.
100
117
  - `vitops agents` — (re-)link this skill into `.agents/skills/` + `.claude/skills/` and
101
118
  refresh the AGENTS.md pointer block. The links point into the installed package and
102
119
  survive version bumps; re-run only if they were deleted.