@claude-collective/cli 0.2.0 → 0.8.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 (190) hide show
  1. package/CHANGELOG.md +178 -0
  2. package/README.md +1 -1
  3. package/dist/chunk-3HBTELJN.js +114 -0
  4. package/dist/chunk-3HBTELJN.js.map +1 -0
  5. package/dist/chunk-3ZCB5K33.js +54 -0
  6. package/dist/chunk-3ZCB5K33.js.map +1 -0
  7. package/dist/chunk-66UDJBF6.js +96 -0
  8. package/dist/chunk-66UDJBF6.js.map +1 -0
  9. package/dist/chunk-6LS7XO3H.js +31 -0
  10. package/dist/chunk-6LS7XO3H.js.map +1 -0
  11. package/dist/chunk-A3J6IAXK.js +57 -0
  12. package/dist/chunk-A3J6IAXK.js.map +1 -0
  13. package/dist/chunk-A65SBAAJ.js +69 -0
  14. package/dist/chunk-A65SBAAJ.js.map +1 -0
  15. package/dist/chunk-ALEPJ6YN.js +80 -0
  16. package/dist/chunk-ALEPJ6YN.js.map +1 -0
  17. package/dist/chunk-C4ZTIYFR.js +84 -0
  18. package/dist/chunk-C4ZTIYFR.js.map +1 -0
  19. package/dist/chunk-CIY5UBRB.js +453 -0
  20. package/dist/chunk-CIY5UBRB.js.map +1 -0
  21. package/dist/chunk-DHET7RCE.js +50 -0
  22. package/dist/chunk-DHET7RCE.js.map +1 -0
  23. package/dist/chunk-DHFFRMF6.js +31 -0
  24. package/dist/chunk-DHFFRMF6.js.map +1 -0
  25. package/dist/chunk-DKGL77IY.js +307 -0
  26. package/dist/chunk-DKGL77IY.js.map +1 -0
  27. package/dist/chunk-ED73HCW2.js +315 -0
  28. package/dist/chunk-ED73HCW2.js.map +1 -0
  29. package/dist/chunk-FNOYEXUE.js +308 -0
  30. package/dist/chunk-FNOYEXUE.js.map +1 -0
  31. package/dist/chunk-G2FBJOZG.js +141 -0
  32. package/dist/chunk-G2FBJOZG.js.map +1 -0
  33. package/dist/chunk-HNDT5QRB.js +120 -0
  34. package/dist/chunk-HNDT5QRB.js.map +1 -0
  35. package/dist/chunk-K7PTOVX4.js +158 -0
  36. package/dist/chunk-K7PTOVX4.js.map +1 -0
  37. package/dist/chunk-LQTST4WY.js +91 -0
  38. package/dist/chunk-LQTST4WY.js.map +1 -0
  39. package/dist/chunk-LVKRVFYR.js +54 -0
  40. package/dist/chunk-LVKRVFYR.js.map +1 -0
  41. package/dist/chunk-M7YCPFIX.js +108 -0
  42. package/dist/chunk-M7YCPFIX.js.map +1 -0
  43. package/dist/chunk-MJSFR562.js +57 -0
  44. package/dist/chunk-MJSFR562.js.map +1 -0
  45. package/dist/chunk-MMDXNZPF.js +69 -0
  46. package/dist/chunk-MMDXNZPF.js.map +1 -0
  47. package/dist/chunk-MYAVQ23U.js +356 -0
  48. package/dist/chunk-MYAVQ23U.js.map +1 -0
  49. package/dist/chunk-NGBFJJ7Q.js +124 -0
  50. package/dist/chunk-NGBFJJ7Q.js.map +1 -0
  51. package/dist/chunk-OLBOTK3O.js +64 -0
  52. package/dist/chunk-OLBOTK3O.js.map +1 -0
  53. package/dist/chunk-PPNTD5LO.js +330 -0
  54. package/dist/chunk-PPNTD5LO.js.map +1 -0
  55. package/dist/chunk-Q2LH2DAB.js +392 -0
  56. package/dist/chunk-Q2LH2DAB.js.map +1 -0
  57. package/dist/chunk-Q6DR5QUH.js +547 -0
  58. package/dist/chunk-Q6DR5QUH.js.map +1 -0
  59. package/dist/chunk-QESUUPOE.js +241 -0
  60. package/dist/chunk-QESUUPOE.js.map +1 -0
  61. package/dist/chunk-QGGSLMO3.js +607 -0
  62. package/dist/chunk-QGGSLMO3.js.map +1 -0
  63. package/dist/chunk-SEBPPFUW.js +478 -0
  64. package/dist/chunk-SEBPPFUW.js.map +1 -0
  65. package/dist/chunk-SYQ7R2JO.js +95 -0
  66. package/dist/chunk-SYQ7R2JO.js.map +1 -0
  67. package/dist/chunk-TOPAIL5W.js +22 -0
  68. package/dist/chunk-TOPAIL5W.js.map +1 -0
  69. package/dist/chunk-U4VYHKPM.js +110 -0
  70. package/dist/chunk-U4VYHKPM.js.map +1 -0
  71. package/dist/chunk-UOWHJ6BE.js +83 -0
  72. package/dist/chunk-UOWHJ6BE.js.map +1 -0
  73. package/dist/chunk-XKEG3SCV.js +86 -0
  74. package/dist/chunk-XKEG3SCV.js.map +1 -0
  75. package/dist/chunk-XY3XDVMI.js +15599 -0
  76. package/dist/chunk-XY3XDVMI.js.map +1 -0
  77. package/dist/chunk-Y3V43XCU.js +76 -0
  78. package/dist/chunk-Y3V43XCU.js.map +1 -0
  79. package/dist/chunk-YKXBGCFD.js +129 -0
  80. package/dist/chunk-YKXBGCFD.js.map +1 -0
  81. package/dist/cli-v2/defaults/agent-mappings.yaml +185 -0
  82. package/dist/commands/build/marketplace.js +254 -0
  83. package/dist/commands/build/marketplace.js.map +1 -0
  84. package/dist/commands/build/plugins.js +324 -0
  85. package/dist/commands/build/plugins.js.map +1 -0
  86. package/dist/commands/build/stack.js +169 -0
  87. package/dist/commands/build/stack.js.map +1 -0
  88. package/dist/commands/compile.js +461 -0
  89. package/dist/commands/compile.js.map +1 -0
  90. package/dist/commands/config/get.js +60 -0
  91. package/dist/commands/config/get.js.map +1 -0
  92. package/dist/commands/config/index.js +22 -0
  93. package/dist/commands/config/index.js.map +1 -0
  94. package/dist/commands/config/path.js +35 -0
  95. package/dist/commands/config/path.js.map +1 -0
  96. package/dist/commands/config/set-project.js +61 -0
  97. package/dist/commands/config/set-project.js.map +1 -0
  98. package/dist/commands/config/set.js +60 -0
  99. package/dist/commands/config/set.js.map +1 -0
  100. package/dist/commands/config/show.js +13 -0
  101. package/dist/commands/config/show.js.map +1 -0
  102. package/dist/commands/config/unset-project.js +57 -0
  103. package/dist/commands/config/unset-project.js.map +1 -0
  104. package/dist/commands/config/unset.js +56 -0
  105. package/dist/commands/config/unset.js.map +1 -0
  106. package/dist/commands/diff.js +755 -0
  107. package/dist/commands/diff.js.map +1 -0
  108. package/dist/commands/doctor.js +413 -0
  109. package/dist/commands/doctor.js.map +1 -0
  110. package/dist/commands/edit.js +254 -0
  111. package/dist/commands/edit.js.map +1 -0
  112. package/dist/commands/eject.js +208 -0
  113. package/dist/commands/eject.js.map +1 -0
  114. package/dist/commands/info.js +205 -0
  115. package/dist/commands/info.js.map +1 -0
  116. package/dist/commands/init.js +915 -0
  117. package/dist/commands/init.js.map +1 -0
  118. package/dist/commands/list.js +44 -0
  119. package/dist/commands/list.js.map +1 -0
  120. package/dist/commands/new/agent.js +230 -0
  121. package/dist/commands/new/agent.js.map +1 -0
  122. package/dist/commands/new/skill.js +204 -0
  123. package/dist/commands/new/skill.js.map +1 -0
  124. package/dist/commands/outdated.js +242 -0
  125. package/dist/commands/outdated.js.map +1 -0
  126. package/dist/commands/search.js +115 -0
  127. package/dist/commands/search.js.map +1 -0
  128. package/dist/commands/test-imports.js +92 -0
  129. package/dist/commands/test-imports.js.map +1 -0
  130. package/dist/commands/uninstall.js +309 -0
  131. package/dist/commands/uninstall.js.map +1 -0
  132. package/dist/commands/update.js +428 -0
  133. package/dist/commands/update.js.map +1 -0
  134. package/dist/commands/validate.js +375 -0
  135. package/dist/commands/validate.js.map +1 -0
  136. package/dist/commands/version/bump.js +95 -0
  137. package/dist/commands/version/bump.js.map +1 -0
  138. package/dist/commands/version/index.js +70 -0
  139. package/dist/commands/version/index.js.map +1 -0
  140. package/dist/commands/version/set.js +101 -0
  141. package/dist/commands/version/set.js.map +1 -0
  142. package/dist/commands/version/show.js +70 -0
  143. package/dist/commands/version/show.js.map +1 -0
  144. package/dist/components/common/confirm.js +9 -0
  145. package/dist/components/common/confirm.js.map +1 -0
  146. package/dist/components/common/message.js +24 -0
  147. package/dist/components/common/message.js.map +1 -0
  148. package/dist/components/common/spinner.js +14 -0
  149. package/dist/components/common/spinner.js.map +1 -0
  150. package/dist/components/wizard/category-grid.js +9 -0
  151. package/dist/components/wizard/category-grid.js.map +1 -0
  152. package/dist/components/wizard/category-grid.test.js +728 -0
  153. package/dist/components/wizard/category-grid.test.js.map +1 -0
  154. package/dist/components/wizard/section-progress.js +9 -0
  155. package/dist/components/wizard/section-progress.js.map +1 -0
  156. package/dist/components/wizard/section-progress.test.js +281 -0
  157. package/dist/components/wizard/section-progress.test.js.map +1 -0
  158. package/dist/components/wizard/step-approach.js +11 -0
  159. package/dist/components/wizard/step-approach.js.map +1 -0
  160. package/dist/components/wizard/step-build.js +15 -0
  161. package/dist/components/wizard/step-build.js.map +1 -0
  162. package/dist/components/wizard/step-build.test.js +729 -0
  163. package/dist/components/wizard/step-build.test.js.map +1 -0
  164. package/dist/components/wizard/step-confirm.js +9 -0
  165. package/dist/components/wizard/step-confirm.js.map +1 -0
  166. package/dist/components/wizard/step-refine.js +9 -0
  167. package/dist/components/wizard/step-refine.js.map +1 -0
  168. package/dist/components/wizard/step-refine.test.js +235 -0
  169. package/dist/components/wizard/step-refine.test.js.map +1 -0
  170. package/dist/components/wizard/step-stack-options.js +11 -0
  171. package/dist/components/wizard/step-stack-options.js.map +1 -0
  172. package/dist/components/wizard/step-stack.js +11 -0
  173. package/dist/components/wizard/step-stack.js.map +1 -0
  174. package/dist/components/wizard/wizard-tabs.js +11 -0
  175. package/dist/components/wizard/wizard-tabs.js.map +1 -0
  176. package/dist/components/wizard/wizard.js +20 -0
  177. package/dist/components/wizard/wizard.js.map +1 -0
  178. package/dist/hooks/init.js +41 -0
  179. package/dist/hooks/init.js.map +1 -0
  180. package/dist/index.js +10 -0
  181. package/dist/index.js.map +1 -0
  182. package/dist/magic-string.es-RGXYGAW3.js +1316 -0
  183. package/dist/magic-string.es-RGXYGAW3.js.map +1 -0
  184. package/dist/stores/wizard-store.js +10 -0
  185. package/dist/stores/wizard-store.js.map +1 -0
  186. package/dist/stores/wizard-store.test.js +405 -0
  187. package/dist/stores/wizard-store.test.js.map +1 -0
  188. package/package.json +44 -25
  189. package/dist/cli/index.js +0 -6314
  190. package/dist/cli/index.js.map +0 -1
