outfitter 0.2.5 → 0.2.6

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 (131) hide show
  1. package/README.md +8 -5
  2. package/dist/actions.d.ts +2 -0
  3. package/dist/actions.js +34 -0
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/add.d.ts +54 -0
  6. package/dist/commands/add.js +16 -0
  7. package/dist/commands/check.d.ts +91 -0
  8. package/dist/commands/check.js +14 -0
  9. package/dist/commands/demo.d.ts +21 -0
  10. package/dist/commands/demo.js +8 -0
  11. package/dist/commands/docs-module-loader.d.ts +2 -0
  12. package/dist/commands/docs-module-loader.js +8 -0
  13. package/dist/commands/doctor.d.ts +2 -0
  14. package/dist/commands/doctor.js +13 -0
  15. package/dist/commands/init.d.ts +7 -0
  16. package/dist/commands/init.js +31 -0
  17. package/dist/commands/migrate-kit.d.ts +2 -0
  18. package/dist/commands/migrate-kit.js +15 -0
  19. package/dist/commands/repo.d.ts +3 -0
  20. package/dist/commands/repo.js +9 -0
  21. package/dist/commands/scaffold.d.ts +4 -0
  22. package/dist/commands/scaffold.js +31 -0
  23. package/dist/commands/shared-deps.d.ts +36 -0
  24. package/dist/commands/shared-deps.js +10 -0
  25. package/dist/commands/upgrade-codemods.d.ts +42 -0
  26. package/dist/commands/upgrade-codemods.js +15 -0
  27. package/dist/commands/upgrade-planner.d.ts +58 -0
  28. package/dist/commands/upgrade-planner.js +8 -0
  29. package/dist/commands/upgrade-workspace.d.ts +76 -0
  30. package/dist/commands/upgrade-workspace.js +16 -0
  31. package/dist/commands/upgrade.d.ts +214 -0
  32. package/dist/commands/upgrade.js +25 -0
  33. package/dist/create/index.d.ts +5 -0
  34. package/dist/create/index.js +29 -0
  35. package/dist/create/planner.d.ts +3 -0
  36. package/dist/create/planner.js +21 -0
  37. package/dist/create/presets.d.ts +3 -0
  38. package/dist/create/presets.js +12 -0
  39. package/dist/create/types.d.ts +2 -0
  40. package/dist/create/types.js +1 -0
  41. package/dist/engine/blocks.d.ts +3 -0
  42. package/dist/engine/blocks.js +12 -0
  43. package/dist/engine/collector.d.ts +2 -0
  44. package/dist/engine/collector.js +8 -0
  45. package/dist/engine/config.d.ts +3 -0
  46. package/dist/engine/config.js +12 -0
  47. package/dist/engine/executor.d.ts +3 -0
  48. package/dist/engine/executor.js +16 -0
  49. package/dist/engine/index.d.ts +8 -0
  50. package/dist/engine/index.js +59 -0
  51. package/dist/engine/names.d.ts +2 -0
  52. package/dist/engine/names.js +16 -0
  53. package/dist/engine/post-scaffold.d.ts +3 -0
  54. package/dist/engine/post-scaffold.js +8 -0
  55. package/dist/engine/render-plan.d.ts +7 -0
  56. package/dist/engine/render-plan.js +9 -0
  57. package/dist/engine/template.d.ts +3 -0
  58. package/dist/engine/template.js +17 -0
  59. package/dist/engine/types.d.ts +2 -0
  60. package/dist/engine/types.js +8 -0
  61. package/dist/engine/workspace.d.ts +3 -0
  62. package/dist/engine/workspace.js +13 -0
  63. package/dist/index.d.ts +10 -0
  64. package/dist/index.js +1 -1
  65. package/dist/manifest.d.ts +71 -0
  66. package/dist/manifest.js +16 -0
  67. package/dist/output-mode.d.ts +2 -0
  68. package/dist/output-mode.js +10 -0
  69. package/dist/shared/{chunk-tpwtpa74.js → chunk-k59f60cp.js} +858 -396
  70. package/dist/shared/outfitter-193jvzg4.d.ts +5 -0
  71. package/dist/shared/outfitter-1dd0k853.js +194 -0
  72. package/dist/shared/outfitter-1dvma85c.js +322 -0
  73. package/dist/shared/outfitter-1h7k8xxt.js +29 -0
  74. package/dist/shared/outfitter-2ngep1h2.d.ts +5 -0
  75. package/dist/shared/outfitter-2np85etz.js +95 -0
  76. package/dist/shared/outfitter-33w361tc.d.ts +18 -0
  77. package/dist/shared/outfitter-344t1r38.js +1 -0
  78. package/dist/shared/outfitter-3weh61w7.d.ts +25 -0
  79. package/dist/shared/outfitter-4s9meh3j.js +221 -0
  80. package/dist/shared/outfitter-66b25bj8.js +125 -0
  81. package/dist/shared/outfitter-6bkqjk86.d.ts +3 -0
  82. package/dist/shared/outfitter-79vfxt6y.js +269 -0
  83. package/dist/shared/outfitter-7ha7p61k.d.ts +6 -0
  84. package/dist/shared/outfitter-7r12fj7f.js +30 -0
  85. package/dist/shared/outfitter-8y2dfx6n.js +11 -0
  86. package/dist/shared/outfitter-9x1brcmq.js +184 -0
  87. package/dist/shared/outfitter-9zqc2njf.js +859 -0
  88. package/dist/shared/outfitter-a79xrm12.d.ts +17 -0
  89. package/dist/shared/outfitter-amc4jbs1.d.ts +50 -0
  90. package/dist/shared/outfitter-ara3djt0.js +73 -0
  91. package/dist/shared/outfitter-avhm5z6w.js +82 -0
  92. package/dist/shared/outfitter-bkwpbkr9.d.ts +63 -0
  93. package/dist/shared/outfitter-bn9c8p2e.js +204 -0
  94. package/dist/shared/outfitter-bpr28y54.js +70 -0
  95. package/dist/shared/outfitter-cwq39bv4.d.ts +48 -0
  96. package/dist/shared/outfitter-d7pq7d0k.js +196 -0
  97. package/dist/shared/outfitter-dd0btgec.d.ts +40 -0
  98. package/dist/shared/outfitter-e2zz5wv7.d.ts +51 -0
  99. package/dist/shared/outfitter-ehp18x1n.js +1 -0
  100. package/dist/shared/outfitter-gdvm5c0b.d.ts +4 -0
  101. package/dist/shared/outfitter-h1mnzzd1.d.ts +14 -0
  102. package/dist/shared/outfitter-hvsaxgcp.js +1 -0
  103. package/dist/shared/outfitter-hws10ze7.js +532 -0
  104. package/dist/shared/outfitter-j833sxws.js +61 -0
  105. package/dist/shared/outfitter-j8yc7294.d.ts +22 -0
  106. package/dist/shared/outfitter-k112c427.js +21 -0
  107. package/dist/shared/outfitter-k56rmt24.d.ts +30 -0
  108. package/dist/shared/outfitter-ksa1pp4t.d.ts +4 -0
  109. package/dist/shared/outfitter-ksyvwmb5.js +191 -0
  110. package/dist/shared/outfitter-mdt37hqm.js +4 -0
  111. package/dist/shared/outfitter-mtbpabf3.js +91 -0
  112. package/dist/shared/outfitter-mxz69pgy.js +713 -0
  113. package/dist/shared/outfitter-npemy7ta.d.ts +53 -0
  114. package/dist/shared/outfitter-npyfbdmc.d.ts +6 -0
  115. package/dist/shared/outfitter-pyy1zkfh.d.ts +133 -0
  116. package/dist/shared/outfitter-q9agarmb.js +42 -0
  117. package/dist/shared/outfitter-qfh36ddg.d.ts +66 -0
  118. package/dist/shared/outfitter-qn864k6h.js +581 -0
  119. package/dist/shared/outfitter-rdc5v5ms.js +746 -0
  120. package/dist/shared/outfitter-sgtq57qr.d.ts +5 -0
  121. package/dist/shared/outfitter-ttjr95y9.js +98 -0
  122. package/dist/shared/outfitter-vh4xgb93.js +35 -0
  123. package/dist/shared/outfitter-yvksv5qb.js +322 -0
  124. package/dist/shared/outfitter-zwyvewr1.js +36 -0
  125. package/dist/targets/index.d.ts +4 -0
  126. package/dist/targets/index.js +29 -0
  127. package/dist/targets/registry.d.ts +3 -0
  128. package/dist/targets/registry.js +28 -0
  129. package/dist/targets/types.d.ts +2 -0
  130. package/dist/targets/types.js +1 -0
  131. package/package.json +19 -12
