toolcraft-schema 0.0.100 → 0.0.102
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/dist/index.d.ts +21 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,25 @@ type NonEmptyReadonlyArray<T> = readonly [T, ...T[]];
|
|
|
18
18
|
type ObjectShape = Record<string, AnySchema>;
|
|
19
19
|
type EmptyOptions = Record<never, never>;
|
|
20
20
|
type SchemaScope = "cli" | "mcp" | "sdk";
|
|
21
|
+
export type CliOutputMode = "rich" | "md" | "json";
|
|
22
|
+
export interface CliMissingParameterChoice<TValue> {
|
|
23
|
+
label: string;
|
|
24
|
+
value: TValue;
|
|
25
|
+
}
|
|
26
|
+
export interface CliMissingParameterContext {
|
|
27
|
+
commandPath: string;
|
|
28
|
+
params: Readonly<Record<string, unknown>>;
|
|
29
|
+
output: CliOutputMode;
|
|
30
|
+
stdinTTY: boolean;
|
|
31
|
+
stdoutTTY: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface CliMissingParameterResolution<TValue> {
|
|
34
|
+
choices: readonly CliMissingParameterChoice<TValue>[];
|
|
35
|
+
message?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface CliSchemaOptions<TValue> {
|
|
38
|
+
resolveMissing?: (context: CliMissingParameterContext) => CliMissingParameterResolution<TValue> | undefined | Promise<CliMissingParameterResolution<TValue> | undefined>;
|
|
39
|
+
}
|
|
21
40
|
type StringMetadata = {
|
|
22
41
|
format?: string;
|
|
23
42
|
maxLength?: number;
|
|
@@ -48,6 +67,7 @@ type InferObject<TShape extends ObjectShape> = {
|
|
|
48
67
|
[TKey in OptionalKeys<TShape>]?: PropertyStatic<TShape[TKey]>;
|
|
49
68
|
};
|
|
50
69
|
type SchemaOptions<TDefault> = {
|
|
70
|
+
cli?: CliSchemaOptions<TDefault>;
|
|
51
71
|
description?: string;
|
|
52
72
|
cliDescription?: string;
|
|
53
73
|
cliAliases?: readonly string[];
|
|
@@ -67,6 +87,7 @@ type WithNullable<TSchema extends AnySchema, TOptions extends {
|
|
|
67
87
|
} : TSchema;
|
|
68
88
|
export interface SchemaBase<TKind extends SchemaKind, TStatic> {
|
|
69
89
|
readonly kind: TKind;
|
|
90
|
+
readonly cli?: CliSchemaOptions<TStatic>;
|
|
70
91
|
readonly description?: string;
|
|
71
92
|
readonly cliDescription?: string;
|
|
72
93
|
readonly cliAliases?: readonly string[];
|