@couch-kit/cli 0.3.8 → 0.3.9

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 (2) hide show
  1. package/dist/index.js +923 -727
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,37 +1,24 @@
1
1
  #!/usr/bin/env node
2
- import { createRequire } from "node:module";
3
- var __create = Object.create;
4
- var __getProtoOf = Object.getPrototypeOf;
5
2
  var __defProp = Object.defineProperty;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __toESM = (mod, isNodeMode, target) => {
9
- target = mod != null ? __create(__getProtoOf(mod)) : {};
10
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
- for (let key of __getOwnPropNames(mod))
12
- if (!__hasOwnProp.call(to, key))
13
- __defProp(to, key, {
14
- get: () => mod[key],
15
- enumerable: true
16
- });
17
- return to;
18
- };
19
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
3
+ var __returnValue = (v) => v;
4
+ function __exportSetter(name, newValue) {
5
+ this[name] = __returnValue.bind(null, newValue);
6
+ }
20
7
  var __export = (target, all) => {
21
8
  for (var name in all)
22
9
  __defProp(target, name, {
23
10
  get: all[name],
24
11
  enumerable: true,
25
12
  configurable: true,
26
- set: (newValue) => all[name] = () => newValue
13
+ set: __exportSetter.bind(all, name)
27
14
  });
28
15
  };
29
16
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
30
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
31
17
 