@@ -0,0 +1,746 @@
1
+ // @bun
2
+ import {
3
+ printMigrateKitResults,
4
+ runMigrateKit
5
+ } from "./outfitter-mxz69pgy.js";
6
+ import {
7
+ printScaffoldResults,
8
+ runScaffold
9
+ } from "./outfitter-hws10ze7.js";
10
+ import {
11
+ printInitResults,
12
+ runInit
13
+ } from "./outfitter-qn864k6h.js";
14
+ import {
15
+ printUpgradeResults,
16
+ runUpgrade
17
+ } from "./outfitter-9zqc2njf.js";
18
+ import {
19
+ printDoctorResults,
20
+ runDoctor
21
+ } from "./outfitter-d7pq7d0k.js";
22
+ import {
23
+ runDemo
24
+ } from "./outfitter-ksyvwmb5.js";
25
+ import {
26
+ printCheckResults,
27
+ runCheck
28
+ } from "./outfitter-1dvma85c.js";
29
+ import {
30
+ listBlocks,
31
+ printAddResults,
32
+ runAdd
33
+ } from "./outfitter-79vfxt6y.js";
34
+ import {
35
+ resolveOutputModeFromContext,
36
+ resolveStructuredOutputMode
37
+ } from "./outfitter-7r12fj7f.js";
38
+
39
+ // apps/outfitter/src/actions.ts
40
+ import { resolve } from "path";
41
+ import { output } from "@outfitter/cli";
42
+ import { actionCliPresets } from "@outfitter/cli/actions";
43
+ import {
44
+ booleanFlagPreset,
45
+ cwdPreset,
46
+ dryRunPreset,
47
+ forcePreset,
48
+ interactionPreset,
49
+ verbosePreset
50
+ } from "@outfitter/cli/flags";
51
+ import {
52
+ createActionRegistry,
53
+ defineAction,
54
+ InternalError,
55
+ Result
56
+ } from "@outfitter/contracts";
57
+ import { z } from "zod";
58
+ var outputModeSchema = z.enum(["human", "json", "jsonl"]).default("human");
59
+ var initInputSchema = z.object({
60
+ targetDir: z.string(),
61
+ name: z.string().optional(),
62
+ bin: z.string().optional(),
63
+ preset: z.enum(["minimal", "cli", "mcp", "daemon"]).optional(),
64
+ template: z.string().optional(),
65
+ structure: z.enum(["single", "workspace"]).optional(),
66
+ workspaceName: z.string().optional(),
67
+ local: z.boolean().optional(),
68
+ force: z.boolean(),
69
+ with: z.string().optional(),
70
+ noTooling: z.boolean().optional(),
71
+ yes: z.boolean().optional(),
72
+ dryRun: z.boolean().optional(),
73
+ skipInstall: z.boolean().optional(),
74
+ skipGit: z.boolean().optional(),
75
+ skipCommit: z.boolean().optional(),
76
+ installTimeout: z.number().optional(),
77
+ outputMode: outputModeSchema
78
+ });
79
+ var scaffoldInputSchema = z.object({
80
+ target: z.string(),
81
+ name: z.string().optional(),
82
+ force: z.boolean(),
83
+ skipInstall: z.boolean(),
84
+ dryRun: z.boolean(),
85
+ with: z.string().optional(),
86
+ noTooling: z.boolean().optional(),
87
+ local: z.boolean().optional(),
88
+ installTimeout: z.number().optional(),
89
+ cwd: z.string(),
90
+ outputMode: outputModeSchema
91
+ });
92
+ var migrateKitInputSchema = z.object({
93
+ targetDir: z.string(),
94
+ dryRun: z.boolean(),
95
+ outputMode: outputModeSchema
96
+ });
97
+ var doctorInputSchema = z.object({
98
+ cwd: z.string(),
99
+ outputMode: outputModeSchema
100
+ });
101
+ function resolveStringFlag(value) {
102
+ return typeof value === "string" && value.length > 0 ? value : undefined;
103
+ }
104
+ function resolveNoToolingFlag(flags) {
105
+ if (typeof flags.noTooling === "boolean") {
106
+ return !flags.noTooling;
107
+ }
108
+ if (typeof flags.tooling === "boolean") {
109
+ if (!flags.tooling) {
110
+ return true;
111
+ }
112
+ return process.argv.includes("--tooling") ? false : undefined;
113
+ }
114
+ return;
115
+ }
116
+ function resolveLocalFlag(flags) {
117
+ if (flags.local === true || flags.workspace === true) {
118
+ return true;
119
+ }
120
+ return;
121
+ }
122
+ function resolveInitOptions(context, presetOverride) {
123
+ const flags = context.flags;
124
+ const { force, dryRun, yes } = initSharedFlags.resolve(context);
125
+ const targetDir = context.args[0] ?? process.cwd();
126
+ const name = resolveStringFlag(flags.name);
127
+ const bin = resolveStringFlag(flags.bin);
128
+ const preset = presetOverride ?? resolveStringFlag(flags.preset);
129
+ const template = resolveStringFlag(flags.template);
130
+ const structure = resolveStringFlag(flags.structure);
131
+ const workspaceName = resolveStringFlag(flags.workspaceName);
132
+ const local = resolveLocalFlag(flags);
133
+ const withBlocks = resolveStringFlag(flags.with);
134
+ const noTooling = resolveNoToolingFlag(flags);
135
+ const skipInstall = Boolean(flags.skipInstall ?? context.flags["skip-install"]);
136
+ const skipGit = Boolean(flags.skipGit ?? context.flags["skip-git"]);
137
+ const skipCommit = Boolean(flags.skipCommit ?? context.flags["skip-commit"]);
138
+ const installTimeoutValue = flags.installTimeout;
139
+ let installTimeout;
140
+ if (typeof installTimeoutValue === "string") {
141
+ installTimeout = Number.parseInt(installTimeoutValue, 10);
142
+ } else if (typeof installTimeoutValue === "number") {
143
+ installTimeout = installTimeoutValue;
144
+ }
145
+ const outputMode = resolveOutputModeFromContext(context.flags);
146
+ return {
147
+ targetDir,
148
+ name,
149
+ ...preset ? { preset } : {},
150
+ ...template ? { template } : {},
151
+ ...structure ? { structure } : {},
152
+ ...workspaceName ? { workspaceName } : {},
153
+ force,
154
+ ...local !== undefined ? { local } : {},
155
+ ...withBlocks ? { with: withBlocks } : {},
156
+ ...noTooling !== undefined ? { noTooling } : {},
157
+ ...bin ? { bin } : {},
158
+ ...yes ? { yes } : {},
159
+ ...dryRun ? { dryRun } : {},
160
+ ...skipInstall ? { skipInstall } : {},
161
+ ...skipGit ? { skipGit } : {},
162
+ ...skipCommit ? { skipCommit } : {},
163
+ ...installTimeout !== undefined ? { installTimeout } : {},
164
+ outputMode
165
+ };
166
+ }
167
+ function resolveScaffoldOptions(context) {
168
+ const flags = context.flags;
169
+ const { force, dryRun } = scaffoldSharedFlags.resolve(context);
170
+ const outputMode = resolveOutputModeFromContext(context.flags);
171
+ const noTooling = resolveNoToolingFlag(flags);
172
+ const local = resolveLocalFlag(flags);
173
+ const installTimeoutValue = flags.installTimeout;
174
+ let installTimeout;
175
+ if (typeof installTimeoutValue === "string") {
176
+ installTimeout = Number.parseInt(installTimeoutValue, 10);
177
+ } else if (typeof installTimeoutValue === "number") {
178
+ installTimeout = installTimeoutValue;
179
+ }
180
+ return {
181
+ target: String(context.args[0] ?? ""),
182
+ name: resolveStringFlag(context.args[1]),
183
+ force,
184
+ skipInstall: Boolean(flags.skipInstall ?? context.flags["skip-install"]),
185
+ dryRun,
186
+ ...local !== undefined ? { local } : {},
187
+ with: resolveStringFlag(flags.with),
188
+ ...noTooling !== undefined ? { noTooling } : {},
189
+ ...installTimeout !== undefined ? { installTimeout } : {},
190
+ cwd: process.cwd(),
191
+ outputMode
192
+ };
193
+ }
194
+ function resolveMigrateKitOptions(context) {
195
+ const { dryRun } = migrateKitSharedFlags.resolve(context);
196
+ const outputMode = resolveOutputModeFromContext(context.flags);
197
+ return {
198
+ targetDir: context.args[0] ?? process.cwd(),
199
+ dryRun,
200
+ outputMode
201
+ };
202
+ }
203
+ var commonInitOptions = [
204
+ {
205
+ flags: "-n, --name <name>",
206
+ description: "Package name (defaults to directory name)"
207
+ },
208
+ {
209
+ flags: "-b, --bin <name>",
210
+ description: "Binary name (defaults to project name)"
211
+ },
212
+ {
213
+ flags: "--local",
214
+ description: "Use workspace:* for @outfitter dependencies"
215
+ },
216
+ {
217
+ flags: "--workspace",
218
+ description: "Alias for --local"
219
+ },
220
+ {
221
+ flags: "--with <blocks>",
222
+ description: "Tooling to add (comma-separated: scaffolding, claude, biome, lefthook, bootstrap)"
223
+ },
224
+ {
225
+ flags: "--no-tooling",
226
+ description: "Skip tooling setup"
227
+ }
228
+ ];
229
+ var templateOption = {
230
+ flags: "-t, --template <template>",
231
+ description: "Template to use (deprecated, use --preset)"
232
+ };
233
+ var initSharedFlags = actionCliPresets(forcePreset(), dryRunPreset(), booleanFlagPreset({
234
+ id: "initYes",
235
+ key: "yes",
236
+ flags: "-y, --yes",
237
+ description: "Skip prompts and use defaults for missing values"
238
+ }));
239
+ function createInitAction(options) {
240
+ const presetOption = {
241
+ flags: "-p, --preset <preset>",
242
+ description: "Preset to use (minimal, cli, mcp, daemon)"
243
+ };
244
+ const initOptions = [...commonInitOptions];
245
+ initOptions.push(...initSharedFlags.options);
246
+ initOptions.push({
247
+ flags: "-s, --structure <mode>",
248
+ description: "Project structure (single|workspace)"
249
+ });
250
+ initOptions.push({
251
+ flags: "--workspace-name <name>",
252
+ description: "Workspace root package name"
253
+ });
254
+ initOptions.push({
255
+ flags: "--skip-install",
256
+ description: "Skip bun install",
257
+ defaultValue: false
258
+ });
259
+ initOptions.push({
260
+ flags: "--skip-git",
261
+ description: "Skip git init and initial commit",
262
+ defaultValue: false
263
+ });
264
+ initOptions.push({
265
+ flags: "--skip-commit",
266
+ description: "Skip initial commit only",
267
+ defaultValue: false
268
+ });
269
+ initOptions.push({
270
+ flags: "--install-timeout <ms>",
271
+ description: "bun install timeout in milliseconds"
272
+ });
273
+ if (options.includePresetOption) {
274
+ initOptions.push(presetOption);
275
+ }
276
+ if (options.includeTemplateOption) {
277
+ initOptions.push(templateOption);
278
+ }
279
+ return defineAction({
280
+ id: options.id,
281
+ description: options.description,
282
+ surfaces: ["cli"],
283
+ input: initInputSchema,
284
+ cli: {
285
+ group: "init",
286
+ command: options.command,
287
+ description: options.description,
288
+ options: initOptions,
289
+ mapInput: (context) => resolveInitOptions(context, options.presetOverride)
290
+ },
291
+ handler: async (input) => {
292
+ const { outputMode, ...initInput } = input;
293
+ const result = await runInit(initInput);
294
+ if (result.isErr()) {
295
+ return Result.err(new InternalError({
296
+ message: result.error.message,
297
+ context: { action: options.id }
298
+ }));
299
+ }
300
+ await printInitResults(result.value, { mode: outputMode });
301
+ return Result.ok(result.value);
302
+ }
303
+ });
304
+ }
305
+ var scaffoldSharedFlags = actionCliPresets(forcePreset(), dryRunPreset());
306
+ var addSharedFlags = actionCliPresets(forcePreset(), dryRunPreset());
307
+ var migrateKitSharedFlags = actionCliPresets(dryRunPreset());
308
+ var createAction = defineAction({
309
+ id: "create",
310
+ description: "Removed - use 'outfitter init' instead",
311
+ surfaces: ["cli"],
312
+ input: z.object({}).passthrough(),
313
+ cli: {
314
+ command: "create [directory]",
315
+ description: "Removed - use 'outfitter init' instead",
316
+ options: [],
317
+ mapInput: () => ({})
318
+ },
319
+ handler: async () => Result.err(new InternalError({
320
+ message: [
321
+ "The 'create' command has been removed.",
322
+ "",
323
+ "Use 'outfitter init' instead. It supports everything 'create' did:",
324
+ "",
325
+ " Interactive mode: outfitter init my-project",
326
+ " With preset: outfitter init my-project --preset cli",
327
+ " Skip prompts: outfitter init my-project --preset cli --yes",
328
+ " Workspace: outfitter init my-project --preset cli --structure workspace",
329
+ "",
330
+ "See 'outfitter init --help' for full options."
331
+ ].join("\\n"),
332
+ context: { action: "create" }
333
+ }))
334
+ });
335
+ var scaffoldAction = defineAction({
336
+ id: "scaffold",
337
+ description: "Add a capability to an existing project",
338
+ surfaces: ["cli"],
339
+ input: scaffoldInputSchema,
340
+ cli: {
341
+ command: "scaffold <target> [name]",
342
+ description: "Add a capability (cli, mcp, daemon, lib, ...) to an existing project",
343
+ options: [
344
+ ...scaffoldSharedFlags.options,
345
+ {
346
+ flags: "--skip-install",
347
+ description: "Skip bun install",
348
+ defaultValue: false
349
+ },
350
+ {
351
+ flags: "--with <blocks>",
352
+ description: "Comma-separated tooling blocks to add"
353
+ },
354
+ {
355
+ flags: "--no-tooling",
356
+ description: "Skip default tooling blocks"
357
+ },
358
+ {
359
+ flags: "--local",
360
+ description: "Use workspace:* for @outfitter dependencies"
361
+ },
362
+ {
363
+ flags: "--install-timeout <ms>",
364
+ description: "bun install timeout in milliseconds"
365
+ }
366
+ ],
367
+ mapInput: resolveScaffoldOptions
368
+ },
369
+ handler: async (input) => {
370
+ const { outputMode, ...scaffoldInput } = input;
371
+ const result = await runScaffold(scaffoldInput);
372
+ if (result.isErr()) {
373
+ return Result.err(new InternalError({
374
+ message: result.error.message,
375
+ context: { action: "scaffold" }
376
+ }));
377
+ }
378
+ await printScaffoldResults(result.value, { mode: outputMode });
379
+ return Result.ok(result.value);
380
+ }
381
+ });
382
+ var demoInputSchema = z.object({
383
+ section: z.string().optional(),
384
+ list: z.boolean().optional(),
385
+ animate: z.boolean().optional(),
386
+ outputMode: outputModeSchema
387
+ });
388
+ var demoAction = defineAction({
389
+ id: "demo",
390
+ description: "Run the CLI demo app",
391
+ surfaces: ["cli"],
392
+ input: demoInputSchema,
393
+ cli: {
394
+ command: "demo [section]",
395
+ description: "Run the CLI demo app",
396
+ options: [
397
+ {
398
+ flags: "-l, --list",
399
+ description: "List available demo sections",
400
+ defaultValue: false
401
+ },
402
+ {
403
+ flags: "-a, --animate",
404
+ description: "Run animated demo (spinners only)",
405
+ defaultValue: false
406
+ }
407
+ ],
408
+ mapInput: (context) => {
409
+ const outputMode = resolveOutputModeFromContext(context.flags);
410
+ return {
411
+ section: context.args[0],
412
+ list: Boolean(context.flags["list"]),
413
+ animate: Boolean(context.flags["animate"]),
414
+ outputMode
415
+ };
416
+ }
417
+ },
418
+ handler: async (input) => {
419
+ const { outputMode, ...demoInput } = input;
420
+ try {
421
+ const result = await runDemo({ ...demoInput, outputMode });
422
+ if (result.exitCode !== 0) {
423
+ process.exit(result.exitCode);
424
+ }
425
+ return Result.ok(result);
426
+ } catch (error) {
427
+ return Result.err(new InternalError({
428
+ message: error instanceof Error ? error.message : "Failed to run demo",
429
+ context: { action: "demo" }
430
+ }));
431
+ }
432
+ }
433
+ });
434
+ var doctorAction = defineAction({
435
+ id: "doctor",
436
+ description: "Validate environment and dependencies",
437
+ surfaces: ["cli"],
438
+ input: doctorInputSchema,
439
+ cli: {
440
+ command: "doctor",
441
+ description: "Validate environment and dependencies",
442
+ mapInput: (context) => {
443
+ const outputMode = resolveOutputModeFromContext(context.flags);
444
+ return {
445
+ cwd: process.cwd(),
446
+ outputMode
447
+ };
448
+ }
449
+ },
450
+ handler: async (input) => {
451
+ const { outputMode, ...doctorInput } = input;
452
+ const result = await runDoctor(doctorInput);
453
+ await printDoctorResults(result, { mode: outputMode });
454
+ if (result.exitCode !== 0) {
455
+ process.exit(result.exitCode);
456
+ }
457
+ return Result.ok(result);
458
+ }
459
+ });
460
+ var addInputSchema = z.object({
461
+ block: z.string(),
462
+ force: z.boolean(),
463
+ dryRun: z.boolean(),
464
+ cwd: z.string().optional(),
465
+ outputMode: outputModeSchema
466
+ });
467
+ var addAction = defineAction({
468
+ id: "add",
469
+ description: "Add a block from the registry to your project",
470
+ surfaces: ["cli"],
471
+ input: addInputSchema,
472
+ cli: {
473
+ group: "add",
474
+ command: "<block>",
475
+ description: "Add a block from the registry (claude, biome, lefthook, bootstrap, scaffolding)",
476
+ options: [...addSharedFlags.options],
477
+ mapInput: (context) => {
478
+ const outputMode = resolveOutputModeFromContext(context.flags);
479
+ const { force, dryRun } = addSharedFlags.resolve(context);
480
+ return {
481
+ block: context.args[0],
482
+ force,
483
+ dryRun,
484
+ cwd: process.cwd(),
485
+ outputMode
486
+ };
487
+ }
488
+ },
489
+ handler: async (input) => {
490
+ const { outputMode, ...addInput } = input;
491
+ const result = await runAdd(addInput);
492
+ if (result.isErr()) {
493
+ return Result.err(new InternalError({
494
+ message: result.error.message,
495
+ context: { action: "add" }
496
+ }));
497
+ }
498
+ await printAddResults(result.value, addInput.dryRun, { mode: outputMode });
499
+ return Result.ok(result.value);
500
+ }
501
+ });
502
+ var listBlocksAction = defineAction({
503
+ id: "add.list",
504
+ description: "List available blocks",
505
+ surfaces: ["cli"],
506
+ input: z.object({ outputMode: outputModeSchema }),
507
+ cli: {
508
+ group: "add",
509
+ command: "list",
510
+ description: "List available blocks",
511
+ mapInput: (context) => {
512
+ const outputMode = resolveOutputModeFromContext(context.flags);
513
+ return {
514
+ outputMode
515
+ };
516
+ }
517
+ },
518
+ handler: async (input) => {
519
+ const result = listBlocks();
520
+ if (result.isErr()) {
521
+ return Result.err(new InternalError({
522
+ message: result.error.message,
523
+ context: { action: "add.list" }
524
+ }));
525
+ }
526
+ const structuredMode = resolveStructuredOutputMode(input.outputMode);
527
+ if (structuredMode) {
528
+ await output({ blocks: result.value }, { mode: structuredMode });
529
+ } else {
530
+ const lines = [
531
+ "Available blocks:",
532
+ ...result.value.map((block) => ` - ${block}`)
533
+ ];
534
+ await output(lines, { mode: "human" });
535
+ }
536
+ return Result.ok({ blocks: result.value });
537
+ }
538
+ });
539
+ var checkInputSchema = z.object({
540
+ cwd: z.string(),
541
+ verbose: z.boolean(),
542
+ block: z.string().optional(),
543
+ ci: z.boolean(),
544
+ outputMode: outputModeSchema
545
+ });
546
+ var checkVerbose = verbosePreset();
547
+ var checkCwd = cwdPreset();
548
+ var checkVerboseOptions = checkVerbose.options.map((option) => option.flags === "-v, --verbose" ? { ...option, description: "Show diffs for drifted files" } : option);
549
+ var checkAction = defineAction({
550
+ id: "check",
551
+ description: "Compare local config blocks against the registry for drift detection",
552
+ surfaces: ["cli"],
553
+ input: checkInputSchema,
554
+ cli: {
555
+ command: "check",
556
+ description: "Compare local config blocks against the registry for drift detection",
557
+ options: [
558
+ ...checkVerboseOptions,
559
+ {
560
+ flags: "-b, --block <name>",
561
+ description: "Check a specific block only"
562
+ },
563
+ {
564
+ flags: "--ci",
565
+ description: "Machine-oriented output for CI",
566
+ defaultValue: false
567
+ },
568
+ ...checkCwd.options
569
+ ],
570
+ mapInput: (context) => {
571
+ const outputMode = resolveOutputModeFromContext(context.flags);
572
+ const { verbose } = checkVerbose.resolve(context.flags);
573
+ const { cwd: rawCwd } = checkCwd.resolve(context.flags);
574
+ const cwd = resolve(process.cwd(), rawCwd);
575
+ const block = resolveStringFlag(context.flags["block"]);
576
+ return {
577
+ cwd,
578
+ verbose,
579
+ ...block !== undefined ? { block } : {},
580
+ ci: Boolean(context.flags["ci"]),
581
+ outputMode
582
+ };
583
+ }
584
+ },
585
+ handler: async (input) => {
586
+ const { outputMode, ci, ...checkInput } = input;
587
+ const effectiveMode = ci ? "json" : outputMode;
588
+ const result = await runCheck(checkInput);
589
+ if (result.isErr()) {
590
+ return Result.err(new InternalError({
591
+ message: result.error.message,
592
+ context: { action: "check" }
593
+ }));
594
+ }
595
+ await printCheckResults(result.value, {
596
+ mode: effectiveMode,
597
+ verbose: checkInput.verbose
598
+ });
599
+ if (result.value.driftedCount > 0 || result.value.missingCount > 0) {
600
+ process.exit(1);
601
+ }
602
+ return Result.ok(result.value);
603
+ }
604
+ });
605
+ var upgradeInputSchema = z.object({
606
+ cwd: z.string(),
607
+ guide: z.boolean(),
608
+ guidePackages: z.array(z.string()).optional(),
609
+ dryRun: z.boolean(),
610
+ yes: z.boolean(),
611
+ interactive: z.boolean(),
612
+ all: z.boolean(),
613
+ noCodemods: z.boolean(),
614
+ outputMode: outputModeSchema
615
+ });
616
+ var upgradeCwd = cwdPreset();
617
+ var upgradeDryRun = dryRunPreset();
618
+ var upgradeInteraction = interactionPreset();
619
+ var upgradeAll = booleanFlagPreset({
620
+ id: "upgradeAll",
621
+ key: "all",
622
+ flags: "--all",
623
+ description: "Include breaking changes in the upgrade"
624
+ });
625
+ var upgradeNoCodemods = booleanFlagPreset({
626
+ id: "upgradeNoCodemods",
627
+ key: "noCodemods",
628
+ flags: "--no-codemods",
629
+ description: "Skip automatic codemod execution during upgrade",
630
+ sources: ["noCodemods", "no-codemods"],
631
+ negatedSources: ["codemods"]
632
+ });
633
+ var upgradeGuide = booleanFlagPreset({
634
+ id: "upgradeGuide",
635
+ key: "guide",
636
+ flags: "--guide",
637
+ description: "Show migration instructions for available updates. Pass package names to filter."
638
+ });
639
+ var upgradeFlags = actionCliPresets(upgradeCwd, upgradeDryRun, upgradeInteraction, upgradeAll, upgradeNoCodemods, upgradeGuide);
640
+ var upgradeAction = defineAction({
641
+ id: "upgrade",
642
+ description: "Check for @outfitter/* package updates and migration guidance",
643
+ surfaces: ["cli"],
644
+ input: upgradeInputSchema,
645
+ cli: {
646
+ command: "upgrade [packages...]",
647
+ description: "Check for @outfitter/* package updates and migration guidance",
648
+ options: [...upgradeFlags.options],
649
+ mapInput: (context) => {
650
+ const outputMode = resolveOutputModeFromContext(context.flags);
651
+ const {
652
+ cwd: rawCwd,
653
+ dryRun,
654
+ interactive,
655
+ yes,
656
+ all,
657
+ noCodemods,
658
+ guide
659
+ } = upgradeFlags.resolve(context);
660
+ const cwd = resolve(process.cwd(), rawCwd);
661
+ const guidePackages = context.args.length > 0 ? context.args : undefined;
662
+ return {
663
+ cwd,
664
+ guide,
665
+ ...guidePackages !== undefined ? { guidePackages } : {},
666
+ dryRun,
667
+ yes,
668
+ interactive,
669
+ all,
670
+ noCodemods,
671
+ outputMode
672
+ };
673
+ }
674
+ },
675
+ handler: async (input) => {
676
+ const { outputMode, guidePackages, ...upgradeInput } = input;
677
+ const result = await runUpgrade({
678
+ ...upgradeInput,
679
+ outputMode,
680
+ ...guidePackages !== undefined ? { guidePackages } : {}
681
+ });
682
+ if (result.isErr()) {
683
+ return Result.err(new InternalError({
684
+ message: result.error.message,
685
+ context: { action: "upgrade" }
686
+ }));
687
+ }
688
+ await printUpgradeResults(result.value, {
689
+ mode: outputMode,
690
+ guide: upgradeInput.guide,
691
+ cwd: upgradeInput.cwd,
692
+ dryRun: upgradeInput.dryRun,
693
+ all: upgradeInput.all
694
+ });
695
+ return Result.ok(result.value);
696
+ }
697
+ });
698
+ var migrateKitAction = defineAction({
699
+ id: "migrate.kit",
700
+ description: "Migrate foundation imports and dependencies to @outfitter/kit",
701
+ surfaces: ["cli"],
702
+ input: migrateKitInputSchema,
703
+ cli: {
704
+ group: "migrate",
705
+ command: "kit [directory]",
706
+ description: "Migrate foundation imports and dependencies to @outfitter/kit",
707
+ options: [...migrateKitSharedFlags.options],
708
+ mapInput: resolveMigrateKitOptions
709
+ },
710
+ handler: async (input) => {
711
+ const { outputMode, ...migrateInput } = input;
712
+ const result = await runMigrateKit(migrateInput);
713
+ if (result.isErr()) {
714
+ return Result.err(new InternalError({
715
+ message: result.error.message,
716
+ context: { action: "migrate.kit" }
717
+ }));
718
+ }
719
+ await printMigrateKitResults(result.value, { mode: outputMode });
720
+ return Result.ok(result.value);
721
+ }
722
+ });
723
+ var outfitterActions = createActionRegistry().add(createAction).add(scaffoldAction).add(createInitAction({
724
+ id: "init",
725
+ description: "Create a new Outfitter project",
726
+ command: "[directory]",
727
+ includePresetOption: true,
728
+ includeTemplateOption: true
729
+ })).add(createInitAction({
730
+ id: "init.cli",
731
+ description: "Create a new CLI project",
732
+ command: "cli [directory]",
733
+ presetOverride: "cli"
734
+ })).add(createInitAction({
735
+ id: "init.mcp",
736
+ description: "Create a new MCP server",
737
+ command: "mcp [directory]",
738
+ presetOverride: "mcp"
739
+ })).add(createInitAction({
740
+ id: "init.daemon",
741
+ description: "Create a new daemon project",
742
+ command: "daemon [directory]",
743
+ presetOverride: "daemon"
744
+ })).add(demoAction).add(doctorAction).add(addAction).add(listBlocksAction).add(checkAction).add(migrateKitAction).add(upgradeAction);
745
+
746
+ export { outfitterActions };