@kjanat/dreamcli 3.0.0-rc.7 → 3.0.0-rc.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 (47) hide show
  1. package/CHANGELOG.md +71 -1
  2. package/dist/core/cli/dispatch.d.mts +6 -4
  3. package/dist/core/cli/dispatch.mjs +6 -4
  4. package/dist/core/cli/index.d.mts +27 -1
  5. package/dist/core/cli/index.mjs +32 -15
  6. package/dist/core/cli/planner.d.mts +3 -0
  7. package/dist/core/cli/planner.mjs +9 -9
  8. package/dist/core/cli/propagate.d.mts +1 -1
  9. package/dist/core/cli/root-help.mjs +32 -20
  10. package/dist/core/cli/runtime-preflight.d.mts +7 -1
  11. package/dist/core/cli/runtime-preflight.mjs +3 -3
  12. package/dist/core/completion/shells/bash.mjs +5 -2
  13. package/dist/core/completion/shells/fish.mjs +3 -1
  14. package/dist/core/completion/shells/powershell.mjs +8 -4
  15. package/dist/core/completion/shells/shared.d.mts +13 -2
  16. package/dist/core/completion/shells/shared.mjs +19 -2
  17. package/dist/core/completion/shells/zsh.mjs +8 -2
  18. package/dist/core/config/index.d.mts +2 -2
  19. package/dist/core/config/package-json.d.mts +27 -3
  20. package/dist/core/config/package-json.mjs +20 -19
  21. package/dist/core/errors/index.d.mts +1 -1
  22. package/dist/core/execution/index.mjs +13 -2
  23. package/dist/core/help/index.d.mts +22 -3
  24. package/dist/core/help/index.mjs +55 -49
  25. package/dist/core/help/theme.d.mts +68 -0
  26. package/dist/core/help/theme.mjs +46 -0
  27. package/dist/core/json-schema/index.d.mts +15 -2
  28. package/dist/core/json-schema/index.mjs +32 -4
  29. package/dist/core/json-schema/meta-descriptions.generated.d.mts +22 -5
  30. package/dist/core/json-schema/meta-descriptions.generated.mjs +14 -5
  31. package/dist/core/parse/index.d.mts +40 -7
  32. package/dist/core/parse/index.mjs +137 -34
  33. package/dist/core/resolve/args.d.mts +1 -1
  34. package/dist/core/resolve/coerce.d.mts +1 -1
  35. package/dist/core/resolve/contracts.d.mts +2 -2
  36. package/dist/core/resolve/index.d.mts +2 -2
  37. package/dist/core/schema/command.d.mts +2 -2
  38. package/dist/core/schema/command.mjs +23 -11
  39. package/dist/core/schema/flag.d.mts +148 -9
  40. package/dist/core/schema/flag.mjs +71 -1
  41. package/dist/core/schema/index.d.mts +2 -2
  42. package/dist/core/schema/run.d.mts +11 -0
  43. package/dist/index.d.mts +7 -6
  44. package/dist/index.mjs +3 -3
  45. package/dist/version.mjs +2 -2
  46. package/dreamcli.schema.json +33 -6
  47. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { ParseError } from "../errors/index.mjs";
2
2
  import { describeNumberConstraintViolation, validateNumberConstraints } from "../schema/number-constraints.mjs";
3
3
  import { describeStringConstraintViolation, validateStringConstraints } from "../schema/string-constraints.mjs";
4
- import { getFlagAliasNames } from "../schema/flag.mjs";
4
+ import { getFlagAliasNames, getFlagNegatedName } from "../schema/flag.mjs";
5
5
  //#region src/core/parse/index.ts
