@hop-top/kit 0.5.0-alpha.1 → 0.5.0-alpha.11
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/CHANGELOG.md +275 -0
- package/LICENSE +1 -1
- package/LICENSE-cobra.txt +174 -0
- package/NOTICE +15 -0
- package/README.md +55 -259
- package/dist/aim-DZHwwiIc.d.ts +139 -0
- package/dist/aim.d.ts +1 -116
- package/dist/aim.js +13 -414
- package/dist/alias-D9_qFlyP.d.ts +174 -0
- package/dist/alias.d.ts +2 -73
- package/dist/alias.js +27 -207
- package/dist/api-DAexsu2H.d.ts +77 -0
- package/dist/api.d.ts +1 -62
- package/dist/api.js +10 -164
- package/dist/auth-2-jfgiHn.d.ts +34 -0
- package/dist/auth.d.ts +1 -26
- package/dist/auth.js +6 -40
- package/dist/chunk-3FIKGFKI.js +54 -0
- package/dist/chunk-4FMALWYB.js +669 -0
- package/dist/chunk-4GPCWBBA.js +143 -0
- package/dist/chunk-4UE5TCMQ.js +104 -0
- package/dist/chunk-65VPWMPV.js +1134 -0
- package/dist/chunk-6HFAEZ52.js +29 -0
- package/dist/chunk-6SVOHNIC.js +17 -0
- package/dist/chunk-BDNNPRX6.js +41 -0
- package/dist/chunk-BRNEKPWX.js +37 -0
- package/dist/chunk-BXJ2J27B.js +219 -0
- package/dist/chunk-CSJWB6D3.js +151 -0
- package/dist/chunk-CXBZTONY.js +65 -0
- package/dist/chunk-EE4M2UOF.js +818 -0
- package/dist/chunk-GFRAYYRD.js +817 -0
- package/dist/chunk-IVQHLI56.js +1890 -0
- package/dist/chunk-IZ6Q4SE3.js +178 -0
- package/dist/chunk-JKMQSAJP.js +174 -0
- package/dist/chunk-K7E34Q3A.js +1445 -0
- package/dist/chunk-KVG7YCTS.js +115 -0
- package/dist/chunk-L23O2FFE.js +51 -0
- package/dist/chunk-MFVUENZR.js +1549 -0
- package/dist/chunk-ML7D5DWY.js +263 -0
- package/dist/chunk-MQXYDYRD.js +968 -0
- package/dist/chunk-POR5L2DG.js +247 -0
- package/dist/chunk-QJVSKKRQ.js +369 -0
- package/dist/chunk-QQQYCWSC.js +240 -0
- package/dist/chunk-R5U7XKVJ.js +16 -0
- package/dist/chunk-RYKLVOVK.js +309 -0
- package/dist/chunk-SNVGDYX7.js +187 -0
- package/dist/chunk-T6OZMPPV.js +68 -0
- package/dist/chunk-UKZIAQA7.js +26 -0
- package/dist/chunk-VGOA5Y7S.js +251 -0
- package/dist/chunk-VWGP4NVJ.js +513 -0
- package/dist/chunk-WBVO43HU.js +355 -0
- package/dist/chunk-WUOAQVOA.js +86 -0
- package/dist/chunk-XJTRY453.js +868 -0
- package/dist/chunk-YOBAUCVN.js +583 -0
- package/dist/cli-RSRk1M36.d.ts +707 -0
- package/dist/cli.d.ts +7 -309
- package/dist/cli.js +125 -945
- package/dist/completion-csVun6SP.d.ts +112 -0
- package/dist/completion-values-By-mnjNt.d.ts +142 -0
- package/dist/completion-values.d.ts +1 -0
- package/dist/completion-values.js +29 -0
- package/dist/completion.d.ts +3 -0
- package/dist/completion.js +34 -0
- package/dist/compliance-AxFf-uMy.d.ts +60 -0
- package/dist/compliance.d.ts +1 -0
- package/dist/compliance.js +17 -0
- package/dist/config-CaK60ByQ.d.ts +241 -0
- package/dist/config.d.ts +1 -97
- package/dist/config.js +8 -78
- package/dist/errcorrect-BcX1Ft0K.d.ts +44 -0
- package/dist/errcorrect.d.ts +1 -37
- package/dist/errcorrect.js +8 -68
- package/dist/error-Do8Qji43.d.ts +231 -0
- package/dist/id/index.d.ts +2 -83
- package/dist/id/index.js +14 -65
- package/dist/index-BKJZClJx.d.ts +1486 -0
- package/dist/index-C3Zw4wDJ.d.ts +359 -0
- package/dist/index-CGE5yLBj.d.ts +328 -0
- package/dist/index-VLDcI5NF.d.ts +95 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +132 -0
- package/dist/llm-DYuR7_uX.d.ts +1069 -0
- package/dist/llm-anthropic-Cd_I2xXB.d.ts +67 -0
- package/dist/llm-anthropic.d.ts +2 -0
- package/dist/llm-anthropic.js +13 -0
- package/dist/llm-openai-DyFrucmV.d.ts +87 -0
- package/dist/llm-openai.d.ts +2 -0
- package/dist/llm-openai.js +19 -0
- package/dist/llm.d.ts +1 -188
- package/dist/llm.js +101 -356
- package/dist/log-CkaxMX3U.d.ts +115 -0
- package/dist/log.d.ts +2 -0
- package/dist/log.js +14 -0
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.js +185 -0
- package/dist/netpolicy-Brx5XZUB.d.ts +151 -0
- package/dist/netpolicy.d.ts +1 -0
- package/dist/netpolicy.js +25 -0
- package/dist/output-CjZWmL8s.d.ts +420 -0
- package/dist/output.d.ts +3 -213
- package/dist/output.js +135 -447
- package/dist/parity-CvMuYcVI.d.ts +61 -0
- package/dist/progress-CAzyxeWl.d.ts +38 -0
- package/dist/progress.d.ts +1 -30
- package/dist/progress.js +6 -55
- package/dist/provenance-SMFHm5gx.d.ts +30 -0
- package/dist/provenance.d.ts +1 -24
- package/dist/provenance.js +6 -31
- package/dist/routellm-B0nv59mH.d.ts +111 -0
- package/dist/routellm.d.ts +2 -64
- package/dist/routellm.js +13 -255
- package/dist/rpc-D31Lg0Kc.d.ts +32 -0
- package/dist/rpc.d.ts +2 -25
- package/dist/rpc.js +4 -98
- package/dist/safety-CUaYEjZc.d.ts +30 -0
- package/dist/safety.d.ts +1 -24
- package/dist/safety.js +6 -43
- package/dist/scope-BrhYB4ij.d.ts +141 -0
- package/dist/scope.d.ts +1 -121
- package/dist/scope.js +20 -377
- package/dist/serve-D8yWMrTc.d.ts +646 -0
- package/dist/serve.d.ts +3 -0
- package/dist/serve.js +75 -0
- package/dist/sqlstore.js +6 -39
- package/dist/stream-CrjeCp0M.d.ts +44 -0
- package/dist/stream.d.ts +1 -35
- package/dist/stream.js +8 -51
- package/dist/telemetry/index.d.ts +1 -315
- package/dist/telemetry/index.js +26 -599
- package/dist/toolspec-DcPwwoAZ.d.ts +368 -0
- package/dist/toolspec.d.ts +2 -0
- package/dist/toolspec.js +37 -0
- package/dist/tui/index.d.ts +6 -298
- package/dist/tui/index.js +17 -381
- package/dist/upgrade-C3RWGwRi.d.ts +125 -0
- package/dist/upgrade.d.ts +1 -95
- package/dist/upgrade.js +6 -114
- package/dist/xdg-DB7Shoib.d.ts +179 -0
- package/dist/xdg.d.ts +1 -169
- package/dist/xdg.js +14 -128
- package/package.json +192 -24
- package/src/README.md +15 -0
- package/src/alias.conformance.test.ts +250 -0
- package/src/alias.test.ts +206 -2
- package/src/alias.ts +196 -21
- package/src/cli.help-command.test.ts +105 -0
- package/src/cli.offline.test.ts +93 -0
- package/src/cli.parity.test.ts +192 -0
- package/src/cli.root.conformance.test.ts +166 -0
- package/src/cli.test.ts +95 -1
- package/src/cli.ts +234 -25
- package/src/completion-scripts.ts +16 -0
- package/src/completion-values.test.ts +76 -16
- package/src/completion-values.ts +170 -66
- package/src/completion.conformance.test.ts +298 -0
- package/src/completion.test.ts +268 -145
- package/src/completion.ts +772 -121
- package/src/compliance.test.ts +196 -2
- package/src/compliance.ts +440 -20
- package/src/config-merge.test.ts +425 -0
- package/src/config.test.ts +228 -1
- package/src/config.ts +429 -16
- package/src/delegation.test.ts +299 -0
- package/src/delegation.ts +807 -0
- package/src/gen/crud_pb.ts +7 -7
- package/src/id/README.md +38 -0
- package/src/id/contract.test.ts +1 -1
- package/src/id/index.test.ts +1 -1
- package/src/id/index.ts +3 -2
- package/src/index.test.ts +71 -0
- package/src/index.ts +46 -0
- package/src/llm-anthropic.conformance.test.ts +1135 -0
- package/src/llm-anthropic.test.ts +152 -0
- package/src/llm-anthropic.ts +940 -0
- package/src/llm-choice-hermetic.test.ts +335 -0
- package/src/llm-config.test.ts +232 -0
- package/src/llm-config.ts +106 -0
- package/src/llm-endpoint.ts +254 -0
- package/src/llm-error.ts +17 -0
- package/src/llm-errors.ts +152 -0
- package/src/llm-file.ts +126 -0
- package/src/llm-http.ts +317 -0
- package/src/llm-keys.ts +167 -0
- package/src/llm-media.conformance.test.ts +87 -0
- package/src/llm-media.test.ts +279 -0
- package/src/llm-media.ts +322 -0
- package/src/llm-openai.conformance.test.ts +407 -0
- package/src/llm-openai.test.ts +510 -0
- package/src/llm-openai.ts +708 -0
- package/src/llm-payload.ts +155 -0
- package/src/llm-quote.ts +46 -0
- package/src/llm-routellm.conformance.test.ts +44 -0
- package/src/llm-toolnames.conformance.test.ts +112 -0
- package/src/llm-toolnames.test.ts +132 -0
- package/src/llm-toolnames.ts +298 -0
- package/src/llm-uri.ts +99 -0
- package/src/llm.test.ts +43 -15
- package/src/llm.toolcall.test.ts +175 -0
- package/src/llm.ts +602 -190
- package/src/log.parity.test.ts +105 -0
- package/src/log.test.ts +270 -1
- package/src/log.ts +228 -49
- package/src/mcp/README.md +63 -0
- package/src/mcp/args-separator.test.ts +164 -0
- package/src/mcp/args.test.ts +223 -0
- package/src/mcp/args.ts +160 -0
- package/src/mcp/audit.test.ts +520 -0
- package/src/mcp/audit.ts +70 -0
- package/src/mcp/bridge.test.ts +250 -0
- package/src/mcp/bridge.ts +286 -0
- package/src/mcp/conformance.test.ts +357 -0
- package/src/mcp/dispatch.ts +359 -0
- package/src/mcp/identity.test.ts +166 -0
- package/src/mcp/identity.ts +72 -0
- package/src/mcp/index.ts +176 -0
- package/src/mcp/legacy-notify.test.ts +59 -0
- package/src/mcp/legacy.ts +367 -0
- package/src/mcp/mcp.test.ts +707 -0
- package/src/mcp/modern-confirm.test.ts +520 -0
- package/src/mcp/modern-confirm.ts +484 -0
- package/src/mcp/modern.ts +788 -0
- package/src/mcp/stdio.test.ts +313 -0
- package/src/mcp/stdio.ts +254 -0
- package/src/mcp/tasks.ts +82 -0
- package/src/mcp/testtree.ts +250 -0
- package/src/mcp/toolname.test.ts +147 -0
- package/src/mcp/types.ts +689 -0
- package/src/netpolicy.test.ts +280 -0
- package/src/netpolicy.ts +256 -0
- package/src/output/README.md +46 -0
- package/src/output/builtins.ts +5 -5
- package/src/output/dispatch.ts +10 -2
- package/src/output/error.ts +459 -0
- package/src/output/formatter.ts +29 -5
- package/src/output/formatters/README.md +50 -0
- package/src/output/formatters/csv.ts +48 -12
- package/src/output/formatters/json.ts +4 -25
- package/src/output/formatters/project.ts +34 -0
- package/src/output/formatters/table.ts +8 -6
- package/src/output/formatters/text.ts +7 -3
- package/src/output/formatters/yaml.ts +5 -22
- package/src/output/projection.test.ts +298 -0
- package/src/output/projection.ts +33 -59
- package/src/output/template.ts +11 -21
- package/src/output.surface.test.ts +41 -0
- package/src/output.ts +64 -3
- package/src/plan.ts +89 -0
- package/src/policy.ts +472 -0
- package/src/published-types.test.ts +133 -0
- package/src/routellm.test.ts +209 -28
- package/src/routellm.toolcall.test.ts +521 -0
- package/src/routellm.ts +213 -177
- package/src/router/README.md +44 -0
- package/src/router/server.test.ts +41 -0
- package/src/router/server.ts +11 -0
- package/src/safety.test.ts +19 -9
- package/src/scope-defaults.json +29 -29
- package/src/serve.test.ts +1257 -0
- package/src/serve.ts +1665 -0
- package/src/sideeffect.ts +105 -0
- package/src/telemetry/README.md +48 -0
- package/src/telemetry/client.test.ts +31 -0
- package/src/telemetry/client.ts +12 -6
- package/src/telemetry/offline.test.ts +64 -0
- package/src/toolspec-internal.ts +279 -0
- package/src/toolspec-manifest.test.ts +167 -0
- package/src/toolspec-manifest.ts +415 -0
- package/src/toolspec-spec-schemas.ts +12 -0
- package/src/toolspec-spec.test.ts +273 -0
- package/src/toolspec-spec.ts +458 -0
- package/src/toolspec.from-command.test.ts +350 -0
- package/src/toolspec.test.ts +2 -2
- package/src/toolspec.ts +222 -0
- package/src/triton/README.md +34 -0
- package/src/tui/README.md +42 -0
- package/src/tui/parity.test.ts +120 -31
- package/src/tui/parity.ts +58 -7
- package/src/upgrade.test.ts +291 -0
- package/src/upgrade.ts +116 -7
- package/src/wizard.test.ts +7 -7
- package/test/llm/conformance-helpers.ts +100 -0
- package/test/output/csv.test.ts +164 -0
- package/test/output/dispatch.test.ts +1 -2
- package/test/output/error.test.ts +277 -0
- package/test/output/smoke-capture.ts +2 -2
- package/test/output/smoke.test.ts +2 -2
- package/test/output/taxonomy-contract.test.ts +148 -0
- package/test/setup-env.ts +16 -0
- package/test/toolspec/fixture.ts +79 -0
- package/tsconfig.json +3 -1
- package/tsconfig.test.json +10 -0
- package/vitest.config.ts +9 -0
- package/src/tui/parity.json +0 -74
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import { Command as Command$1 } from 'commander';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Port of Go's `toolspec.Manifest` and `BuildManifest`
|
|
5
|
+
* (go/ai/toolspec/spec.go, go/ai/toolspec/cli/spec_command.go): the
|
|
6
|
+
* flat, snake_case capability manifest a `<tool> spec` command emits,
|
|
7
|
+
* projected from a commander tree carrying kit/* annotations.
|
|
8
|
+
*
|
|
9
|
+
* Byte parity with Go is pinned by
|
|
10
|
+
* sdk/tests/cross-lang/fixtures/toolspec-manifest*.json.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Env var a harness sets to request a manifest schema version. */
|
|
14
|
+
declare const SCHEMA_VERSION_ENV = "KIT_TOOLSPEC_SCHEMA";
|
|
15
|
+
/**
|
|
16
|
+
* Newest manifest schema version kit emits. 1.1 added per-command
|
|
17
|
+
* fields; 1.2 adds per-flag `required` and `choices` and per-argument
|
|
18
|
+
* `variadic`. Each is additive over the one before.
|
|
19
|
+
*/
|
|
20
|
+
declare const LATEST_SCHEMA_VERSION = "1.2";
|
|
21
|
+
/** Value side_effect / idempotent carry when nothing was declared. */
|
|
22
|
+
declare const SIDE_EFFECT_UNKNOWN = "unknown";
|
|
23
|
+
declare const IDEMPOTENT_UNKNOWN = "unknown";
|
|
24
|
+
interface ManifestArg {
|
|
25
|
+
name: string;
|
|
26
|
+
required?: boolean;
|
|
27
|
+
/** Schema 1.2: a kit/args `name...` entry, always the last argument. */
|
|
28
|
+
variadic?: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface ManifestFlag {
|
|
31
|
+
name: string;
|
|
32
|
+
short?: string;
|
|
33
|
+
type?: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
default?: string;
|
|
36
|
+
since_version?: string;
|
|
37
|
+
/** Schema 1.2: commander makeOptionMandatory (cobra MarkFlagRequired). */
|
|
38
|
+
required?: boolean;
|
|
39
|
+
/** Schema 1.2: commander `.choices()` (kit WithFlagEnum), in order. */
|
|
40
|
+
choices?: string[];
|
|
41
|
+
}
|
|
42
|
+
interface ManifestExample {
|
|
43
|
+
title: string;
|
|
44
|
+
command: string;
|
|
45
|
+
output?: string;
|
|
46
|
+
}
|
|
47
|
+
interface ManifestNextStep {
|
|
48
|
+
when?: string;
|
|
49
|
+
suggest: string;
|
|
50
|
+
reason?: string;
|
|
51
|
+
}
|
|
52
|
+
/** One invocable command. Field order is the Go struct order. */
|
|
53
|
+
interface ManifestCommand {
|
|
54
|
+
path: string[];
|
|
55
|
+
short: string;
|
|
56
|
+
side_effect: string;
|
|
57
|
+
idempotent: string;
|
|
58
|
+
args?: ManifestArg[];
|
|
59
|
+
flags?: ManifestFlag[];
|
|
60
|
+
exit_codes?: string[];
|
|
61
|
+
deprecated?: boolean;
|
|
62
|
+
deprecated_since?: string;
|
|
63
|
+
removal_target?: string;
|
|
64
|
+
since_version?: string;
|
|
65
|
+
long?: string;
|
|
66
|
+
retryable: boolean;
|
|
67
|
+
/** Raw JSON Schema text, embedded verbatim (Go RawJSON). */
|
|
68
|
+
output_schema?: string;
|
|
69
|
+
output_schema_version?: string;
|
|
70
|
+
examples?: ManifestExample[];
|
|
71
|
+
next_steps?: ManifestNextStep[];
|
|
72
|
+
top_level_verb?: boolean;
|
|
73
|
+
hierarchical?: boolean;
|
|
74
|
+
passthrough?: boolean;
|
|
75
|
+
destructive_token_required?: boolean;
|
|
76
|
+
dry_run_supported: boolean;
|
|
77
|
+
dry_run_rationale?: string;
|
|
78
|
+
reserved?: boolean;
|
|
79
|
+
hidden?: boolean;
|
|
80
|
+
}
|
|
81
|
+
interface Manifest {
|
|
82
|
+
tool: string;
|
|
83
|
+
version: string;
|
|
84
|
+
schema_version: string;
|
|
85
|
+
commands: ManifestCommand[];
|
|
86
|
+
}
|
|
87
|
+
interface BuildManifestOptions {
|
|
88
|
+
/** Include deprecated commands (Go --include-deprecated). */
|
|
89
|
+
includeDeprecated?: boolean;
|
|
90
|
+
/** Depth-1 verbs the tool reserves (Go Root.IsReserved). */
|
|
91
|
+
reserved?: Iterable<string>;
|
|
92
|
+
/**
|
|
93
|
+
* The command being executed, if any. It gets the -h/--help flag
|
|
94
|
+
* cobra adds to the executing command, as a live Go run lists.
|
|
95
|
+
*/
|
|
96
|
+
invokedCommand?: Command$1;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Resolve the emitted schema_version (Go NegotiateSchemaVersion):
|
|
100
|
+
* declared is a floor; a well-formed request raises it to the highest
|
|
101
|
+
* known version not above the request; nothing is ever refused.
|
|
102
|
+
*/
|
|
103
|
+
declare function negotiateSchemaVersion(declared: string, requested: string): string;
|
|
104
|
+
/**
|
|
105
|
+
* Project a commander tree into the Go-shaped Manifest (Go
|
|
106
|
+
* BuildManifest). Lists every runnable command except framework
|
|
107
|
+
* builtins (help, completion, man) and, unless includeDeprecated,
|
|
108
|
+
* deprecated ones; hidden and reserved commands stay listed and say
|
|
109
|
+
* so. Children are visited in name order and flags sorted by name,
|
|
110
|
+
* as cobra and pflag do by default.
|
|
111
|
+
*/
|
|
112
|
+
declare function buildManifest(program: Command$1, schemaVersion: string, opts?: BuildManifestOptions): Manifest;
|
|
113
|
+
/**
|
|
114
|
+
* Render a Manifest exactly as Go's `output.Render(w, "json", m)`:
|
|
115
|
+
* two-space indent, HTML-escaped strings, trailing newline, fields
|
|
116
|
+
* in Go struct order with omitempty applied.
|
|
117
|
+
*/
|
|
118
|
+
declare function renderManifestJSON(m: Manifest): string;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Port of Go's `<tool> spec` subcommand and `spec coverage`
|
|
122
|
+
* (go/ai/toolspec/cli/spec_command.go, coverage.go,
|
|
123
|
+
* coverage_command.go). Output bytes for json / kit-manifest are
|
|
124
|
+
* pinned against Go by sdk/tests/cross-lang/fixtures/toolspec-spec*.json.
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
/** Annotation marking kit's spec subcommands (Go specCommandAnnotation). */
|
|
128
|
+
declare const SPEC_COMMAND_ANNOTATION = "kit/spec-command";
|
|
129
|
+
interface RegisterSpecOptions {
|
|
130
|
+
/** Depth-1 verbs the tool reserves; "spec" is always added. */
|
|
131
|
+
reserved?: Iterable<string>;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Attach a `spec` subcommand emitting the tool's capability manifest
|
|
135
|
+
* (Go RegisterSpecCommand). Call once after registering every
|
|
136
|
+
* command.
|
|
137
|
+
*
|
|
138
|
+
* - `--format`: `kit-manifest` (default; aliases `kit`, `manifest`)
|
|
139
|
+
* and `json` emit Go-identical JSON; `yaml` emits the same document
|
|
140
|
+
* as YAML; `table`/`csv`/`text` emit nothing, as Go does today.
|
|
141
|
+
* The program's global `--format` is used when it has one,
|
|
142
|
+
* otherwise spec adds its own.
|
|
143
|
+
* - `--version`: print only the schema version.
|
|
144
|
+
* - `--include-deprecated`: list deprecated commands too.
|
|
145
|
+
*
|
|
146
|
+
* schemaVersion is a floor: each run resolves the emitted version
|
|
147
|
+
* against KIT_TOOLSPEC_SCHEMA (negotiateSchemaVersion).
|
|
148
|
+
*
|
|
149
|
+
* commander parses a program's own options anywhere on the line, so
|
|
150
|
+
* a program-level `--version` (commander `.version()`, which
|
|
151
|
+
* createCLI sets) would answer `spec --version` with the tool
|
|
152
|
+
* version. The program's version listener is wrapped so a literal
|
|
153
|
+
* `--version` is forwarded to spec when spec is the command being
|
|
154
|
+
* executed; `tool --version`, `-v`, and `--version` on any other
|
|
155
|
+
* command keep commander's behaviour. See forwardVersionToSpec.
|
|
156
|
+
*/
|
|
157
|
+
declare function registerSpecCommand(program: Command$1, schemaVersion: string, opts?: RegisterSpecOptions): Command$1;
|
|
158
|
+
/** Go CoverageReport: annotation coverage over a command tree. */
|
|
159
|
+
interface CoverageReport {
|
|
160
|
+
tool: string;
|
|
161
|
+
total: number;
|
|
162
|
+
annotated: number;
|
|
163
|
+
unannotated: number;
|
|
164
|
+
inferred: number;
|
|
165
|
+
malformed: number;
|
|
166
|
+
unannotated_paths?: string[];
|
|
167
|
+
malformed_paths?: string[];
|
|
168
|
+
measurable: boolean;
|
|
169
|
+
}
|
|
170
|
+
interface CoverageOptions {
|
|
171
|
+
/** Depth-1 verbs the tool reserves (not measured). */
|
|
172
|
+
reserved?: Iterable<string>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Measure kit/side-effect annotation coverage (Go CoverageOf):
|
|
176
|
+
* runnable commands, excluding framework builtins, reserved verbs and
|
|
177
|
+
* kit's spec commands. Deprecated and hidden commands count.
|
|
178
|
+
*/
|
|
179
|
+
declare function coverageOf(program: Command$1, opts?: CoverageOptions): CoverageReport;
|
|
180
|
+
|
|
181
|
+
type SafetyLevel = "safe" | "caution" | "dangerous";
|
|
182
|
+
interface Contract {
|
|
183
|
+
/** True iff kit/idempotent is "yes"; see idempotentClass for "no" / "conditional". */
|
|
184
|
+
idempotent: boolean;
|
|
185
|
+
sideEffects?: string[];
|
|
186
|
+
retryable: boolean;
|
|
187
|
+
preConditions?: string[];
|
|
188
|
+
/**
|
|
189
|
+
* The raw kit/idempotent class when it is one of yes|no|conditional
|
|
190
|
+
* (YAML key `idempotent_class`). "conditional" means the command
|
|
191
|
+
* takes --idempotency-key and a retry must supply one.
|
|
192
|
+
*/
|
|
193
|
+
idempotentClass?: string;
|
|
194
|
+
}
|
|
195
|
+
interface Safety {
|
|
196
|
+
level: SafetyLevel;
|
|
197
|
+
requiresConfirmation?: boolean;
|
|
198
|
+
permissions?: string[];
|
|
199
|
+
}
|
|
200
|
+
interface OutputSchema {
|
|
201
|
+
format?: string;
|
|
202
|
+
fields?: string[];
|
|
203
|
+
example?: string;
|
|
204
|
+
}
|
|
205
|
+
interface StateIntrospection {
|
|
206
|
+
configCommands?: string[];
|
|
207
|
+
envVars?: string[];
|
|
208
|
+
authCommands?: string[];
|
|
209
|
+
}
|
|
210
|
+
interface Provenance {
|
|
211
|
+
source?: string;
|
|
212
|
+
retrievedAt?: string;
|
|
213
|
+
confidence?: number;
|
|
214
|
+
}
|
|
215
|
+
interface Intent {
|
|
216
|
+
domain?: string;
|
|
217
|
+
category?: string;
|
|
218
|
+
tags?: string[];
|
|
219
|
+
}
|
|
220
|
+
interface Flag {
|
|
221
|
+
name: string;
|
|
222
|
+
short?: string;
|
|
223
|
+
type?: string;
|
|
224
|
+
description?: string;
|
|
225
|
+
/** Flag must be supplied (commander `makeOptionMandatory`). */
|
|
226
|
+
required?: boolean;
|
|
227
|
+
deprecated?: boolean;
|
|
228
|
+
replacedBy?: string;
|
|
229
|
+
/**
|
|
230
|
+
* Default value spelled as pflag prints it ("false" for a bool,
|
|
231
|
+
* "[a,b]" for a list), the same string the manifest's `default`
|
|
232
|
+
* carries; absent when empty.
|
|
233
|
+
*/
|
|
234
|
+
default?: string;
|
|
235
|
+
/** Closed set of legal values (commander `.choices()`, kit WithFlagEnum), in order. */
|
|
236
|
+
choices?: string[];
|
|
237
|
+
}
|
|
238
|
+
/** A declared positional argument (mirrors Go toolspec.Arg). */
|
|
239
|
+
interface Arg {
|
|
240
|
+
name: string;
|
|
241
|
+
/** False/absent for an optional argument. */
|
|
242
|
+
required?: boolean;
|
|
243
|
+
/** True for a `<name...>` argument: takes every remaining operand; always last. */
|
|
244
|
+
variadic?: boolean;
|
|
245
|
+
}
|
|
246
|
+
interface Command {
|
|
247
|
+
name: string;
|
|
248
|
+
/** One-line summary of the command. */
|
|
249
|
+
short?: string;
|
|
250
|
+
aliases?: string[];
|
|
251
|
+
flags?: Flag[];
|
|
252
|
+
/** Declared positional arguments, in order. */
|
|
253
|
+
args?: Arg[];
|
|
254
|
+
/** Command takes positional arguments it does not declare. */
|
|
255
|
+
undeclaredArgs?: boolean;
|
|
256
|
+
/** Exit-code symbols the command may produce (kit/exit-codes). */
|
|
257
|
+
exitCodes?: string[];
|
|
258
|
+
children?: Command[];
|
|
259
|
+
contract?: Contract;
|
|
260
|
+
safety?: Safety;
|
|
261
|
+
previewModes?: string[];
|
|
262
|
+
outputSchema?: OutputSchema;
|
|
263
|
+
deprecated?: boolean;
|
|
264
|
+
deprecatedSince?: string;
|
|
265
|
+
replacedBy?: string;
|
|
266
|
+
intent?: Intent;
|
|
267
|
+
suggestedNext?: string[];
|
|
268
|
+
}
|
|
269
|
+
interface ErrorPattern {
|
|
270
|
+
pattern: string;
|
|
271
|
+
fix: string;
|
|
272
|
+
source?: string;
|
|
273
|
+
cause?: string;
|
|
274
|
+
fixes?: string[];
|
|
275
|
+
confidence?: number;
|
|
276
|
+
provenance?: Provenance;
|
|
277
|
+
}
|
|
278
|
+
interface Workflow {
|
|
279
|
+
name: string;
|
|
280
|
+
steps: string[];
|
|
281
|
+
after?: Record<string, string[]>;
|
|
282
|
+
provenance?: Provenance;
|
|
283
|
+
}
|
|
284
|
+
interface ToolSpec {
|
|
285
|
+
name: string;
|
|
286
|
+
schemaVersion: string;
|
|
287
|
+
commands: Command[];
|
|
288
|
+
flags?: Flag[];
|
|
289
|
+
errorPatterns?: ErrorPattern[];
|
|
290
|
+
workflows?: Workflow[];
|
|
291
|
+
stateIntrospection?: StateIntrospection;
|
|
292
|
+
}
|
|
293
|
+
/** Parse a YAML toolspec file into a ToolSpec object. */
|
|
294
|
+
declare function loadToolSpec(yamlPath: string): ToolSpec;
|
|
295
|
+
/** Validate a ToolSpec, returning a list of error strings. */
|
|
296
|
+
declare function validateToolSpec(spec: ToolSpec): string[];
|
|
297
|
+
/** BFS search for a command by name (mirrors Go FindCommand). */
|
|
298
|
+
declare function findCommand(spec: ToolSpec, name: string): Command | undefined;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Per-command fields merged over what the commander tree yields.
|
|
302
|
+
* Structural fields (name, aliases, flags, args, children) always
|
|
303
|
+
* come from the tree.
|
|
304
|
+
*/
|
|
305
|
+
type CommandAnnotation = Omit<Partial<Command>, "name" | "aliases" | "flags" | "args" | "children">;
|
|
306
|
+
interface FromCommandOptions {
|
|
307
|
+
/** Annotations keyed by space-joined path below the root, e.g. "mission list". */
|
|
308
|
+
annotations?: Record<string, CommandAnnotation>;
|
|
309
|
+
/** Defaults to "1", the version the YAML toolspecs declare. */
|
|
310
|
+
schemaVersion?: string;
|
|
311
|
+
/** Keep hidden commands (Go WithIncludeHidden). Hidden options stay omitted. */
|
|
312
|
+
includeHidden?: boolean;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Build a ToolSpec from a constructed commander tree, so CLIs with
|
|
316
|
+
* dynamically registered subcommands need no hand-synced YAML.
|
|
317
|
+
* Mirrors Go's WalkCobra projection: hidden commands (unless
|
|
318
|
+
* includeHidden) and hidden options are omitted, framework builtins
|
|
319
|
+
* (help, completion and its shells, man, __complete,
|
|
320
|
+
* __completeNoDesc) and kit/spec-command commands are skipped, flag
|
|
321
|
+
* names are undashed, root options become spec.flags.
|
|
322
|
+
*/
|
|
323
|
+
declare function toolSpecFromCommand(program: Command$1, opts?: FromCommandOptions): ToolSpec;
|
|
324
|
+
|
|
325
|
+
type toolspec_Arg = Arg;
|
|
326
|
+
type toolspec_BuildManifestOptions = BuildManifestOptions;
|
|
327
|
+
type toolspec_Command = Command;
|
|
328
|
+
type toolspec_CommandAnnotation = CommandAnnotation;
|
|
329
|
+
type toolspec_Contract = Contract;
|
|
330
|
+
type toolspec_CoverageOptions = CoverageOptions;
|
|
331
|
+
type toolspec_CoverageReport = CoverageReport;
|
|
332
|
+
type toolspec_ErrorPattern = ErrorPattern;
|
|
333
|
+
type toolspec_Flag = Flag;
|
|
334
|
+
type toolspec_FromCommandOptions = FromCommandOptions;
|
|
335
|
+
declare const toolspec_IDEMPOTENT_UNKNOWN: typeof IDEMPOTENT_UNKNOWN;
|
|
336
|
+
type toolspec_Intent = Intent;
|
|
337
|
+
declare const toolspec_LATEST_SCHEMA_VERSION: typeof LATEST_SCHEMA_VERSION;
|
|
338
|
+
type toolspec_Manifest = Manifest;
|
|
339
|
+
type toolspec_ManifestArg = ManifestArg;
|
|
340
|
+
type toolspec_ManifestCommand = ManifestCommand;
|
|
341
|
+
type toolspec_ManifestExample = ManifestExample;
|
|
342
|
+
type toolspec_ManifestFlag = ManifestFlag;
|
|
343
|
+
type toolspec_ManifestNextStep = ManifestNextStep;
|
|
344
|
+
type toolspec_OutputSchema = OutputSchema;
|
|
345
|
+
type toolspec_Provenance = Provenance;
|
|
346
|
+
type toolspec_RegisterSpecOptions = RegisterSpecOptions;
|
|
347
|
+
declare const toolspec_SCHEMA_VERSION_ENV: typeof SCHEMA_VERSION_ENV;
|
|
348
|
+
declare const toolspec_SIDE_EFFECT_UNKNOWN: typeof SIDE_EFFECT_UNKNOWN;
|
|
349
|
+
declare const toolspec_SPEC_COMMAND_ANNOTATION: typeof SPEC_COMMAND_ANNOTATION;
|
|
350
|
+
type toolspec_Safety = Safety;
|
|
351
|
+
type toolspec_SafetyLevel = SafetyLevel;
|
|
352
|
+
type toolspec_StateIntrospection = StateIntrospection;
|
|
353
|
+
type toolspec_ToolSpec = ToolSpec;
|
|
354
|
+
type toolspec_Workflow = Workflow;
|
|
355
|
+
declare const toolspec_buildManifest: typeof buildManifest;
|
|
356
|
+
declare const toolspec_coverageOf: typeof coverageOf;
|
|
357
|
+
declare const toolspec_findCommand: typeof findCommand;
|
|
358
|
+
declare const toolspec_loadToolSpec: typeof loadToolSpec;
|
|
359
|
+
declare const toolspec_negotiateSchemaVersion: typeof negotiateSchemaVersion;
|
|
360
|
+
declare const toolspec_registerSpecCommand: typeof registerSpecCommand;
|
|
361
|
+
declare const toolspec_renderManifestJSON: typeof renderManifestJSON;
|
|
362
|
+
declare const toolspec_toolSpecFromCommand: typeof toolSpecFromCommand;
|
|
363
|
+
declare const toolspec_validateToolSpec: typeof validateToolSpec;
|
|
364
|
+
declare namespace toolspec {
|
|
365
|
+
export { type toolspec_Arg as Arg, type toolspec_BuildManifestOptions as BuildManifestOptions, type toolspec_Command as Command, type toolspec_CommandAnnotation as CommandAnnotation, type toolspec_Contract as Contract, type toolspec_CoverageOptions as CoverageOptions, type toolspec_CoverageReport as CoverageReport, type toolspec_ErrorPattern as ErrorPattern, type toolspec_Flag as Flag, type toolspec_FromCommandOptions as FromCommandOptions, toolspec_IDEMPOTENT_UNKNOWN as IDEMPOTENT_UNKNOWN, type toolspec_Intent as Intent, toolspec_LATEST_SCHEMA_VERSION as LATEST_SCHEMA_VERSION, type toolspec_Manifest as Manifest, type toolspec_ManifestArg as ManifestArg, type toolspec_ManifestCommand as ManifestCommand, type toolspec_ManifestExample as ManifestExample, type toolspec_ManifestFlag as ManifestFlag, type toolspec_ManifestNextStep as ManifestNextStep, type toolspec_OutputSchema as OutputSchema, type toolspec_Provenance as Provenance, type toolspec_RegisterSpecOptions as RegisterSpecOptions, toolspec_SCHEMA_VERSION_ENV as SCHEMA_VERSION_ENV, toolspec_SIDE_EFFECT_UNKNOWN as SIDE_EFFECT_UNKNOWN, toolspec_SPEC_COMMAND_ANNOTATION as SPEC_COMMAND_ANNOTATION, type toolspec_Safety as Safety, type toolspec_SafetyLevel as SafetyLevel, type toolspec_StateIntrospection as StateIntrospection, type toolspec_ToolSpec as ToolSpec, type toolspec_Workflow as Workflow, toolspec_buildManifest as buildManifest, toolspec_coverageOf as coverageOf, toolspec_findCommand as findCommand, toolspec_loadToolSpec as loadToolSpec, toolspec_negotiateSchemaVersion as negotiateSchemaVersion, toolspec_registerSpecCommand as registerSpecCommand, toolspec_renderManifestJSON as renderManifestJSON, toolspec_toolSpecFromCommand as toolSpecFromCommand, toolspec_validateToolSpec as validateToolSpec };
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export { type Arg as A, type BuildManifestOptions as B, type Command as C, type ErrorPattern as E, type Flag as F, IDEMPOTENT_UNKNOWN as I, LATEST_SCHEMA_VERSION as L, type Manifest as M, type OutputSchema as O, type Provenance as P, type RegisterSpecOptions as R, SCHEMA_VERSION_ENV as S, type ToolSpec as T, type Workflow as W, type CommandAnnotation as a, type Contract as b, type CoverageOptions as c, type CoverageReport as d, type FromCommandOptions as e, type Intent as f, type ManifestArg as g, type ManifestCommand as h, type ManifestExample as i, type ManifestFlag as j, type ManifestNextStep as k, SIDE_EFFECT_UNKNOWN as l, SPEC_COMMAND_ANNOTATION as m, type Safety as n, type SafetyLevel as o, type StateIntrospection as p, buildManifest as q, coverageOf as r, findCommand as s, toolspec as t, loadToolSpec as u, negotiateSchemaVersion as v, registerSpecCommand as w, renderManifestJSON as x, toolSpecFromCommand as y, validateToolSpec as z };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import 'commander';
|
|
2
|
+
export { A as Arg, B as BuildManifestOptions, C as Command, a as CommandAnnotation, b as Contract, c as CoverageOptions, d as CoverageReport, E as ErrorPattern, F as Flag, e as FromCommandOptions, I as IDEMPOTENT_UNKNOWN, f as Intent, L as LATEST_SCHEMA_VERSION, M as Manifest, g as ManifestArg, h as ManifestCommand, i as ManifestExample, j as ManifestFlag, k as ManifestNextStep, O as OutputSchema, P as Provenance, R as RegisterSpecOptions, S as SCHEMA_VERSION_ENV, l as SIDE_EFFECT_UNKNOWN, m as SPEC_COMMAND_ANNOTATION, n as Safety, o as SafetyLevel, p as StateIntrospection, T as ToolSpec, W as Workflow, q as buildManifest, r as coverageOf, s as findCommand, u as loadToolSpec, v as negotiateSchemaVersion, w as registerSpecCommand, x as renderManifestJSON, y as toolSpecFromCommand, z as validateToolSpec } from './toolspec-DcPwwoAZ.js';
|
package/dist/toolspec.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunkEE4M2UOFjs = require('./chunk-EE4M2UOF.js');
|
|
17
|
+
require('./chunk-SNVGDYX7.js');
|
|
18
|
+
require('./chunk-CXBZTONY.js');
|
|
19
|
+
require('./chunk-GFRAYYRD.js');
|
|
20
|
+
require('./chunk-POR5L2DG.js');
|
|
21
|
+
require('./chunk-R5U7XKVJ.js');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
exports.IDEMPOTENT_UNKNOWN = _chunkEE4M2UOFjs.IDEMPOTENT_UNKNOWN; exports.LATEST_SCHEMA_VERSION = _chunkEE4M2UOFjs.LATEST_SCHEMA_VERSION; exports.SCHEMA_VERSION_ENV = _chunkEE4M2UOFjs.SCHEMA_VERSION_ENV; exports.SIDE_EFFECT_UNKNOWN = _chunkEE4M2UOFjs.SIDE_EFFECT_UNKNOWN; exports.SPEC_COMMAND_ANNOTATION = _chunkEE4M2UOFjs.SPEC_COMMAND_ANNOTATION; exports.buildManifest = _chunkEE4M2UOFjs.buildManifest; exports.coverageOf = _chunkEE4M2UOFjs.coverageOf; exports.findCommand = _chunkEE4M2UOFjs.findCommand; exports.loadToolSpec = _chunkEE4M2UOFjs.loadToolSpec; exports.negotiateSchemaVersion = _chunkEE4M2UOFjs.negotiateSchemaVersion; exports.registerSpecCommand = _chunkEE4M2UOFjs.registerSpecCommand; exports.renderManifestJSON = _chunkEE4M2UOFjs.renderManifestJSON; exports.toolSpecFromCommand = _chunkEE4M2UOFjs.toolSpecFromCommand; exports.validateToolSpec = _chunkEE4M2UOFjs.validateToolSpec;
|