Skip to content

Commit f37f0c6

Browse files
committed
add runtime arg validation, remove Pipeline abstraction
Add $validate for schema-derived arg validation with Levenshtein did-you-mean suggestions. Remove Pipeline/pipe API in favor of $spawn's native async iterator — just use for-await loops.
1 parent 67bed7b commit f37f0c6

6 files changed

Lines changed: 0 additions & 329 deletions

File tree

packages/cli-to-js/src/build-api.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
} from "./exec.js";
99
import { parseSubcommandHelp, enrichSubcommands } from "./parse-subcommands.js";
1010
import { validateOptions, type ValidationError } from "./validate.js";
11-
import { createPipelineProxy } from "./pipe.js";
1211
import type { CliApi } from "./cli-api.js";
1312

1413
const RESERVED_PROPERTIES = new Set([
@@ -156,7 +155,6 @@ export const buildApi = <
156155
get(target, property) {
157156
if (property === "$schema") return schema;
158157
if (property === "$validate") return handleValidate;
159-
if (property === "$pipe") return createPipelineProxy(binaryName, defaultConfig);
160158
if (property === "$spawn") return buildSpawnProxy();
161159
if (property === "$parse") return handleParse;
162160
if (typeof property === "symbol") return Reflect.get(target, property);

packages/cli-to-js/src/cli-api.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { CommandResult, RunConfig, CommandProcess } from "./exec.js";
22
import type { CliSchema, ParsedCommand } from "./parse-help-text.js";
33
import type { ValidationError } from "./validate.js";
4-
import type { Pipeline } from "./pipe.js";
54

65
interface SubcommandFn<TOptions = Record<string, unknown>> {
76
(
@@ -38,8 +37,6 @@ interface CliApiBase {
3837
(options?: Record<string, unknown>, config?: RunConfig): CommandProcess;
3938
(subcommand: string, options?: Record<string, unknown>, config?: RunConfig): CommandProcess;
4039
};
41-
$pipe: Pipeline &
42-
Record<string, (options?: Record<string, unknown>, config?: RunConfig) => Pipeline>;
4340
}
4441

4542
type CliApi<

packages/cli-to-js/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ export { loadSchema } from "./load-schema.js";
3838
export { parseSubcommandHelp, enrichSubcommands } from "./parse-subcommands.js";
3939
export { generate, generateTypes } from "./generate.js";
4040
export { validateOptions } from "./validate.js";
41-
export { Pipeline, createCommandStep, createPipelineProxy } from "./pipe.js";
42-
export { map, filter, take } from "./utils/async-iterable.js";
43-
export type { AsyncTransform } from "./utils/async-iterable.js";
4441
export type { ValidationError } from "./validate.js";
4542
export type { CliApi, CliApiBase, SubcommandFn, SpawnFn } from "./cli-api.js";
4643
export type {

packages/cli-to-js/src/pipe.ts

Lines changed: 0 additions & 174 deletions
This file was deleted.

packages/cli-to-js/src/utils/async-iterable.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/cli-to-js/tests/pipe.test.ts

Lines changed: 0 additions & 122 deletions
This file was deleted.

0 commit comments

Comments
 (0)