@refrakt-md/cli 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/bin.js +277 -9
  2. package/dist/bin.js.map +1 -1
  3. package/dist/commands/contracts.d.ts +6 -0
  4. package/dist/commands/contracts.d.ts.map +1 -0
  5. package/dist/commands/contracts.js +41 -0
  6. package/dist/commands/contracts.js.map +1 -0
  7. package/dist/commands/inspect.d.ts +33 -0
  8. package/dist/commands/inspect.d.ts.map +1 -0
  9. package/dist/commands/inspect.js +269 -0
  10. package/dist/commands/inspect.js.map +1 -0
  11. package/dist/commands/scaffold-css.d.ts +6 -0
  12. package/dist/commands/scaffold-css.d.ts.map +1 -0
  13. package/dist/commands/scaffold-css.js +113 -0
  14. package/dist/commands/scaffold-css.js.map +1 -0
  15. package/dist/commands/validate.d.ts +6 -0
  16. package/dist/commands/validate.d.ts.map +1 -0
  17. package/dist/commands/validate.js +70 -0
  18. package/dist/commands/validate.js.map +1 -0
  19. package/dist/commands/write.d.ts +7 -0
  20. package/dist/commands/write.d.ts.map +1 -1
  21. package/dist/commands/write.js +66 -10
  22. package/dist/commands/write.js.map +1 -1
  23. package/dist/config.d.ts +2 -1
  24. package/dist/config.d.ts.map +1 -1
  25. package/dist/config.js +30 -2
  26. package/dist/config.js.map +1 -1
  27. package/dist/lib/css-audit.d.ts +23 -0
  28. package/dist/lib/css-audit.d.ts.map +1 -0
  29. package/dist/lib/css-audit.js +99 -0
  30. package/dist/lib/css-audit.js.map +1 -0
  31. package/dist/lib/css-resolve.d.ts +20 -0
  32. package/dist/lib/css-resolve.d.ts.map +1 -0
  33. package/dist/lib/css-resolve.js +57 -0
  34. package/dist/lib/css-resolve.js.map +1 -0
  35. package/dist/lib/fixtures.d.ts +10 -0
  36. package/dist/lib/fixtures.d.ts.map +1 -0
  37. package/dist/lib/fixtures.js +356 -0
  38. package/dist/lib/fixtures.js.map +1 -0
  39. package/dist/lib/format.d.ts +35 -0
  40. package/dist/lib/format.d.ts.map +1 -0
  41. package/dist/lib/format.js +215 -0
  42. package/dist/lib/format.js.map +1 -0
  43. package/dist/lib/variants.d.ts +17 -0
  44. package/dist/lib/variants.d.ts.map +1 -0
  45. package/dist/lib/variants.js +32 -0
  46. package/dist/lib/variants.js.map +1 -0
  47. package/package.json +7 -3
