@hop-top/kit 0.5.0-alpha.6 → 0.5.0-alpha.8

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/LICENSE-cobra.txt +174 -0
  3. package/NOTICE +15 -0
  4. package/README.md +3 -3
  5. package/dist/alias-D9_qFlyP.d.ts +174 -0
  6. package/dist/alias.d.ts +1 -1
  7. package/dist/alias.js +10 -2
  8. package/dist/chunk-263IZ6Z6.js +915 -0
  9. package/dist/{chunk-S45UHXQF.js → chunk-BLS2OBIQ.js} +106 -25
  10. package/dist/{chunk-7FDIN5KE.js → chunk-GHPJJV5L.js} +8 -4
  11. package/dist/chunk-JKMQSAJP.js +174 -0
  12. package/dist/chunk-JZ22ZUFA.js +1131 -0
  13. package/dist/{chunk-GAZPYCQD.js → chunk-NLMS7HGP.js} +93 -35
  14. package/dist/chunk-QQQYCWSC.js +240 -0
  15. package/dist/chunk-XJTRY453.js +868 -0
  16. package/dist/cli.js +6 -4
  17. package/dist/completion-csVun6SP.d.ts +112 -0
  18. package/dist/completion-values-By-mnjNt.d.ts +142 -0
  19. package/dist/completion-values.d.ts +1 -0
  20. package/dist/completion-values.js +29 -0
  21. package/dist/completion.d.ts +2 -1
  22. package/dist/completion.js +23 -2
  23. package/dist/compliance-AxFf-uMy.d.ts +60 -0
  24. package/dist/compliance.d.ts +1 -0
  25. package/dist/compliance.js +17 -0
  26. package/dist/config-CaK60ByQ.d.ts +241 -0
  27. package/dist/config.d.ts +1 -1
  28. package/dist/config.js +4 -2
  29. package/dist/index.d.ts +7 -5
  30. package/dist/index.js +26 -18
  31. package/dist/log-CkaxMX3U.d.ts +115 -0
  32. package/dist/log.d.ts +1 -1
  33. package/dist/log.js +2 -2
  34. package/dist/toolspec-UrWnoJ3Y.d.ts +336 -0
  35. package/dist/toolspec.d.ts +2 -1
  36. package/dist/toolspec.js +27 -2
  37. package/package.json +19 -3
  38. package/src/alias.conformance.test.ts +250 -0
  39. package/src/alias.test.ts +206 -2
  40. package/src/alias.ts +196 -21
  41. package/src/cli.ts +5 -0
  42. package/src/completion-scripts.ts +16 -0
  43. package/src/completion-values.test.ts +70 -10
  44. package/src/completion-values.ts +170 -66
  45. package/src/completion.conformance.test.ts +297 -0
  46. package/src/completion.test.ts +256 -145
  47. package/src/completion.ts +767 -121
  48. package/src/config-merge.test.ts +425 -0
  49. package/src/config.test.ts +41 -0
  50. package/src/config.ts +265 -18
  51. package/src/index.test.ts +2 -1
  52. package/src/index.ts +5 -1
  53. package/src/log.test.ts +270 -1
  54. package/src/log.ts +172 -44
  55. package/src/published-types.test.ts +18 -0
  56. package/src/toolspec-internal.ts +197 -0
  57. package/src/toolspec-manifest.test.ts +82 -0
  58. package/src/toolspec-manifest.ts +404 -0
  59. package/src/toolspec-spec-schemas.ts +12 -0
  60. package/src/toolspec-spec.test.ts +273 -0
  61. package/src/toolspec-spec.ts +458 -0
  62. package/src/toolspec.from-command.test.ts +216 -0
  63. package/src/toolspec.ts +159 -0
  64. package/test/toolspec/fixture.ts +73 -0
  65. package/dist/alias-BOj0-VAr.d.ts +0 -88
  66. package/dist/chunk-6RFRV4VP.js +0 -128
  67. package/dist/chunk-IQXEISMC.js +0 -142
  68. package/dist/chunk-W7ERKNSQ.js +0 -171
  69. package/dist/completion-CVnPcWMZ.d.ts +0 -32
  70. package/dist/config-Bm9fBXch.d.ts +0 -134
  71. package/dist/log-uKjHsK-c.d.ts +0 -62
  72. package/dist/toolspec-DPBr18Ub.d.ts +0 -106
