@wirecat/cli-base 0.27.1 → 0.28.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 +128 -367
- package/dist/commands/document.d.ts.map +1 -1
- package/dist/commands/document.js +4 -3
- package/dist/commands/document.js.map +1 -1
- package/dist/commands/index.d.ts +16 -9
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +24 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/page.d.ts +1 -1
- package/dist/commands/page.d.ts.map +1 -1
- package/dist/commands/page.js +5 -1
- package/dist/commands/page.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -1
- package/dist/config.js.map +1 -1
- package/dist/dev/lint.d.ts.map +1 -1
- package/dist/dev/lint.js +42 -4
- package/dist/dev/lint.js.map +1 -1
- package/dist/dev/main.d.ts +2 -0
- package/dist/dev/main.d.ts.map +1 -1
- package/dist/dev/main.js +9 -6
- package/dist/dev/main.js.map +1 -1
- package/dist/drain.d.ts +3 -0
- package/dist/drain.d.ts.map +1 -0
- package/dist/drain.js +27 -0
- package/dist/drain.js.map +1 -0
- package/dist/errors.d.ts +7 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/failure.d.ts +31 -3
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +45 -7
- package/dist/failure.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/logging.d.ts +4 -5
- package/dist/logging.d.ts.map +1 -1
- package/dist/logging.js +7 -6
- package/dist/logging.js.map +1 -1
- package/dist/standards/effects.d.ts +12 -0
- package/dist/standards/effects.d.ts.map +1 -0
- package/dist/standards/effects.js +10 -0
- package/dist/standards/effects.js.map +1 -0
- package/dist/standards/errors.d.ts +27 -5
- package/dist/standards/errors.d.ts.map +1 -1
- package/dist/standards/errors.js +10 -2
- package/dist/standards/errors.js.map +1 -1
- package/dist/standards/identifiers.d.ts +12 -0
- package/dist/standards/identifiers.d.ts.map +1 -0
- package/dist/standards/identifiers.js +24 -0
- package/dist/standards/identifiers.js.map +1 -0
- package/dist/standards/index.d.ts +6 -4
- package/dist/standards/index.d.ts.map +1 -1
- package/dist/standards/index.js +6 -4
- package/dist/standards/index.js.map +1 -1
- package/dist/standards/lint.d.ts +13 -2
- package/dist/standards/lint.d.ts.map +1 -1
- package/dist/standards/lint.js +46 -3
- package/dist/standards/lint.js.map +1 -1
- package/dist/standards/log.d.ts +15 -0
- package/dist/standards/log.d.ts.map +1 -1
- package/dist/standards/log.js +26 -1
- package/dist/standards/log.js.map +1 -1
- package/dist/standards/output.d.ts +130 -27
- package/dist/standards/output.d.ts.map +1 -1
- package/dist/standards/output.js +64 -15
- package/dist/standards/output.js.map +1 -1
- package/dist/standards/steps.d.ts +23 -5
- package/dist/standards/steps.d.ts.map +1 -1
- package/dist/standards/steps.js +51 -19
- package/dist/standards/steps.js.map +1 -1
- package/dist/standards/vocabulary.d.ts +2 -0
- package/dist/standards/vocabulary.d.ts.map +1 -1
- package/dist/standards/vocabulary.js +24 -1
- package/dist/standards/vocabulary.js.map +1 -1
- package/dist/streams.d.ts +1 -0
- package/dist/streams.d.ts.map +1 -1
- package/dist/streams.js +4 -0
- package/dist/streams.js.map +1 -1
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +7 -0
- package/dist/testing/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,101 +1,175 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
/** At most
|
|
3
|
-
export declare const MAX_NEXT_STEPS =
|
|
2
|
+
/** At most two next steps per answer: the one to take, then one alternative. */
|
|
3
|
+
export declare const MAX_NEXT_STEPS = 2;
|
|
4
4
|
export declare const isoTime: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time with a zone">]>;
|
|
5
5
|
/** The typed name of a stored thing, `msg:telegram/1/2/3` or `note:42`: what every other command takes. */
|
|
6
6
|
export declare const reference: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
7
|
-
export declare const nextStepSchema: v.StrictObjectSchema<{
|
|
7
|
+
export declare const nextStepSchema: v.VariantSchema<"kind", [v.StrictObjectSchema<{
|
|
8
|
+
readonly kind: v.LiteralSchema<"command", undefined>;
|
|
8
9
|
readonly step: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>;
|
|
9
10
|
/** The command path as one string, `messages list` — what the MCP router tools take as `command`. */
|
|
10
11
|
readonly command: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
11
12
|
readonly args: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
|
|
12
13
|
readonly why: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
13
|
-
|
|
14
|
+
/** True only when the target command is known to write nothing, here or at the provider. */
|
|
15
|
+
readonly safe_to_auto_execute: v.BooleanSchema<undefined>;
|
|
16
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
17
|
+
readonly kind: v.LiteralSchema<"user_action", undefined>;
|
|
18
|
+
readonly step: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>;
|
|
19
|
+
readonly why: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
20
|
+
readonly safe_to_auto_execute: v.LiteralSchema<false, undefined>;
|
|
21
|
+
}, undefined>], undefined>;
|
|
14
22
|
export declare const missingSchema: v.StrictObjectSchema<{
|
|
15
23
|
readonly field: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
16
24
|
readonly why: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
17
|
-
|
|
25
|
+
/** Left out when there is nothing to run that would fill the field. */
|
|
26
|
+
readonly step: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>, undefined>;
|
|
18
27
|
}, undefined>;
|
|
19
|
-
|
|
28
|
+
/** `has_more`: another page exists. A cursor source never pretends to have page numbers. */
|
|
29
|
+
export declare const pageSchema: v.VariantSchema<"mode", [v.StrictObjectSchema<{
|
|
30
|
+
readonly mode: v.LiteralSchema<"page", undefined>;
|
|
20
31
|
readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
21
32
|
readonly has_more: v.BooleanSchema<undefined>;
|
|
22
|
-
readonly
|
|
33
|
+
readonly next_page: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 2, undefined>]>, undefined>;
|
|
34
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
35
|
+
readonly mode: v.LiteralSchema<"cursor", undefined>;
|
|
36
|
+
readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
37
|
+
readonly has_more: v.BooleanSchema<undefined>;
|
|
38
|
+
readonly next_cursor: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>;
|
|
39
|
+
}, undefined>], undefined>;
|
|
40
|
+
/** A source that failed or was skipped: the answer holds what the others gave. */
|
|
41
|
+
export declare const issueSchema: v.StrictObjectSchema<{
|
|
42
|
+
readonly code: v.PicklistSchema<readonly ["validation_error", "configuration_error", "authentication_error", "permission_error", "not_found", "confirmation_required", "rate_limited", "timeout", "network_error", "provider_error", "provider_unavailable", "invalid_response", "outcome_unknown", "cancelled"], undefined>;
|
|
43
|
+
readonly reason: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>, undefined>;
|
|
44
|
+
/** The account, provider or source that is missing from the answer. */
|
|
45
|
+
readonly source: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
23
46
|
}, undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* `complete: false` (with `issues`): some source failed or was skipped. `truncated`: a size cap cut the answer.
|
|
49
|
+
* Neither is `page.has_more`.
|
|
50
|
+
*/
|
|
24
51
|
export declare const metaSchema: v.StrictObjectSchema<{
|
|
25
52
|
readonly run_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
26
53
|
readonly duration_ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
27
54
|
readonly accounts: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>, undefined>;
|
|
28
|
-
readonly
|
|
29
|
-
|
|
30
|
-
readonly
|
|
55
|
+
readonly complete: v.BooleanSchema<undefined>;
|
|
56
|
+
readonly issues: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
57
|
+
readonly code: v.PicklistSchema<readonly ["validation_error", "configuration_error", "authentication_error", "permission_error", "not_found", "confirmation_required", "rate_limited", "timeout", "network_error", "provider_error", "provider_unavailable", "invalid_response", "outcome_unknown", "cancelled"], undefined>;
|
|
58
|
+
readonly reason: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>, undefined>;
|
|
59
|
+
/** The account, provider or source that is missing from the answer. */
|
|
60
|
+
readonly source: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
31
61
|
}, undefined>, undefined>, undefined>;
|
|
32
62
|
readonly truncated: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
33
63
|
}, undefined>;
|
|
34
64
|
export declare const listEnvelopeSchema: <T extends v.GenericSchema>(item: T) => v.StrictObjectSchema<{
|
|
35
65
|
readonly items: v.ArraySchema<T, undefined>;
|
|
36
|
-
readonly page: v.StrictObjectSchema<{
|
|
66
|
+
readonly page: v.VariantSchema<"mode", [v.StrictObjectSchema<{
|
|
67
|
+
readonly mode: v.LiteralSchema<"page", undefined>;
|
|
37
68
|
readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
38
69
|
readonly has_more: v.BooleanSchema<undefined>;
|
|
39
|
-
readonly
|
|
40
|
-
}, undefined
|
|
41
|
-
|
|
70
|
+
readonly next_page: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 2, undefined>]>, undefined>;
|
|
71
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
72
|
+
readonly mode: v.LiteralSchema<"cursor", undefined>;
|
|
73
|
+
readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
74
|
+
readonly has_more: v.BooleanSchema<undefined>;
|
|
75
|
+
readonly next_cursor: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>;
|
|
76
|
+
}, undefined>], undefined>;
|
|
77
|
+
readonly next: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"kind", [v.StrictObjectSchema<{
|
|
78
|
+
readonly kind: v.LiteralSchema<"command", undefined>;
|
|
42
79
|
readonly step: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>;
|
|
43
80
|
/** The command path as one string, `messages list` — what the MCP router tools take as `command`. */
|
|
44
81
|
readonly command: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
45
82
|
readonly args: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
|
|
46
83
|
readonly why: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
47
|
-
|
|
84
|
+
/** True only when the target command is known to write nothing, here or at the provider. */
|
|
85
|
+
readonly safe_to_auto_execute: v.BooleanSchema<undefined>;
|
|
86
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
87
|
+
readonly kind: v.LiteralSchema<"user_action", undefined>;
|
|
88
|
+
readonly step: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>;
|
|
89
|
+
readonly why: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
90
|
+
readonly safe_to_auto_execute: v.LiteralSchema<false, undefined>;
|
|
91
|
+
}, undefined>], undefined>, undefined>, v.MaxLengthAction<({
|
|
92
|
+
kind: "command";
|
|
48
93
|
step: string;
|
|
49
94
|
command: string;
|
|
50
95
|
args: {
|
|
51
96
|
[x: string]: unknown;
|
|
52
97
|
};
|
|
53
98
|
why: string;
|
|
54
|
-
|
|
99
|
+
safe_to_auto_execute: boolean;
|
|
100
|
+
} | {
|
|
101
|
+
kind: "user_action";
|
|
102
|
+
step: string;
|
|
103
|
+
why: string;
|
|
104
|
+
safe_to_auto_execute: false;
|
|
105
|
+
})[], 2, undefined>]>, undefined>;
|
|
55
106
|
readonly missing: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
56
107
|
readonly field: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
57
108
|
readonly why: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
58
|
-
|
|
109
|
+
/** Left out when there is nothing to run that would fill the field. */
|
|
110
|
+
readonly step: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>, undefined>;
|
|
59
111
|
}, undefined>, undefined>, undefined>;
|
|
60
112
|
readonly meta: v.StrictObjectSchema<{
|
|
61
113
|
readonly run_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
62
114
|
readonly duration_ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
63
115
|
readonly accounts: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>, undefined>;
|
|
64
|
-
readonly
|
|
65
|
-
|
|
66
|
-
readonly
|
|
116
|
+
readonly complete: v.BooleanSchema<undefined>;
|
|
117
|
+
readonly issues: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
118
|
+
readonly code: v.PicklistSchema<readonly ["validation_error", "configuration_error", "authentication_error", "permission_error", "not_found", "confirmation_required", "rate_limited", "timeout", "network_error", "provider_error", "provider_unavailable", "invalid_response", "outcome_unknown", "cancelled"], undefined>;
|
|
119
|
+
readonly reason: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>, undefined>;
|
|
120
|
+
/** The account, provider or source that is missing from the answer. */
|
|
121
|
+
readonly source: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
67
122
|
}, undefined>, undefined>, undefined>;
|
|
68
123
|
readonly truncated: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
69
124
|
}, undefined>;
|
|
70
125
|
}, undefined>;
|
|
71
126
|
export declare const itemEnvelopeSchema: <T extends v.GenericSchema>(item: T) => v.StrictObjectSchema<{
|
|
72
127
|
readonly item: T;
|
|
73
|
-
readonly next: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StrictObjectSchema<{
|
|
128
|
+
readonly next: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"kind", [v.StrictObjectSchema<{
|
|
129
|
+
readonly kind: v.LiteralSchema<"command", undefined>;
|
|
74
130
|
readonly step: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>;
|
|
75
131
|
/** The command path as one string, `messages list` — what the MCP router tools take as `command`. */
|
|
76
132
|
readonly command: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
77
133
|
readonly args: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
|
|
78
134
|
readonly why: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
79
|
-
|
|
135
|
+
/** True only when the target command is known to write nothing, here or at the provider. */
|
|
136
|
+
readonly safe_to_auto_execute: v.BooleanSchema<undefined>;
|
|
137
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
138
|
+
readonly kind: v.LiteralSchema<"user_action", undefined>;
|
|
139
|
+
readonly step: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>;
|
|
140
|
+
readonly why: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
141
|
+
readonly safe_to_auto_execute: v.LiteralSchema<false, undefined>;
|
|
142
|
+
}, undefined>], undefined>, undefined>, v.MaxLengthAction<({
|
|
143
|
+
kind: "command";
|
|
80
144
|
step: string;
|
|
81
145
|
command: string;
|
|
82
146
|
args: {
|
|
83
147
|
[x: string]: unknown;
|
|
84
148
|
};
|
|
85
149
|
why: string;
|
|
86
|
-
|
|
150
|
+
safe_to_auto_execute: boolean;
|
|
151
|
+
} | {
|
|
152
|
+
kind: "user_action";
|
|
153
|
+
step: string;
|
|
154
|
+
why: string;
|
|
155
|
+
safe_to_auto_execute: false;
|
|
156
|
+
})[], 2, undefined>]>, undefined>;
|
|
87
157
|
readonly missing: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
88
158
|
readonly field: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
89
159
|
readonly why: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
90
|
-
|
|
160
|
+
/** Left out when there is nothing to run that would fill the field. */
|
|
161
|
+
readonly step: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>, undefined>;
|
|
91
162
|
}, undefined>, undefined>, undefined>;
|
|
92
163
|
readonly meta: v.StrictObjectSchema<{
|
|
93
164
|
readonly run_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
94
165
|
readonly duration_ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
95
166
|
readonly accounts: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>, undefined>;
|
|
96
|
-
readonly
|
|
97
|
-
|
|
98
|
-
readonly
|
|
167
|
+
readonly complete: v.BooleanSchema<undefined>;
|
|
168
|
+
readonly issues: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
169
|
+
readonly code: v.PicklistSchema<readonly ["validation_error", "configuration_error", "authentication_error", "permission_error", "not_found", "confirmation_required", "rate_limited", "timeout", "network_error", "provider_error", "provider_unavailable", "invalid_response", "outcome_unknown", "cancelled"], undefined>;
|
|
170
|
+
readonly reason: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>, undefined>;
|
|
171
|
+
/** The account, provider or source that is missing from the answer. */
|
|
172
|
+
readonly source: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
99
173
|
}, undefined>, undefined>, undefined>;
|
|
100
174
|
readonly truncated: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
101
175
|
}, undefined>;
|
|
@@ -103,6 +177,7 @@ export declare const itemEnvelopeSchema: <T extends v.GenericSchema>(item: T) =>
|
|
|
103
177
|
export type NextStep = v.InferOutput<typeof nextStepSchema>;
|
|
104
178
|
export type Missing = v.InferOutput<typeof missingSchema>;
|
|
105
179
|
export type Page = v.InferOutput<typeof pageSchema>;
|
|
180
|
+
export type Issue = v.InferOutput<typeof issueSchema>;
|
|
106
181
|
export type Meta = v.InferOutput<typeof metaSchema>;
|
|
107
182
|
export interface ListEnvelope<T> {
|
|
108
183
|
items: T[];
|
|
@@ -124,5 +199,33 @@ declare const fieldRuleSchema: v.StrictObjectSchema<{
|
|
|
124
199
|
export type FieldRule = v.InferOutput<typeof fieldRuleSchema>;
|
|
125
200
|
export declare const defineFieldRules: (input: unknown) => FieldRule[];
|
|
126
201
|
export declare const FIELD_RULES: FieldRule[];
|
|
202
|
+
/** `--jsonl`: one item per line, then one end line, so a reader tells a finished stream from a cut one. */
|
|
203
|
+
export declare const jsonlItemSchema: <T extends v.GenericSchema>(item: T) => v.StrictObjectSchema<{
|
|
204
|
+
readonly type: v.LiteralSchema<"item", undefined>;
|
|
205
|
+
readonly data: T;
|
|
206
|
+
}, undefined>;
|
|
207
|
+
export declare const jsonlEndSchema: v.StrictObjectSchema<{
|
|
208
|
+
readonly type: v.LiteralSchema<"end", undefined>;
|
|
209
|
+
readonly complete: v.BooleanSchema<undefined>;
|
|
210
|
+
readonly issues: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
211
|
+
readonly code: v.PicklistSchema<readonly ["validation_error", "configuration_error", "authentication_error", "permission_error", "not_found", "confirmation_required", "rate_limited", "timeout", "network_error", "provider_error", "provider_unavailable", "invalid_response", "outcome_unknown", "cancelled"], undefined>;
|
|
212
|
+
readonly reason: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>, undefined>;
|
|
213
|
+
/** The account, provider or source that is missing from the answer. */
|
|
214
|
+
readonly source: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
215
|
+
}, undefined>, undefined>, undefined>;
|
|
216
|
+
readonly page: v.VariantSchema<"mode", [v.StrictObjectSchema<{
|
|
217
|
+
readonly mode: v.LiteralSchema<"page", undefined>;
|
|
218
|
+
readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
219
|
+
readonly has_more: v.BooleanSchema<undefined>;
|
|
220
|
+
readonly next_page: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 2, undefined>]>, undefined>;
|
|
221
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
222
|
+
readonly mode: v.LiteralSchema<"cursor", undefined>;
|
|
223
|
+
readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
224
|
+
readonly has_more: v.BooleanSchema<undefined>;
|
|
225
|
+
readonly next_cursor: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>;
|
|
226
|
+
}, undefined>], undefined>;
|
|
227
|
+
}, undefined>;
|
|
228
|
+
/** A list answer as JSON lines, the end line last. */
|
|
229
|
+
export declare const jsonlOf: <T>({ items, page, meta }: ListEnvelope<T>) => string;
|
|
127
230
|
export {};
|
|
128
231
|
//# sourceMappingURL=output.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/standards/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/standards/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B,gFAAgF;AAChF,eAAO,MAAM,cAAc,IAAI,CAAA;AAE/B,eAAO,MAAM,OAAO,sHAAqE,CAAA;AAEzF,2GAA2G;AAC3G,eAAO,MAAM,SAAS,gHAA+E,CAAA;AAErG,eAAO,MAAM,cAAc;;;IAIvB,qGAAqG;;;;IAIrG,4FAA4F;;;;;;;0BAU9F,CAAA;AAEF,eAAO,MAAM,aAAa;;;IAGxB,uEAAuE;;aAEvE,CAAA;AAIF,4FAA4F;AAC5F,eAAO,MAAM,UAAU;;;;;;;;;;0BAQrB,CAAA;AAEF,kFAAkF;AAClF,eAAO,MAAM,WAAW;;;IAGtB,uEAAuE;;aAEvE,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;QARrB,uEAAuE;;;;aAevE,CAAA;AAIF,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,CAAC,CAAC,aAAa,QAAQ,CAAC;;;;;;;;;;;;;;;;QA3DjE,qGAAqG;;;;QAIrG,4FAA4F;;;;;;;;;;;;;;;;;;;;;;;;;QAe9F,uEAAuE;;;;;;;;;;;YAqBvE,uEAAuE;;;;;aA0BrE,CAAA;AAEJ,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,CAAC,CAAC,aAAa,QAAQ,CAAC;;;;;QApEjE,qGAAqG;;;;QAIrG,4FAA4F;;;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eAAO,MAAM,cAAc;;;;;;QAhFzB,uEAAuE;;;;;;;;;;;;;;aAqFvE,CAAA;AAEF,sDAAsD;AACtD,eAAO,MAAM,OAAO,GAAI,CAAC,yBAAyB,YAAY,CAAC,CAAC,CAAC,KAAG,MAItD,CAAA"}
|
package/dist/standards/output.js
CHANGED
|
@@ -1,32 +1,64 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
+
import { errorCodes } from "../errors.js";
|
|
2
3
|
import { dottedId, duplicates, parseRegistry, text, word } from "./registry.js";
|
|
3
|
-
/** At most
|
|
4
|
-
export const MAX_NEXT_STEPS =
|
|
4
|
+
/** At most two next steps per answer: the one to take, then one alternative. */
|
|
5
|
+
export const MAX_NEXT_STEPS = 2;
|
|
5
6
|
export const isoTime = v.pipe(v.string(), v.isoTimestamp("an ISO 8601 time with a zone"));
|
|
6
7
|
/** The typed name of a stored thing, `msg:telegram/1/2/3` or `note:42`: what every other command takes. */
|
|
7
8
|
export const reference = v.pipe(v.string(), v.regex(/^[a-z]+:\S+$/, "a reference such as `note:42`"));
|
|
8
|
-
export const nextStepSchema = v.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
export const nextStepSchema = v.variant("kind", [
|
|
10
|
+
v.strictObject({
|
|
11
|
+
kind: v.literal("command"),
|
|
12
|
+
step: dottedId,
|
|
13
|
+
/** The command path as one string, `messages list` — what the MCP router tools take as `command`. */
|
|
14
|
+
command: text,
|
|
15
|
+
args: v.record(v.string(), v.unknown()),
|
|
16
|
+
why: text,
|
|
17
|
+
/** True only when the target command is known to write nothing, here or at the provider. */
|
|
18
|
+
safe_to_auto_execute: v.boolean(),
|
|
19
|
+
}),
|
|
20
|
+
/** Something only the person can do — sign in on the phone, approve a device. */
|
|
21
|
+
v.strictObject({
|
|
22
|
+
kind: v.literal("user_action"),
|
|
23
|
+
step: dottedId,
|
|
24
|
+
why: text,
|
|
25
|
+
safe_to_auto_execute: v.literal(false),
|
|
26
|
+
}),
|
|
27
|
+
]);
|
|
15
28
|
export const missingSchema = v.strictObject({
|
|
16
29
|
field: text,
|
|
17
30
|
why: text,
|
|
18
|
-
|
|
31
|
+
/** Left out when there is nothing to run that would fill the field. */
|
|
32
|
+
step: v.optional(dottedId),
|
|
19
33
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
const limit = v.pipe(v.number(), v.integer(), v.minValue(1));
|
|
35
|
+
/** `has_more`: another page exists. A cursor source never pretends to have page numbers. */
|
|
36
|
+
export const pageSchema = v.variant("mode", [
|
|
37
|
+
v.strictObject({
|
|
38
|
+
mode: v.literal("page"),
|
|
39
|
+
limit,
|
|
40
|
+
has_more: v.boolean(),
|
|
41
|
+
next_page: v.optional(v.pipe(v.number(), v.integer(), v.minValue(2))),
|
|
42
|
+
}),
|
|
43
|
+
v.strictObject({ mode: v.literal("cursor"), limit, has_more: v.boolean(), next_cursor: v.optional(text) }),
|
|
44
|
+
]);
|
|
45
|
+
/** A source that failed or was skipped: the answer holds what the others gave. */
|
|
46
|
+
export const issueSchema = v.strictObject({
|
|
47
|
+
code: v.picklist(errorCodes),
|
|
48
|
+
reason: v.optional(dottedId),
|
|
49
|
+
/** The account, provider or source that is missing from the answer. */
|
|
50
|
+
source: text,
|
|
24
51
|
});
|
|
52
|
+
/**
|
|
53
|
+
* `complete: false` (with `issues`): some source failed or was skipped. `truncated`: a size cap cut the answer.
|
|
54
|
+
* Neither is `page.has_more`.
|
|
55
|
+
*/
|
|
25
56
|
export const metaSchema = v.strictObject({
|
|
26
57
|
run_id: text,
|
|
27
58
|
duration_ms: v.pipe(v.number(), v.integer(), v.minValue(0)),
|
|
28
59
|
accounts: v.optional(v.array(text)),
|
|
29
|
-
|
|
60
|
+
complete: v.boolean(),
|
|
61
|
+
issues: v.optional(v.array(issueSchema)),
|
|
30
62
|
truncated: v.optional(v.boolean()),
|
|
31
63
|
});
|
|
32
64
|
const nextSteps = v.optional(v.pipe(v.array(nextStepSchema), v.maxLength(MAX_NEXT_STEPS)));
|
|
@@ -52,5 +84,22 @@ export const FIELD_RULES = defineFieldRules([
|
|
|
52
84
|
{ id: "ref", rule: "a stored thing is named by `ref`; a message's `ref` value is its locator" },
|
|
53
85
|
{ id: "snake-case", rule: "keys are snake_case words, no abbreviations a reader has to decode" },
|
|
54
86
|
{ id: "one-meaning", rule: "a key has one meaning and one type in every answer of every CLI" },
|
|
87
|
+
{
|
|
88
|
+
id: "absent-null",
|
|
89
|
+
rule: "absent: not asked for or not known; `null`: known to have no value; `[]`: known to be empty, never `null`; `0`: measured, never a stand-in for unknown",
|
|
90
|
+
},
|
|
55
91
|
]);
|
|
92
|
+
/** `--jsonl`: one item per line, then one end line, so a reader tells a finished stream from a cut one. */
|
|
93
|
+
export const jsonlItemSchema = (item) => v.strictObject({ type: v.literal("item"), data: item });
|
|
94
|
+
export const jsonlEndSchema = v.strictObject({
|
|
95
|
+
type: v.literal("end"),
|
|
96
|
+
complete: v.boolean(),
|
|
97
|
+
issues: v.optional(v.array(issueSchema)),
|
|
98
|
+
page: pageSchema,
|
|
99
|
+
});
|
|
100
|
+
/** A list answer as JSON lines, the end line last. */
|
|
101
|
+
export const jsonlOf = ({ items, page, meta }) => [
|
|
102
|
+
...items.map((data) => JSON.stringify({ type: "item", data })),
|
|
103
|
+
JSON.stringify({ type: "end", complete: meta.complete, ...(meta.issues ? { issues: meta.issues } : {}), page }),
|
|
104
|
+
].join("\n");
|
|
56
105
|
//# sourceMappingURL=output.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/standards/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAE/E,
|
|
1
|
+
{"version":3,"file":"output.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AAC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;AAEzD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,YAAY,CAAC;IAC3C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACtB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACxC,IAAI,EAAE,UAAU;CACjB,CAAC,CAAA;AAEF,sDAAsD;AACtD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAmB,EAAU,EAAE,CAC3E;IACE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9D,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC;CAChH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -1,27 +1,45 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
+
import { type Effects } from "./effects.js";
|
|
2
3
|
import type { NextStep } from "./output.js";
|
|
3
4
|
/** A step's command: a path such as `messages sync`, or `*` for the command that gave the answer (`page.next`). */
|
|
4
5
|
export declare const SAME_COMMAND = "*";
|
|
5
|
-
declare const stepSchema: v.StrictObjectSchema<{
|
|
6
|
+
declare const stepSchema: v.UnionSchema<[v.StrictObjectSchema<{
|
|
6
7
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>;
|
|
8
|
+
readonly kind: v.OptionalSchema<v.LiteralSchema<"command", undefined>, "command">;
|
|
7
9
|
readonly command: v.UnionSchema<[v.LiteralSchema<"*", undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a command path such as `messages sync`">]>], undefined>;
|
|
8
10
|
readonly args: v.ArraySchema<v.StrictObjectSchema<{
|
|
9
11
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "an argument or option name in snake_case">]>;
|
|
10
12
|
readonly required: v.BooleanSchema<undefined>;
|
|
11
13
|
}, undefined>, undefined>;
|
|
12
14
|
readonly why: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, v.MaxLengthAction<string, 120, undefined>]>;
|
|
13
|
-
}, undefined
|
|
15
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
16
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "dotted lower-case words, such as `page.next`">]>;
|
|
17
|
+
readonly kind: v.LiteralSchema<"user_action", undefined>;
|
|
18
|
+
readonly why: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, v.MaxLengthAction<string, 120, undefined>]>;
|
|
19
|
+
}, undefined>], undefined>;
|
|
14
20
|
export type StepDefinition = v.InferOutput<typeof stepSchema>;
|
|
15
21
|
export declare const defineSteps: (input: unknown) => StepDefinition[];
|
|
22
|
+
/** What a step's command is, read from the live command tree (`stepTargets` in `/commands`). */
|
|
23
|
+
export interface StepTarget {
|
|
24
|
+
effects?: Effects;
|
|
25
|
+
/** Its arguments and options in snake_case. */
|
|
26
|
+
names: readonly string[];
|
|
27
|
+
}
|
|
16
28
|
export interface StepInput {
|
|
17
|
-
args
|
|
29
|
+
args?: Readonly<Record<string, unknown>>;
|
|
18
30
|
/** Values for the `{placeholders}` of `why` that are not arguments. */
|
|
19
31
|
values?: Readonly<Record<string, string | number>>;
|
|
20
32
|
/** Required when the step's command is `*`. */
|
|
21
33
|
command?: string;
|
|
34
|
+
/** Looks a command path up; without it, or for a path it does not know, the step is never safe to run unasked. */
|
|
35
|
+
targets?: (command: string) => StepTarget | undefined;
|
|
22
36
|
}
|
|
23
|
-
/**
|
|
24
|
-
|
|
37
|
+
/**
|
|
38
|
+
* One `next` entry from its definition: checks the arguments against the definition and, when `targets` knows the
|
|
39
|
+
* command, against the options it really takes; fills `why`. Build steps only from state the CLI owns — ids, counts,
|
|
40
|
+
* cursors — never from text a message, email or document carried.
|
|
41
|
+
*/
|
|
42
|
+
export declare const stepOf: (definition: StepDefinition, input?: StepInput) => NextStep;
|
|
25
43
|
/** The steps every CLI has; each package adds its own with `defineSteps`. */
|
|
26
44
|
export declare const STEPS: StepDefinition[];
|
|
27
45
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/standards/steps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAG3C,mHAAmH;AACnH,eAAO,MAAM,YAAY,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/standards/steps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAG3C,mHAAmH;AACnH,eAAO,MAAM,YAAY,MAAM,CAAA;AAO/B,QAAA,MAAM,UAAU;;;;;;;;;;;;;0BAcd,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,UAAU,CAAC,CAAA;AAI7D,eAAO,MAAM,WAAW,UAAW,OAAO,KAAG,cAAc,EAMvD,CAAA;AAEJ,gGAAgG;AAChG,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,+CAA+C;IAC/C,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CACzB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACxC,uEAAuE;IACvE,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAA;IAClD,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,kHAAkH;IAClH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,CAAA;CACtD;AAOD;;;;GAIG;AACH,eAAO,MAAM,MAAM,eAAgB,cAAc,UAAS,SAAS,KAAQ,QAyC1E,CAAA;AAED,6EAA6E;AAC7E,eAAO,MAAM,KAAK,EAAE,cAAc,EAWhC,CAAA"}
|
package/dist/standards/steps.js
CHANGED
|
@@ -1,43 +1,75 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
+
import { writes } from "./effects.js";
|
|
2
3
|
import { dottedId, duplicates, fill, parseRegistry, SNAKE_CASE, text } from "./registry.js";
|
|
3
4
|
/** A step's command: a path such as `messages sync`, or `*` for the command that gave the answer (`page.next`). */
|
|
4
5
|
export const SAME_COMMAND = "*";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
v.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})
|
|
6
|
+
const commandPath = v.pipe(v.string(), v.regex(/^[a-z][a-z0-9-]*( [a-z][a-z0-9-]*)*$/, "a command path such as `messages sync`"));
|
|
7
|
+
const stepSchema = v.union([
|
|
8
|
+
v.strictObject({
|
|
9
|
+
id: dottedId,
|
|
10
|
+
kind: v.optional(v.literal("command"), "command"),
|
|
11
|
+
command: v.union([v.literal(SAME_COMMAND), commandPath]),
|
|
12
|
+
args: v.array(v.strictObject({
|
|
13
|
+
name: v.pipe(v.string(), v.regex(SNAKE_CASE, "an argument or option name in snake_case")),
|
|
14
|
+
required: v.boolean(),
|
|
15
|
+
})),
|
|
16
|
+
why: v.pipe(text, v.maxLength(120)),
|
|
17
|
+
}),
|
|
18
|
+
v.strictObject({ id: dottedId, kind: v.literal("user_action"), why: v.pipe(text, v.maxLength(120)) }),
|
|
19
|
+
]);
|
|
20
|
+
const argsOf = (step) => (step.kind === "command" ? step.args : []);
|
|
17
21
|
export const defineSteps = (input) => parseRegistry("steps", v.array(stepSchema), input, (steps) => [
|
|
18
22
|
...duplicates(steps.map((step) => step.id)).map((id) => `"${id}" is listed twice`),
|
|
19
|
-
...steps.flatMap((step) => duplicates(step.
|
|
23
|
+
...steps.flatMap((step) => duplicates(argsOf(step).map((arg) => arg.name)).map((name) => `${step.id}: argument "${name}" is listed twice`)),
|
|
20
24
|
]);
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
// A value that would bind to an option: a scalar on one line. A paragraph read out of a message is not one.
|
|
26
|
+
const BINDS = /^[^\p{Cc}\u2028\u2029]*$/u;
|
|
27
|
+
const binds = (value) => typeof value === "number" || typeof value === "boolean" || (typeof value === "string" && BINDS.test(value));
|
|
28
|
+
/**
|
|
29
|
+
* One `next` entry from its definition: checks the arguments against the definition and, when `targets` knows the
|
|
30
|
+
* command, against the options it really takes; fills `why`. Build steps only from state the CLI owns — ids, counts,
|
|
31
|
+
* cursors — never from text a message, email or document carried.
|
|
32
|
+
*/
|
|
33
|
+
export const stepOf = (definition, input = {}) => {
|
|
34
|
+
const args = input.args ?? {};
|
|
35
|
+
if (definition.kind === "user_action")
|
|
36
|
+
return {
|
|
37
|
+
kind: "user_action",
|
|
38
|
+
step: definition.id,
|
|
39
|
+
why: fill(definition.why, { ...input.values }),
|
|
40
|
+
safe_to_auto_execute: false,
|
|
41
|
+
};
|
|
23
42
|
const command = definition.command === SAME_COMMAND ? input.command : definition.command;
|
|
24
43
|
if (!command)
|
|
25
44
|
throw new Error(`${definition.id}: the step runs the same command, so pass the command`);
|
|
26
45
|
const known = new Set(definition.args.map((arg) => arg.name));
|
|
27
46
|
// A step that reruns the answer's command carries that command's own arguments too.
|
|
28
47
|
if (definition.command !== SAME_COMMAND)
|
|
29
|
-
for (const name of Object.keys(
|
|
48
|
+
for (const name of Object.keys(args))
|
|
30
49
|
if (!known.has(name))
|
|
31
50
|
throw new Error(`${definition.id}: no argument "${name}"`);
|
|
32
51
|
for (const arg of definition.args)
|
|
33
|
-
if (arg.required &&
|
|
52
|
+
if (arg.required && args[arg.name] === undefined)
|
|
34
53
|
throw new Error(`${definition.id}: argument "${arg.name}" is required`);
|
|
35
|
-
const
|
|
54
|
+
for (const [name, value] of Object.entries(args))
|
|
55
|
+
if (!(Array.isArray(value) ? value.every(binds) : binds(value)))
|
|
56
|
+
throw new Error(`${definition.id}: "${name}" is not a value an option takes`);
|
|
57
|
+
const target = input.targets?.(command);
|
|
58
|
+
if (input.targets && !target)
|
|
59
|
+
throw new Error(`${definition.id}: no command "${command}"`);
|
|
60
|
+
const names = new Set(target?.names ?? []);
|
|
61
|
+
if (target)
|
|
62
|
+
for (const name of Object.keys(args))
|
|
63
|
+
if (!names.has(name))
|
|
64
|
+
throw new Error(`${definition.id}: "${command}" takes no "${name}"`);
|
|
65
|
+
const scalars = Object.fromEntries(Object.entries(args).filter((entry) => ["string", "number"].includes(typeof entry[1])));
|
|
36
66
|
return {
|
|
67
|
+
kind: "command",
|
|
37
68
|
step: definition.id,
|
|
38
69
|
command,
|
|
39
|
-
args: { ...
|
|
70
|
+
args: { ...args },
|
|
40
71
|
why: fill(definition.why, { ...scalars, ...input.values }),
|
|
72
|
+
safe_to_auto_execute: target?.effects !== undefined && !writes(target.effects),
|
|
41
73
|
};
|
|
42
74
|
};
|
|
43
75
|
/** The steps every CLI has; each package adds its own with `defineSteps`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../../src/standards/steps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../../src/standards/steps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAgB,MAAM,EAAE,MAAM,cAAc,CAAA;AAEnD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAE3F,mHAAmH;AACnH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA;AAE/B,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CACxB,CAAC,CAAC,MAAM,EAAE,EACV,CAAC,CAAC,KAAK,CAAC,sCAAsC,EAAE,wCAAwC,CAAC,CAC1F,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC;IACzB,CAAC,CAAC,YAAY,CAAC;QACb,EAAE,EAAE,QAAQ;QACZ,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;QACjD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,WAAW,CAAC,CAAC;QACxD,IAAI,EAAE,CAAC,CAAC,KAAK,CACX,CAAC,CAAC,YAAY,CAAC;YACb,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KA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M,OAAO,GAAG,MAAM,CAAC,WAAW,CAChC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAsC,EAAE,CACxE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAC/C,CACF,CAAA;IACD,OAAO;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,UAAU,CAAC,EAAE;QACnB,OAAO;QACP,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE;QACjB,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAC1D,oBAAoB,EAAE,MAAM,EAAE,OAAO,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;KAC/E,CAAA;AACH,CAAC,CAAA;AAED,6EAA6E;AAC7E,MAAM,CAAC,MAAM,KAAK,GAAqB,WAAW,CAAC;IACjD;QACE,EAAE,EAAE,WAAW;QACf,OAAO,EAAE,YAAY;QACrB,IAAI,EAAE;YACJ,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE;YACnC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE;YACjC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE;SACnC;QACD,GAAG,EAAE,2BAA2B;KACjC;CACF,CAAC,CAAA"}
|
|
@@ -44,6 +44,8 @@ export declare const vocabularySchema: v.StrictObjectSchema<{
|
|
|
44
44
|
readonly role: v.PicklistSchema<["action" | "budget" | "mode" | "output" | "paging" | "query" | "scope" | "sort" | "target" | "value", ...("action" | "budget" | "mode" | "output" | "paging" | "query" | "scope" | "sort" | "target" | "value")[]], undefined>;
|
|
45
45
|
readonly meaning: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
|
|
46
46
|
readonly unit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>;
|
|
47
|
+
/** Other names for the same flag, which `flag-synonym` refuses. */
|
|
48
|
+
readonly replaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a long flag">]>, undefined>, undefined>;
|
|
47
49
|
}, undefined>, undefined>;
|
|
48
50
|
}, undefined>;
|
|
49
51
|
export type Vocabulary = v.InferOutput<typeof vocabularySchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabulary.d.ts","sourceRoot":"","sources":["../../src/standards/vocabulary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B,eAAO,MAAM,UAAU,YACrB,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,UAAU,EACV,QAAQ,EACR,MAAM,EACN,MAAM,EACN,QAAQ,CACA,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,UAAU;aACrB,MAAM,EAAE,sEAAsE;aAC9E,MAAM,EAAE,mCAAmC;aAC3C,IAAI,EAAE,yBAAyB;aAC/B,IAAI,EAAE,yCAAyC;aAC/C,MAAM,EAAE,yCAAyC;aACjD,MAAM,EAAE,6CAA6C;aACrD,KAAK,EAAE,sGAAsG;aAC7G,MAAM,EAAE,kFAAkF;aAC1F,KAAK,EAAE,yBAAyB;aAChC,KAAK,EAAE,4DAA4D;CAC3D,CAAA;AACV,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"vocabulary.d.ts","sourceRoot":"","sources":["../../src/standards/vocabulary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B,eAAO,MAAM,UAAU,YACrB,Q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