@outfitter/cli 0.5.2 → 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.
- package/README.md +179 -60
- package/dist/actions.d.ts +5 -2
- package/dist/actions.js +2 -2
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +8 -1
- package/dist/colors/index.js +1 -17
- package/dist/command.d.ts +3 -43
- package/dist/command.js +241 -13
- package/dist/envelope.d.ts +5 -0
- package/dist/envelope.js +160 -0
- package/dist/flags.d.ts +5 -189
- package/dist/flags.js +5 -1
- package/dist/hints.d.ts +34 -0
- package/dist/hints.js +26 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -17
- package/dist/input.d.ts +3 -124
- package/dist/input.js +14 -359
- package/dist/internal/envelope-helpers.d.ts +4 -0
- package/dist/internal/envelope-helpers.js +24 -0
- package/dist/internal/envelope-types.d.ts +3 -0
- package/dist/internal/flag-builders.d.ts +3 -0
- package/dist/internal/flag-builders.js +155 -0
- package/dist/internal/flag-types.d.ts +3 -0
- package/dist/internal/flag-types.js +13 -0
- package/dist/internal/hint-action-graph.d.ts +5 -0
- package/dist/internal/hint-action-graph.js +11 -0
- package/dist/internal/hint-command-tree.d.ts +5 -0
- package/dist/internal/hint-command-tree.js +9 -0
- package/dist/internal/hint-error-recovery.d.ts +2 -0
- package/dist/internal/hint-error-recovery.js +7 -0
- package/dist/internal/hint-types.d.ts +4 -0
- package/dist/internal/hint-types.js +1 -0
- package/dist/internal/input-helpers.d.ts +18 -0
- package/dist/internal/input-helpers.js +11 -0
- package/dist/internal/input-normalization.d.ts +3 -0
- package/dist/internal/input-normalization.js +9 -0
- package/dist/internal/input-parsers.d.ts +3 -0
- package/dist/internal/input-parsers.js +19 -0
- package/dist/internal/input-security.d.ts +22 -0
- package/dist/internal/input-security.js +11 -0
- package/dist/internal/output-formatting.d.ts +3 -0
- package/dist/internal/output-formatting.js +21 -0
- package/dist/internal/presets.d.ts +3 -0
- package/dist/{shared/@outfitter/cli-pdb7znbq.js → internal/presets.js} +49 -223
- package/dist/internal/schema-commands.d.ts +3 -0
- package/dist/{shared/@outfitter/cli-0cjts94k.js → internal/schema-commands.js} +12 -100
- package/dist/internal/schema-formatting.d.ts +2 -0
- package/dist/internal/schema-formatting.js +7 -0
- package/dist/internal/schema-types.d.ts +2 -0
- package/dist/internal/schema-types.js +1 -0
- package/dist/output.d.ts +4 -3
- package/dist/output.js +10 -2
- package/dist/pagination.d.ts +1 -1
- package/dist/query.d.ts +84 -2
- package/dist/query.js +8 -45
- package/dist/schema-input.d.ts +80 -0
- package/dist/schema-input.js +15 -0
- package/dist/schema.d.ts +4 -1
- package/dist/schema.js +1 -1
- package/dist/shared/@outfitter/cli-10wxfc78.d.ts +45 -0
- package/dist/shared/@outfitter/cli-16wg5mka.d.ts +71 -0
- package/dist/shared/@outfitter/cli-1q5redaj.js +267 -0
- package/dist/shared/@outfitter/cli-2dfxs239.js +98 -0
- package/dist/shared/@outfitter/cli-30mt7c5w.d.ts +112 -0
- package/dist/shared/@outfitter/cli-3jta1h1h.js +134 -0
- package/dist/shared/@outfitter/cli-4h85mpth.js +76 -0
- package/dist/shared/@outfitter/cli-6shkwxdc.js +28 -0
- package/dist/shared/@outfitter/cli-89335n9a.js +16 -0
- package/dist/shared/@outfitter/cli-8999qjdd.js +3 -0
- package/dist/shared/@outfitter/cli-8cfxdady.js +60 -0
- package/dist/shared/@outfitter/cli-bcajqy33.d.ts +25 -0
- package/dist/shared/@outfitter/cli-c09332vm.d.ts +39 -0
- package/dist/shared/@outfitter/cli-cgha038c.d.ts +3 -0
- package/dist/shared/@outfitter/{cli-zahqsaby.js → cli-d40m2x1d.js} +19 -3
- package/dist/shared/@outfitter/{cli-7wp5nj0s.js → cli-dg0cz7rw.js} +39 -81
- package/dist/shared/@outfitter/cli-dv8kk4jw.d.ts +24 -0
- package/dist/shared/@outfitter/cli-g43887b7.js +20 -0
- package/dist/shared/@outfitter/cli-gqtkhgw4.js +52 -0
- package/dist/shared/@outfitter/cli-h4ejpmjs.d.ts +104 -0
- package/dist/shared/@outfitter/cli-htzez8v2.js +70 -0
- package/dist/shared/@outfitter/cli-hvg2m5gf.js +79 -0
- package/dist/shared/@outfitter/cli-n54zs151.d.ts +78 -0
- package/dist/shared/@outfitter/cli-nbpgw7z7.d.ts +15 -0
- package/dist/shared/@outfitter/cli-nkt399zf.d.ts +94 -0
- package/dist/shared/@outfitter/cli-pmd04gtv.d.ts +60 -0
- package/dist/shared/@outfitter/{cli-xy3gs50c.d.ts → cli-q6csxmeh.d.ts} +19 -12
- package/dist/shared/@outfitter/cli-qcskd96y.d.ts +11 -0
- package/dist/shared/@outfitter/cli-ry7btmy4.js +118 -0
- package/dist/shared/@outfitter/cli-sy99pjyj.js +32 -0
- package/dist/shared/@outfitter/cli-tm2fzngs.d.ts +23 -0
- package/dist/shared/@outfitter/cli-vvvhjwks.js +106 -0
- package/dist/shared/@outfitter/cli-wjv7g1aq.d.ts +16 -0
- package/dist/shared/@outfitter/{cli-98aa9104.d.ts → cli-x6qr7bnd.d.ts} +338 -16
- package/dist/shared/@outfitter/cli-xde45xcc.d.ts +53 -0
- package/dist/shared/@outfitter/cli-xw8ys1je.d.ts +123 -0
- package/dist/shared/@outfitter/cli-yfewnyc2.d.ts +43 -0
- package/dist/shared/@outfitter/cli-zkzj0q4q.js +99 -0
- package/dist/shared/@outfitter/cli-zv3ah6f0.js +3 -0
- package/dist/streaming.d.ts +47 -0
- package/dist/streaming.js +13 -0
- package/dist/terminal/index.js +1 -19
- package/dist/truncation.d.ts +104 -0
- package/dist/truncation.js +111 -0
- package/dist/types.d.ts +2 -2
- package/dist/types.js +0 -5
- package/dist/verbs.d.ts +1 -1
- package/package.json +66 -36
- package/dist/shared/@outfitter/cli-n1k0d23k.d.ts +0 -33
- /package/dist/{shared/@outfitter/cli-zw75pdk8.js → internal/envelope-types.js} +0 -0
package/README.md
CHANGED
|
@@ -56,11 +56,11 @@ output(errors, { stream: process.stderr });
|
|
|
56
56
|
|
|
57
57
|
**Options:**
|
|
58
58
|
|
|
59
|
-
| Option
|
|
60
|
-
|
|
61
|
-
| `mode`
|
|
62
|
-
| `stream` | `WritableStream` | `stdout` | Stream to write to
|
|
63
|
-
| `pretty` | `boolean`
|
|
59
|
+
| Option | Type | Default | Description |
|
|
60
|
+
| -------- | ---------------- | -------- | ---------------------------- |
|
|
61
|
+
| `mode` | `OutputMode` | auto | Force a specific output mode |
|
|
62
|
+
| `stream` | `WritableStream` | `stdout` | Stream to write to |
|
|
63
|
+
| `pretty` | `boolean` | `false` | Pretty-print JSON output |
|
|
64
64
|
|
|
65
65
|
**Output Modes:**
|
|
66
66
|
|
|
@@ -108,10 +108,10 @@ const ids = await collectIds(args.ids, {
|
|
|
108
108
|
|
|
109
109
|
**Options:**
|
|
110
110
|
|
|
111
|
-
| Option
|
|
112
|
-
|
|
113
|
-
| `allowFile`
|
|
114
|
-
| `allowStdin` | `boolean` | `true`
|
|
111
|
+
| Option | Type | Default | Description |
|
|
112
|
+
| ------------ | --------- | ------- | ----------------------- |
|
|
113
|
+
| `allowFile` | `boolean` | `true` | Allow `@file` expansion |
|
|
114
|
+
| `allowStdin` | `boolean` | `true` | Allow `@-` for stdin |
|
|
115
115
|
|
|
116
116
|
#### `expandFileArg(input, options?)`
|
|
117
117
|
|
|
@@ -132,11 +132,11 @@ const content = await expandFileArg(args.content, {
|
|
|
132
132
|
|
|
133
133
|
**Options:**
|
|
134
134
|
|
|
135
|
-
| Option
|
|
136
|
-
|
|
137
|
-
| `encoding` | `BufferEncoding` | `utf-8` | File encoding
|
|
138
|
-
| `maxSize`
|
|
139
|
-
| `trim`
|
|
135
|
+
| Option | Type | Default | Description |
|
|
136
|
+
| ---------- | ---------------- | ------- | -------------------------- |
|
|
137
|
+
| `encoding` | `BufferEncoding` | `utf-8` | File encoding |
|
|
138
|
+
| `maxSize` | `number` | - | Maximum file size in bytes |
|
|
139
|
+
| `trim` | `boolean` | `false` | Trim whitespace |
|
|
140
140
|
|
|
141
141
|
#### `parseGlob(pattern, options?)`
|
|
142
142
|
|
|
@@ -154,13 +154,13 @@ const files = await parseGlob("src/**/*.ts", {
|
|
|
154
154
|
|
|
155
155
|
**Options:**
|
|
156
156
|
|
|
157
|
-
| Option
|
|
158
|
-
|
|
159
|
-
| `cwd`
|
|
160
|
-
| `ignore`
|
|
161
|
-
| `onlyFiles`
|
|
162
|
-
| `onlyDirectories` | `boolean`
|
|
163
|
-
| `followSymlinks`
|
|
157
|
+
| Option | Type | Default | Description |
|
|
158
|
+
| ----------------- | ---------- | --------------- | ---------------------- |
|
|
159
|
+
| `cwd` | `string` | `process.cwd()` | Working directory |
|
|
160
|
+
| `ignore` | `string[]` | `[]` | Patterns to exclude |
|
|
161
|
+
| `onlyFiles` | `boolean` | `false` | Only match files |
|
|
162
|
+
| `onlyDirectories` | `boolean` | `false` | Only match directories |
|
|
163
|
+
| `followSymlinks` | `boolean` | `false` | Follow symbolic links |
|
|
164
164
|
|
|
165
165
|
#### `parseKeyValue(input)`
|
|
166
166
|
|
|
@@ -219,15 +219,15 @@ if (result.isOk()) {
|
|
|
219
219
|
|
|
220
220
|
**Filter Operators:**
|
|
221
221
|
|
|
222
|
-
| Prefix | Operator
|
|
223
|
-
|
|
224
|
-
| (none) | `eq`
|
|
225
|
-
| `!`
|
|
226
|
-
| `>`
|
|
227
|
-
| `<`
|
|
228
|
-
| `>=`
|
|
229
|
-
| `<=`
|
|
230
|
-
| `~`
|
|
222
|
+
| Prefix | Operator | Description |
|
|
223
|
+
| ------ | ---------- | --------------------- |
|
|
224
|
+
| (none) | `eq` | Equals (default) |
|
|
225
|
+
| `!` | `ne` | Not equals |
|
|
226
|
+
| `>` | `gt` | Greater than |
|
|
227
|
+
| `<` | `lt` | Less than |
|
|
228
|
+
| `>=` | `gte` | Greater than or equal |
|
|
229
|
+
| `<=` | `lte` | Less than or equal |
|
|
230
|
+
| `~` | `contains` | Contains substring |
|
|
231
231
|
|
|
232
232
|
#### `parseSortSpec(input)`
|
|
233
233
|
|
|
@@ -268,13 +268,13 @@ if (result.isOk()) {
|
|
|
268
268
|
|
|
269
269
|
**Options:**
|
|
270
270
|
|
|
271
|
-
| Option
|
|
272
|
-
|
|
273
|
-
| `trim`
|
|
271
|
+
| Option | Type | Default | Description |
|
|
272
|
+
| ----------- | --------- | ------- | -------------------- |
|
|
273
|
+
| `trim` | `boolean` | `false` | Trim whitespace |
|
|
274
274
|
| `lowercase` | `boolean` | `false` | Convert to lowercase |
|
|
275
|
-
| `minLength` | `number`
|
|
276
|
-
| `maxLength` | `number`
|
|
277
|
-
| `pattern`
|
|
275
|
+
| `minLength` | `number` | - | Minimum length |
|
|
276
|
+
| `maxLength` | `number` | - | Maximum length |
|
|
277
|
+
| `pattern` | `RegExp` | - | Required pattern |
|
|
278
278
|
|
|
279
279
|
#### `confirmDestructive(options)`
|
|
280
280
|
|
|
@@ -361,12 +361,116 @@ if (flags.reset) {
|
|
|
361
361
|
}
|
|
362
362
|
```
|
|
363
363
|
|
|
364
|
+
## NDJSON Streaming (`@outfitter/cli/streaming`)
|
|
365
|
+
|
|
366
|
+
Real-time progress reporting via newline-delimited JSON. Handlers emit progress events through an optional `ctx.progress` callback; the CLI adapter writes them as NDJSON lines to stdout.
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
import { streamPreset } from "@outfitter/cli/query";
|
|
370
|
+
import { runHandler } from "@outfitter/cli/envelope";
|
|
371
|
+
|
|
372
|
+
command("deploy")
|
|
373
|
+
.preset(streamPreset())
|
|
374
|
+
.action(async ({ flags, input }) => {
|
|
375
|
+
await runHandler({
|
|
376
|
+
command: "deploy",
|
|
377
|
+
handler: async (input, ctx) => {
|
|
378
|
+
ctx.progress?.({ type: "progress", current: 1, total: 3 });
|
|
379
|
+
// ... work ...
|
|
380
|
+
return Result.ok({ status: "deployed" });
|
|
381
|
+
},
|
|
382
|
+
input,
|
|
383
|
+
stream: Boolean(flags.stream),
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
```
|
|
389
|
+
$ mycli deploy --stream
|
|
390
|
+
{"type":"start","command":"deploy","ts":"2025-01-01T00:00:00.000Z"}
|
|
391
|
+
{"type":"progress","current":1,"total":3}
|
|
392
|
+
{"ok":true,"command":"deploy","result":{"status":"deployed"}}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
`--stream` is orthogonal to output mode — it controls delivery (streaming vs batch), not serialization. Types live in `@outfitter/contracts/stream`.
|
|
396
|
+
|
|
397
|
+
Low-level utilities (`writeNdjsonLine`, `writeStreamEnvelope`, `createNdjsonProgress`) are exported from `@outfitter/cli/streaming` for custom setups.
|
|
398
|
+
|
|
399
|
+
## Output Truncation (`@outfitter/cli/truncation`)
|
|
400
|
+
|
|
401
|
+
Truncate array output with pagination hints and optional file pointers for very large results.
|
|
402
|
+
|
|
403
|
+
```typescript
|
|
404
|
+
import { truncateOutput } from "@outfitter/cli/truncation";
|
|
405
|
+
|
|
406
|
+
const result = truncateOutput(items, {
|
|
407
|
+
limit: 20,
|
|
408
|
+
offset: 0,
|
|
409
|
+
commandName: "list",
|
|
410
|
+
});
|
|
411
|
+
// result.data — sliced items (length <= 20)
|
|
412
|
+
// result.metadata — { showing: 20, total: 500, truncated: true }
|
|
413
|
+
// result.hints — [{ description: "Show next 20 of 480...", command: "list --offset 20 --limit 20" }]
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
When output exceeds `filePointerThreshold` (default: 1000 items), the full result is written to a temp file and `metadata.full_output` contains the file path. File write failures degrade gracefully with a warning hint instead of crashing.
|
|
417
|
+
|
|
418
|
+
**Exports:** `truncateOutput`, `TruncationOptions`, `TruncationResult`, `TruncationMetadata`, `DEFAULT_FILE_POINTER_THRESHOLD`
|
|
419
|
+
|
|
420
|
+
## CommandBuilder
|
|
421
|
+
|
|
422
|
+
The `command()` builder provides a fluent API for defining CLI commands with typed input schemas, safety metadata, and hint generation:
|
|
423
|
+
|
|
424
|
+
```typescript
|
|
425
|
+
import { command } from "@outfitter/cli/command";
|
|
426
|
+
import { runHandler } from "@outfitter/cli/envelope";
|
|
427
|
+
|
|
428
|
+
command("delete <id>")
|
|
429
|
+
.description("Delete a resource")
|
|
430
|
+
.input(z.object({ id: z.string(), force: z.boolean().default(false) }))
|
|
431
|
+
.destructive(true) // auto-adds --dry-run flag
|
|
432
|
+
.relatedTo("list", { description: "List remaining resources" })
|
|
433
|
+
.hints((result, input) => [
|
|
434
|
+
{ description: "Verify", command: `show ${input.id}` },
|
|
435
|
+
])
|
|
436
|
+
.onError((error, input) => [
|
|
437
|
+
{ description: "Check exists", command: `show ${input.id}` },
|
|
438
|
+
])
|
|
439
|
+
.action(async ({ input, flags }) => {
|
|
440
|
+
await runHandler({
|
|
441
|
+
command: "delete",
|
|
442
|
+
handler: deleteHandler,
|
|
443
|
+
input,
|
|
444
|
+
dryRun: Boolean(flags.dryRun),
|
|
445
|
+
});
|
|
446
|
+
})
|
|
447
|
+
.build();
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
**Safety metadata methods:**
|
|
451
|
+
|
|
452
|
+
| Method | Effect |
|
|
453
|
+
| ------------------- | ----------------------------------------------------------------------------- |
|
|
454
|
+
| `.destructive()` | Auto-adds `--dry-run` flag; `runHandler({ dryRun })` generates execution hint |
|
|
455
|
+
| `.readOnly()` | Surfaces in command tree JSON and maps to MCP `readOnlyHint` |
|
|
456
|
+
| `.idempotent()` | Surfaces in command tree JSON and maps to MCP `idempotentHint` |
|
|
457
|
+
| `.relatedTo()` | Declares action graph edges for tier-4 hint generation |
|
|
458
|
+
| `.input(schema)` | Zod schema for auto-derived flags and validation |
|
|
459
|
+
| `.context(factory)` | Async factory for handler context construction |
|
|
460
|
+
| `.hints(fn)` | Success hint function called with `(result, input)` |
|
|
461
|
+
| `.onError(fn)` | Error hint function called with `(error, input)` |
|
|
462
|
+
|
|
364
463
|
## Conventions
|
|
365
464
|
|
|
366
465
|
Composable flag presets provide typed, reusable CLI flag definitions. See the [full conventions guide](../../docs/cli/conventions.md) for the complete catalog.
|
|
367
466
|
|
|
368
467
|
```typescript
|
|
369
|
-
import {
|
|
468
|
+
import {
|
|
469
|
+
composePresets,
|
|
470
|
+
verbosePreset,
|
|
471
|
+
cwdPreset,
|
|
472
|
+
forcePreset,
|
|
473
|
+
} from "@outfitter/cli/flags";
|
|
370
474
|
import { outputModePreset } from "@outfitter/cli/query";
|
|
371
475
|
|
|
372
476
|
const preset = composePresets(verbosePreset(), cwdPreset(), forcePreset());
|
|
@@ -379,30 +483,36 @@ command("deploy")
|
|
|
379
483
|
});
|
|
380
484
|
```
|
|
381
485
|
|
|
382
|
-
**Available presets:** `verbosePreset`, `cwdPreset`, `dryRunPreset`, `forcePreset`, `interactionPreset`, `strictPreset`, `colorPreset`, `projectionPreset`, `paginationPreset`, `timeWindowPreset`, `executionPreset`, `outputModePreset`, `jqPreset`
|
|
486
|
+
**Available presets:** `verbosePreset`, `cwdPreset`, `dryRunPreset`, `forcePreset`, `interactionPreset`, `strictPreset`, `colorPreset`, `projectionPreset`, `paginationPreset`, `timeWindowPreset`, `executionPreset`, `outputModePreset`, `jqPreset`, `streamPreset`
|
|
383
487
|
|
|
384
488
|
**Additional modules:**
|
|
489
|
+
|
|
385
490
|
- `@outfitter/cli/verbs` — Standard verb families (`create`, `modify`, `remove`, `list`, `show`)
|
|
386
|
-
- `@outfitter/cli/query` — Output mode
|
|
491
|
+
- `@outfitter/cli/query` — Output mode, jq expression, and streaming presets
|
|
387
492
|
- `@outfitter/cli/completion` — Shell completion script generation
|
|
493
|
+
- `@outfitter/cli/streaming` — NDJSON streaming primitives
|
|
494
|
+
- `@outfitter/cli/truncation` — Output truncation with pagination hints
|
|
495
|
+
- `@outfitter/cli/envelope` — Response envelope construction and `runHandler()` lifecycle
|
|
496
|
+
- `@outfitter/cli/hints` — Hint generation tiers (command tree, error recovery, schema params, action graph)
|
|
388
497
|
|
|
389
498
|
## Configuration
|
|
390
499
|
|
|
391
500
|
### Environment Variables
|
|
392
501
|
|
|
393
|
-
| Variable
|
|
394
|
-
|
|
395
|
-
| `OUTFITTER_ENV`
|
|
396
|
-
| `OUTFITTER_VERBOSE` | Override verbose mode (`1` or `0`)
|
|
397
|
-
| `OUTFITTER_JSON`
|
|
398
|
-
| `OUTFITTER_JSONL`
|
|
399
|
-
| `XDG_STATE_HOME`
|
|
502
|
+
| Variable | Description | Default |
|
|
503
|
+
| ------------------- | ----------------------------------------------------------- | ----------------- |
|
|
504
|
+
| `OUTFITTER_ENV` | Environment profile (`development`, `production`, `test`) | `production` |
|
|
505
|
+
| `OUTFITTER_VERBOSE` | Override verbose mode (`1` or `0`) | - |
|
|
506
|
+
| `OUTFITTER_JSON` | Set to `1` to force JSON output | - |
|
|
507
|
+
| `OUTFITTER_JSONL` | Set to `1` to force JSONL output (takes priority over JSON) | - |
|
|
508
|
+
| `XDG_STATE_HOME` | State directory for pagination | Platform-specific |
|
|
400
509
|
|
|
401
510
|
### `resolveVerbose(verbose?)`
|
|
402
511
|
|
|
403
512
|
Resolve verbose mode from environment configuration. Use this instead of hardcoding verbosity so your CLI responds to `OUTFITTER_ENV` and `OUTFITTER_VERBOSE` automatically.
|
|
404
513
|
|
|
405
514
|
**Precedence** (highest wins):
|
|
515
|
+
|
|
406
516
|
1. `OUTFITTER_VERBOSE` environment variable (`"1"` or `"0"`)
|
|
407
517
|
2. Explicit `verbose` parameter (from `--verbose` CLI flag)
|
|
408
518
|
3. `OUTFITTER_ENV` profile defaults (`true` in development)
|
|
@@ -449,18 +559,18 @@ The bridge uses `optsWithGlobals()` so global and subcommand `--json` flags both
|
|
|
449
559
|
|
|
450
560
|
Exit codes are automatically determined from error categories:
|
|
451
561
|
|
|
452
|
-
| Category
|
|
453
|
-
|
|
454
|
-
| `validation` | 1
|
|
455
|
-
| `not_found`
|
|
456
|
-
| `conflict`
|
|
457
|
-
| `permission` | 4
|
|
458
|
-
| `timeout`
|
|
459
|
-
| `rate_limit` | 6
|
|
460
|
-
| `network`
|
|
461
|
-
| `internal`
|
|
462
|
-
| `auth`
|
|
463
|
-
| `cancelled`
|
|
562
|
+
| Category | Exit Code |
|
|
563
|
+
| ------------ | --------- |
|
|
564
|
+
| `validation` | 1 |
|
|
565
|
+
| `not_found` | 2 |
|
|
566
|
+
| `conflict` | 3 |
|
|
567
|
+
| `permission` | 4 |
|
|
568
|
+
| `timeout` | 5 |
|
|
569
|
+
| `rate_limit` | 6 |
|
|
570
|
+
| `network` | 7 |
|
|
571
|
+
| `internal` | 8 |
|
|
572
|
+
| `auth` | 9 |
|
|
573
|
+
| `cancelled` | 130 |
|
|
464
574
|
|
|
465
575
|
### Tagged Errors
|
|
466
576
|
|
|
@@ -478,9 +588,18 @@ exitWithError(error); // Exits with code 2
|
|
|
478
588
|
All types are exported for TypeScript consumers:
|
|
479
589
|
|
|
480
590
|
```typescript
|
|
481
|
-
import type {
|
|
591
|
+
import type {
|
|
592
|
+
CLIConfig,
|
|
593
|
+
CommandConfig,
|
|
594
|
+
CommandAction,
|
|
595
|
+
CommandFlags,
|
|
596
|
+
} from "@outfitter/cli/command";
|
|
482
597
|
import type { OutputMode, OutputOptions } from "@outfitter/cli/output";
|
|
483
|
-
import type {
|
|
598
|
+
import type {
|
|
599
|
+
CollectIdsOptions,
|
|
600
|
+
ExpandFileOptions,
|
|
601
|
+
ParseGlobOptions,
|
|
602
|
+
} from "@outfitter/cli/input";
|
|
484
603
|
import type { PaginationState, CursorOptions } from "@outfitter/cli/pagination";
|
|
485
604
|
```
|
|
486
605
|
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "./shared/@outfitter/cli-cgha038c.js";
|
|
2
|
+
import "./shared/@outfitter/cli-nbpgw7z7.js";
|
|
3
|
+
import { SchemaCommandOptions } from "./shared/@outfitter/cli-wjv7g1aq.js";
|
|
4
|
+
import "./shared/@outfitter/cli-qcskd96y.js";
|
|
5
|
+
import { FlagPreset } from "./shared/@outfitter/cli-x6qr7bnd.js";
|
|
3
6
|
import { ActionCliInputContext, ActionCliOption, ActionRegistry, ActionSurface, AnyActionSpec, HandlerContext } from "@outfitter/contracts";
|
|
4
7
|
import { Command } from "commander";
|
|
5
8
|
interface BuildCliCommandsOptions {
|
package/dist/actions.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
createSchemaCommand
|
|
4
|
-
} from "./shared/@outfitter/cli-
|
|
4
|
+
} from "./shared/@outfitter/cli-zv3ah6f0.js";
|
|
5
5
|
import {
|
|
6
6
|
composePresets
|
|
7
|
-
} from "./shared/@outfitter/cli-
|
|
7
|
+
} from "./shared/@outfitter/cli-8999qjdd.js";
|
|
8
8
|
|
|
9
9
|
// packages/cli/src/actions.ts
|
|
10
10
|
import {
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
createCLI
|
|
4
|
-
} from "./shared/@outfitter/cli-
|
|
4
|
+
} from "./shared/@outfitter/cli-d40m2x1d.js";
|
|
5
|
+
import"./shared/@outfitter/cli-89335n9a.js";
|
|
6
|
+
import"./shared/@outfitter/cli-htzez8v2.js";
|
|
7
|
+
import"./shared/@outfitter/cli-hvg2m5gf.js";
|
|
8
|
+
import"./shared/@outfitter/cli-2dfxs239.js";
|
|
9
|
+
import"./shared/@outfitter/cli-4h85mpth.js";
|
|
10
|
+
import"./shared/@outfitter/cli-dg0cz7rw.js";
|
|
11
|
+
import"./shared/@outfitter/cli-3jta1h1h.js";
|
|
5
12
|
export {
|
|
6
13
|
createCLI
|
|
7
14
|
};
|
package/dist/colors/index.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import"../shared/@outfitter/cli-zw75pdk8.js";
|
|
3
|
-
import {
|
|
4
|
-
ANSI,
|
|
5
|
-
applyColor,
|
|
6
|
-
createTheme,
|
|
7
|
-
createTokens,
|
|
8
|
-
resolveTokenColorEnabled
|
|
9
|
-
} from "../shared/@outfitter/cli-rk9zagkm.js";
|
|
10
|
-
import"../shared/@outfitter/cli-jbj78ac5.js";
|
|
11
|
-
export {
|
|
12
|
-
resolveTokenColorEnabled,
|
|
13
|
-
createTokens,
|
|
14
|
-
createTheme,
|
|
15
|
-
applyColor,
|
|
16
|
-
ANSI
|
|
17
|
-
};
|
|
1
|
+
export { ANSI, applyColor, createTheme, createTokens, resolveTokenColorEnabled } from "./colors.js";
|
package/dist/command.d.ts
CHANGED
|
@@ -1,43 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
declare function createCLI(config: CLIConfig): CLI;
|
|
6
|
-
/**
|
|
7
|
-
* Create a new command builder with the given name.
|
|
8
|
-
*
|
|
9
|
-
* The command builder provides a fluent API for defining CLI commands
|
|
10
|
-
* with typed flags, arguments, and actions.
|
|
11
|
-
*
|
|
12
|
-
* @param name - Command name and optional argument syntax (e.g., "list" or "get <id>")
|
|
13
|
-
* @returns A CommandBuilder instance for fluent configuration
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* import { command, output } from "@outfitter/cli";
|
|
18
|
-
*
|
|
19
|
-
* const list = command("list")
|
|
20
|
-
* .description("List all notes")
|
|
21
|
-
* .option("--limit <n>", "Max results", "20")
|
|
22
|
-
* .option("--json", "Output as JSON")
|
|
23
|
-
* .option("--next", "Continue from last position")
|
|
24
|
-
* .action(async ({ flags }) => {
|
|
25
|
-
* const results = await listNotes(flags);
|
|
26
|
-
* output(results);
|
|
27
|
-
* });
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* // Command with required argument
|
|
33
|
-
* const get = command("get <id>")
|
|
34
|
-
* .description("Get a note by ID")
|
|
35
|
-
* .action(async ({ args }) => {
|
|
36
|
-
* const [id] = args;
|
|
37
|
-
* const note = await getNote(id);
|
|
38
|
-
* output(note);
|
|
39
|
-
* });
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
declare function command(name: string): CommandBuilder;
|
|
43
|
-
export { createCLI, command, FlagPreset, CommandFlags, CommandConfig, CommandBuilder, CommandAction, CLIConfig, CLI };
|
|
1
|
+
import { CommandMetadata, command, createCLI } from "./shared/@outfitter/cli-xde45xcc.js";
|
|
2
|
+
import { AnyPreset, CLI, CLIConfig, CommandAction, CommandBuilder, CommandConfig, CommandFlags, ContextFactory, ErrorHintFn, FlagPreset, RelatedToDeclaration, RelatedToOptions, SchemaPreset, SuccessHintFn, ZodObjectLike } from "./shared/@outfitter/cli-x6qr7bnd.js";
|
|
3
|
+
export { createCLI, command, ZodObjectLike, SuccessHintFn, SchemaPreset, RelatedToOptions, RelatedToDeclaration, FlagPreset, ErrorHintFn, ContextFactory, CommandMetadata, CommandFlags, CommandConfig, CommandBuilder, CommandAction, CLIConfig, CLI, AnyPreset };
|