@outfitter/cli 0.5.1 → 0.5.3

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.
@@ -1,19 +1 @@
1
- // @bun
2
- import {
3
- getEnvValue,
4
- getTerminalWidth,
5
- hasNoColorEnv,
6
- isInteractive,
7
- resolveColorEnv,
8
- resolveForceColorEnv,
9
- supportsColor
10
- } from "../shared/@outfitter/cli-jbj78ac5.js";
11
- export {
12
- supportsColor,
13
- resolveForceColorEnv,
14
- resolveColorEnv,
15
- isInteractive,
16
- hasNoColorEnv,
17
- getTerminalWidth,
18
- getEnvValue
19
- };
1
+ export { getEnvValue, getTerminalWidth, hasNoColorEnv, isInteractive, resolveColorEnv, resolveForceColorEnv, supportsColor } from "./detection.js";
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { BooleanFlagPresetConfig, CLI, CLIConfig, CancelledError, CollectIdsOptions, ColorFlags, ColorMode, CommandAction, CommandBuilder, CommandConfig, CommandFlags, ComposedPreset, CursorOptions, DateRange, EnumFlagPresetConfig, ErrorCategory, ExecutionFlags, ExecutionPresetConfig, ExpandFileOptions, FilterExpression, FlagPreset, FlagPresetConfig, InteractionFlags, KeyValuePair, NormalizeIdOptions, NumberFlagPresetConfig, NumericRange, OutputMode, OutputOptions, PaginationFlags, PaginationPresetConfig, PaginationState, ParseGlobOptions, ProjectionFlags, Range, Result, SortCriteria, StrictFlags, StringListFlagPresetConfig, TimeWindowFlags, TimeWindowPresetConfig, ValidationError, VerbConfig, VerbFamily } from "./shared/@outfitter/cli-7n5zmndx";
1
+ import { BooleanFlagPresetConfig, CLI, CLIConfig, CancelledError, CollectIdsOptions, ColorFlags, ColorMode, CommandAction, CommandBuilder, CommandConfig, CommandFlags, ComposedPreset, CursorOptions, DateRange, EnumFlagPresetConfig, ErrorCategory, ExecutionFlags, ExecutionPresetConfig, ExpandFileOptions, FilterExpression, FlagPreset, FlagPresetConfig, InteractionFlags, KeyValuePair, NormalizeIdOptions, NumberFlagPresetConfig, NumericRange, OutputMode, OutputOptions, PaginationFlags, PaginationPresetConfig, PaginationState, ParseGlobOptions, ProjectionFlags, Range, Result, SortCriteria, StrictFlags, StringListFlagPresetConfig, TimeWindowFlags, TimeWindowPresetConfig, ValidationError, VerbConfig, VerbFamily } from "./shared/@outfitter/cli-98aa9104.js";
2
2
  export { VerbFamily, VerbConfig, ValidationError, TimeWindowPresetConfig, TimeWindowFlags, StringListFlagPresetConfig, StrictFlags, SortCriteria, Result, Range, ProjectionFlags, ParseGlobOptions, PaginationState, PaginationPresetConfig, PaginationFlags, OutputOptions, OutputMode, NumericRange, NumberFlagPresetConfig, NormalizeIdOptions, KeyValuePair, InteractionFlags, FlagPresetConfig, FlagPreset, FilterExpression, ExpandFileOptions, ExecutionPresetConfig, ExecutionFlags, ErrorCategory, EnumFlagPresetConfig, DateRange, CursorOptions, ComposedPreset, CommandFlags, CommandConfig, CommandBuilder, CommandAction, ColorMode, ColorFlags, CollectIdsOptions, CancelledError, CLIConfig, CLI, BooleanFlagPresetConfig };
package/dist/types.js CHANGED
@@ -1,9 +1,4 @@
1
1
  // @bun