6
6
  /**
7
7
  * Argv tokenization and parsing against command schemas.
@@ -123,23 +123,107 @@ function stripBeforeSeparator(argv, token) {
123
123
  const filteredHead = head.filter((arg) => arg !== token);
124
124
  return separatorIndex === -1 ? filteredHead : [...filteredHead, ...argv.slice(separatorIndex)];
125
125
  }
126
+ /** `do-this` → `doThis`. Returns the input unchanged when nothing converts. */
127
+ function kebabToCamel(name) {
128
+ return name.replace(/-+([a-z0-9])/g, (_match, char) => char.toUpperCase());
129
+ }
130
+ /** `doThis` → `do-this`. Returns the input unchanged when nothing converts. */
131
+ function camelToKebab(name) {
132
+ return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
133
+ }
126
134
  /**
127
- * Build a map from flag name/alias → [canonicalName, {@link FlagSchema}].
135
+ * The kebab↔camel counterpart spelling of a flag name, or `undefined` when
136
+ * the name has none (single-char aliases, single lowercase words).
137
+ */
138
+ function counterpartSpelling(name) {
139
+ if (name.length < 2) return void 0;
140
+ if (name.includes("-")) {
141
+ const camel = kebabToCamel(name);
142
+ return camel !== name ? camel : void 0;
143
+ }
144
+ const kebab = camelToKebab(name);
145
+ return kebab !== name ? kebab : void 0;
146
+ }
147
+ /**
148
+ * Build a map from flag spelling → {@link FlagLookupEntry}.
128
149
  *
129
- * Supports both long names and single-char aliases for short flag expansion.
150
+ * Covers canonical names, aliases (long + single-char), negated spellings of
151
+ * `.negatable()` booleans, and — unless `caseParity` is `false` — the
152
+ * kebab↔camel counterpart of every declared spelling. Counterparts never
153
+ * override declared spellings: when a command defines both `do-this` and
154
+ * `doThis` explicitly, each spelling exact-matches its own flag and no
155
+ * parity entries are added for the pair.
130
156
  *
131
157
  * @param flags - Flag schemas keyed by canonical name
132
- * @returns Lookup map covering all names and aliases
158
+ * @param options - Parity toggle (see {@link ParseOptions})
159
+ * @returns Lookup map covering all resolvable spellings
133
160
  */
