@outfitter/cli 0.5.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README.md +105 -2
  2. package/dist/actions.d.ts +5 -2
  3. package/dist/actions.js +2 -2
  4. package/dist/cli.d.ts +1 -1
  5. package/dist/cli.js +8 -1
  6. package/dist/command.d.ts +3 -43
  7. package/dist/command.js +241 -13
  8. package/dist/envelope.d.ts +5 -0
  9. package/dist/envelope.js +160 -0
  10. package/dist/flags.d.ts +5 -189
  11. package/dist/flags.js +5 -1
  12. package/dist/hints.d.ts +34 -0
  13. package/dist/hints.js +26 -0
  14. package/dist/index.d.ts +3 -2
  15. package/dist/input.d.ts +3 -124
  16. package/dist/input.js +14 -359
  17. package/dist/internal/envelope-helpers.d.ts +4 -0
  18. package/dist/internal/envelope-helpers.js +24 -0
  19. package/dist/internal/envelope-types.d.ts +3 -0
  20. package/dist/internal/envelope-types.js +1 -0
  21. package/dist/internal/flag-builders.d.ts +3 -0
  22. package/dist/internal/flag-builders.js +155 -0
  23. package/dist/internal/flag-types.d.ts +3 -0
  24. package/dist/internal/flag-types.js +13 -0
  25. package/dist/internal/hint-action-graph.d.ts +5 -0
  26. package/dist/internal/hint-action-graph.js +11 -0
  27. package/dist/internal/hint-command-tree.d.ts +5 -0
  28. package/dist/internal/hint-command-tree.js +9 -0
  29. package/dist/internal/hint-error-recovery.d.ts +2 -0
  30. package/dist/internal/hint-error-recovery.js +7 -0
  31. package/dist/internal/hint-types.d.ts +4 -0
  32. package/dist/internal/hint-types.js +1 -0
  33. package/dist/internal/input-helpers.d.ts +18 -0
  34. package/dist/internal/input-helpers.js +11 -0
  35. package/dist/internal/input-normalization.d.ts +3 -0
  36. package/dist/internal/input-normalization.js +9 -0
  37. package/dist/internal/input-parsers.d.ts +3 -0
  38. package/dist/internal/input-parsers.js +19 -0
  39. package/dist/internal/input-security.d.ts +22 -0
  40. package/dist/internal/input-security.js +11 -0
  41. package/dist/internal/output-formatting.d.ts +3 -0
  42. package/dist/internal/output-formatting.js +21 -0
  43. package/dist/internal/presets.d.ts +3 -0
  44. package/dist/{shared/@outfitter/cli-pdb7znbq.js → internal/presets.js} +49 -223
  45. package/dist/internal/schema-commands.d.ts +3 -0
  46. package/dist/{shared/@outfitter/cli-5vtr4bdt.js → internal/schema-commands.js} +8 -99
  47. package/dist/internal/schema-formatting.d.ts +2 -0
  48. package/dist/internal/schema-formatting.js +7 -0
  49. package/dist/internal/schema-types.d.ts +2 -0
  50. package/dist/internal/schema-types.js +1 -0
  51. package/dist/output.d.ts +4 -3
  52. package/dist/output.js +13 -166
  53. package/dist/pagination.d.ts +1 -1
  54. package/dist/query.d.ts +84 -2
  55. package/dist/query.js +8 -45
  56. package/dist/schema-input.d.ts +80 -0
  57. package/dist/schema-input.js +15 -0
  58. package/dist/schema.d.ts +4 -1
  59. package/dist/schema.js +1 -1
  60. package/dist/shared/@outfitter/cli-10wxfc78.d.ts +45 -0
  61. package/dist/shared/@outfitter/cli-16wg5mka.d.ts +71 -0
  62. package/dist/shared/@outfitter/cli-1q5redaj.js +267 -0
  63. package/dist/shared/@outfitter/cli-2dfxs239.js +98 -0
  64. package/dist/shared/@outfitter/cli-30mt7c5w.d.ts +112 -0
  65. package/dist/shared/@outfitter/cli-3jta1h1h.js +134 -0
  66. package/dist/shared/@outfitter/cli-4h85mpth.js +76 -0
  67. package/dist/shared/@outfitter/cli-6shkwxdc.js +28 -0
  68. package/dist/shared/@outfitter/cli-89335n9a.js +16 -0
  69. package/dist/shared/@outfitter/cli-8999qjdd.js +3 -0
  70. package/dist/shared/@outfitter/cli-8cfxdady.js +60 -0
  71. package/dist/shared/@outfitter/cli-bcajqy33.d.ts +25 -0
  72. package/dist/shared/@outfitter/cli-c09332vm.d.ts +39 -0
  73. package/dist/shared/@outfitter/cli-cgha038c.d.ts +3 -0
  74. package/dist/shared/@outfitter/{cli-zahqsaby.js → cli-d40m2x1d.js} +19 -3
  75. package/dist/shared/@outfitter/cli-dg0cz7rw.js +127 -0
  76. package/dist/shared/@outfitter/cli-dv8kk4jw.d.ts +24 -0
  77. package/dist/shared/@outfitter/cli-g43887b7.js +20 -0
  78. package/dist/shared/@outfitter/cli-gqtkhgw4.js +52 -0
  79. package/dist/shared/@outfitter/cli-h4ejpmjs.d.ts +104 -0
  80. package/dist/shared/@outfitter/cli-htzez8v2.js +70 -0
  81. package/dist/shared/@outfitter/cli-hvg2m5gf.js +79 -0
  82. package/dist/shared/@outfitter/cli-n54zs151.d.ts +78 -0
  83. package/dist/shared/@outfitter/cli-nbpgw7z7.d.ts +15 -0
  84. package/dist/shared/@outfitter/cli-nkt399zf.d.ts +94 -0
  85. package/dist/shared/@outfitter/cli-pmd04gtv.d.ts +60 -0
  86. package/dist/shared/@outfitter/{cli-xy3gs50c.d.ts → cli-q6csxmeh.d.ts} +19 -12
  87. package/dist/shared/@outfitter/cli-qcskd96y.d.ts +11 -0
  88. package/dist/shared/@outfitter/cli-ry7btmy4.js +118 -0
  89. package/dist/shared/@outfitter/cli-sy99pjyj.js +32 -0
  90. package/dist/shared/@outfitter/cli-tm2fzngs.d.ts +23 -0
  91. package/dist/shared/@outfitter/cli-vvvhjwks.js +106 -0
  92. package/dist/shared/@outfitter/cli-wjv7g1aq.d.ts +16 -0
  93. package/dist/shared/@outfitter/{cli-98aa9104.d.ts → cli-x6qr7bnd.d.ts} +338 -16
  94. package/dist/shared/@outfitter/cli-xde45xcc.d.ts +53 -0
  95. package/dist/shared/@outfitter/cli-xw8ys1je.d.ts +123 -0
  96. package/dist/shared/@outfitter/cli-yfewnyc2.d.ts +43 -0
  97. package/dist/shared/@outfitter/cli-zkzj0q4q.js +99 -0
  98. package/dist/shared/@outfitter/cli-zv3ah6f0.js +3 -0
  99. package/dist/streaming.d.ts +47 -0
  100. package/dist/streaming.js +13 -0
  101. package/dist/truncation.d.ts +104 -0
  102. package/dist/truncation.js +111 -0
  103. package/dist/types.d.ts +2 -2
  104. package/dist/verbs.d.ts +1 -1
  105. package/package.json +55 -25
  106. package/dist/shared/@outfitter/cli-n1k0d23k.d.ts +0 -33