2
- // packages/cli/src/types.ts
3
- import {
4
- CancelledError,
5
- ValidationError
6
- } from "@outfitter/contracts";
7
2
  export {
8
3
  ValidationError,
9
4
  CancelledError
package/dist/verbs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CommandBuilder, VerbConfig, VerbFamily } from "./shared/@outfitter/cli-7n5zmndx";
1
+ import { CommandBuilder, VerbConfig, VerbFamily } from "./shared/@outfitter/cli-98aa9104.js";
2
2
  /**
3
3
  * Built-in verb families with standard primary verbs and aliases.
4
4
  *
package/package.json CHANGED
@@ -1,11 +1,28 @@
1
1
  {
2
2
  "name": "@outfitter/cli",
3
+ "version": "0.5.3",
3
4
  "description": "Typed CLI runtime with terminal detection, rendering, output contracts, and input parsing",
4
- "version": "0.5.1",
5
- "type": "module",
5
+ "keywords": [
6
+ "bun",
7
+ "cli",
8
+ "colors",
9
+ "commander",
10
+ "outfitter",
11
+ "renderers",
12
+ "terminal",
13
+ "typescript"
14
+ ],
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/outfitter-dev/outfitter.git",
19
+ "directory": "packages/cli"
20
+ },
6
21
  "files": [
7
22
  "dist"
8
23
  ],
24
+ "type": "module",
25
+ "sideEffects": false,
9
26
  "module": "./dist/index.js",
10
27
  "types": "./dist/index.d.ts",
11
28
  "exports": {
@@ -107,57 +124,40 @@
107
124
  }
108
125
  }
109
126
  },
110
- "sideEffects": false,
127
+ "publishConfig": {
128
+ "access": "public"
129
+ },
111
130
  "scripts": {
112
131
  "build": "cd ../.. && bunup --filter @outfitter/cli",
113
132
  "test": "bun test",
114
133
  "test:watch": "bun test --watch",
115
- "lint": "biome lint ./src",
116
- "lint:fix": "biome lint --write ./src",
134
+ "lint": "oxlint ./src",
135
+ "lint:fix": "oxlint --fix ./src",
117
136
  "typecheck": "tsc --noEmit",
118
137
  "clean": "rm -rf dist",
119
138
  "prepublishOnly": "bun ../../scripts/check-publish-manifest.ts"
120
139
  },
121
140
  "dependencies": {
122
- "@clack/prompts": "^0.11.0",
141
+ "@clack/prompts": "^1.0.1",
123
142
  "better-result": "^2.5.1",
124
143
  "commander": "^14.0.2"
125
144
  },
145
+ "devDependencies": {
146
+ "@outfitter/config": "0.3.4",
147
+ "@outfitter/contracts": "0.4.2",
148
+ "@outfitter/schema": "0.2.3",
149
+ "@types/bun": "^1.3.9",
150
+ "@types/node": "^25.3.0",
151
+ "typescript": "^5.9.3"
152
+ },
126
153
  "peerDependencies": {
127
154
  "@outfitter/config": ">=0.3.0",
128
155
  "@outfitter/contracts": ">=0.2.0",
129
156
  "@outfitter/schema": ">=0.1.0",
130
157
  "@outfitter/types": ">=0.2.0",
131
- "zod": "^4.3.5"
132
- },
133
- "devDependencies": {
134
- "@outfitter/config": "0.3.2",
135
- "@outfitter/contracts": "0.4.0",
136
- "@outfitter/schema": "0.2.1",
137
- "@types/bun": "^1.3.7",
138
- "@types/node": "^25.0.10",
139
- "typescript": "^5.9.3"
158
+ "zod": ">=4.0.0"
140
159
  },
141
160
  "engines": {
142
- "bun": ">=1.3.7"
143
- },
144
- "publishConfig": {
145
- "access": "public"
146
- },
147
- "repository": {
148
- "type": "git",
149
- "url": "https://github.com/outfitter-dev/outfitter.git",
150
- "directory": "packages/cli"
151
- },
152
- "license": "MIT",
153
- "keywords": [
154
- "cli",
155
- "commander",
156
- "typescript",
157
- "bun",
158
- "outfitter",
159
- "terminal",
160
- "colors",
161
- "renderers"
162
- ]
161
+ "bun": ">=1.3.10"
162
+ }
163
163
  }
@@ -1,169 +0,0 @@
1
- // @bun
2
- // packages/cli/src/output.ts
3
- import { getEnvironment, getEnvironmentDefaults } from "@outfitter/config";
4
- import {
5
- safeStringify as contractsSafeStringify,
6
- exitCodeMap
7
- } from "@outfitter/contracts";
8
- var DEFAULT_EXIT_CODE = 1;
9
- function writeWithBackpressure(stream, data) {
10
- return new Promise((resolve, reject) => {
11
- const canContinue = stream.write(data, (error) => {
12
- if (error)
13
- reject(error);
14
- });
15
- if (canContinue) {
16
- resolve();
17
- } else {
18
- stream.once("drain", () => resolve());
19
- stream.once("error", reject);
20
- }
21
- });
22
- }
23
- function detectMode(options) {
24
- if (options?.mode) {
25
- return options.mode;
26
- }
27
- const envJsonl = process.env["OUTFITTER_JSONL"];
28
- const envJson = process.env["OUTFITTER_JSON"];
29
- if (envJsonl === "1")
30
- return "jsonl";
31
- if (envJson === "1")
32
- return "json";
33
- if (envJsonl === "0" || envJson === "0")
34
- return "human";
35
- return "human";
36
- }
37
- function isValidCategory(category) {
38
- return category in exitCodeMap;
39
- }
40
- function safeStringify(value, pretty) {
41
- const wrappedValue = value === undefined ? null : value;
42
- return contractsSafeStringify(wrappedValue, pretty ? 2 : undefined);
43
- }
44
- function formatHuman(data) {
45
- if (data === null || data === undefined) {
46
- return "";
47
- }
48
- if (typeof data === "string") {
49
- return data;
50
- }
51
- if (typeof data === "number" || typeof data === "boolean") {
52
- return String(data);
53
- }
54
- if (Array.isArray(data)) {
55
- return data.map((item) => formatHuman(item)).join(`
56
- `);
57
- }
58
- if (typeof data === "object") {
59
- const lines = [];
60
- for (const [key, value] of Object.entries(data)) {
61
- lines.push(`${key}: ${formatHuman(value)}`);
62
- }
63
- return lines.join(`
64
- `);
65
- }
66
- return String(data);
67
- }
68
- function getErrorProperties(error) {
69
- const errorObj = error;
70
- return {
71
- _tag: errorObj._tag,
72
- category: errorObj.category,
73
- context: errorObj.context
74
- };
75
- }
76
- function getExitCode(error) {
77
- const { category } = getErrorProperties(error);
78
- if (category !== undefined && isValidCategory(category)) {
79
- return exitCodeMap[category];
80
- }
81
- return DEFAULT_EXIT_CODE;
82
- }
83
- function serializeErrorToJson(error) {
84
- const { _tag, category, context } = getErrorProperties(error);
85
- const result = {
86
- message: error.message
87
- };
88
- if (_tag !== undefined) {
89
- result._tag = _tag;
90
- }
91
- if (category !== undefined) {
92
- result.category = category;
93
- }
94
- if (context !== undefined) {
95
- result.context = context;
96
- }
97
- return JSON.stringify(result);
98
- }
99
- function formatErrorHuman(error) {
100
- const { _tag } = getErrorProperties(error);
101
- if (_tag) {
102
- return `${_tag}: ${error.message}`;
103
- }
104
- return error.message;
105
- }
106
- async function output(data, options) {
107
- const mode = detectMode(options);
108
- const stream = options?.stream ?? process.stdout;
109
- let outputText;
110
- switch (mode) {
111
- case "json": {
112
- const jsonData = data === undefined ? null : data;
113
- outputText = safeStringify(jsonData, options?.pretty);
114
- break;
115
- }
116
- case "jsonl": {
117
- if (Array.isArray(data)) {
118
- if (data.length === 0) {
119
- outputText = "";
120
- } else {
121
- outputText = data.map((item) => safeStringify(item)).join(`
122
- `);
123
- }
124
- } else {
125
- outputText = safeStringify(data);
126
- }
127
- break;
128
- }
129
- default: {
130
- outputText = formatHuman(data);
131
- break;
132
- }
133
- }
134
- if (outputText) {
135
- await writeWithBackpressure(stream, `${outputText}
136
- `);
137
- }
138
- }
139
- function exitWithError(error, options) {
140
- const exitCode = getExitCode(error);
141
- const mode = detectMode({
142
- ...options,
143
- stream: options?.stream ?? process.stderr
144
- });
145
- const isJsonMode = mode === "json" || mode === "jsonl";
146
- if (isJsonMode) {
147
- process.stderr.write(`${serializeErrorToJson(error)}
148
- `);
149
- } else {
150
- process.stderr.write(`${formatErrorHuman(error)}
151
- `);
152
- }
153
- process.exit(exitCode);
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
- }
168
-
169
- export { output, exitWithError, resolveVerbose };
@@ -1 +0,0 @@
1
- // @bun