@agentuity/cli 0.1.34 → 0.1.36

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 (114) hide show
  1. package/bin/cli.ts +110 -6
  2. package/dist/cmd/ai/index.d.ts.map +1 -1
  3. package/dist/cmd/ai/index.js +0 -6
  4. package/dist/cmd/ai/index.js.map +1 -1
  5. package/dist/cmd/ai/opencode/uninstall.js +1 -1
  6. package/dist/cmd/ai/opencode/uninstall.js.map +1 -1
  7. package/dist/cmd/build/vite/bun-dev-server.d.ts +6 -0
  8. package/dist/cmd/build/vite/bun-dev-server.d.ts.map +1 -1
  9. package/dist/cmd/build/vite/bun-dev-server.js +100 -33
  10. package/dist/cmd/build/vite/bun-dev-server.js.map +1 -1
  11. package/dist/cmd/cloud/apikey/create.d.ts.map +1 -1
  12. package/dist/cmd/cloud/apikey/create.js +1 -1
  13. package/dist/cmd/cloud/apikey/create.js.map +1 -1
  14. package/dist/cmd/cloud/deploy.d.ts.map +1 -1
  15. package/dist/cmd/cloud/deploy.js +4 -1
  16. package/dist/cmd/cloud/deploy.js.map +1 -1
  17. package/dist/cmd/cloud/env/delete.d.ts.map +1 -1
  18. package/dist/cmd/cloud/env/delete.js +100 -45
  19. package/dist/cmd/cloud/env/delete.js.map +1 -1
  20. package/dist/cmd/cloud/env/pull.d.ts.map +1 -1
  21. package/dist/cmd/cloud/env/pull.js +1 -1
  22. package/dist/cmd/cloud/env/pull.js.map +1 -1
  23. package/dist/cmd/cloud/machine/delete.js +1 -1
  24. package/dist/cmd/cloud/machine/delete.js.map +1 -1
  25. package/dist/cmd/dev/index.d.ts.map +1 -1
  26. package/dist/cmd/dev/index.js +58 -10
  27. package/dist/cmd/dev/index.js.map +1 -1
  28. package/dist/cmd/index.d.ts.map +1 -1
  29. package/dist/cmd/index.js +1 -0
  30. package/dist/cmd/index.js.map +1 -1
  31. package/dist/cmd/support/index.d.ts +2 -0
  32. package/dist/cmd/support/index.d.ts.map +1 -0
  33. package/dist/cmd/support/index.js +11 -0
  34. package/dist/cmd/support/index.js.map +1 -0
  35. package/dist/cmd/support/logs/index.d.ts +3 -0
  36. package/dist/cmd/support/logs/index.d.ts.map +1 -0
  37. package/dist/cmd/support/logs/index.js +9 -0
  38. package/dist/cmd/support/logs/index.js.map +1 -0
  39. package/dist/cmd/support/logs/path.d.ts +3 -0
  40. package/dist/cmd/support/logs/path.d.ts.map +1 -0
  41. package/dist/cmd/support/logs/path.js +52 -0
  42. package/dist/cmd/support/logs/path.js.map +1 -0
  43. package/dist/cmd/support/logs/show.d.ts +3 -0
  44. package/dist/cmd/support/logs/show.d.ts.map +1 -0
  45. package/dist/cmd/support/logs/show.js +121 -0
  46. package/dist/cmd/support/logs/show.js.map +1 -0
  47. package/dist/cmd/support/report.d.ts +3 -0
  48. package/dist/cmd/support/report.d.ts.map +1 -0
  49. package/dist/cmd/support/report.js +299 -0
  50. package/dist/cmd/support/report.js.map +1 -0
  51. package/dist/cmd/support/system.d.ts +3 -0
  52. package/dist/cmd/support/system.d.ts.map +1 -0
  53. package/dist/cmd/support/system.js +120 -0
  54. package/dist/cmd/support/system.js.map +1 -0
  55. package/dist/cmd/version/index.d.ts.map +1 -1
  56. package/dist/cmd/version/index.js +1 -0
  57. package/dist/cmd/version/index.js.map +1 -1
  58. package/dist/composite-logger.d.ts +35 -0
  59. package/dist/composite-logger.d.ts.map +1 -0
  60. package/dist/composite-logger.js +78 -0
  61. package/dist/composite-logger.js.map +1 -0
  62. package/dist/index.d.ts +2 -0
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +2 -0
  65. package/dist/index.js.map +1 -1
  66. package/dist/internal-logger.d.ts +77 -0
  67. package/dist/internal-logger.d.ts.map +1 -0
  68. package/dist/internal-logger.js +363 -0
  69. package/dist/internal-logger.js.map +1 -0
  70. package/dist/types.d.ts +6 -0
  71. package/dist/types.d.ts.map +1 -1
  72. package/dist/types.js.map +1 -1
  73. package/package.json +6 -6
  74. package/src/cmd/ai/index.ts +0 -6
  75. package/src/cmd/ai/opencode/uninstall.ts +1 -1
  76. package/src/cmd/build/vite/bun-dev-server.ts +113 -36
  77. package/src/cmd/cloud/apikey/create.ts +3 -1
  78. package/src/cmd/cloud/deploy.ts +4 -1
  79. package/src/cmd/cloud/env/delete.ts +100 -45
  80. package/src/cmd/cloud/env/pull.ts +1 -6
  81. package/src/cmd/cloud/machine/delete.ts +1 -1
  82. package/src/cmd/dev/index.ts +59 -11
  83. package/src/cmd/index.ts +1 -0
  84. package/src/cmd/support/index.ts +11 -0
  85. package/src/cmd/support/logs/index.ts +9 -0
  86. package/src/cmd/support/logs/path.ts +56 -0
  87. package/src/cmd/support/logs/show.ts +144 -0
  88. package/src/cmd/support/report.ts +364 -0
  89. package/src/cmd/support/system.ts +130 -0
  90. package/src/cmd/version/index.ts +1 -0
  91. package/src/composite-logger.ts +86 -0
  92. package/src/index.ts +7 -0
  93. package/src/internal-logger.ts +435 -0
  94. package/src/types.ts +6 -0
  95. package/dist/cmd/ai/skills/generate.d.ts +0 -3
  96. package/dist/cmd/ai/skills/generate.d.ts.map +0 -1
  97. package/dist/cmd/ai/skills/generate.js +0 -65
  98. package/dist/cmd/ai/skills/generate.js.map +0 -1
  99. package/dist/cmd/ai/skills/generator.d.ts +0 -4
  100. package/dist/cmd/ai/skills/generator.d.ts.map +0 -1
  101. package/dist/cmd/ai/skills/generator.js +0 -410
  102. package/dist/cmd/ai/skills/generator.js.map +0 -1
  103. package/dist/cmd/ai/skills/index.d.ts +0 -4
  104. package/dist/cmd/ai/skills/index.d.ts.map +0 -1
  105. package/dist/cmd/ai/skills/index.js +0 -21
  106. package/dist/cmd/ai/skills/index.js.map +0 -1
  107. package/dist/cmd/dev/skills.d.ts +0 -10
  108. package/dist/cmd/dev/skills.d.ts.map +0 -1
  109. package/dist/cmd/dev/skills.js +0 -57
  110. package/dist/cmd/dev/skills.js.map +0 -1
  111. package/src/cmd/ai/skills/generate.ts +0 -75
  112. package/src/cmd/ai/skills/generator.ts +0 -527
  113. package/src/cmd/ai/skills/index.ts +0 -23
  114. package/src/cmd/dev/skills.ts +0 -82
