@voltui/agent 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -21
- package/content.js +16 -538
- package/installer.js +216 -18
- package/package.json +7 -4
- package/skills/volt-ui/SKILL.md +50 -0
- package/skills/volt-ui-adoption/SKILL.md +77 -0
- package/skills/volt-ui-component-selection/SKILL.md +231 -0
- package/skills/volt-ui-distribution/SKILL.md +139 -0
- package/skills/volt-ui-forms/SKILL.md +87 -0
- package/skills/volt-ui-overlays/SKILL.md +72 -0
- package/skills/volt-ui-styling/SKILL.md +79 -0
- package/skills.js +74 -0
package/installer.js
CHANGED
|
@@ -31,18 +31,38 @@ const BLOCK_START =
|
|
|
31
31
|
'<!-- volt-ui:begin (managed by @voltui/agent — edits inside are overwritten) -->';
|
|
32
32
|
const BLOCK_END = '<!-- volt-ui:end -->';
|
|
33
33
|
|
|
34
|
+
// A block lives inside a file the user also edits, so its markers must be a comment in that file's
|
|
35
|
+
// own syntax: HTML for Markdown rules files, `#` for TOML.
|
|
36
|
+
const MARKERS = {
|
|
37
|
+
html: { start: BLOCK_START, end: BLOCK_END },
|
|
38
|
+
hash: {
|
|
39
|
+
start: '# volt-ui:begin (managed by @voltui/agent — edits inside are overwritten)',
|
|
40
|
+
end: '# volt-ui:end',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
const markersOf = spec => MARKERS[spec.style ?? 'html'];
|
|
44
|
+
|
|
34
45
|
// ---------------------------------------------------------------------------
|
|
35
46
|
// Agent plans
|
|
36
47
|
//
|
|
37
48
|
// An agent is a list of files. `kind` decides how an existing file is treated:
|
|
38
49
|
// json merged into the existing JSON (the user's other keys survive)
|
|
39
|
-
// block a delimited block inside a file the user also edits
|
|
50
|
+
// block a delimited block inside a file the user also edits (`style`: html | hash comment markers)
|
|
40
51
|
// owned a file that is entirely Volt's (rewritten each run, deleted on uninstall)
|
|
41
52
|
// ---------------------------------------------------------------------------
|
|
42
53
|
|
|
43
54
|
function buildAgents(mcpUrl) {
|
|
44
|
-
const { CURSOR_RULES, COPILOT_INSTRUCTIONS,
|
|
55
|
+
const { CURSOR_RULES, COPILOT_INSTRUCTIONS, WINDSURF_RULES, VOLT_UI_SKILLS, VSCODE_SNIPPETS } =
|
|
45
56
|
buildContent(mcpUrl);
|
|
57
|
+
// One owned file per skill, in the directory the agent scans: .claude/skills/<name>/ or
|
|
58
|
+
// .agents/skills/<name>/. The skills are the full playbooks; agents that cannot load them get
|
|
59
|
+
// the same digests in a rules block instead.
|
|
60
|
+
const skillFiles = dir =>
|
|
61
|
+
Object.entries(VOLT_UI_SKILLS).map(([name, content]) => ({
|
|
62
|
+
path: `${dir}/${name}/SKILL.md`,
|
|
63
|
+
kind: 'owned',
|
|
64
|
+
content,
|
|
65
|
+
}));
|
|
46
66
|
// Cursor / Windsurf accept a bare `url` entry; Claude Code's `.mcp.json` and VS Code's
|
|
47
67
|
// `.vscode/mcp.json` use the `http` transport type.
|
|
48
68
|
const urlEntry = { type: 'url', url: mcpUrl };
|
|
@@ -63,10 +83,10 @@ function buildAgents(mcpUrl) {
|
|
|
63
83
|
content: { mcpServers: { 'volt-ui': httpEntry } },
|
|
64
84
|
owns: ['mcpServers', 'volt-ui'],
|
|
65
85
|
},
|
|
66
|
-
|
|
86
|
+
...skillFiles('.claude/skills'),
|
|
67
87
|
],
|
|
68
88
|
notes: [
|
|
69
|
-
'Restart Claude Code for the MCP server and
|
|
89
|
+
'Restart Claude Code for the MCP server and skills to load.',
|
|
70
90
|
'Claude Desktop: remote MCP servers are added via Settings -> Connectors, not by editing claude_desktop_config.json.',
|
|
71
91
|
],
|
|
72
92
|
},
|
|
@@ -81,7 +101,10 @@ function buildAgents(mcpUrl) {
|
|
|
81
101
|
},
|
|
82
102
|
{ path: '.cursorrules', kind: 'block', content: CURSOR_RULES },
|
|
83
103
|
],
|
|
84
|
-
notes: [
|
|
104
|
+
notes: [
|
|
105
|
+
'Restart Cursor for MCP changes to take effect.',
|
|
106
|
+
'Cursor reads a rules file, not skills: .cursorrules carries the digests of the Volt skills.',
|
|
107
|
+
],
|
|
85
108
|
},
|
|
86
109
|
windsurf: {
|
|
87
110
|
label: 'Windsurf',
|
|
@@ -92,8 +115,12 @@ function buildAgents(mcpUrl) {
|
|
|
92
115
|
content: { mcpServers: { 'volt-ui': urlEntry } },
|
|
93
116
|
owns: ['mcpServers', 'volt-ui'],
|
|
94
117
|
},
|
|
118
|
+
{ path: '.windsurfrules', kind: 'block', content: WINDSURF_RULES },
|
|
119
|
+
],
|
|
120
|
+
notes: [
|
|
121
|
+
'Restart Windsurf for MCP changes to take effect.',
|
|
122
|
+
'Windsurf reads a rules file, not skills: .windsurfrules carries the digests of the Volt skills.',
|
|
95
123
|
],
|
|
96
|
-
notes: ['Restart Windsurf for MCP changes to take effect.'],
|
|
97
124
|
},
|
|
98
125
|
copilot: {
|
|
99
126
|
label: 'GitHub Copilot (VS Code)',
|
|
@@ -112,6 +139,55 @@ function buildAgents(mcpUrl) {
|
|
|
112
139
|
'The instructions file gives Copilot Chat context even where MCP is unavailable.',
|
|
113
140
|
],
|
|
114
141
|
},
|
|
142
|
+
codex: {
|
|
143
|
+
label: 'OpenAI Codex',
|
|
144
|
+
files: [
|
|
145
|
+
{
|
|
146
|
+
path: '.codex/config.toml',
|
|
147
|
+
kind: 'block',
|
|
148
|
+
style: 'hash',
|
|
149
|
+
content: `[mcp_servers.volt-ui]\nurl = "${mcpUrl}"`,
|
|
150
|
+
unlessPresent: /^\s*\[mcp_servers\.(?:"volt-ui"|volt-ui)\]/m,
|
|
151
|
+
},
|
|
152
|
+
...skillFiles('.agents/skills'),
|
|
153
|
+
],
|
|
154
|
+
notes: [
|
|
155
|
+
'Codex reads .codex/config.toml only for projects you have marked as trusted.',
|
|
156
|
+
'Restart Codex for the MCP server and skills to load.',
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
gemini: {
|
|
160
|
+
label: 'Gemini CLI',
|
|
161
|
+
files: [
|
|
162
|
+
{
|
|
163
|
+
path: '.gemini/settings.json',
|
|
164
|
+
kind: 'json',
|
|
165
|
+
content: { mcpServers: { 'volt-ui': { httpUrl: mcpUrl } } },
|
|
166
|
+
owns: ['mcpServers', 'volt-ui'],
|
|
167
|
+
},
|
|
168
|
+
{ path: 'GEMINI.md', kind: 'block', content: COPILOT_INSTRUCTIONS },
|
|
169
|
+
],
|
|
170
|
+
notes: [
|
|
171
|
+
'Restart Gemini CLI; `/mcp` lists the connected servers.',
|
|
172
|
+
'GEMINI.md carries the digests of the Volt skills (Gemini CLI is given a rules block, not skills).',
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
opencode: {
|
|
176
|
+
label: 'OpenCode',
|
|
177
|
+
files: [
|
|
178
|
+
{
|
|
179
|
+
path: 'opencode.json',
|
|
180
|
+
kind: 'json',
|
|
181
|
+
content: {
|
|
182
|
+
$schema: 'https://opencode.ai/config.json',
|
|
183
|
+
mcp: { 'volt-ui': { type: 'remote', url: mcpUrl, enabled: true } },
|
|
184
|
+
},
|
|
185
|
+
owns: ['mcp', 'volt-ui'],
|
|
186
|
+
},
|
|
187
|
+
...skillFiles('.agents/skills'),
|
|
188
|
+
],
|
|
189
|
+
notes: ['Restart OpenCode for the MCP server and skills to load.'],
|
|
190
|
+
},
|
|
115
191
|
vscode: {
|
|
116
192
|
label: 'VS Code (snippets)',
|
|
117
193
|
files: [snippets],
|
|
@@ -169,13 +245,13 @@ function parseJsonStrict(file, text) {
|
|
|
169
245
|
}
|
|
170
246
|
}
|
|
171
247
|
|
|
172
|
-
function wrapBlock(content) {
|
|
173
|
-
return `${
|
|
248
|
+
function wrapBlock(content, { start, end }) {
|
|
249
|
+
return `${start}\n${content.trim()}\n${end}\n`;
|
|
174
250
|
}
|
|
175
251
|
|
|
176
|
-
function blockPattern() {
|
|
252
|
+
function blockPattern({ start, end }) {
|
|
177
253
|
const esc = s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
178
|
-
return new RegExp(`${esc(
|
|
254
|
+
return new RegExp(`${esc(start)}[\\s\\S]*?${esc(end)}\\n?`);
|
|
179
255
|
}
|
|
180
256
|
|
|
181
257
|
function install(file, spec, dryRun) {
|
|
@@ -191,11 +267,16 @@ function install(file, spec, dryRun) {
|
|
|
191
267
|
}
|
|
192
268
|
|
|
193
269
|
if (spec.kind === 'block') {
|
|
194
|
-
const
|
|
270
|
+
const markers = markersOf(spec);
|
|
271
|
+
const block = wrapBlock(spec.content, markers);
|
|
195
272
|
let next;
|
|
196
273
|
if (existing === null) next = block;
|
|
197
|
-
else if (blockPattern().test(existing))
|
|
198
|
-
|
|
274
|
+
else if (blockPattern(markers).test(existing)) {
|
|
275
|
+
next = existing.replace(blockPattern(markers), () => block);
|
|
276
|
+
} else if (spec.unlessPresent?.test(existing)) {
|
|
277
|
+
// The user already configures this by hand; a second copy would be a duplicate TOML table.
|
|
278
|
+
return 'kept';
|
|
279
|
+
} else next = existing.replace(/\s*$/, '\n\n') + block;
|
|
199
280
|
if (existing === next) return 'unchanged';
|
|
200
281
|
write(file, next, dryRun);
|
|
201
282
|
return existing === null ? 'created' : 'updated';
|
|
@@ -218,16 +299,19 @@ function uninstall(file, spec, dryRun) {
|
|
|
218
299
|
delete json[group][key];
|
|
219
300
|
if (!Object.keys(json[group]).length) delete json[group];
|
|
220
301
|
if (!dryRun) {
|
|
221
|
-
|
|
302
|
+
// A lone `$schema` is what this installer wrote into a file it created; nothing of the user's.
|
|
303
|
+
const left = Object.keys(json).filter(k => k !== '$schema');
|
|
304
|
+
if (left.length) write(file, JSON.stringify(json, null, 2) + '\n', false);
|
|
222
305
|
else fs.rmSync(file);
|
|
223
306
|
}
|
|
224
307
|
return 'removed';
|
|
225
308
|
}
|
|
226
309
|
|
|
227
310
|
if (spec.kind === 'block') {
|
|
228
|
-
|
|
311
|
+
const markers = markersOf(spec);
|
|
312
|
+
if (!blockPattern(markers).test(existing)) return 'absent';
|
|
229
313
|
const next = existing
|
|
230
|
-
.replace(blockPattern(), '')
|
|
314
|
+
.replace(blockPattern(markers), '')
|
|
231
315
|
.replace(/\n{3,}/g, '\n\n')
|
|
232
316
|
.trim();
|
|
233
317
|
if (!dryRun) {
|
|
@@ -248,26 +332,33 @@ function uninstall(file, spec, dryRun) {
|
|
|
248
332
|
const HELP = `Volt UI agent setup (@voltui/agent ${VERSION})
|
|
249
333
|
|
|
250
334
|
Usage: npx @voltui/agent [agent...] [options]
|
|
335
|
+
npx @voltui/agent doctor [agent...] [options]
|
|
251
336
|
|
|
252
|
-
Agents: claude, cursor, windsurf, copilot, vscode
|
|
337
|
+
Agents: claude, cursor, windsurf, copilot, codex, gemini, opencode, vscode
|
|
253
338
|
With no agent and no --all, you are asked which to set up.
|
|
254
339
|
|
|
340
|
+
doctor checks what is installed: files up to date, and the MCP endpoint answering.
|
|
341
|
+
With no agent it checks every agent that has files in the project.
|
|
342
|
+
|
|
255
343
|
Options:
|
|
256
344
|
--all set up every agent
|
|
257
345
|
--dir <path> project directory (default: current directory)
|
|
258
346
|
--url <url> MCP endpoint to write (default: ${DEFAULT_MCP_URL})
|
|
259
347
|
--dry-run print what would change, write nothing
|
|
348
|
+
--offline doctor: skip the MCP endpoint check
|
|
260
349
|
--uninstall remove what this installer wrote (your other config is kept)
|
|
261
350
|
-y, --yes never prompt; with no agent given, set up every agent
|
|
262
351
|
-v, --version print the version
|
|
263
352
|
-h, --help print this help
|
|
264
353
|
|
|
265
|
-
Exit codes: 0 ok · 1 failed · 2 bad usage`;
|
|
354
|
+
Exit codes: 0 ok · 1 failed (doctor: a problem was found) · 2 bad usage`;
|
|
266
355
|
|
|
267
356
|
class UsageError extends Error {}
|
|
268
357
|
|
|
269
358
|
function parseArgs(argv, agentKeys) {
|
|
270
359
|
const opts = {
|
|
360
|
+
command: 'setup',
|
|
361
|
+
offline: false,
|
|
271
362
|
agents: [],
|
|
272
363
|
all: false,
|
|
273
364
|
dir: null,
|
|
@@ -300,12 +391,15 @@ function parseArgs(argv, agentKeys) {
|
|
|
300
391
|
if (flag === '--all') opts.all = true;
|
|
301
392
|
else if (flag === '--dry-run') opts.dryRun = true;
|
|
302
393
|
else if (flag === '--uninstall') opts.uninstall = true;
|
|
394
|
+
else if (flag === '--offline') opts.offline = true;
|
|
303
395
|
else if (flag === '-y' || flag === '--yes') opts.yes = true;
|
|
304
396
|
else if (flag === '-h' || flag === '--help') opts.help = true;
|
|
305
397
|
else if (flag === '-v' || flag === '--version') opts.version = true;
|
|
306
398
|
else if (flag === '--dir') opts.dir = next('--dir');
|
|
307
399
|
else if (flag === '--url') opts.url = next('--url');
|
|
308
400
|
else if (arg.startsWith('-')) throw new UsageError(`Unknown option: ${arg}`);
|
|
401
|
+
else if (arg === 'doctor' && opts.command === 'setup' && !opts.agents.length)
|
|
402
|
+
opts.command = 'doctor';
|
|
309
403
|
else if (agentKeys.includes(arg)) opts.agents.push(arg);
|
|
310
404
|
else throw new UsageError(`Unknown agent: ${arg}. Available: ${agentKeys.join(', ')}.`);
|
|
311
405
|
}
|
|
@@ -319,6 +413,9 @@ function parseArgs(argv, agentKeys) {
|
|
|
319
413
|
} catch {
|
|
320
414
|
throw new UsageError(`--url must be an http(s) URL, got: ${opts.url}`);
|
|
321
415
|
}
|
|
416
|
+
if (opts.command === 'doctor' && (opts.uninstall || opts.dryRun)) {
|
|
417
|
+
throw new UsageError('doctor only reads; --uninstall and --dry-run do not apply to it.');
|
|
418
|
+
}
|
|
322
419
|
opts.agents = [...new Set(opts.agents)];
|
|
323
420
|
return opts;
|
|
324
421
|
}
|
|
@@ -351,6 +448,87 @@ async function promptAgents(rl, agents, out) {
|
|
|
351
448
|
return [...new Set(picked)];
|
|
352
449
|
}
|
|
353
450
|
|
|
451
|
+
// ---------------------------------------------------------------------------
|
|
452
|
+
// doctor
|
|
453
|
+
// ---------------------------------------------------------------------------
|
|
454
|
+
|
|
455
|
+
const FILE_STATE = {
|
|
456
|
+
unchanged: 'ok',
|
|
457
|
+
kept: 'ok (your own entry)',
|
|
458
|
+
updated: 'outdated',
|
|
459
|
+
created: 'missing',
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
/** Ask the endpoint for an MCP `initialize`, the way a real client does. */
|
|
463
|
+
async function pingEndpoint(url, fetchImpl) {
|
|
464
|
+
const response = await fetchImpl(url, {
|
|
465
|
+
method: 'POST',
|
|
466
|
+
headers: { 'content-type': 'application/json', accept: 'application/json, text/event-stream' },
|
|
467
|
+
body: JSON.stringify({
|
|
468
|
+
jsonrpc: '2.0',
|
|
469
|
+
id: 1,
|
|
470
|
+
method: 'initialize',
|
|
471
|
+
params: {
|
|
472
|
+
protocolVersion: '2025-03-26',
|
|
473
|
+
capabilities: {},
|
|
474
|
+
clientInfo: { name: '@voltui/agent doctor', version: VERSION },
|
|
475
|
+
},
|
|
476
|
+
}),
|
|
477
|
+
signal: AbortSignal.timeout(10_000),
|
|
478
|
+
});
|
|
479
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
480
|
+
const json = await response.json();
|
|
481
|
+
const server = json?.result?.serverInfo;
|
|
482
|
+
if (!server) throw new Error(json?.error?.message ?? 'not an MCP initialize response');
|
|
483
|
+
return `${server.name} ${server.version}`;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
async function doctor({ agents, selected, projectDir, opts, out, fetchImpl }) {
|
|
487
|
+
out.log(`Checking: ${projectDir}`);
|
|
488
|
+
let problems = 0;
|
|
489
|
+
|
|
490
|
+
const keys = selected.length
|
|
491
|
+
? selected
|
|
492
|
+
: Object.keys(agents).filter(key =>
|
|
493
|
+
agents[key].files.some(spec => fs.existsSync(path.join(projectDir, spec.path)))
|
|
494
|
+
);
|
|
495
|
+
if (!keys.length) {
|
|
496
|
+
out.log('\nNo Volt UI agent files found here. Set one up with: npx @voltui/agent <agent>');
|
|
497
|
+
return 1;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
for (const key of keys) {
|
|
501
|
+
out.log(`\n${agents[key].label}`);
|
|
502
|
+
for (const spec of agents[key].files) {
|
|
503
|
+
let state;
|
|
504
|
+
try {
|
|
505
|
+
state = FILE_STATE[install(path.join(projectDir, spec.path), spec, true)];
|
|
506
|
+
} catch (err) {
|
|
507
|
+
state = `invalid — ${err.message}`;
|
|
508
|
+
}
|
|
509
|
+
if (!state.startsWith('ok')) problems++;
|
|
510
|
+
out.log(` ${state.padEnd(10)} ${spec.path}`);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if (!opts.offline) {
|
|
515
|
+
out.log(`\nMCP endpoint: ${opts.url}`);
|
|
516
|
+
try {
|
|
517
|
+
out.log(` ok ${await pingEndpoint(opts.url, fetchImpl)}`);
|
|
518
|
+
} catch (err) {
|
|
519
|
+
problems++;
|
|
520
|
+
out.log(` failed ${err.message}`);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
if (problems) {
|
|
525
|
+
out.log(`\n${problems} problem(s). Re-run \`npx @voltui/agent <agent>\` to repair the files.`);
|
|
526
|
+
return 1;
|
|
527
|
+
}
|
|
528
|
+
out.log('\nAll good.');
|
|
529
|
+
return 0;
|
|
530
|
+
}
|
|
531
|
+
|
|
354
532
|
// ---------------------------------------------------------------------------
|
|
355
533
|
// Entry point
|
|
356
534
|
// ---------------------------------------------------------------------------
|
|
@@ -378,6 +556,20 @@ async function run(argv, env = {}) {
|
|
|
378
556
|
let selected = opts.all ? Object.keys(agents) : opts.agents;
|
|
379
557
|
let projectDir = opts.dir ? path.resolve(cwd, opts.dir) : cwd;
|
|
380
558
|
|
|
559
|
+
if (opts.command === 'doctor') {
|
|
560
|
+
if (!fs.existsSync(projectDir) || !fs.statSync(projectDir).isDirectory()) {
|
|
561
|
+
throw new UsageError(`Project directory does not exist: ${projectDir}`);
|
|
562
|
+
}
|
|
563
|
+
return await doctor({
|
|
564
|
+
agents,
|
|
565
|
+
selected,
|
|
566
|
+
projectDir,
|
|
567
|
+
opts,
|
|
568
|
+
out,
|
|
569
|
+
fetchImpl: env.fetch ?? fetch,
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
|
|
381
573
|
if (!selected.length) {
|
|
382
574
|
if (opts.yes) selected = Object.keys(agents);
|
|
383
575
|
else if (!isTTY) {
|
|
@@ -425,6 +617,12 @@ async function run(argv, env = {}) {
|
|
|
425
617
|
out.log(' npx @voltui/cli init scaffold the ui/ folder');
|
|
426
618
|
out.log(' npx @voltui/cli add button add a component');
|
|
427
619
|
out.log(' npx @voltui/cli list list every component');
|
|
620
|
+
out.log(
|
|
621
|
+
' npx @voltui/cli diff button compare an edited copy with the CLI source (read-only)'
|
|
622
|
+
);
|
|
623
|
+
out.log(
|
|
624
|
+
' MCP find_compositions copy a block, layout or workflow from recipes.voltui.dev'
|
|
625
|
+
);
|
|
428
626
|
}
|
|
429
627
|
return 0;
|
|
430
628
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltui/agent",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Set up Volt UI for AI coding agents: the MCP server,
|
|
5
|
-
"homepage": "https://
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"description": "Set up Volt UI for AI coding agents: the MCP server, single-responsibility skills and rules for Claude Code, Codex, OpenCode, Cursor, Windsurf, Gemini CLI and GitHub Copilot",
|
|
5
|
+
"homepage": "https://voltui.dev/docs/ai-mcp",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/Andersseen/volt-ui.git",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"setup-agent.js",
|
|
19
19
|
"installer.js",
|
|
20
20
|
"content.js",
|
|
21
|
+
"skills.js",
|
|
22
|
+
"skills",
|
|
21
23
|
"README.md",
|
|
22
24
|
"LICENSE"
|
|
23
25
|
],
|
|
@@ -32,7 +34,8 @@
|
|
|
32
34
|
"copilot",
|
|
33
35
|
"ai",
|
|
34
36
|
"skills",
|
|
35
|
-
"agent"
|
|
37
|
+
"agent",
|
|
38
|
+
"angular-components"
|
|
36
39
|
],
|
|
37
40
|
"license": "MIT",
|
|
38
41
|
"engines": {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: volt-ui
|
|
3
|
+
description: >
|
|
4
|
+
Entry point for Volt UI, an Angular component library (ng-primitives, Tailwind v4, signals).
|
|
5
|
+
Use when a project imports from '@voltui/components' or has copied Volt source under src/app/ui,
|
|
6
|
+
or the user asks for UI in an app that uses Volt. Routes to the specialised volt-ui-* skills and
|
|
7
|
+
to the Volt MCP server, which is the source of exact component APIs.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Volt UI
|
|
11
|
+
|
|
12
|
+
Volt is a set of accessible Angular **atoms** (Button, Input, Card, Tabs, Dialog, Combobox…). The
|
|
13
|
+
app keeps its own layout, icons, state and domain components.
|
|
14
|
+
|
|
15
|
+
## Three rules
|
|
16
|
+
|
|
17
|
+
1. **Volt first.** Before writing UI, check whether Volt already owns the responsibility
|
|
18
|
+
(`volt-ui-adoption`). Do not rebuild Button, Card, Input, Badge, Alert, Tabs or an overlay with
|
|
19
|
+
raw Tailwind, and do not import `ng-primitives` to get around Volt.
|
|
20
|
+
2. **The MCP server is the source of exact facts.** Selectors, inputs, outputs, variants, status and
|
|
21
|
+
examples change between releases. Ask the `volt-ui` MCP server (`list_components`,
|
|
22
|
+
`find_components`, `get_component`, `get_usage_example`, `find_compositions`) instead of recalling
|
|
23
|
+
them. Never invent an input. It describes the source: `get_project_info` says what npm serves. If
|
|
24
|
+
the server is not connected, read the component's source or run `npx @voltui/cli list`.
|
|
25
|
+
3. **Match the project's mode.** Package mode imports `Volt*` from `'@voltui/components'` and uses
|
|
26
|
+
`volt-*` selectors. Copy mode has `Ui*` classes and `ui-*` selectors under `./ui`. Check which
|
|
27
|
+
(`volt-ui-distribution`) before writing a single import.
|
|
28
|
+
|
|
29
|
+
## Which skill
|
|
30
|
+
|
|
31
|
+
| You are about to… | Load |
|
|
32
|
+
| ------------------------------------------------------------------ | ----------------------------- |
|
|
33
|
+
| build any UI: buttons, cards, lists, states | `volt-ui-adoption` |
|
|
34
|
+
| choose between two similar components | `volt-ui-component-selection` |
|
|
35
|
+
| build a form, validation, a select or a search | `volt-ui-forms` |
|
|
36
|
+
| open a dialog, drawer, popover, menu, tooltip or toast | `volt-ui-overlays` |
|
|
37
|
+
| change colours, size, spacing or theme; override a component | `volt-ui-styling` |
|
|
38
|
+
| install, update or copy components; unsure of the import or prefix | `volt-ui-distribution` |
|
|
39
|
+
| install a Recipes block, layout, pattern or application starter | `volt-ui-distribution` |
|
|
40
|
+
|
|
41
|
+
Accessibility is part of every skill, not a separate step: Volt components carry the roles, keyboard
|
|
42
|
+
and focus behaviour, so the way to keep it is to use them as documented.
|
|
43
|
+
|
|
44
|
+
<!-- volt:digest:start -->
|
|
45
|
+
|
|
46
|
+
- Volt first: reuse an existing atom before hand-building UI; never import `ng-primitives` to bypass Volt.
|
|
47
|
+
- The `volt-ui` MCP server is the source of exact selectors, inputs, status and examples (`find_components`, `get_component`, `get_usage_example`); never invent an input.
|
|
48
|
+
- Match the project's mode: package (`Volt*`, `'@voltui/components'`) or copy (`Ui*`, `./ui`).
|
|
49
|
+
|
|
50
|
+
<!-- volt:digest:end -->
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: volt-ui-adoption
|
|
3
|
+
description: >
|
|
4
|
+
Prefer existing Volt UI atoms before hand-building equivalent UI in an Angular app. Use whenever
|
|
5
|
+
you are about to write a button, link-as-button, card, badge, alert, input, tabs, spinner,
|
|
6
|
+
skeleton, empty state or overlay in a project that uses Volt.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Prefer Volt atoms
|
|
10
|
+
|
|
11
|
+
Hand-built copies of what Volt ships drift from it: different focus rings, missing keyboard
|
|
12
|
+
behaviour, a theme that does not reach them. Reuse first.
|
|
13
|
+
|
|
14
|
+
## Before you write markup
|
|
15
|
+
|
|
16
|
+
1. **Inspect the project.** Does it already use Volt (imports from `@voltui/components`, or a
|
|
17
|
+
`ui/` folder from `@voltui/cli`)? Which mode? (`volt-ui-distribution`.) Which Volt components
|
|
18
|
+
does it already use? Match them.
|
|
19
|
+
2. **Ask the MCP server for the responsibility.** `find_components` with the intent
|
|
20
|
+
("dismissible confirmation", "status chip", "server-backed search") returns candidates with
|
|
21
|
+
`useWhen` / `notFor`; `get_component` returns the exact selector and inputs;
|
|
22
|
+
`get_usage_example` returns working markup.
|
|
23
|
+
3. **Reuse the atom if one exists.** Keep what is specific to the app — layout, copy, domain logic,
|
|
24
|
+
data fetching — in the app, around the atom.
|
|
25
|
+
4. **For a whole section, shell or workflow, start from a composition.** `find_compositions`
|
|
26
|
+
("pricing section", "dashboard shell", "settings form", "paged table") returns Recipes blocks,
|
|
27
|
+
layouts, patterns and two application starters (admin, product website) built from these atoms,
|
|
28
|
+
with install commands and the state the app owns. Install one (`volt composition add`, see
|
|
29
|
+
`volt-ui-distribution`) and adapt it rather than composing the same thing from scratch.
|
|
30
|
+
5. **Use native HTML where it is genuinely the right element**, and say why (below).
|
|
31
|
+
|
|
32
|
+
## Responsibility → atom
|
|
33
|
+
|
|
34
|
+
| You need | Use |
|
|
35
|
+
| --------------------------------------- | ---------------------------------------------------------- |
|
|
36
|
+
| a clickable action | `Button` (`<button voltButton>`) |
|
|
37
|
+
| a router link that looks like an action | `<a voltButton routerLink>` — never a button inside a link |
|
|
38
|
+
| a status chip or count | `Badge` |
|
|
39
|
+
| a feedback panel | `Alert` |
|
|
40
|
+
| an empty application state | `EmptyState` |
|
|
41
|
+
| something is loading | `Spinner` (indeterminate) or `Skeleton` (shape of content) |
|
|
42
|
+
| a grouped surface | `Card` |
|
|
43
|
+
| choose one of many, searchable | `Combobox`; server data → `filterMode="manual"` |
|
|
44
|
+
|
|
45
|
+
The exact selectors and inputs come from the MCP server, not from this table.
|
|
46
|
+
|
|
47
|
+
## Do not
|
|
48
|
+
|
|
49
|
+
- Re-implement an atom's look with `rounded-md px-4 py-2 bg-primary text-primary-foreground`.
|
|
50
|
+
Use `variant` / `size`, and `class` to adjust.
|
|
51
|
+
- Import `ng-primitives/*` in an application that consumes Volt. Volt re-exports what a consumer
|
|
52
|
+
needs; if something is missing, that is a Volt gap to report, not a reason to bypass it.
|
|
53
|
+
- Nest interactive elements (a `<button>` inside an `<a>`).
|
|
54
|
+
- Copy a Volt component's internals into your component to tweak it. Use its inputs and `class`.
|
|
55
|
+
|
|
56
|
+
## Native HTML is fine when
|
|
57
|
+
|
|
58
|
+
- there is no Volt equivalent (a `<details>`, a `<dl>`, an `<img>`);
|
|
59
|
+
- the native element is the point: route-backed tab strips are real anchors because the router
|
|
60
|
+
owns selection and middle-click should work;
|
|
61
|
+
- you are deliberately demonstrating the element itself.
|
|
62
|
+
|
|
63
|
+
Prefer Volt **responsibility**, not Volt tag count.
|
|
64
|
+
|
|
65
|
+
## If Volt cannot do it
|
|
66
|
+
|
|
67
|
+
Say so. Do not silently work around it with raw Tailwind: that hides the gap from the people who
|
|
68
|
+
could close it. Use the closest atom, note the limitation, and suggest an upstream issue.
|
|
69
|
+
|
|
70
|
+
<!-- volt:digest:start -->
|
|
71
|
+
|
|
72
|
+
- Before writing UI, check whether Volt already owns the responsibility (MCP `find_components`); reuse the atom and keep layout, copy and domain logic in the app.
|
|
73
|
+
- For a page section, app shell, workflow or whole app, `find_compositions` first and install the Recipes composition or starter.
|
|
74
|
+
- Never rebuild Button, Card, Input, Badge, Alert, Tabs or an overlay with raw Tailwind, and never import `ng-primitives` in an app that consumes Volt.
|
|
75
|
+
- Native HTML is right only where Volt has no equivalent or the native element is the point (route-backed tab strips are real anchors). If Volt cannot do something, say so instead of working around it silently.
|
|
76
|
+
|
|
77
|
+
<!-- volt:digest:end -->
|