@outfitter/cli 0.3.0 → 0.4.1
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 +48 -4
- package/dist/actions.js +0 -2
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +1 -2
- package/dist/{render → colors}/colors.d.ts +1 -1
- package/dist/{render → colors}/colors.js +2 -6
- package/dist/colors/index.d.ts +1 -1
- package/dist/colors/index.js +3 -4
- package/dist/command.d.ts +2 -2
- package/dist/command.js +11 -2
- package/dist/completion.d.ts +36 -0
- package/dist/completion.js +91 -0
- package/dist/flags.d.ts +167 -0
- package/dist/flags.js +31 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -4
- package/dist/input.d.ts +3 -26
- package/dist/input.js +1 -31
- package/dist/output.d.ts +2 -2
- package/dist/output.js +0 -1
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.js +0 -2
- package/dist/query.d.ts +50 -0
- package/dist/query.js +51 -0
- package/dist/shared/@outfitter/cli-b2zk8fb3.js +357 -0
- package/dist/shared/@outfitter/{cli-d9ad0rqj.js → cli-jbj78ac5.js} +1 -6
- package/dist/shared/@outfitter/{cli-e6yv2764.d.ts → cli-k0yvzn6d.d.ts} +1 -1
- package/dist/shared/@outfitter/{cli-ttt7r0j7.d.ts → cli-md9347gn.d.ts} +155 -13
- package/dist/shared/@outfitter/{cli-5g6rkv3d.js → cli-rk9zagkm.js} +24 -32
- package/dist/shared/@outfitter/{cli-4h4rpdra.js → cli-zahqsaby.js} +32 -10
- package/dist/terminal/detection.js +1 -5
- package/dist/terminal/index.js +1 -6
- package/dist/{shared/@outfitter/cli-4cb5g831.d.ts → text.d.ts} +1 -1
- package/dist/{shared/@outfitter/cli-mwxsh3sr.js → text.js} +15 -14
- package/dist/types.d.ts +2 -2
- package/dist/types.js +0 -2
- package/dist/verbs.d.ts +50 -0
- package/dist/verbs.js +61 -0
- package/package.json +50 -204
- package/dist/borders/index.d.ts +0 -3
- package/dist/borders/index.js +0 -13
- package/dist/box/index.d.ts +0 -4
- package/dist/box/index.js +0 -13
- package/dist/demo/index.d.ts +0 -78
- package/dist/demo/index.js +0 -148
- package/dist/demo/registry.d.ts +0 -7
- package/dist/demo/registry.js +0 -28
- package/dist/demo/renderers/borders.d.ts +0 -7
- package/dist/demo/renderers/borders.js +0 -17
- package/dist/demo/renderers/box.d.ts +0 -7
- package/dist/demo/renderers/box.js +0 -18
- package/dist/demo/renderers/colors.d.ts +0 -7
- package/dist/demo/renderers/colors.js +0 -18
- package/dist/demo/renderers/indicators.d.ts +0 -7
- package/dist/demo/renderers/indicators.js +0 -17
- package/dist/demo/renderers/list.d.ts +0 -7
- package/dist/demo/renderers/list.js +0 -19
- package/dist/demo/renderers/markdown.d.ts +0 -7
- package/dist/demo/renderers/markdown.js +0 -18
- package/dist/demo/renderers/progress.d.ts +0 -7
- package/dist/demo/renderers/progress.js +0 -17
- package/dist/demo/renderers/spinner.d.ts +0 -7
- package/dist/demo/renderers/spinner.js +0 -19
- package/dist/demo/renderers/table.d.ts +0 -7
- package/dist/demo/renderers/table.js +0 -19
- package/dist/demo/renderers/text.d.ts +0 -7
- package/dist/demo/renderers/text.js +0 -16
- package/dist/demo/renderers/tree.d.ts +0 -7
- package/dist/demo/renderers/tree.js +0 -18
- package/dist/demo/section.d.ts +0 -5
- package/dist/demo/section.js +0 -23
- package/dist/demo/templates.d.ts +0 -4
- package/dist/demo/templates.js +0 -10
- package/dist/demo/types.d.ts +0 -3
- package/dist/demo/types.js +0 -8
- package/dist/list/index.d.ts +0 -3
- package/dist/list/index.js +0 -9
- package/dist/preset/full.d.ts +0 -14
- package/dist/preset/full.js +0 -41
- package/dist/preset/standard.d.ts +0 -11
- package/dist/preset/standard.js +0 -30
- package/dist/prompt/confirm.d.ts +0 -4
- package/dist/prompt/confirm.js +0 -9
- package/dist/prompt/group.d.ts +0 -4
- package/dist/prompt/group.js +0 -9
- package/dist/prompt/index.d.ts +0 -7
- package/dist/prompt/index.js +0 -32
- package/dist/prompt/select.d.ts +0 -4
- package/dist/prompt/select.js +0 -11
- package/dist/prompt/text.d.ts +0 -4
- package/dist/prompt/text.js +0 -11
- package/dist/prompt/types.d.ts +0 -3
- package/dist/prompt/types.js +0 -8
- package/dist/prompt/validators.d.ts +0 -2
- package/dist/prompt/validators.js +0 -8
- package/dist/render/borders.d.ts +0 -2
- package/dist/render/borders.js +0 -15
- package/dist/render/box.d.ts +0 -3
- package/dist/render/box.js +0 -23
- package/dist/render/date.d.ts +0 -2
- package/dist/render/date.js +0 -12
- package/dist/render/format-relative.d.ts +0 -2
- package/dist/render/format-relative.js +0 -8
- package/dist/render/format.d.ts +0 -2
- package/dist/render/format.js +0 -10
- package/dist/render/heading.d.ts +0 -3
- package/dist/render/heading.js +0 -14
- package/dist/render/index.d.ts +0 -32
- package/dist/render/index.js +0 -235
- package/dist/render/indicators.d.ts +0 -2
- package/dist/render/indicators.js +0 -16
- package/dist/render/json.d.ts +0 -2
- package/dist/render/json.js +0 -10
- package/dist/render/layout.d.ts +0 -5
- package/dist/render/layout.js +0 -25
- package/dist/render/list.d.ts +0 -2
- package/dist/render/list.js +0 -8
- package/dist/render/markdown.d.ts +0 -2
- package/dist/render/markdown.js +0 -10
- package/dist/render/progress.d.ts +0 -2
- package/dist/render/progress.js +0 -8
- package/dist/render/separator.d.ts +0 -3
- package/dist/render/separator.js +0 -14
- package/dist/render/shapes.d.ts +0 -2
- package/dist/render/shapes.js +0 -35
- package/dist/render/spinner.d.ts +0 -2
- package/dist/render/spinner.js +0 -12
- package/dist/render/stack.d.ts +0 -3
- package/dist/render/stack.js +0 -38
- package/dist/render/table.d.ts +0 -3
- package/dist/render/table.js +0 -12
- package/dist/render/text.d.ts +0 -2
- package/dist/render/text.js +0 -27
- package/dist/render/tree.d.ts +0 -2
- package/dist/render/tree.js +0 -10
- package/dist/render/types.d.ts +0 -2
- package/dist/shared/@outfitter/cli-0djg8q91.js +0 -7
- package/dist/shared/@outfitter/cli-0w242qtv.d.ts +0 -48
- package/dist/shared/@outfitter/cli-1g8tt31a.d.ts +0 -119
- package/dist/shared/@outfitter/cli-1kwbnt86.d.ts +0 -45
- package/dist/shared/@outfitter/cli-1sb3xvnw.js +0 -95
- package/dist/shared/@outfitter/cli-1vy0vtga.js +0 -135
- package/dist/shared/@outfitter/cli-2g8bx1aq.d.ts +0 -50
- package/dist/shared/@outfitter/cli-33e97cjs.d.ts +0 -42
- package/dist/shared/@outfitter/cli-3b7ed3rm.d.ts +0 -97
- package/dist/shared/@outfitter/cli-3hk2xf3c.js +0 -82
- package/dist/shared/@outfitter/cli-3hp8qwx3.js +0 -11
- package/dist/shared/@outfitter/cli-47yw5h6a.js +0 -7
- package/dist/shared/@outfitter/cli-4b6tbp68.d.ts +0 -36
- package/dist/shared/@outfitter/cli-4fcz51qa.js +0 -70
- package/dist/shared/@outfitter/cli-4x6pqnez.js +0 -20
- package/dist/shared/@outfitter/cli-4zk2y4a2.d.ts +0 -61
- package/dist/shared/@outfitter/cli-60b5xh1r.js +0 -20
- package/dist/shared/@outfitter/cli-6bztk73z.d.ts +0 -51
- package/dist/shared/@outfitter/cli-6fxffp8k.js +0 -1
- package/dist/shared/@outfitter/cli-6hg0sg2d.d.ts +0 -93
- package/dist/shared/@outfitter/cli-6r3m2knf.js +0 -62
- package/dist/shared/@outfitter/cli-6ty1nvws.js +0 -179
- package/dist/shared/@outfitter/cli-7n610r63.js +0 -20
- package/dist/shared/@outfitter/cli-7na6p4fs.d.ts +0 -59
- package/dist/shared/@outfitter/cli-83jwvj1t.d.ts +0 -17
- package/dist/shared/@outfitter/cli-85fg2vr5.js +0 -123
- package/dist/shared/@outfitter/cli-8bwaw3pz.js +0 -7
- package/dist/shared/@outfitter/cli-8hngbjyr.d.ts +0 -164
- package/dist/shared/@outfitter/cli-8j5k6mr3.js +0 -71
- package/dist/shared/@outfitter/cli-8xsmsbbd.d.ts +0 -223
- package/dist/shared/@outfitter/cli-914d47mt.js +0 -20
- package/dist/shared/@outfitter/cli-9bcm4zhf.d.ts +0 -87
- package/dist/shared/@outfitter/cli-9khk3cbq.d.ts +0 -190
- package/dist/shared/@outfitter/cli-a4q87517.d.ts +0 -64
- package/dist/shared/@outfitter/cli-aem6v4c8.js +0 -146
- package/dist/shared/@outfitter/cli-b0tzqgnf.d.ts +0 -132
- package/dist/shared/@outfitter/cli-b5c2k0d7.js +0 -39
- package/dist/shared/@outfitter/cli-b5epywry.js +0 -1
- package/dist/shared/@outfitter/cli-bc17qeh2.js +0 -19
- package/dist/shared/@outfitter/cli-bcmcaz1b.js +0 -23
- package/dist/shared/@outfitter/cli-bv09nme3.d.ts +0 -56
- package/dist/shared/@outfitter/cli-c6pbxpw0.d.ts +0 -112
- package/dist/shared/@outfitter/cli-c8fqdaes.js +0 -117
- package/dist/shared/@outfitter/cli-c8q4f71g.js +0 -144
- package/dist/shared/@outfitter/cli-c9knfqn5.d.ts +0 -30
- package/dist/shared/@outfitter/cli-cf1xexgn.d.ts +0 -53
- package/dist/shared/@outfitter/cli-cf2s94s1.d.ts +0 -42
- package/dist/shared/@outfitter/cli-cwgj6mcs.js +0 -214
- package/dist/shared/@outfitter/cli-d8ahdd9d.js +0 -272
- package/dist/shared/@outfitter/cli-dbyteh27.d.ts +0 -24
- package/dist/shared/@outfitter/cli-e5ms1y0x.d.ts +0 -91
- package/dist/shared/@outfitter/cli-en6zn6sj.js +0 -1
- package/dist/shared/@outfitter/cli-evx7qcp1.d.ts +0 -300
- package/dist/shared/@outfitter/cli-f6fsaayd.js +0 -94
- package/dist/shared/@outfitter/cli-fakncnjp.d.ts +0 -106
- package/dist/shared/@outfitter/cli-ffa0jwb7.js +0 -122
- package/dist/shared/@outfitter/cli-h20jc0bs.d.ts +0 -66
- package/dist/shared/@outfitter/cli-h3jz0bxz.js +0 -48
- package/dist/shared/@outfitter/cli-h4wpzb3f.js +0 -67
- package/dist/shared/@outfitter/cli-hda6mc28.js +0 -126
- package/dist/shared/@outfitter/cli-hnpbqmc8.d.ts +0 -328
- package/dist/shared/@outfitter/cli-j19a91ck.js +0 -30
- package/dist/shared/@outfitter/cli-jejfypgf.js +0 -85
- package/dist/shared/@outfitter/cli-jp0k3qd9.js +0 -279
- package/dist/shared/@outfitter/cli-k76e7173.js +0 -128
- package/dist/shared/@outfitter/cli-kc3ffp1v.d.ts +0 -23
- package/dist/shared/@outfitter/cli-kk5hnndk.d.ts +0 -128
- package/dist/shared/@outfitter/cli-ktqme80d.js +0 -7
- package/dist/shared/@outfitter/cli-mq0jp15z.js +0 -1
- package/dist/shared/@outfitter/cli-n0c33vba.js +0 -25
- package/dist/shared/@outfitter/cli-n17gt1dz.js +0 -19
- package/dist/shared/@outfitter/cli-n9dbh0hp.js +0 -51
- package/dist/shared/@outfitter/cli-ndem6tz8.js +0 -63
- package/dist/shared/@outfitter/cli-nj4nqy1h.d.ts +0 -24
- package/dist/shared/@outfitter/cli-nkns8p4r.js +0 -61
- package/dist/shared/@outfitter/cli-p3dqm1vd.js +0 -22
- package/dist/shared/@outfitter/cli-pndwprz8.js +0 -118
- package/dist/shared/@outfitter/cli-pvrwv6rb.js +0 -352
- package/dist/shared/@outfitter/cli-py02m79x.d.ts +0 -20
- package/dist/shared/@outfitter/cli-qj83y5wj.d.ts +0 -71
- package/dist/shared/@outfitter/cli-regjbef6.d.ts +0 -26
- package/dist/shared/@outfitter/cli-s1tx5kha.d.ts +0 -59
- package/dist/shared/@outfitter/cli-sam2sq50.js +0 -37
- package/dist/shared/@outfitter/cli-snxj55n6.js +0 -43
- package/dist/shared/@outfitter/cli-symyxb0z.js +0 -20
- package/dist/shared/@outfitter/cli-tvw1xrdj.js +0 -20
- package/dist/shared/@outfitter/cli-v1tzwxkt.js +0 -32
- package/dist/shared/@outfitter/cli-vd60dj65.js +0 -1
- package/dist/shared/@outfitter/cli-vfcrskfj.d.ts +0 -41
- package/dist/shared/@outfitter/cli-vstbkzky.d.ts +0 -74
- package/dist/shared/@outfitter/cli-vtg0sqk2.d.ts +0 -54
- package/dist/shared/@outfitter/cli-x4cavvc0.js +0 -1
- package/dist/shared/@outfitter/cli-xep6v2c0.js +0 -52
- package/dist/shared/@outfitter/cli-xg5y5fhk.js +0 -86
- package/dist/shared/@outfitter/cli-y7k1t81k.js +0 -30
- package/dist/shared/@outfitter/cli-yfyzy95c.js +0 -67
- package/dist/shared/@outfitter/cli-z78mkrc7.js +0 -59
- package/dist/shared/@outfitter/cli-znc47004.js +0 -134
- package/dist/shared/@outfitter/cli-zx598p8q.d.ts +0 -26
- package/dist/streaming/ansi.d.ts +0 -2
- package/dist/streaming/ansi.js +0 -8
- package/dist/streaming/index.d.ts +0 -4
- package/dist/streaming/index.js +0 -17
- package/dist/streaming/spinner.d.ts +0 -3
- package/dist/streaming/spinner.js +0 -10
- package/dist/streaming/writer.d.ts +0 -2
- package/dist/streaming/writer.js +0 -9
- package/dist/table/index.d.ts +0 -4
- package/dist/table/index.js +0 -13
- package/dist/theme/context.d.ts +0 -9
- package/dist/theme/context.js +0 -14
- package/dist/theme/create.d.ts +0 -8
- package/dist/theme/create.js +0 -12
- package/dist/theme/index.d.ts +0 -17
- package/dist/theme/index.js +0 -42
- package/dist/theme/presets/bold.d.ts +0 -8
- package/dist/theme/presets/bold.js +0 -12
- package/dist/theme/presets/default.d.ts +0 -8
- package/dist/theme/presets/default.js +0 -11
- package/dist/theme/presets/index.d.ts +0 -12
- package/dist/theme/presets/index.js +0 -24
- package/dist/theme/presets/minimal.d.ts +0 -8
- package/dist/theme/presets/minimal.js +0 -12
- package/dist/theme/presets/rounded.d.ts +0 -8
- package/dist/theme/presets/rounded.js +0 -12
- package/dist/theme/resolve.d.ts +0 -8
- package/dist/theme/resolve.js +0 -11
- package/dist/theme/types.d.ts +0 -7
- package/dist/theme/types.js +0 -1
- package/dist/tree/index.d.ts +0 -3
- package/dist/tree/index.js +0 -11
- /package/dist/shared/@outfitter/{cli-ykxn7rb2.d.ts → cli-xppg982q.d.ts} +0 -0
- /package/dist/{render/types.js → shared/@outfitter/cli-zw75pdk8.js} +0 -0
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ if (cursor) {
|
|
|
36
36
|
|
|
37
37
|
Output data to the console with automatic mode selection.
|
|
38
38
|
|
|
39
|
-
Defaults to human-friendly output
|
|
39
|
+
Defaults to human-friendly output. Override via `mode` option or `OUTFITTER_JSON`/`OUTFITTER_JSONL` environment variables.
|
|
40
40
|
|
|
41
41
|
```typescript
|
|
42
42
|
import { output } from "@outfitter/cli/output";
|
|
@@ -278,10 +278,10 @@ if (result.isOk()) {
|
|
|
278
278
|
|
|
279
279
|
#### `confirmDestructive(options)`
|
|
280
280
|
|
|
281
|
-
|
|
281
|
+
> **Moved to `@outfitter/tui`** -- This function is now exported from `@outfitter/tui/confirm`. Update your imports accordingly.
|
|
282
282
|
|
|
283
283
|
```typescript
|
|
284
|
-
import { confirmDestructive } from "@outfitter/
|
|
284
|
+
import { confirmDestructive } from "@outfitter/tui/confirm";
|
|
285
285
|
|
|
286
286
|
const result = await confirmDestructive({
|
|
287
287
|
message: "Delete 5 notes?",
|
|
@@ -361,6 +361,31 @@ if (flags.reset) {
|
|
|
361
361
|
}
|
|
362
362
|
```
|
|
363
363
|
|
|
364
|
+
## Conventions
|
|
365
|
+
|
|
366
|
+
Composable flag presets provide typed, reusable CLI flag definitions. See the [full conventions guide](../../docs/CLI-CONVENTIONS.md) for the complete catalog.
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
import { composePresets, verbosePreset, cwdPreset, forcePreset } from "@outfitter/cli/flags";
|
|
370
|
+
import { outputModePreset } from "@outfitter/cli/query";
|
|
371
|
+
|
|
372
|
+
const preset = composePresets(verbosePreset(), cwdPreset(), forcePreset());
|
|
373
|
+
|
|
374
|
+
command("deploy")
|
|
375
|
+
.preset(preset)
|
|
376
|
+
.action(async ({ flags }) => {
|
|
377
|
+
const { verbose, cwd, force } = preset.resolve(flags);
|
|
378
|
+
// All typed, all composable
|
|
379
|
+
});
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
**Available presets:** `verbosePreset`, `cwdPreset`, `dryRunPreset`, `forcePreset`, `interactionPreset`, `strictPreset`, `colorPreset`, `projectionPreset`, `paginationPreset`, `timeWindowPreset`, `executionPreset`, `outputModePreset`, `jqPreset`
|
|
383
|
+
|
|
384
|
+
**Additional modules:**
|
|
385
|
+
- `@outfitter/cli/verbs` — Standard verb families (`create`, `modify`, `remove`, `list`, `show`)
|
|
386
|
+
- `@outfitter/cli/query` — Output mode and jq expression presets
|
|
387
|
+
- `@outfitter/cli/completion` — Shell completion script generation
|
|
388
|
+
|
|
364
389
|
## Configuration
|
|
365
390
|
|
|
366
391
|
### Environment Variables
|
|
@@ -395,13 +420,28 @@ const isVerbose = resolveVerbose();
|
|
|
395
420
|
const isVerbose = resolveVerbose(cliFlags.verbose);
|
|
396
421
|
```
|
|
397
422
|
|
|
423
|
+
### JSON Output
|
|
424
|
+
|
|
425
|
+
`createCLI()` registers a global `--json` flag that bridges to `OUTFITTER_JSON=1` via a `preAction` hook. This means `output()` auto-detects JSON mode — no manual `if (json)` branching needed:
|
|
426
|
+
|
|
427
|
+
```typescript
|
|
428
|
+
// No need for this:
|
|
429
|
+
if (opts.json) output(data, { mode: "json" });
|
|
430
|
+
else output(data);
|
|
431
|
+
|
|
432
|
+
// Just use output() directly — it reads OUTFITTER_JSON:
|
|
433
|
+
output(data);
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
The bridge uses `optsWithGlobals()` so global and subcommand `--json` flags both work and coalesce into a single env var. Subcommands should **not** define their own `--json` — use the global flag. If they do, both coalesce safely.
|
|
437
|
+
|
|
398
438
|
### Output Mode Priority
|
|
399
439
|
|
|
400
440
|
1. Explicit `mode` option in `output()` call
|
|
401
441
|
2. `OUTFITTER_JSONL=1` environment variable (highest env priority)
|
|
402
442
|
3. `OUTFITTER_JSON=1` environment variable
|
|
403
443
|
4. `OUTFITTER_JSON=0` or `OUTFITTER_JSONL=0` forces human mode
|
|
404
|
-
5.
|
|
444
|
+
5. Default fallback: `human`
|
|
405
445
|
|
|
406
446
|
## Error Handling
|
|
407
447
|
|
|
@@ -444,6 +484,10 @@ import type { CollectIdsOptions, ExpandFileOptions, ParseGlobOptions } from "@ou
|
|
|
444
484
|
import type { PaginationState, CursorOptions } from "@outfitter/cli/pagination";
|
|
445
485
|
```
|
|
446
486
|
|
|
487
|
+
## Upgrading
|
|
488
|
+
|
|
489
|
+
Run `outfitter update --guide` for version-specific migration instructions, or check the [migration docs](https://github.com/outfitter-dev/outfitter/tree/main/plugins/outfitter/shared/migrations) for detailed upgrade steps.
|
|
490
|
+
|
|
447
491
|
## License
|
|
448
492
|
|
|
449
493
|
MIT
|
package/dist/actions.js
CHANGED
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ANSI, ColorName, Theme, TokenOptions, Tokens, applyColor, createTheme, createTokens, resolveTokenColorEnabled } from "../shared/@outfitter/cli-
|
|
1
|
+
import { ANSI, ColorName, Theme, TokenOptions, Tokens, applyColor, createTheme, createTokens, resolveTokenColorEnabled } from "../shared/@outfitter/cli-xppg982q";
|
|
2
2
|
export { resolveTokenColorEnabled, createTokens, createTheme, applyColor, Tokens, TokenOptions, Theme, ColorName, ANSI };
|
|
@@ -4,13 +4,9 @@ import {
|
|
|
4
4
|
applyColor,
|
|
5
5
|
createTheme,
|
|
6
6
|
createTokens,
|
|
7
|
-
init_colors,
|
|
8
7
|
resolveTokenColorEnabled
|
|
9
|
-
} from "../shared/@outfitter/cli-
|
|
10
|
-
import"../shared/@outfitter/cli-
|
|
11
|
-
import"../shared/@outfitter/cli-v1tzwxkt.js";
|
|
12
|
-
init_colors();
|
|
13
|
-
|
|
8
|
+
} from "../shared/@outfitter/cli-rk9zagkm.js";
|
|
9
|
+
import"../shared/@outfitter/cli-jbj78ac5.js";
|
|
14
10
|
export {
|
|
15
11
|
resolveTokenColorEnabled,
|
|
16
12
|
createTokens,
|
package/dist/colors/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "../shared/@outfitter/cli-qz47jk6d";
|
|
2
|
-
import { ANSI, ColorName, Theme, TokenOptions, Tokens, applyColor, createTheme, createTokens, resolveTokenColorEnabled } from "../shared/@outfitter/cli-
|
|
2
|
+
import { ANSI, ColorName, Theme, TokenOptions, Tokens, applyColor, createTheme, createTokens, resolveTokenColorEnabled } from "../shared/@outfitter/cli-xppg982q";
|
|
3
3
|
export { resolveTokenColorEnabled, createTokens, createTheme, applyColor, Tokens, TokenOptions, Theme, ColorName, ANSI };
|
package/dist/colors/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../shared/@outfitter/cli-
|
|
2
|
+
import"../shared/@outfitter/cli-zw75pdk8.js";
|
|
3
3
|
import {
|
|
4
4
|
ANSI,
|
|
5
5
|
applyColor,
|
|
6
6
|
createTheme,
|
|
7
7
|
createTokens,
|
|
8
8
|
resolveTokenColorEnabled
|
|
9
|
-
} from "../shared/@outfitter/cli-
|
|
10
|
-
import"../shared/@outfitter/cli-
|
|
11
|
-
import"../shared/@outfitter/cli-v1tzwxkt.js";
|
|
9
|
+
} from "../shared/@outfitter/cli-rk9zagkm.js";
|
|
10
|
+
import"../shared/@outfitter/cli-jbj78ac5.js";
|
|
12
11
|
export {
|
|
13
12
|
resolveTokenColorEnabled,
|
|
14
13
|
createTokens,
|
package/dist/command.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CLI, CLIConfig, CommandAction, CommandBuilder, CommandConfig, CommandFlags } from "./shared/@outfitter/cli-
|
|
1
|
+
import { CLI, CLIConfig, CommandAction, CommandBuilder, CommandConfig, CommandFlags, FlagPreset } from "./shared/@outfitter/cli-md9347gn";
|
|
2
2
|
/**
|
|
3
3
|
* Create a CLI instance with a portable return type from this module.
|
|
4
4
|
*/
|
|
@@ -40,4 +40,4 @@ declare function createCLI(config: CLIConfig): CLI;
|
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
42
|
declare function command(name: string): CommandBuilder;
|
|
43
|
-
export { createCLI, command, CommandFlags, CommandConfig, CommandBuilder, CommandAction, CLIConfig, CLI };
|
|
43
|
+
export { createCLI, command, FlagPreset, CommandFlags, CommandConfig, CommandBuilder, CommandAction, CLIConfig, CLI };
|
package/dist/command.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
createCLI
|
|
4
|
-
} from "./shared/@outfitter/cli-
|
|
5
|
-
import"./shared/@outfitter/cli-v1tzwxkt.js";
|
|
4
|
+
} from "./shared/@outfitter/cli-zahqsaby.js";
|
|
6
5
|
|
|
7
6
|
// packages/cli/src/command.ts
|
|
8
7
|
import { Command } from "commander";
|
|
@@ -48,6 +47,16 @@ class CommandBuilderImpl {
|
|
|
48
47
|
this.command.alias(alias);
|
|
49
48
|
return this;
|
|
50
49
|
}
|
|
50
|
+
preset(preset) {
|
|
51
|
+
for (const opt of preset.options) {
|
|
52
|
+
if (opt.required) {
|
|
53
|
+
this.command.requiredOption(opt.flags, opt.description, opt.defaultValue);
|
|
54
|
+
} else {
|
|
55
|
+
this.command.option(opt.flags, opt.description, opt.defaultValue);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
51
60
|
action(handler) {
|
|
52
61
|
this.command.action(async (...args) => {
|
|
53
62
|
const command = args.at(-1);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for the completion command.
|
|
4
|
+
*/
|
|
5
|
+
interface CompletionConfig {
|
|
6
|
+
/** Supported shells (default: bash, zsh, fish) */
|
|
7
|
+
readonly shells?: readonly ("bash" | "zsh" | "fish")[];
|
|
8
|
+
/** Program name for completion scripts (inferred from CLI name if not provided) */
|
|
9
|
+
readonly programName?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Generate a completion script for the given shell.
|
|
13
|
+
*
|
|
14
|
+
* @param shell - Target shell
|
|
15
|
+
* @param programName - CLI program name
|
|
16
|
+
* @returns The completion script string, or undefined for unsupported shells
|
|
17
|
+
*/
|
|
18
|
+
declare function generateCompletion(shell: string, programName: string): string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Create a `completion <shell>` command that outputs install-ready
|
|
21
|
+
* completion scripts.
|
|
22
|
+
*
|
|
23
|
+
* @param config - Optional configuration
|
|
24
|
+
* @returns A Commander command instance
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import { createCLI } from "@outfitter/cli";
|
|
29
|
+
* import { createCompletionCommand } from "@outfitter/cli/completion";
|
|
30
|
+
*
|
|
31
|
+
* const cli = createCLI({ name: "mycli", version: "1.0.0" });
|
|
32
|
+
* cli.register(createCompletionCommand({ programName: "mycli" }));
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare function createCompletionCommand(config?: CompletionConfig): Command;
|
|
36
|
+
export { generateCompletion, createCompletionCommand, CompletionConfig };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/cli/src/completion.ts
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
var SHELL_SAFE_PROGRAM_NAME = /^[A-Za-z0-9._-]+$/;
|
|
5
|
+
function assertSafeProgramName(programName) {
|
|
6
|
+
if (SHELL_SAFE_PROGRAM_NAME.test(programName))
|
|
7
|
+
return;
|
|
8
|
+
throw new Error(`Invalid program name for shell completion: "${programName}".` + " Must match /^[A-Za-z0-9._-]+$/.");
|
|
9
|
+
}
|
|
10
|
+
function toShellIdentifier(programName) {
|
|
11
|
+
assertSafeProgramName(programName);
|
|
12
|
+
return programName.replaceAll(/[^A-Za-z0-9_]/g, "_");
|
|
13
|
+
}
|
|
14
|
+
function generateBashCompletion(programName) {
|
|
15
|
+
assertSafeProgramName(programName);
|
|
16
|
+
const shellIdentifier = toShellIdentifier(programName);
|
|
17
|
+
return `# bash completion for ${programName}
|
|
18
|
+
# Add to ~/.bashrc or ~/.bash_profile:
|
|
19
|
+
# eval "$(${programName} completion bash)"
|
|
20
|
+
|
|
21
|
+
_${shellIdentifier}_completions() {
|
|
22
|
+
local cur
|
|
23
|
+
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
24
|
+
|
|
25
|
+
COMPREPLY=( $(compgen -W "$(${programName} --help 2>/dev/null | grep -oE '^ [a-z][-a-z]*' | tr -d ' ')" -- "\${cur}") )
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
complete -F _${shellIdentifier}_completions ${programName}
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
31
|
+
function generateZshCompletion(programName) {
|
|
32
|
+
assertSafeProgramName(programName);
|
|
33
|
+
const shellIdentifier = toShellIdentifier(programName);
|
|
34
|
+
return `#compdef ${programName}
|
|
35
|
+
# zsh completion for ${programName}
|
|
36
|
+
# Add to ~/.zshrc:
|
|
37
|
+
# eval "$(${programName} completion zsh)"
|
|
38
|
+
|
|
39
|
+
_${shellIdentifier}() {
|
|
40
|
+
local -a commands
|
|
41
|
+
commands=($(${programName} --help 2>/dev/null | grep -oE '^ [a-z][-a-z]*' | tr -d ' '))
|
|
42
|
+
|
|
43
|
+
_arguments \\
|
|
44
|
+
'1:command:compadd -a commands' \\
|
|
45
|
+
'*::arg:->args'
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
compdef _${shellIdentifier} ${programName}
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
function generateFishCompletion(programName) {
|
|
52
|
+
assertSafeProgramName(programName);
|
|
53
|
+
return `# fish completion for ${programName}
|
|
54
|
+
# Add to ~/.config/fish/completions/${programName}.fish:
|
|
55
|
+
# ${programName} completion fish > ~/.config/fish/completions/${programName}.fish
|
|
56
|
+
|
|
57
|
+
complete -c ${programName} -f
|
|
58
|
+
complete -c ${programName} -n "__fish_use_subcommand" -a "(${programName} --help 2>/dev/null | string match -r '^ [a-z][-a-z]*' | string trim)"
|
|
59
|
+
`;
|
|
60
|
+
}
|
|
61
|
+
var GENERATORS = {
|
|
62
|
+
bash: generateBashCompletion,
|
|
63
|
+
zsh: generateZshCompletion,
|
|
64
|
+
fish: generateFishCompletion
|
|
65
|
+
};
|
|
66
|
+
function generateCompletion(shell, programName) {
|
|
67
|
+
const generator = Object.hasOwn(GENERATORS, shell) ? GENERATORS[shell] : undefined;
|
|
68
|
+
return generator?.(programName);
|
|
69
|
+
}
|
|
70
|
+
function createCompletionCommand(config) {
|
|
71
|
+
const shells = config?.shells ?? ["bash", "zsh", "fish"];
|
|
72
|
+
const shellSet = new Set(shells);
|
|
73
|
+
const cmd = new Command("completion").description(`Generate shell completion script (${shells.join(", ")})`).argument("<shell>", `Shell type (${shells.join(", ")})`).action((shell) => {
|
|
74
|
+
if (!shellSet.has(shell)) {
|
|
75
|
+
cmd.error(`error: unsupported shell '${shell}'. Supported: ${shells.join(", ")}`);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const generator = GENERATORS[shell];
|
|
79
|
+
if (generator) {
|
|
80
|
+
const programName = config?.programName ?? cmd.parent?.name() ?? "program";
|
|
81
|
+
assertSafeProgramName(programName);
|
|
82
|
+
const script = generator(programName);
|
|
83
|
+
process.stdout.write(script);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
return cmd;
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
generateCompletion,
|
|
90
|
+
createCompletionCommand
|
|
91
|
+
};
|
package/dist/flags.d.ts
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { ColorFlags, ColorMode, ComposedPreset, ExecutionFlags, ExecutionPresetConfig, FlagPreset, FlagPresetConfig, InteractionFlags, PaginationFlags, PaginationPresetConfig, ProjectionFlags, StrictFlags, TimeWindowFlags, TimeWindowPresetConfig } from "./shared/@outfitter/cli-md9347gn";
|
|
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
|
+
* Verbose output flag preset.
|
|
48
|
+
*
|
|
49
|
+
* Adds: `-v, --verbose`
|
|
50
|
+
* Resolves: `{ verbose: boolean }`
|
|
51
|
+
*/
|
|
52
|
+
declare function verbosePreset(): FlagPreset<{
|
|
53
|
+
verbose: boolean;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Working directory flag preset.
|
|
57
|
+
*
|
|
58
|
+
* Adds: `--cwd <path>`
|
|
59
|
+
* Resolves: `{ cwd: string }` (defaults to `process.cwd()`)
|
|
60
|
+
*/
|
|
61
|
+
declare function cwdPreset(): FlagPreset<{
|
|
62
|
+
cwd: string;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Dry-run flag preset.
|
|
66
|
+
*
|
|
67
|
+
* Adds: `--dry-run`
|
|
68
|
+
* Resolves: `{ dryRun: boolean }`
|
|
69
|
+
*/
|
|
70
|
+
declare function dryRunPreset(): FlagPreset<{
|
|
71
|
+
dryRun: boolean;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* Force flag preset.
|
|
75
|
+
*
|
|
76
|
+
* Adds: `-f, --force`
|
|
77
|
+
* Resolves: `{ force: boolean }`
|
|
78
|
+
*/
|
|
79
|
+
declare function forcePreset(): FlagPreset<{
|
|
80
|
+
force: boolean;
|
|
81
|
+
}>;
|
|
82
|
+
/**
|
|
83
|
+
* Interaction mode flag preset.
|
|
84
|
+
*
|
|
85
|
+
* Adds: `--non-interactive`, `--no-input`, `-y, --yes`
|
|
86
|
+
* Resolves: `{ interactive: boolean, yes: boolean }`
|
|
87
|
+
*
|
|
88
|
+
* `interactive` defaults to `true` and is set to `false` when
|
|
89
|
+
* `--non-interactive` or `--no-input` is passed. The two flags
|
|
90
|
+
* are synonyms for user convenience.
|
|
91
|
+
*/
|
|
92
|
+
declare function interactionPreset(): FlagPreset<InteractionFlags>;
|
|
93
|
+
/**
|
|
94
|
+
* Strict mode flag preset.
|
|
95
|
+
*
|
|
96
|
+
* Adds: `--strict`
|
|
97
|
+
* Resolves: `{ strict: boolean }`
|
|
98
|
+
*/
|
|
99
|
+
declare function strictPreset(): FlagPreset<StrictFlags>;
|
|
100
|
+
/**
|
|
101
|
+
* Color mode flag preset.
|
|
102
|
+
*
|
|
103
|
+
* Adds: `--color [mode]`, `--no-color`
|
|
104
|
+
* Resolves: `{ color: "auto" | "always" | "never" }`
|
|
105
|
+
*
|
|
106
|
+
* Commander's `--no-color` negation sets `flags["color"]` to `false`,
|
|
107
|
+
* which resolves to `"never"`. Invalid values default to `"auto"`.
|
|
108
|
+
*
|
|
109
|
+
* This preset resolves the user's *intent*. Consumers should compose
|
|
110
|
+
* with terminal detection (`supportsColor()`, `resolveColorEnv()`)
|
|
111
|
+
* to determine actual color output behavior.
|
|
112
|
+
*/
|
|
113
|
+
declare function colorPreset(): FlagPreset<ColorFlags>;
|
|
114
|
+
/**
|
|
115
|
+
* Projection flag preset.
|
|
116
|
+
*
|
|
117
|
+
* Adds: `--fields <fields>`, `--exclude-fields <fields>`, `--count`
|
|
118
|
+
* Resolves: `{ fields: string[] | undefined, excludeFields: string[] | undefined, count: boolean }`
|
|
119
|
+
*
|
|
120
|
+
* Fields are parsed as comma-separated strings with whitespace trimming.
|
|
121
|
+
* `undefined` when not provided (not empty array) to distinguish
|
|
122
|
+
* "not specified" from "empty".
|
|
123
|
+
*
|
|
124
|
+
* Conflict between `--fields` and `--exclude-fields` is a handler
|
|
125
|
+
* concern (documented, not enforced).
|
|
126
|
+
*/
|
|
127
|
+
declare function projectionPreset(): FlagPreset<ProjectionFlags>;
|
|
128
|
+
/**
|
|
129
|
+
* Time-window flag preset.
|
|
130
|
+
*
|
|
131
|
+
* Adds: `--since <date>`, `--until <date>`
|
|
132
|
+
* Resolves: `{ since: Date | undefined, until: Date | undefined }`
|
|
133
|
+
*
|
|
134
|
+
* Accepts ISO 8601 dates (`2024-01-15`) or relative durations
|
|
135
|
+
* (`7d`, `24h`, `30m`, `2w`). Durations are past-relative
|
|
136
|
+
* (subtracted from now).
|
|
137
|
+
*
|
|
138
|
+
* Returns `undefined` for unparseable values (does not throw).
|
|
139
|
+
* When `config.maxRange` is set and both bounds are provided,
|
|
140
|
+
* ranges above the limit are treated as invalid.
|
|
141
|
+
*/
|
|
142
|
+
declare function timeWindowPreset(config?: TimeWindowPresetConfig): FlagPreset<TimeWindowFlags>;
|
|
143
|
+
/**
|
|
144
|
+
* Execution flag preset.
|
|
145
|
+
*
|
|
146
|
+
* Adds: `--timeout <ms>`, `--retries <n>`, `--offline`
|
|
147
|
+
* Resolves: `{ timeout: number | undefined, retries: number, offline: boolean }`
|
|
148
|
+
*
|
|
149
|
+
* Timeout is parsed as a positive integer in milliseconds.
|
|
150
|
+
* Retries are parsed as a non-negative integer, clamped to maxRetries.
|
|
151
|
+
*/
|
|
152
|
+
declare function executionPreset(config?: ExecutionPresetConfig): FlagPreset<ExecutionFlags>;
|
|
153
|
+
/**
|
|
154
|
+
* Pagination flag preset.
|
|
155
|
+
*
|
|
156
|
+
* Adds: `-l, --limit <n>`, `--next`, `--reset`
|
|
157
|
+
* Resolves: `{ limit: number, next: boolean, reset: boolean }`
|
|
158
|
+
*
|
|
159
|
+
* Limit is parsed as an integer, clamped to maxLimit, and defaults
|
|
160
|
+
* to defaultLimit on invalid input. Mutual exclusivity of --next
|
|
161
|
+
* and --reset is a handler concern (not enforced here).
|
|
162
|
+
*
|
|
163
|
+
* Integrates with loadCursor/saveCursor/clearCursor from
|
|
164
|
+
* `@outfitter/cli/pagination`.
|
|
165
|
+
*/
|
|
166
|
+
declare function paginationPreset(config?: PaginationPresetConfig): FlagPreset<PaginationFlags>;
|
|
167
|
+
export { verbosePreset, timeWindowPreset, strictPreset, projectionPreset, paginationPreset, interactionPreset, forcePreset, executionPreset, dryRunPreset, cwdPreset, createPreset, composePresets, colorPreset, TimeWindowPresetConfig, TimeWindowFlags, StrictFlags, ProjectionFlags, PaginationPresetConfig, PaginationFlags, InteractionFlags, FlagPresetConfig, FlagPreset, ExecutionPresetConfig, ExecutionFlags, ComposedPreset, ColorMode, ColorFlags };
|
package/dist/flags.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
colorPreset,
|
|
4
|
+
composePresets,
|
|
5
|
+
createPreset,
|
|
6
|
+
cwdPreset,
|
|
7
|
+
dryRunPreset,
|
|
8
|
+
executionPreset,
|
|
9
|
+
forcePreset,
|
|
10
|
+
interactionPreset,
|
|
11
|
+
paginationPreset,
|
|
12
|
+
projectionPreset,
|
|
13
|
+
strictPreset,
|
|
14
|
+
timeWindowPreset,
|
|
15
|
+
verbosePreset
|
|
16
|
+
} from "./shared/@outfitter/cli-b2zk8fb3.js";
|
|
17
|
+
export {
|
|
18
|
+
verbosePreset,
|
|
19
|
+
timeWindowPreset,
|
|
20
|
+
strictPreset,
|
|
21
|
+
projectionPreset,
|
|
22
|
+
paginationPreset,
|
|
23
|
+
interactionPreset,
|
|
24
|
+
forcePreset,
|
|
25
|
+
executionPreset,
|
|
26
|
+
dryRunPreset,
|
|
27
|
+
cwdPreset,
|
|
28
|
+
createPreset,
|
|
29
|
+
composePresets,
|
|
30
|
+
colorPreset
|
|
31
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./shared/@outfitter/cli-qz47jk6d";
|
|
2
|
-
import { ANSI, Theme, Tokens, createTheme } from "./shared/@outfitter/cli-
|
|
3
|
-
import { output } from "./shared/@outfitter/cli-
|
|
4
|
-
import { OutputMode } from "./shared/@outfitter/cli-
|
|
5
|
-
export { output, createTheme, Tokens, Theme, OutputMode, ANSI };
|
|
2
|
+
import { ANSI, Theme, Tokens, createTheme } from "./shared/@outfitter/cli-xppg982q";
|
|
3
|
+
import { exitWithError, output } from "./shared/@outfitter/cli-k0yvzn6d";
|
|
4
|
+
import { OutputMode } from "./shared/@outfitter/cli-md9347gn";
|
|
5
|
+
export { output, exitWithError, createTheme, Tokens, Theme, OutputMode, ANSI };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./shared/@outfitter/cli-
|
|
2
|
+
import"./shared/@outfitter/cli-zw75pdk8.js";
|
|
3
3
|
import {
|
|
4
4
|
ANSI,
|
|
5
5
|
createTheme
|
|
6
|
-
} from "./shared/@outfitter/cli-
|
|
7
|
-
import"./shared/@outfitter/cli-
|
|
6
|
+
} from "./shared/@outfitter/cli-rk9zagkm.js";
|
|
7
|
+
import"./shared/@outfitter/cli-jbj78ac5.js";
|
|
8
8
|
import {
|
|
9
|
+
exitWithError,
|
|
9
10
|
output
|
|
10
11
|
} from "./shared/@outfitter/cli-7wp5nj0s.js";
|
|
11
|
-
import"./shared/@outfitter/cli-v1tzwxkt.js";
|
|
12
12
|
export {
|
|
13
13
|
output,
|
|
14
|
+
exitWithError,
|
|
14
15
|
createTheme,
|
|
15
16
|
ANSI
|
|
16
17
|
};
|
package/dist/input.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CollectIdsOptions,
|
|
2
|
-
import {
|
|
1
|
+
import { CollectIdsOptions, ExpandFileOptions, FilterExpression, KeyValuePair, NormalizeIdOptions, ParseGlobOptions, Range, SortCriteria } from "./shared/@outfitter/cli-md9347gn";
|
|
2
|
+
import { ValidationError } from "@outfitter/contracts";
|
|
3
3
|
import { Result } from "better-result";
|
|
4
4
|
/**
|
|
5
5
|
* Collect IDs from various input formats.
|
|
@@ -138,27 +138,4 @@ declare function parseSortSpec(input: string): Result<SortCriteria[], InstanceTy
|
|
|
138
138
|
* ```
|
|
139
139
|
*/
|
|
140
140
|
declare function normalizeId(input: string, options?: NormalizeIdOptions): Result<string, InstanceType<typeof ValidationError>>;
|
|
141
|
-
|
|
142
|
-
* Prompt for confirmation before destructive operations.
|
|
143
|
-
*
|
|
144
|
-
* Respects --yes flag for non-interactive mode.
|
|
145
|
-
*
|
|
146
|
-
* @param options - Confirmation options
|
|
147
|
-
* @returns Whether the user confirmed
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```typescript
|
|
151
|
-
* const confirmed = await confirmDestructive({
|
|
152
|
-
* message: "Delete 5 notes?",
|
|
153
|
-
* bypassFlag: flags.yes,
|
|
154
|
-
* itemCount: 5,
|
|
155
|
-
* });
|
|
156
|
-
*
|
|
157
|
-
* if (confirmed.isErr()) {
|
|
158
|
-
* // User cancelled
|
|
159
|
-
* process.exit(0);
|
|
160
|
-
* }
|
|
161
|
-
* ```
|
|
162
|
-
*/
|
|
163
|
-
declare function confirmDestructive(options: ConfirmDestructiveOptions): Promise<Result<boolean, InstanceType<typeof CancelledError>>>;
|
|
164
|
-
export { parseSortSpec, parseRange, parseKeyValue, parseGlob, parseFilter, normalizeId, expandFileArg, confirmDestructive, collectIds };
|
|
141
|
+
export { parseSortSpec, parseRange, parseKeyValue, parseGlob, parseFilter, normalizeId, expandFileArg, collectIds };
|
package/dist/input.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import {
|
|
3
|
-
__require
|
|
4
|
-
} from "./shared/@outfitter/cli-v1tzwxkt.js";
|
|
5
|
-
|
|
6
2
|
// packages/cli/src/input.ts
|
|
7
3
|
import path from "path";
|
|
8
|
-
import {
|
|
4
|
+
import { ValidationError } from "@outfitter/contracts";
|
|
9
5
|
import { Err, Ok } from "better-result";
|
|
10
6
|
function isSecurePath(filePath, allowAbsolute = false) {
|
|
11
7
|
if (filePath.includes("\x00")) {
|
|
@@ -400,31 +396,6 @@ function normalizeId(input, options) {
|
|
|
400
396
|
}
|
|
401
397
|
return new Ok(normalized);
|
|
402
398
|
}
|
|
403
|
-
async function confirmDestructive(options) {
|
|
404
|
-
const { message, bypassFlag = false, itemCount } = options;
|
|
405
|
-
if (bypassFlag) {
|
|
406
|
-
return new Ok(true);
|
|
407
|
-
}
|
|
408
|
-
const isTTY = process.stdout.isTTY;
|
|
409
|
-
const isDumbTerminal = process.env["TERM"] === "dumb";
|
|
410
|
-
if (!isTTY || isDumbTerminal) {
|
|
411
|
-
return new Err(new CancelledError({
|
|
412
|
-
message: "Cannot prompt for confirmation in non-interactive mode. Use --yes to bypass."
|
|
413
|
-
}));
|
|
414
|
-
}
|
|
415
|
-
let promptMessage = message;
|
|
416
|
-
if (itemCount !== undefined) {
|
|
417
|
-
promptMessage = `${message} (${itemCount} items)`;
|
|
418
|
-
}
|
|
419
|
-
const { confirm, isCancel } = await import("@clack/prompts");
|
|
420
|
-
const response = await confirm({ message: promptMessage });
|
|
421
|
-
if (isCancel(response) || response === false) {
|
|
422
|
-
return new Err(new CancelledError({
|
|
423
|
-
message: "Operation cancelled by user."
|
|
424
|
-
}));
|
|
425
|
-
}
|
|
426
|
-
return new Ok(true);
|
|
427
|
-
}
|
|
428
399
|
export {
|
|
429
400
|
parseSortSpec,
|
|
430
401
|
parseRange,
|
|
@@ -433,6 +404,5 @@ export {
|
|
|
433
404
|
parseFilter,
|
|
434
405
|
normalizeId,
|
|
435
406
|
expandFileArg,
|
|
436
|
-
confirmDestructive,
|
|
437
407
|
collectIds
|
|
438
408
|
};
|
package/dist/output.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { exitWithError, output, resolveVerbose } from "./shared/@outfitter/cli-
|
|
2
|
-
import "./shared/@outfitter/cli-
|
|
1
|
+
import { exitWithError, output, resolveVerbose } from "./shared/@outfitter/cli-k0yvzn6d";
|
|
2
|
+
import "./shared/@outfitter/cli-md9347gn";
|
|
3
3
|
export { resolveVerbose, output, exitWithError };
|