@@ -1,171 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunkR5U7XKVJjs = require('./chunk-R5U7XKVJ.js');
4
-
5
- // src/toolspec.ts
6
- var toolspec_exports = {};
7
- _chunkR5U7XKVJjs.__export.call(void 0, toolspec_exports, {
8
- findCommand: () => findCommand,
9
- loadToolSpec: () => loadToolSpec,
10
- validateToolSpec: () => validateToolSpec
11
- });
12
- var _fs = require('fs'); var fs = _interopRequireWildcard(_fs);
13
- var _jsyaml = require('js-yaml'); var yaml = _interopRequireWildcard(_jsyaml);
14
- function mapFlag(raw) {
15
- return {
16
- name: _nullishCoalesce(raw.name, () => ( "")),
17
- short: raw.short,
18
- type: raw.type,
19
- description: raw.description,
20
- deprecated: raw.deprecated,
21
- replacedBy: raw.replaced_by
22
- };
23
- }
24
- function mapProvenance(raw) {
25
- if (!raw) return void 0;
26
- return {
27
- source: raw.source,
28
- retrievedAt: raw.retrieved_at,
29
- confidence: raw.confidence
30
- };
31
- }
32
- function mapContract(raw) {
33
- if (!raw) return void 0;
34
- return {
35
- idempotent: _nullishCoalesce(raw.idempotent, () => ( false)),
36
- sideEffects: raw.side_effects,
37
- retryable: _nullishCoalesce(raw.retryable, () => ( false)),
38
- preConditions: raw.pre_conditions
39
- };
40
- }
41
- function mapSafety(raw) {
42
- if (!raw) return void 0;
43
- return {
44
- level: raw.level,
45
- requiresConfirmation: raw.requires_confirmation,
46
- permissions: raw.permissions
47
- };
48
- }
49
- function mapOutputSchema(raw) {
50
- if (!raw) return void 0;
51
- return {
52
- format: raw.format,
53
- fields: raw.fields,
54
- example: raw.example
55
- };
56
- }
57
- function mapIntent(raw) {
58
- if (!raw) return void 0;
59
- return {
60
- domain: raw.domain,
61
- category: raw.category,
62
- tags: raw.tags
63
- };
64
- }
65
- function mapCommand(raw) {
66
- return {
67
- name: _nullishCoalesce(raw.name, () => ( "")),
68
- aliases: raw.aliases,
69
- flags: _optionalChain([raw, 'access', _ => _.flags, 'optionalAccess', _2 => _2.map, 'call', _3 => _3(mapFlag)]),
70
- children: _optionalChain([raw, 'access', _4 => _4.children, 'optionalAccess', _5 => _5.map, 'call', _6 => _6(mapCommand)]),
71
- contract: mapContract(raw.contract),
72
- safety: mapSafety(raw.safety),
73
- previewModes: raw.preview_modes,
74
- outputSchema: mapOutputSchema(raw.output_schema),
75
- deprecated: raw.deprecated,
76
- deprecatedSince: raw.deprecated_since,
77
- replacedBy: raw.replaced_by,
78
- intent: mapIntent(raw.intent),
79
- suggestedNext: raw.suggested_next
80
- };
81
- }
82
- function mapStateIntrospection(raw) {
83
- if (!raw) return void 0;
84
- return {
85
- configCommands: raw.config_commands,
86
- envVars: raw.env_vars,
87
- authCommands: raw.auth_commands
88
- };
89
- }
90
- function mapErrorPattern(raw) {
91
- return {
92
- pattern: _nullishCoalesce(raw.pattern, () => ( "")),
93
- fix: _nullishCoalesce(raw.fix, () => ( "")),
94
- source: raw.source,
95
- cause: raw.cause,
96
- fixes: raw.fixes,
97
- confidence: raw.confidence,
98
- provenance: mapProvenance(raw.provenance)
99
- };
100
- }
101
- function mapWorkflow(raw) {
102
- return {
103
- name: _nullishCoalesce(raw.name, () => ( "")),
104
- steps: _nullishCoalesce(raw.steps, () => ( [])),
105
- after: raw.after,
106
- provenance: mapProvenance(raw.provenance)
107
- };
108
- }
109
- function loadToolSpec(yamlPath) {
110
- const content = fs.readFileSync(yamlPath, "utf-8");
111
- const raw = yaml.load(content);
112
- return {
113
- name: _nullishCoalesce(raw.name, () => ( "")),
114
- schemaVersion: _nullishCoalesce(raw.schema_version, () => ( "")),
115
- commands: (_nullishCoalesce(raw.commands, () => ( []))).map(mapCommand),
116
- flags: _optionalChain([raw, 'access', _7 => _7.flags, 'optionalAccess', _8 => _8.map, 'call', _9 => _9(mapFlag)]),
117
- errorPatterns: _optionalChain([raw, 'access', _10 => _10.error_patterns, 'optionalAccess', _11 => _11.map, 'call', _12 => _12(mapErrorPattern)]),
118
- workflows: _optionalChain([raw, 'access', _13 => _13.workflows, 'optionalAccess', _14 => _14.map, 'call', _15 => _15(mapWorkflow)]),
119
- stateIntrospection: mapStateIntrospection(
120
- raw.state_introspection
121
- )
122
- };
123
- }
124
- var VALID_SAFETY_LEVELS = /* @__PURE__ */ new Set([
125
- "safe",
126
- "caution",
127
- "dangerous"
128
- ]);
129
- function validateToolSpec(spec) {
130
- const errors = [];
131
- if (!spec.name) errors.push("name is required");
132
- if (!spec.schemaVersion) errors.push("schemaVersion is required");
133
- if (!spec.commands || spec.commands.length === 0) {
134
- errors.push("at least one command is required");
135
- }
136
- const validateCmd = (cmd, path) => {
137
- if (!cmd.name) {
138
- errors.push(`${path}: command name is required`);
139
- }
140
- if (cmd.safety && !VALID_SAFETY_LEVELS.has(cmd.safety.level)) {
141
- errors.push(
142
- `${path}: invalid safety level "${cmd.safety.level}" (must be safe|caution|dangerous)`
143
- );
144
- }
145
- if (cmd.children) {
146
- for (const child of cmd.children) {
147
- validateCmd(child, `${path}/${child.name || "<unnamed>"}`);
148
- }
149
- }
150
- };
151
- for (const cmd of _nullishCoalesce(spec.commands, () => ( []))) {
152
- validateCmd(cmd, cmd.name || "<unnamed>");
153
- }
154
- return errors;
155
- }
156
- function findCommand(spec, name) {
157
- const queue = [...spec.commands];
158
- while (queue.length > 0) {
159
- const c = queue.shift();
160
- if (c.name === name) return c;
161
- if (c.children) queue.push(...c.children);
162
- }
163
- return void 0;
164
- }
165
-
166
-
167
-
168
-
169
-
170
-
171
- exports.loadToolSpec = loadToolSpec; exports.validateToolSpec = validateToolSpec; exports.findCommand = findCommand; exports.toolspec_exports = toolspec_exports;
@@ -1,32 +0,0 @@
1
- import { Command } from 'commander';
2
-
3
- /**
4
- * @module completion
5
- * @package @hop-top/kit
6
- *
7
- * Shell completion script generators for Commander-based CLIs.
8
- * Extracts subcommand names and flag names from the program tree
9
- * and generates bash/zsh/fish completion scripts.
10
- */
11
-
12
- /** Generate a bash completion script for the given program. */
13
- declare function generateBashCompletion(program: Command): string;
14
- /** Generate a zsh completion script for the given program. */
15
- declare function generateZshCompletion(program: Command): string;
16
- /** Generate a fish completion script for the given program. */
17
- declare function generateFishCompletion(program: Command): string;
18
- /**
19
- * Create a hidden `completion` command with bash/zsh/fish subcommands.
20
- * Each prints the completion script to stdout.
21
- */
22
- declare function completionCommand(program: Command): Command;
23
-
24
- declare const completion_completionCommand: typeof completionCommand;
25
- declare const completion_generateBashCompletion: typeof generateBashCompletion;
26
- declare const completion_generateFishCompletion: typeof generateFishCompletion;
27
- declare const completion_generateZshCompletion: typeof generateZshCompletion;
28
- declare namespace completion {
29
- export { completion_completionCommand as completionCommand, completion_generateBashCompletion as generateBashCompletion, completion_generateFishCompletion as generateFishCompletion, completion_generateZshCompletion as generateZshCompletion };
30
- }
31
-
32
- export { completionCommand as a, generateFishCompletion as b, completion as c, generateZshCompletion as d, generateBashCompletion as g };
@@ -1,134 +0,0 @@
1
- /**
2
- * @packageDocumentation
3
- *
4
- * Layered YAML configuration loader — TypeScript port of hop.top/kit/config.
5
- *
6
- * Merges configuration from up to three file layers in priority order:
7
- * system → user → project → envOverride
8
- *
9
- * Each layer merges into `dst` with these rules:
10
- *
11
- * - Plain objects merge recursively, key by key, so a later layer only
12
- * overrides the keys it sets (`db: {port: 2}` keeps an earlier `db.host`).
13
- * - Arrays and scalars are replaced wholesale.
14
- * - `null` clears an object or array; it leaves a scalar untouched.
15
- * - On a type conflict (object vs non-object) the later value replaces the
16
- * earlier one.
17
- * - Non-plain objects (`Date`, `Map`, class instances) are never merged
18
- * into; a later value replaces them.
19
- *
20
- * This matches Go's `kit/core/config` for struct fields. Go differs where its
21
- * target type differs: a `map[...]` value or an `any` field is replaced
22
- * whole rather than merged, and a type conflict on a typed field is a decode
23
- * error rather than a replacement.
24
- *
25
- * Missing files are silently skipped. A file that exists but contains invalid
26
- * YAML causes {@link load} to throw. A document whose root is not a mapping
27
- * is ignored.
28
- *
29
- * Each file is checked before it merges, with aliases expanded, and
30
- * {@link load} throws `config: failed to parse <path>: <reason>` when:
31
- *
32
- * - its aliases expand past Go yaml.v3's budget: more than 100 nodes inside
33
- * alias expansions and more than 1000 in total, with the share inside
34
- * aliases above 0.99 (up to 400k nodes), falling linearly to 0.10 at 4M
35
- * (`document contains excessive aliasing`). Go counts only the keys its
36
- * target struct reads; TS has no target, so it counts every key, and a
37
- * file Go accepts because the aliases sit under ignored keys fails here.
38
- * - collections nest deeper than 100, counted through aliases
39
- * (`nesting exceeded maxDepth (100)`). Go allows 10000 levels of text
40
- * nesting and caps alias chains only through the budget above.
41
- *
42
- * @example
43
- * ```ts
44
- * import { load } from "@hop-top/kit/config";
45
- *
46
- * interface AppConfig {
47
- * host: string;
48
- * port: number;
49
- * debug: boolean;
50
- * token: string;
51
- * }
52
- *
53
- * const cfg: AppConfig = { host: "localhost", port: 3000, debug: false, token: "" };
54
- *
55
- * load(cfg, {
56
- * systemConfigPath: "/etc/mytool/config.yaml",
57
- * userConfigPath: `${process.env.HOME}/.config/mytool/config.yaml`,
58
- * projectConfigPath: ".mytool.yaml",
59
- * envOverride(c) {
60
- * if (process.env.HOST) c.host = process.env.HOST;
61
- * if (process.env.PORT) c.port = Number(process.env.PORT);
62
- * if (process.env.TOKEN) c.token = process.env.TOKEN;
63
- * },
64
- * });
65
- * ```
66
- */
67
- /**
68
- * Configuration sources for {@link load}.
69
- *
70
- * All path fields are optional; an empty or omitted path is silently skipped.
71
- * {@link Options.envOverride} is called last, after all file layers, so it can
72
- * apply environment-variable overrides on top of file values.
73
- */
74
- interface Options<T extends object = object> {
75
- /**
76
- * Path to the system-wide config file, e.g. `/etc/mytool/config.yaml`.
77
- * Applied first (lowest priority).
78
- */
79
- systemConfigPath?: string;
80
- /**
81
- * Path to the per-user config file, e.g. `~/.config/mytool/config.yaml`.
82
- * Applied second; merges over system values (see the module merge rules).
83
- */
84
- userConfigPath?: string;
85
- /**
86
- * Path to the project-level config file, e.g. `.mytool.yaml`.
87
- * Applied third; merges over system and user values.
88
- */
89
- projectConfigPath?: string;
90
- /**
91
- * Optional callback invoked after all file layers have been merged.
92
- * Receives the fully-merged `dst` object so the caller can apply
93
- * environment-variable overrides last (highest priority).
94
- *
95
- * @param cfg - The merged config object (same reference as `dst`).
96
- */
97
- envOverride?: (cfg: T) => void;
98
- }
99
- /**
100
- * Merges layered YAML configuration into `dst` and returns it.
101
- *
102
- * Merge order: `systemConfigPath` → `userConfigPath` → `projectConfigPath` →
103
- * `envOverride`.
104
- *
105
- * - Objects merge recursively; arrays and scalars replace; `null` clears
106
- * objects and arrays but not scalars (see the module docs for details).
107
- * - Missing files (ENOENT) are silently skipped.
108
- * - A file that exists but is not valid YAML causes this function to throw
109
- * a descriptive error wrapping the parse failure.
110
- * - `envOverride`, when provided, is called last with the merged `dst`.
111
- * - Returns `dst` (the same object reference passed in).
112
- *
113
- * @param dst - Destination object to merge config into. Must be a non-null
114
- * object; mutated in place.
115
- * @param opts - Config sources. All fields are optional.
116
- * @returns The mutated `dst` object.
117
- * @throws {Error} When a file exists but cannot be parsed as YAML.
118
- *
119
- * @example
120
- * ```ts
121
- * const cfg = { host: "localhost", port: 8080 };
122
- * load(cfg, { projectConfigPath: ".tool.yaml" });
123
- * console.log(cfg.host); // value from .tool.yaml, or "localhost" if file missing
124
- * ```
125
- */
126
- declare function load<T extends object>(dst: T, opts?: Options<T>): T;
127
-
128
- type config_Options<T extends object = object> = Options<T>;
129
- declare const config_load: typeof load;
130
- declare namespace config {
131
- export { type config_Options as Options, config_load as load };
132
- }
133
-
134
- export { type Options as O, config as c, load as l };
@@ -1,62 +0,0 @@
1
- import { P as ParityData } from './parity-CvMuYcVI.js';
2
-
3
- /**
4
- * Structured logger wrapping pino — applies kit's charmtone theme
5
- * colors to stderr output.
6
- *
7
- * API: `logger.info('msg', 'key', val, 'key2', val2)` (variadic key-value)
8
- * This matches Go's charm/log API, not pino's native object API.
9
- * Pino handles transports, serialization, and performance under the hood.
10
- *
11
- * The `-V` count → level mapping and the `--quiet` override both come from
12
- * the parity contract (`parity.json` verbosity block), so the level
13
- * vocabulary stays identical across the Go, TypeScript and Python ports.
14
- */
15
-
16
- interface Logger {
17
- info(msg: string, ...keyvals: any[]): void;
18
- warn(msg: string, ...keyvals: any[]): void;
19
- error(msg: string, ...keyvals: any[]): void;
20
- debug(msg: string, ...keyvals: any[]): void;
21
- trace(msg: string, ...keyvals: any[]): void;
22
- }
23
- interface LoggerOptions {
24
- quiet?: boolean;
25
- noColor?: boolean;
26
- }
27
- /**
28
- * Resolve a `-V` count against a parity contract's `verbosity.levels`
29
- * table. Counts above the highest declared key clamp to that key's level;
30
- * an empty or unresolvable table falls back to `info`.
31
- *
32
- * Taking the contract as a parameter (rather than reading the module-level
33
- * `parity`) keeps the mapping testable against a constructed `ParityData`
34
- * without mutating the shared `parity.json`.
35
- */
36
- declare function verbosityLevel(d: ParityData, verbose: number): string;
37
- /**
38
- * Resolve a parity contract's `verbosity.quiet_override` to a pino level
39
- * name. An unrecognized or absent override falls back to `warn`.
40
- */
41
- declare function quietLevel(d: ParityData): string;
42
- declare function createLogger(opts?: LoggerOptions): Logger;
43
- /**
44
- * Map verbose count to a pino level through the parity contract's
45
- * `verbosity.levels` table. Quiet overrides to the contract's
46
- * `quiet_override` level regardless of verbose count.
47
- */
48
- declare function withVerbose(opts: LoggerOptions & {
49
- verbose?: number;
50
- }): Logger;
51
-
52
- type log_Logger = Logger;
53
- type log_LoggerOptions = LoggerOptions;
54
- declare const log_createLogger: typeof createLogger;
55
- declare const log_quietLevel: typeof quietLevel;
56
- declare const log_verbosityLevel: typeof verbosityLevel;
57
- declare const log_withVerbose: typeof withVerbose;
58
- declare namespace log {
59
- export { type log_Logger as Logger, type log_LoggerOptions as LoggerOptions, log_createLogger as createLogger, log_quietLevel as quietLevel, log_verbosityLevel as verbosityLevel, log_withVerbose as withVerbose };
60
- }
61
-
62
- export { type Logger as L, type LoggerOptions as a, createLogger as c, log as l, quietLevel as q, verbosityLevel as v, withVerbose as w };
@@ -1,106 +0,0 @@
1
- type SafetyLevel = "safe" | "caution" | "dangerous";
2
- interface Contract {
3
- idempotent: boolean;
4
- sideEffects?: string[];
5
- retryable: boolean;
6
- preConditions?: string[];
7
- }
8
- interface Safety {
9
- level: SafetyLevel;
10
- requiresConfirmation?: boolean;
11
- permissions?: string[];
12
- }
13
- interface OutputSchema {
14
- format?: string;
15
- fields?: string[];
16
- example?: string;
17
- }
18
- interface StateIntrospection {
19
- configCommands?: string[];
20
- envVars?: string[];
21
- authCommands?: string[];
22
- }
23
- interface Provenance {
24
- source?: string;
25
- retrievedAt?: string;
26
- confidence?: number;
27
- }
28
- interface Intent {
29
- domain?: string;
30
- category?: string;
31
- tags?: string[];
32
- }
33
- interface Flag {
34
- name: string;
35
- short?: string;
36
- type?: string;
37
- description?: string;
38
- deprecated?: boolean;
39
- replacedBy?: string;
40
- }
41
- interface Command {
42
- name: string;
43
- aliases?: string[];
44
- flags?: Flag[];
45
- children?: Command[];
46
- contract?: Contract;
47
- safety?: Safety;
48
- previewModes?: string[];
49
- outputSchema?: OutputSchema;
50
- deprecated?: boolean;
51
- deprecatedSince?: string;
52
- replacedBy?: string;
53
- intent?: Intent;
54
- suggestedNext?: string[];
55
- }
56
- interface ErrorPattern {
57
- pattern: string;
58
- fix: string;
59
- source?: string;
60
- cause?: string;
61
- fixes?: string[];
62
- confidence?: number;
63
- provenance?: Provenance;
64
- }
65
- interface Workflow {
66
- name: string;
67
- steps: string[];
68
- after?: Record<string, string[]>;
69
- provenance?: Provenance;
70
- }
71
- interface ToolSpec {
72
- name: string;
73
- schemaVersion: string;
74
- commands: Command[];
75
- flags?: Flag[];
76
- errorPatterns?: ErrorPattern[];
77
- workflows?: Workflow[];
78
- stateIntrospection?: StateIntrospection;
79
- }
80
- /** Parse a YAML toolspec file into a ToolSpec object. */
81
- declare function loadToolSpec(yamlPath: string): ToolSpec;
82
- /** Validate a ToolSpec, returning a list of error strings. */
83
- declare function validateToolSpec(spec: ToolSpec): string[];
84
- /** BFS search for a command by name (mirrors Go FindCommand). */
85
- declare function findCommand(spec: ToolSpec, name: string): Command | undefined;
86
-
87
- type toolspec_Command = Command;
88
- type toolspec_Contract = Contract;
89
- type toolspec_ErrorPattern = ErrorPattern;
90
- type toolspec_Flag = Flag;
91
- type toolspec_Intent = Intent;
92
- type toolspec_OutputSchema = OutputSchema;
93
- type toolspec_Provenance = Provenance;
94
- type toolspec_Safety = Safety;
95
- type toolspec_SafetyLevel = SafetyLevel;
96
- type toolspec_StateIntrospection = StateIntrospection;
97
- type toolspec_ToolSpec = ToolSpec;
98
- type toolspec_Workflow = Workflow;
99
- declare const toolspec_findCommand: typeof findCommand;
100
- declare const toolspec_loadToolSpec: typeof loadToolSpec;
101
- declare const toolspec_validateToolSpec: typeof validateToolSpec;
102
- declare namespace toolspec {
103
- export { type toolspec_Command as Command, type toolspec_Contract as Contract, type toolspec_ErrorPattern as ErrorPattern, type toolspec_Flag as Flag, type toolspec_Intent as Intent, type toolspec_OutputSchema as OutputSchema, type toolspec_Provenance as Provenance, 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_findCommand as findCommand, toolspec_loadToolSpec as loadToolSpec, toolspec_validateToolSpec as validateToolSpec };
104
- }
105
-
106
- export { type Command as C, type ErrorPattern as E, type Flag as F, type Intent as I, type OutputSchema as O, type Provenance as P, type Safety as S, type ToolSpec as T, type Workflow as W, type Contract as a, type SafetyLevel as b, type StateIntrospection as c, findCommand as f, loadToolSpec as l, toolspec as t, validateToolSpec as v };