@voltui/agent 0.0.0-stage → 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.
package/content.js ADDED
@@ -0,0 +1,787 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Content the @voltui/agent installer writes into a consumer project: Cursor rules, Copilot
5
+ * instructions, the Claude Code skill and the VS Code snippets.
6
+ *
7
+ * Single source for both the installer (setup-agent.js) and the hosted /api/mcp/setup endpoint, which
8
+ * reads a generated copy (`pnpm generate:mcp-content`). Edit here, never in the generated file.
9
+ */
10
+
11
+ const DEFAULT_MCP_URL = 'https://volt-ui.pages.dev/api/mcp';
12
+
13
+ /** @param {string} MCP_URL endpoint written into the rules/instructions */
14
+ function buildContent(MCP_URL) {
15
+ const CURSOR_RULES = `# Volt UI — Angular Component Library
16
+
17
+ Volt UI is an Angular component library inspired by shadcn/ui, built on top of ng-primitives for accessible, copyable components.
18
+
19
+ ## Stack
20
+ - Angular v21 · zoneless change detection · standalone components
21
+ - Tailwind CSS v4 with semantic tokens
22
+ - class-variance-authority (CVA) for variants
23
+ - ng-primitives for accessibility / interaction primitives
24
+ - Signals: input(), output(), model(), computed()
25
+
26
+ ## Naming
27
+ | Context | Selector | Class |
28
+ |---------|----------|-------|
29
+ | Source (library) | \`volt-*\` (component) / \`[voltXxx]\` (directive) | \`Volt*\` |
30
+ | CLI output (user project) | \`ui-*\` (component) / \`[uiXxx]\` (directive) | \`Ui*\` |
31
+
32
+ ## Components
33
+ button · badge · card · input · autofill · search · textarea · checkbox · radio · switch · toggle ·
34
+ select · tabs · accordion · avatar · separator · tooltip · navigation-menu · form-field ·
35
+ dialog · popover · dropdown-menu · slider · range-slider · progress · breadcrumbs · sidebar ·
36
+ toggle-group · meter · pagination · toast · input-otp · file-upload · combobox ·
37
+ date-picker · listbox · toolbar · skeleton · table · resizable · theme · alert · spinner · empty-state
38
+
39
+ ## Component import (CLI)
40
+ \`\`\`ts
41
+ import { UiButton } from './ui/button';
42
+ import { UiCard, UiCardHeader, UiCardContent, UiCardFooter } from './ui/card';
43
+ import { UiFormField, UiLabel, UiHint, UiError } from './ui/form-field';
44
+ import { UiToastService } from './ui/toast';
45
+ \`\`\`
46
+
47
+ ## Template selectors
48
+ \`\`\`html
49
+ <!-- Components -->
50
+ <button uiButton variant="solid|outline|ghost|link|destructive" size="sm|md|lg|icon">
51
+ <a uiButton routerLink="/docs"> <!-- links styled as buttons: never <a><ui-button> -->
52
+ <ui-button variant="…" aria-label="…"> <!-- still supported; aria-* forwarded to its <button> -->
53
+ <ui-card> <ui-card-header> <ui-card-title> <ui-card-content class="p-3"> <ui-card-footer>
54
+ <ui-form-field> <ui-label> <ui-input size="sm|md|lg" state="default|error|success"> <ui-hint> <ui-error>
55
+ <ui-badge variant="solid|secondary|outline|destructive|success|warning|info">
56
+ <ui-alert variant="default|info|success|warning|destructive" role="status|alert"> <ui-alert-title> <ui-alert-description>
57
+ <ui-spinner size="sm|md|lg" label="Loading…">
58
+ <ui-empty-state> <ui-empty-state-title> <ui-empty-state-description> <div slot="actions">
59
+ <ui-tabs [(value)]="activeTab"> <ui-tabs-list> <ui-tabs-trigger value="x"> <ui-tabs-content value="x">
60
+ <ui-accordion type="single|multiple" [collapsible]="true">
61
+ <ui-select placeholder="…"> <ui-select-content> <ui-select-item value="x">
62
+ <ui-table> <ui-table-header> <ui-table-body> <ui-table-row> <ui-table-head> <ui-table-cell>
63
+ <ui-skeleton variant="circle|text|rectangle" width="…" height="…">
64
+
65
+ <!-- Attribute directives (overlays) -->
66
+ <button [uiDialog]="tpl"> + <ng-template> with <div uiDialogContent>
67
+ <ng-template uiDialogRoot [(open)]="isOpen" let-close="close"> <!-- state-controlled dialog -->
68
+ <button [uiDrawer]="tpl"> + <ng-template> with <div uiDrawerContent side="left|right|top|bottom">
69
+ <button uiPopover [uiPopover]="tpl"> + <ng-template> with <ui-popover-content>
70
+ <button uiTooltip [uiTooltip]="tpl"> + <ng-template> with <ui-tooltip-content>
71
+ <button [uiDropdownMenu]="tpl"> + <ng-template> with <ui-dropdown-menu>
72
+ <img uiAvatarImage>
73
+ <a uiNavigationMenuLink>
74
+ \`\`\`
75
+
76
+ ## Theme
77
+ \`\`\`ts
78
+ import { provideVoltTheme } from '@voltui/components';
79
+ // colors: volt | ember | sage | dusk | glacier
80
+ // styles: sharp | soft | brutal | ghost | retro
81
+ provideVoltTheme({ color: 'ember', style: 'soft', dark: false })
82
+ \`\`\`
83
+
84
+ ## CLI
85
+ \`\`\`bash
86
+ npx @voltui/cli init # scaffold ui/ folder
87
+ npx @voltui/cli add button # add a component
88
+ npx @voltui/cli list # list all components
89
+ \`\`\`
90
+
91
+ ## Code guidelines
92
+ 1. Use standalone components with \`imports\` array.
93
+ 2. Use OnPush change detection.
94
+ 3. Use signal inputs: \`readonly x = input<T>(default)\`.
95
+ 4. Boolean inputs must use \`booleanAttribute\`.
96
+ 5. Import copied components from \`'./ui/<component>'\`.
97
+ 6. Overlays are attribute-directive triggers + \`<ng-template>\` — never use \`<ui-dialog>\`, \`<ui-tooltip>\`, \`<ui-popover-trigger>\`, or \`<ui-dropdown-menu-trigger>\`. For state-driven dialogs use \`<ng-template uiDialogRoot [(open)]>\` or \`UiDialogService.open()\`.
98
+ 7. Links that look like buttons are \`<a uiButton routerLink>\` / \`<a uiButton href>\`. Never put a button inside a link.
99
+ 8. \`class\` on any Volt component is merged with \`cn()\` onto the element that owns the styles (\`<ui-input class="w-24">\` styles the native input).
100
+ 9. Toasts: \`inject(UiToastService).success('Saved')\` — no template or ng-primitives import needed.
101
+ 10. Server-side search: \`<ui-combobox filterMode="manual" [items]="results()" [loading]="loading()" (queryChange)="search($event)" />\` — the app fetches (latest response wins); never feed server results to the default local filter. Router breadcrumbs: \`<a uiBreadcrumbLink routerLink="…">\`. Native selects: \`<select uiNativeSelect>\`.
102
+
103
+ ## AI tools
104
+ MCP server at ${MCP_URL} — query it for component details, usage examples, and theme info.
105
+ `;
106
+
107
+ const COPILOT_INSTRUCTIONS = `# Volt UI — GitHub Copilot Instructions
108
+
109
+ You are working with **Volt UI**, an Angular v21 component library (shadcn/ui-inspired).
110
+
111
+ ## Architecture
112
+ - **Standalone components** — no NgModules
113
+ - **Zoneless signals** — input(), output(), model(), computed()
114
+ - **OnPush** change detection everywhere
115
+ - **CVA** (class-variance-authority) for variants
116
+ - **ng-primitives** for accessibility and interaction behavior
117
+
118
+ ## Naming
119
+ - Library source: \`volt-*\` element selectors and \`[voltXxx]\` attribute directives, \`Volt*\` classes
120
+ - After CLI copy: \`ui-*\` element selectors and \`[uiXxx]\` attribute directives, \`Ui*\` classes
121
+ - Import from: \`'./ui/<component>'\`
122
+
123
+ ## Available components
124
+
125
+ | Component | Import | Selectors | Notes |
126
+ |-----------|--------|-----------|-------|
127
+ | Button | \`./ui/button\` | \`button[uiButton]\`, \`a[uiButton]\`, \`ui-button\` | Variants: solid, outline, ghost, link, destructive. Use \`a[uiButton]\` for links |
128
+ | Badge | \`./ui/badge\` | \`ui-badge\` | Variants: solid, secondary, outline, destructive, success, warning, info |
129
+ | Alert | \`./ui/alert\` | \`ui-alert\` + title/description | Variants: default, info, success, warning, destructive. Opt-in \`role\` |
130
+ | Spinner | \`./ui/spinner\` | \`ui-spinner\` | \`size\`; \`label\` makes it \`role="status"\` |
131
+ | Empty State | \`./ui/empty-state\` | \`ui-empty-state\` + title/description | Optional \`[slot=icon]\`, \`[slot=actions]\`; plain content |
132
+ | Autofill | \`./ui/autofill\` | \`[uiAutofill]\` directive | Emits \`autofillChange\` |
133
+ | Card | \`./ui/card\` | \`ui-card\` + header/title/description/content/footer | Presentational |
134
+ | Input | \`./ui/input\` | \`ui-input\` | CVA; \`size\`, \`state\`, \`class\` style the native input |
135
+ | Textarea | \`./ui/textarea\` | \`ui-textarea\` | CVA |
136
+ | Checkbox | \`./ui/checkbox\` | \`ui-checkbox\` | CVA |
137
+ | Radio | \`./ui/radio\` | \`ui-radio-group\`, \`ui-radio-item\` | CVA |
138
+ | Switch | \`./ui/switch\` | \`ui-switch\` | CVA |
139
+ | Toggle | \`./ui/toggle\` | \`ui-toggle\` | CVA |
140
+ | Toggle Group | \`./ui/toggle-group\` | \`ui-toggle-group\`, \`ui-toggle-group-item\` | CVA |
141
+ | Select | \`./ui/select\` | \`ui-select\` + content/item/label/separator + \`<select uiNativeSelect>\` (attribute, not an element) | CVA |
142
+ | Tabs | \`./ui/tabs\` | \`ui-tabs\` + list/trigger/content | Use \`value\` model, not \`defaultValue\` |
143
+ | Accordion | \`./ui/accordion\` | \`ui-accordion\` + item/trigger/content | \`type\`, \`collapsible\` |
144
+ | Avatar | \`./ui/avatar\` | \`ui-avatar\`, \`<img uiAvatarImage>\`, \`ui-avatar-fallback\` | Image is directive |
145
+ | Breadcrumbs | \`./ui/breadcrumbs\` | \`ui-breadcrumbs\` + singular \`breadcrumb-*\` sub-components | |
146
+ | Separator | \`./ui/separator\` | \`ui-separator\` | \`orientation\` |
147
+ | Skeleton | \`./ui/skeleton\` | \`ui-skeleton\` | \`variant\`, \`width\`, \`height\` |
148
+ | Meter | \`./ui/meter\` | \`ui-meter\` + label/value/track/indicator | |
149
+ | Progress | \`./ui/progress\` | \`ui-progress\` + label/value | |
150
+ | Slider | \`./ui/slider\` | \`ui-slider\` | CVA |
151
+ | Range Slider | \`./ui/range-slider\` | \`ui-range-slider\` | CVA, dual-thumb |
152
+ | Form Field | \`./ui/form-field\` | \`ui-form-field\`, \`ui-label\`, \`ui-hint\`, \`ui-error\` | Wires label/description ids |
153
+ | Pagination | \`./ui/pagination\` | \`ui-pagination\` + first/previous/next/last/button | |
154
+ | Table | \`./ui/table\` | \`ui-table\` + header/body/footer/row/head/cell/caption | |
155
+ | Toolbar | \`./ui/toolbar\` | \`ui-toolbar\`, \`button[uiToolbarButton]\` | |
156
+ | Search | \`./ui/search\` | \`ui-search\`, \`ui-search-clear\` | |
157
+ | Input OTP | \`./ui/input-otp\` | \`ui-input-otp\`, \`ui-input-otp-slot\` | |
158
+ | Combobox | \`./ui/combobox\` | \`ui-combobox\` + input/button/dropdown/option | |
159
+ | Date Picker | \`./ui/date-picker\` | \`ui-date-picker\`, \`ui-date-range-picker\` + sub-components | CVA |
160
+ | File Upload | \`./ui/file-upload\` | \`ui-file-upload\`, \`ui-file-dropzone\` | |
161
+ | Listbox | \`./ui/listbox\` | \`ui-listbox\` + option/section/header | |
162
+ | Navigation Menu | \`./ui/navigation-menu\` | \`ui-navigation-menu\` + list/item/trigger/content/link | Link is \`a[uiNavigationMenuLink]\` |
163
+ | Resizable | \`./ui/resizable\` | \`ui-resizable\` + panel/handle | |
164
+ | Sidebar | \`./ui/sidebar\` | \`ui-sidebar\` layout group | |
165
+ | Theme | \`./ui/theme\` | \`provideVoltTheme\`, \`applyVoltTheme\` | |
166
+ | Dialog | \`./ui/dialog\` | \`[uiDialog]\`, \`ng-template[uiDialogRoot]\`, \`[uiDialogOverlay]\`, \`[uiDialogContent]\`, \`[uiDialogTitle]\`, \`[uiDialogDescription]\` | Trigger, \`[(open)]\`-controlled, or \`UiDialogService.open()\` |
167
+ | Drawer | \`./ui/drawer\` | \`[uiDrawer]\`, \`[uiDrawerOverlay]\`, \`[uiDrawerContent]\`, \`[uiDrawerTitle]\`, \`[uiDrawerDescription]\`, \`ui-drawer-close\` | Template-based overlay |
168
+ | Popover | \`./ui/popover\` | \`[uiPopover]\`, \`ui-popover-content\` | Template-based overlay |
169
+ | Tooltip | \`./ui/tooltip\` | \`[uiTooltip]\`, \`ui-tooltip-content\` | Template-based overlay |
170
+ | Dropdown Menu | \`./ui/dropdown-menu\` | \`[uiDropdownMenu]\`, \`ui-dropdown-menu\` + item/label/separator | Template-based overlay |
171
+ | Toast | \`./ui/toast\` | \`ui-toast\` + title/description/close | Use \`UiToastService\` (show/success/error/warning/info) |
172
+
173
+ Known upstream caveats in \`ng-primitives\`: meter currently exposes \`aria-valuenow\` as a percentage for non-0..100 ranges, and progress currently reports \`aria-valuemin="0"\` even when \`min\` is customized.
174
+
175
+ ## Overlay pattern
176
+ Overlays are never used as element selectors. Use an attribute-directive trigger that references an \`<ng-template>\`:
177
+
178
+ \`\`\`html
179
+ <button [uiDialog]="dialogTpl">Open</button>
180
+ <ng-template #dialogTpl let-close="close">
181
+ <div uiDialogOverlay></div>
182
+ <div uiDialogContent>
183
+ <h2 uiDialogTitle>Title</h2>
184
+ <p uiDialogDescription>Description</p>
185
+ <button uiButton (click)="close()">Close</button>
186
+ </div>
187
+ </ng-template>
188
+
189
+ <!-- State-controlled: no trigger element -->
190
+ <ng-template uiDialogRoot [(open)]="editing" let-close="close">…</ng-template>
191
+ \`\`\`
192
+
193
+ ## Button variants
194
+ \`\`\`html
195
+ <button uiButton variant="solid|outline|ghost|link|destructive" size="sm|md|lg|icon">Save</button>
196
+ <a uiButton variant="outline" routerLink="/docs">Docs</a>
197
+ <button uiButton size="icon" aria-label="Close"><svg aria-hidden="true">…</svg></button>
198
+ \`\`\`
199
+
200
+ ## Card pattern
201
+ \`\`\`html
202
+ <ui-card>
203
+ <ui-card-header>
204
+ <ui-card-title>Title</ui-card-title>
205
+ <ui-card-description>Description</ui-card-description>
206
+ </ui-card-header>
207
+ <ui-card-content>Content</ui-card-content>
208
+ <ui-card-footer>
209
+ <ui-button variant="outline">Cancel</ui-button>
210
+ <ui-button>Save</ui-button>
211
+ </ui-card-footer>
212
+ </ui-card>
213
+ \`\`\`
214
+
215
+ ## Form field pattern
216
+ \`\`\`html
217
+ <ui-form-field>
218
+ <ui-label>Email</ui-label>
219
+ <ui-input type="email" placeholder="you@example.com" />
220
+ <ui-hint>We'll never share your email</ui-hint>
221
+ <ui-error>Email is required</ui-error>
222
+ </ui-form-field>
223
+ \`\`\`
224
+
225
+ ## Tabs pattern
226
+ \`\`\`html
227
+ <ui-tabs [(value)]="activeTab">
228
+ <ui-tabs-list>
229
+ <ui-tabs-trigger value="account">Account</ui-tabs-trigger>
230
+ <ui-tabs-trigger value="password">Password</ui-tabs-trigger>
231
+ </ui-tabs-list>
232
+ <ui-tabs-content value="account">Account settings.</ui-tabs-content>
233
+ <ui-tabs-content value="password">Password settings.</ui-tabs-content>
234
+ </ui-tabs>
235
+ \`\`\`
236
+
237
+ ## Theme system
238
+ \`\`\`ts
239
+ import { provideVoltTheme } from '@voltui/components';
240
+ // colors: volt | ember | sage | dusk | glacier
241
+ // styles: sharp | soft | brutal | ghost | retro
242
+ providers: [provideVoltTheme({ color: 'ember', style: 'soft', dark: false })]
243
+ \`\`\`
244
+
245
+ ## CLI
246
+ \`\`\`bash
247
+ npx @voltui/cli init
248
+ npx @voltui/cli add button card form-field input
249
+ npx @voltui/cli list
250
+ \`\`\`
251
+
252
+ ## Code guidelines
253
+ 1. Use standalone components with \`imports\` array.
254
+ 2. Use OnPush change detection.
255
+ 3. Use signal inputs (\`readonly x = input<T>(default)\`).
256
+ 4. Use \`computed()\` for derived values.
257
+ 5. Boolean inputs must use \`booleanAttribute\`.
258
+ 6. Import from \`'./ui/<component>'\`.
259
+ 7. Never use \`<ui-dialog>\`, \`<ui-tooltip>\`, \`<ui-popover-trigger>\`, or \`<ui-dropdown-menu-trigger>\`.
260
+ 8. Never nest a button inside a link: use \`<a uiButton>\`.
261
+ 9. \`class\` is merged with \`cn()\` onto the element that owns the styles.
262
+ 10. Server-side search: \`<ui-combobox filterMode="manual" (queryChange)="search($event)">\` (the app fetches; never combine with the local filter). Router breadcrumbs: \`<a uiBreadcrumbLink routerLink>\`. Native selects: \`<select uiNativeSelect>\`.
263
+ `;
264
+
265
+ const VOLT_UI_SKILL = `---
266
+ name: volt-ui
267
+ description: >
268
+ Understand and integrate Volt UI components into Angular projects.
269
+ Volt UI is an Angular component library inspired by shadcn/ui, built on
270
+ ng-primitives, Tailwind CSS v4, standalone signals components and CVA.
271
+ Use when the project consumes @voltui/components, @voltui/cli, or copied
272
+ Volt UI source under src/app/ui.
273
+ ---
274
+
275
+ # Volt UI — AI Integration Skill
276
+
277
+ ## When to use this skill
278
+
279
+ - The user is adding, editing or debugging Volt UI components in an Angular app.
280
+ - You see imports from \`'@voltui/components'\`, \`'./ui/button'\`, etc.
281
+ - You need to generate markup, fix selectors, wire Reactive Forms, or theme the app.
282
+ - The user asks about available components, CLI commands, or MCP tools.
283
+
284
+ ## What Volt UI is
285
+
286
+ - **Angular 21**, zoneless, standalone components, OnPush, signals (\`input()\`, \`output()\`, \`model()\`).
287
+ - **Tailwind CSS v4** with semantic tokens (\`bg-primary\`, \`text-foreground\`, \`rounded-md\`).
288
+ - **ng-primitives** provides accessible behavior (keyboard, focus, overlays, CVA).
289
+ - **class-variance-authority (CVA)** drives component variants.
290
+ - **Two first-class consumption modes**:
291
+ 1. **Package mode**: \`npm install @voltui/components\`, import \`VoltXxx\` from \`'@voltui/components'\`. Centralized updates, shared behavior, one version.
292
+ 2. **Copy-and-own mode**: \`npx @voltui/cli add button\` copies source into the project (default \`src/app/ui\`) as editable \`UiXxx\` code.
293
+
294
+ ## Naming conventions
295
+
296
+ | Context | Selector | Class name | Import path |
297
+ | -------------- | ----------------------------------------------- | ---------- | ----------------------------------- |
298
+ | Library source | \`volt-*\` (component) / \`[voltXxx]\` (directive) | \`VoltXxx\` | \`'@voltui/components'\` |
299
+ | After CLI copy | \`ui-*\` (component) / \`[uiXxx]\` (directive) | \`UiXxx\` | \`'./ui/<component>'\` |
300
+
301
+ Always prefer the CLI prefix (\`ui-*\` / \`UiXxx\`) when generating code for this project unless it explicitly imports from the npm package.
302
+
303
+ ## Adding components to this project
304
+
305
+ \`\`\`bash
306
+ npx @voltui/cli init # scaffolds src/app/ui
307
+ npx @voltui/cli add button card form-field input
308
+ npx @voltui/cli add dialog ./src/app/shared/ui --dry-run
309
+ \`\`\`
310
+
311
+ Runtime dependencies (installed once):
312
+
313
+ \`\`\`bash
314
+ npm install ng-primitives class-variance-authority clsx tailwind-merge
315
+ \`\`\`
316
+
317
+ ## Theme setup
318
+
319
+ In the app's global CSS:
320
+
321
+ \`\`\`css
322
+ @import 'tailwindcss';
323
+ @import '@voltui/components/themes.css';
324
+ \`\`\`
325
+
326
+ In \`app.config.ts\`:
327
+
328
+ \`\`\`ts
329
+ import { provideVoltTheme } from '@voltui/components';
330
+
331
+ bootstrapApplication(AppComponent, {
332
+ providers: [provideVoltTheme({ color: 'volt', style: 'sharp', dark: false })],
333
+ });
334
+ \`\`\`
335
+
336
+ Color presets: \`volt\`, \`ember\`, \`sage\`, \`dusk\`, \`glacier\`.
337
+ Style presets: \`sharp\`, \`soft\`, \`brutal\`, \`ghost\`, \`retro\`.
338
+
339
+ ## Component / directive selector rules
340
+
341
+ - Element selectors are used for presentational containers: \`<ui-card>\`, \`<ui-button>\`, \`<ui-input>\`.
342
+ - Attribute directives are used when the primitive is applied to an existing host element:
343
+ - Dialog trigger: \`<button [uiDialog]="tpl">\`
344
+ - Drawer trigger: \`<button [uiDrawer]="tpl">\`
345
+ - Popover trigger: \`<button uiPopover [uiPopover]="tpl">\`
346
+ - Tooltip trigger: \`<button uiTooltip [uiTooltip]="tpl">\`
347
+ - Dropdown trigger: \`<button [uiDropdownMenu]="tpl">\`
348
+ - Avatar image: \`<img uiAvatarImage>\`
349
+ - Navigation link: \`<a uiNavigationMenuLink>\`
350
+ - Overlays (dialog, drawer, popover, tooltip, dropdown-menu) are declared inside an \`<ng-template>\` and referenced by the trigger.
351
+
352
+ ## Reactive Forms
353
+
354
+ Most CVA components expose \`formControl\` directly:
355
+
356
+ \`\`\`ts
357
+ import { FormControl, ReactiveFormsModule } from '@angular/forms';
358
+ import { UiInput, UiCheckbox, UiSwitch, UiRadioGroup, UiRadioItem } from './ui';
359
+
360
+ email = new FormControl('', { nonNullable: true });
361
+ accepted = new FormControl(false, { nonNullable: true });
362
+ \`\`\`
363
+
364
+ \`\`\`html
365
+ <ui-form-field>
366
+ <ui-label>Email</ui-label>
367
+ <ui-input [formControl]="email" type="email" />
368
+ <ui-hint>We'll only use this for account updates.</ui-hint>
369
+ </ui-form-field>
370
+
371
+ <ui-checkbox [formControl]="accepted">Accept terms</ui-checkbox>
372
+ \`\`\`
373
+
374
+ ## Common patterns
375
+
376
+ ### Buttons and links
377
+
378
+ \`\`\`html
379
+ <button uiButton type="submit">Save</button>
380
+ <a uiButton variant="outline" routerLink="/docs">Docs</a>
381
+ <button uiButton size="icon" aria-label="Switch theme"><svg aria-hidden="true">…</svg></button>
382
+ \`\`\`
383
+
384
+ Never wrap \`<ui-button>\` in \`<a>\`. \`<ui-button>\` remains supported and forwards \`aria-label\`,
385
+ \`aria-expanded\`, \`aria-controls\`, \`aria-pressed\`, \`aria-haspopup\`, \`aria-labelledby\`,
386
+ \`aria-describedby\` to its inner \`<button>\`.
387
+
388
+ ### Styling
389
+
390
+ \`class\` on every Volt component is merged with \`cn()\` (tailwind-merge) onto the element that owns
391
+ the styles: \`<ui-card-content class="p-3">\` replaces \`p-6\`, \`<ui-input class="w-24">\` styles the
392
+ native \`<input>\`.
393
+
394
+ ### Search and navigation
395
+
396
+ Local list → the default. Server/API search → \`filterMode="manual"\` plus \`(queryChange)\`. Never pass
397
+ server results to the default local filter: it hides rows whose label does not contain the typed text.
398
+
399
+ \`\`\`html
400
+ <!-- A list you already have: Ui narrows it by label as the user types. -->
401
+ <ui-combobox [(value)]="framework" [items]="frameworks" />
402
+
403
+ <!-- A server decides what matches: items are rendered exactly as supplied. -->
404
+ <ui-combobox
405
+ label="Owner"
406
+ filterMode="manual"
407
+ [items]="results()"
408
+ [loading]="loading()"
409
+ loadingText="Searching…"
410
+ [emptyText]="'No matches for ' + query()"
411
+ [itemLabel]="label"
412
+ [compareWith]="sameId"
413
+ [(value)]="owner"
414
+ (queryChange)="search($event)"
415
+ />
416
+ \`\`\`
417
+
418
+ \`(queryChange)\` is the text the user typed — not the value, and not the label written back after a
419
+ selection, so it is safe to start a request from. The application owns the request: debounce it, make
420
+ the latest response win, show errors. The combobox never fetches. \`loading\` shows a row and is
421
+ announced once through the combobox's own live region; do not add a second \`role="status"\`.
422
+
423
+ Angular Router breadcrumbs: put the directive on your own anchor so \`routerLink\` owns navigation.
424
+
425
+ \`\`\`html
426
+ <a uiBreadcrumbLink routerLink="/admin" [queryParams]="{ tab: 'users' }">Admin</a>
427
+ <ui-breadcrumb-link href="/docs">Docs</ui-breadcrumb-link> <!-- plain URL only -->
428
+ \`\`\`
429
+
430
+ Prefer native HTML where the browser already has the right primitive: \`<select uiNativeSelect>\` (an
431
+ attribute on a real \`<select>\`; there is no \`<ui-native-select>\` element), \`<details>\`/\`<summary>\`,
432
+ \`<input type="file">\`. Use Ui when it adds reusable styling or behaviour you would otherwise copy.
433
+
434
+ ### Feedback
435
+
436
+ \`\`\`ts
437
+ private readonly toast = inject(UiToastService);
438
+ this.toast.success('Changes saved');
439
+ this.toast.error('Could not save', { description: 'Try again.' });
440
+ \`\`\`
441
+
442
+ \`\`\`html
443
+ <ui-badge variant="success">Connected</ui-badge>
444
+ <ui-alert variant="warning" role="status">
445
+ <ui-alert-title>Connection needs attention</ui-alert-title>
446
+ <ui-alert-description>Reconnect your account.</ui-alert-description>
447
+ </ui-alert>
448
+ <ui-spinner size="sm" /> <!-- decorative -->
449
+ <ui-spinner label="Loading projects" /> <!-- announced status -->
450
+ \`\`\`
451
+
452
+ ### Card
453
+
454
+ \`\`\`html
455
+ <ui-card>
456
+ <ui-card-header>
457
+ <ui-card-title>Title</ui-card-title>
458
+ <ui-card-description>Description</ui-card-description>
459
+ </ui-card-header>
460
+ <ui-card-content>Content</ui-card-content>
461
+ <ui-card-footer>
462
+ <ui-button variant="outline">Cancel</ui-button>
463
+ <ui-button>Save</ui-button>
464
+ </ui-card-footer>
465
+ </ui-card>
466
+ \`\`\`
467
+
468
+ ### Dialog
469
+
470
+ \`\`\`html
471
+ <button [uiDialog]="dialogTpl">Open</button>
472
+ <ng-template #dialogTpl let-close="close">
473
+ <div uiDialogOverlay></div>
474
+ <div uiDialogContent>
475
+ <h2 uiDialogTitle>Confirm</h2>
476
+ <p uiDialogDescription>Are you sure?</p>
477
+ <button uiButton (click)="close()">Confirm</button>
478
+ </div>
479
+ </ng-template>
480
+
481
+ <!-- Controlled by state, no trigger -->
482
+ <ng-template uiDialogRoot [(open)]="editing" (closed)="onClosed($event)" let-close="close">
483
+ <div uiDialogOverlay></div>
484
+ <div uiDialogContent>…</div>
485
+ </ng-template>
486
+ \`\`\`
487
+
488
+ While a request is pending, pin the dialog and put focus on the safe action:
489
+
490
+ \`\`\`html
491
+ <ng-template uiDialogRoot role="alertdialog" [(open)]="deleting" [dismissible]="!pending()"
492
+ initialFocus="[data-cancel]" let-close="close">…</ng-template>
493
+ \`\`\`
494
+
495
+ \`[dismissible]\` is live (Escape and overlay click do nothing while \`false\`); \`close()\` always works.
496
+ \`closeOnEscape\`/\`closeOnClick\` are only read when the dialog opens.
497
+
498
+ \`\`\`ts
499
+ const ok = await inject(UiDialogService).open<boolean>(confirmTpl, { role: 'alertdialog' }).closed;
500
+ \`\`\`
501
+
502
+ ### Tabs
503
+
504
+ \`\`\`html
505
+ <ui-tabs [(value)]="activeTab">
506
+ <ui-tabs-list>
507
+ <ui-tabs-trigger value="account">Account</ui-tabs-trigger>
508
+ <ui-tabs-trigger value="password">Password</ui-tabs-trigger>
509
+ </ui-tabs-list>
510
+ <ui-tabs-content value="account">Account settings.</ui-tabs-content>
511
+ <ui-tabs-content value="password">Password settings.</ui-tabs-content>
512
+ </ui-tabs>
513
+ \`\`\`
514
+
515
+ ## AI tools integration
516
+
517
+ - **MCP server**: \`${MCP_URL}\` is a spec-compliant Streamable HTTP MCP server, already configured in this project's \`.mcp.json\` by \`npx @voltui/agent\`. It exposes tools, resources, and prompts:
518
+ - Tools: \`list_components\`, \`get_component\`, \`get_usage_example\`, \`get_theme_info\`, \`get_project_info\`, \`generate_cli_command\`.
519
+ - Resources: \`component://<name>\`, \`theme://info\`, \`project://info\`.
520
+ - Prompts: \`generate-volt-ui-component\`, \`volt-ui-troubleshooting\`.
521
+ - **CLI**: \`npx @voltui/cli list\` shows available components; \`npx @voltui/cli add <name>\` copies source.
522
+ - Prefer calling the MCP \`get_component\` tool over guessing inputs — this file lists the common patterns, but the MCP server always reflects the current component metadata.
523
+
524
+ ## Rules for generating Volt UI code
525
+
526
+ 1. Prefer standalone components with signal inputs; avoid NgModules.
527
+ 2. Use OnPush change detection in new components that extend Volt UI.
528
+ 3. Import copied components from \`'./ui/<component>'\` (or the local barrel), not from \`'@voltui/components'\`, unless this project explicitly uses the npm package workflow.
529
+ 4. Use semantic Tailwind utilities (\`bg-primary\`, \`text-foreground\`, \`rounded-md\`) instead of hard-coded \`var()\` utilities.
530
+ 5. Boolean inputs must use \`booleanAttribute\`; number inputs should use \`numberAttribute\` when appropriate.
531
+ 6. For overlays, always use the attribute-directive trigger + \`<ng-template>\` pattern.
532
+ 7. Do not invent inputs. If unsure, call the MCP \`get_component\` tool.
533
+ 8. Links styled as buttons are \`<a uiButton>\`; never nest interactive elements.
534
+
535
+ ## Blocks, Layouts and Recipes are copied, not imported
536
+
537
+ They live on the docs site (\`/docs/blocks\`, \`/docs/layouts\`, \`/docs/recipes/*\`), not in
538
+ \`@voltui/components\`. Copy the source into the app and import Volt from \`@voltui/components\`. Never
539
+ import an \`AppDashboard\`, \`SettingsLayout\` or \`SettingsFormRecipe\` from the package. Recipes
540
+ (settings form, async search, data table) show behaviour — validation, pending, failure, retry — using
541
+ ordinary Angular signals around the atoms.
542
+
543
+ Blocked-but-focusable actions use \`aria-disabled="true"\` (+ \`aria-describedby\` for the reason) on
544
+ \`uiButton\`; Volt only dims it, so guard the handler yourself. Use \`disabled\` to leave the tab order.
545
+
546
+ `;
547
+
548
+ const VSCODE_SNIPPETS = {
549
+ 'Volt UI Button': {
550
+ prefix: ['volt-button', 'ui-button'],
551
+ description: 'Volt UI Button component',
552
+ body: [
553
+ '<ui-button variant="${1|solid,outline,ghost,link,destructive|}" size="${2|md,sm,lg,icon|}">${3:Label}</ui-button>',
554
+ ],
555
+ },
556
+ 'Volt UI Card': {
557
+ prefix: ['volt-card', 'ui-card'],
558
+ description: 'Volt UI Card with full structure',
559
+ body: [
560
+ '<ui-card>',
561
+ ' <ui-card-header>',
562
+ ' <ui-card-title>${1:Title}</ui-card-title>',
563
+ ' <ui-card-description>${2:Description}</ui-card-description>',
564
+ ' </ui-card-header>',
565
+ ' <ui-card-content>',
566
+ ' ${3:<!-- Content -->}',
567
+ ' </ui-card-content>',
568
+ ' <ui-card-footer>',
569
+ ' <ui-button variant="outline">${4:Cancel}</ui-button>',
570
+ ' <ui-button>${5:Confirm}</ui-button>',
571
+ ' </ui-card-footer>',
572
+ '</ui-card>',
573
+ ],
574
+ },
575
+ 'Volt UI Form Field': {
576
+ prefix: ['volt-form-field', 'ui-form-field'],
577
+ description: 'Volt UI Form Field with input',
578
+ body: [
579
+ '<ui-form-field>',
580
+ ' <ui-form-field-label>${1:Label}</ui-form-field-label>',
581
+ ' <ui-input type="${2:text}" placeholder="${3:Enter value}" />',
582
+ ' <ui-form-field-hint>${4:Helper text}</ui-form-field-hint>',
583
+ '</ui-form-field>',
584
+ ],
585
+ },
586
+ 'Volt UI Tabs': {
587
+ prefix: ['volt-tabs', 'ui-tabs'],
588
+ description: 'Volt UI Tabs component',
589
+ body: [
590
+ '<ui-tabs [(value)]="${1:activeTab}">',
591
+ ' <ui-tabs-list>',
592
+ ' <ui-tabs-trigger value="${2:tab1}">${3:Tab 1}</ui-tabs-trigger>',
593
+ ' <ui-tabs-trigger value="${4:tab2}">${5:Tab 2}</ui-tabs-trigger>',
594
+ ' </ui-tabs-list>',
595
+ ' <ui-tabs-content value="${2:tab1}">${6:Content 1}</ui-tabs-content>',
596
+ ' <ui-tabs-content value="${4:tab2}">${7:Content 2}</ui-tabs-content>',
597
+ '</ui-tabs>',
598
+ ],
599
+ },
600
+ 'Volt UI Select': {
601
+ prefix: ['volt-select', 'ui-select'],
602
+ description: 'Volt UI Select dropdown',
603
+ body: [
604
+ '<ui-select placeholder="${1:Select option}">',
605
+ ' <ui-select-label>${2:Label}</ui-select-label>',
606
+ ' <ui-select-content>',
607
+ ' <ui-select-item value="${3:value1}">${4:Option 1}</ui-select-item>',
608
+ ' <ui-select-item value="${5:value2}">${6:Option 2}</ui-select-item>',
609
+ ' </ui-select-content>',
610
+ '</ui-select>',
611
+ ],
612
+ },
613
+ 'Volt UI Accordion': {
614
+ prefix: ['volt-accordion', 'ui-accordion'],
615
+ description: 'Volt UI Accordion',
616
+ body: [
617
+ '<ui-accordion type="${1|single,multiple|}" [collapsible]="true">',
618
+ ' <ui-accordion-item>',
619
+ ' <ui-accordion-trigger>${2:Question}</ui-accordion-trigger>',
620
+ ' <ui-accordion-content>${3:Answer}</ui-accordion-content>',
621
+ ' </ui-accordion-item>',
622
+ '</ui-accordion>',
623
+ ],
624
+ },
625
+ 'Volt UI Checkbox': {
626
+ prefix: ['volt-checkbox', 'ui-checkbox'],
627
+ description: 'Volt UI Checkbox',
628
+ body: ['<ui-checkbox [(checked)]="${1:checked}">${2:Label}</ui-checkbox>'],
629
+ },
630
+ 'Volt UI Switch': {
631
+ prefix: ['volt-switch', 'ui-switch'],
632
+ description: 'Volt UI Switch',
633
+ body: ['<ui-switch [(checked)]="${1:enabled}">${2:Label}</ui-switch>'],
634
+ },
635
+ 'Volt UI Radio': {
636
+ prefix: ['volt-radio', 'ui-radio'],
637
+ description: 'Volt UI Radio Group',
638
+ body: [
639
+ '<ui-radio-group [(value)]="${1:selectedValue}">',
640
+ ' <ui-radio-item value="${2:option1}">${3:Option 1}</ui-radio-item>',
641
+ ' <ui-radio-item value="${4:option2}">${5:Option 2}</ui-radio-item>',
642
+ '</ui-radio-group>',
643
+ ],
644
+ },
645
+ 'Volt UI Avatar': {
646
+ prefix: ['volt-avatar', 'ui-avatar'],
647
+ description: 'Volt UI Avatar',
648
+ body: [
649
+ '<ui-avatar>',
650
+ ' <img uiAvatarImage [src]="${1:url}" [alt]="${2:User}" />',
651
+ ' <ui-avatar-fallback>${3:JD}</ui-avatar-fallback>',
652
+ '</ui-avatar>',
653
+ ],
654
+ },
655
+ 'Volt UI Tooltip': {
656
+ prefix: ['volt-tooltip', 'ui-tooltip'],
657
+ description: 'Volt UI Tooltip',
658
+ body: [
659
+ '<button uiTooltip [uiTooltip]="tooltipTpl">${1:Hover me}</button>',
660
+ '<ng-template #tooltipTpl>',
661
+ ' <ui-tooltip-content>${2:Tooltip text}</ui-tooltip-content>',
662
+ '</ng-template>',
663
+ ],
664
+ },
665
+ 'Volt UI Badge': {
666
+ prefix: ['volt-badge', 'ui-badge'],
667
+ description: 'Volt UI Badge',
668
+ body: [
669
+ '<ui-badge variant="${1|default,secondary,outline,destructive|}">${2:Label}</ui-badge>',
670
+ ],
671
+ },
672
+ 'Volt UI Dialog': {
673
+ prefix: ['volt-dialog', 'ui-dialog'],
674
+ description: 'Volt UI Dialog',
675
+ body: [
676
+ '<button [uiDialog]="${1:dialogTpl}">${2:Open Dialog}</button>',
677
+ '<ng-template #${1:dialogTpl} let-close="close">',
678
+ ' <div uiDialogOverlay></div>',
679
+ ' <div uiDialogContent>',
680
+ ' <h2 uiDialogTitle>${3:Title}</h2>',
681
+ ' <p uiDialogDescription>${4:Description}</p>',
682
+ ' </div>',
683
+ '</ng-template>',
684
+ ],
685
+ },
686
+ 'Volt UI Popover': {
687
+ prefix: ['volt-popover', 'ui-popover'],
688
+ description: 'Volt UI Popover',
689
+ body: [
690
+ '<button uiPopover [uiPopover]="${1:popoverTpl}">${2:Open}</button>',
691
+ '<ng-template #${1:popoverTpl}>',
692
+ ' <ui-popover-content>${3:Content}</ui-popover-content>',
693
+ '</ng-template>',
694
+ ],
695
+ },
696
+ 'Volt UI Dropdown Menu': {
697
+ prefix: ['volt-dropdown-menu', 'ui-dropdown-menu'],
698
+ description: 'Volt UI Dropdown Menu',
699
+ body: [
700
+ '<button [uiDropdownMenu]="${1:menuTpl}">${2:Menu}</button>',
701
+ '<ng-template #${1:menuTpl}>',
702
+ ' <ui-dropdown-menu>',
703
+ ' <ui-dropdown-menu-item>${3:Item}</ui-dropdown-menu-item>',
704
+ ' </ui-dropdown-menu>',
705
+ '</ng-template>',
706
+ ],
707
+ },
708
+ 'Volt UI Slider': {
709
+ prefix: ['volt-slider', 'ui-slider'],
710
+ description: 'Volt UI Slider',
711
+ body: ['<ui-slider [min]="${1:0}" [max]="${2:100}" [(value)]="${3:value}" />'],
712
+ },
713
+ 'Volt UI Range Slider': {
714
+ prefix: ['volt-range-slider', 'ui-range-slider'],
715
+ description: 'Volt UI Range Slider',
716
+ body: [
717
+ '<ui-range-slider [min]="${1:0}" [max]="${2:100}" [(low)]="${3:low}" [(high)]="${4:high}" />',
718
+ ],
719
+ },
720
+ 'Volt UI Progress': {
721
+ prefix: ['volt-progress', 'ui-progress'],
722
+ description: 'Volt UI Progress',
723
+ body: [
724
+ '<ui-progress [value]="${1:60}" [max]="${2:100}">',
725
+ ' <ui-progress-label>${3:Loading}</ui-progress-label>',
726
+ ' <ui-progress-value>${1:60}%</ui-progress-value>',
727
+ '</ui-progress>',
728
+ ],
729
+ },
730
+ 'Volt UI Skeleton': {
731
+ prefix: ['volt-skeleton', 'ui-skeleton'],
732
+ description: 'Volt UI Skeleton',
733
+ body: [
734
+ '<ui-skeleton variant="${1|text,circle,rectangle|}" width="${2:120px}" height="${3:16px}" />',
735
+ ],
736
+ },
737
+ 'Volt UI Table': {
738
+ prefix: ['volt-table', 'ui-table'],
739
+ description: 'Volt UI Table',
740
+ body: [
741
+ '<ui-table>',
742
+ ' <ui-table-header>',
743
+ ' <ui-table-row>',
744
+ ' <ui-table-head>${1:Column}</ui-table-head>',
745
+ ' </ui-table-row>',
746
+ ' </ui-table-header>',
747
+ ' <ui-table-body>',
748
+ ' <ui-table-row>',
749
+ ' <ui-table-cell>${2:Cell}</ui-table-cell>',
750
+ ' </ui-table-row>',
751
+ ' </ui-table-body>',
752
+ '</ui-table>',
753
+ ],
754
+ },
755
+ 'Volt Theme Provider': {
756
+ prefix: ['volt-theme', 'provide-volt-theme'],
757
+ description: 'Provide Volt theme in app config',
758
+ body: [
759
+ "import { provideVoltTheme } from '@voltui/components';",
760
+ '',
761
+ 'providers: [',
762
+ ' provideVoltTheme({',
763
+ " color: '${1|volt,ember,sage,dusk,glacier|}',",
764
+ " style: '${2|sharp,soft,brutal,ghost,retro|}',",
765
+ ' dark: ${3|false,true|}',
766
+ ' })',
767
+ ']',
768
+ ],
769
+ },
770
+ 'Volt UI Import Button': {
771
+ prefix: ['import-ui-button'],
772
+ description: 'Import Volt UI Button',
773
+ body: ["import { UiButton } from './ui/button';"],
774
+ },
775
+ 'Volt UI Import Card': {
776
+ prefix: ['import-ui-card'],
777
+ description: 'Import Volt UI Card',
778
+ body: [
779
+ "import { UiCard, UiCardHeader, UiCardTitle, UiCardDescription, UiCardContent, UiCardFooter } from './ui/card';",
780
+ ],
781
+ },
782
+ };
783
+
784
+ return { CURSOR_RULES, COPILOT_INSTRUCTIONS, VOLT_UI_SKILL, VSCODE_SNIPPETS };
785
+ }
786
+
787
+ module.exports = { DEFAULT_MCP_URL, buildContent };