@@ -1,527 +0,0 @@
1
- import type {
2
- CLISchema,
3
- SchemaCommand,
4
- SchemaOption,
5
- SchemaArgument,
6
- } from '../../../schema-generator';
7
- import * as path from 'node:path';
8
-
9
- interface SkillInfo {
10
- skillPath: string;
11
- skillName: string;
12
- command: SchemaCommand;
13
- fullCommandPath: string[];
14
- }
15
-
16
- const EXCLUDED_COMMANDS = new Set([
17
- 'ai',
18
- 'help',
19
- 'version',
20
- 'canary',
21
- 'setup',
22
- 'profile',
23
- 'upgrade',
24
- ]);
25
-
26
- function isValidSkillName(name: string): boolean {
27
- if (name.length < 1 || name.length > 64) return false;
28
- if (!/^[a-z0-9-]+$/.test(name)) return false;
29
- if (name.startsWith('-') || name.endsWith('-')) return false;
30
- if (name.includes('--')) return false;
31
- return true;
32
- }
33
-
34
- function toSkillName(parts: string[]): string {
35
- return parts.join('-').toLowerCase();
36
- }
37
-
38
- function enhanceDescription(command: SchemaCommand, fullPath: string[]): string {
39
- let description = command.description;
40
-
41
- const context = getCommandContext(command, fullPath);
42
- if (context) {
43
- description = `${description}. ${context}`;
44
- }
45
-
46
- if (description.length > 1024) {
47
- description = description.substring(0, 1021) + '...';
48
- }
49
-
50
- return description;
51
- }
52
-
53
- function getCommandContext(command: SchemaCommand, fullPath: string[]): string {
54
- const parts: string[] = [];
55
-
56
- if (command.requires?.auth) {
57
- parts.push('Requires authentication');
58
- }
59
-
60
- if (fullPath.includes('cloud')) {
61
- parts.push('Use for Agentuity cloud platform operations');
62
- } else if (fullPath.includes('auth')) {
63
- parts.push('Use for managing authentication credentials');
64
- } else if (fullPath.includes('project')) {
65
- parts.push('Use for project management operations');
66
- }
67
-
68
- return parts.join('. ');
69
- }
70
-
71
- function collectLeafCommands(
72
- command: SchemaCommand,
73
- parentPath: string[],
74
- baseDir: string,
75
- _isHidden: boolean
76
- ): SkillInfo[] {
77
- const skills: SkillInfo[] = [];
78
- const currentPath = [...parentPath, command.name];
79
-
80
- // Skip commands marked with skipSkill
81
- if (command.skipSkill) {
82
- return skills;
83
- }
84
-
85
- // Skip toplevel aliases (subcommands that have toplevel: true create duplicates)
86
- if (command.toplevel && parentPath.length === 0) {
87
- return skills;
88
- }
89
-
90
- if (command.subcommands && command.subcommands.length > 0) {
91
- for (const sub of command.subcommands) {
92
- skills.push(...collectLeafCommands(sub, currentPath, baseDir, _isHidden));
93
- }
94
- } else {
95
- const skillName = `agentuity-cli-${toSkillName(currentPath)}`;
96
-
97
- if (!isValidSkillName(skillName)) {
98
- return skills;
99
- }
100
-
101
- const skillPath = path.join(baseDir, skillName, 'SKILL.md');
102
-
103
- skills.push({
104
- skillPath,
105
- skillName,
106
- command,
107
- fullCommandPath: currentPath,
108
- });
109
- }
110
-
111
- return skills;
112
- }
113
-
114
- function formatPrerequisites(command: SchemaCommand): string[] {
115
- const prereqs: string[] = [];
116
-
117
- if (command.requires?.auth) {
118
- prereqs.push('Authenticated with `agentuity auth login`');
119
- }
120
-
121
- if (command.requires?.project) {
122
- prereqs.push('Project context required (run from project directory or use `--project-id`)');
123
- }
124
-
125
- if (command.requires?.org) {
126
- prereqs.push('Organization context required (`--org-id` or default org)');
127
- }
128
-
129
- if (command.prerequisites) {
130
- prereqs.push(...command.prerequisites);
131
- }
132
-
133
- return prereqs;
134
- }
135
-
136
- function formatOptionsTable(options: SchemaOption[]): string {
137
- if (options.length === 0) return '';
138
-
139
- const lines: string[] = [
140
- '| Option | Type | Required | Default | Description |',
141
- '|--------|------|----------|---------|-------------|',
142
- ];
143
-
144
- for (const opt of options) {
145
- const optName = `\`--${opt.name}\``;
146
- const optType = opt.enum ? opt.enum.join(' \\| ') : opt.type;
147
- const required = opt.required ? 'Yes' : 'No';
148
- const defaultVal = opt.default !== undefined ? `\`${JSON.stringify(opt.default)}\`` : '-';
149
- const desc = opt.description ?? '-';
150
-
151
- lines.push(`| ${optName} | ${optType} | ${required} | ${defaultVal} | ${desc} |`);
152
- }
153
-
154
- return lines.join('\n');
155
- }
156
-
157
- function formatArgumentsTable(args: SchemaArgument[]): string {
158
- if (args.length === 0) return '';
159
-
160
- const lines: string[] = [
161
- '| Argument | Type | Required | Description |',
162
- '|----------|------|----------|-------------|',
163
- ];
164
-
165
- for (const arg of args) {
166
- const argName = `\`<${arg.name}${arg.variadic ? '...' : ''}>\``;
167
- const argType = arg.variadic ? 'array' : arg.type;
168
- const required = arg.required ? 'Yes' : 'No';
169
- const desc = arg.description ?? '-';
170
-
171
- lines.push(`| ${argName} | ${argType} | ${required} | ${desc} |`);
172
- }
173
-
174
- return lines.join('\n');
175
- }
176
-
177
- function formatExamples(command: SchemaCommand): string {
178
- if (!command.examples || command.examples.length === 0) {
179
- return '';
180
- }
181
-
182
- const lines: string[] = [];
183
-
184
- for (const example of command.examples) {
185
- lines.push(`${example.description}:`);
186
- lines.push('');
187
- lines.push('```bash');
188
- lines.push(example.command);
189
- lines.push('```');
190
- lines.push('');
191
- }
192
-
193
- return lines.join('\n').trim();
194
- }
195
-
196
- function formatResponse(command: SchemaCommand): string {
197
- if (!command.response) {
198
- return '';
199
- }
200
-
201
- const response = command.response as Record<string, unknown>;
202
- const lines: string[] = [];
203
-
204
- if (response.type === 'object' && response.properties) {
205
- const props = response.properties as Record<string, { type?: string; description?: string }>;
206
-
207
- lines.push('Returns JSON object:');
208
- lines.push('');
209
- lines.push('```json');
210
- const sample: Record<string, string> = {};
211
- for (const [key, val] of Object.entries(props)) {
212
- sample[key] = val.type ?? 'unknown';
213
- }
214
- lines.push(JSON.stringify(sample, null, 2));
215
- lines.push('```');
216
- lines.push('');
217
- lines.push('| Field | Type | Description |');
218
- lines.push('|-------|------|-------------|');
219
-
220
- for (const [key, val] of Object.entries(props)) {
221
- lines.push(`| \`${key}\` | ${val.type ?? 'unknown'} | ${val.description ?? '-'} |`);
222
- }
223
- } else if (response.type) {
224
- lines.push(`Returns: \`${response.type}\``);
225
- }
226
-
227
- return lines.join('\n');
228
- }
229
-
230
- function buildUsageString(command: SchemaCommand, fullPath: string[]): string {
231
- const parts = ['agentuity', ...fullPath];
232
-
233
- if (command.arguments) {
234
- for (const arg of command.arguments) {
235
- const argStr = arg.required
236
- ? `<${arg.name}${arg.variadic ? '...' : ''}>`
237
- : `[${arg.name}${arg.variadic ? '...' : ''}]`;
238
- parts.push(argStr);
239
- }
240
- }
241
-
242
- if (command.options && command.options.length > 0) {
243
- parts.push('[options]');
244
- }
245
-
246
- return parts.join(' ');
247
- }
248
-
249
- function escapeYamlString(str: string): string {
250
- // Check if string needs quoting:
251
- // - Contains YAML special characters
252
- // - Has leading/trailing whitespace
253
- // - Looks like a boolean, null, or number
254
- // - Contains control characters
255
- const specialCharsRegex = /[:[\]{}#&*!|>'"%@`,?<>=~-]/;
256
- // eslint-disable-next-line no-control-regex
257
- const controlCharsRegex = new RegExp('[\\x00-\\x1f\\x7f]');
258
- const needsQuoting =
259
- specialCharsRegex.test(str) ||
260
- controlCharsRegex.test(str) ||
261
- str !== str.trim() ||
262
- /^(true|false|yes|no|on|off|null|~)$/i.test(str) ||
263
- /^-?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i.test(str) ||
264
- str === '';
265
-
266
- if (!needsQuoting) {
267
- return str;
268
- }
269
-
270
- // Escape special characters for double-quoted YAML string
271
- // eslint-disable-next-line no-control-regex
272
- const nonPrintableRegex = new RegExp('[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]', 'g');
273
- const escaped = str
274
- .replace(/\\/g, '\\\\')
275
- .replace(/"/g, '\\"')
276
- .replace(/\n/g, '\\n')
277
- .replace(/\r/g, '\\r')
278
- .replace(/\t/g, '\\t')
279
- .replace(nonPrintableRegex, (char) => {
280
- const code = char.charCodeAt(0);
281
- return `\\x${code.toString(16).padStart(2, '0')}`;
282
- });
283
-
284
- return `"${escaped}"`;
285
- }
286
-
287
- function buildArgumentHint(command: SchemaCommand): string | null {
288
- if (!command.arguments || command.arguments.length === 0) {
289
- return null;
290
- }
291
-
292
- const hints = command.arguments.map((arg) => {
293
- const name = arg.variadic ? `${arg.name}...` : arg.name;
294
- return arg.required ? `<${name}>` : `[${name}]`;
295
- });
296
-
297
- return hints.join(' ');
298
- }
299
-
300
- function generateSkillContent(skill: SkillInfo, version: string): string {
301
- const { command, skillName, fullCommandPath } = skill;
302
- const fullCommand = ['agentuity', ...fullCommandPath].join(' ');
303
-
304
- const enhancedDescription = enhanceDescription(command, fullCommandPath);
305
- const tags = command.tags?.join(' ') ?? '';
306
- const argumentHint = buildArgumentHint(command);
307
-
308
- const lines: string[] = [
309
- '---',
310
- `name: ${skillName}`,
311
- `description: ${escapeYamlString(enhancedDescription)}`,
312
- `version: "${version}"`,
313
- 'license: Apache-2.0',
314
- `allowed-tools: "Bash(agentuity:*)"`,
315
- ];
316
-
317
- if (argumentHint) {
318
- lines.push(`argument-hint: "${argumentHint}"`);
319
- }
320
-
321
- lines.push('metadata:');
322
- lines.push(` command: "${fullCommand}"`);
323
-
324
- if (tags) {
325
- lines.push(` tags: "${tags}"`);
326
- }
327
-
328
- lines.push('---');
329
- lines.push('');
330
-
331
- const title = fullCommandPath.map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(' ');
332
- lines.push(`# ${title}`);
333
- lines.push('');
334
- lines.push(command.description);
335
- lines.push('');
336
-
337
- const prerequisites = formatPrerequisites(command);
338
- if (prerequisites.length > 0) {
339
- lines.push('## Prerequisites');
340
- lines.push('');
341
- for (const prereq of prerequisites) {
342
- lines.push(`- ${prereq}`);
343
- }
344
- lines.push('');
345
- }
346
-
347
- lines.push('## Usage');
348
- lines.push('');
349
- lines.push('```bash');
350
- lines.push(buildUsageString(command, fullCommandPath));
351
- lines.push('```');
352
- lines.push('');
353
-
354
- if (command.arguments && command.arguments.length > 0) {
355
- lines.push('## Arguments');
356
- lines.push('');
357
- lines.push(formatArgumentsTable(command.arguments));
358
- lines.push('');
359
- }
360
-
361
- if (command.options && command.options.length > 0) {
362
- lines.push('## Options');
363
- lines.push('');
364
- lines.push(formatOptionsTable(command.options));
365
- lines.push('');
366
- }
367
-
368
- const examples = formatExamples(command);
369
- if (examples) {
370
- lines.push('## Examples');
371
- lines.push('');
372
- lines.push(examples);
373
- lines.push('');
374
- }
375
-
376
- const response = formatResponse(command);
377
- if (response) {
378
- lines.push('## Output');
379
- lines.push('');
380
- lines.push(response);
381
- lines.push('');
382
- }
383
-
384
- return lines.join('\n');
385
- }
386
-
387
- function collectAllSkills(
388
- schema: CLISchema,
389
- outputDir: string,
390
- includeHidden: boolean
391
- ): SkillInfo[] {
392
- const baseDir = path.join(outputDir, 'skills');
393
- const allSkills: SkillInfo[] = [];
394
-
395
- for (const command of schema.commands) {
396
- if (EXCLUDED_COMMANDS.has(command.name)) {
397
- continue;
398
- }
399
-
400
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
401
- const isHidden = (command as any).hidden === true;
402
- if (isHidden && !includeHidden) {
403
- continue;
404
- }
405
-
406
- const skills = collectLeafCommands(command, [], baseDir, isHidden);
407
- allSkills.push(...skills);
408
- }
409
-
410
- return allSkills;
411
- }
412
-
413
- function generateReadme(version: string, skills: SkillInfo[]): string {
414
- const groups = new Map<string, SkillInfo[]>();
415
- for (const skill of skills) {
416
- const group = skill.fullCommandPath[0];
417
- if (!groups.has(group)) {
418
- groups.set(group, []);
419
- }
420
- groups.get(group)!.push(skill);
421
- }
422
-
423
- const lines: string[] = [
424
- '# Agentuity CLI Skills',
425
- '',
426
- 'This directory contains auto-generated [Agent Skills](https://agentskills.io) for the Agentuity CLI.',
427
- '',
428
- '## What are Agent Skills?',
429
- '',
430
- 'Agent Skills are modular capabilities that extend AI coding agents. Each skill is a directory',
431
- 'containing a `SKILL.md` file with instructions that agents read when performing relevant tasks.',
432
- '',
433
- 'Learn more at the [Agent Skills Specification](https://agentskills.io/specification).',
434
- '',
435
- '## Generated From',
436
- '',
437
- `- **CLI Version**: ${version}`,
438
- `- **Generated**: ${new Date().toISOString().split('T')[0]}`,
439
- `- **Total Skills**: ${skills.length}`,
440
- '',
441
- '## Available Skills',
442
- '',
443
- ];
444
-
445
- for (const [group, groupSkills] of [...groups.entries()].sort()) {
446
- lines.push(`### ${group}`);
447
- lines.push('');
448
- lines.push('| Skill | Command | Description |');
449
- lines.push('|-------|---------|-------------|');
450
-
451
- for (const skill of groupSkills.sort((a, b) => a.skillName.localeCompare(b.skillName))) {
452
- const cmd = `\`agentuity ${skill.fullCommandPath.join(' ')}\``;
453
- const desc =
454
- skill.command.description.substring(0, 60) +
455
- (skill.command.description.length > 60 ? '...' : '');
456
- lines.push(`| [${skill.skillName}](./${skill.skillName}) | ${cmd} | ${desc} |`);
457
- }
458
-
459
- lines.push('');
460
- }
461
-
462
- lines.push('## Usage');
463
- lines.push('');
464
- lines.push(
465
- 'These skills are designed for AI coding agents that support the Agent Skills format.'
466
- );
467
- lines.push(
468
- 'Place this directory in your project or install globally for your agent to discover.'
469
- );
470
- lines.push('');
471
- lines.push('## Regenerating');
472
- lines.push('');
473
- lines.push('To regenerate these skills with the latest CLI schema:');
474
- lines.push('');
475
- lines.push('```bash');
476
- lines.push('agentuity ai skills generate --output ./skills');
477
- lines.push('```');
478
- lines.push('');
479
- lines.push('---');
480
- lines.push('');
481
- lines.push('*This file was auto-generated by the Agentuity CLI. Do not edit manually.*');
482
- lines.push('');
483
-
484
- return lines.join('\n');
485
- }
486
-
487
- export function collectSkillsForPreview(
488
- schema: CLISchema,
489
- outputDir: string,
490
- includeHidden: boolean
491
- ): string[] {
492
- const allSkills = collectAllSkills(schema, outputDir, includeHidden);
493
- return allSkills.map((s) => s.skillPath);
494
- }
495
-
496
- export async function generateSkills(
497
- schema: CLISchema,
498
- outputDir: string,
499
- includeHidden: boolean
500
- ): Promise<number> {
501
- const allSkills = collectAllSkills(schema, outputDir, includeHidden);
502
-
503
- if (allSkills.length === 0) {
504
- return 0;
505
- }
506
-
507
- const baseDir = path.join(outputDir, 'skills');
508
- let created = 0;
509
-
510
- for (const skill of allSkills) {
511
- const content = generateSkillContent(skill, schema.version);
512
- const skillDir = path.dirname(skill.skillPath);
513
-
514
- await Bun.$`mkdir -p ${skillDir}`.quiet();
515
- await Bun.write(Bun.file(skill.skillPath), content);
516
- created++;
517
- }
518
-
519
- const readmePath = path.join(baseDir, 'README.md');
520
- const readmeContent = generateReadme(schema.version, allSkills);
521
- await Bun.write(Bun.file(readmePath), readmeContent);
522
-
523
- const versionPath = path.join(baseDir, 'agentuity-version.txt');
524
- await Bun.write(Bun.file(versionPath), schema.version);
525
-
526
- return created;
527
- }
@@ -1,23 +0,0 @@
1
- import type { CommandDefinition } from '../../../types';
2
- import { createCommand } from '../../../types';
3
- import { generateSubcommand } from './generate';
4
- import { getCommand } from '../../../command-prefix';
5
-
6
- export const skillsCommand: CommandDefinition = createCommand({
7
- name: 'skills',
8
- description: 'Generate Agent Skills from CLI schema',
9
- tags: ['read-only', 'fast'],
10
- examples: [
11
- {
12
- command: getCommand('ai skills generate --output ./skills'),
13
- description: 'Generate skills to a directory',
14
- },
15
- {
16
- command: getCommand('--dry-run ai skills generate --output ./skills'),
17
- description: 'Preview without writing files',
18
- },
19
- ],
20
- subcommands: [generateSubcommand],
21
- });
22
-
23
- export default skillsCommand;
@@ -1,82 +0,0 @@
1
- import { join } from 'node:path';
2
- import { existsSync } from 'node:fs';
3
- import { semver } from 'bun';
4
- import type { Logger } from '@agentuity/core';
5
-
6
- const SKILLS_DIR = '.agents/skills/agentuity/cli';
7
- const VERSION_FILE = 'version.txt';
8
-
9
- interface SkillsCheckResult {
10
- needsRegeneration: boolean;
11
- reason?: 'missing' | 'outdated' | 'version-missing';
12
- currentVersion?: string;
13
- }
14
-
15
- export async function checkSkillsVersion(
16
- projectDir: string,
17
- cliVersion: string
18
- ): Promise<SkillsCheckResult> {
19
- const skillsDir = join(projectDir, SKILLS_DIR);
20
- const versionFile = join(skillsDir, VERSION_FILE);
21
-
22
- if (!existsSync(skillsDir)) {
23
- return { needsRegeneration: true, reason: 'missing' };
24
- }
25
-
26
- if (!existsSync(versionFile)) {
27
- return { needsRegeneration: true, reason: 'version-missing' };
28
- }
29
-
30
- const currentVersion = (await Bun.file(versionFile).text()).trim();
31
- if (!currentVersion) {
32
- return { needsRegeneration: true, reason: 'version-missing' };
33
- }
34
-
35
- try {
36
- const order = semver.order(currentVersion, cliVersion);
37
- if (order < 0) {
38
- return { needsRegeneration: true, reason: 'outdated', currentVersion };
39
- }
40
- } catch {
41
- return { needsRegeneration: true, reason: 'outdated', currentVersion };
42
- }
43
-
44
- return { needsRegeneration: false, currentVersion };
45
- }
46
-
47
- export async function regenerateSkillsAsync(
48
- projectDir: string,
49
- cliVersion: string,
50
- logger: Logger
51
- ): Promise<void> {
52
- const result = await checkSkillsVersion(projectDir, cliVersion);
53
-
54
- if (!result.needsRegeneration) {
55
- return;
56
- }
57
-
58
- const reasonMsg =
59
- result.reason === 'missing'
60
- ? 'Skills not found'
61
- : result.reason === 'version-missing'
62
- ? 'Skills version unknown'
63
- : `Skills outdated (${result.currentVersion} < ${cliVersion})`;
64
-
65
- logger.debug(`${reasonMsg}, regenerating...`);
66
-
67
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
68
- const schema = (global as any).__CLI_SCHEMA__;
69
- if (!schema) {
70
- logger.debug('CLI schema not available, skipping skill regeneration');
71
- return;
72
- }
73
-
74
- try {
75
- const outputDir = join(projectDir, '.agents');
76
- const { generateSkills } = await import('../ai/skills/generator');
77
- await generateSkills(schema, outputDir, false);
78
- logger.debug(`Skills regenerated to ${outputDir}/skills/agentuity/cli`);
79
- } catch (error) {
80
- logger.debug(`Failed to regenerate skills: ${error}`);
81
- }
82
- }