@outfitter/cli 0.3.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 +23 -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 +3 -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/shared/@outfitter/{cli-ttt7r0j7.d.ts → cli-02kyvj7h.d.ts} +2 -13
- package/dist/shared/@outfitter/{cli-e6yv2764.d.ts → cli-f79bwzsp.d.ts} +1 -1
- 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-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/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?",
|
|
@@ -395,13 +395,28 @@ const isVerbose = resolveVerbose();
|
|
|
395
395
|
const isVerbose = resolveVerbose(cliFlags.verbose);
|
|
396
396
|
```
|
|
397
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
|
+
|
|
398
413
|
### Output Mode Priority
|
|
399
414
|
|
|
400
415
|
1. Explicit `mode` option in `output()` call
|
|
401
416
|
2. `OUTFITTER_JSONL=1` environment variable (highest env priority)
|
|
402
417
|
3. `OUTFITTER_JSON=1` environment variable
|
|
403
418
|
4. `OUTFITTER_JSON=0` or `OUTFITTER_JSONL=0` forces human mode
|
|
404
|
-
5.
|
|
419
|
+
5. Default fallback: `human`
|
|
405
420
|
|
|
406
421
|
## Error Handling
|
|
407
422
|
|
|
@@ -444,6 +459,10 @@ import type { CollectIdsOptions, ExpandFileOptions, ParseGlobOptions } from "@ou
|
|
|
444
459
|
import type { PaginationState, CursorOptions } from "@outfitter/cli/pagination";
|
|
445
460
|
```
|
|
446
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
|
+
|
|
447
466
|
## License
|
|
448
467
|
|
|
449
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
10
|
} from "./shared/@outfitter/cli-7wp5nj0s.js";
|
|
11
|
-
import"./shared/@outfitter/cli-v1tzwxkt.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, resolveVerbose } from "./shared/@outfitter/cli-
|
|
2
|
-
import "./shared/@outfitter/cli-
|
|
1
|
+
import { exitWithError, output, resolveVerbose } from "./shared/@outfitter/cli-f79bwzsp";
|
|
2
|
+
import "./shared/@outfitter/cli-02kyvj7h";
|
|
3
3
|
export { resolveVerbose, output, exitWithError };
|
package/dist/output.js
CHANGED
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,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,33 +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
27
|
program.option("--json", "Output as JSON", false);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
|
|
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;
|
|
18
34
|
}
|
|
19
|
-
if (config.onError) {
|
|
20
|
-
config.onError(error);
|
|
21
|
-
}
|
|
22
|
-
const exitCode = typeof error.exitCode === "number" && Number.isFinite(error.exitCode) ? error.exitCode : 1;
|
|
23
|
-
exit(exitCode);
|
|
24
35
|
});
|
|
36
|
+
program.hook("postAction", () => {
|
|
37
|
+
restoreJsonEnvBridge();
|
|
38
|
+
});
|
|
39
|
+
const exit = config.onExit ?? ((code) => void process.exit(code));
|
|
40
|
+
program.exitOverride();
|
|
25
41
|
const parse = async (argv) => {
|
|
26
42
|
try {
|
|
27
43
|
await program.parseAsync(argv ?? process.argv);
|
|
28
44
|
} catch (error) {
|
|
29
45
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
46
|
+
if (isCommanderHelp(err)) {
|
|
47
|
+
await exit(0);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
30
50
|
if (config.onError) {
|
|
31
51
|
config.onError(err);
|
|
32
52
|
}
|
|
33
53
|
const errorExitCode = error.exitCode;
|
|
34
54
|
const exitCode = typeof errorExitCode === "number" ? errorExitCode : 1;
|
|
35
|
-
exit(exitCode);
|
|
55
|
+
await exit(exitCode);
|
|
56
|
+
} finally {
|
|
57
|
+
restoreJsonEnvBridge();
|
|
36
58
|
}
|
|
37
59
|
};
|
|
38
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 };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
ANSI
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
__esm
|
|
8
|
-
} from "./cli-v1tzwxkt.js";
|
|
3
|
+
ANSI
|
|
4
|
+
} from "./shared/@outfitter/cli-rk9zagkm.js";
|
|
5
|
+
import"./shared/@outfitter/cli-jbj78ac5.js";
|
|
9
6
|
|
|
10
|
-
// packages/cli/src/
|
|
7
|
+
// packages/cli/src/text.ts
|
|
8
|
+
var ANSI_REGEX = /\x1b\[[0-9;]*m/g;
|
|
11
9
|
function stripAnsi(text) {
|
|
12
10
|
return text.replace(ANSI_REGEX, "");
|
|
13
11
|
}
|
|
@@ -76,10 +74,13 @@ function pluralize(count, singular, plural) {
|
|
|
76
74
|
function slugify(text) {
|
|
77
75
|
return text.toLowerCase().replace(/&/g, "and").replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
78
76
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
export {
|
|
78
|
+
wrapText,
|
|
79
|
+
truncateText,
|
|
80
|
+
stripAnsi,
|
|
81
|
+
slugify,
|
|
82
|
+
pluralize,
|
|
83
|
+
padText,
|
|
84
|
+
getStringWidth,
|
|
85
|
+
ANSI_REGEX
|
|
86
|
+
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CLI, CLIConfig, CancelledError, CollectIdsOptions, CommandAction, CommandBuilder, CommandConfig, CommandFlags,
|
|
2
|
-
export { ValidationError, SortCriteria, Result, Range, ParseGlobOptions, PaginationState, OutputOptions, OutputMode, NumericRange, NormalizeIdOptions, KeyValuePair, FilterExpression, ExpandFileOptions, ErrorCategory, DateRange, CursorOptions,
|
|
1
|
+
import { CLI, CLIConfig, CancelledError, CollectIdsOptions, CommandAction, CommandBuilder, CommandConfig, CommandFlags, CursorOptions, DateRange, ErrorCategory, ExpandFileOptions, FilterExpression, KeyValuePair, NormalizeIdOptions, NumericRange, OutputMode, OutputOptions, PaginationState, ParseGlobOptions, Range, Result, SortCriteria, ValidationError } from "./shared/@outfitter/cli-02kyvj7h";
|
|
2
|
+
export { ValidationError, SortCriteria, Result, Range, ParseGlobOptions, PaginationState, OutputOptions, OutputMode, NumericRange, NormalizeIdOptions, KeyValuePair, FilterExpression, ExpandFileOptions, ErrorCategory, DateRange, CursorOptions, CommandFlags, CommandConfig, CommandBuilder, CommandAction, CollectIdsOptions, CancelledError, CLIConfig, CLI };
|