create-macostack 0.3.0 → 0.4.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.
@@ -45,6 +45,24 @@ type Part = {
45
45
  hint: string;
46
46
  };
47
47
 
48
+ // The module question a template exposes via `setup --questions`. The CLI stays
49
+ // dumb: it renders whatever the template declares (options + optional one-line
50
+ // descriptions), never hardcoding which modules exist.
51
+ type ModuleSpec = {
52
+ options: string[];
53
+ initial: string[];
54
+ descriptions?: Record<string, string>;
55
+ exclusive?: string[][];
56
+ };
57
+
58
+ // Optional deploy-target question a template may expose (e.g. vps vs cloudflare
59
+ // workers). Same dumb-CLI contract as modules: rendered from what setup declares.
60
+ type RuntimeSpec = {
61
+ options: string[];
62
+ initial: string;
63
+ descriptions?: Record<string, string>;
64
+ };
65
+
48
66
  const PARTS: Part[] = [
49
67
  {
50
68
  id: "server",
@@ -204,7 +222,7 @@ const adjustModules = async (part: Part) => {
204
222
  stdout: "pipe",
205
223
  stderr: "pipe",
206
224
  });
207
- let spec: { modules?: { options: string[]; initial: string[]; exclusive?: string[][] } } | null = null;
225
+ let spec: { modules?: ModuleSpec } | null = null;
208
226
  if (q.exitCode === 0) {
209
227
  try {
210
228
  spec = JSON.parse(q.stdout.toString().trim().split("\n").at(-1) ?? "");
@@ -221,7 +239,7 @@ const adjustModules = async (part: Part) => {
221
239
  chosen = answered(
222
240
  await multiselect({
223
241
  message: `${part.label} — which modules should be ON? (your current setup is preselected)`,
224
- options: mods.options.map((m) => ({ value: m, label: m })),
242
+ options: mods.options.map((m) => ({ value: m, label: m, hint: mods.descriptions?.[m] })),
225
243
  initialValues: mods.initial,
226
244
  required: false,
227
245
  }),
@@ -397,7 +415,7 @@ for (const p of selected) {
397
415
  ? await Bun.file(resolve(dest, "package.json")).json()
398
416
  : null;
399
417
  if (!flags["skip-setup"] && pkg?.scripts?.setup) {
400
- let questions: { modules?: { options: string[]; initial: string[]; exclusive?: string[][] } } | null = null;
418
+ let questions: { modules?: ModuleSpec; runtime?: RuntimeSpec } | null = null;
401
419
  if (!flags.yes) {
402
420
  const q = Bun.spawnSync(["bun", "run", "setup", "--questions"], {
403
421
  cwd: dest,
@@ -419,7 +437,7 @@ for (const p of selected) {
419
437
  chosen = answered(
420
438
  await multiselect({
421
439
  message: `${p.label} — which modules should start ON? (everything stays in the code; off = dormant, ready when you need it)`,
422
- options: questions.modules.options.map((m) => ({ value: m, label: m })),
440
+ options: questions.modules.options.map((m) => ({ value: m, label: m, hint: questions.modules?.descriptions?.[m] })),
423
441
  initialValues: questions.modules.initial,
424
442
  required: false,
425
443
  }),
@@ -433,6 +451,21 @@ for (const p of selected) {
433
451
  setupArgs.push("--modules", chosen.join(","));
434
452
  }
435
453
 
454
+ if (questions?.runtime && questions.runtime.options.length > 1) {
455
+ const rt = answered(
456
+ await select({
457
+ message: `${p.label} — where will you deploy?`,
458
+ options: questions.runtime.options.map((o) => ({
459
+ value: o,
460
+ label: o,
461
+ hint: questions.runtime?.descriptions?.[o],
462
+ })),
463
+ initialValue: questions.runtime.initial,
464
+ }),
465
+ );
466
+ setupArgs.push("--runtime", rt as string);
467
+ }
468
+
436
469
  const s3 = spinner();
437
470
  s3.start(`${p.label} — applying your setup (modules, fresh secrets, git)`);
438
471
  const setup = Bun.spawnSync(["bun", ...setupArgs], { cwd: dest, stdout: "pipe", stderr: "pipe" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-macostack",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Private macostack scaffold orchestrator for detached server/client repos.",
5
5
  "type": "module",
6
6
  "bin": {