@@ -0,0 +1,375 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ printPluginValidationResult,
4
+ validateAllPlugins,
5
+ validatePlugin
6
+ } from "../chunk-CIY5UBRB.js";
7
+ import {
8
+ PROJECT_ROOT
9
+ } from "../chunk-A3J6IAXK.js";
10
+ import {
11
+ BaseCommand,
12
+ EXIT_CODES
13
+ } from "../chunk-SYQ7R2JO.js";
14
+ import {
15
+ fileExists,
16
+ readFile
17
+ } from "../chunk-MMDXNZPF.js";
18
+ import {
19
+ init_esm_shims
20
+ } from "../chunk-DHET7RCE.js";
21
+
22
+ // src/cli-v2/commands/validate.ts
23
+ init_esm_shims();
24
+ import { Args, Flags } from "@oclif/core";
25
+ import path2 from "path";
26
+
27
+ // src/cli-v2/lib/schema-validator.ts
28
+ init_esm_shims();
29
+ import Ajv from "ajv";
30
+ import addFormats from "ajv-formats";
31
+ import path from "path";
32
+ import { parse as parseYaml } from "yaml";
33
+ import fg from "fast-glob";
34
+ function extractFrontmatter(content) {
35
+ const frontmatterRegex = /^---\r?\n([\s\S]*?)\r?\n---/;
36
+ const match = content.match(frontmatterRegex);
37
+ if (!match || !match[1]) {
38
+ return null;
39
+ }
40
+ try {
41
+ return parseYaml(match[1]);
42
+ } catch {
43
+ return null;
44
+ }
45
+ }
46
+ var VALIDATION_TARGETS = [
47
+ {
48
+ name: "Skills Matrix",
49
+ schema: "skills-matrix.schema.json",
50
+ pattern: "skills-matrix.yaml",
51
+ baseDir: "src/config"
52
+ },
53
+ {
54
+ name: "Skill Metadata",
55
+ schema: "metadata.schema.json",
56
+ pattern: "**/metadata.yaml",
57
+ baseDir: "src/skills"
58
+ },
59
+ {
60
+ name: "Stack Skill Metadata",
61
+ schema: "metadata.schema.json",
62
+ pattern: "**/skills/**/metadata.yaml",
63
+ baseDir: "src/stacks"
64
+ },
65
+ {
66
+ name: "Stack Config",
67
+ schema: "stack.schema.json",
68
+ pattern: "*/config.yaml",
69
+ baseDir: "src/stacks"
70
+ },
71
+ {
72
+ name: "Agent Definition",
73
+ schema: "agent.schema.json",
74
+ pattern: "**/agent.yaml",
75
+ baseDir: "src/agents"
76
+ },
77
+ {
78
+ name: "Skill Frontmatter",
79
+ schema: "skill-frontmatter.schema.json",
80
+ pattern: "**/SKILL.md",
81
+ baseDir: "src/skills",
82
+ extractor: extractFrontmatter
83
+ },
84
+ {
85
+ name: "Stack Skill Frontmatter",
86
+ schema: "skill-frontmatter.schema.json",
87
+ pattern: "**/skills/**/SKILL.md",
88
+ baseDir: "src/stacks",
89
+ extractor: extractFrontmatter
90
+ }
91
+ ];
92
+ var schemaCache = /* @__PURE__ */ new Map();
93
+ var validatorCache = /* @__PURE__ */ new Map();
94
+ async function loadSchema(schemaName, rootDir = process.cwd()) {
95
+ const cacheKey = `${rootDir}:${schemaName}`;
96
+ if (schemaCache.has(cacheKey)) {
97
+ return schemaCache.get(cacheKey);
98
+ }
99
+ const locations = [
100
+ path.join(PROJECT_ROOT, "src", "schemas", schemaName),
101
+ path.join(rootDir, "src", "schemas", schemaName)
102
+ ];
103
+ for (const schemaPath of locations) {
104
+ if (await fileExists(schemaPath)) {
105
+ const content = await readFile(schemaPath);
106
+ const schema = JSON.parse(content);
107
+ schemaCache.set(cacheKey, schema);
108
+ return schema;
109
+ }
110
+ }
111
+ throw new Error(
112
+ `Schema not found: ${schemaName}. Searched: ${locations.join(", ")}`
113
+ );
114
+ }
115
+ async function getValidator(schemaName, rootDir = process.cwd()) {
116
+ const cacheKey = `${rootDir}:${schemaName}`;
117
+ if (validatorCache.has(cacheKey)) {
118
+ return validatorCache.get(cacheKey);
119
+ }
120
+ const ajv = new Ajv({ allErrors: true, strict: false });
121
+ addFormats(ajv);
122
+ const schema = await loadSchema(schemaName, rootDir);
123
+ const validate = ajv.compile(schema);
124
+ validatorCache.set(cacheKey, validate);
125
+ return validate;
126
+ }
127
+ function formatAjvErrors(errors) {
128
+ if (!errors) return [];
129
+ return errors.map((err) => {
130
+ const errorPath = err.instancePath ? err.instancePath.replace(/^\//, "").replace(/\//g, ".") : "";
131
+ const message = err.message || "Unknown error";
132
+ if (err.keyword === "additionalProperties") {
133
+ const prop = err.params.additionalProperty;
134
+ return `Unrecognized key: "${prop}"`;
135
+ }
136
+ if (err.keyword === "enum") {
137
+ const allowed = err.params.allowedValues;
138
+ return errorPath ? `${errorPath}: ${message}. Allowed: ${allowed?.join(", ")}` : `${message}. Allowed: ${allowed?.join(", ")}`;
139
+ }
140
+ return errorPath ? `${errorPath}: ${message}` : message;
141
+ });
142
+ }
143
+ async function validateFile(filePath, validate, extractor) {
144
+ try {
145
+ if (!await fileExists(filePath)) {
146
+ return { valid: false, errors: [`File not found: ${filePath}`] };
147
+ }
148
+ const content = await readFile(filePath);
149
+ let parsed;
150
+ if (extractor) {
151
+ parsed = extractor(content);
152
+ if (parsed === null) {
153
+ return {
154
+ valid: false,
155
+ errors: ["Failed to extract content (no valid frontmatter found)"]
156
+ };
157
+ }
158
+ } else {
159
+ parsed = parseYaml(content);
160
+ }
161
+ const isValid = validate(parsed);
162
+ if (isValid) {
163
+ return { valid: true, errors: [] };
164
+ }
165
+ return { valid: false, errors: formatAjvErrors(validate.errors) };
166
+ } catch (error) {
167
+ const message = error instanceof Error ? error.message : String(error);
168
+ return { valid: false, errors: [`Failed to parse content: ${message}`] };
169
+ }
170
+ }
171
+ async function validateTarget(target, rootDir = process.cwd()) {
172
+ const baseDir = path.join(rootDir, target.baseDir);
173
+ const pattern = path.join(baseDir, target.pattern);
174
+ const files = await fg(pattern, { absolute: true });
175
+ const result = {
176
+ schemaName: target.name,
177
+ valid: true,
178
+ totalFiles: files.length,
179
+ validFiles: 0,
180
+ invalidFiles: []
181
+ };
182
+ if (files.length === 0) {
183
+ return result;
184
+ }
185
+ const validate = await getValidator(target.schema, rootDir);
186
+ for (const file of files) {
187
+ const validation = await validateFile(file, validate, target.extractor);
188
+ const relativePath = path.relative(rootDir, file);
189
+ if (validation.valid) {
190
+ result.validFiles++;
191
+ } else {
192
+ result.valid = false;
193
+ result.invalidFiles.push({
194
+ file: relativePath,
195
+ errors: validation.errors
196
+ });
197
+ }
198
+ }
199
+ return result;
200
+ }
201
+ async function validateAllSchemas(rootDir = process.cwd()) {
202
+ const results = [];
203
+ for (const target of VALIDATION_TARGETS) {
204
+ const result = await validateTarget(target, rootDir);
205
+ results.push(result);
206
+ }
207
+ const summary = {
208
+ totalSchemas: results.length,
209
+ totalFiles: results.reduce((sum, r) => sum + r.totalFiles, 0),
210
+ validFiles: results.reduce((sum, r) => sum + r.validFiles, 0),
211
+ invalidFiles: results.reduce((sum, r) => sum + r.invalidFiles.length, 0)
212
+ };
213
+ return {
214
+ valid: results.every((r) => r.valid),
215
+ results,
216
+ summary
217
+ };
218
+ }
219
+ function printValidationResults(result) {
220
+ console.log(`
221
+ Schema Validation Summary:`);
222
+ console.log(` \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`);
223
+ console.log(` Total schemas checked: ${result.summary.totalSchemas}`);
224
+ console.log(` Total files: ${result.summary.totalFiles}`);
225
+ console.log(` Valid: ${result.summary.validFiles}`);
226
+ console.log(` Invalid: ${result.summary.invalidFiles}`);
227
+ for (const schemaResult of result.results) {
228
+ if (schemaResult.totalFiles === 0) continue;
229
+ const status = schemaResult.valid ? "\u2713" : "\u2717";
230
+ console.log(
231
+ `
232
+ ${status} ${schemaResult.schemaName}: ${schemaResult.validFiles}/${schemaResult.totalFiles} valid`
233
+ );
234
+ if (schemaResult.invalidFiles.length > 0) {
235
+ for (const file of schemaResult.invalidFiles) {
236
+ console.log(`
237
+ ${file.file}:`);
238
+ file.errors.forEach((e) => console.log(` - ${e}`));
239
+ }
240
+ }
241
+ }
242
+ if (result.valid) {
243
+ console.log(`
244
+ \u2713 All schemas validated successfully
245
+ `);
246
+ } else {
247
+ console.log(`
248
+ \u2717 Validation failed
249
+ `);
250
+ }
251
+ }
252
+
253
+ // src/cli-v2/commands/validate.ts
254
+ var Validate = class _Validate extends BaseCommand {
255
+ static summary = "Validate YAML files against schemas or validate compiled plugins";
256
+ static description = "Validates skill/agent YAML files against JSON schemas, or validates compiled plugin structure and content. Without arguments, validates all YAML files in the current directory against their schemas. With a path argument or --plugins flag, validates plugin(s) instead.";
257
+ static args = {
258
+ path: Args.string({
259
+ description: "Path to plugin or plugins directory to validate",
260
+ required: false
261
+ })
262
+ };
263
+ static flags = {
264
+ ...BaseCommand.baseFlags,
265
+ verbose: Flags.boolean({
266
+ char: "v",
267
+ description: "Enable verbose logging",
268
+ default: false
269
+ }),
270
+ all: Flags.boolean({
271
+ char: "a",
272
+ description: "Validate all plugins in directory",
273
+ default: false
274
+ }),
275
+ plugins: Flags.boolean({
276
+ char: "p",
277
+ description: "Validate plugins instead of schemas",
278
+ default: false
279
+ })
280
+ };
281
+ async run() {
282
+ const { args, flags } = await this.parse(_Validate);
283
+ if (args.path || flags.plugins) {
284
+ await this.validatePlugins(args.path, flags.verbose, flags.all);
285
+ } else {
286
+ await this.validateSchemas();
287
+ }
288
+ }
289
+ async validateSchemas() {
290
+ this.log("");
291
+ this.log("Validating all schemas");
292
+ this.log("");
293
+ try {
294
+ const result = await validateAllSchemas();
295
+ const summary = result.valid ? `Done: ${result.summary.validFiles}/${result.summary.totalFiles} files valid` : `Done: ${result.summary.invalidFiles} invalid files`;
296
+ this.log(summary);
297
+ printValidationResults(result);
298
+ if (!result.valid) {
299
+ this.exit(EXIT_CODES.ERROR);
300
+ }
301
+ } catch (error) {
302
+ const message = error instanceof Error ? error.message : String(error);
303
+ this.error(`Validation failed: ${message}`, { exit: EXIT_CODES.ERROR });
304
+ }
305
+ }
306
+ async validatePlugins(pluginPath, verbose, all) {
307
+ const targetPath = pluginPath ? path2.resolve(pluginPath) : process.cwd();
308
+ if (all) {
309
+ await this.validateAllPluginsInDirectory(targetPath, verbose);
310
+ } else {
311
+ await this.validateSinglePlugin(targetPath, verbose);
312
+ }
313
+ }
314
+ async validateAllPluginsInDirectory(targetPath, verbose) {
315
+ this.log("");
316
+ this.log(`Validating all plugins in: ${targetPath}`);
317
+ this.log("");
318
+ try {
319
+ const result = await validateAllPlugins(targetPath);
320
+ const summary = result.valid ? `Done: ${result.summary.valid}/${result.summary.total} plugins valid` : `Done: ${result.summary.invalid} invalid plugins`;
321
+ this.log(summary);
322
+ this.log("");
323
+ this.log(" Plugin Validation Summary:");
324
+ this.log(" -------------------------");
325
+ this.log(` Total plugins: ${result.summary.total}`);
326
+ this.log(` Valid: ${result.summary.valid}`);
327
+ this.log(` Invalid: ${result.summary.invalid}`);
328
+ this.log(` With warnings: ${result.summary.withWarnings}`);
329
+ for (const { name, result: pluginResult } of result.results) {
330
+ printPluginValidationResult(name, pluginResult, verbose);
331
+ }
332
+ if (result.valid) {
333
+ this.log("");
334
+ this.logSuccess("All plugins validated successfully");
335
+ this.log("");
336
+ } else {
337
+ this.log("");
338
+ this.error("Validation failed", { exit: EXIT_CODES.ERROR });
339
+ }
340
+ } catch (error) {
341
+ const message = error instanceof Error ? error.message : String(error);
342
+ this.error(`Validation failed: ${message}`, { exit: EXIT_CODES.ERROR });
343
+ }
344
+ }
345
+ async validateSinglePlugin(targetPath, verbose) {
346
+ this.log("");
347
+ this.log(`Validating plugin: ${targetPath}`);
348
+ this.log("");
349
+ try {
350
+ const result = await validatePlugin(targetPath);
351
+ const summary = result.valid ? "Done: Plugin is valid" : "Done: Plugin has errors";
352
+ this.log(summary);
353
+ printPluginValidationResult(path2.basename(targetPath), result, true);
354
+ if (result.valid && result.warnings.length === 0) {
355
+ this.log("");
356
+ this.logSuccess("Plugin validated successfully");
357
+ this.log("");
358
+ } else if (result.valid) {
359
+ this.log("");
360
+ this.logWarning("Plugin valid with warnings");
361
+ this.log("");
362
+ } else {
363
+ this.log("");
364
+ this.error("Validation failed", { exit: EXIT_CODES.ERROR });
365
+ }
366
+ } catch (error) {
367
+ const message = error instanceof Error ? error.message : String(error);
368
+ this.error(`Validation failed: ${message}`, { exit: EXIT_CODES.ERROR });
369
+ }
370
+ }
371
+ };
372
+ export {
373
+ Validate as default
374
+ };
375
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli-v2/commands/validate.ts","../../src/cli-v2/lib/schema-validator.ts"],"sourcesContent":["import { Args, Flags } from \"@oclif/core\";\nimport path from \"path\";\nimport { BaseCommand } from \"../base-command.js\";\nimport { EXIT_CODES } from \"../lib/exit-codes.js\";\nimport {\n validateAllSchemas,\n printValidationResults,\n} from \"../lib/schema-validator.js\";\nimport {\n validatePlugin,\n validateAllPlugins,\n printPluginValidationResult,\n} from \"../lib/plugin-validator.js\";\n\nexport default class Validate extends BaseCommand {\n static summary =\n \"Validate YAML files against schemas or validate compiled plugins\";\n static description =\n \"Validates skill/agent YAML files against JSON schemas, or validates compiled plugin structure and content. \" +\n \"Without arguments, validates all YAML files in the current directory against their schemas. \" +\n \"With a path argument or --plugins flag, validates plugin(s) instead.\";\n\n static args = {\n path: Args.string({\n description: \"Path to plugin or plugins directory to validate\",\n required: false,\n }),\n };\n\n static flags = {\n ...BaseCommand.baseFlags,\n verbose: Flags.boolean({\n char: \"v\",\n description: \"Enable verbose logging\",\n default: false,\n }),\n all: Flags.boolean({\n char: \"a\",\n description: \"Validate all plugins in directory\",\n default: false,\n }),\n plugins: Flags.boolean({\n char: \"p\",\n description: \"Validate plugins instead of schemas\",\n default: false,\n }),\n };\n\n async run(): Promise<void> {\n const { args, flags } = await this.parse(Validate);\n\n if (args.path || flags.plugins) {\n await this.validatePlugins(args.path, flags.verbose, flags.all);\n } else {\n await this.validateSchemas();\n }\n }\n\n private async validateSchemas(): Promise<void> {\n this.log(\"\");\n this.log(\"Validating all schemas\");\n this.log(\"\");\n\n try {\n const result = await validateAllSchemas();\n\n const summary = result.valid\n ? `Done: ${result.summary.validFiles}/${result.summary.totalFiles} files valid`\n : `Done: ${result.summary.invalidFiles} invalid files`;\n\n this.log(summary);\n printValidationResults(result);\n\n if (!result.valid) {\n this.exit(EXIT_CODES.ERROR);\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n this.error(`Validation failed: ${message}`, { exit: EXIT_CODES.ERROR });\n }\n }\n\n private async validatePlugins(\n pluginPath: string | undefined,\n verbose: boolean,\n all: boolean,\n ): Promise<void> {\n const targetPath = pluginPath ? path.resolve(pluginPath) : process.cwd();\n\n if (all) {\n await this.validateAllPluginsInDirectory(targetPath, verbose);\n } else {\n await this.validateSinglePlugin(targetPath, verbose);\n }\n }\n\n private async validateAllPluginsInDirectory(\n targetPath: string,\n verbose: boolean,\n ): Promise<void> {\n this.log(\"\");\n this.log(`Validating all plugins in: ${targetPath}`);\n this.log(\"\");\n\n try {\n const result = await validateAllPlugins(targetPath);\n\n const summary = result.valid\n ? `Done: ${result.summary.valid}/${result.summary.total} plugins valid`\n : `Done: ${result.summary.invalid} invalid plugins`;\n\n this.log(summary);\n\n this.log(\"\");\n this.log(\" Plugin Validation Summary:\");\n this.log(\" -------------------------\");\n this.log(` Total plugins: ${result.summary.total}`);\n this.log(` Valid: ${result.summary.valid}`);\n this.log(` Invalid: ${result.summary.invalid}`);\n this.log(` With warnings: ${result.summary.withWarnings}`);\n\n for (const { name, result: pluginResult } of result.results) {\n printPluginValidationResult(name, pluginResult, verbose);\n }\n\n if (result.valid) {\n this.log(\"\");\n this.logSuccess(\"All plugins validated successfully\");\n this.log(\"\");\n } else {\n this.log(\"\");\n this.error(\"Validation failed\", { exit: EXIT_CODES.ERROR });\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n this.error(`Validation failed: ${message}`, { exit: EXIT_CODES.ERROR });\n }\n }\n\n private async validateSinglePlugin(\n targetPath: string,\n verbose: boolean,\n ): Promise<void> {\n this.log(\"\");\n this.log(`Validating plugin: ${targetPath}`);\n this.log(\"\");\n\n try {\n const result = await validatePlugin(targetPath);\n\n const summary = result.valid\n ? \"Done: Plugin is valid\"\n : \"Done: Plugin has errors\";\n\n this.log(summary);\n\n printPluginValidationResult(path.basename(targetPath), result, true);\n\n if (result.valid && result.warnings.length === 0) {\n this.log(\"\");\n this.logSuccess(\"Plugin validated successfully\");\n this.log(\"\");\n } else if (result.valid) {\n this.log(\"\");\n this.logWarning(\"Plugin valid with warnings\");\n this.log(\"\");\n } else {\n this.log(\"\");\n this.error(\"Validation failed\", { exit: EXIT_CODES.ERROR });\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n this.error(`Validation failed: ${message}`, { exit: EXIT_CODES.ERROR });\n }\n }\n}\n","import Ajv, { type ValidateFunction, type ErrorObject } from \"ajv\";\nimport addFormats from \"ajv-formats\";\nimport path from \"path\";\nimport { readFile, fileExists } from \"../utils/fs\";\nimport { parse as parseYaml } from \"yaml\";\nimport fg from \"fast-glob\";\nimport { PROJECT_ROOT } from \"../consts\";\n\nexport interface FileValidationError {\n file: string;\n errors: string[];\n}\n\nexport interface SchemaValidationResult {\n schemaName: string;\n valid: boolean;\n totalFiles: number;\n validFiles: number;\n invalidFiles: FileValidationError[];\n}\n\nexport interface FullValidationResult {\n valid: boolean;\n results: SchemaValidationResult[];\n summary: {\n totalSchemas: number;\n totalFiles: number;\n validFiles: number;\n invalidFiles: number;\n };\n}\n\ntype ContentExtractor = (content: string) => unknown | null;\n\ninterface ValidationTarget {\n name: string;\n schema: string;\n pattern: string;\n baseDir: string;\n extractor?: ContentExtractor;\n}\n\nfunction extractFrontmatter(content: string): unknown | null {\n const frontmatterRegex = /^---\\r?\\n([\\s\\S]*?)\\r?\\n---/;\n const match = content.match(frontmatterRegex);\n\n if (!match || !match[1]) {\n return null;\n }\n\n try {\n return parseYaml(match[1]);\n } catch {\n return null;\n }\n}\n\nconst VALIDATION_TARGETS: ValidationTarget[] = [\n {\n name: \"Skills Matrix\",\n schema: \"skills-matrix.schema.json\",\n pattern: \"skills-matrix.yaml\",\n baseDir: \"src/config\",\n },\n {\n name: \"Skill Metadata\",\n schema: \"metadata.schema.json\",\n pattern: \"**/metadata.yaml\",\n baseDir: \"src/skills\",\n },\n {\n name: \"Stack Skill Metadata\",\n schema: \"metadata.schema.json\",\n pattern: \"**/skills/**/metadata.yaml\",\n baseDir: \"src/stacks\",\n },\n {\n name: \"Stack Config\",\n schema: \"stack.schema.json\",\n pattern: \"*/config.yaml\",\n baseDir: \"src/stacks\",\n },\n {\n name: \"Agent Definition\",\n schema: \"agent.schema.json\",\n pattern: \"**/agent.yaml\",\n baseDir: \"src/agents\",\n },\n {\n name: \"Skill Frontmatter\",\n schema: \"skill-frontmatter.schema.json\",\n pattern: \"**/SKILL.md\",\n baseDir: \"src/skills\",\n extractor: extractFrontmatter,\n },\n {\n name: \"Stack Skill Frontmatter\",\n schema: \"skill-frontmatter.schema.json\",\n pattern: \"**/skills/**/SKILL.md\",\n baseDir: \"src/stacks\",\n extractor: extractFrontmatter,\n },\n];\n\nconst schemaCache = new Map<string, object>();\nconst validatorCache = new Map<string, ValidateFunction>();\n\nasync function loadSchema(\n schemaName: string,\n rootDir: string = process.cwd(),\n): Promise<object> {\n const cacheKey = `${rootDir}:${schemaName}`;\n if (schemaCache.has(cacheKey)) {\n return schemaCache.get(cacheKey)!;\n }\n\n // Try multiple locations for schema files:\n // 1. CLI repo's schemas (for agent schemas)\n // 2. Target directory's schemas (for stack/skill schemas in claude-subagents)\n const locations = [\n path.join(PROJECT_ROOT, \"src\", \"schemas\", schemaName),\n path.join(rootDir, \"src\", \"schemas\", schemaName),\n ];\n\n for (const schemaPath of locations) {\n if (await fileExists(schemaPath)) {\n const content = await readFile(schemaPath);\n const schema = JSON.parse(content);\n schemaCache.set(cacheKey, schema);\n return schema;\n }\n }\n\n throw new Error(\n `Schema not found: ${schemaName}. Searched: ${locations.join(\", \")}`,\n );\n}\n\nasync function getValidator(\n schemaName: string,\n rootDir: string = process.cwd(),\n): Promise<ValidateFunction> {\n const cacheKey = `${rootDir}:${schemaName}`;\n if (validatorCache.has(cacheKey)) {\n return validatorCache.get(cacheKey)!;\n }\n\n const ajv = new Ajv({ allErrors: true, strict: false });\n addFormats(ajv);\n const schema = await loadSchema(schemaName, rootDir);\n const validate = ajv.compile(schema);\n validatorCache.set(cacheKey, validate);\n return validate;\n}\n\nfunction formatAjvErrors(errors: ErrorObject[] | null | undefined): string[] {\n if (!errors) return [];\n\n return errors.map((err) => {\n const errorPath = err.instancePath\n ? err.instancePath.replace(/^\\//, \"\").replace(/\\//g, \".\")\n : \"\";\n const message = err.message || \"Unknown error\";\n\n if (err.keyword === \"additionalProperties\") {\n const prop = (err.params as { additionalProperty?: string })\n .additionalProperty;\n return `Unrecognized key: \"${prop}\"`;\n }\n\n if (err.keyword === \"enum\") {\n const allowed = (err.params as { allowedValues?: string[] })\n .allowedValues;\n return errorPath\n ? `${errorPath}: ${message}. Allowed: ${allowed?.join(\", \")}`\n : `${message}. Allowed: ${allowed?.join(\", \")}`;\n }\n\n return errorPath ? `${errorPath}: ${message}` : message;\n });\n}\n\nasync function validateFile(\n filePath: string,\n validate: ValidateFunction,\n extractor?: ContentExtractor,\n): Promise<{ valid: boolean; errors: string[] }> {\n try {\n if (!(await fileExists(filePath))) {\n return { valid: false, errors: [`File not found: ${filePath}`] };\n }\n\n const content = await readFile(filePath);\n\n let parsed: unknown;\n if (extractor) {\n parsed = extractor(content);\n if (parsed === null) {\n return {\n valid: false,\n errors: [\"Failed to extract content (no valid frontmatter found)\"],\n };\n }\n } else {\n parsed = parseYaml(content);\n }\n\n const isValid = validate(parsed);\n\n if (isValid) {\n return { valid: true, errors: [] };\n }\n\n return { valid: false, errors: formatAjvErrors(validate.errors) };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return { valid: false, errors: [`Failed to parse content: ${message}`] };\n }\n}\n\nasync function validateTarget(\n target: ValidationTarget,\n rootDir: string = process.cwd(),\n): Promise<SchemaValidationResult> {\n const baseDir = path.join(rootDir, target.baseDir);\n const pattern = path.join(baseDir, target.pattern);\n const files = await fg(pattern, { absolute: true });\n\n const result: SchemaValidationResult = {\n schemaName: target.name,\n valid: true,\n totalFiles: files.length,\n validFiles: 0,\n invalidFiles: [],\n };\n\n if (files.length === 0) {\n return result;\n }\n\n const validate = await getValidator(target.schema, rootDir);\n\n for (const file of files) {\n const validation = await validateFile(file, validate, target.extractor);\n const relativePath = path.relative(rootDir, file);\n\n if (validation.valid) {\n result.validFiles++;\n } else {\n result.valid = false;\n result.invalidFiles.push({\n file: relativePath,\n errors: validation.errors,\n });\n }\n }\n\n return result;\n}\n\nexport async function validateAllSchemas(\n rootDir: string = process.cwd(),\n): Promise<FullValidationResult> {\n const results: SchemaValidationResult[] = [];\n\n for (const target of VALIDATION_TARGETS) {\n const result = await validateTarget(target, rootDir);\n results.push(result);\n }\n\n const summary = {\n totalSchemas: results.length,\n totalFiles: results.reduce((sum, r) => sum + r.totalFiles, 0),\n validFiles: results.reduce((sum, r) => sum + r.validFiles, 0),\n invalidFiles: results.reduce((sum, r) => sum + r.invalidFiles.length, 0),\n };\n\n return {\n valid: results.every((r) => r.valid),\n results,\n summary,\n };\n}\n\nexport function printValidationResults(result: FullValidationResult): void {\n console.log(`\\n Schema Validation Summary:`);\n console.log(` ─────────────────────────`);\n console.log(` Total schemas checked: ${result.summary.totalSchemas}`);\n console.log(` Total files: ${result.summary.totalFiles}`);\n console.log(` Valid: ${result.summary.validFiles}`);\n console.log(` Invalid: ${result.summary.invalidFiles}`);\n\n for (const schemaResult of result.results) {\n if (schemaResult.totalFiles === 0) continue;\n\n const status = schemaResult.valid ? \"✓\" : \"✗\";\n console.log(\n `\\n ${status} ${schemaResult.schemaName}: ${schemaResult.validFiles}/${schemaResult.totalFiles} valid`,\n );\n\n if (schemaResult.invalidFiles.length > 0) {\n for (const file of schemaResult.invalidFiles) {\n console.log(`\\n ${file.file}:`);\n file.errors.forEach((e) => console.log(` - ${e}`));\n }\n }\n }\n\n if (result.valid) {\n console.log(`\\n ✓ All schemas validated successfully\\n`);\n } else {\n console.log(`\\n ✗ Validation failed\\n`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,SAAS,MAAM,a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UAAU,GAAG,QAAQ,IAAI;AAEnE,UAAI,OAAO,SAAS,OAAO,SAAS,WAAW,GAAG;AAChD,aAAK,IAAI,EAAE;AACX,aAAK,WAAW,+BAA+B;AAC/C,aAAK,IAAI,EAAE;AAAA,MACb,WAAW,OAAO,OAAO;AACvB,aAAK,IAAI,EAAE;AACX,aAAK,WAAW,4BAA4B;AAC5C,aAAK,IAAI,EAAE;AAAA,MACb,OAAO;AACL,aAAK,IAAI,EAAE;AACX,aAAK,MAAM,qBAAqB,EAAE,MAAM,WAAW,MAAM,CAAC;AAAA,MAC5D;AAAA,IACF,SAAS,OAAO;AACd,YAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,WAAK,MAAM,sBAAsB,OAAO,IAAI,EAAE,MAAM,WAAW,MAAM,CAAC;AAAA,IACxE;AAAA,EACF;AACF;","names":["path","path"]}
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ bumpPluginVersion
4
+ } from "../../chunk-OLBOTK3O.js";
5
+ import {
6
+ PLUGIN_MANIFEST_DIR,
7
+ PLUGIN_MANIFEST_FILE
8
+ } from "../../chunk-A3J6IAXK.js";
9
+ import {
10
+ BaseCommand,
11
+ EXIT_CODES
12
+ } from "../../chunk-SYQ7R2JO.js";
13
+ import {
14
+ fileExists,
15
+ readFile
16
+ } from "../../chunk-MMDXNZPF.js";
17
+ import {
18
+ init_esm_shims
19
+ } from "../../chunk-DHET7RCE.js";
20
+
21
+ // src/cli-v2/commands/version/bump.ts
22
+ init_esm_shims();
23
+ import { Args } from "@oclif/core";
24
+ import path from "path";
25
+ async function findPluginManifest(startDir) {
26
+ let currentDir = startDir;
27
+ const root = path.parse(currentDir).root;
28
+ while (currentDir !== root) {
29
+ const manifestPath = path.join(
30
+ currentDir,
31
+ PLUGIN_MANIFEST_DIR,
32
+ PLUGIN_MANIFEST_FILE
33
+ );
34
+ if (await fileExists(manifestPath)) {
35
+ return manifestPath;
36
+ }
37
+ currentDir = path.dirname(currentDir);
38
+ }
39
+ return null;
40
+ }
41
+ var VersionBump = class _VersionBump extends BaseCommand {
42
+ static summary = "Bump plugin version";
43
+ static description = "Increment the plugin version by the specified type (major, minor, or patch).";
44
+ static args = {
45
+ type: Args.string({
46
+ description: "Version bump type",
47
+ required: true,
48
+ options: ["major", "minor", "patch"]
49
+ })
50
+ };
51
+ static flags = {
52
+ ...BaseCommand.baseFlags
53
+ };
54
+ static examples = [
55
+ "<%= config.bin %> <%= command.id %> patch",
56
+ "<%= config.bin %> <%= command.id %> minor",
57
+ "<%= config.bin %> <%= command.id %> major",
58
+ "<%= config.bin %> <%= command.id %> patch --dry-run"
59
+ ];
60
+ async run() {
61
+ const { args, flags } = await this.parse(_VersionBump);
62
+ const bumpType = args.type;
63
+ const manifestPath = await findPluginManifest(process.cwd());
64
+ if (!manifestPath) {
65
+ this.error(
66
+ `No plugin.json found in current directory or parents
67
+ Expected location: ${PLUGIN_MANIFEST_DIR}/${PLUGIN_MANIFEST_FILE}`,
68
+ { exit: EXIT_CODES.ERROR }
69
+ );
70
+ }
71
+ const pluginDir = path.dirname(path.dirname(manifestPath));
72
+ try {
73
+ const content = await readFile(manifestPath);
74
+ const manifest = JSON.parse(content);
75
+ const oldVersion = manifest.version || "1.0.0";
76
+ const pluginName = manifest.name || "unknown";
77
+ if (flags["dry-run"]) {
78
+ this.log(
79
+ `[DRY RUN] Would bump ${pluginName} version: ${oldVersion} -> ${bumpType}`
80
+ );
81
+ return;
82
+ }
83
+ const newVersion = await bumpPluginVersion(pluginDir, bumpType);
84
+ this.log(`${pluginName}: ${oldVersion} -> ${newVersion}`);
85
+ } catch (error) {
86
+ this.error(`Failed to bump plugin version: ${error}`, {
87
+ exit: EXIT_CODES.ERROR
88
+ });
89
+ }
90
+ }
91
+ };
92
+ export {
93
+ VersionBump as default
94
+ };
95
+ //# sourceMappingURL=bump.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/cli-v2/commands/version/bump.ts"],"sourcesContent":["/**\n * Bump plugin version (major, minor, or patch).\n */\nimport { BaseCommand } from \"../../base-command.js\";\nimport { Args, Flags } from \"@oclif/core\";\nimport {\n bumpPluginVersion,\n type VersionBumpType,\n} from \"../../lib/plugin-version.js\";\nimport { EXIT_CODES } from \"../../lib/exit-codes.js\";\nimport path from \"path\";\nimport { PLUGIN_MANIFEST_DIR, PLUGIN_MANIFEST_FILE } from \"../../consts.js\";\nimport { fileExists, readFile } from \"../../utils/fs.js\";\nimport type { PluginManifest } from \"../../../types.js\";\n\nasync function findPluginManifest(startDir: string): Promise<string | null> {\n let currentDir = startDir;\n const root = path.parse(currentDir).root;\n\n while (currentDir !== root) {\n const manifestPath = path.join(\n currentDir,\n PLUGIN_MANIFEST_DIR,\n PLUGIN_MANIFEST_FILE,\n );\n if (await fileExists(manifestPath)) {\n return manifestPath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return null;\n}\n\nexport default class VersionBump extends BaseCommand {\n static summary = \"Bump plugin version\";\n static description =\n \"Increment the plugin version by the specified type (major, minor, or patch).\";\n\n static args = {\n type: Args.string({\n description: \"Version bump type\",\n required: true,\n options: [\"major\", \"minor\", \"patch\"],\n }),\n };\n\n static flags = {\n ...BaseCommand.baseFlags,\n };\n\n static examples = [\n \"<%= config.bin %> <%= command.id %> patch\",\n \"<%= config.bin %> <%= command.id %> minor\",\n \"<%= config.bin %> <%= command.id %> major\",\n \"<%= config.bin %> <%= command.id %> patch --dry-run\",\n ];\n\n async run(): Promise<void> {\n const { args, flags } = await this.parse(VersionBump);\n const bumpType = args.type as VersionBumpType;\n\n const manifestPath = await findPluginManifest(process.cwd());\n\n if (!manifestPath) {\n this.error(\n `No plugin.json found in current directory or parents\\nExpected location: ${PLUGIN_MANIFEST_DIR}/${PLUGIN_MANIFEST_FILE}`,\n { exit: EXIT_CODES.ERROR },\n );\n }\n\n const pluginDir = path.dirname(path.dirname(manifestPath));\n\n try {\n // Read current version and plugin name\n const content = await readFile(manifestPath);\n const manifest = JSON.parse(content) as PluginManifest;\n const oldVersion = manifest.version || \"1.0.0\";\n const pluginName = manifest.name || \"unknown\";\n\n if (flags[\"dry-run\"]) {\n this.log(\n `[DRY RUN] Would bump ${pluginName} version: ${oldVersion} -> ${bumpType}`,\n );\n return;\n }\n\n const newVersion = await bumpPluginVersion(pluginDir, bumpType);\n this.log(`${pluginName}: ${oldVersion} -> ${newVersion}`);\n } catch (error) {\n this.error(`Failed to bump plugin version: ${error}`, {\n exit: EXIT_CODES.ERROR,\n });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAIA,SAAS,YAAmB;AAM5B,OAAO,UAAU;AAKjB,eAAe,mBAAmB,UAA0C;AAC1E,MAAI,aAAa;AACjB,QAAM,OAAO,KAAK,MAAM,UAAU,EAAE;AAEpC,SAAO,eAAe,MAAM;AAC1B,UAAM,eAAe,KAAK;AAAA,MACxB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,QAAI,MAAM,WAAW,YAAY,GAAG;AAClC,aAAO;AAAA,IACT;AACA,iBAAa,KAAK,QAAQ,UAAU;AAAA,EACtC;AAEA,SAAO;AACT;AAEA,IAAqB,cAArB,MAAqB,qBAAoB,YAAY;AAAA,EACnD,OAAO,UAAU;AAAA,EACjB,OAAO,cACL;AAAA,EAEF,OAAO,OAAO;AAAA,IACZ,MAAM,KAAK,OAAO;AAAA,MAChB,aAAa;AAAA,MACb,UAAU;AAAA,MACV,SAAS,CAAC,SAAS,SAAS,OAAO;AAAA,IACrC,CAAC;AAAA,EACH;AAAA,EAEA,OAAO,QAAQ;AAAA,IACb,GAAG,YAAY;AAAA,EACjB;AAAA,EAEA,OAAO,WAAW;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,MAAM,MAAM,IAAI,MAAM,KAAK,MAAM,YAAW;AACpD,UAAM,WAAW,KAAK;AAEtB,UAAM,eAAe,MAAM,mBAAmB,QAAQ,IAAI,CAAC;AAE3D,QAAI,CAAC,cAAc;AACjB,WAAK;AAAA,QACH;AAAA,qBAA4E,mBAAmB,IAAI,oBAAoB;AAAA,QACvH,EAAE,MAAM,WAAW,MAAM;AAAA,MAC3B;AAAA,IACF;AAEA,UAAM,YAAY,KAAK,QAAQ,KAAK,QAAQ,YAAY,CAAC;AAEzD,QAAI;AAEF,YAAM,UAAU,MAAM,SAAS,YAAY;AAC3C,YAAM,WAAW,KAAK,MAAM,OAAO;AACnC,YAAM,aAAa,SAAS,WAAW;AACvC,YAAM,aAAa,SAAS,QAAQ;AAEpC,UAAI,MAAM,SAAS,GAAG;AACpB,aAAK;AAAA,UACH,wBAAwB,UAAU,aAAa,UAAU,OAAO,QAAQ;AAAA,QAC1E;AACA;AAAA,MACF;AAEA,YAAM,aAAa,MAAM,kBAAkB,WAAW,QAAQ;AAC9D,WAAK,IAAI,GAAG,UAAU,KAAK,UAAU,OAAO,UAAU,EAAE;AAAA,IAC1D,SAAS,OAAO;AACd,WAAK,MAAM,kCAAkC,KAAK,IAAI;AAAA,QACpD,MAAM,WAAW;AAAA,MACnB,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ getPluginVersion
4
+ } from "../../chunk-OLBOTK3O.js";
5
+ import {
6
+ PLUGIN_MANIFEST_DIR,
7
+ PLUGIN_MANIFEST_FILE
8
+ } from "../../chunk-A3J6IAXK.js";
9
+ import {
10
+ BaseCommand,
11
+ EXIT_CODES
12
+ } from "../../chunk-SYQ7R2JO.js";
13
+ import {
14
+ fileExists
15
+ } from "../../chunk-MMDXNZPF.js";
16
+ import {
17
+ init_esm_shims
18
+ } from "../../chunk-DHET7RCE.js";
19
+
20
+ // src/cli-v2/commands/version/index.ts
21
+ init_esm_shims();
22
+ import path from "path";
23
+ async function findPluginManifest(startDir) {
24
+ let currentDir = startDir;
25
+ const root = path.parse(currentDir).root;
26
+ while (currentDir !== root) {
27
+ const manifestPath = path.join(
28
+ currentDir,
29
+ PLUGIN_MANIFEST_DIR,
30
+ PLUGIN_MANIFEST_FILE
31
+ );
32
+ if (await fileExists(manifestPath)) {
33
+ return manifestPath;
34
+ }
35
+ currentDir = path.dirname(currentDir);
36
+ }
37
+ return null;
38
+ }
39
+ var Version = class _Version extends BaseCommand {
40
+ static summary = "Show current plugin version";
41
+ static description = "Display the current version of the plugin in the current directory.";
42
+ static flags = {
43
+ ...BaseCommand.baseFlags
44
+ };
45
+ static examples = ["<%= config.bin %> <%= command.id %>"];
46
+ async run() {
47
+ await this.parse(_Version);
48
+ const manifestPath = await findPluginManifest(process.cwd());
49
+ if (!manifestPath) {
50
+ this.error(
51
+ `No plugin.json found in current directory or parents
52
+ Expected location: ${PLUGIN_MANIFEST_DIR}/${PLUGIN_MANIFEST_FILE}`,
53
+ { exit: EXIT_CODES.ERROR }
54
+ );
55
+ }
56
+ const pluginDir = path.dirname(path.dirname(manifestPath));
57
+ try {
58
+ const version = await getPluginVersion(pluginDir);
59
+ this.log(version);
60
+ } catch (error) {
61
+ this.error(`Failed to read plugin version: ${error}`, {
62
+ exit: EXIT_CODES.ERROR
63
+ });
64
+ }
65
+ }
66
+ };
67
+ export {
68
+ Version as default
69
+ };
70
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/cli-v2/commands/version/index.ts"],"sourcesContent":["/**\n * Default version command - shows current plugin version.\n * Alias for `version show`.\n */\nimport { BaseCommand } from \"../../base-command.js\";\nimport { getPluginVersion } from \"../../lib/plugin-version.js\";\nimport { EXIT_CODES } from \"../../lib/exit-codes.js\";\nimport path from \"path\";\nimport { PLUGIN_MANIFEST_DIR, PLUGIN_MANIFEST_FILE } from \"../../consts.js\";\nimport { fileExists } from \"../../utils/fs.js\";\n\nasync function findPluginManifest(startDir: string): Promise<string | null> {\n let currentDir = startDir;\n const root = path.parse(currentDir).root;\n\n while (currentDir !== root) {\n const manifestPath = path.join(\n currentDir,\n PLUGIN_MANIFEST_DIR,\n PLUGIN_MANIFEST_FILE,\n );\n if (await fileExists(manifestPath)) {\n return manifestPath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return null;\n}\n\nexport default class Version extends BaseCommand {\n static summary = \"Show current plugin version\";\n static description =\n \"Display the current version of the plugin in the current directory.\";\n\n static flags = {\n ...BaseCommand.baseFlags,\n };\n\n static examples = [\"<%= config.bin %> <%= command.id %>\"];\n\n async run(): Promise<void> {\n await this.parse(Version);\n const manifestPath = await findPluginManifest(process.cwd());\n\n if (!manifestPath) {\n this.error(\n `No plugin.json found in current directory or parents\\nExpected location: ${PLUGIN_MANIFEST_DIR}/${PLUGIN_MANIFEST_FILE}`,\n { exit: EXIT_CODES.ERROR },\n );\n }\n\n const pluginDir = path.dirname(path.dirname(manifestPath));\n\n try {\n const version = await getPluginVersion(pluginDir);\n this.log(version);\n } catch (error) {\n this.error(`Failed to read plugin version: ${error}`, {\n exit: EXIT_CODES.ERROR,\n });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAOA,OAAO,UAAU;AAIjB,eAAe,mBAAmB,UAA0C;AAC1E,MAAI,aAAa;AACjB,QAAM,OAAO,KAAK,MAAM,UAAU,EAAE;AAEpC,SAAO,eAAe,MAAM;AAC1B,UAAM,eAAe,KAAK;AAAA,MACxB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,QAAI,MAAM,WAAW,YAAY,GAAG;AAClC,aAAO;AAAA,IACT;AACA,iBAAa,KAAK,QAAQ,UAAU;AAAA,EACtC;AAEA,SAAO;AACT;AAEA,IAAqB,UAArB,MAAqB,iBAAgB,YAAY;AAAA,EAC/C,OAAO,UAAU;AAAA,EACjB,OAAO,cACL;AAAA,EAEF,OAAO,QAAQ;AAAA,IACb,GAAG,YAAY;AAAA,EACjB;AAAA,EAEA,OAAO,WAAW,CAAC,qCAAqC;AAAA,EAExD,MAAM,MAAqB;AACzB,UAAM,KAAK,MAAM,QAAO;AACxB,UAAM,eAAe,MAAM,mBAAmB,QAAQ,IAAI,CAAC;AAE3D,QAAI,CAAC,cAAc;AACjB,WAAK;AAAA,QACH;AAAA,qBAA4E,mBAAmB,IAAI,oBAAoB;AAAA,QACvH,EAAE,MAAM,WAAW,MAAM;AAAA,MAC3B;AAAA,IACF;AAEA,UAAM,YAAY,KAAK,QAAQ,KAAK,QAAQ,YAAY,CAAC;AAEzD,QAAI;AACF,YAAM,UAAU,MAAM,iBAAiB,SAAS;AAChD,WAAK,IAAI,OAAO;AAAA,IAClB,SAAS,OAAO;AACd,WAAK,MAAM,kCAAkC,KAAK,IAAI;AAAA,QACpD,MAAM,WAAW;AAAA,MACnB,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}