@hypercli/gen 0.1.1 → 0.1.2
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/oclif.manifest.json +4 -274
- package/package.json +4 -4
- package/dist/commands/cookbook/info.d.ts +0 -22
- package/dist/commands/cookbook/info.d.ts.map +0 -1
- package/dist/commands/cookbook/info.js +0 -217
- package/dist/commands/cookbook/info.js.map +0 -1
- package/dist/commands/cookbook/list.d.ts +0 -20
- package/dist/commands/cookbook/list.d.ts.map +0 -1
- package/dist/commands/cookbook/list.js +0 -133
- package/dist/commands/cookbook/list.js.map +0 -1
- package/dist/commands/recipe/info.d.ts +0 -18
- package/dist/commands/recipe/info.d.ts.map +0 -1
- package/dist/commands/recipe/info.js +0 -89
- package/dist/commands/recipe/info.js.map +0 -1
- package/dist/commands/recipe/list.d.ts +0 -29
- package/dist/commands/recipe/list.d.ts.map +0 -1
- package/dist/commands/recipe/list.js +0 -215
- package/dist/commands/recipe/list.js.map +0 -1
package/oclif.manifest.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"cwd": {
|
|
23
23
|
"description": "Working directory",
|
|
24
24
|
"name": "cwd",
|
|
25
|
-
"default": "/work/hyper/packages/gen",
|
|
25
|
+
"default": "/home/runner/work/hyper-coding/hyper-coding/packages/gen",
|
|
26
26
|
"hasDynamicHelp": false,
|
|
27
27
|
"multiple": false,
|
|
28
28
|
"type": "option"
|
|
@@ -104,276 +104,6 @@
|
|
|
104
104
|
"gen.js"
|
|
105
105
|
]
|
|
106
106
|
},
|
|
107
|
-
"cookbook:info": {
|
|
108
|
-
"aliases": [],
|
|
109
|
-
"args": {
|
|
110
|
-
"cookbook": {
|
|
111
|
-
"description": "Cookbook name or path",
|
|
112
|
-
"name": "cookbook",
|
|
113
|
-
"required": true
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
"description": "Show detailed information about a cookbook",
|
|
117
|
-
"examples": [
|
|
118
|
-
"<%= config.bin %> cookbook info starlight",
|
|
119
|
-
"<%= config.bin %> cookbook info @kit/starlight/docs --json"
|
|
120
|
-
],
|
|
121
|
-
"flags": {
|
|
122
|
-
"cwd": {
|
|
123
|
-
"description": "Working directory",
|
|
124
|
-
"name": "cwd",
|
|
125
|
-
"default": "/work/hyper/packages/gen",
|
|
126
|
-
"hasDynamicHelp": false,
|
|
127
|
-
"multiple": false,
|
|
128
|
-
"type": "option"
|
|
129
|
-
},
|
|
130
|
-
"debug": {
|
|
131
|
-
"char": "d",
|
|
132
|
-
"description": "Enable debug output",
|
|
133
|
-
"env": "DEBUG",
|
|
134
|
-
"name": "debug",
|
|
135
|
-
"allowNo": false,
|
|
136
|
-
"type": "boolean"
|
|
137
|
-
},
|
|
138
|
-
"json": {
|
|
139
|
-
"description": "Output as JSON",
|
|
140
|
-
"name": "json",
|
|
141
|
-
"allowNo": false,
|
|
142
|
-
"type": "boolean"
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
"hasDynamicHelp": false,
|
|
146
|
-
"hiddenAliases": [],
|
|
147
|
-
"id": "cookbook:info",
|
|
148
|
-
"pluginAlias": "@hypercli/gen",
|
|
149
|
-
"pluginName": "@hypercli/gen",
|
|
150
|
-
"pluginType": "core",
|
|
151
|
-
"strict": true,
|
|
152
|
-
"enableJsonFlag": false,
|
|
153
|
-
"isESM": true,
|
|
154
|
-
"relativePath": [
|
|
155
|
-
"dist",
|
|
156
|
-
"commands",
|
|
157
|
-
"cookbook",
|
|
158
|
-
"info.js"
|
|
159
|
-
]
|
|
160
|
-
},
|
|
161
|
-
"cookbook:list": {
|
|
162
|
-
"aliases": [],
|
|
163
|
-
"args": {
|
|
164
|
-
"kit": {
|
|
165
|
-
"description": "Kit to list cookbooks from (optional, lists all if omitted)",
|
|
166
|
-
"name": "kit",
|
|
167
|
-
"required": false
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
"description": "List cookbooks in a kit or all installed cookbooks",
|
|
171
|
-
"examples": [
|
|
172
|
-
"<%= config.bin %> cookbook list",
|
|
173
|
-
"<%= config.bin %> cookbook list @kit/starlight",
|
|
174
|
-
"<%= config.bin %> cookbook list --json"
|
|
175
|
-
],
|
|
176
|
-
"flags": {
|
|
177
|
-
"cwd": {
|
|
178
|
-
"description": "Working directory",
|
|
179
|
-
"name": "cwd",
|
|
180
|
-
"default": "/work/hyper/packages/gen",
|
|
181
|
-
"hasDynamicHelp": false,
|
|
182
|
-
"multiple": false,
|
|
183
|
-
"type": "option"
|
|
184
|
-
},
|
|
185
|
-
"debug": {
|
|
186
|
-
"char": "d",
|
|
187
|
-
"description": "Enable debug output",
|
|
188
|
-
"env": "DEBUG",
|
|
189
|
-
"name": "debug",
|
|
190
|
-
"allowNo": false,
|
|
191
|
-
"type": "boolean"
|
|
192
|
-
},
|
|
193
|
-
"json": {
|
|
194
|
-
"description": "Output as JSON",
|
|
195
|
-
"name": "json",
|
|
196
|
-
"allowNo": false,
|
|
197
|
-
"type": "boolean"
|
|
198
|
-
},
|
|
199
|
-
"kit": {
|
|
200
|
-
"char": "k",
|
|
201
|
-
"description": "Filter by kit name",
|
|
202
|
-
"name": "kit",
|
|
203
|
-
"hasDynamicHelp": false,
|
|
204
|
-
"multiple": false,
|
|
205
|
-
"type": "option"
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
"hasDynamicHelp": false,
|
|
209
|
-
"hiddenAliases": [],
|
|
210
|
-
"id": "cookbook:list",
|
|
211
|
-
"pluginAlias": "@hypercli/gen",
|
|
212
|
-
"pluginName": "@hypercli/gen",
|
|
213
|
-
"pluginType": "core",
|
|
214
|
-
"strict": true,
|
|
215
|
-
"enableJsonFlag": false,
|
|
216
|
-
"isESM": true,
|
|
217
|
-
"relativePath": [
|
|
218
|
-
"dist",
|
|
219
|
-
"commands",
|
|
220
|
-
"cookbook",
|
|
221
|
-
"list.js"
|
|
222
|
-
]
|
|
223
|
-
},
|
|
224
|
-
"recipe:info": {
|
|
225
|
-
"aliases": [],
|
|
226
|
-
"args": {
|
|
227
|
-
"recipe": {
|
|
228
|
-
"description": "Path to recipe file (.yml or .yaml)",
|
|
229
|
-
"name": "recipe",
|
|
230
|
-
"required": true
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
"description": "Show detailed recipe information",
|
|
234
|
-
"examples": [
|
|
235
|
-
"<%= config.bin %> <%= command.id %> my-recipe.yml",
|
|
236
|
-
"<%= config.bin %> <%= command.id %> .hyper/kits/component.yml --json"
|
|
237
|
-
],
|
|
238
|
-
"flags": {
|
|
239
|
-
"cwd": {
|
|
240
|
-
"description": "Working directory",
|
|
241
|
-
"name": "cwd",
|
|
242
|
-
"default": "/work/hyper/packages/gen",
|
|
243
|
-
"hasDynamicHelp": false,
|
|
244
|
-
"multiple": false,
|
|
245
|
-
"type": "option"
|
|
246
|
-
},
|
|
247
|
-
"debug": {
|
|
248
|
-
"char": "d",
|
|
249
|
-
"description": "Enable debug output",
|
|
250
|
-
"env": "DEBUG",
|
|
251
|
-
"name": "debug",
|
|
252
|
-
"allowNo": false,
|
|
253
|
-
"type": "boolean"
|
|
254
|
-
},
|
|
255
|
-
"json": {
|
|
256
|
-
"description": "Output as JSON",
|
|
257
|
-
"name": "json",
|
|
258
|
-
"allowNo": false,
|
|
259
|
-
"type": "boolean"
|
|
260
|
-
},
|
|
261
|
-
"verbose": {
|
|
262
|
-
"char": "v",
|
|
263
|
-
"description": "Verbose output",
|
|
264
|
-
"name": "verbose",
|
|
265
|
-
"allowNo": false,
|
|
266
|
-
"type": "boolean"
|
|
267
|
-
},
|
|
268
|
-
"quiet": {
|
|
269
|
-
"char": "q",
|
|
270
|
-
"description": "Quiet output",
|
|
271
|
-
"name": "quiet",
|
|
272
|
-
"allowNo": false,
|
|
273
|
-
"type": "boolean"
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
"hasDynamicHelp": false,
|
|
277
|
-
"hiddenAliases": [],
|
|
278
|
-
"id": "recipe:info",
|
|
279
|
-
"pluginAlias": "@hypercli/gen",
|
|
280
|
-
"pluginName": "@hypercli/gen",
|
|
281
|
-
"pluginType": "core",
|
|
282
|
-
"strict": true,
|
|
283
|
-
"enableJsonFlag": false,
|
|
284
|
-
"isESM": true,
|
|
285
|
-
"relativePath": [
|
|
286
|
-
"dist",
|
|
287
|
-
"commands",
|
|
288
|
-
"recipe",
|
|
289
|
-
"info.js"
|
|
290
|
-
]
|
|
291
|
-
},
|
|
292
|
-
"recipe:list": {
|
|
293
|
-
"aliases": [],
|
|
294
|
-
"args": {
|
|
295
|
-
"kit": {
|
|
296
|
-
"description": "Kit to list recipes from (optional, lists all if omitted)",
|
|
297
|
-
"name": "kit",
|
|
298
|
-
"required": false
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
|
-
"description": "List available recipes from all discovered kits",
|
|
302
|
-
"examples": [
|
|
303
|
-
"<%= config.bin %> <%= command.id %>",
|
|
304
|
-
"<%= config.bin %> <%= command.id %> nextjs",
|
|
305
|
-
"<%= config.bin %> <%= command.id %> --json"
|
|
306
|
-
],
|
|
307
|
-
"flags": {
|
|
308
|
-
"cwd": {
|
|
309
|
-
"description": "Working directory",
|
|
310
|
-
"name": "cwd",
|
|
311
|
-
"default": "/work/hyper/packages/gen",
|
|
312
|
-
"hasDynamicHelp": false,
|
|
313
|
-
"multiple": false,
|
|
314
|
-
"type": "option"
|
|
315
|
-
},
|
|
316
|
-
"debug": {
|
|
317
|
-
"char": "d",
|
|
318
|
-
"description": "Enable debug output",
|
|
319
|
-
"env": "DEBUG",
|
|
320
|
-
"name": "debug",
|
|
321
|
-
"allowNo": false,
|
|
322
|
-
"type": "boolean"
|
|
323
|
-
},
|
|
324
|
-
"json": {
|
|
325
|
-
"description": "Output as JSON",
|
|
326
|
-
"name": "json",
|
|
327
|
-
"allowNo": false,
|
|
328
|
-
"type": "boolean"
|
|
329
|
-
},
|
|
330
|
-
"verbose": {
|
|
331
|
-
"char": "v",
|
|
332
|
-
"description": "Verbose output",
|
|
333
|
-
"name": "verbose",
|
|
334
|
-
"allowNo": false,
|
|
335
|
-
"type": "boolean"
|
|
336
|
-
},
|
|
337
|
-
"quiet": {
|
|
338
|
-
"char": "q",
|
|
339
|
-
"description": "Quiet output",
|
|
340
|
-
"name": "quiet",
|
|
341
|
-
"allowNo": false,
|
|
342
|
-
"type": "boolean"
|
|
343
|
-
},
|
|
344
|
-
"kit": {
|
|
345
|
-
"char": "k",
|
|
346
|
-
"description": "Filter by kit name",
|
|
347
|
-
"name": "kit",
|
|
348
|
-
"hasDynamicHelp": false,
|
|
349
|
-
"multiple": false,
|
|
350
|
-
"type": "option"
|
|
351
|
-
},
|
|
352
|
-
"cookbook": {
|
|
353
|
-
"char": "c",
|
|
354
|
-
"description": "Filter by cookbook name",
|
|
355
|
-
"name": "cookbook",
|
|
356
|
-
"hasDynamicHelp": false,
|
|
357
|
-
"multiple": false,
|
|
358
|
-
"type": "option"
|
|
359
|
-
}
|
|
360
|
-
},
|
|
361
|
-
"hasDynamicHelp": false,
|
|
362
|
-
"hiddenAliases": [],
|
|
363
|
-
"id": "recipe:list",
|
|
364
|
-
"pluginAlias": "@hypercli/gen",
|
|
365
|
-
"pluginName": "@hypercli/gen",
|
|
366
|
-
"pluginType": "core",
|
|
367
|
-
"strict": true,
|
|
368
|
-
"enableJsonFlag": false,
|
|
369
|
-
"isESM": true,
|
|
370
|
-
"relativePath": [
|
|
371
|
-
"dist",
|
|
372
|
-
"commands",
|
|
373
|
-
"recipe",
|
|
374
|
-
"list.js"
|
|
375
|
-
]
|
|
376
|
-
},
|
|
377
107
|
"recipe:run": {
|
|
378
108
|
"aliases": [],
|
|
379
109
|
"args": {
|
|
@@ -395,7 +125,7 @@
|
|
|
395
125
|
"cwd": {
|
|
396
126
|
"description": "Working directory",
|
|
397
127
|
"name": "cwd",
|
|
398
|
-
"default": "/work/hyper/packages/gen",
|
|
128
|
+
"default": "/home/runner/work/hyper-coding/hyper-coding/packages/gen",
|
|
399
129
|
"hasDynamicHelp": false,
|
|
400
130
|
"multiple": false,
|
|
401
131
|
"type": "option"
|
|
@@ -519,7 +249,7 @@
|
|
|
519
249
|
"cwd": {
|
|
520
250
|
"description": "Working directory",
|
|
521
251
|
"name": "cwd",
|
|
522
|
-
"default": "/work/hyper/packages/gen",
|
|
252
|
+
"default": "/home/runner/work/hyper-coding/hyper-coding/packages/gen",
|
|
523
253
|
"hasDynamicHelp": false,
|
|
524
254
|
"multiple": false,
|
|
525
255
|
"type": "option"
|
|
@@ -576,5 +306,5 @@
|
|
|
576
306
|
]
|
|
577
307
|
}
|
|
578
308
|
},
|
|
579
|
-
"version": "0.1.
|
|
309
|
+
"version": "0.1.2"
|
|
580
310
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hypercli/gen",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Code generation engine for HyperDev",
|
|
6
6
|
"keywords": [
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@clack/prompts": "^0.11.0",
|
|
90
|
-
"@hypercli/core": "^0.1.
|
|
91
|
-
"@hypercli/kit": "^0.1.
|
|
92
|
-
"@hypercli/ui": "^0.1.
|
|
90
|
+
"@hypercli/core": "^0.1.2",
|
|
91
|
+
"@hypercli/kit": "^0.1.2",
|
|
92
|
+
"@hypercli/ui": "^0.1.2",
|
|
93
93
|
"@jig-lang/jig": "^1.0.1",
|
|
94
94
|
"@oclif/core": "^4",
|
|
95
95
|
"ai": "^4.0.0",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Show detailed information about a cookbook
|
|
3
|
-
*/
|
|
4
|
-
import { BaseCommand } from "#lib/base-command";
|
|
5
|
-
export default class CookbookInfo extends BaseCommand<typeof CookbookInfo> {
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
static flags: {
|
|
9
|
-
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
-
cwd: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
-
};
|
|
13
|
-
static args: {
|
|
14
|
-
cookbook: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
15
|
-
};
|
|
16
|
-
run(): Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Display available cookbooks grouped by kit when a cookbook is not found
|
|
19
|
-
*/
|
|
20
|
-
private suggestAvailableCookbooks;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=info.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../src/commands/cookbook/info.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW,CAAC,OAAO,YAAY,CAAC;IACzE,OAAgB,WAAW,SAAgD;IAE3E,OAAgB,QAAQ,WAGtB;IAEF,OAAgB,KAAK;;;;MAMnB;IAEF,OAAgB,IAAI;;MAKlB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAqL1B;;OAEG;YACW,yBAAyB;CAmEvC"}
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Show detailed information about a cookbook
|
|
3
|
-
*/
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { c, s } from "@hypercli/ui/shortcuts";
|
|
6
|
-
import { Args, Flags } from "@oclif/core";
|
|
7
|
-
import { BaseCommand } from "#lib/base-command";
|
|
8
|
-
export default class CookbookInfo extends BaseCommand {
|
|
9
|
-
static description = "Show detailed information about a cookbook";
|
|
10
|
-
static examples = [
|
|
11
|
-
"<%= config.bin %> cookbook info starlight",
|
|
12
|
-
"<%= config.bin %> cookbook info @kit/starlight/docs --json",
|
|
13
|
-
];
|
|
14
|
-
static flags = {
|
|
15
|
-
...BaseCommand.baseFlags,
|
|
16
|
-
json: Flags.boolean({
|
|
17
|
-
description: "Output as JSON",
|
|
18
|
-
default: false,
|
|
19
|
-
}),
|
|
20
|
-
};
|
|
21
|
-
static args = {
|
|
22
|
-
cookbook: Args.string({
|
|
23
|
-
description: "Cookbook name or path",
|
|
24
|
-
required: true,
|
|
25
|
-
}),
|
|
26
|
-
};
|
|
27
|
-
async run() {
|
|
28
|
-
const { args, flags } = await this.parse(CookbookInfo);
|
|
29
|
-
try {
|
|
30
|
-
this.log(s.hint(`Searching for cookbook: ${args.cookbook}...`));
|
|
31
|
-
// 1. Discover all kits
|
|
32
|
-
const generators = await this.discovery.discoverAll();
|
|
33
|
-
// 2. Find the cookbook in the discovered kits
|
|
34
|
-
let foundCookbook;
|
|
35
|
-
// Helper to match cookbook name
|
|
36
|
-
const targetCookbook = args.cookbook;
|
|
37
|
-
for (const generator of generators) {
|
|
38
|
-
// We only care about kits (generators with cookbooks)
|
|
39
|
-
if (!generator.cookbooks || generator.cookbooks.length === 0)
|
|
40
|
-
continue;
|
|
41
|
-
// Check if this kit contains the requested cookbook
|
|
42
|
-
if (generator.cookbooks.includes(targetCookbook)) {
|
|
43
|
-
// Found it! Now we need the path.
|
|
44
|
-
// We need to re-parse the kit to get the cookbook globs and find the path
|
|
45
|
-
// (GeneratorDiscovery only gives us names)
|
|
46
|
-
// Import from @hypercli/core
|
|
47
|
-
const { parseKitFile, discoverCookbooksInKit } = await import("@hypercli/core");
|
|
48
|
-
const kitYmlPath = path.join(generator.path, "kit.yml");
|
|
49
|
-
const parsedKit = await parseKitFile(kitYmlPath);
|
|
50
|
-
if (parsedKit.isValid && parsedKit.config.cookbooks) {
|
|
51
|
-
const cookbooks = await discoverCookbooksInKit(generator.path, parsedKit.config.cookbooks);
|
|
52
|
-
const cookbook = cookbooks.get(targetCookbook);
|
|
53
|
-
if (cookbook) {
|
|
54
|
-
foundCookbook = {
|
|
55
|
-
kitName: generator.name,
|
|
56
|
-
kitPath: generator.path,
|
|
57
|
-
cookbookName: cookbook.config.name,
|
|
58
|
-
cookbookPath: cookbook.dirPath,
|
|
59
|
-
config: cookbook.config,
|
|
60
|
-
};
|
|
61
|
-
break; // Stop searching once found
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (!foundCookbook) {
|
|
67
|
-
this.log(s.error(`Cookbook not found: ${args.cookbook}`));
|
|
68
|
-
await this.suggestAvailableCookbooks(generators);
|
|
69
|
-
this.exit(1);
|
|
70
|
-
}
|
|
71
|
-
// 3. Discover recipes in the cookbook
|
|
72
|
-
const { discoverRecipesInCookbook } = await import("@hypercli/core");
|
|
73
|
-
// Default recipe globs if not specified in cookbook config
|
|
74
|
-
const recipeGlobs = foundCookbook.config.recipes || ["./*/recipe.yml"];
|
|
75
|
-
const recipeMap = await discoverRecipesInCookbook(foundCookbook.cookbookPath, recipeGlobs);
|
|
76
|
-
const recipePaths = Array.from(recipeMap.values());
|
|
77
|
-
// 4. Load recipe details
|
|
78
|
-
const recipesWithDetails = [];
|
|
79
|
-
for (const recipePath of recipePaths) {
|
|
80
|
-
try {
|
|
81
|
-
const { recipe } = await this.recipeEngine.loadRecipe(recipePath);
|
|
82
|
-
recipesWithDetails.push(recipe);
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
// Log warning but continue
|
|
86
|
-
this.warn(`Failed to load recipe at ${recipePath}: ${e instanceof Error ? e.message : String(e)}`);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// Sort recipes by name
|
|
90
|
-
recipesWithDetails.sort((a, b) => a.name.localeCompare(b.name));
|
|
91
|
-
if (flags.json) {
|
|
92
|
-
const output = {
|
|
93
|
-
name: foundCookbook.cookbookName,
|
|
94
|
-
kit: foundCookbook.kitName,
|
|
95
|
-
location: foundCookbook.cookbookPath,
|
|
96
|
-
description: foundCookbook.config.description,
|
|
97
|
-
recipes: recipesWithDetails,
|
|
98
|
-
};
|
|
99
|
-
this.log(JSON.stringify(output, null, 2));
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
// 5. Display Information
|
|
103
|
-
this.log("");
|
|
104
|
-
this.log(s.title("Cookbook", foundCookbook.cookbookName));
|
|
105
|
-
this.log(s.hr());
|
|
106
|
-
this.log(s.keyValue("Location", s.path(foundCookbook.cookbookPath), 10));
|
|
107
|
-
this.log(s.keyValue("Kit", c.kit(foundCookbook.kitName), 10));
|
|
108
|
-
if (foundCookbook.config.description) {
|
|
109
|
-
this.log(s.keyValue("Description", foundCookbook.config.description, 10));
|
|
110
|
-
}
|
|
111
|
-
this.log("");
|
|
112
|
-
this.log(s.header("Recipes", recipesWithDetails.length));
|
|
113
|
-
if (recipesWithDetails.length === 0) {
|
|
114
|
-
this.log(s.description("(No recipes found)", 2));
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
for (const recipe of recipesWithDetails) {
|
|
118
|
-
this.log("");
|
|
119
|
-
this.log(s.listItem(c.recipe(recipe.name)));
|
|
120
|
-
if (recipe.description) {
|
|
121
|
-
this.log(s.description(recipe.description));
|
|
122
|
-
}
|
|
123
|
-
if (recipe.variables && Object.keys(recipe.variables).length > 0) {
|
|
124
|
-
this.log(s.indent(c.helper("Variables:"), 4));
|
|
125
|
-
for (const [key, variable] of Object.entries(recipe.variables)) {
|
|
126
|
-
const varAny = variable;
|
|
127
|
-
let varLine = c.property(` ${key}`);
|
|
128
|
-
if (varAny.type) {
|
|
129
|
-
varLine += c.subtle(` (${varAny.type})`);
|
|
130
|
-
}
|
|
131
|
-
if (varAny.required) {
|
|
132
|
-
varLine += c.required(" *required*");
|
|
133
|
-
}
|
|
134
|
-
if (varAny.default !== undefined) {
|
|
135
|
-
varLine += c.default(varAny.default);
|
|
136
|
-
}
|
|
137
|
-
this.log(s.indent(varLine, 4));
|
|
138
|
-
if (varAny.description) {
|
|
139
|
-
this.log(s.indent(c.text(varAny.description), 6));
|
|
140
|
-
}
|
|
141
|
-
// Helper to check for enum properties safely
|
|
142
|
-
if (varAny.options && Array.isArray(varAny.options)) {
|
|
143
|
-
this.log(s.indent(c.enum(`Enum: ${varAny.options.map((o) => (typeof o === "object" ? o.value : o)).join(", ")}`), 6));
|
|
144
|
-
}
|
|
145
|
-
if (varAny.suggestion) {
|
|
146
|
-
this.log(s.indent(c.subtle(`Suggestion: ${varAny.suggestion}`), 6));
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
this.log("");
|
|
153
|
-
}
|
|
154
|
-
catch (error) {
|
|
155
|
-
this.error(`Failed to get cookbook info: ${error instanceof Error ? error.message : String(error)}`);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Display available cookbooks grouped by kit when a cookbook is not found
|
|
160
|
-
*/
|
|
161
|
-
async suggestAvailableCookbooks(generators) {
|
|
162
|
-
// Collect all cookbooks grouped by kit
|
|
163
|
-
const cookbooksByKit = new Map();
|
|
164
|
-
for (const generator of generators) {
|
|
165
|
-
if (!generator.cookbooks || generator.cookbooks.length === 0)
|
|
166
|
-
continue;
|
|
167
|
-
const kitCookbooks = [];
|
|
168
|
-
// Try to get cookbook details
|
|
169
|
-
try {
|
|
170
|
-
const { parseKitFile, discoverCookbooksInKit } = await import("@hypercli/core");
|
|
171
|
-
const kitYmlPath = path.join(generator.path, "kit.yml");
|
|
172
|
-
const parsedKit = await parseKitFile(kitYmlPath);
|
|
173
|
-
if (parsedKit.isValid && parsedKit.config.cookbooks) {
|
|
174
|
-
const cookbooks = await discoverCookbooksInKit(generator.path, parsedKit.config.cookbooks);
|
|
175
|
-
for (const [name, cookbook] of cookbooks) {
|
|
176
|
-
kitCookbooks.push({
|
|
177
|
-
name,
|
|
178
|
-
description: cookbook.config.description,
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
catch {
|
|
184
|
-
// Fallback to just names if we can't load details
|
|
185
|
-
for (const cookbookName of generator.cookbooks) {
|
|
186
|
-
kitCookbooks.push({ name: cookbookName });
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
if (kitCookbooks.length > 0) {
|
|
190
|
-
cookbooksByKit.set(generator.name, kitCookbooks);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
if (cookbooksByKit.size === 0) {
|
|
194
|
-
this.log(c.warning("No cookbooks found in any installed kits."));
|
|
195
|
-
this.log(s.hint("\nInstall a kit with: hypergen kit install <kit>"));
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
this.log(c.title("Available cookbooks:"));
|
|
199
|
-
this.log(s.hr());
|
|
200
|
-
this.log("");
|
|
201
|
-
for (const [kitName, cookbooks] of cookbooksByKit) {
|
|
202
|
-
this.log(c.heading(`${kitName}:`));
|
|
203
|
-
for (const cookbook of cookbooks) {
|
|
204
|
-
const name = c.cookbook(` ${cookbook.name}`);
|
|
205
|
-
if (cookbook.description) {
|
|
206
|
-
this.log(`${name} ${c.subtle(`— ${cookbook.description}`)}`);
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
this.log(name);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
this.log("");
|
|
213
|
-
}
|
|
214
|
-
this.log(s.hint("Run `hypergen cookbook info <cookbook>` for more details."));
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
//# sourceMappingURL=info.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../../src/commands/cookbook/info.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE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AAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC,CAAC;IAC/E,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* List cookbooks in a kit or all installed cookbooks
|
|
3
|
-
*/
|
|
4
|
-
import { BaseCommand } from "#lib/base-command";
|
|
5
|
-
export default class CookbookList extends BaseCommand<typeof CookbookList> {
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
static flags: {
|
|
9
|
-
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
-
kit: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
cwd: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
-
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
};
|
|
14
|
-
static args: {
|
|
15
|
-
kit: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
16
|
-
};
|
|
17
|
-
run(): Promise<void>;
|
|
18
|
-
private displayCookbooks;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/cookbook/list.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAWhD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW,CAAC,OAAO,YAAY,CAAC;IACzE,OAAgB,WAAW,SAAwD;IAEnF,OAAgB,QAAQ,WAItB;IAEF,OAAgB,KAAK;;;;;MAUnB;IAEF,OAAgB,IAAI;;MAKlB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA6E1B,OAAO,CAAC,gBAAgB;CAgDxB"}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* List cookbooks in a kit or all installed cookbooks
|
|
3
|
-
*/
|
|
4
|
-
import { discoverCookbooksInKit, discoverRecipesInCookbook } from "@hypercli/core";
|
|
5
|
-
import { c, s } from "@hypercli/ui/shortcuts";
|
|
6
|
-
import { Args, Flags } from "@oclif/core";
|
|
7
|
-
import { BaseCommand } from "#lib/base-command";
|
|
8
|
-
export default class CookbookList extends BaseCommand {
|
|
9
|
-
static description = "List cookbooks in a kit or all installed cookbooks";
|
|
10
|
-
static examples = [
|
|
11
|
-
"<%= config.bin %> cookbook list",
|
|
12
|
-
"<%= config.bin %> cookbook list @kit/starlight",
|
|
13
|
-
"<%= config.bin %> cookbook list --json",
|
|
14
|
-
];
|
|
15
|
-
static flags = {
|
|
16
|
-
...BaseCommand.baseFlags,
|
|
17
|
-
json: Flags.boolean({
|
|
18
|
-
description: "Output as JSON",
|
|
19
|
-
default: false,
|
|
20
|
-
}),
|
|
21
|
-
kit: Flags.string({
|
|
22
|
-
char: "k",
|
|
23
|
-
description: "Filter by kit name",
|
|
24
|
-
}),
|
|
25
|
-
};
|
|
26
|
-
static args = {
|
|
27
|
-
kit: Args.string({
|
|
28
|
-
description: "Kit to list cookbooks from (optional, lists all if omitted)",
|
|
29
|
-
required: false,
|
|
30
|
-
}),
|
|
31
|
-
};
|
|
32
|
-
async run() {
|
|
33
|
-
const { args, flags } = await this.parse(CookbookList);
|
|
34
|
-
try {
|
|
35
|
-
// Discover all kits
|
|
36
|
-
const kits = await this.discovery.discoverAll();
|
|
37
|
-
// Filter by kit if specified (via arg or flag)
|
|
38
|
-
const kitFilter = args.kit || flags.kit;
|
|
39
|
-
const targetKits = kitFilter
|
|
40
|
-
? kits.filter((k) => k.name === kitFilter ||
|
|
41
|
-
k.name.endsWith(`/${kitFilter}`) ||
|
|
42
|
-
k.name === `@kit/${kitFilter}`)
|
|
43
|
-
: kits;
|
|
44
|
-
if (targetKits.length === 0 && kitFilter) {
|
|
45
|
-
this.error(`Kit not found: ${kitFilter}`);
|
|
46
|
-
}
|
|
47
|
-
// Collect cookbooks from all target kits
|
|
48
|
-
const cookbooks = [];
|
|
49
|
-
for (const kit of targetKits) {
|
|
50
|
-
if (!kit.cookbooks || kit.cookbooks.length === 0) {
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
const kitPath = kit.path;
|
|
54
|
-
const cookbookGlobs = ["./cookbooks/*/cookbook.yml"]; // Default pattern
|
|
55
|
-
try {
|
|
56
|
-
const discoveredCookbooks = await discoverCookbooksInKit(kitPath, cookbookGlobs);
|
|
57
|
-
for (const [cookbookName, cookbook] of discoveredCookbooks) {
|
|
58
|
-
// Discover actual recipe names from the cookbook directory
|
|
59
|
-
const recipeGlobs = cookbook.config.recipes ?? ["./*/recipe.yml"];
|
|
60
|
-
let recipeNames;
|
|
61
|
-
try {
|
|
62
|
-
const discoveredRecipes = await discoverRecipesInCookbook(cookbook.dirPath, recipeGlobs);
|
|
63
|
-
if (discoveredRecipes.size > 0) {
|
|
64
|
-
recipeNames = Array.from(discoveredRecipes.keys()).sort();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
catch {
|
|
68
|
-
// If recipe discovery fails, omit the recipes list
|
|
69
|
-
}
|
|
70
|
-
cookbooks.push({
|
|
71
|
-
name: cookbookName,
|
|
72
|
-
kit: kit.name,
|
|
73
|
-
description: cookbook.config.description,
|
|
74
|
-
version: cookbook.config.version,
|
|
75
|
-
recipes: recipeNames,
|
|
76
|
-
path: cookbook.dirPath,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
// Skip kits that fail to parse
|
|
82
|
-
this.warn(`Failed to discover cookbooks in kit ${kit.name}: ${error}`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
this.displayCookbooks(cookbooks, flags);
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
this.error(`Failed to list cookbooks: ${error instanceof Error ? error.message : String(error)}`);
|
|
89
|
-
}
|
|
90
|
-
this.exit(0);
|
|
91
|
-
}
|
|
92
|
-
displayCookbooks(cookbooks, flags) {
|
|
93
|
-
if (flags.json) {
|
|
94
|
-
this.log(JSON.stringify(cookbooks, null, 2));
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (cookbooks.length === 0) {
|
|
98
|
-
this.log(c.warning("No cookbooks found."));
|
|
99
|
-
this.log(s.hint("\nInstall a kit with: hypergen kit install <kit>"));
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
// Group by kit for display
|
|
103
|
-
const byKit = new Map();
|
|
104
|
-
for (const cookbook of cookbooks) {
|
|
105
|
-
const kitCookbooks = byKit.get(cookbook.kit) || [];
|
|
106
|
-
kitCookbooks.push(cookbook);
|
|
107
|
-
byKit.set(cookbook.kit, kitCookbooks);
|
|
108
|
-
}
|
|
109
|
-
this.log(s.header("Cookbooks", cookbooks.length));
|
|
110
|
-
this.log("");
|
|
111
|
-
for (const [kitName, kitCookbooks] of byKit) {
|
|
112
|
-
this.log(c.kit(`${kitName}:`));
|
|
113
|
-
for (const cookbook of kitCookbooks) {
|
|
114
|
-
const versionStr = cookbook.version ? ` ${s.version(cookbook.version)}` : "";
|
|
115
|
-
this.log(s.listItem(c.cookbook(cookbook.name) + versionStr));
|
|
116
|
-
const bodyLines = [];
|
|
117
|
-
if (cookbook.description) {
|
|
118
|
-
bodyLines.push(s.description(cookbook.description.trim()));
|
|
119
|
-
}
|
|
120
|
-
if (cookbook.recipes && cookbook.recipes.length > 0) {
|
|
121
|
-
const recipeList = cookbook.recipes.map((r) => c.recipe(r)).join(c.muted(", "));
|
|
122
|
-
if (bodyLines.length > 0)
|
|
123
|
-
bodyLines.push("");
|
|
124
|
-
bodyLines.push(s.description("Recipes: ") + recipeList);
|
|
125
|
-
}
|
|
126
|
-
if (bodyLines.length > 0) {
|
|
127
|
-
this.log(s.listItemBody(...bodyLines));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=list.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/cookbook/list.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAWhD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAgC;IACzE,MAAM,CAAU,WAAW,GAAG,oDAAoD,CAAC;IAEnF,MAAM,CAAU,QAAQ,GAAG;QAC1B,iCAAiC;QACjC,gDAAgD;QAChD,wCAAwC;KACxC,CAAC;IAEF,MAAM,CAAU,KAAK,GAAG;QACvB,GAAG,WAAW,CAAC,SAAS;QACxB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC;YACnB,WAAW,EAAE,gBAAgB;YAC7B,OAAO,EAAE,KAAK;SACd,CAAC;QACF,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC;YACjB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,oBAAoB;SACjC,CAAC;KACF,CAAC;IAEF,MAAM,CAAU,IAAI,GAAG;QACtB,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC;YAChB,WAAW,EAAE,6DAA6D;YAC1E,QAAQ,EAAE,KAAK;SACf,CAAC;KACF,CAAC;IAEF,KAAK,CAAC,GAAG;QACR,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAEvD,IAAI,CAAC;YACJ,oBAAoB;YACpB,MAAM,IAAI,GAAG,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,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;gBAE7D,MAAM,SAAS,GAAa,EAAE,CAAC;gBAE/B,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;oBAC1B,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;gBAC5D,CAAC;gBAED,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACrD,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;oBAChF,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;wBAAE,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBAC7C,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC,CAAC;gBACzD,CAAC;gBAED,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC1B,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;gBACxC,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Recipe Info command - Show recipe information
|
|
3
|
-
*/
|
|
4
|
-
import { BaseCommand } from "#lib/base-command";
|
|
5
|
-
export default class RecipeInfo extends BaseCommand<typeof RecipeInfo> {
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
static flags: {
|
|
9
|
-
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
-
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
-
};
|
|
13
|
-
static args: {
|
|
14
|
-
recipe: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
15
|
-
};
|
|
16
|
-
run(): Promise<void>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=info.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../src/commands/recipe/info.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW,CAAC,OAAO,UAAU,CAAC;IACrE,OAAgB,WAAW,SAAsC;IAEjE,OAAgB,QAAQ,WAGtB;IAEF,OAAgB,KAAK;;;;MAEnB;IAEF,OAAgB,IAAI;;MAKlB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAkE1B"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Recipe Info command - Show recipe information
|
|
3
|
-
*/
|
|
4
|
-
import { Args } from "@oclif/core";
|
|
5
|
-
import { BaseCommand } from "#lib/base-command";
|
|
6
|
-
import { outputFlags } from "#lib/flags";
|
|
7
|
-
import { loadRecipe } from "#recipe-engine/recipe-engine";
|
|
8
|
-
export default class RecipeInfo extends BaseCommand {
|
|
9
|
-
static description = "Show detailed recipe information";
|
|
10
|
-
static examples = [
|
|
11
|
-
"<%= config.bin %> <%= command.id %> my-recipe.yml",
|
|
12
|
-
"<%= config.bin %> <%= command.id %> .hyper/kits/component.yml --json",
|
|
13
|
-
];
|
|
14
|
-
static flags = {
|
|
15
|
-
...outputFlags,
|
|
16
|
-
};
|
|
17
|
-
static args = {
|
|
18
|
-
recipe: Args.string({
|
|
19
|
-
description: "Path to recipe file (.yml or .yaml)",
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
};
|
|
23
|
-
async run() {
|
|
24
|
-
const { args, flags } = await this.parse(RecipeInfo);
|
|
25
|
-
const recipePath = args.recipe;
|
|
26
|
-
try {
|
|
27
|
-
const result = await loadRecipe(recipePath);
|
|
28
|
-
const recipe = result.recipe;
|
|
29
|
-
if (flags.json) {
|
|
30
|
-
this.log(JSON.stringify(recipe, null, 2));
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
this.log(`Recipe: ${recipe.name}`);
|
|
34
|
-
this.log(`Version: ${recipe.version || "unversioned"}`);
|
|
35
|
-
if (recipe.description) {
|
|
36
|
-
this.log(`Description: ${recipe.description}`);
|
|
37
|
-
}
|
|
38
|
-
// Variables
|
|
39
|
-
const variables = Object.entries(recipe.variables || {});
|
|
40
|
-
if (variables.length > 0) {
|
|
41
|
-
this.log("");
|
|
42
|
-
this.log(`Variables (${variables.length}):`);
|
|
43
|
-
for (const [name, varConfig] of variables) {
|
|
44
|
-
let line = ` - ${name}`;
|
|
45
|
-
if (typeof varConfig === "object" && varConfig !== null) {
|
|
46
|
-
const config = varConfig;
|
|
47
|
-
if (config.type)
|
|
48
|
-
line += ` (${config.type})`;
|
|
49
|
-
if (config.required)
|
|
50
|
-
line += " *required*";
|
|
51
|
-
if (config.default !== undefined)
|
|
52
|
-
line += ` [default: ${config.default}]`;
|
|
53
|
-
if (config.description)
|
|
54
|
-
line += ` - ${config.description}`;
|
|
55
|
-
}
|
|
56
|
-
this.log(line);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
// Steps
|
|
60
|
-
if (recipe.steps?.length) {
|
|
61
|
-
this.log("");
|
|
62
|
-
this.log(`Steps (${recipe.steps.length}):`);
|
|
63
|
-
for (let i = 0; i < recipe.steps.length; i++) {
|
|
64
|
-
const step = recipe.steps[i];
|
|
65
|
-
let line = ` ${i + 1}. ${step.name || `Step ${i + 1}`}`;
|
|
66
|
-
line += ` [${step.tool}]`;
|
|
67
|
-
// Check for condition property (may exist on some step types)
|
|
68
|
-
const stepWithCondition = step;
|
|
69
|
-
if (stepWithCondition.condition)
|
|
70
|
-
line += " (conditional)";
|
|
71
|
-
this.log(line);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
// Dependencies
|
|
75
|
-
if (recipe.dependencies?.length) {
|
|
76
|
-
this.log("");
|
|
77
|
-
this.log(`Dependencies (${recipe.dependencies.length}):`);
|
|
78
|
-
for (const dep of recipe.dependencies) {
|
|
79
|
-
this.log(` - ${dep}`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
85
|
-
this.error(`Failed to read recipe: ${message}`);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=info.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../../src/commands/recipe/info.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAA8B;IACrE,MAAM,CAAU,WAAW,GAAG,kCAAkC,CAAC;IAEjE,MAAM,CAAU,QAAQ,GAAG;QAC1B,mDAAmD;QACnD,sEAAsE;KACtE,CAAC;IAEF,MAAM,CAAU,KAAK,GAAG;QACvB,GAAG,WAAW;KACd,CAAC;IAEF,MAAM,CAAU,IAAI,GAAG;QACtB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;YACnB,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AAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAChB,CAAC;YACF,CAAC;YAED,eAAe;YACf,IAAI,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;gBACjC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACb,IAAI,CAAC,GAAG,CAAC,iBAAiB,MAAM,CAAC,YAAY,CAAC,MAAM,IAAI,CAAC,CAAC;gBAC1D,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;oBACvC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;gBACxB,CAAC;YACF,CAAC;QACF,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACzB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,IAAI,CAAC,KAAK,CAAC,0BAA0B,OAAO,EAAE,CAAC,CAAC;QACjD,CAAC;IACF,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Recipe List command - List available recipes from all discovered kits
|
|
3
|
-
*/
|
|
4
|
-
import { BaseCommand } from "#lib/base-command";
|
|
5
|
-
export default class RecipeList extends BaseCommand<typeof RecipeList> {
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
static flags: {
|
|
9
|
-
kit: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
cookbook: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
-
};
|
|
15
|
-
static args: {
|
|
16
|
-
kit: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
17
|
-
};
|
|
18
|
-
run(): Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* Quick parse a recipe file for display purposes
|
|
21
|
-
*/
|
|
22
|
-
private quickParseRecipe;
|
|
23
|
-
/**
|
|
24
|
-
* Get recipe directories by scanning for recipe.yml files
|
|
25
|
-
*/
|
|
26
|
-
private getRecipeDirs;
|
|
27
|
-
private displayRecipes;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/recipe/list.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAahD,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW,CAAC,OAAO,UAAU,CAAC;IACrE,OAAgB,WAAW,SAAqD;IAEhF,OAAgB,QAAQ,WAItB;IAEF,OAAgB,KAAK;;;;;;MAUnB;IAEF,OAAgB,IAAI;;MAKlB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAwH1B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAuBxB;;OAEG;IACH,OAAO,CAAC,aAAa;IAqBrB,OAAO,CAAC,cAAc;CA8CtB"}
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Recipe List command - List available recipes from all discovered kits
|
|
3
|
-
*/
|
|
4
|
-
import fs from "node:fs";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
import { c, s } from "@hypercli/ui/shortcuts";
|
|
7
|
-
import { Args, Flags } from "@oclif/core";
|
|
8
|
-
import yaml from "js-yaml";
|
|
9
|
-
import { BaseCommand } from "#lib/base-command";
|
|
10
|
-
import { outputFlags } from "#lib/flags";
|
|
11
|
-
export default class RecipeList extends BaseCommand {
|
|
12
|
-
static description = "List available recipes from all discovered kits";
|
|
13
|
-
static examples = [
|
|
14
|
-
"<%= config.bin %> <%= command.id %>",
|
|
15
|
-
"<%= config.bin %> <%= command.id %> nextjs",
|
|
16
|
-
"<%= config.bin %> <%= command.id %> --json",
|
|
17
|
-
];
|
|
18
|
-
static flags = {
|
|
19
|
-
...outputFlags,
|
|
20
|
-
kit: Flags.string({
|
|
21
|
-
char: "k",
|
|
22
|
-
description: "Filter by kit name",
|
|
23
|
-
}),
|
|
24
|
-
cookbook: Flags.string({
|
|
25
|
-
char: "c",
|
|
26
|
-
description: "Filter by cookbook name",
|
|
27
|
-
}),
|
|
28
|
-
};
|
|
29
|
-
static args = {
|
|
30
|
-
kit: Args.string({
|
|
31
|
-
description: "Kit to list recipes from (optional, lists all if omitted)",
|
|
32
|
-
required: false,
|
|
33
|
-
}),
|
|
34
|
-
};
|
|
35
|
-
async run() {
|
|
36
|
-
const { args, flags } = await this.parse(RecipeList);
|
|
37
|
-
try {
|
|
38
|
-
// Discover all kits
|
|
39
|
-
const kits = await this.discovery.discoverAll();
|
|
40
|
-
// Filter by kit if specified (via arg or flag)
|
|
41
|
-
const kitFilter = args.kit || flags.kit;
|
|
42
|
-
const targetKits = kitFilter
|
|
43
|
-
? kits.filter((k) => k.name === kitFilter ||
|
|
44
|
-
k.name.endsWith(`/${kitFilter}`) ||
|
|
45
|
-
k.name === `@kit/${kitFilter}`)
|
|
46
|
-
: kits;
|
|
47
|
-
if (targetKits.length === 0 && kitFilter) {
|
|
48
|
-
this.error(`Kit not found: ${kitFilter}`);
|
|
49
|
-
}
|
|
50
|
-
// Collect recipes from all target kits
|
|
51
|
-
const recipes = [];
|
|
52
|
-
for (const kit of targetKits) {
|
|
53
|
-
// Get recipes from cookbooks
|
|
54
|
-
if (kit.cookbooks && kit.cookbooks.length > 0) {
|
|
55
|
-
const kitPath = kit.path;
|
|
56
|
-
// Look for cookbook directories directly
|
|
57
|
-
const cookbooksDir = path.join(kitPath, "cookbooks");
|
|
58
|
-
if (!fs.existsSync(cookbooksDir)) {
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
for (const cookbookName of kit.cookbooks) {
|
|
62
|
-
// Filter by cookbook if specified
|
|
63
|
-
if (flags.cookbook && cookbookName !== flags.cookbook) {
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
const cookbookDir = path.join(cookbooksDir, cookbookName);
|
|
67
|
-
const cookbookYml = path.join(cookbookDir, "cookbook.yml");
|
|
68
|
-
if (!fs.existsSync(cookbookYml)) {
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
// Discover recipes by scanning directories
|
|
72
|
-
const recipeDirs = this.getRecipeDirs(cookbookDir);
|
|
73
|
-
for (const recipeDir of recipeDirs) {
|
|
74
|
-
const recipeName = path.basename(recipeDir);
|
|
75
|
-
const recipePath = path.join(recipeDir, "recipe.yml");
|
|
76
|
-
if (!fs.existsSync(recipePath)) {
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
// Quick parse just for display info
|
|
80
|
-
const info = this.quickParseRecipe(recipePath);
|
|
81
|
-
recipes.push({
|
|
82
|
-
name: recipeName,
|
|
83
|
-
path: recipePath,
|
|
84
|
-
kit: kit.name,
|
|
85
|
-
cookbook: cookbookName,
|
|
86
|
-
description: info.description,
|
|
87
|
-
version: info.version,
|
|
88
|
-
steps: info.steps,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
// Get direct recipes (not in cookbooks)
|
|
94
|
-
if (kit.recipes && kit.recipes.length > 0) {
|
|
95
|
-
for (const recipeName of kit.recipes) {
|
|
96
|
-
// Try to find the recipe file
|
|
97
|
-
const possiblePaths = [
|
|
98
|
-
path.join(kit.path, "recipes", recipeName, "recipe.yml"),
|
|
99
|
-
path.join(kit.path, recipeName, "recipe.yml"),
|
|
100
|
-
path.join(kit.path, `${recipeName}.yml`),
|
|
101
|
-
];
|
|
102
|
-
for (const recipePath of possiblePaths) {
|
|
103
|
-
if (fs.existsSync(recipePath)) {
|
|
104
|
-
const info = this.quickParseRecipe(recipePath);
|
|
105
|
-
recipes.push({
|
|
106
|
-
name: recipeName,
|
|
107
|
-
path: recipePath,
|
|
108
|
-
kit: kit.name,
|
|
109
|
-
description: info.description,
|
|
110
|
-
version: info.version,
|
|
111
|
-
steps: info.steps,
|
|
112
|
-
});
|
|
113
|
-
break; // Found it, stop trying paths
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
// Apply cookbook filter to direct recipes too
|
|
120
|
-
if (flags.cookbook) {
|
|
121
|
-
const filteredRecipes = recipes.filter((r) => r.cookbook === flags.cookbook);
|
|
122
|
-
if (filteredRecipes.length === 0) {
|
|
123
|
-
this.error(`Cookbook not found: ${flags.cookbook}`);
|
|
124
|
-
}
|
|
125
|
-
return this.displayRecipes(filteredRecipes, flags);
|
|
126
|
-
}
|
|
127
|
-
this.displayRecipes(recipes, flags);
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
this.error(`Failed to list recipes: ${error instanceof Error ? error.message : String(error)}`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Quick parse a recipe file for display purposes
|
|
135
|
-
*/
|
|
136
|
-
quickParseRecipe(recipePath) {
|
|
137
|
-
try {
|
|
138
|
-
const content = fs.readFileSync(recipePath, "utf-8");
|
|
139
|
-
const parsed = yaml.load(content);
|
|
140
|
-
if (!parsed || typeof parsed !== "object") {
|
|
141
|
-
return {};
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
description: parsed.description,
|
|
145
|
-
version: parsed.version,
|
|
146
|
-
steps: Array.isArray(parsed.steps) ? parsed.steps.length : undefined,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
catch {
|
|
150
|
-
return {};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Get recipe directories by scanning for recipe.yml files
|
|
155
|
-
*/
|
|
156
|
-
getRecipeDirs(cookbookDir) {
|
|
157
|
-
const recipeDirs = [];
|
|
158
|
-
try {
|
|
159
|
-
const entries = fs.readdirSync(cookbookDir, { withFileTypes: true });
|
|
160
|
-
for (const entry of entries) {
|
|
161
|
-
if (entry.isDirectory()) {
|
|
162
|
-
const recipeYml = path.join(cookbookDir, entry.name, "recipe.yml");
|
|
163
|
-
if (fs.existsSync(recipeYml)) {
|
|
164
|
-
recipeDirs.push(path.join(cookbookDir, entry.name));
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
catch {
|
|
170
|
-
// Ignore errors
|
|
171
|
-
}
|
|
172
|
-
return recipeDirs;
|
|
173
|
-
}
|
|
174
|
-
displayRecipes(recipes, flags) {
|
|
175
|
-
if (flags.json) {
|
|
176
|
-
this.log(JSON.stringify(recipes, null, 2));
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
if (recipes.length === 0) {
|
|
180
|
-
this.log(c.warning("No recipes found."));
|
|
181
|
-
this.log(s.hint("\nInstall a kit with: hypergen kit install <kit>"));
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
// Group by kit for display
|
|
185
|
-
const byKit = new Map();
|
|
186
|
-
for (const recipe of recipes) {
|
|
187
|
-
const kitRecipes = byKit.get(recipe.kit) || [];
|
|
188
|
-
kitRecipes.push(recipe);
|
|
189
|
-
byKit.set(recipe.kit, kitRecipes);
|
|
190
|
-
}
|
|
191
|
-
this.log(s.header("Available recipes", recipes.length));
|
|
192
|
-
this.log("");
|
|
193
|
-
for (const [kitName, kitRecipes] of byKit) {
|
|
194
|
-
this.log(c.kit(`${kitName}:`));
|
|
195
|
-
// Group by cookbook within kit
|
|
196
|
-
const byCookbook = new Map();
|
|
197
|
-
for (const recipe of kitRecipes) {
|
|
198
|
-
const cbRecipes = byCookbook.get(recipe.cookbook) || [];
|
|
199
|
-
cbRecipes.push(recipe);
|
|
200
|
-
byCookbook.set(recipe.cookbook, cbRecipes);
|
|
201
|
-
}
|
|
202
|
-
for (const [cookbookName, cbRecipes] of byCookbook) {
|
|
203
|
-
const prefix = cookbookName ? c.cookbook(` ${cookbookName}/`) : c.subtle(" (direct)/");
|
|
204
|
-
for (const recipe of cbRecipes) {
|
|
205
|
-
this.log(` ${prefix}${c.recipe(recipe.name)}`);
|
|
206
|
-
if (recipe.description) {
|
|
207
|
-
this.log(s.description(recipe.description));
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
this.log("");
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
//# sourceMappingURL=list.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/recipe/list.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAYzC,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAA8B;IACrE,MAAM,CAAU,WAAW,GAAG,iDAAiD,CAAC;IAEhF,MAAM,CAAU,QAAQ,GAAG;QAC1B,qCAAqC;QACrC,4CAA4C;QAC5C,4CAA4C;KAC5C,CAAC;IAEF,MAAM,CAAU,KAAK,GAAG;QACvB,GAAG,WAAW;QACd,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC;YACjB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,oB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