@outfitter/cli 0.2.0 → 0.4.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 +47 -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 +1 -1
- package/dist/command.js +1 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -5
- package/dist/input.d.ts +3 -26
- package/dist/input.js +1 -31
- package/dist/output.d.ts +3 -3
- package/dist/output.js +4 -3
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.js +0 -2
- package/dist/shared/@outfitter/{cli-ttt7r0j7.d.ts → cli-02kyvj7h.d.ts} +2 -13
- package/dist/shared/@outfitter/{cli-8gg0hck1.js → cli-7wp5nj0s.js} +16 -12
- package/dist/shared/@outfitter/{cli-72kg550t.d.ts → cli-f79bwzsp.d.ts} +30 -2
- package/dist/shared/@outfitter/{cli-d9ad0rqj.js → cli-jbj78ac5.js} +1 -6
- package/dist/shared/@outfitter/{cli-5g6rkv3d.js → cli-rk9zagkm.js} +24 -32
- package/dist/shared/@outfitter/{cli-efy6jfcj.js → cli-zahqsaby.js} +33 -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/package.json +35 -213
- 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?",
|
|
@@ -367,17 +367,56 @@ if (flags.reset) {
|
|
|
367
367
|
|
|
368
368
|
| Variable | Description | Default |
|
|
369
369
|
|----------|-------------|---------|
|
|
370
|
+
| `OUTFITTER_ENV` | Environment profile (`development`, `production`, `test`) | `production` |
|
|
371
|
+
| `OUTFITTER_VERBOSE` | Override verbose mode (`1` or `0`) | - |
|
|
370
372
|
| `OUTFITTER_JSON` | Set to `1` to force JSON output | - |
|
|
371
373
|
| `OUTFITTER_JSONL` | Set to `1` to force JSONL output (takes priority over JSON) | - |
|
|
372
374
|
| `XDG_STATE_HOME` | State directory for pagination | Platform-specific |
|
|
373
375
|
|
|
376
|
+
### `resolveVerbose(verbose?)`
|
|
377
|
+
|
|
378
|
+
Resolve verbose mode from environment configuration. Use this instead of hardcoding verbosity so your CLI responds to `OUTFITTER_ENV` and `OUTFITTER_VERBOSE` automatically.
|
|
379
|
+
|
|
380
|
+
**Precedence** (highest wins):
|
|
381
|
+
1. `OUTFITTER_VERBOSE` environment variable (`"1"` or `"0"`)
|
|
382
|
+
2. Explicit `verbose` parameter (from `--verbose` CLI flag)
|
|
383
|
+
3. `OUTFITTER_ENV` profile defaults (`true` in development)
|
|
384
|
+
4. `false` (default)
|
|
385
|
+
|
|
386
|
+
```typescript
|
|
387
|
+
import { resolveVerbose } from "@outfitter/cli/output";
|
|
388
|
+
|
|
389
|
+
const isVerbose = resolveVerbose();
|
|
390
|
+
// With OUTFITTER_ENV=development → true
|
|
391
|
+
// With OUTFITTER_VERBOSE=0 → false (overrides everything)
|
|
392
|
+
// With nothing set → false
|
|
393
|
+
|
|
394
|
+
// Pass through from CLI flag
|
|
395
|
+
const isVerbose = resolveVerbose(cliFlags.verbose);
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### JSON Output
|
|
399
|
+
|
|
400
|
+
`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:
|
|
401
|
+
|
|
402
|
+
```typescript
|
|
403
|
+
// No need for this:
|
|
404
|
+
if (opts.json) output(data, { mode: "json" });
|
|
405
|
+
else output(data);
|
|
406
|
+
|
|
407
|
+
// Just use output() directly — it reads OUTFITTER_JSON:
|
|
408
|
+
output(data);
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
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.
|
|
412
|
+
|
|
374
413
|
### Output Mode Priority
|
|
375
414
|
|
|
376
415
|
1. Explicit `mode` option in `output()` call
|
|
377
416
|
2. `OUTFITTER_JSONL=1` environment variable (highest env priority)
|
|
378
417
|
3. `OUTFITTER_JSON=1` environment variable
|
|
379
418
|
4. `OUTFITTER_JSON=0` or `OUTFITTER_JSONL=0` forces human mode
|
|
380
|
-
5.
|
|
419
|
+
5. Default fallback: `human`
|
|
381
420
|
|
|
382
421
|
## Error Handling
|
|
383
422
|
|
|
@@ -420,6 +459,10 @@ import type { CollectIdsOptions, ExpandFileOptions, ParseGlobOptions } from "@ou
|
|
|
420
459
|
import type { PaginationState, CursorOptions } from "@outfitter/cli/pagination";
|
|
421
460
|
```
|
|
422
461
|
|
|
462
|
+
## Upgrading
|
|
463
|
+
|
|
464
|
+
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.
|
|
465
|
+
|
|
423
466
|
## License
|
|
424
467
|
|
|
425
468
|
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 } from "./shared/@outfitter/cli-02kyvj7h";
|
|
2
2
|
/**
|
|
3
3
|
* Create a CLI instance with a portable return type from this module.
|
|
4
4
|
*/
|
package/dist/command.js
CHANGED
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-
|
|
2
|
+
import { ANSI, Theme, Tokens, createTheme } from "./shared/@outfitter/cli-xppg982q";
|
|
3
|
+
import { output } from "./shared/@outfitter/cli-f79bwzsp";
|
|
4
|
+
import { OutputMode } from "./shared/@outfitter/cli-02kyvj7h";
|
|
5
5
|
export { output, createTheme, Tokens, Theme, OutputMode, ANSI };
|
package/dist/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
|
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
9
|
output
|
|
10
|
-
} from "./shared/@outfitter/cli-
|
|
11
|
-
import"./shared/@outfitter/cli-v1tzwxkt.js";
|
|
10
|
+
} from "./shared/@outfitter/cli-7wp5nj0s.js";
|
|
12
11
|
export {
|
|
13
12
|
output,
|
|
14
13
|
createTheme,
|
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-02kyvj7h";
|
|
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 } from "./shared/@outfitter/cli-
|
|
2
|
-
import "./shared/@outfitter/cli-
|
|
3
|
-
export { output, exitWithError };
|
|
1
|
+
import { exitWithError, output, resolveVerbose } from "./shared/@outfitter/cli-f79bwzsp";
|
|
2
|
+
import "./shared/@outfitter/cli-02kyvj7h";
|
|
3
|
+
export { resolveVerbose, output, exitWithError };
|
package/dist/output.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
exitWithError,
|
|
4
|
-
output
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
output,
|
|
5
|
+
resolveVerbose
|
|
6
|
+
} from "./shared/@outfitter/cli-7wp5nj0s.js";
|
|
7
7
|
export {
|
|
8
|
+
resolveVerbose,
|
|
8
9
|
output,
|
|
9
10
|
exitWithError
|
|
10
11
|
};
|
package/dist/pagination.d.ts
CHANGED
package/dist/pagination.js
CHANGED
|
@@ -23,7 +23,7 @@ interface CLIConfig {
|
|
|
23
23
|
/** Custom error handler */
|
|
24
24
|
readonly onError?: (error: Error) => void;
|
|
25
25
|
/** Custom exit handler (defaults to process.exit) */
|
|
26
|
-
readonly onExit?: (code: number) =>
|
|
26
|
+
readonly onExit?: (code: number) => void | Promise<void>;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* CLI instance returned by createCLI.
|
|
@@ -164,17 +164,6 @@ interface NormalizeIdOptions {
|
|
|
164
164
|
readonly pattern?: RegExp;
|
|
165
165
|
}
|
|
166
166
|
/**
|
|
167
|
-
* Options for confirmDestructive().
|
|
168
|
-
*/
|
|
169
|
-
interface ConfirmDestructiveOptions {
|
|
170
|
-
/** Message to display to the user */
|
|
171
|
-
readonly message: string;
|
|
172
|
-
/** Whether to bypass confirmation (e.g., --yes flag) */
|
|
173
|
-
readonly bypassFlag?: boolean;
|
|
174
|
-
/** Number of items affected (shown in confirmation) */
|
|
175
|
-
readonly itemCount?: number;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
167
|
* Numeric or date range parsed from CLI input.
|
|
179
168
|
*/
|
|
180
169
|
type Range = NumericRange | DateRange;
|
|
@@ -250,4 +239,4 @@ interface CursorOptions {
|
|
|
250
239
|
/** Total count of results (if known) */
|
|
251
240
|
readonly total?: number;
|
|
252
241
|
}
|
|
253
|
-
export { CLIConfig, CLI, CommandConfig, CommandAction, CommandFlags, CommandBuilder, OutputMode, OutputOptions, CollectIdsOptions, ExpandFileOptions, ParseGlobOptions, NormalizeIdOptions,
|
|
242
|
+
export { CLIConfig, CLI, CommandConfig, CommandAction, CommandFlags, CommandBuilder, OutputMode, OutputOptions, CollectIdsOptions, ExpandFileOptions, ParseGlobOptions, NormalizeIdOptions, Range, NumericRange, DateRange, FilterExpression, SortCriteria, KeyValuePair, PaginationState, CursorOptions, CancelledError, ErrorCategory, ValidationError, Result };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/cli/src/output.ts
|
|
3
|
+
import { getEnvironment, getEnvironmentDefaults } from "@outfitter/config";
|
|
3
4
|
import {
|
|
4
5
|
safeStringify as contractsSafeStringify,
|
|
5
6
|
exitCodeMap
|
|
@@ -19,14 +20,6 @@ function writeWithBackpressure(stream, data) {
|
|
|
19
20
|
}
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
|
-
function getStreamIsTTY(stream) {
|
|
23
|
-
if (!stream)
|
|
24
|
-
return;
|
|
25
|
-
if ("isTTY" in stream) {
|
|
26
|
-
return Boolean(stream.isTTY);
|
|
27
|
-
}
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
23
|
function detectMode(options) {
|
|
31
24
|
if (options?.mode) {
|
|
32
25
|
return options.mode;
|
|
@@ -39,9 +32,7 @@ function detectMode(options) {
|
|
|
39
32
|
return "json";
|
|
40
33
|
if (envJsonl === "0" || envJson === "0")
|
|
41
34
|
return "human";
|
|
42
|
-
|
|
43
|
-
const isTTY = streamIsTTY ?? process.stdout.isTTY;
|
|
44
|
-
return isTTY ? "human" : "json";
|
|
35
|
+
return "human";
|
|
45
36
|
}
|
|
46
37
|
function isValidCategory(category) {
|
|
47
38
|
return category in exitCodeMap;
|
|
@@ -161,5 +152,18 @@ function exitWithError(error, options) {
|
|
|
161
152
|
}
|
|
162
153
|
process.exit(exitCode);
|
|
163
154
|
}
|
|
155
|
+
function resolveVerbose(verbose) {
|
|
156
|
+
const envVerbose = process.env["OUTFITTER_VERBOSE"];
|
|
157
|
+
if (envVerbose === "1")
|
|
158
|
+
return true;
|
|
159
|
+
if (envVerbose === "0")
|
|
160
|
+
return false;
|
|
161
|
+
if (verbose !== undefined) {
|
|
162
|
+
return verbose;
|
|
163
|
+
}
|
|
164
|
+
const env = getEnvironment();
|
|
165
|
+
const defaults = getEnvironmentDefaults(env);
|
|
166
|
+
return defaults.verbose;
|
|
167
|
+
}
|
|
164
168
|
|
|
165
|
-
export { output, exitWithError };
|
|
169
|
+
export { output, exitWithError, resolveVerbose };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OutputOptions } from "./cli-
|
|
1
|
+
import { OutputOptions } from "./cli-02kyvj7h";
|
|
2
2
|
/**
|
|
3
3
|
* Output data to the console with automatic mode selection.
|
|
4
4
|
*
|
|
@@ -50,4 +50,32 @@ declare function output(data: unknown, options?: OutputOptions): Promise<void>;
|
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
52
|
declare function exitWithError(error: Error, options?: OutputOptions): never;
|
|
53
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Resolve verbose mode from environment configuration.
|
|
55
|
+
*
|
|
56
|
+
* Precedence (highest wins):
|
|
57
|
+
* 1. `OUTFITTER_VERBOSE` environment variable (`"1"` or `"0"`)
|
|
58
|
+
* 2. Explicit `verbose` parameter (from CLI flag)
|
|
59
|
+
* 3. `OUTFITTER_ENV` environment profile defaults
|
|
60
|
+
* 4. `false` (default)
|
|
61
|
+
*
|
|
62
|
+
* @param verbose - Optional explicit verbose flag (e.g. from --verbose CLI flag)
|
|
63
|
+
* @returns Whether verbose mode is enabled
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* import { resolveVerbose } from "@outfitter/cli/output";
|
|
68
|
+
*
|
|
69
|
+
* // Auto-resolve from environment
|
|
70
|
+
* const isVerbose = resolveVerbose();
|
|
71
|
+
*
|
|
72
|
+
* // With OUTFITTER_ENV=development → true
|
|
73
|
+
* // With OUTFITTER_VERBOSE=0 → false (overrides everything)
|
|
74
|
+
* // With nothing set → false
|
|
75
|
+
*
|
|
76
|
+
* // From CLI flag
|
|
77
|
+
* const isVerbose = resolveVerbose(cliFlags.verbose);
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
declare function resolveVerbose(verbose?: boolean): boolean;
|
|
81
|
+
export { output, exitWithError, resolveVerbose };
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import {
|
|
3
|
-
__esm
|
|
4
|
-
} from "./cli-v1tzwxkt.js";
|
|
5
|
-
|
|
6
2
|
// packages/cli/src/terminal/detection.ts
|
|
7
3
|
import { getEnvBoolean } from "@outfitter/config";
|
|
8
4
|
function getEnvValue(key) {
|
|
@@ -70,6 +66,5 @@ function isInteractive(options) {
|
|
|
70
66
|
const isTTY = options?.isTTY ?? process.stdout.isTTY ?? false;
|
|
71
67
|
return isTTY;
|
|
72
68
|
}
|
|
73
|
-
var init_detection = () => {};
|
|
74
69
|
|
|
75
|
-
export { getEnvValue, hasNoColorEnv, resolveForceColorEnv, resolveColorEnv, supportsColor, getTerminalWidth, isInteractive
|
|
70
|
+
export { getEnvValue, hasNoColorEnv, resolveForceColorEnv, resolveColorEnv, supportsColor, getTerminalWidth, isInteractive };
|
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
init_detection,
|
|
4
3
|
resolveColorEnv,
|
|
5
4
|
supportsColor
|
|
6
|
-
} from "./cli-
|
|
7
|
-
import {
|
|
8
|
-
__esm
|
|
9
|
-
} from "./cli-v1tzwxkt.js";
|
|
5
|
+
} from "./cli-jbj78ac5.js";
|
|
10
6
|
|
|
11
|
-
// packages/cli/src/
|
|
7
|
+
// packages/cli/src/colors/colors.ts
|
|
8
|
+
var ANSI = {
|
|
9
|
+
reset: "\x1B[0m",
|
|
10
|
+
bold: "\x1B[1m",
|
|
11
|
+
dim: "\x1B[2m",
|
|
12
|
+
italic: "\x1B[3m",
|
|
13
|
+
underline: "\x1B[4m",
|
|
14
|
+
inverse: "\x1B[7m",
|
|
15
|
+
green: "\x1B[32m",
|
|
16
|
+
yellow: "\x1B[33m",
|
|
17
|
+
red: "\x1B[31m",
|
|
18
|
+
blue: "\x1B[34m",
|
|
19
|
+
cyan: "\x1B[36m",
|
|
20
|
+
magenta: "\x1B[35m",
|
|
21
|
+
white: "\x1B[37m",
|
|
22
|
+
gray: "\x1B[90m",
|
|
23
|
+
brightCyan: "\x1B[96m",
|
|
24
|
+
brightRed: "\x1B[91m",
|
|
25
|
+
brightYellow: "\x1B[93m",
|
|
26
|
+
brightGreen: "\x1B[92m",
|
|
27
|
+
brightBlue: "\x1B[94m"
|
|
28
|
+
};
|
|
12
29
|
function createTheme() {
|
|
13
30
|
const colorEnabled = supportsColor();
|
|
14
31
|
const colorFn = (ansiCode) => (text) => {
|
|
@@ -103,30 +120,5 @@ function applyColor(text, color) {
|
|
|
103
120
|
const ansiCode = ANSI[color];
|
|
104
121
|
return `${ansiCode}${text}${ANSI.reset}`;
|
|
105
122
|
}
|
|
106
|
-
var ANSI;
|
|
107
|
-
var init_colors = __esm(() => {
|
|
108
|
-
init_detection();
|
|
109
|
-
ANSI = {
|
|
110
|
-
reset: "\x1B[0m",
|
|
111
|
-
bold: "\x1B[1m",
|
|
112
|
-
dim: "\x1B[2m",
|
|
113
|
-
italic: "\x1B[3m",
|
|
114
|
-
underline: "\x1B[4m",
|
|
115
|
-
inverse: "\x1B[7m",
|
|
116
|
-
green: "\x1B[32m",
|
|
117
|
-
yellow: "\x1B[33m",
|
|
118
|
-
red: "\x1B[31m",
|
|
119
|
-
blue: "\x1B[34m",
|
|
120
|
-
cyan: "\x1B[36m",
|
|
121
|
-
magenta: "\x1B[35m",
|
|
122
|
-
white: "\x1B[37m",
|
|
123
|
-
gray: "\x1B[90m",
|
|
124
|
-
brightCyan: "\x1B[96m",
|
|
125
|
-
brightRed: "\x1B[91m",
|
|
126
|
-
brightYellow: "\x1B[93m",
|
|
127
|
-
brightGreen: "\x1B[92m",
|
|
128
|
-
brightBlue: "\x1B[94m"
|
|
129
|
-
};
|
|
130
|
-
});
|
|
131
123
|
|
|
132
|
-
export { ANSI, createTheme, resolveTokenColorEnabled, createTokens, applyColor
|
|
124
|
+
export { ANSI, createTheme, resolveTokenColorEnabled, createTokens, applyColor };
|
|
@@ -6,32 +6,55 @@ function isCommanderHelp(error) {
|
|
|
6
6
|
}
|
|
7
7
|
function createCLI(config) {
|
|
8
8
|
const program = new Command;
|
|
9
|
+
let bridgedJsonEnvPrevious;
|
|
10
|
+
let bridgedJsonEnvActive = false;
|
|
11
|
+
const restoreJsonEnvBridge = () => {
|
|
12
|
+
if (!bridgedJsonEnvActive) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (bridgedJsonEnvPrevious === undefined) {
|
|
16
|
+
process.env["OUTFITTER_JSON"] = undefined;
|
|
17
|
+
} else {
|
|
18
|
+
process.env["OUTFITTER_JSON"] = bridgedJsonEnvPrevious;
|
|
19
|
+
}
|
|
20
|
+
bridgedJsonEnvPrevious = undefined;
|
|
21
|
+
bridgedJsonEnvActive = false;
|
|
22
|
+
};
|
|
9
23
|
program.name(config.name).version(config.version);
|
|
10
24
|
if (config.description) {
|
|
11
25
|
program.description(config.description);
|
|
12
26
|
}
|
|
13
|
-
|
|
14
|
-
program.
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
program.option("--json", "Output as JSON", false);
|
|
28
|
+
program.hook("preAction", (thisCommand) => {
|
|
29
|
+
const allOpts = thisCommand.optsWithGlobals();
|
|
30
|
+
if (allOpts["json"] && !bridgedJsonEnvActive) {
|
|
31
|
+
bridgedJsonEnvPrevious = process.env["OUTFITTER_JSON"];
|
|
32
|
+
process.env["OUTFITTER_JSON"] = "1";
|
|
33
|
+
bridgedJsonEnvActive = true;
|
|
17
34
|
}
|
|
18
|
-
if (config.onError) {
|
|
19
|
-
config.onError(error);
|
|
20
|
-
}
|
|
21
|
-
const exitCode = typeof error.exitCode === "number" && Number.isFinite(error.exitCode) ? error.exitCode : 1;
|
|
22
|
-
exit(exitCode);
|
|
23
35
|
});
|
|
36
|
+
program.hook("postAction", () => {
|
|
37
|
+
restoreJsonEnvBridge();
|
|
38
|
+
});
|
|
39
|
+
const exit = config.onExit ?? ((code) => void process.exit(code));
|
|
40
|
+
program.exitOverride();
|
|
24
41
|
const parse = async (argv) => {
|
|
25
42
|
try {
|
|
26
43
|
await program.parseAsync(argv ?? process.argv);
|
|
27
44
|
} catch (error) {
|
|
28
45
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
46
|
+
if (isCommanderHelp(err)) {
|
|
47
|
+
await exit(0);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
29
50
|
if (config.onError) {
|
|
30
51
|
config.onError(err);
|
|
31
52
|
}
|
|
32
53
|
const errorExitCode = error.exitCode;
|
|
33
54
|
const exitCode = typeof errorExitCode === "number" ? errorExitCode : 1;
|
|
34
|
-
exit(exitCode);
|
|
55
|
+
await exit(exitCode);
|
|
56
|
+
} finally {
|
|
57
|
+
restoreJsonEnvBridge();
|
|
35
58
|
}
|
|
36
59
|
};
|
|
37
60
|
const cli = {
|
|
@@ -3,15 +3,11 @@ import {
|
|
|
3
3
|
getEnvValue,
|
|
4
4
|
getTerminalWidth,
|
|
5
5
|
hasNoColorEnv,
|
|
6
|
-
init_detection,
|
|
7
6
|
isInteractive,
|
|
8
7
|
resolveColorEnv,
|
|
9
8
|
resolveForceColorEnv,
|
|
10
9
|
supportsColor
|
|
11
|
-
} from "../shared/@outfitter/cli-
|
|
12
|
-
import"../shared/@outfitter/cli-v1tzwxkt.js";
|
|
13
|
-
init_detection();
|
|
14
|
-
|
|
10
|
+
} from "../shared/@outfitter/cli-jbj78ac5.js";
|
|
15
11
|
export {
|
|
16
12
|
supportsColor,
|
|
17
13
|
resolveForceColorEnv,
|
package/dist/terminal/index.js
CHANGED
|
@@ -3,16 +3,11 @@ import {
|
|
|
3
3
|
getEnvValue,
|
|
4
4
|
getTerminalWidth,
|
|
5
5
|
hasNoColorEnv,
|
|
6
|
-
init_detection,
|
|
7
6
|
isInteractive,
|
|
8
7
|
resolveColorEnv,
|
|
9
8
|
resolveForceColorEnv,
|
|
10
9
|
supportsColor
|
|
11
|
-
} from "../shared/@outfitter/cli-
|
|
12
|
-
import"../shared/@outfitter/cli-v1tzwxkt.js";
|
|
13
|
-
|
|
14
|
-
// packages/cli/src/terminal/index.ts
|
|
15
|
-
init_detection();
|
|
10
|
+
} from "../shared/@outfitter/cli-jbj78ac5.js";
|
|
16
11
|
export {
|
|
17
12
|
supportsColor,
|
|
18
13
|
resolveForceColorEnv,
|
|
@@ -144,4 +144,4 @@ declare function pluralize(count: number, singular: string, plural?: string): st
|
|
|
144
144
|
* ```
|
|
145
145
|
*/
|
|
146
146
|
declare function slugify(text: string): string;
|
|
147
|
-
export {
|
|
147
|
+
export { wrapText, truncateText, stripAnsi, slugify, pluralize, padText, getStringWidth, ANSI_REGEX };
|