32
- // ../../node_modules/commander/lib/error.js
33
- var require_error = __commonJS((exports) => {
34
- class CommanderError extends Error {
18
+ // ../../node_modules/.bun/commander@15.0.0/node_modules/commander/lib/error.js
19
+ var CommanderError, InvalidArgumentError;
20
+ var init_error = __esm(() => {
21
+ CommanderError = class CommanderError extends Error {
35
22
  constructor(exitCode, code, message) {
36
23
  super(message);
37
24
  Error.captureStackTrace(this, this.constructor);
@@ -40,592 +27,753 @@ var require_error = __commonJS((exports) => {
40
27
  this.exitCode = exitCode;
41
28
  this.nestedError = undefined;
42
29
  }
43
- }
44
-
45
- class InvalidArgumentError extends CommanderError {
30
+ };
31
+ InvalidArgumentError = class InvalidArgumentError extends CommanderError {
46
32
  constructor(message) {
47
33
  super(1, "commander.invalidArgument", message);
48
34
  Error.captureStackTrace(this, this.constructor);
49
35
  this.name = this.constructor.name;
50
36
  }
51
- }
52
- exports.CommanderError = CommanderError;
53
- exports.InvalidArgumentError = InvalidArgumentError;
37
+ };
54
38
  });
55
39
 
56
- // ../../node_modules/commander/lib/argument.js
57
- var require_argument = __commonJS((exports) => {
58
- var { InvalidArgumentError } = require_error();
59
-
60
- class Argument {
61
- constructor(name, description) {
62
- this.description = description || "";
63
- this.variadic = false;
64
- this.parseArg = undefined;
65
- this.defaultValue = undefined;
66
- this.defaultValueDescription = undefined;
67
- this.argChoices = undefined;
68
- switch (name[0]) {
69
- case "<":
70
- this.required = true;
71
- this._name = name.slice(1, -1);
72
- break;
73
- case "[":
74
- this.required = false;
75
- this._name = name.slice(1, -1);
76
- break;
77
- default:
78
- this.required = true;
79
- this._name = name;
80
- break;
81
- }
82
- if (this._name.length > 3 && this._name.slice(-3) === "...") {
83
- this.variadic = true;
84
- this._name = this._name.slice(0, -3);
85
- }
40
+ // ../../node_modules/.bun/commander@15.0.0/node_modules/commander/lib/argument.js
41
+ class Argument {
42
+ constructor(name, description) {
43
+ this.description = description || "";
44
+ this.variadic = false;
45
+ this.parseArg = undefined;
46
+ this.defaultValue = undefined;
47
+ this.defaultValueDescription = undefined;
48
+ this.argChoices = undefined;
49
+ switch (name[0]) {
50
+ case "<":
51
+ this.required = true;
52
+ this._name = name.slice(1, -1);
53
+ break;
54
+ case "[":
55
+ this.required = false;
56
+ this._name = name.slice(1, -1);
57
+ break;
58
+ default:
59
+ this.required = true;
60
+ this._name = name;
61
+ break;
62
+ }
63
+ if (this._name.endsWith("...")) {
64
+ this.variadic = true;
65
+ this._name = this._name.slice(0, -3);
86
66
  }
87
- name() {
88
- return this._name;
67
+ }
68
+ name() {
69
+ return this._name;
70
+ }
71
+ _collectValue(value, previous) {
72
+ if (previous === this.defaultValue || !Array.isArray(previous)) {
73
+ return [value];
89
74
  }
90
- _concatValue(value, previous) {
91
- if (previous === this.defaultValue || !Array.isArray(previous)) {
92
- return [value];
75
+ previous.push(value);
76
+ return previous;
77
+ }
78
+ default(value, description) {
79
+ this.defaultValue = value;
80
+ this.defaultValueDescription = description;
81
+ return this;
82
+ }
83
+ argParser(fn) {
84
+ this.parseArg = fn;
85
+ return this;
86
+ }
87
+ choices(values) {
88
+ this.argChoices = values.slice();
89
+ this.parseArg = (arg, previous) => {
90
+ if (!this.argChoices.includes(arg)) {
91
+ throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
93
92
  }
94
- return previous.concat(value);
95
- }
96
- default(value, description) {
97
- this.defaultValue = value;
98
- this.defaultValueDescription = description;
99
- return this;
100
- }
101
- argParser(fn) {
102
- this.parseArg = fn;
103
- return this;
104
- }
105
- choices(values) {
106
- this.argChoices = values.slice();
107
- this.parseArg = (arg, previous) => {
108
- if (!this.argChoices.includes(arg)) {
109
- throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
110
- }
111
- if (this.variadic) {
112
- return this._concatValue(arg, previous);
113
- }
114
- return arg;
115
- };
116
- return this;
117
- }
118
- argRequired() {
119
- this.required = true;
120
- return this;
121
- }
122
- argOptional() {
123
- this.required = false;
124
- return this;
125
- }
93
+ if (this.variadic) {
94
+ return this._collectValue(arg, previous);
95
+ }
96
+ return arg;
97
+ };
98
+ return this;
126
99
  }
127
- function humanReadableArgName(arg) {
128
- const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
129
- return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
100
+ argRequired() {
101
+ this.required = true;
102
+ return this;
130
103
  }
131
- exports.Argument = Argument;
132
- exports.humanReadableArgName = humanReadableArgName;
104
+ argOptional() {
105
+ this.required = false;
106
+ return this;
107
+ }
108
+ }
109
+ function humanReadableArgName(arg) {
110
+ const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
111
+ return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
112
+ }
113
+ var init_argument = __esm(() => {
114
+ init_error();
133
115
  });
134
116
 
135
- // ../../node_modules/commander/lib/help.js
136
- var require_help = __commonJS((exports) => {
137
- var { humanReadableArgName } = require_argument();
117
+ // ../../node_modules/.bun/commander@15.0.0/node_modules/commander/lib/help.js
118
+ import { stripVTControlCharacters } from "node:util";
138
119
 
139
- class Help {
140
- constructor() {
141
- this.helpWidth = undefined;
142
- this.sortSubcommands = false;
143
- this.sortOptions = false;
144
- this.showGlobalOptions = false;
145
- }
146
- visibleCommands(cmd) {
147
- const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
148
- const helpCommand = cmd._getHelpCommand();
149
- if (helpCommand && !helpCommand._hidden) {
150
- visibleCommands.push(helpCommand);
151
- }
152
- if (this.sortSubcommands) {
153
- visibleCommands.sort((a, b) => {
154
- return a.name().localeCompare(b.name());
155
- });
156
- }
157
- return visibleCommands;
120
+ class Help {
121
+ constructor() {
122
+ this.helpWidth = undefined;
123
+ this.minWidthToWrap = 40;
124
+ this.sortSubcommands = false;
125
+ this.sortOptions = false;
126
+ this.showGlobalOptions = false;
127
+ }
128
+ prepareContext(contextOptions) {
129
+ this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
130
+ }
131
+ visibleCommands(cmd) {
132
+ const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
133
+ const helpCommand = cmd._getHelpCommand();
134
+ if (helpCommand && !helpCommand._hidden) {
135
+ visibleCommands.push(helpCommand);
136
+ }
137
+ if (this.sortSubcommands) {
138
+ visibleCommands.sort((a, b) => {
139
+ return a.name().localeCompare(b.name());
140
+ });
158
141
  }
159
- compareOptions(a, b) {
160
- const getSortKey = (option) => {
161
- return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
162
- };
163
- return getSortKey(a).localeCompare(getSortKey(b));
164
- }
165
- visibleOptions(cmd) {
166
- const visibleOptions = cmd.options.filter((option) => !option.hidden);
167
- const helpOption = cmd._getHelpOption();
168
- if (helpOption && !helpOption.hidden) {
169
- const removeShort = helpOption.short && cmd._findOption(helpOption.short);
170
- const removeLong = helpOption.long && cmd._findOption(helpOption.long);
171
- if (!removeShort && !removeLong) {
172
- visibleOptions.push(helpOption);
173
- } else if (helpOption.long && !removeLong) {
174
- visibleOptions.push(cmd.createOption(helpOption.long, helpOption.description));
175
- } else if (helpOption.short && !removeShort) {
176
- visibleOptions.push(cmd.createOption(helpOption.short, helpOption.description));
177
- }
178
- }
179
- if (this.sortOptions) {
180
- visibleOptions.sort(this.compareOptions);
181
- }
182
- return visibleOptions;
142
+ return visibleCommands;
143
+ }
144
+ compareOptions(a, b) {
145
+ const getSortKey = (option) => {
146
+ return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
147
+ };
148
+ return getSortKey(a).localeCompare(getSortKey(b));
149
+ }
150
+ visibleOptions(cmd) {
151
+ const visibleOptions = cmd.options.filter((option) => !option.hidden);
152
+ const helpOption = cmd._getHelpOption();
153
+ if (helpOption && !helpOption.hidden) {
154
+ const removeShort = helpOption.short && cmd._findOption(helpOption.short);
155
+ const removeLong = helpOption.long && cmd._findOption(helpOption.long);
156
+ if (!removeShort && !removeLong) {
157
+ visibleOptions.push(helpOption);
158
+ } else if (helpOption.long && !removeLong) {
159
+ visibleOptions.push(cmd.createOption(helpOption.long, helpOption.description));
160
+ } else if (helpOption.short && !removeShort) {
161
+ visibleOptions.push(cmd.createOption(helpOption.short, helpOption.description));
162
+ }
163
+ }
164
+ if (this.sortOptions) {
165
+ visibleOptions.sort(this.compareOptions);
166
+ }
167
+ return visibleOptions;
168
+ }
169
+ visibleGlobalOptions(cmd) {
170
+ if (!this.showGlobalOptions)
171
+ return [];
172
+ const globalOptions = [];
173
+ for (let ancestorCmd = cmd.parent;ancestorCmd; ancestorCmd = ancestorCmd.parent) {
174
+ const visibleOptions = ancestorCmd.options.filter((option) => !option.hidden);
175
+ globalOptions.push(...visibleOptions);
183
176
  }
184
- visibleGlobalOptions(cmd) {
185
- if (!this.showGlobalOptions)
186
- return [];
187
- const globalOptions = [];
188
- for (let ancestorCmd = cmd.parent;ancestorCmd; ancestorCmd = ancestorCmd.parent) {
189
- const visibleOptions = ancestorCmd.options.filter((option) => !option.hidden);
190
- globalOptions.push(...visibleOptions);
191
- }
192
- if (this.sortOptions) {
193
- globalOptions.sort(this.compareOptions);
194
- }
195
- return globalOptions;
177
+ if (this.sortOptions) {
178
+ globalOptions.sort(this.compareOptions);
196
179
  }
197
- visibleArguments(cmd) {
198
- if (cmd._argsDescription) {
199
- cmd.registeredArguments.forEach((argument) => {
200
- argument.description = argument.description || cmd._argsDescription[argument.name()] || "";
201
- });
202
- }
203
- if (cmd.registeredArguments.find((argument) => argument.description)) {
204
- return cmd.registeredArguments;
205
- }
206
- return [];
180
+ return globalOptions;
181
+ }
182
+ visibleArguments(cmd) {
183
+ if (cmd._argsDescription) {
184
+ cmd.registeredArguments.forEach((argument) => {
185
+ argument.description = argument.description || cmd._argsDescription[argument.name()] || "";
186
+ });
207
187
  }
208
- subcommandTerm(cmd) {
209
- const args = cmd.registeredArguments.map((arg) => humanReadableArgName(arg)).join(" ");
210
- return cmd._name + (cmd._aliases[0] ? "|" + cmd._aliases[0] : "") + (cmd.options.length ? " [options]" : "") + (args ? " " + args : "");
188
+ if (cmd.registeredArguments.find((argument) => argument.description)) {
189
+ return cmd.registeredArguments;
211
190
  }
212
- optionTerm(option) {
213
- return option.flags;
191
+ return [];
192
+ }
193
+ subcommandTerm(cmd) {
194
+ const args = cmd.registeredArguments.map((arg) => humanReadableArgName(arg)).join(" ");
195
+ return cmd._name + (cmd._aliases[0] ? "|" + cmd._aliases[0] : "") + (cmd.options.length ? " [options]" : "") + (args ? " " + args : "");
196
+ }
197
+ optionTerm(option) {
198
+ return option.flags;
199
+ }
200
+ argumentTerm(argument) {
201
+ return argument.name();
202
+ }
203
+ longestSubcommandTermLength(cmd, helper) {
204
+ return helper.visibleCommands(cmd).reduce((max, command) => {
205
+ return Math.max(max, this.displayWidth(helper.styleSubcommandTerm(helper.subcommandTerm(command))));
206
+ }, 0);
207
+ }
208
+ longestOptionTermLength(cmd, helper) {
209
+ return helper.visibleOptions(cmd).reduce((max, option) => {
210
+ return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
211
+ }, 0);
212
+ }
213
+ longestGlobalOptionTermLength(cmd, helper) {
214
+ return helper.visibleGlobalOptions(cmd).reduce((max, option) => {
215
+ return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
216
+ }, 0);
217
+ }
218
+ longestArgumentTermLength(cmd, helper) {
219
+ return helper.visibleArguments(cmd).reduce((max, argument) => {
220
+ return Math.max(max, this.displayWidth(helper.styleArgumentTerm(helper.argumentTerm(argument))));
221
+ }, 0);
222
+ }
223
+ commandUsage(cmd) {
224
+ let cmdName = cmd._name;
225
+ if (cmd._aliases[0]) {
226
+ cmdName = cmdName + "|" + cmd._aliases[0];
214
227
  }
215
- argumentTerm(argument) {
216
- return argument.name();
228
+ let ancestorCmdNames = "";
229
+ for (let ancestorCmd = cmd.parent;ancestorCmd; ancestorCmd = ancestorCmd.parent) {
230
+ ancestorCmdNames = ancestorCmd.name() + " " + ancestorCmdNames;
217
231
  }
218
- longestSubcommandTermLength(cmd, helper) {
219
- return helper.visibleCommands(cmd).reduce((max, command) => {
220
- return Math.max(max, helper.subcommandTerm(command).length);
221
- }, 0);
232
+ return ancestorCmdNames + cmdName + " " + cmd.usage();
233
+ }
234
+ commandDescription(cmd) {
235
+ return cmd.description();
236
+ }
237
+ subcommandDescription(cmd) {
238
+ return cmd.summary() || cmd.description();
239
+ }
240
+ optionDescription(option) {
241
+ const extraInfo = [];
242
+ if (option.argChoices) {
243
+ extraInfo.push(`choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`);
222
244
  }
223
- longestOptionTermLength(cmd, helper) {
224
- return helper.visibleOptions(cmd).reduce((max, option) => {
225
- return Math.max(max, helper.optionTerm(option).length);
226
- }, 0);
245
+ if (option.defaultValue !== undefined) {
246
+ const showDefault = option.required || option.optional || option.isBoolean() && typeof option.defaultValue === "boolean";
247
+ if (showDefault) {
248
+ extraInfo.push(`default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`);
249
+ }
227
250
  }
228
- longestGlobalOptionTermLength(cmd, helper) {
229
- return helper.visibleGlobalOptions(cmd).reduce((max, option) => {
230
- return Math.max(max, helper.optionTerm(option).length);
231
- }, 0);
251
+ if (option.presetArg !== undefined && option.optional) {
252
+ extraInfo.push(`preset: ${JSON.stringify(option.presetArg)}`);
232
253
  }
233
- longestArgumentTermLength(cmd, helper) {
234
- return helper.visibleArguments(cmd).reduce((max, argument) => {
235
- return Math.max(max, helper.argumentTerm(argument).length);
236
- }, 0);
254
+ if (option.envVar !== undefined) {
255
+ extraInfo.push(`env: ${option.envVar}`);
237
256
  }
238
- commandUsage(cmd) {
239
- let cmdName = cmd._name;
240
- if (cmd._aliases[0]) {
241
- cmdName = cmdName + "|" + cmd._aliases[0];
257
+ if (extraInfo.length > 0) {
258
+ const extraDescription = `(${extraInfo.join(", ")})`;
259
+ if (option.description) {
260
+ return `${option.description} ${extraDescription}`;
242
261
  }
243
- let ancestorCmdNames = "";
244
- for (let ancestorCmd = cmd.parent;ancestorCmd; ancestorCmd = ancestorCmd.parent) {
245
- ancestorCmdNames = ancestorCmd.name() + " " + ancestorCmdNames;
246
- }
247
- return ancestorCmdNames + cmdName + " " + cmd.usage();
262
+ return extraDescription;
248
263
  }
249
- commandDescription(cmd) {
250
- return cmd.description();
264
+ return option.description;
265
+ }
266
+ argumentDescription(argument) {
267
+ const extraInfo = [];
268
+ if (argument.argChoices) {
269
+ extraInfo.push(`choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`);
251
270
  }
252
- subcommandDescription(cmd) {
253
- return cmd.summary() || cmd.description();
271
+ if (argument.defaultValue !== undefined) {
272
+ extraInfo.push(`default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`);
254
273
  }
255
- optionDescription(option) {
256
- const extraInfo = [];
257
- if (option.argChoices) {
258
- extraInfo.push(`choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`);
259
- }
260
- if (option.defaultValue !== undefined) {
261
- const showDefault = option.required || option.optional || option.isBoolean() && typeof option.defaultValue === "boolean";
262
- if (showDefault) {
263
- extraInfo.push(`default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`);
264
- }
274
+ if (extraInfo.length > 0) {
275
+ const extraDescription = `(${extraInfo.join(", ")})`;
276
+ if (argument.description) {
277
+ return `${argument.description} ${extraDescription}`;
265
278
  }
266
- if (option.presetArg !== undefined && option.optional) {
267
- extraInfo.push(`preset: ${JSON.stringify(option.presetArg)}`);
268
- }
269
- if (option.envVar !== undefined) {
270
- extraInfo.push(`env: ${option.envVar}`);
271
- }
272
- if (extraInfo.length > 0) {
273
- return `${option.description} (${extraInfo.join(", ")})`;
274
- }
275
- return option.description;
279
+ return extraDescription;
276
280
  }
277
- argumentDescription(argument) {
278
- const extraInfo = [];
279
- if (argument.argChoices) {
280
- extraInfo.push(`choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`);
281
- }
282
- if (argument.defaultValue !== undefined) {
283
- extraInfo.push(`default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`);
281
+ return argument.description;
282
+ }
283
+ formatItemList(heading, items, helper) {
284
+ if (items.length === 0)
285
+ return [];
286
+ return [helper.styleTitle(heading), ...items, ""];
287
+ }
288
+ groupItems(unsortedItems, visibleItems, getGroup) {
289
+ const result = new Map;
290
+ unsortedItems.forEach((item) => {
291
+ const group = getGroup(item);
292
+ if (!result.has(group))
293
+ result.set(group, []);
294
+ });
295
+ visibleItems.forEach((item) => {
296
+ const group = getGroup(item);
297
+ if (!result.has(group)) {
298
+ result.set(group, []);
284
299
  }
285
- if (extraInfo.length > 0) {
286
- const extraDescripton = `(${extraInfo.join(", ")})`;
287
- if (argument.description) {
288
- return `${argument.description} ${extraDescripton}`;
289
- }
290
- return extraDescripton;
291
- }
292
- return argument.description;
293
- }
294
- formatHelp(cmd, helper) {
295
- const termWidth = helper.padWidth(cmd, helper);
296
- const helpWidth = helper.helpWidth || 80;
297
- const itemIndentWidth = 2;
298
- const itemSeparatorWidth = 2;
299
- function formatItem(term, description) {
300
- if (description) {
301
- const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`;
302
- return helper.wrap(fullText, helpWidth - itemIndentWidth, termWidth + itemSeparatorWidth);
303
- }
304
- return term;
305
- }
306
- function formatList(textArray) {
307
- return textArray.join(`
308
- `).replace(/^/gm, " ".repeat(itemIndentWidth));
309
- }
310
- let output = [`Usage: ${helper.commandUsage(cmd)}`, ""];
311
- const commandDescription = helper.commandDescription(cmd);
312
- if (commandDescription.length > 0) {
313
- output = output.concat([
314
- helper.wrap(commandDescription, helpWidth, 0),
315
- ""
316
- ]);
317
- }
318
- const argumentList = helper.visibleArguments(cmd).map((argument) => {
319
- return formatItem(helper.argumentTerm(argument), helper.argumentDescription(argument));
300
+ result.get(group).push(item);
301
+ });
302
+ return result;
303
+ }
304
+ formatHelp(cmd, helper) {
305
+ const termWidth = helper.padWidth(cmd, helper);
306
+ const helpWidth = helper.helpWidth ?? 80;
307
+ function callFormatItem(term, description) {
308
+ return helper.formatItem(term, termWidth, description, helper);
309
+ }
310
+ let output = [
311
+ `${helper.styleTitle("Usage:")} ${helper.styleUsage(helper.commandUsage(cmd))}`,
312
+ ""
313
+ ];
314
+ const commandDescription = helper.commandDescription(cmd);
315
+ if (commandDescription.length > 0) {
316
+ output = output.concat([
317
+ helper.boxWrap(helper.styleCommandDescription(commandDescription), helpWidth),
318
+ ""
319
+ ]);
320
+ }
321
+ const argumentList = helper.visibleArguments(cmd).map((argument) => {
322
+ return callFormatItem(helper.styleArgumentTerm(helper.argumentTerm(argument)), helper.styleArgumentDescription(helper.argumentDescription(argument)));
323
+ });
324
+ output = output.concat(this.formatItemList("Arguments:", argumentList, helper));
325
+ const optionGroups = this.groupItems(cmd.options, helper.visibleOptions(cmd), (option) => option.helpGroupHeading ?? "Options:");
326
+ optionGroups.forEach((options, group) => {
327
+ const optionList = options.map((option) => {
328
+ return callFormatItem(helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)));
320
329
  });
321
- if (argumentList.length > 0) {
322
- output = output.concat(["Arguments:", formatList(argumentList), ""]);
323
- }
324
- const optionList = helper.visibleOptions(cmd).map((option) => {
325
- return formatItem(helper.optionTerm(option), helper.optionDescription(option));
330
+ output = output.concat(this.formatItemList(group, optionList, helper));
331
+ });
332
+ if (helper.showGlobalOptions) {
333
+ const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
334
+ return callFormatItem(helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)));
326
335
  });
327
- if (optionList.length > 0) {
328
- output = output.concat(["Options:", formatList(optionList), ""]);
329
- }
330
- if (this.showGlobalOptions) {
331
- const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
332
- return formatItem(helper.optionTerm(option), helper.optionDescription(option));
333
- });
334
- if (globalOptionList.length > 0) {
335
- output = output.concat([
336
- "Global Options:",
337
- formatList(globalOptionList),
338
- ""
339
- ]);
340
- }
341
- }
342
- const commandList = helper.visibleCommands(cmd).map((cmd2) => {
343
- return formatItem(helper.subcommandTerm(cmd2), helper.subcommandDescription(cmd2));
336
+ output = output.concat(this.formatItemList("Global Options:", globalOptionList, helper));
337
+ }
338
+ const commandGroups = this.groupItems(cmd.commands, helper.visibleCommands(cmd), (sub) => sub.helpGroup() || "Commands:");
339
+ commandGroups.forEach((commands, group) => {
340
+ const commandList = commands.map((sub) => {
341
+ return callFormatItem(helper.styleSubcommandTerm(helper.subcommandTerm(sub)), helper.styleSubcommandDescription(helper.subcommandDescription(sub)));
344
342
  });
345
- if (commandList.length > 0) {
346
- output = output.concat(["Commands:", formatList(commandList), ""]);
347
- }
348
- return output.join(`
343
+ output = output.concat(this.formatItemList(group, commandList, helper));
344
+ });
345
+ return output.join(`
349
346
  `);
347
+ }
348
+ displayWidth(str) {
349
+ return stripVTControlCharacters(str).length;
350
+ }
351
+ styleTitle(str) {
352
+ return str;
353
+ }
354
+ styleUsage(str) {
355
+ return str.split(" ").map((word) => {
356
+ if (word === "[options]")
357
+ return this.styleOptionText(word);
358
+ if (word === "[command]")
359
+ return this.styleSubcommandText(word);
360
+ if (word[0] === "[" || word[0] === "<")
361
+ return this.styleArgumentText(word);
362
+ return this.styleCommandText(word);
363
+ }).join(" ");
364
+ }
365
+ styleCommandDescription(str) {
366
+ return this.styleDescriptionText(str);
367
+ }
368
+ styleOptionDescription(str) {
369
+ return this.styleDescriptionText(str);
370
+ }
371
+ styleSubcommandDescription(str) {
372
+ return this.styleDescriptionText(str);
373
+ }
374
+ styleArgumentDescription(str) {
375
+ return this.styleDescriptionText(str);
376
+ }
377
+ styleDescriptionText(str) {
378
+ return str;
379
+ }
380
+ styleOptionTerm(str) {
381
+ return this.styleOptionText(str);
382
+ }
383
+ styleSubcommandTerm(str) {
384
+ return str.split(" ").map((word) => {
385
+ if (word === "[options]")
386
+ return this.styleOptionText(word);
387
+ if (word[0] === "[" || word[0] === "<")
388
+ return this.styleArgumentText(word);
389
+ return this.styleSubcommandText(word);
390
+ }).join(" ");
391
+ }
392
+ styleArgumentTerm(str) {
393
+ return this.styleArgumentText(str);
394
+ }
395
+ styleOptionText(str) {
396
+ return str;
397
+ }
398
+ styleArgumentText(str) {
399
+ return str;
400
+ }
401
+ styleSubcommandText(str) {
402
+ return str;
403
+ }
404
+ styleCommandText(str) {
405
+ return str;
406
+ }
407
+ padWidth(cmd, helper) {
408
+ return Math.max(helper.longestOptionTermLength(cmd, helper), helper.longestGlobalOptionTermLength(cmd, helper), helper.longestSubcommandTermLength(cmd, helper), helper.longestArgumentTermLength(cmd, helper));
409
+ }
410
+ preformatted(str) {
411
+ return /\n[^\S\r\n]/.test(str);
412
+ }
413
+ formatItem(term, termWidth, description, helper) {
414
+ const itemIndent = 2;
415
+ const itemIndentStr = " ".repeat(itemIndent);
416
+ if (!description)
417
+ return itemIndentStr + term;
418
+ const paddedTerm = term.padEnd(termWidth + term.length - helper.displayWidth(term));
419
+ const spacerWidth = 2;
420
+ const helpWidth = this.helpWidth ?? 80;
421
+ const remainingWidth = helpWidth - termWidth - spacerWidth - itemIndent;
422
+ let formattedDescription;
423
+ if (remainingWidth < this.minWidthToWrap || helper.preformatted(description)) {
424
+ formattedDescription = description;
425
+ } else {
426
+ const wrappedDescription = helper.boxWrap(description, remainingWidth);
427
+ formattedDescription = wrappedDescription.replace(/\n/g, `
428
+ ` + " ".repeat(termWidth + spacerWidth));
350
429
  }
351
- padWidth(cmd, helper) {
352
- return Math.max(helper.longestOptionTermLength(cmd, helper), helper.longestGlobalOptionTermLength(cmd, helper), helper.longestSubcommandTermLength(cmd, helper), helper.longestArgumentTermLength(cmd, helper));
353
- }
354
- wrap(str, width, indent, minColumnWidth = 40) {
355
- const indents = " \\f\\t\\v   -    \uFEFF";
356
- const manualIndent = new RegExp(`[\\n][${indents}]+`);
357
- if (str.match(manualIndent))
358
- return str;
359
- const columnWidth = width - indent;
360
- if (columnWidth < minColumnWidth)
361
- return str;
362
- const leadingStr = str.slice(0, indent);
363
- const columnText = str.slice(indent).replace(`\r
364
- `, `
365
- `);
366
- const indentString = " ".repeat(indent);
367
- const zeroWidthSpace = "​";
368
- const breaks = `\\s${zeroWidthSpace}`;
369
- const regex = new RegExp(`
370
- |.{1,${columnWidth - 1}}([${breaks}]|$)|[^${breaks}]+?([${breaks}]|$)`, "g");
371
- const lines = columnText.match(regex) || [];
372
- return leadingStr + lines.map((line, i) => {
373
- if (line === `
374
- `)
375
- return "";
376
- return (i > 0 ? indentString : "") + line.trimEnd();
377
- }).join(`
430
+ return itemIndentStr + paddedTerm + " ".repeat(spacerWidth) + formattedDescription.replace(/\n/g, `
431
+ ${itemIndentStr}`);
432
+ }
433
+ boxWrap(str, width) {
434
+ if (width < this.minWidthToWrap)
435
+ return str;
436
+ const rawLines = str.split(/\r\n|\n/);
437
+ const chunkPattern = /[\s]*[^\s]+/g;
438
+ const wrappedLines = [];
439
+ rawLines.forEach((line) => {
440
+ const chunks = line.match(chunkPattern);
441
+ if (chunks === null) {
442
+ wrappedLines.push("");
443
+ return;
444
+ }
445
+ let sumChunks = [chunks.shift()];
446
+ let sumWidth = this.displayWidth(sumChunks[0]);
447
+ chunks.forEach((chunk) => {
448
+ const visibleWidth = this.displayWidth(chunk);
449
+ if (sumWidth + visibleWidth <= width) {
450
+ sumChunks.push(chunk);
451
+ sumWidth += visibleWidth;
452
+ return;
453
+ }
454
+ wrappedLines.push(sumChunks.join(""));
455
+ const nextChunk = chunk.trimStart();
456
+ sumChunks = [nextChunk];
457
+ sumWidth = this.displayWidth(nextChunk);
458
+ });
459
+ wrappedLines.push(sumChunks.join(""));
460
+ });
461
+ return wrappedLines.join(`
378
462
  `);
379
- }
380
463
  }
381
- exports.Help = Help;
464
+ }
465
+ var init_help = __esm(() => {
466
+ init_argument();
382
467
  });
383
468
 
384
- // ../../node_modules/commander/lib/option.js
385
- var require_option = __commonJS((exports) => {
386
- var { InvalidArgumentError } = require_error();
387
-
388
- class Option {
389
- constructor(flags, description) {
390
- this.flags = flags;
391
- this.description = description || "";
392
- this.required = flags.includes("<");
393
- this.optional = flags.includes("[");
394
- this.variadic = /\w\.\.\.[>\]]$/.test(flags);
395
- this.mandatory = false;
396
- const optionFlags = splitOptionFlags(flags);
397
- this.short = optionFlags.shortFlag;
398
- this.long = optionFlags.longFlag;
399
- this.negate = false;
400
- if (this.long) {
401
- this.negate = this.long.startsWith("--no-");
402
- }
403
- this.defaultValue = undefined;
404
- this.defaultValueDescription = undefined;
405
- this.presetArg = undefined;
406
- this.envVar = undefined;
407
- this.parseArg = undefined;
408
- this.hidden = false;
409
- this.argChoices = undefined;
410
- this.conflictsWith = [];
411
- this.implied = undefined;
412
- }
413
- default(value, description) {
414
- this.defaultValue = value;
415
- this.defaultValueDescription = description;
416
- return this;
417
- }
418
- preset(arg) {
419
- this.presetArg = arg;
420
- return this;
421
- }
422
- conflicts(names) {
423
- this.conflictsWith = this.conflictsWith.concat(names);
424
- return this;
425
- }
426
- implies(impliedOptionValues) {
427
- let newImplied = impliedOptionValues;
428
- if (typeof impliedOptionValues === "string") {
429
- newImplied = { [impliedOptionValues]: true };
430
- }
431
- this.implied = Object.assign(this.implied || {}, newImplied);
432
- return this;
433
- }
434
- env(name) {
435
- this.envVar = name;
436
- return this;
437
- }
438
- argParser(fn) {
439
- this.parseArg = fn;
440
- return this;
441
- }
442
- makeOptionMandatory(mandatory = true) {
443
- this.mandatory = !!mandatory;
444
- return this;
469
+ // ../../node_modules/.bun/commander@15.0.0/node_modules/commander/lib/option.js
470
+ class Option {
471
+ constructor(flags, description) {
472
+ this.flags = flags;
473
+ this.description = description || "";
474
+ this.required = flags.includes("<");
475
+ this.optional = flags.includes("[");
476
+ this.variadic = /\w\.\.\.[>\]]$/.test(flags);
477
+ this.mandatory = false;
478
+ const optionFlags = splitOptionFlags(flags);
479
+ this.short = optionFlags.shortFlag;
480
+ this.long = optionFlags.longFlag;
481
+ this.negate = false;
482
+ if (this.long) {
483
+ this.negate = this.long.startsWith("--no-");
484
+ }
485
+ this.defaultValue = undefined;
486
+ this.defaultValueDescription = undefined;
487
+ this.presetArg = undefined;
488
+ this.envVar = undefined;
489
+ this.parseArg = undefined;
490
+ this.hidden = false;
491
+ this.argChoices = undefined;
492
+ this.conflictsWith = [];
493
+ this.implied = undefined;
494
+ this.helpGroupHeading = undefined;
495
+ }
496
+ default(value, description) {
497
+ this.defaultValue = value;
498
+ this.defaultValueDescription = description;
499
+ return this;
500
+ }
501
+ preset(arg) {
502
+ this.presetArg = arg;
503
+ return this;
504
+ }
505
+ conflicts(names) {
506
+ this.conflictsWith = this.conflictsWith.concat(names);
507
+ return this;
508
+ }
509
+ implies(impliedOptionValues) {
510
+ let newImplied = impliedOptionValues;
511
+ if (typeof impliedOptionValues === "string") {
512
+ newImplied = { [impliedOptionValues]: true };
445
513
  }
446
- hideHelp(hide = true) {
447
- this.hidden = !!hide;
448
- return this;
514
+ this.implied = Object.assign(this.implied || {}, newImplied);
515
+ return this;
516
+ }
517
+ env(name) {
518
+ this.envVar = name;
519
+ return this;
520
+ }
521
+ argParser(fn) {
522
+ this.parseArg = fn;
523
+ return this;
524
+ }
525
+ makeOptionMandatory(mandatory = true) {
526
+ this.mandatory = !!mandatory;
527
+ return this;
528
+ }
529
+ hideHelp(hide = true) {
530
+ this.hidden = !!hide;
531
+ return this;
532
+ }
533
+ _collectValue(value, previous) {
534
+ if (previous === this.defaultValue || !Array.isArray(previous)) {
535
+ return [value];
449
536
  }
450
- _concatValue(value, previous) {
451
- if (previous === this.defaultValue || !Array.isArray(previous)) {
452
- return [value];
537
+ previous.push(value);
538
+ return previous;
539
+ }
540
+ choices(values) {
541
+ this.argChoices = values.slice();
542
+ this.parseArg = (arg, previous) => {
543
+ if (!this.argChoices.includes(arg)) {
544
+ throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
453
545
  }
454
- return previous.concat(value);
455
- }
456
- choices(values) {
457
- this.argChoices = values.slice();
458
- this.parseArg = (arg, previous) => {
459
- if (!this.argChoices.includes(arg)) {
460
- throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
461
- }
462
- if (this.variadic) {
463
- return this._concatValue(arg, previous);
464
- }
465
- return arg;
466
- };
467
- return this;
468
- }
469
- name() {
470
- if (this.long) {
471
- return this.long.replace(/^--/, "");
546
+ if (this.variadic) {
547
+ return this._collectValue(arg, previous);
472
548
  }
473
- return this.short.replace(/^-/, "");
549
+ return arg;
550
+ };
551
+ return this;
552
+ }
553
+ name() {
554
+ if (this.long) {
555
+ return this.long.replace(/^--/, "");
474
556
  }
475
- attributeName() {
557
+ return this.short.replace(/^-/, "");
558
+ }
559
+ attributeName() {
560
+ if (this.negate) {
476
561
  return camelcase(this.name().replace(/^no-/, ""));
477
562
  }
478
- is(arg) {
479
- return this.short === arg || this.long === arg;
480
- }
481
- isBoolean() {
482
- return !this.required && !this.optional && !this.negate;
483
- }
563
+ return camelcase(this.name());
484
564
  }
485
-
486
- class DualOptions {
487
- constructor(options) {
488
- this.positiveOptions = new Map;
489
- this.negativeOptions = new Map;
490
- this.dualOptions = new Set;
491
- options.forEach((option) => {
492
- if (option.negate) {
493
- this.negativeOptions.set(option.attributeName(), option);
494
- } else {
495
- this.positiveOptions.set(option.attributeName(), option);
496
- }
497
- });
498
- this.negativeOptions.forEach((value, key) => {
499
- if (this.positiveOptions.has(key)) {
500
- this.dualOptions.add(key);
501
- }
502
- });
503
- }
504
- valueFromOption(value, option) {
505
- const optionKey = option.attributeName();
506
- if (!this.dualOptions.has(optionKey))
507
- return true;
508
- const preset = this.negativeOptions.get(optionKey).presetArg;
509
- const negativeValue = preset !== undefined ? preset : false;
510
- return option.negate === (negativeValue === value);
511
- }
565
+ helpGroup(heading) {
566
+ this.helpGroupHeading = heading;
567
+ return this;
512
568
  }
513
- function camelcase(str) {
514
- return str.split("-").reduce((str2, word) => {
515
- return str2 + word[0].toUpperCase() + word.slice(1);
569
+ is(arg) {
570
+ return this.short === arg || this.long === arg;
571
+ }
572
+ isBoolean() {
573
+ return !this.required && !this.optional && !this.negate;
574
+ }
575
+ }
576
+
577
+ class DualOptions {
578
+ constructor(options) {
579
+ this.positiveOptions = new Map;
580
+ this.negativeOptions = new Map;
581
+ this.dualOptions = new Set;
582
+ options.forEach((option) => {
583
+ if (option.negate) {
584
+ this.negativeOptions.set(option.attributeName(), option);
585
+ } else {
586
+ this.positiveOptions.set(option.attributeName(), option);
587
+ }
588
+ });
589
+ this.negativeOptions.forEach((value, key) => {
590
+ if (this.positiveOptions.has(key)) {
591
+ this.dualOptions.add(key);
592
+ }
516
593
  });
517
594
  }
518
- function splitOptionFlags(flags) {
519
- let shortFlag;
520
- let longFlag;
521
- const flagParts = flags.split(/[ |,]+/);
522
- if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1]))
523
- shortFlag = flagParts.shift();
595
+ valueFromOption(value, option) {
596
+ const optionKey = option.attributeName();
597
+ if (!this.dualOptions.has(optionKey))
598
+ return true;
599
+ const preset = this.negativeOptions.get(optionKey).presetArg;
600
+ const negativeValue = preset !== undefined ? preset : false;
601
+ return option.negate === (negativeValue === value);
602
+ }
603
+ }
604
+ function camelcase(str) {
605
+ return str.split("-").reduce((str2, word) => {
606
+ return str2 + word[0].toUpperCase() + word.slice(1);
607
+ });
608
+ }
609
+ function splitOptionFlags(flags) {
610
+ let shortFlag;
611
+ let longFlag;
612
+ const shortFlagExp = /^-[^-]$/;
613
+ const longFlagExp = /^--[^-]/;
614
+ const flagParts = flags.split(/[ |,]+/).concat("guard");
615
+ if (shortFlagExp.test(flagParts[0]))
616
+ shortFlag = flagParts.shift();
617
+ if (longFlagExp.test(flagParts[0]))
524
618
  longFlag = flagParts.shift();
525
- if (!shortFlag && /^-[^-]$/.test(longFlag)) {
526
- shortFlag = longFlag;
527
- longFlag = undefined;
528
- }
529
- return { shortFlag, longFlag };
619
+ if (!shortFlag && shortFlagExp.test(flagParts[0]))
620
+ shortFlag = flagParts.shift();
621
+ if (!shortFlag && longFlagExp.test(flagParts[0])) {
622
+ shortFlag = longFlag;
623
+ longFlag = flagParts.shift();
624
+ }
625
+ if (flagParts[0].startsWith("-")) {
626
+ const unsupportedFlag = flagParts[0];
627
+ const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;
628
+ if (/^-[^-][^-]/.test(unsupportedFlag))
629
+ throw new Error(`${baseError}
630
+ - a short flag is a single dash and a single character
631
+ - either use a single dash and a single character (for a short flag)
632
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);
633
+ if (shortFlagExp.test(unsupportedFlag))
634
+ throw new Error(`${baseError}
635
+ - too many short flags`);
636
+ if (longFlagExp.test(unsupportedFlag))
637
+ throw new Error(`${baseError}
638
+ - too many long flags`);
639
+ throw new Error(`${baseError}
640
+ - unrecognised flag format`);
530
641
  }
531
- exports.Option = Option;
532
- exports.DualOptions = DualOptions;
642
+ if (shortFlag === undefined && longFlag === undefined)
643
+ throw new Error(`option creation failed due to no flags found in '${flags}'.`);
644
+ return { shortFlag, longFlag };
645
+ }
646
+ var init_option = __esm(() => {
647
+ init_error();
533
648
  });
534
649
 
535
- // ../../node_modules/commander/lib/suggestSimilar.js
536
- var require_suggestSimilar = __commonJS((exports) => {
537
- var maxDistance = 3;
538
- function editDistance(a, b) {
539
- if (Math.abs(a.length - b.length) > maxDistance)
540
- return Math.max(a.length, b.length);
541
- const d = [];
542
- for (let i = 0;i <= a.length; i++) {
543
- d[i] = [i];
544
- }
545
- for (let j = 0;j <= b.length; j++) {
546
- d[0][j] = j;
547
- }
548
- for (let j = 1;j <= b.length; j++) {
549
- for (let i = 1;i <= a.length; i++) {
550
- let cost = 1;
551
- if (a[i - 1] === b[j - 1]) {
552
- cost = 0;
553
- } else {
554
- cost = 1;
555
- }
556
- d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
557
- if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
558
- d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
559
- }
650
+ // ../../node_modules/.bun/commander@15.0.0/node_modules/commander/lib/suggestSimilar.js
651
+ function editDistance(a, b) {
652
+ if (Math.abs(a.length - b.length) > maxDistance)
653
+ return Math.max(a.length, b.length);
654
+ const d = [];
655
+ for (let i = 0;i <= a.length; i++) {
656
+ d[i] = [i];
657
+ }
658
+ for (let j = 0;j <= b.length; j++) {
659
+ d[0][j] = j;
660
+ }
661
+ for (let j = 1;j <= b.length; j++) {
662
+ for (let i = 1;i <= a.length; i++) {
663
+ let cost;
664
+ if (a[i - 1] === b[j - 1]) {
665
+ cost = 0;
666
+ } else {
667
+ cost = 1;
668
+ }
669
+ d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
670
+ if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
671
+ d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
560
672
  }
561
673
  }
562
- return d[a.length][b.length];
563
674
  }
564
- function suggestSimilar(word, candidates) {
565
- if (!candidates || candidates.length === 0)
566
- return "";
567
- candidates = Array.from(new Set(candidates));
568
- const searchingOptions = word.startsWith("--");
569
- if (searchingOptions) {
570
- word = word.slice(2);
571
- candidates = candidates.map((candidate) => candidate.slice(2));
572
- }
573
- let similar = [];
574
- let bestDistance = maxDistance;
575
- const minSimilarity = 0.4;
576
- candidates.forEach((candidate) => {
577
- if (candidate.length <= 1)
578
- return;
579
- const distance = editDistance(word, candidate);
580
- const length = Math.max(word.length, candidate.length);
581
- const similarity = (length - distance) / length;
582
- if (similarity > minSimilarity) {
583
- if (distance < bestDistance) {
584
- bestDistance = distance;
585
- similar = [candidate];
586
- } else if (distance === bestDistance) {
587
- similar.push(candidate);
588
- }
675
+ return d[a.length][b.length];
676
+ }
677
+ function suggestSimilar(word, candidates) {
678
+ if (!candidates || candidates.length === 0)
679
+ return "";
680
+ candidates = Array.from(new Set(candidates));
681
+ const searchingOptions = word.startsWith("--");
682
+ if (searchingOptions) {
683
+ word = word.slice(2);
684
+ candidates = candidates.map((candidate) => candidate.slice(2));
685
+ }
686
+ let similar = [];
687
+ let bestDistance = maxDistance;
688
+ const minSimilarity = 0.4;
689
+ candidates.forEach((candidate) => {
690
+ if (candidate.length <= 1)
691
+ return;
692
+ const distance = editDistance(word, candidate);
693
+ const length = Math.max(word.length, candidate.length);
694
+ const similarity = (length - distance) / length;
695
+ if (similarity > minSimilarity) {
696
+ if (distance < bestDistance) {
697
+ bestDistance = distance;
698
+ similar = [candidate];
699
+ } else if (distance === bestDistance) {
700
+ similar.push(candidate);
589
701
  }
590
- });
591
- similar.sort((a, b) => a.localeCompare(b));
592
- if (searchingOptions) {
593
- similar = similar.map((candidate) => `--${candidate}`);
594
702
  }
595
- if (similar.length > 1) {
596
- return `
703
+ });
704
+ similar.sort((a, b) => a.localeCompare(b));
705
+ if (searchingOptions) {
706
+ similar = similar.map((candidate) => `--${candidate}`);
707
+ }
708
+ if (similar.length > 1) {
709
+ return `
597
710
  (Did you mean one of ${similar.join(", ")}?)`;
598
- }
599
- if (similar.length === 1) {
600
- return `
711
+ }
712
+ if (similar.length === 1) {
713
+ return `
601
714
  (Did you mean ${similar[0]}?)`;
602
- }
603
- return "";
604
715
  }
605
- exports.suggestSimilar = suggestSimilar;
606
- });
607
-
608
- // ../../node_modules/commander/lib/command.js
609
- var require_command = __commonJS((exports) => {
610
- var EventEmitter = __require("node:events").EventEmitter;
611
- var childProcess = __require("node:child_process");
612
- var path = __require("node:path");
613
- var fs = __require("node:fs");
614
- var process2 = __require("node:process");
615
- var { Argument, humanReadableArgName } = require_argument();
616
- var { CommanderError } = require_error();
617
- var { Help } = require_help();
618
- var { Option, DualOptions } = require_option();
619
- var { suggestSimilar } = require_suggestSimilar();
716
+ return "";
717
+ }
718
+ var maxDistance = 3;
620
719
 
621
- class Command extends EventEmitter {
720
+ // ../../node_modules/.bun/commander@15.0.0/node_modules/commander/lib/command.js
721
+ import { EventEmitter } from "node:events";
722
+ import childProcess from "node:child_process";
723
+ import path from "node:path";
724
+ import fs from "node:fs";
725
+ import process2 from "node:process";
726
+ import { stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
727
+ function incrementNodeInspectorPort(args) {
728
+ return args.map((arg) => {
729
+ if (!arg.startsWith("--inspect")) {
730
+ return arg;
731
+ }
732
+ let debugOption;
733
+ let debugHost = "127.0.0.1";
734
+ let debugPort = "9229";
735
+ let match;
736
+ if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
737
+ debugOption = match[1];
738
+ } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
739
+ debugOption = match[1];
740
+ if (/^\d+$/.test(match[3])) {
741
+ debugPort = match[3];
742
+ } else {
743
+ debugHost = match[3];
744
+ }
745
+ } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
746
+ debugOption = match[1];
747
+ debugHost = match[3];
748
+ debugPort = match[4];
749
+ }
750
+ if (debugOption && debugPort !== "0") {
751
+ return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;
752
+ }
753
+ return arg;
754
+ });
755
+ }
756
+ function useColor() {
757
+ if (process2.env.NO_COLOR || process2.env.FORCE_COLOR === "0" || process2.env.FORCE_COLOR === "false")
758
+ return false;
759
+ if (process2.env.FORCE_COLOR || process2.env.CLICOLOR_FORCE !== undefined)
760
+ return true;
761
+ return;
762
+ }
763
+ var Command;
764
+ var init_command = __esm(() => {
765
+ init_argument();
766
+ init_error();
767
+ init_help();
768
+ init_option();
769
+ Command = class Command extends EventEmitter {
622
770
  constructor(name) {
623
771
  super();
624
772
  this.commands = [];
625
773
  this.options = [];
626
774
  this.parent = null;
627
775
  this._allowUnknownOption = false;
628
- this._allowExcessArguments = true;
776
+ this._allowExcessArguments = false;
629
777
  this.registeredArguments = [];
630
778
  this._args = this.registeredArguments;
631
779
  this.args = [];
@@ -652,18 +800,25 @@ var require_command = __commonJS((exports) => {
652
800
  this._lifeCycleHooks = {};
653
801
  this._showHelpAfterError = false;
654
802
  this._showSuggestionAfterError = true;
803
+ this._savedState = null;
655
804
  this._outputConfiguration = {
656
805
  writeOut: (str) => process2.stdout.write(str),
657
806
  writeErr: (str) => process2.stderr.write(str),
807
+ outputError: (str, write) => write(str),
658
808
  getOutHelpWidth: () => process2.stdout.isTTY ? process2.stdout.columns : undefined,
659
809
  getErrHelpWidth: () => process2.stderr.isTTY ? process2.stderr.columns : undefined,
660
- outputError: (str, write) => write(str)
810
+ getOutHasColors: () => useColor() ?? (process2.stdout.isTTY && process2.stdout.hasColors?.()),
811
+ getErrHasColors: () => useColor() ?? (process2.stderr.isTTY && process2.stderr.hasColors?.()),
812
+ stripColor: (str) => stripVTControlCharacters2(str)
661
813
  };
662
814
  this._hidden = false;
663
815
  this._helpOption = undefined;
664
816
  this._addImplicitHelpCommand = undefined;
665
817
  this._helpCommand = undefined;
666
818
  this._helpConfiguration = {};
819
+ this._helpGroupHeading = undefined;
820
+ this._defaultCommandGroup = undefined;
821
+ this._defaultOptionGroup = undefined;
667
822
  }
668
823
  copyInheritedSettings(sourceCommand) {
669
824
  this._outputConfiguration = sourceCommand._outputConfiguration;
@@ -728,7 +883,10 @@ var require_command = __commonJS((exports) => {
728
883
  configureOutput(configuration) {
729
884
  if (configuration === undefined)
730
885
  return this._outputConfiguration;
731
- Object.assign(this._outputConfiguration, configuration);
886
+ this._outputConfiguration = {
887
+ ...this._outputConfiguration,
888
+ ...configuration
889
+ };
732
890
  return this;
733
891
  }
734
892
  showHelpAfterError(displayHelp = true) {
@@ -759,12 +917,12 @@ var require_command = __commonJS((exports) => {
759
917
  createArgument(name, description) {
760
918
  return new Argument(name, description);
761
919
  }
762
- argument(name, description, fn, defaultValue) {
920
+ argument(name, description, parseArg, defaultValue) {
763
921
  const argument = this.createArgument(name, description);
764
- if (typeof fn === "function") {
765
- argument.default(defaultValue).argParser(fn);
922
+ if (typeof parseArg === "function") {
923
+ argument.default(defaultValue).argParser(parseArg);
766
924
  } else {
767
- argument.default(fn);
925
+ argument.default(parseArg);
768
926
  }
769
927
  this.addArgument(argument);
770
928
  return this;
@@ -777,7 +935,7 @@ var require_command = __commonJS((exports) => {
777
935
  }
778
936
  addArgument(argument) {
779
937
  const previousArgument = this.registeredArguments.slice(-1)[0];
780
- if (previousArgument && previousArgument.variadic) {
938
+ if (previousArgument?.variadic) {
781
939
  throw new Error(`only the last argument can be variadic '${previousArgument.name()}'`);
782
940
  }
783
941
  if (argument.required && argument.defaultValue !== undefined && argument.parseArg === undefined) {
@@ -789,10 +947,13 @@ var require_command = __commonJS((exports) => {
789
947
  helpCommand(enableOrNameAndArgs, description) {
790
948
  if (typeof enableOrNameAndArgs === "boolean") {
791
949
  this._addImplicitHelpCommand = enableOrNameAndArgs;
950
+ if (enableOrNameAndArgs && this._defaultCommandGroup) {
951
+ this._initCommandGroup(this._getHelpCommand());
952
+ }
792
953
  return this;
793
954
  }
794
- enableOrNameAndArgs = enableOrNameAndArgs ?? "help [command]";
795
- const [, helpName, helpArgs] = enableOrNameAndArgs.match(/([^ ]+) *(.*)/);
955
+ const nameAndArgs = enableOrNameAndArgs ?? "help [command]";
956
+ const [, helpName, helpArgs] = nameAndArgs.match(/([^ ]+) *(.*)/);
796
957
  const helpDescription = description ?? "display help for command";
797
958
  const helpCommand = this.createCommand(helpName);
798
959
  helpCommand.helpOption(false);
@@ -802,6 +963,8 @@ var require_command = __commonJS((exports) => {
802
963
  helpCommand.description(helpDescription);
803
964
  this._addImplicitHelpCommand = true;
804
965
  this._helpCommand = helpCommand;
966
+ if (enableOrNameAndArgs || description)
967
+ this._initCommandGroup(helpCommand);
805
968
  return this;
806
969
  }
807
970
  addHelpCommand(helpCommand, deprecatedDescription) {
@@ -811,6 +974,7 @@ var require_command = __commonJS((exports) => {
811
974
  }
812
975
  this._addImplicitHelpCommand = true;
813
976
  this._helpCommand = helpCommand;
977
+ this._initCommandGroup(helpCommand);
814
978
  return this;
815
979
  }
816
980
  _getHelpCommand() {
@@ -843,7 +1007,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
843
1007
  this._exitCallback = (err) => {
844
1008
  if (err.code !== "commander.executeSubCommandAsync") {
845
1009
  throw err;
846
- } else {}
1010
+ }
847
1011
  };
848
1012
  }
849
1013
  return this;
@@ -890,6 +1054,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
890
1054
  throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}'
891
1055
  - already used by option '${matchingOption.flags}'`);
892
1056
  }
1057
+ this._initOptionGroup(option);
893
1058
  this.options.push(option);
894
1059
  }
895
1060
  _registerCommand(command) {
@@ -902,18 +1067,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
902
1067
  const newCmd = knownBy(command).join("|");
903
1068
  throw new Error(`cannot add command '${newCmd}' as already have command '${existingCmd}'`);
904
1069
  }
1070
+ this._initCommandGroup(command);
905
1071
  this.commands.push(command);
906
1072
  }
907
1073
  addOption(option) {
908
1074
  this._registerOption(option);
909
1075
  const oname = option.name();
910
1076
  const name = option.attributeName();
911
- if (option.negate) {
912
- const positiveLongFlag = option.long.replace(/^--no-/, "--");
913
- if (!this._findOption(positiveLongFlag)) {
914
- this.setOptionValueWithSource(name, option.defaultValue === undefined ? true : option.defaultValue, "default");
915
- }
916
- } else if (option.defaultValue !== undefined) {
1077
+ if (option.defaultValue !== undefined) {
917
1078
  this.setOptionValueWithSource(name, option.defaultValue, "default");
918
1079
  }
919
1080
  const handleOptionValue = (val, invalidValueMessage, valueSource) => {
@@ -924,7 +1085,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
924
1085
  if (val !== null && option.parseArg) {
925
1086
  val = this._callParseArg(option, val, oldValue, invalidValueMessage);
926
1087
  } else if (val !== null && option.variadic) {
927
- val = option._concatValue(val, oldValue);
1088
+ val = option._collectValue(val, oldValue);
928
1089
  }
929
1090
  if (val == null) {
930
1091
  if (option.negate) {
@@ -1089,18 +1250,61 @@ Expecting one of '${allowedValues.join("', '")}'`);
1089
1250
  return userArgs;
1090
1251
  }
1091
1252
  parse(argv, parseOptions) {
1253
+ this._prepareForParse();
1092
1254
  const userArgs = this._prepareUserArgs(argv, parseOptions);
1093
1255
  this._parseCommand([], userArgs);
1094
1256
  return this;
1095
1257
  }
1096
1258
  async parseAsync(argv, parseOptions) {
1259
+ this._prepareForParse();
1097
1260
  const userArgs = this._prepareUserArgs(argv, parseOptions);
1098
1261
  await this._parseCommand([], userArgs);
1099
1262
  return this;
1100
1263
  }
1264
+ _prepareForParse() {
1265
+ if (this._savedState === null) {
1266
+ this.options.filter((option) => option.negate && option.defaultValue === undefined && this.getOptionValue(option.attributeName()) === undefined).forEach((option) => {
1267
+ const positiveLongFlag = option.long.replace(/^--no-/, "--");
1268
+ if (!this._findOption(positiveLongFlag)) {
1269
+ this.setOptionValueWithSource(option.attributeName(), true, "default");
1270
+ }
1271
+ });
1272
+ this.saveStateBeforeParse();
1273
+ } else {
1274
+ this.restoreStateBeforeParse();
1275
+ }
1276
+ }
1277
+ saveStateBeforeParse() {
1278
+ this._savedState = {
1279
+ _name: this._name,
1280
+ _optionValues: { ...this._optionValues },
1281
+ _optionValueSources: { ...this._optionValueSources }
1282
+ };
1283
+ }
1284
+ restoreStateBeforeParse() {
1285
+ if (this._storeOptionsAsProperties)
1286
+ throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
1287
+ - either make a new Command for each call to parse, or stop storing options as properties`);
1288
+ this._name = this._savedState._name;
1289
+ this._scriptPath = null;
1290
+ this.rawArgs = [];
1291
+ this._optionValues = { ...this._savedState._optionValues };
1292
+ this._optionValueSources = { ...this._savedState._optionValueSources };
1293
+ this.args = [];
1294
+ this.processedArgs = [];
1295
+ }
1296
+ _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
1297
+ if (fs.existsSync(executableFile))
1298
+ return;
1299
+ const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
1300
+ const executableMissing = `'${executableFile}' does not exist
1301
+ - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
1302
+ - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
1303
+ - ${executableDirMessage}`;
1304
+ throw new Error(executableMissing);
1305
+ }
1101
1306
  _executeSubCommand(subcommand, args) {
1102
1307
  args = args.slice();
1103
- let launchWithNode = false;
1104
1308
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1105
1309
  function findFile(baseDir, baseName) {
1106
1310
  const localBin = path.resolve(baseDir, baseName);
@@ -1121,7 +1325,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1121
1325
  let resolvedScriptPath;
1122
1326
  try {
1123
1327
  resolvedScriptPath = fs.realpathSync(this._scriptPath);
1124
- } catch (err) {
1328
+ } catch {
1125
1329
  resolvedScriptPath = this._scriptPath;
1126
1330
  }
1127
1331
  executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir);
@@ -1136,7 +1340,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1136
1340
  }
1137
1341
  executableFile = localFile || executableFile;
1138
1342
  }
1139
- launchWithNode = sourceExt.includes(path.extname(executableFile));
1343
+ const launchWithNode = sourceExt.includes(path.extname(executableFile));
1140
1344
  let proc;
1141
1345
  if (process2.platform !== "win32") {
1142
1346
  if (launchWithNode) {
@@ -1147,6 +1351,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1147
1351
  proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
1148
1352
  }
1149
1353
  } else {
1354
+ this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
1150
1355
  args.unshift(executableFile);
1151
1356
  args = incrementNodeInspectorPort(process2.execArgv).concat(args);
1152
1357
  proc = childProcess.spawn(process2.execPath, args, { stdio: "inherit" });
@@ -1172,12 +1377,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1172
1377
  });
1173
1378
  proc.on("error", (err) => {
1174
1379
  if (err.code === "ENOENT") {
1175
- const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
1176
- const executableMissing = `'${executableFile}' does not exist
1177
- - if '${subcommand._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
1178
- - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
1179
- - ${executableDirMessage}`;
1180
- throw new Error(executableMissing);
1380
+ this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
1181
1381
  } else if (err.code === "EACCES") {
1182
1382
  throw new Error(`'${executableFile}' not executable`);
1183
1383
  }
@@ -1195,6 +1395,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1195
1395
  const subCommand = this._findCommand(commandName);
1196
1396
  if (!subCommand)
1197
1397
  this.help({ error: true });
1398
+ subCommand._prepareForParse();
1198
1399
  let promiseChain;
1199
1400
  promiseChain = this._chainOrCallSubCommandHook(promiseChain, subCommand, "preSubcommand");
1200
1401
  promiseChain = this._chainOrCall(promiseChain, () => {
@@ -1264,7 +1465,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1264
1465
  this.processedArgs = processedArgs;
1265
1466
  }
1266
1467
  _chainOrCall(promise, fn) {
1267
- if (promise && promise.then && typeof promise.then === "function") {
1468
+ if (promise?.then && typeof promise.then === "function") {
1268
1469
  return promise.then(() => fn());
1269
1470
  }
1270
1471
  return fn();
@@ -1341,7 +1542,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1341
1542
  promiseChain = this._chainOrCallHooks(promiseChain, "postAction");
1342
1543
  return promiseChain;
1343
1544
  }
1344
- if (this.parent && this.parent.listenerCount(commandEvent)) {
1545
+ if (this.parent?.listenerCount(commandEvent)) {
1345
1546
  checkForUnknownOptions();
1346
1547
  this._processArguments();
1347
1548
  this.parent.emit(commandEvent, operands, unknown);
@@ -1403,24 +1604,31 @@ Expecting one of '${allowedValues.join("', '")}'`);
1403
1604
  cmd._checkForConflictingLocalOptions();
1404
1605
  });
1405
1606
  }
1406
- parseOptions(argv) {
1607
+ parseOptions(args) {
1407
1608
  const operands = [];
1408
1609
  const unknown = [];
1409
1610
  let dest = operands;
1410
- const args = argv.slice();
1411
1611
  function maybeOption(arg) {
1412
1612
  return arg.length > 1 && arg[0] === "-";
1413
1613
  }
1614
+ const negativeNumberArg = (arg) => {
1615
+ if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg))
1616
+ return false;
1617
+ return !this._getCommandAndAncestors().some((cmd) => cmd.options.map((opt) => opt.short).some((short) => /^-\d$/.test(short)));
1618
+ };
1414
1619
  let activeVariadicOption = null;
1415
- while (args.length) {
1416
- const arg = args.shift();
1620
+ let activeGroup = null;
1621
+ let i = 0;
1622
+ while (i < args.length || activeGroup) {
1623
+ const arg = activeGroup ?? args[i++];
1624
+ activeGroup = null;
1417
1625
  if (arg === "--") {
1418
1626
  if (dest === unknown)
1419
1627
  dest.push(arg);
1420
- dest.push(...args);
1628
+ dest.push(...args.slice(i));
1421
1629
  break;
1422
1630
  }
1423
- if (activeVariadicOption && !maybeOption(arg)) {
1631
+ if (activeVariadicOption && (!maybeOption(arg) || negativeNumberArg(arg))) {
1424
1632
  this.emit(`option:${activeVariadicOption.name()}`, arg);
1425
1633
  continue;
1426
1634
  }
@@ -1429,14 +1637,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
1429
1637
  const option = this._findOption(arg);
1430
1638
  if (option) {
1431
1639
  if (option.required) {
1432
- const value = args.shift();
1640
+ const value = args[i++];
1433
1641
  if (value === undefined)
1434
1642
  this.optionMissingArgument(option);
1435
1643
  this.emit(`option:${option.name()}`, value);
1436
1644
  } else if (option.optional) {
1437
1645
  let value = null;
1438
- if (args.length > 0 && !maybeOption(args[0])) {
1439
- value = args.shift();
1646
+ if (i < args.length && (!maybeOption(args[i]) || negativeNumberArg(args[i]))) {
1647
+ value = args[i++];
1440
1648
  }
1441
1649
  this.emit(`option:${option.name()}`, value);
1442
1650
  } else {
@@ -1453,7 +1661,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1453
1661
  this.emit(`option:${option.name()}`, arg.slice(2));
1454
1662
  } else {
1455
1663
  this.emit(`option:${option.name()}`);
1456
- args.unshift(`-${arg.slice(2)}`);
1664
+ activeGroup = `-${arg.slice(2)}`;
1457
1665
  }
1458
1666
  continue;
1459
1667
  }
@@ -1466,31 +1674,24 @@ Expecting one of '${allowedValues.join("', '")}'`);
1466
1674
  continue;
1467
1675
  }
1468
1676
  }
1469
- if (maybeOption(arg)) {
1677
+ if (dest === operands && maybeOption(arg) && !(this.commands.length === 0 && negativeNumberArg(arg))) {
1470
1678
  dest = unknown;
1471
1679
  }
1472
1680
  if ((this._enablePositionalOptions || this._passThroughOptions) && operands.length === 0 && unknown.length === 0) {
1473
1681
  if (this._findCommand(arg)) {
1474
1682
  operands.push(arg);
1475
- if (args.length > 0)
1476
- unknown.push(...args);
1683
+ unknown.push(...args.slice(i));
1477
1684
  break;
1478
1685
  } else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) {
1479
- operands.push(arg);
1480
- if (args.length > 0)
1481
- operands.push(...args);
1686
+ operands.push(arg, ...args.slice(i));
1482
1687
  break;
1483
1688
  } else if (this._defaultCommandName) {
1484
- unknown.push(arg);
1485
- if (args.length > 0)
1486
- unknown.push(...args);
1689
+ unknown.push(arg, ...args.slice(i));
1487
1690
  break;
1488
1691
  }
1489
1692
  }
1490
1693
  if (this._passThroughOptions) {
1491
- dest.push(arg);
1492
- if (args.length > 0)
1493
- dest.push(...args);
1694
+ dest.push(arg, ...args.slice(i));
1494
1695
  break;
1495
1696
  }
1496
1697
  dest.push(arg);
@@ -1610,8 +1811,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1610
1811
  return;
1611
1812
  const expected = this.registeredArguments.length;
1612
1813
  const s = expected === 1 ? "" : "s";
1814
+ const received = receivedArgs.length;
1613
1815
  const forSubcommand = this.parent ? ` for '${this.name()}'` : "";
1614
- const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${receivedArgs.length}.`;
1816
+ const details = receivedArgs.join(", ");
1817
+ const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${received}: ${details}.`;
1615
1818
  this.error(message, { code: "commander.excessArguments" });
1616
1819
  }
1617
1820
  unknownCommand() {
@@ -1701,6 +1904,32 @@ Expecting one of '${allowedValues.join("', '")}'`);
1701
1904
  this._name = str;
1702
1905
  return this;
1703
1906
  }
1907
+ helpGroup(heading) {
1908
+ if (heading === undefined)
1909
+ return this._helpGroupHeading ?? "";
1910
+ this._helpGroupHeading = heading;
1911
+ return this;
1912
+ }
1913
+ commandsGroup(heading) {
1914
+ if (heading === undefined)
1915
+ return this._defaultCommandGroup ?? "";
1916
+ this._defaultCommandGroup = heading;
1917
+ return this;
1918
+ }
1919
+ optionsGroup(heading) {
1920
+ if (heading === undefined)
1921
+ return this._defaultOptionGroup ?? "";
1922
+ this._defaultOptionGroup = heading;
1923
+ return this;
1924
+ }
1925
+ _initOptionGroup(option) {
1926
+ if (this._defaultOptionGroup && !option.helpGroupHeading)
1927
+ option.helpGroup(this._defaultOptionGroup);
1928
+ }
1929
+ _initCommandGroup(cmd) {
1930
+ if (this._defaultCommandGroup && !cmd.helpGroup())
1931
+ cmd.helpGroup(this._defaultCommandGroup);
1932
+ }
1704
1933
  nameFromFilename(filename) {
1705
1934
  this._name = path.basename(filename, path.extname(filename));
1706
1935
  return this;
@@ -1713,23 +1942,38 @@ Expecting one of '${allowedValues.join("', '")}'`);
1713
1942
  }
1714
1943
  helpInformation(contextOptions) {
1715
1944
  const helper = this.createHelp();
1716
- if (helper.helpWidth === undefined) {
1717
- helper.helpWidth = contextOptions && contextOptions.error ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth();
1718
- }
1719
- return helper.formatHelp(this, helper);
1945
+ const context = this._getOutputContext(contextOptions);
1946
+ helper.prepareContext({
1947
+ error: context.error,
1948
+ helpWidth: context.helpWidth,
1949
+ outputHasColors: context.hasColors
1950
+ });
1951
+ const text = helper.formatHelp(this, helper);
1952
+ if (context.hasColors)
1953
+ return text;
1954
+ return this._outputConfiguration.stripColor(text);
1720
1955
  }
1721
- _getHelpContext(contextOptions) {
1956
+ _getOutputContext(contextOptions) {
1722
1957
  contextOptions = contextOptions || {};
1723
- const context = { error: !!contextOptions.error };
1724
- let write;
1725
- if (context.error) {
1726
- write = (arg) => this._outputConfiguration.writeErr(arg);
1958
+ const error = !!contextOptions.error;
1959
+ let baseWrite;
1960
+ let hasColors;
1961
+ let helpWidth;
1962
+ if (error) {
1963
+ baseWrite = (str) => this._outputConfiguration.writeErr(str);
1964
+ hasColors = this._outputConfiguration.getErrHasColors();
1965
+ helpWidth = this._outputConfiguration.getErrHelpWidth();
1727
1966
  } else {
1728
- write = (arg) => this._outputConfiguration.writeOut(arg);
1729
- }
1730
- context.write = contextOptions.write || write;
1731
- context.command = this;
1732
- return context;
1967
+ baseWrite = (str) => this._outputConfiguration.writeOut(str);
1968
+ hasColors = this._outputConfiguration.getOutHasColors();
1969
+ helpWidth = this._outputConfiguration.getOutHelpWidth();
1970
+ }
1971
+ const write = (str) => {
1972
+ if (!hasColors)
1973
+ str = this._outputConfiguration.stripColor(str);
1974
+ return baseWrite(str);
1975
+ };
1976
+ return { error, write, hasColors, helpWidth };
1733
1977
  }
1734
1978
  outputHelp(contextOptions) {
1735
1979
  let deprecatedCallback;
@@ -1737,35 +1981,44 @@ Expecting one of '${allowedValues.join("', '")}'`);
1737
1981
  deprecatedCallback = contextOptions;
1738
1982
  contextOptions = undefined;
1739
1983
  }
1740
- const context = this._getHelpContext(contextOptions);
1741
- this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", context));
1742
- this.emit("beforeHelp", context);
1743
- let helpInformation = this.helpInformation(context);
1984
+ const outputContext = this._getOutputContext(contextOptions);
1985
+ const eventContext = {
1986
+ error: outputContext.error,
1987
+ write: outputContext.write,
1988
+ command: this
1989
+ };
1990
+ this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", eventContext));
1991
+ this.emit("beforeHelp", eventContext);
1992
+ let helpInformation = this.helpInformation({ error: outputContext.error });
1744
1993
  if (deprecatedCallback) {
1745
1994
  helpInformation = deprecatedCallback(helpInformation);
1746
1995
  if (typeof helpInformation !== "string" && !Buffer.isBuffer(helpInformation)) {
1747
1996
  throw new Error("outputHelp callback must return a string or a Buffer");
1748
1997
  }
1749
1998
  }
1750
- context.write(helpInformation);
1999
+ outputContext.write(helpInformation);
1751
2000
  if (this._getHelpOption()?.long) {
1752
2001
  this.emit(this._getHelpOption().long);
1753
2002
  }
1754
- this.emit("afterHelp", context);
1755
- this._getCommandAndAncestors().forEach((command) => command.emit("afterAllHelp", context));
2003
+ this.emit("afterHelp", eventContext);
2004
+ this._getCommandAndAncestors().forEach((command) => command.emit("afterAllHelp", eventContext));
1756
2005
  }
1757
2006
  helpOption(flags, description) {
1758
2007
  if (typeof flags === "boolean") {
1759
2008
  if (flags) {
1760
- this._helpOption = this._helpOption ?? undefined;
2009
+ if (this._helpOption === null)
2010
+ this._helpOption = undefined;
2011
+ if (this._defaultOptionGroup) {
2012
+ this._initOptionGroup(this._getHelpOption());
2013
+ }
1761
2014
  } else {
1762
2015
  this._helpOption = null;
1763
2016
  }
1764
2017
  return this;
1765
2018
  }
1766
- flags = flags ?? "-h, --help";
1767
- description = description ?? "display help for command";
1768
- this._helpOption = this.createOption(flags, description);
2019
+ this._helpOption = this.createOption(flags ?? "-h, --help", description ?? "display help for command");
2020
+ if (flags || description)
2021
+ this._initOptionGroup(this._helpOption);
1769
2022
  return this;
1770
2023
  }
1771
2024
  _getHelpOption() {
@@ -1776,11 +2029,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
1776
2029
  }
1777
2030
  addHelpOption(option) {
1778
2031
  this._helpOption = option;
2032
+ this._initOptionGroup(option);
1779
2033
  return this;
1780
2034
  }
1781
2035
  help(contextOptions) {
1782
2036
  this.outputHelp(contextOptions);
1783
- let exitCode = process2.exitCode || 0;
2037
+ let exitCode = Number(process2.exitCode ?? 0);
1784
2038
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
1785
2039
  exitCode = 1;
1786
2040
  }
@@ -1815,76 +2069,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
1815
2069
  this._exit(0, "commander.helpDisplayed", "(outputHelp)");
1816
2070
  }
1817
2071
  }
1818
- }
1819
- function incrementNodeInspectorPort(args) {
1820
- return args.map((arg) => {
1821
- if (!arg.startsWith("--inspect")) {
1822
- return arg;
1823
- }
1824
- let debugOption;
1825
- let debugHost = "127.0.0.1";
1826
- let debugPort = "9229";
1827
- let match;
1828
- if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
1829
- debugOption = match[1];
1830
- } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
1831
- debugOption = match[1];
1832
- if (/^\d+$/.test(match[3])) {
1833
- debugPort = match[3];
1834
- } else {
1835
- debugHost = match[3];
1836
- }
1837
- } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
1838
- debugOption = match[1];
1839
- debugHost = match[3];
1840
- debugPort = match[4];
1841
- }
1842
- if (debugOption && debugPort !== "0") {
1843
- return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;
1844
- }
1845
- return arg;
1846
- });
1847
- }
1848
- exports.Command = Command;
1849
- });
1850
-
1851
- // ../../node_modules/commander/index.js
1852
- var require_commander = __commonJS((exports) => {
1853
- var { Argument } = require_argument();
1854
- var { Command } = require_command();
1855
- var { CommanderError, InvalidArgumentError } = require_error();
1856
- var { Help } = require_help();
1857
- var { Option } = require_option();
1858
- exports.program = new Command;
1859
- exports.createCommand = (name) => new Command(name);
1860
- exports.createOption = (flags, description) => new Option(flags, description);
1861
- exports.createArgument = (name, description) => new Argument(name, description);
1862
- exports.Command = Command;
1863
- exports.Option = Option;
1864
- exports.Argument = Argument;
1865
- exports.Help = Help;
1866
- exports.CommanderError = CommanderError;
1867
- exports.InvalidArgumentError = InvalidArgumentError;
1868
- exports.InvalidOptionArgumentError = InvalidArgumentError;
2072
+ };
1869
2073
  });
1870
2074
 
1871
- // ../../node_modules/commander/esm.mjs
1872
- var import__, program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help;
1873
- var init_esm = __esm(() => {
1874
- import__ = __toESM(require_commander(), 1);
1875
- ({
1876
- program,
1877
- createCommand,
1878
- createArgument,
1879
- createOption,
1880
- CommanderError,
1881
- InvalidArgumentError,
1882
- InvalidOptionArgumentError,
1883
- Command,
1884
- Argument,
1885
- Option,
1886
- Help
1887
- } = import__.default);
2075
+ // ../../node_modules/.bun/commander@15.0.0/node_modules/commander/index.js
2076
+ var program;
2077
+ var init_commander = __esm(() => {
2078
+ init_argument();
2079
+ init_command();
2080
+ init_error();
2081
+ init_help();
2082
+ init_option();
2083
+ program = new Command;
1888
2084
  });
1889
2085
 
1890
2086
  // ../core/src/types.ts
@@ -1974,16 +2170,16 @@ var exports_bundle = {};
1974
2170
  __export(exports_bundle, {
1975
2171
  bundleCommand: () => bundleCommand
1976
2172
  });
1977
- import fs from "node:fs";
1978
- import path from "node:path";
2173
+ import fs2 from "node:fs";
2174
+ import path2 from "node:path";
1979
2175
  import { execSync } from "node:child_process";
1980
2176
  function collectFiles(dir, prefix = "") {
1981
- const entries = fs.readdirSync(dir, { withFileTypes: true });
2177
+ const entries = fs2.readdirSync(dir, { withFileTypes: true });
1982
2178
  const files = [];
1983
2179
  for (const entry of entries) {
1984
2180
  const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
1985
2181
  if (entry.isDirectory()) {
1986
- files.push(...collectFiles(path.join(dir, entry.name), relativePath));
2182
+ files.push(...collectFiles(path2.join(dir, entry.name), relativePath));
1987
2183
  } else {
1988
2184
  files.push(relativePath);
1989
2185
  }
@@ -1991,32 +2187,32 @@ function collectFiles(dir, prefix = "") {
1991
2187
  return files;
1992
2188
  }
1993
2189
  function detectPackageManager(dir) {
1994
- for (let current = dir, parent = "";parent !== current; current = path.dirname(current)) {
2190
+ for (let current = dir, parent = "";parent !== current; current = path2.dirname(current)) {
1995
2191
  parent = current;
1996
- if (fs.existsSync(path.join(current, "bun.lockb")) || fs.existsSync(path.join(current, "bun.lock")))
2192
+ if (fs2.existsSync(path2.join(current, "bun.lockb")) || fs2.existsSync(path2.join(current, "bun.lock")))
1997
2193
  return "bun";
1998
- if (fs.existsSync(path.join(current, "pnpm-lock.yaml")))
2194
+ if (fs2.existsSync(path2.join(current, "pnpm-lock.yaml")))
1999
2195
  return "pnpm";
2000
- if (fs.existsSync(path.join(current, "yarn.lock")))
2196
+ if (fs2.existsSync(path2.join(current, "yarn.lock")))
2001
2197
  return "yarn";
2002
- if (fs.existsSync(path.join(current, "package-lock.json")))
2198
+ if (fs2.existsSync(path2.join(current, "package-lock.json")))
2003
2199
  return "npm";
2004
2200
  }
2005
2201
  return "npm";
2006
2202
  }
2007
2203
  var bundleCommand;
2008
2204
  var init_bundle = __esm(() => {
2009
- init_esm();
2205
+ init_commander();
2010
2206
  init_src();
2011
2207
  bundleCommand = new Command("bundle").description("Bundles the web controller into the Android assets directory").option("-s, --source <path>", "Source directory of web controller", "./web-controller").option("-o, --output <path>", "Android assets directory", "./android/app/src/main/assets/www").option("--no-build", "Skip build step (just copy)").option("-m, --manifest <path>", "Also write manifest to this path for import in app source").action(async (options) => {
2012
2208
  console.log("Bundling controller...");
2013
2209
  try {
2014
- const sourceDir = path.resolve(process.cwd(), options.source);
2015
- const distDir = path.join(sourceDir, "dist");
2016
- const targetDir = path.resolve(process.cwd(), options.output);
2210
+ const sourceDir = path2.resolve(process.cwd(), options.source);
2211
+ const distDir = path2.join(sourceDir, "dist");
2212
+ const targetDir = path2.resolve(process.cwd(), options.output);
2017
2213
  if (options.build) {
2018
2214
  console.log(" Running build command...");
2019
- if (fs.existsSync(path.join(sourceDir, "package.json"))) {
2215
+ if (fs2.existsSync(path2.join(sourceDir, "package.json"))) {
2020
2216
  const pm = detectPackageManager(sourceDir);
2021
2217
  console.log(` Using ${pm} to build...`);
2022
2218
  execSync(`${pm} run build`, { cwd: sourceDir, stdio: "inherit" });
@@ -2024,24 +2220,24 @@ var init_bundle = __esm(() => {
2024
2220
  console.warn(" No package.json found, skipping build");
2025
2221
  }
2026
2222
  }
2027
- if (!fs.existsSync(distDir)) {
2223
+ if (!fs2.existsSync(distDir)) {
2028
2224
  throw new Error(`Build output not found at ${distDir}`);
2029
2225
  }
2030
2226
  console.log(" Cleaning target directory...");
2031
- fs.rmSync(targetDir, { recursive: true, force: true });
2032
- fs.mkdirSync(targetDir, { recursive: true });
2227
+ fs2.rmSync(targetDir, { recursive: true, force: true });
2228
+ fs2.mkdirSync(targetDir, { recursive: true });
2033
2229
  console.log(" Copying assets...");
2034
- fs.cpSync(distDir, targetDir, { recursive: true });
2230
+ fs2.cpSync(distDir, targetDir, { recursive: true });
2035
2231
  const files = collectFiles(targetDir).sort();
2036
2232
  const manifest = JSON.stringify({ files }, null, 2);
2037
- const manifestPath = path.join(targetDir, "www-manifest.json");
2038
- fs.writeFileSync(manifestPath, manifest + `
2233
+ const manifestPath = path2.join(targetDir, "www-manifest.json");
2234
+ fs2.writeFileSync(manifestPath, manifest + `
2039
2235
  `);
2040
2236
  console.log(` Generated manifest with ${files.length} files`);
2041
2237
  if (options.manifest) {
2042
- const secondaryPath = path.resolve(process.cwd(), options.manifest);
2043
- fs.mkdirSync(path.dirname(secondaryPath), { recursive: true });
2044
- fs.writeFileSync(secondaryPath, manifest + `
2238
+ const secondaryPath = path2.resolve(process.cwd(), options.manifest);
2239
+ fs2.mkdirSync(path2.dirname(secondaryPath), { recursive: true });
2240
+ fs2.writeFileSync(secondaryPath, manifest + `
2045
2241
  `);
2046
2242
  console.log(` Manifest also written to ${options.manifest}`);
2047
2243
  }
@@ -2060,7 +2256,7 @@ __export(exports_simulate, {
2060
2256
  });
2061
2257
  var simulateCommand;
2062
2258
  var init_simulate = __esm(() => {
2063
- init_esm();
2259
+ init_commander();
2064
2260
  init_src();
2065
2261
  simulateCommand = new Command("simulate").description("Spawns headless bots to simulate players").option("-n, --count <number>", "Number of bots", "4").option("-u, --url <url>", "WebSocket URL of host", `ws://localhost:${DEFAULT_HTTP_PORT + DEFAULT_WS_PORT_OFFSET}${DEFAULT_WS_PATH}`).option("-i, --interval <ms>", "Action interval in ms", "1000").action(async (options) => {
2066
2262
  const count = parseInt(options.count);
@@ -2123,8 +2319,8 @@ var exports_init = {};
2123
2319
  __export(exports_init, {
2124
2320
  initCommand: () => initCommand
2125
2321
  });
2126
- import fs2 from "node:fs";
2127
- import path2 from "node:path";
2322
+ import fs3 from "node:fs";
2323
+ import path3 from "node:path";
2128
2324
  function detectPackageManager2() {
2129
2325
  if (typeof Bun !== "undefined")
2130
2326
  return "bun";
@@ -2139,16 +2335,16 @@ function detectPackageManager2() {
2139
2335
  }
2140
2336
  var initCommand;
2141
2337
  var init_init = __esm(() => {
2142
- init_esm();
2338
+ init_commander();
2143
2339
  init_src();
2144
2340
  initCommand = new Command("init").description("Scaffolds a new web controller project").argument("[name]", "Project name", "web-controller").action(async (name) => {
2145
2341
  console.log(`Creating ${name}...`);
2146
2342
  try {
2147
- const targetDir = path2.resolve(process.cwd(), name);
2148
- if (fs2.existsSync(targetDir)) {
2343
+ const targetDir = path3.resolve(process.cwd(), name);
2344
+ if (fs3.existsSync(targetDir)) {
2149
2345
  throw new Error(`Directory ${name} already exists`);
2150
2346
  }
2151
- fs2.mkdirSync(targetDir, { recursive: true });
2347
+ fs3.mkdirSync(targetDir, { recursive: true });
2152
2348
  const packageJson = {
2153
2349
  name,
2154
2350
  private: true,
@@ -2172,9 +2368,9 @@ var init_init = __esm(() => {
2172
2368
  vite: "^6.0.0"
2173
2369
  }
2174
2370
  };
2175
- fs2.writeFileSync(path2.join(targetDir, "package.json"), JSON.stringify(packageJson, null, 2) + `
2371
+ fs3.writeFileSync(path3.join(targetDir, "package.json"), JSON.stringify(packageJson, null, 2) + `
2176
2372
  `);
2177
- fs2.writeFileSync(path2.join(targetDir, "tsconfig.json"), JSON.stringify({
2373
+ fs3.writeFileSync(path3.join(targetDir, "tsconfig.json"), JSON.stringify({
2178
2374
  compilerOptions: {
2179
2375
  target: "ES2020",
2180
2376
  useDefineForClassFields: true,
@@ -2198,7 +2394,7 @@ var init_init = __esm(() => {
2198
2394
  references: [{ path: "./tsconfig.node.json" }]
2199
2395
  }, null, 2) + `
2200
2396
  `);
2201
- fs2.writeFileSync(path2.join(targetDir, "tsconfig.node.json"), JSON.stringify({
2397
+ fs3.writeFileSync(path3.join(targetDir, "tsconfig.node.json"), JSON.stringify({
2202
2398
  compilerOptions: {
2203
2399
  composite: true,
2204
2400
  skipLibCheck: true,
@@ -2209,7 +2405,7 @@ var init_init = __esm(() => {
2209
2405
  include: ["vite.config.ts"]
2210
2406
  }, null, 2) + `
2211
2407
  `);
2212
- fs2.writeFileSync(path2.join(targetDir, "vite.config.ts"), `
2408
+ fs3.writeFileSync(path3.join(targetDir, "vite.config.ts"), `
2213
2409
  import { defineConfig } from 'vite'
2214
2410
  import react from '@vitejs/plugin-react'
2215
2411
 
@@ -2219,8 +2415,8 @@ export default defineConfig({
2219
2415
  base: './', // Important for relative paths in Android WebView
2220
2416
  })
2221
2417
  `);
2222
- fs2.mkdirSync(path2.join(targetDir, "src"), { recursive: true });
2223
- fs2.writeFileSync(path2.join(targetDir, "index.html"), `
2418
+ fs3.mkdirSync(path3.join(targetDir, "src"), { recursive: true });
2419
+ fs3.writeFileSync(path3.join(targetDir, "index.html"), `
2224
2420
  <!doctype html>
2225
2421
  <html lang="en">
2226
2422
  <head>
@@ -2234,7 +2430,7 @@ export default defineConfig({
2234
2430
  </body>
2235
2431
  </html>
2236
2432
  `);
2237
- fs2.writeFileSync(path2.join(targetDir, "src/main.tsx"), `
2433
+ fs3.writeFileSync(path3.join(targetDir, "src/main.tsx"), `
2238
2434
  import React from 'react'
2239
2435
  import ReactDOM from 'react-dom/client'
2240
2436
  import App from './App'
@@ -2246,7 +2442,7 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
2246
2442
  </React.StrictMode>,
2247
2443
  )
2248
2444
  `);
2249
- fs2.writeFileSync(path2.join(targetDir, "src/App.tsx"), `
2445
+ fs3.writeFileSync(path3.join(targetDir, "src/App.tsx"), `
2250
2446
  import { useGameClient } from '@couch-kit/client';
2251
2447
  import { gameReducer, initialState } from './reducer';
2252
2448
 
@@ -2271,7 +2467,7 @@ function App() {
2271
2467
 
2272
2468
  export default App
2273
2469
  `);
2274
- fs2.writeFileSync(path2.join(targetDir, "src/index.css"), `
2470
+ fs3.writeFileSync(path3.join(targetDir, "src/index.css"), `
2275
2471
  body { margin: 0; background: #111; color: #fff; }
2276
2472
  `);
2277
2473
  const reducerContent = `import type { IAction, IGameState, GameReducer } from "@couch-kit/core";
@@ -2306,14 +2502,14 @@ export const initialState: GameState = {
2306
2502
  round: 1,
2307
2503
  };
2308
2504
  `;
2309
- fs2.writeFileSync(path2.join(targetDir, "src/reducer.ts"), reducerContent);
2505
+ fs3.writeFileSync(path3.join(targetDir, "src/reducer.ts"), reducerContent);
2310
2506
  const gitignoreContent = `node_modules/
2311
2507
  dist/
2312
2508
  lib/
2313
2509
  .DS_Store
2314
2510
  *.local
2315
2511
  `;
2316
- fs2.writeFileSync(path2.join(targetDir, ".gitignore"), gitignoreContent);
2512
+ fs3.writeFileSync(path3.join(targetDir, ".gitignore"), gitignoreContent);
2317
2513
  const pm = detectPackageManager2();
2318
2514
  console.log(`Done! Created new project in ${name}`);
2319
2515
  console.log(`
@@ -2337,7 +2533,7 @@ __export(exports_replay, {
2337
2533
  import { resolve } from "node:path";
2338
2534
  var replay2;
2339
2535
  var init_replay = __esm(() => {
2340
- init_esm();
2536
+ init_commander();
2341
2537
  init_src();
2342
2538
  replay2 = new Command("replay").description("Replay a recorded game session against a reducer").argument("<recording>", "Path to recording JSON file").argument("<reducer>", "Path to reducer module (must export default or named 'reducer')").option("--snapshots", "Output intermediate state snapshots", false).option("--json", "Output as formatted JSON", false).action(async (recordingPath, reducerPath, options) => {
2343
2539
  try {
@@ -2413,7 +2609,7 @@ function getLanIp() {
2413
2609
  }
2414
2610
  var dev;
2415
2611
  var init_dev = __esm(() => {
2416
- init_esm();
2612
+ init_commander();
2417
2613
  init_src();
2418
2614
  dev = new Command("dev").description("Start development server with LAN access for mobile testing").option("-p, --port <port>", "Port number", "5173").option("--host", "Expose to LAN", true).option("--open", "Open browser automatically", false).action(async (options) => {
2419
2615
  try {
@@ -2457,9 +2653,9 @@ var init_dev = __esm(() => {
2457
2653
  });
2458
2654
 
2459
2655
  // src/index.ts
2460
- init_esm();
2461
- import { createRequire as createRequire2 } from "node:module";
2462
- var require2 = createRequire2(import.meta.url);
2656
+ init_commander();
2657
+ import { createRequire } from "node:module";
2658
+ var require2 = createRequire(import.meta.url);
2463
2659
  var { version } = require2("../package.json");
2464
2660
  var program2 = new Command;
2465
2661
  program2.name("couch-kit").description("CLI for Couch Kit").version(version);