134
- function buildFlagLookup(flags) {
161
+ function buildFlagLookup(flags, options) {
135
162
  const lookup = /* @__PURE__ */ new Map();
136
163
  for (const [name, schema] of Object.entries(flags)) {
137
- lookup.set(name, [name, schema]);
138
- for (const alias of getFlagAliasNames(schema, { includeHidden: true })) lookup.set(alias, [name, schema]);
164
+ lookup.set(name, {
165
+ name,
166
+ schema,
167
+ negated: false,
168
+ parity: false
169
+ });
170
+ for (const alias of getFlagAliasNames(schema, { includeHidden: true })) lookup.set(alias, {
171
+ name,
172
+ schema,
173
+ negated: false,
174
+ parity: false
175
+ });
176
+ const negatedName = getFlagNegatedName(name, schema);
177
+ if (negatedName !== void 0) lookup.set(negatedName, {
178
+ name,
179
+ schema,
180
+ negated: true,
181
+ parity: false
182
+ });
183
+ }
184
+ if (options?.caseParity !== false) for (const [spelling, entry] of [...lookup]) {
185
+ const counterpart = counterpartSpelling(spelling);
186
+ if (counterpart !== void 0 && !lookup.has(counterpart)) lookup.set(counterpart, {
187
+ ...entry,
188
+ parity: true
189
+ });
139
190
  }
140
191
  return lookup;
141
192
  }
142
193
  /**
194
+ * Record one CLI occurrence of a logical flag and enforce its duplicate
195
+ * policy.
196
+ *
197
+ * @param occurrences - Per-parse accumulator keyed by canonical name
198
+ * @param name - Canonical flag name
199
+ * @param schema - Flag schema (read for {@link FlagSchema.duplicates})
200
+ * @param value - The occurrence's raw value (or the boolean it implies)
201
+ * @param displayName - User-facing spelling for error messages
202
+ * @returns `true` when the occurrence should be applied; `false` when the
203
+ * `'first'` policy suppresses it (the token is still consumed)
204
+ * @throws ParseError `DUPLICATE_FLAG` on a repeat under the `'error'` policy
205
+ */
206
+ function recordFlagOccurrence(occurrences, name, schema, value, displayName) {
207
+ const record = occurrences.get(name) ?? {
208
+ count: 0,
209
+ values: []
210
+ };
211
+ record.count += 1;
212
+ record.values.push(value);
213
+ occurrences.set(name, record);
214
+ if (record.count === 1) return true;
215
+ if (schema.duplicates === "error") throw new ParseError(`Flag --${name} may only be specified once`, {
216
+ code: "DUPLICATE_FLAG",
217
+ details: {
218
+ flag: name,
219
+ input: displayName,
220
+ count: record.count,
221
+ values: [...record.values]
222
+ }
223
+ });
224
+ return schema.duplicates !== "first";
225
+ }
226
+ /**
143
227
  * Whether a flag kind expects a value argument (vs. being a bare boolean).
144
228
  *
145
229
  * @param schema - Flag schema to check
@@ -349,6 +433,7 @@ function coerceArgValue(argName, raw, schema) {
349
433
  *
350
434
  * @param schema - The command schema to parse against
351
435
  * @param argv - Raw argv strings (NOT including the command name itself)
436
+ * @param options - Parser behavior toggles (see {@link ParseOptions})
352
437
  * @returns Parsed flag and arg values
353
438
  * @throws ParseError for unknown flags, missing values, type mismatches
354
439
  *
@@ -358,11 +443,12 @@ function coerceArgValue(argName, raw, schema) {
358
443
  * // => { args: { target: 'production' }, flags: { force: true } }
359
444
  * ```
360
445
  */
361
- function parse(schema, argv) {
446
+ function parse(schema, argv, options) {
362
447
  const tokens = tokenize(argv);
363
- const flagLookup = buildFlagLookup(schema.flags);
448
+ const flagLookup = buildFlagLookup(schema.flags, options);
364
449
  const flags = {};
365
450
  const positionals = [];
451
+ const occurrences = /* @__PURE__ */ new Map();
366
452
  let i = 0;
367
453
  while (i < tokens.length) {
368
454
  const token = tokens[i];
@@ -377,10 +463,10 @@ function parse(schema, argv) {
377
463
  continue;
378
464
  }
379
465
  if (token.kind === "long-flag") {
380
- i = parseLongFlag(token, tokens, i, flagLookup, flags);
466
+ i = parseLongFlag(token, tokens, i, flagLookup, flags, occurrences);
381
467
  continue;
382
468
  }
383
- i = parseShortFlags(token, tokens, i, flagLookup, flags);
469
+ i = parseShortFlags(token, tokens, i, flagLookup, flags, occurrences);
384
470
  }
385
471
  return {
386
472
  flags,
@@ -393,11 +479,12 @@ function parse(schema, argv) {
393
479
  * @param token - Long-flag token to process
394
480
  * @param tokens - Full token array (for lookahead)
395
481
  * @param startIdx - Current index of `token` in the array
396
- * @param flagLookup - Name/alias → [canonical, schema] map from {@link buildFlagLookup}
482
+ * @param flagLookup - Spelling → {@link FlagLookupEntry} map from {@link buildFlagLookup}
397
483
  * @param flags - Mutable accumulator for resolved flag values
484
+ * @param occurrences - Per-parse duplicate-occurrence accumulator
398
485
  * @returns Next index to continue parsing from
399
486
  */
400
- function parseLongFlag(token, tokens, startIdx, flagLookup, flags) {
487
+ function parseLongFlag(token, tokens, startIdx, flagLookup, flags, occurrences) {
401
488
  const entry = flagLookup.get(token.name);
402
489
  if (!entry) {
403
490
  const suggestion = suggestFlag(token.name, flagLookup);
@@ -410,21 +497,36 @@ function parseLongFlag(token, tokens, startIdx, flagLookup, flags) {
410
497
  ...suggestion ? { suggest: `--${suggestion}` } : {}
411
498
  });
412
499
  }
413
- const [canonicalName, flagSchema] = entry;
500
+ const { name: canonicalName, schema: flagSchema, negated } = entry;
501
+ const displayName = `--${token.name}`;
502
+ if (negated) {
503
+ if (token.value !== void 0) throw new ParseError(`Flag ${displayName} does not take a value`, {
504
+ code: "INVALID_VALUE",
505
+ details: {
506
+ flag: canonicalName,
507
+ input: token.name,
508
+ value: token.value
509
+ }
510
+ });
511
+ if (recordFlagOccurrence(occurrences, canonicalName, flagSchema, false, displayName)) flags[canonicalName] = false;
512
+ return startIdx + 1;
513
+ }
414
514
  if (!flagExpectsValue(flagSchema)) {
415
- if (token.value !== void 0) flags[canonicalName] = coerceFlagValue(canonicalName, token.value, flagSchema, `--${token.name}`);
416
- else if (flagSchema.kind === "count") {
515
+ if (token.value !== void 0) {
516
+ const coerced = coerceFlagValue(canonicalName, token.value, flagSchema, displayName);
517
+ if (recordFlagOccurrence(occurrences, canonicalName, flagSchema, coerced, displayName)) flags[canonicalName] = coerced;
518
+ } else if (flagSchema.kind === "count") {
417
519
  const existing = flags[canonicalName];
418
520
  flags[canonicalName] = (typeof existing === "number" ? existing : 0) + 1;
419
- } else flags[canonicalName] = true;
521
+ } else if (recordFlagOccurrence(occurrences, canonicalName, flagSchema, true, displayName)) flags[canonicalName] = true;
420
522
  return startIdx + 1;
421
523
  }
422
524
  if (token.value !== void 0) {
423
- setFlagValue(flags, canonicalName, flagSchema, token.value);
525
+ if (recordFlagOccurrence(occurrences, canonicalName, flagSchema, token.value, displayName)) setFlagValue(flags, canonicalName, flagSchema, token.value);
424
526
  return startIdx + 1;
425
527
  }
426
528
  const nextToken = tokens[startIdx + 1];
427
- if (nextToken?.kind !== "positional") throw new ParseError(`Flag --${token.name} requires a value`, {
529
+ if (nextToken?.kind !== "positional") throw new ParseError(`Flag ${displayName} requires a value`, {
428
530
  code: "MISSING_VALUE",
429
531
  details: {
430
532
  flag: canonicalName,
@@ -432,7 +534,7 @@ function parseLongFlag(token, tokens, startIdx, flagLookup, flags) {
432
534
  kind: flagSchema.kind
433
535
  }
434
536
  });
435
- setFlagValue(flags, canonicalName, flagSchema, nextToken.value, `--${token.name}`);
537
+ if (recordFlagOccurrence(occurrences, canonicalName, flagSchema, nextToken.value, displayName)) setFlagValue(flags, canonicalName, flagSchema, nextToken.value, displayName);
436
538
  return startIdx + 2;
437
539
  }
438
540
  /**
@@ -441,11 +543,12 @@ function parseLongFlag(token, tokens, startIdx, flagLookup, flags) {
441
543
  * @param token - Short-flags token to expand
442
544
  * @param tokens - Full token array (for lookahead)
443
545
  * @param startIdx - Current index of `token` in the array
444
- * @param flagLookup - Name/alias → [canonical, schema] map from {@link buildFlagLookup}
546
+ * @param flagLookup - Spelling → {@link FlagLookupEntry} map from {@link buildFlagLookup}
445
547
  * @param flags - Mutable accumulator for resolved flag values
548
+ * @param occurrences - Per-parse duplicate-occurrence accumulator
446
549
  * @returns Next index to continue parsing from
447
550
  */
448
- function parseShortFlags(token, tokens, startIdx, flagLookup, flags) {
551
+ function parseShortFlags(token, tokens, startIdx, flagLookup, flags, occurrences) {
449
552
  const { chars } = token;
450
553
  let nextIdx = startIdx + 1;
451
554
  for (let ci = 0; ci < chars.length; ci++) {
@@ -455,16 +558,18 @@ function parseShortFlags(token, tokens, startIdx, flagLookup, flags) {
455
558
  code: "UNKNOWN_FLAG",
456
559
  details: { flag: ch }
457
560
  });
458
- const [canonicalName, flagSchema] = entry;
561
+ const { name: canonicalName, schema: flagSchema } = entry;
562
+ const displayName = `-${ch}`;
459
563
  if (!flagExpectsValue(flagSchema)) {
460
564
  if (flagSchema.kind === "count") {
461
565
  const existing = flags[canonicalName];
462
566
  flags[canonicalName] = (typeof existing === "number" ? existing : 0) + 1;
463
- } else flags[canonicalName] = true;
567
+ } else if (recordFlagOccurrence(occurrences, canonicalName, flagSchema, true, displayName)) flags[canonicalName] = true;
464
568
  continue;
465
569
  }
466
570
  if (ci < chars.length - 1) {
467
- setFlagValue(flags, canonicalName, flagSchema, chars.slice(ci + 1), `-${ch}`);
571
+ const inlineValue = chars.slice(ci + 1);
572
+ if (recordFlagOccurrence(occurrences, canonicalName, flagSchema, inlineValue, displayName)) setFlagValue(flags, canonicalName, flagSchema, inlineValue, displayName);
468
573
  break;
469
574
  }
470
575
  const nextToken = tokens[nextIdx];
@@ -476,7 +581,7 @@ function parseShortFlags(token, tokens, startIdx, flagLookup, flags) {
476
581
  kind: flagSchema.kind
477
582
  }
478
583
  });
479
- setFlagValue(flags, canonicalName, flagSchema, nextToken.value, `-${ch}`);
584
+ if (recordFlagOccurrence(occurrences, canonicalName, flagSchema, nextToken.value, displayName)) setFlagValue(flags, canonicalName, flagSchema, nextToken.value, displayName);
480
585
  nextIdx++;
481
586
  }
482
587
  return nextIdx;
@@ -574,13 +679,11 @@ function suggestFlag(input, lookup) {
574
679
  let bestName;
575
680
  let bestDist = Number.POSITIVE_INFINITY;
576
681
  const threshold = Math.max(2, Math.floor(input.length / 2));
577
- for (const key of lookup.keys()) {
578
- const entry = lookup.get(key);
579
- if (entry === void 0) continue;
580
- const [canonicalName, schema] = entry;
581
- const alias = schema.aliases.find((candidate) => candidate.name === key);
582
- if (key.length < 2) continue;
583
- if (key !== canonicalName && alias?.hidden) continue;
682
+ for (const [key, entry] of lookup) {
683
+ if (key.length < 2 || entry.parity) continue;
684
+ if (entry.negated && entry.schema.negation?.hidden === true) continue;
685
+ const alias = entry.schema.aliases.find((candidate) => candidate.name === key);
686
+ if (key !== entry.name && !entry.negated && alias?.hidden) continue;
584
687
  const dist = levenshtein(input, key);
585
688
  if (dist < bestDist && dist <= threshold) {
586
689
  bestDist = dist;
@@ -618,4 +721,4 @@ function levenshtein(a, b) {
618
721
  return row[aLen] ?? 0;
619
722
  }
620
723
  //#endregion
621
- export { buildFlagLookup, flagExpectsValue, includesBeforeSeparator, parse, stripBeforeSeparator, tokenize };
724
+ export { buildFlagLookup, camelToKebab, flagExpectsValue, includesBeforeSeparator, kebabToCamel, parse, stripBeforeSeparator, tokenize };
@@ -1,6 +1,6 @@
1
- import "../schema/index.mjs";
2
1
  import { DeprecationWarning } from "./contracts.mjs";
3
2
  import { CommandArgEntry } from "../schema/command.mjs";
3
+ import "../schema/index.mjs";
4
4
  //#region src/core/resolve/args.d.ts
5
5
  /** Walk every declared arg through the resolution chain (cli -> stdin -> env -> default), collecting deprecations and throwing aggregated errors. */
6
6
  declare function resolveArgs(argEntries: readonly CommandArgEntry[], parsedArgs: Readonly<Record<string, unknown>>, stdinData: string | null | undefined, env: Readonly<Record<string, string | undefined>>, deprecations: DeprecationWarning[]): Readonly<Record<string, unknown>>;
@@ -1,8 +1,8 @@
1
1
  import { ArgSchema } from "../schema/arg.mjs";
2
2
  import { FlagSchema } from "../schema/flag.mjs";
3
- import "../schema/index.mjs";
4
3
  import { ArgDiagnosticSource, FlagDiagnosticSource } from "./contracts.mjs";
5
4
  import { ValidationError } from "../errors/index.mjs";
5
+ import "../schema/index.mjs";
6
6
  //#region src/core/resolve/coerce.d.ts
7
7
  type CoerceSource = FlagDiagnosticSource;
8
8
  /** Discriminated result of a value coercion attempt — success with the coerced value, or failure with a structured validation error. */
@@ -1,7 +1,7 @@
1
- import "../schema/index.mjs";
2
- import { ParseResult } from "../parse/index.mjs";
3
1
  import { PromptEngine } from "../prompt/index.mjs";
4
2
  import { CommandSchema } from "../schema/command.mjs";
3
+ import "../schema/index.mjs";
4
+ import { ParseResult } from "../parse/index.mjs";
5
5
  //#region src/core/resolve/contracts.d.ts
6
6
  /** Ordered flag resolution stages owned by the resolver. */
7
7
  declare const FLAG_RESOLUTION_ORDER: readonly ['cli', 'env', 'config', 'prompt', 'default'];
@@ -1,7 +1,7 @@
1
- import "../schema/index.mjs";
2
- import { ParseResult } from "../parse/index.mjs";
3
1
  import { DeprecationWarning, ResolveOptions, ResolveResult } from "./contracts.mjs";
4
2
  import { CommandSchema } from "../schema/command.mjs";
3
+ import "../schema/index.mjs";
4
+ import { ParseResult } from "../parse/index.mjs";
5
5
  //#region src/core/resolve/index.d.ts
6
6
  /**
7
7
  * Resolve parsed values against a command schema.
@@ -336,7 +336,7 @@ type DeriveParams<F extends Record<string, FlagBuilder<FlagConfig>>, A extends R
336
336
  * Handlers may be async; the resolved value follows the same rules.
337
337
  * They cannot wrap downstream execution; use {@linkcode middleware} for that.
338
338
  */
339
- type DeriveHandler<F extends Record<string, FlagBuilder<FlagConfig>>, A extends Record<string, ArgBuilder<ArgConfig>>, C extends Record<string, unknown> = Record<string, never>, Output extends Record<string, unknown> | undefined | void = undefined> = (params: DeriveParams<F, A, C>) => Output | Promise<Output>;
339
+ type DeriveHandler<F extends Record<string, FlagBuilder<FlagConfig>>, A extends Record<string, ArgBuilder<ArgConfig>>, C extends Record<string, unknown> = Record<string, never>, Output extends Record<string, unknown> | undefined = undefined> = (params: DeriveParams<F, A, C>) => Output | Promise<Output> | void | Promise<void>;
340
340
  /**
341
341
  * Type-erased derive handler stored on the command builder.
342
342
  *
@@ -631,7 +631,7 @@ declare class CommandBuilder<F extends Record<string, FlagBuilder<FlagConfig>> =
631
631
  * @param handler - Derive function receiving typed args/flags/ctx.
632
632
  * @returns The builder (for chaining).
633
633
  */
634
- derive<Output extends Record<string, unknown> | undefined | void>(handler: DeriveHandler<F, A, C, Output>): CommandBuilder<F, A, WidenDerivedContext<C, Output>>;
634
+ derive<Output extends Record<string, unknown> | undefined = undefined>(handler: DeriveHandler<F, A, C, Output>): CommandBuilder<F, A, WidenDerivedContext<C, Output>>;
635
635
  /**
636
636
  * Register middleware to run before the action handler.
637
637
  *
@@ -1,4 +1,5 @@
1
1
  import { CLIError } from "../errors/index.mjs";
2
+ import { getFlagNegatedName } from "./flag.mjs";
2
3
  //#region src/core/schema/command.ts
3
4
  /**
4
5
  * Validate a new arg entry against invariants before adding it to the command.
@@ -39,21 +40,32 @@ function formatFlagToken(name, kind) {
39
40
  }
40
41
  function describeFlagForm(form) {
41
42
  if (form.kind === "canonical") return `canonical flag ${formatFlagToken(form.name, form.kind)}`;
43
+ if (form.kind === "negation") return `${form.hidden ? "hidden " : ""}negated spelling ${formatFlagToken(form.name, form.kind)}`;
42
44
  const aliasType = form.name.length === 1 ? "short alias" : "long alias";
43
45
  return `${form.hidden ? "hidden " : ""}${aliasType} ${formatFlagToken(form.name, form.kind)}`;
44
46
  }
45
47
  function listFlagForms(name, schema) {
46
- return [{
47
- owner: name,
48
- name,
49
- kind: "canonical",
50
- hidden: false
51
- }, ...schema.aliases.map((alias) => ({
52
- owner: name,
53
- name: alias.name,
54
- kind: "alias",
55
- hidden: alias.hidden
56
- }))];
48
+ const negatedName = getFlagNegatedName(name, schema);
49
+ return [
50
+ {
51
+ owner: name,
52
+ name,
53
+ kind: "canonical",
54
+ hidden: false
55
+ },
56
+ ...schema.aliases.map((alias) => ({
57
+ owner: name,
58
+ name: alias.name,
59
+ kind: "alias",
60
+ hidden: alias.hidden
61
+ })),
62
+ ...negatedName !== void 0 && schema.negation !== void 0 ? [{
63
+ owner: name,
64
+ name: negatedName,
65
+ kind: "negation",
66
+ hidden: schema.negation.hidden
67
+ }] : []
68
+ ];
57
69
  }
58
70
  function throwFlagCollisionError(commandName, form, existing, options) {
59
71
  const inherited = options?.inherited ?? false;