@@ -0,0 +1,356 @@
1
+ /**
2
+ * Built-in Markdoc fixture strings for the inspect command.
3
+ *
4
+ * Each fixture exercises the rune's full structure with realistic content.
5
+ * The key is the primary rune tag name (as used in Markdoc).
6
+ */
7
+ export const fixtures = {
8
+ hint: `{% hint type="note" %}
9
+ The identity transform runs after the rune schema transform and before rendering. It applies BEM classes, injects structural elements, and resolves design tokens.
10
+ {% /hint %}`,
11
+ accordion: `{% accordion %}
12
+ ## Getting Started
13
+ Follow these steps to set up your development environment and build your first theme.
14
+
15
+ ## Configuration
16
+ Theme configuration is defined in a TypeScript file that exports a ThemeConfig object.
17
+
18
+ ## Deployment
19
+ Once your theme is ready, publish it to npm and register it in the theme marketplace.
20
+ {% /accordion %}`,
21
+ details: `{% details %}
22
+ ## Implementation Notes
23
+ This section contains additional technical details about how the transform pipeline processes rune content. The identity transform reads meta tags, applies BEM classes, and injects structural elements before the content reaches the renderer.
24
+ {% /details %}`,
25
+ api: `{% api method="GET" path="/api/users/:id" auth="Bearer" %}
26
+ Retrieve a single user by their unique identifier.
27
+
28
+ | Parameter | Type | Description |
29
+ |-----------|------|-------------|
30
+ | id | string | The user's unique ID |
31
+
32
+ \`\`\`json
33
+ {
34
+ "id": "usr_123",
35
+ "name": "Alice",
36
+ "email": "alice@example.com"
37
+ }
38
+ \`\`\`
39
+ {% /api %}`,
40
+ recipe: `{% recipe prepTime="PT15M" cookTime="PT30M" servings="4" difficulty="medium" %}
41
+ # Classic Margherita Pizza
42
+
43
+ - 500g bread flour
44
+ - 7g dried yeast
45
+ - 1 tsp salt
46
+ - 300ml warm water
47
+ - San Marzano tomatoes
48
+ - Fresh mozzarella
49
+ - Fresh basil leaves
50
+
51
+ 1. Mix flour, yeast, and salt in a large bowl
52
+ 2. Add warm water and knead for 10 minutes until smooth
53
+ 3. Let the dough rise for 1 hour at room temperature
54
+ 4. Shape into rounds and add toppings
55
+ 5. Bake at 250°C for 8-10 minutes
56
+
57
+ > For the best crust, preheat your oven with a pizza stone for at least 30 minutes before baking.
58
+ {% /recipe %}`,
59
+ symbol: `{% symbol kind="function" lang="typescript" since="1.2.0" %}
60
+ # createTransform
61
+
62
+ \`\`\`typescript
63
+ function createTransform(config: ThemeConfig): (tree: RendererNode) => RendererNode
64
+ \`\`\`
65
+
66
+ - config — The theme configuration object defining BEM mappings and structural rules
67
+ - Returns a pure transform function that enhances serialized tag trees
68
+
69
+ > Returns a function that walks the serialized tag tree and applies BEM classes, reads meta tags, injects structural elements, and recurses into children.
70
+ {% /symbol %}`,
71
+ event: `{% event date="2026-03-15" endDate="2026-03-17" location="Stockholm, Sweden" url="https://example.com/register" %}
72
+ # Nordic Developer Summit
73
+
74
+ A three-day conference bringing together developers, designers, and product engineers from across the Nordics.
75
+
76
+ - Keynote: The Future of Web Components
77
+ - Workshop: Building Design Systems at Scale
78
+ - Panel: Open Source in Enterprise
79
+ {% /event %}`,
80
+ howto: `{% howto estimatedTime="PT45M" difficulty="easy" %}
81
+ # Set Up a Refrakt Theme
82
+
83
+ - Node.js 20+
84
+ - A code editor
85
+ - Basic CSS knowledge
86
+
87
+ 1. Create a new directory for your theme
88
+ 2. Run \`npm init\` and add the theme-base dependency
89
+ 3. Create your \`theme.config.ts\` extending baseConfig
90
+ 4. Write CSS targeting the BEM selectors from \`refrakt inspect\`
91
+ 5. Test with \`refrakt inspect --serve\`
92
+ {% /howto %}`,
93
+ hero: `{% hero align="center" %}
94
+ # Build Beautiful Documentation
95
+ From Markdown to pixel-perfect pages in minutes.
96
+
97
+ - [Get Started](/docs)
98
+ - [View on GitHub](https://github.com)
99
+ {% /hero %}`,
100
+ feature: `{% feature %}
101
+ # Why Refrakt
102
+
103
+ Runes reinterpret standard Markdown — same syntax, richer meaning.
104
+
105
+ - **Fast** — Static generation, zero runtime JavaScript
106
+ - **Flexible** — 43+ runes, infinite combinations
107
+ - **Themeable** — Full control over every element
108
+ {% /feature %}`,
109
+ grid: `{% grid %}
110
+ First column content with enough text to demonstrate layout behavior.
111
+
112
+ ---
113
+
114
+ Second column content showing how grid cells are separated by horizontal rules.
115
+
116
+ ---
117
+
118
+ Third column content completing the three-column grid layout example.
119
+ {% /grid %}`,
120
+ figure: `{% figure size="large" align="center" %}
121
+ ![Mountain landscape](/images/mountain.jpg)
122
+
123
+ A panoramic view of the Norwegian fjords at sunset, captured from the summit of Trolltunga.
124
+ {% /figure %}`,
125
+ steps: `{% steps %}
126
+ # Install dependencies
127
+ Run \`npm install @refrakt-md/cli\` to add the CLI to your project.
128
+
129
+ # Create content
130
+ Write your first Markdown file using rune tags for rich components.
131
+
132
+ # Build and preview
133
+ Run \`npm run dev\` to start the development server and see your content rendered.
134
+ {% /steps %}`,
135
+ tabs: `{% tabs %}
136
+ # JavaScript
137
+ \`\`\`js
138
+ const greeting = "Hello, world!";
139
+ console.log(greeting);
140
+ \`\`\`
141
+
142
+ # TypeScript
143
+ \`\`\`ts
144
+ const greeting: string = "Hello, world!";
145
+ console.log(greeting);
146
+ \`\`\`
147
+
148
+ # Python
149
+ \`\`\`python
150
+ greeting = "Hello, world!"
151
+ print(greeting)
152
+ \`\`\`
153
+ {% /tabs %}`,
154
+ pricing: `{% pricing %}
155
+ # Choose Your Plan
156
+ Select the plan that best fits your needs.
157
+
158
+ {% tier name="Starter" price="Free" %}
159
+ - Up to 3 projects
160
+ - Community support
161
+ - Basic themes
162
+ {% /tier %}
163
+
164
+ {% tier name="Pro" price="$29/mo" featured="true" %}
165
+ - Unlimited projects
166
+ - Priority support
167
+ - All themes
168
+ - Custom domains
169
+ {% /tier %}
170
+
171
+ {% tier name="Enterprise" price="Custom" %}
172
+ - Everything in Pro
173
+ - SSO & SAML
174
+ - Dedicated support
175
+ - SLA guarantee
176
+ {% /tier %}
177
+ {% /pricing %}`,
178
+ changelog: `{% changelog %}
179
+ ## 1.2.0 — 2026-02-15
180
+ - **Added** Inspect command for theme developers
181
+ - **Added** Selector extraction from transformed trees
182
+ - **Fixed** BEM class ordering for nested runes
183
+
184
+ ## 1.1.0 — 2026-01-20
185
+ - **Added** Context-aware modifiers
186
+ - **Changed** Improved meta tag consumption logic
187
+ {% /changelog %}`,
188
+ testimonial: `{% testimonial %}
189
+ > Refrakt transformed how we write documentation. The rune system means our content authors write Markdown while our designers have full control over the output.
190
+
191
+ **Sarah Chen** — Head of Developer Experience at Acme Corp
192
+
193
+ ![](/avatars/sarah.jpg)
194
+ {% /testimonial %}`,
195
+ timeline: `{% timeline %}
196
+ ## 2024 — Project Inception
197
+ Initial prototype exploring Markdoc extensions for component-rich content.
198
+
199
+ ## 2025 — Open Source Launch
200
+ First public release with 20 runes and the Lumina theme.
201
+
202
+ ## 2026 — Theme Ecosystem
203
+ Launch of the theme marketplace and inspect tooling for developers.
204
+ {% /timeline %}`,
205
+ conversation: `{% conversation %}
206
+ > **Alice** — Have you tried the new inspect command?
207
+
208
+ > **Bob** — Yes! It shows exactly what HTML the identity transform produces. No more guessing which selectors to target.
209
+
210
+ > **Alice** — The variant expansion is my favorite part. You can see every modifier value at once.
211
+ {% /conversation %}`,
212
+ comparison: `{% comparison %}
213
+ # React
214
+ - **Learning Curve** — Moderate
215
+ - **Bundle Size** — ~40kb
216
+ - **Reactivity** — Virtual DOM
217
+ - ~~Server Components~~ — Experimental
218
+
219
+ # Svelte
220
+ - **Learning Curve** — Easy
221
+ - **Bundle Size** — ~5kb
222
+ - **Reactivity** — Compile-time
223
+ - **Server Components** — Native
224
+ {% /comparison %}`,
225
+ storyboard: `{% storyboard style="clean" columns="3" %}
226
+ ![Panel 1](/images/panel1.jpg)
227
+ The hero surveys the landscape from atop the hill.
228
+
229
+ ![Panel 2](/images/panel2.jpg)
230
+ A distant rumble echoes across the valley.
231
+
232
+ ![Panel 3](/images/panel3.jpg)
233
+ The journey begins.
234
+ {% /storyboard %}`,
235
+ sidenote: `{% sidenote style="sidenote" %}
236
+ This is a margin note that appears alongside the main content, providing additional context without interrupting the reading flow.
237
+ {% /sidenote %}`,
238
+ diff: `{% diff mode="unified" %}
239
+ \`\`\`ts
240
+ const config = {
241
+ prefix: 'rf',
242
+ runes: {}
243
+ };
244
+ \`\`\`
245
+
246
+ \`\`\`ts
247
+ const config = {
248
+ prefix: 'rf',
249
+ tokenPrefix: '--rf',
250
+ icons: {},
251
+ runes: {}
252
+ };
253
+ \`\`\`
254
+ {% /diff %}`,
255
+ datatable: `{% datatable %}
256
+ | Name | Role | Department | Status |
257
+ |------|------|------------|--------|
258
+ | Alice | Engineer | Platform | Active |
259
+ | Bob | Designer | Product | Active |
260
+ | Carol | Manager | Engineering | On Leave |
261
+ {% /datatable %}`,
262
+ form: `{% form method="POST" style="stacked" %}
263
+ - Name
264
+ - Email
265
+ - Message (textarea)
266
+
267
+ > How did you hear about us?
268
+ - Search engine
269
+ - Social media
270
+ - Friend referral
271
+ - Other
272
+
273
+ **Submit**
274
+ {% /form %}`,
275
+ cast: `{% cast %}
276
+ - **Alice Chen** — Lead Engineer
277
+ - **Bob Martinez** — Product Designer
278
+ - **Carol Kim** — Engineering Manager
279
+ {% /cast %}`,
280
+ bento: `{% bento %}
281
+ # Main Feature
282
+ The primary showcase area with plenty of room for a detailed description.
283
+
284
+ ## Secondary Feature
285
+ A supporting feature with moderate space.
286
+
287
+ ## Another Feature
288
+ More supporting content.
289
+
290
+ ### Small Detail
291
+ A compact cell.
292
+
293
+ ### Small Detail
294
+ Another compact cell.
295
+ {% /bento %}`,
296
+ palette: `{% palette title="Brand Colors" %}
297
+ - Primary: #2563EB
298
+ - Secondary: #7C3AED
299
+ - Accent: #F59E0B
300
+ - Success: #10B981
301
+ - Error: #EF4444
302
+ {% /palette %}`,
303
+ typography: `{% typography title="Type Scale" %}
304
+ - Display: Inter (400, 600, 700)
305
+ - Body: Inter (400, 500)
306
+ - Mono: JetBrains Mono (400, 500)
307
+ {% /typography %}`,
308
+ spacing: `{% spacing title="Spacing Scale" %}
309
+ # Spacing
310
+ - xs: 4px
311
+ - sm: 8px
312
+ - md: 16px
313
+ - lg: 24px
314
+ - xl: 32px
315
+ - 2xl: 48px
316
+ {% /spacing %}`,
317
+ };
318
+ /** Get a fixture for a rune, with optional attribute overrides applied to the source */
319
+ export function getFixture(runeName, attrOverrides) {
320
+ // Look up by primary name or try as-is
321
+ const source = fixtures[runeName];
322
+ if (!source) {
323
+ // Generate a minimal fixture for unknown runes
324
+ return `{% ${runeName} %}\nSample content for the ${runeName} rune.\n{% /${runeName} %}`;
325
+ }
326
+ if (!attrOverrides || Object.keys(attrOverrides).length === 0) {
327
+ return source;
328
+ }
329
+ // Apply attribute overrides by modifying the opening tag
330
+ return applyOverrides(source, runeName, attrOverrides);
331
+ }
332
+ /** Replace or add attributes in the opening tag of a fixture */
333
+ function applyOverrides(source, tagName, overrides) {
334
+ // Match the opening tag: {% tagName ... %}
335
+ const openTagPattern = new RegExp(`(\\{%\\s*${escapeRegex(tagName)})([^%]*?)(%\\})`);
336
+ const match = source.match(openTagPattern);
337
+ if (!match)
338
+ return source;
339
+ let attrString = match[2];
340
+ for (const [key, value] of Object.entries(overrides)) {
341
+ // Try to replace existing attribute
342
+ const attrPattern = new RegExp(`${escapeRegex(key)}="[^"]*"`);
343
+ if (attrPattern.test(attrString)) {
344
+ attrString = attrString.replace(attrPattern, `${key}="${value}"`);
345
+ }
346
+ else {
347
+ // Add new attribute
348
+ attrString = attrString.trimEnd() + ` ${key}="${value}" `;
349
+ }
350
+ }
351
+ return source.replace(openTagPattern, `${match[1]}${attrString}${match[3]}`);
352
+ }
353
+ function escapeRegex(s) {
354
+ return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
355
+ }
356
+ //# sourceMappingURL=fixtures.js.map
@@ -0,0 +1 @@
1
+ {"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AAE,GAAG,IAAI,GAAG,KAAK,KAAK,IAAI,CAAC;QAC3D,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { RuneConfig, ThemeConfig } from '@refrakt-md/transform';
2
+ import type { AuditResult } from './css-audit.js';
3
+ /** Format the "Config Applied" section showing what the identity transform does */
4
+ export declare function formatConfig(runeTypeof: string, config: ThemeConfig): string;
5
+ /** Format the selector list with visual grouping */
6
+ export declare function formatSelectors(selectors: string[]): string;
7
+ /** Format a section heading */
8
+ export declare function heading(text: string): string;
9
+ /** Format the input Markdoc source (indented) */
10
+ export declare function formatInput(source: string): string;
11
+ /** Format the HTML output (indented, already pretty-printed) */
12
+ export declare function formatHtml(html: string): string;
13
+ /** Format the rune list for --list mode */
14
+ export declare function formatRuneList(runes: Array<{
15
+ name: string;
16
+ aliases: string[];
17
+ description: string;
18
+ variants: Record<string, string[]>;
19
+ }>): string;
20
+ /** Build JSON output matching the spec format */
21
+ export declare function buildJsonOutput(opts: {
22
+ rune: string;
23
+ theme: string;
24
+ input: string;
25
+ config: RuneConfig | undefined;
26
+ html: string;
27
+ selectors: string[];
28
+ }): object;
29
+ /** Format a single-rune audit result */
30
+ export declare function formatAuditResult(result: AuditResult, theme: string): string;
31
+ /** Format the full-theme audit summary */
32
+ export declare function formatAuditSummary(results: AuditResult[], theme: string): string;
33
+ /** Build JSON output for an audit */
34
+ export declare function buildAuditJson(results: AuditResult[], theme: string): object;
35
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":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AAC1C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAiChF;AAED,qCAAqC;AACrC,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAgB5E"}
@@ -0,0 +1,215 @@
1
+ const DIM = '\x1b[2m';
2
+ const BOLD = '\x1b[1m';
3
+ const CYAN = '\x1b[36m';
4
+ const GREEN = '\x1b[32m';
5
+ const YELLOW = '\x1b[33m';
6
+ const RED = '\x1b[31m';
7
+ const RESET = '\x1b[0m';
8
+ /** Format the "Config Applied" section showing what the identity transform does */
9
+ export function formatConfig(runeTypeof, config) {
10
+ const runeConfig = config.runes[runeTypeof];
11
+ if (!runeConfig) {
12
+ return ` ${DIM}No config found for ${runeTypeof}${RESET}`;
13
+ }
14
+ const lines = [];
15
+ lines.push(` ${DIM}block:${RESET} ${runeConfig.block}`);
16
+ // Modifiers
17
+ if (runeConfig.modifiers && Object.keys(runeConfig.modifiers).length > 0) {
18
+ const mods = Object.entries(runeConfig.modifiers)
19
+ .map(([name, mod]) => {
20
+ const def = mod.default ? ` (default: ${mod.default})` : '';
21
+ return `${name} from ${mod.source}${def}`;
22
+ })
23
+ .join(', ');
24
+ lines.push(` ${DIM}modifiers:${RESET} ${mods}`);
25
+ }
26
+ else {
27
+ lines.push(` ${DIM}modifiers:${RESET} ${DIM}none${RESET}`);
28
+ }
29
+ // Structure
30
+ if (runeConfig.structure && Object.keys(runeConfig.structure).length > 0) {
31
+ const structs = Object.entries(runeConfig.structure)
32
+ .map(([name, entry]) => {
33
+ const children = entry.children
34
+ ? entry.children.map(c => typeof c === 'string' ? c : (c.ref ?? '?')).join(' + ')
35
+ : name;
36
+ const pos = entry.before ? 'before' : 'after';
37
+ return `${name} → ${children} (${pos})`;
38
+ })
39
+ .join(', ');
40
+ lines.push(` ${DIM}structure:${RESET} ${structs}`);
41
+ }
42
+ else {
43
+ lines.push(` ${DIM}structure:${RESET} ${DIM}none${RESET}`);
44
+ }
45
+ // Content wrapper
46
+ if (runeConfig.contentWrapper) {
47
+ lines.push(` ${DIM}contentWrapper:${RESET} ${runeConfig.contentWrapper.tag}[ref=${runeConfig.contentWrapper.ref}]`);
48
+ }
49
+ else {
50
+ lines.push(` ${DIM}contentWrapper:${RESET} ${DIM}none${RESET}`);
51
+ }
52
+ // Context modifiers
53
+ if (runeConfig.contextModifiers && Object.keys(runeConfig.contextModifiers).length > 0) {
54
+ const ctx = Object.entries(runeConfig.contextModifiers)
55
+ .map(([parent, suffix]) => `${parent} → ${suffix}`)
56
+ .join(', ');
57
+ lines.push(` ${DIM}contextModifiers:${RESET} ${ctx}`);
58
+ }
59
+ // Root attributes
60
+ if (runeConfig.rootAttributes && Object.keys(runeConfig.rootAttributes).length > 0) {
61
+ const attrs = Object.entries(runeConfig.rootAttributes)
62
+ .map(([k, v]) => `${k}="${v}"`)
63
+ .join(', ');
64
+ lines.push(` ${DIM}rootAttributes:${RESET} ${attrs}`);
65
+ }
66
+ // Static modifiers
67
+ if (runeConfig.staticModifiers && runeConfig.staticModifiers.length > 0) {
68
+ lines.push(` ${DIM}staticModifiers:${RESET} ${runeConfig.staticModifiers.join(', ')}`);
69
+ }
70
+ // Styles mapping
71
+ if (runeConfig.styles && Object.keys(runeConfig.styles).length > 0) {
72
+ const styles = Object.entries(runeConfig.styles)
73
+ .map(([mod, prop]) => `${mod} → ${prop}`)
74
+ .join(', ');
75
+ lines.push(` ${DIM}styles:${RESET} ${styles}`);
76
+ }
77
+ return lines.join('\n');
78
+ }
79
+ /** Format the selector list with visual grouping */
80
+ export function formatSelectors(selectors) {
81
+ return selectors.map(s => {
82
+ if (s.startsWith('['))
83
+ return ` ${YELLOW}${s}${RESET}`;
84
+ if (s.includes('__'))
85
+ return ` ${CYAN}${s}${RESET}`;
86
+ if (s.includes('--'))
87
+ return ` ${GREEN}${s}${RESET}`;
88
+ return ` ${BOLD}${s}${RESET}`;
89
+ }).join('\n');
90
+ }
91
+ /** Format a section heading */
92
+ export function heading(text) {
93
+ return `\n${BOLD}${text}${RESET}`;
94
+ }
95
+ /** Format the input Markdoc source (indented) */
96
+ export function formatInput(source) {
97
+ return source.split('\n').map(line => ` ${DIM}${line}${RESET}`).join('\n');
98
+ }
99
+ /** Format the HTML output (indented, already pretty-printed) */
100
+ export function formatHtml(html) {
101
+ return html.split('\n').map(line => ` ${line}`).join('\n');
102
+ }
103
+ /** Format the rune list for --list mode */
104
+ export function formatRuneList(runes) {
105
+ const lines = [];
106
+ for (const rune of runes) {
107
+ const aliasStr = rune.aliases.length > 0 ? ` ${DIM}(${rune.aliases.join(', ')})${RESET}` : '';
108
+ lines.push(` ${BOLD}${rune.name}${RESET}${aliasStr}`);
109
+ if (rune.description) {
110
+ lines.push(` ${rune.description}`);
111
+ }
112
+ if (Object.keys(rune.variants).length > 0) {
113
+ for (const [attr, values] of Object.entries(rune.variants)) {
114
+ lines.push(` ${DIM}${attr}:${RESET} ${values.join(', ')}`);
115
+ }
116
+ }
117
+ lines.push('');
118
+ }
119
+ return lines.join('\n');
120
+ }
121
+ /** Build JSON output matching the spec format */
122
+ export function buildJsonOutput(opts) {
123
+ return {
124
+ rune: opts.rune,
125
+ theme: opts.theme,
126
+ input: opts.input,
127
+ config: opts.config ? {
128
+ block: opts.config.block,
129
+ modifiers: opts.config.modifiers ?? {},
130
+ structure: opts.config.structure ?? {},
131
+ contentWrapper: opts.config.contentWrapper ?? null,
132
+ contextModifiers: opts.config.contextModifiers ?? {},
133
+ rootAttributes: opts.config.rootAttributes ?? {},
134
+ staticModifiers: opts.config.staticModifiers ?? [],
135
+ styles: opts.config.styles ?? {},
136
+ } : null,
137
+ html: opts.html,
138
+ selectors: opts.selectors,
139
+ };
140
+ }
141
+ /** Format a single-rune audit result */
142
+ export function formatAuditResult(result, theme) {
143
+ const lines = [];
144
+ lines.push(heading(`CSS Coverage: ${result.rune} (${theme})`));
145
+ lines.push('');
146
+ // Find the longest selector for alignment
147
+ const selectors = Object.keys(result.selectors);
148
+ const maxLen = Math.max(...selectors.map(s => s.length));
149
+ for (const [sel, info] of Object.entries(result.selectors)) {
150
+ const padded = sel.padEnd(maxLen + 2);
151
+ if (info.styled) {
152
+ lines.push(` ${GREEN}\u2713${RESET} ${padded} ${DIM}\u2192 ${info.file}:${info.line}${RESET}`);
153
+ }
154
+ else {
155
+ lines.push(` ${RED}\u2717${RESET} ${padded} ${RED}NOT STYLED${RESET}`);
156
+ }
157
+ }
158
+ lines.push('');
159
+ const pct = result.total > 0 ? Math.round((result.styled / result.total) * 100) : 0;
160
+ const statusIcon = result.status === 'complete' ? `${GREEN}\u2713 complete${RESET}`
161
+ : result.status === 'partial' ? `${YELLOW}\u26a0 ${result.total - result.styled} unstyled${RESET}`
162
+ : `${RED}\u2717 not started${RESET}`;
163
+ lines.push(` Coverage: ${result.styled}/${result.total} selectors (${pct}%) ${statusIcon}`);
164
+ return lines.join('\n');
165
+ }
166
+ /** Format the full-theme audit summary */
167
+ export function formatAuditSummary(results, theme) {
168
+ const lines = [];
169
+ lines.push(heading(`Theme Audit: ${theme}`));
170
+ lines.push('');
171
+ // Find the longest rune name for alignment
172
+ const maxNameLen = Math.max(...results.map(r => r.rune.length));
173
+ for (const r of results) {
174
+ const name = r.rune.padEnd(maxNameLen + 2);
175
+ const fraction = `${r.styled}/${r.total}`.padStart(7);
176
+ const statusIcon = r.status === 'complete' ? `${GREEN}\u2713 complete${RESET}`
177
+ : r.status === 'partial' ? `${YELLOW}\u26a0 ${r.total - r.styled} unstyled${RESET}`
178
+ : `${RED}\u2717 not started${RESET}`;
179
+ lines.push(` ${name} ${fraction} selectors ${statusIcon}`);
180
+ }
181
+ // Summary
182
+ const totalSelectors = results.reduce((sum, r) => sum + r.total, 0);
183
+ const totalStyled = results.reduce((sum, r) => sum + r.styled, 0);
184
+ const complete = results.filter(r => r.status === 'complete').length;
185
+ const partial = results.filter(r => r.status === 'partial').length;
186
+ const notStarted = results.filter(r => r.status === 'not-started').length;
187
+ const pct = totalSelectors > 0 ? Math.round((totalStyled / totalSelectors) * 100) : 0;
188
+ lines.push('');
189
+ lines.push(` ${DIM}${'─'.repeat(40)}${RESET}`);
190
+ lines.push(` Overall: ${totalStyled}/${totalSelectors} selectors styled (${pct}%)`);
191
+ lines.push(` Complete: ${complete} runes`);
192
+ if (partial > 0)
193
+ lines.push(` Partial: ${partial} runes`);
194
+ if (notStarted > 0)
195
+ lines.push(` Not started: ${notStarted} runes`);
196
+ return lines.join('\n');
197
+ }
198
+ /** Build JSON output for an audit */
199
+ export function buildAuditJson(results, theme) {
200
+ const totalSelectors = results.reduce((sum, r) => sum + r.total, 0);
201
+ const totalStyled = results.reduce((sum, r) => sum + r.styled, 0);
202
+ return {
203
+ theme,
204
+ totalSelectors,
205
+ styledSelectors: totalStyled,
206
+ coverage: totalSelectors > 0 ? Math.round((totalStyled / totalSelectors) * 100) / 100 : 0,
207
+ runes: Object.fromEntries(results.map(r => [r.rune, {
208
+ total: r.total,
209
+ styled: r.styled,
210
+ status: r.status,
211
+ selectors: r.selectors,
212
+ }])),
213
+ };
214
+ }
215
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/lib/format.ts"],"names":[],"mappings":"AAGA,MAAM,GAAG,GAAG,SAAS,CAAC;AACtB,MAAM,IAAI,GAAG,SAAS,CAAC;AACvB,MAAM,IAAI,GAAG,UAAU,CAAC;AACxB,MAAM,KAAK,GAAG,UAAU,CAAC;AACzB,MAAM,MAAM,GAAG,UAAU,CAAC;AAC1B,MAAM,GAAG,GAAG,UAAU,CAAC;AACvB,MAAM,KAAK,GAAG,SAAS,CAAC;AAExB,mFAAmF;AACnF,MAAM,UAAU,YAAY,CAAC,UAAkB,EAAE,MAAmB;IACnE,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC5C,IAAI,CAAC,UAAU,EAAE,C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AAK,CAAC,IAAI,CAAC,kBAAkB,UAAU,QAAQ,CAAC,CAAC;IAErE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,qCAAqC;AACrC,MAAM,UAAU,cAAc,CAAC,OAAsB,EAAE,KAAa;IACnE,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAElE,OAAO;QACN,KAAK;QACL,cAAc;QACd,eAAe,EAAE,WAAW;QAC5B,QAAQ,EAAE,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,GAAG,cAAc,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACzF,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;gBACnD,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,MAAM,EAAE,CAAC,CAAC,MAAM;gBAChB,MAAM,EAAE,CAAC,CAAC,MAAM;gBAChB,SAAS,EAAE,CAAC,CAAC,SAAS;aACtB,CAAC,CAAC,CAAC;KACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { Schema } from '@markdoc/markdoc';
2
+ /**
3
+ * Discover variant values for a rune's attributes from its Markdoc schema.
4
+ *
5
+ * Reads the `matches` array from each schema attribute to find enumerations.
6
+ * Returns a map of attribute name → array of valid values.
7
+ */
8
+ export declare function discoverVariants(schema: Schema): Record<string, string[]>;
9
+ /**
10
+ * Check if any flag value is the special "all" keyword requesting variant expansion.
11
+ * Returns the attribute name that should be expanded, or null.
12
+ */
13
+ export declare function findExpandedVariant(flags: Record<string, string>): {
14
+ attr: string;
15
+ values: string[];
16
+ } | null;
17
+ //# sourceMappingURL=variants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../src/lib/variants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAYzE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CAS5G"}