package/dist/flags.d.ts CHANGED
@@ -1,189 +1,5 @@
1
- import { BooleanFlagPresetConfig, ColorFlags, ColorMode, ComposedPreset, EnumFlagPresetConfig, ExecutionFlags, ExecutionPresetConfig, FlagPreset, FlagPresetConfig, InteractionFlags, NumberFlagPresetConfig, PaginationFlags, PaginationPresetConfig, ProjectionFlags, StrictFlags, StringListFlagPresetConfig, TimeWindowFlags, TimeWindowPresetConfig } from "./shared/@outfitter/cli-98aa9104.js";
2
- /**
3
- * Create a typed flag preset.
4
- *
5
- * @param config - Preset configuration with id, options, and resolver
6
- * @returns A flag preset that can be applied to commands or composed
7
- *
8
- * @example
9
- * ```typescript
10
- * const myPreset = createPreset({
11
- * id: "output-format",
12
- * options: [{ flags: "--format <type>", description: "Output format" }],
13
- * resolve: (flags) => ({
14
- * format: String(flags["format"] ?? "text"),
15
- * }),
16
- * });
17
- * ```
18
- */
19
- declare function createPreset<TResolved extends Record<string, unknown>>(config: FlagPresetConfig<TResolved>): FlagPreset<TResolved>;
20
- type ResolvedType<T> = T extends FlagPreset<infer R> ? R : never;
21
- type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
22
- /**
23
- * Resolves the merged type from a tuple of presets.
24
- * Falls back to Record<string, unknown> when the tuple is empty
25
- * (since UnionToIntersection<never> produces unknown).
26
- */
27
- type MergedPresetResult<TPresets extends readonly FlagPreset<Record<string, unknown>>[]> = UnionToIntersection<ResolvedType<TPresets[number]>> extends Record<string, unknown> ? UnionToIntersection<ResolvedType<TPresets[number]>> : Record<string, unknown>;
28
- /**
29
- * Compose multiple presets into one, deduplicating by id (first wins).
30
- *
31
- * @param presets - Presets to compose together
32
- * @returns A single preset merging all options and resolvers
33
- *
34
- * @example
35
- * ```typescript
36
- * const composed = composePresets(
37
- * verbosePreset(),
38
- * cwdPreset(),
39
- * forcePreset(),
40
- * );
41
- * // composed.resolve({ verbose: true, cwd: "/tmp", force: false })
42
- * // => { verbose: true, cwd: "/tmp", force: false }
43
- * ```
44
- */
45
- declare function composePresets<TPresets extends readonly FlagPreset<Record<string, unknown>>[]>(...presets: TPresets): ComposedPreset<MergedPresetResult<TPresets>>;
46
- /**
47
- * Generic boolean custom-flag builder.
48
- *
49
- * Supports normal sources and negated sources so `--no-foo` patterns can
50
- * resolve consistently across Commander flag-shape differences.
51
- */
52
- declare function booleanFlagPreset<TKey extends string>(config: BooleanFlagPresetConfig<TKey>): FlagPreset<{ [K in TKey] : boolean }>;
53
- /**
54
- * Generic enum custom-flag builder.
55
- */
56
- declare function enumFlagPreset<
57
- TKey extends string,
58
- TValue extends string
59
- >(config: EnumFlagPresetConfig<TKey, TValue>): FlagPreset<{ [K in TKey] : TValue }>;
60
- /**
61
- * Generic number custom-flag builder.
62
- */
63
- declare function numberFlagPreset<TKey extends string>(config: NumberFlagPresetConfig<TKey>): FlagPreset<{ [K in TKey] : number }>;
64
- /**
65
- * Generic string-list custom-flag builder.
66
- */
67
- declare function stringListFlagPreset<TKey extends string>(config: StringListFlagPresetConfig<TKey>): FlagPreset<{ [K in TKey] : string[] | undefined }>;
68
- /**
69
- * Verbose output flag preset.
70
- *
71
- * Adds: `-v, --verbose`
72
- * Resolves: `{ verbose: boolean }`
73
- */
74
- declare function verbosePreset(): FlagPreset<{
75
- verbose: boolean;
76
- }>;
77
- /**
78
- * Working directory flag preset.
79
- *
80
- * Adds: `--cwd <path>`
81
- * Resolves: `{ cwd: string }` (defaults to `process.cwd()`)
82
- */
83
- declare function cwdPreset(): FlagPreset<{
84
- cwd: string;
85
- }>;
86
- /**
87
- * Dry-run flag preset.
88
- *
89
- * Adds: `--dry-run`
90
- * Resolves: `{ dryRun: boolean }`
91
- */
92
- declare function dryRunPreset(): FlagPreset<{
93
- dryRun: boolean;
94
- }>;
95
- /**
96
- * Force flag preset.
97
- *
98
- * Adds: `-f, --force`
99
- * Resolves: `{ force: boolean }`
100
- */
101
- declare function forcePreset(): FlagPreset<{
102
- force: boolean;
103
- }>;
104
- /**
105
- * Interaction mode flag preset.
106
- *
107
- * Adds: `--non-interactive`, `--no-input`, `-y, --yes`
108
- * Resolves: `{ interactive: boolean, yes: boolean }`
109
- *
110
- * `interactive` defaults to `true` and is set to `false` when
111
- * `--non-interactive` or `--no-input` is passed. The two flags
112
- * are synonyms for user convenience.
113
- */
114
- declare function interactionPreset(): FlagPreset<InteractionFlags>;
115
- /**
116
- * Strict mode flag preset.
117
- *
118
- * Adds: `--strict`
119
- * Resolves: `{ strict: boolean }`
120
- */
121
- declare function strictPreset(): FlagPreset<StrictFlags>;
122
- /**
123
- * Color mode flag preset.
124
- *
125
- * Adds: `--color [mode]`, `--no-color`
126
- * Resolves: `{ color: "auto" | "always" | "never" }`
127
- *
128
- * Commander's `--no-color` negation sets `flags["color"]` to `false`,
129
- * which resolves to `"never"`. Invalid values default to `"auto"`.
130
- *
131
- * This preset resolves the user's *intent*. Consumers should compose
132
- * with terminal detection (`supportsColor()`, `resolveColorEnv()`)
133
- * to determine actual color output behavior.
134
- */
135
- declare function colorPreset(): FlagPreset<ColorFlags>;
136
- /**
137
- * Projection flag preset.
138
- *
139
- * Adds: `--fields <fields>`, `--exclude-fields <fields>`, `--count`
140
- * Resolves: `{ fields: string[] | undefined, excludeFields: string[] | undefined, count: boolean }`
141
- *
142
- * Fields are parsed as comma-separated strings with whitespace trimming.
143
- * `undefined` when not provided (not empty array) to distinguish
144
- * "not specified" from "empty".
145
- *
146
- * Conflict between `--fields` and `--exclude-fields` is a handler
147
- * concern (documented, not enforced).
148
- */
149
- declare function projectionPreset(): FlagPreset<ProjectionFlags>;
150
- /**
151
- * Time-window flag preset.
152
- *
153
- * Adds: `--since <date>`, `--until <date>`
154
- * Resolves: `{ since: Date | undefined, until: Date | undefined }`
155
- *
156
- * Accepts ISO 8601 dates (`2024-01-15`) or relative durations
157
- * (`7d`, `24h`, `30m`, `2w`). Durations are past-relative
158
- * (subtracted from now).
159
- *
160
- * Returns `undefined` for unparseable values (does not throw).
161
- * When `config.maxRange` is set and both bounds are provided,
162
- * ranges above the limit are treated as invalid.
163
- */
164
- declare function timeWindowPreset(config?: TimeWindowPresetConfig): FlagPreset<TimeWindowFlags>;
165
- /**
166
- * Execution flag preset.
167
- *
168
- * Adds: `--timeout <ms>`, `--retries <n>`, `--offline`
169
- * Resolves: `{ timeout: number | undefined, retries: number, offline: boolean }`
170
- *
171
- * Timeout is parsed as a positive integer in milliseconds.
172
- * Retries are parsed as a non-negative integer, clamped to maxRetries.
173
- */
174
- declare function executionPreset(config?: ExecutionPresetConfig): FlagPreset<ExecutionFlags>;
175
- /**
176
- * Pagination flag preset.
177
- *
178
- * Adds: `-l, --limit <n>`, `--next`, `--reset`
179
- * Resolves: `{ limit: number, next: boolean, reset: boolean }`
180
- *
181
- * Limit is parsed as an integer, clamped to maxLimit, and defaults
182
- * to defaultLimit on invalid input. Mutual exclusivity of --next
183
- * and --reset is a handler concern (not enforced here).
184
- *
185
- * Integrates with loadCursor/saveCursor/clearCursor from
186
- * `@outfitter/cli/pagination`.
187
- */
188
- declare function paginationPreset(config?: PaginationPresetConfig): FlagPreset<PaginationFlags>;
189
- export { verbosePreset, timeWindowPreset, stringListFlagPreset, strictPreset, projectionPreset, paginationPreset, numberFlagPreset, interactionPreset, forcePreset, executionPreset, enumFlagPreset, dryRunPreset, cwdPreset, createPreset, composePresets, colorPreset, booleanFlagPreset, TimeWindowPresetConfig, TimeWindowFlags, StringListFlagPresetConfig, StrictFlags, ProjectionFlags, PaginationPresetConfig, PaginationFlags, NumberFlagPresetConfig, InteractionFlags, FlagPresetConfig, FlagPreset, ExecutionPresetConfig, ExecutionFlags, EnumFlagPresetConfig, ComposedPreset, ColorMode, ColorFlags, BooleanFlagPresetConfig };
1
+ import { colorPreset, cwdPreset, dryRunPreset, executionPreset, forcePreset, interactionPreset, paginationPreset, projectionPreset, strictPreset, timeWindowPreset, verbosePreset } from "./shared/@outfitter/cli-xw8ys1je.js";
2
+ import { composePresets, createPreset, createSchemaPreset, isSchemaPreset } from "./shared/@outfitter/cli-n54zs151.js";
3
+ import { booleanFlagPreset, enumFlagPreset, numberFlagPreset, stringListFlagPreset } from "./shared/@outfitter/cli-dv8kk4jw.js";
4
+ import { AnyPreset, BooleanFlagPresetConfig, ColorFlags, ColorMode, ComposedPreset, EnumFlagPresetConfig, ExecutionFlags, ExecutionPresetConfig, FlagPreset, FlagPresetConfig, InteractionFlags, NumberFlagPresetConfig, PaginationFlags, PaginationPresetConfig, ProjectionFlags, SchemaPreset, SchemaPresetConfig, StrictFlags, StringListFlagPresetConfig, TimeWindowFlags, TimeWindowPresetConfig } from "./shared/@outfitter/cli-x6qr7bnd.js";
5
+ export { verbosePreset, timeWindowPreset, stringListFlagPreset, strictPreset, projectionPreset, paginationPreset, numberFlagPreset, isSchemaPreset, interactionPreset, forcePreset, executionPreset, enumFlagPreset, dryRunPreset, cwdPreset, createSchemaPreset, createPreset, composePresets, colorPreset, booleanFlagPreset, TimeWindowPresetConfig, TimeWindowFlags, StringListFlagPresetConfig, StrictFlags, SchemaPresetConfig, SchemaPreset, ProjectionFlags, PaginationPresetConfig, PaginationFlags, NumberFlagPresetConfig, InteractionFlags, FlagPresetConfig, FlagPreset, ExecutionPresetConfig, ExecutionFlags, EnumFlagPresetConfig, ComposedPreset, ColorMode, ColorFlags, BooleanFlagPresetConfig, AnyPreset };
package/dist/flags.js CHANGED
@@ -4,12 +4,14 @@ import {
4
4
  colorPreset,
5
5
  composePresets,
6
6
  createPreset,
7
+ createSchemaPreset,
7
8
  cwdPreset,
8
9
  dryRunPreset,
9
10
  enumFlagPreset,
10
11
  executionPreset,
11
12
  forcePreset,
12
13
  interactionPreset,
14
+ isSchemaPreset,
13
15
  numberFlagPreset,
14
16
  paginationPreset,
15
17
  projectionPreset,
@@ -17,7 +19,7 @@ import {
17
19
  stringListFlagPreset,
18
20
  timeWindowPreset,
19
21
  verbosePreset
20
- } from "./shared/@outfitter/cli-pdb7znbq.js";
22
+ } from "./shared/@outfitter/cli-8999qjdd.js";
21
23
  export {
22
24
  verbosePreset,
23
25
  timeWindowPreset,
@@ -26,12 +28,14 @@ export {
26
28
  projectionPreset,
27
29
  paginationPreset,
28
30
  numberFlagPreset,
31
+ isSchemaPreset,
29
32
  interactionPreset,
30
33
  forcePreset,
31
34
  executionPreset,
32
35
  enumFlagPreset,
33
36
  dryRunPreset,
34
37
  cwdPreset,
38
+ createSchemaPreset,
35
39
  createPreset,
36
40
  composePresets,
37
41
  colorPreset,
@@ -0,0 +1,34 @@
1
+ import { buildCommandTree, commandTreeHints } from "./shared/@outfitter/cli-yfewnyc2.js";
2
+ import { buildActionGraph, graphErrorHints, graphSuccessHints } from "./shared/@outfitter/cli-pmd04gtv.js";
3
+ import { ActionGraph, ActionGraphEdge, CommandTree, CommandTreeNode, CommandTreeOption } from "./shared/@outfitter/cli-16wg5mka.js";
4
+ import { errorRecoveryHints } from "./shared/@outfitter/cli-tm2fzngs.js";
5
+ import "./shared/@outfitter/cli-xde45xcc.js";
6
+ import "./shared/@outfitter/cli-x6qr7bnd.js";
7
+ /**
8
+ * Populate hint params from a Zod input schema (Tier 3).
9
+ *
10
+ * Introspects the schema fields and produces a params record where each
11
+ * key is a field name and each value is the field's description (or type
12
+ * name as fallback).
13
+ *
14
+ * Enables agents to understand the expected parameter shapes for a command
15
+ * without needing to parse the schema definition themselves.
16
+ *
17
+ * @param schema - A Zod object schema (or ZodObjectLike)
18
+ * @returns A params record mapping field names to their descriptions/types
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const schema = z.object({
23
+ * env: z.string().describe("Target environment"),
24
+ * force: z.boolean().describe("Force deployment"),
25
+ * });
26
+ *
27
+ * const params = schemaHintParams(schema);
28
+ * // { env: "Target environment", force: "Force deployment" }
29
+ * ```
30
+ */
31
+ declare function schemaHintParams(schema: {
32
+ shape: Record<string, unknown>;
33
+ }): Record<string, unknown>;
34
+ export { schemaHintParams, graphSuccessHints, graphErrorHints, errorRecoveryHints, commandTreeHints, buildCommandTree, buildActionGraph, CommandTreeOption, CommandTreeNode, CommandTree, ActionGraphEdge, ActionGraph };
package/dist/hints.js ADDED
@@ -0,0 +1,26 @@
1
+ // @bun
2
+ import {
3
+ schemaHintParams
4
+ } from "./shared/@outfitter/cli-89335n9a.js";
5
+ import {
6
+ buildCommandTree,
7
+ commandTreeHints
8
+ } from "./shared/@outfitter/cli-htzez8v2.js";
9
+ import {
10
+ buildActionGraph,
11
+ graphErrorHints,
12
+ graphSuccessHints
13
+ } from "./shared/@outfitter/cli-hvg2m5gf.js";
14
+ import {
15
+ errorRecoveryHints
16
+ } from "./shared/@outfitter/cli-2dfxs239.js";
17
+ import"./shared/@outfitter/cli-3jta1h1h.js";
18
+ export {
19
+ schemaHintParams,
20
+ graphSuccessHints,
21
+ graphErrorHints,
22
+ errorRecoveryHints,
23
+ commandTreeHints,
24
+ buildCommandTree,
25
+ buildActionGraph
26
+ };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import "./shared/@outfitter/cli-qz47jk6d.js";
2
2
  import { ANSI, Theme, Tokens, createTheme } from "./shared/@outfitter/cli-j2x88att.js";
3
- import { exitWithError, output } from "./shared/@outfitter/cli-xy3gs50c.js";
4
- import { OutputMode } from "./shared/@outfitter/cli-98aa9104.js";
3
+ import { exitWithError, output } from "./shared/@outfitter/cli-q6csxmeh.js";
4
+ import "./shared/@outfitter/cli-10wxfc78.js";
5
+ import { OutputMode } from "./shared/@outfitter/cli-x6qr7bnd.js";
5
6
  export { output, exitWithError, createTheme, Tokens, Theme, OutputMode, ANSI };
package/dist/input.d.ts CHANGED
@@ -1,130 +1,9 @@
1
- import { CollectIdsOptions, ExpandFileOptions, FilterExpression, KeyValuePair, NormalizeIdOptions, ParseGlobOptions, Range, SortCriteria } from "./shared/@outfitter/cli-98aa9104.js";
1
+ import { expandFileArg, parseFilter, parseGlob, parseKeyValue, parseRange, parseSortSpec } from "./shared/@outfitter/cli-h4ejpmjs.js";
2
+ import { collectIds } from "./shared/@outfitter/cli-bcajqy33.js";
3
+ import { NormalizeIdOptions } from "./shared/@outfitter/cli-x6qr7bnd.js";
2
4
  import { ValidationError } from "@outfitter/contracts";
3
5
  import { Result } from "better-result";
4
6
  /**
5
- * Collect IDs from various input formats.
6
- *
7
- * Handles space-separated, comma-separated, repeated flags, @file, and stdin.
8
- *
9
- * @param input - Raw input from CLI arguments
10
- * @param options - Collection options
11
- * @returns Array of collected IDs
12
- *
13
- * @example
14
- * ```typescript
15
- * // All these produce the same result:
16
- * // wm show id1 id2 id3
17
- * // wm show id1,id2,id3
18
- * // wm show --ids id1 --ids id2
19
- * // wm show @ids.txt
20
- * const ids = await collectIds(args.ids, {
21
- * allowFile: true,
22
- * allowStdin: true,
23
- * });
24
- * ```
25
- */
26
- declare function collectIds(input: string | readonly string[], options?: CollectIdsOptions): Promise<string[]>;
27
- /**
28
- * Expand @file references to file contents.
29
- *
30
- * If the input starts with @, reads the file and returns its contents.
31
- * Otherwise, returns the input unchanged.
32
- *
33
- * @param input - Raw input that may be a @file reference
34
- * @param options - Expansion options
35
- * @returns File contents or original input
36
- *
37
- * @example
38
- * ```typescript
39
- * // wm create @template.md
40
- * const content = await expandFileArg(args.content);
41
- * ```
42
- */
43
- declare function expandFileArg(input: string, options?: ExpandFileOptions): Promise<string>;
44
- /**
45
- * Parse and expand glob patterns.
46
- *
47
- * Uses Bun.Glob with workspace constraints.
48
- *
49
- * @param pattern - Glob pattern to expand
50
- * @param options - Glob options
51
- * @returns Array of matched file paths
52
- *
53
- * @example
54
- * ```typescript
55
- * // wm index "src/**\/*.ts"
56
- * const files = await parseGlob(args.pattern, {
57
- * cwd: workspaceRoot,
58
- * ignore: ["node_modules/**"],
59
- * });
60
- * ```
61
- */
62
- declare function parseGlob(pattern: string, options?: ParseGlobOptions): Promise<string[]>;
63
- /**
64
- * Parse key=value pairs from CLI input.
65
- *
66
- * @param input - Raw input containing key=value pairs
67
- * @returns Array of parsed key-value pairs
68
- *
69
- * @example
70
- * ```typescript
71
- * // --set key=value --set key2=value2
72
- * // --set key=value,key2=value2
73
- * const pairs = parseKeyValue(args.set);
74
- * // => [{ key: "key", value: "value" }, { key: "key2", value: "value2" }]
75
- * ```
76
- */
77
- declare function parseKeyValue(input: string | readonly string[]): Result<KeyValuePair[], InstanceType<typeof ValidationError>>;
78
- /**
79
- * Parse range inputs (numeric or date).
80
- *
81
- * @param input - Range string (e.g., "1-10" or "2024-01-01..2024-12-31")
82
- * @param type - Type of range to parse
83
- * @returns Parsed range
84
- *
85
- * @example
86
- * ```typescript
87
- * parseRange("1-10", "number");
88
- * // => Result<{ type: "number", min: 1, max: 10 }, ValidationError>
89
- *
90
- * parseRange("2024-01-01..2024-12-31", "date");
91
- * // => Result<{ type: "date", start: Date, end: Date }, ValidationError>
92
- * ```
93
- */
94
- declare function parseRange(input: string, type: "number" | "date"): Result<Range, InstanceType<typeof ValidationError>>;
95
- /**
96
- * Parse filter expressions from CLI input.
97
- *
98
- * @param input - Filter string (e.g., "status:active,priority:high")
99
- * @returns Array of parsed filter expressions
100
- *
101
- * @example
102
- * ```typescript
103
- * parseFilter("status:active,priority:high");
104
- * // => Result<[
105
- * // { field: "status", value: "active" },
106
- * // { field: "priority", value: "high" }
107
- * // ], ValidationError>
108
- * ```
109
- */
110
- declare function parseFilter(input: string): Result<FilterExpression[], InstanceType<typeof ValidationError>>;
111
- /**
112
- * Parse sort specification from CLI input.
113
- *
114
- * @param input - Sort string (e.g., "modified:desc,title:asc")
115
- * @returns Array of parsed sort criteria
116
- *
117
- * @example
118
- * ```typescript
119
- * parseSortSpec("modified:desc,title:asc");
120
- * // => Result<[
121
- * // { field: "modified", direction: "desc" },
122
- * // { field: "title", direction: "asc" }
123
- * // ], ValidationError>
124
- * ```
125
- */
126
- declare function parseSortSpec(input: string): Result<SortCriteria[], InstanceType<typeof ValidationError>>;
127
- /**
128
7
  * Normalize an identifier (trim, lowercase where appropriate).
129
8
  *
130
9
  * @param input - Raw identifier input