unicommand 0.0.1

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.
@@ -0,0 +1,609 @@
1
+ import { ZodType, z } from 'zod';
2
+ export { z } from 'zod';
3
+ import { Program, CreateOptionCommandOpts, Command } from '@caporal/core';
4
+
5
+ type CompletionConfig = {
6
+ binNames?: readonly string[];
7
+ };
8
+ declare const registerCompletionCommand: (program: Program, config?: CompletionConfig) => void;
9
+
10
+ declare const setProgramExamples: (program: Program, examples: string[]) => void;
11
+ declare const isGlobalHelpRequest: (args: readonly string[]) => boolean;
12
+ declare const printProgramHelp: (program: Program) => Promise<void>;
13
+
14
+ type JsonSchemaProperty = {
15
+ type: 'array' | 'boolean' | 'number' | 'string';
16
+ description?: string;
17
+ items?: {
18
+ type: 'string';
19
+ };
20
+ };
21
+ type CommandArgumentDefinition = {
22
+ synopsis: string;
23
+ description: string;
24
+ };
25
+ type CommandOptionDefinition = {
26
+ name: string;
27
+ description: string;
28
+ aliases?: readonly string[];
29
+ config?: CreateOptionCommandOpts;
30
+ negated?: boolean;
31
+ schema?: JsonSchemaProperty;
32
+ value?: string;
33
+ };
34
+ type CommandMcpToolMetadata = {
35
+ kind: 'tool';
36
+ readOnly: boolean;
37
+ destructive: boolean;
38
+ idempotent: boolean;
39
+ openWorld: boolean;
40
+ requiresConfirmation: boolean;
41
+ sideEffects?: string[];
42
+ };
43
+ type CommandMcpResourceMetadata = {
44
+ kind: 'resource';
45
+ uriTemplate: string;
46
+ mimeType?: string;
47
+ };
48
+ type CommandMcpMetadata = false | CommandMcpToolMetadata | CommandMcpResourceMetadata;
49
+ declare const isCommandMcpToolMetadata: (metadata: CommandMcpMetadata | undefined) => metadata is CommandMcpToolMetadata;
50
+ declare const isCommandMcpResourceMetadata: (metadata: CommandMcpMetadata | undefined) => metadata is CommandMcpResourceMetadata;
51
+ type ShellCompletionSnippet = {
52
+ complete: string;
53
+ functions?: string;
54
+ };
55
+ type CommandCompletionDefinition = {
56
+ bash?: (binName: string) => string;
57
+ fish?: (binName: string) => ShellCompletionSnippet;
58
+ zsh?: (binName: string) => ShellCompletionSnippet;
59
+ };
60
+ type CommandExamplesDefinition = (binName: string) => readonly string[];
61
+ type CommandDefinition<TInputSchema extends ZodType = ZodType, TOutputSchema extends ZodType = ZodType> = {
62
+ name: string;
63
+ description: string;
64
+ aliases?: readonly string[];
65
+ arguments?: readonly CommandArgumentDefinition[];
66
+ completion?: CommandCompletionDefinition;
67
+ config?: Parameters<Program['command']>[2];
68
+ examples?: CommandExamplesDefinition;
69
+ inputSchema: TInputSchema;
70
+ mcp?: CommandMcpMetadata;
71
+ options?: readonly CommandOptionDefinition[];
72
+ order?: number;
73
+ outputSchema: TOutputSchema;
74
+ };
75
+ type DefineCommandDefinition<TInputSchema extends ZodType = ZodType, TOutputSchema extends ZodType = ZodType> = Omit<CommandDefinition<TInputSchema, TOutputSchema>, 'inputSchema' | 'outputSchema'> & {
76
+ inputSchema?: TInputSchema;
77
+ outputSchema?: TOutputSchema;
78
+ };
79
+ declare const defineCommand: <TInputSchema extends ZodType = ZodType, TOutputSchema extends ZodType = ZodType>(definition: DefineCommandDefinition<TInputSchema, TOutputSchema>) => CommandDefinition<TInputSchema, TOutputSchema>;
80
+ declare const registerCommand: (program: Program, definition: CommandDefinition) => Command;
81
+ declare const commandInputValue: (args: Record<string, unknown>, name: string) => unknown;
82
+ declare const commandInputString: (args: Record<string, unknown>, name: string) => string;
83
+ declare const commandActionInput: (definition: CommandDefinition, args: Record<string, unknown>, options: Record<string, unknown>) => {
84
+ [x: string]: unknown;
85
+ } & {
86
+ [k: string]: unknown;
87
+ };
88
+ declare const normalizeCommandInputAliases: <TInput extends Record<string, unknown>>(definition: CommandDefinition, input: TInput) => TInput & {
89
+ [k: string]: unknown;
90
+ };
91
+ declare const commandDefinitionToZodInputSchema: (definition: CommandDefinition) => z.ZodObject<{
92
+ [x: string]: ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
93
+ }, z.core.$strip>;
94
+ declare const commandDefinitionToInputSchema: (definition: CommandDefinition) => {
95
+ type: string;
96
+ properties: any;
97
+ required: string[];
98
+ additionalProperties: boolean;
99
+ };
100
+ declare const commandOptionSynopsis: (option: CommandOptionDefinition) => string;
101
+
102
+ type CommandRegistrarContext$1<TContext> = {
103
+ binName: string;
104
+ getContext?: () => Promise<TContext> | TContext;
105
+ };
106
+ type CommandRegistrar<TContext> = (program: Program, context: CommandRegistrarContext$1<TContext>) => void;
107
+ type RegisterCliCommandsFromDirectoryOptions<TContext> = {
108
+ binName: string;
109
+ commandsDir: string;
110
+ getContext?: () => Promise<TContext> | TContext;
111
+ program: Program;
112
+ };
113
+ type CreateCommandProgramOptions<TContext> = {
114
+ binName: string;
115
+ binNames?: readonly string[];
116
+ commandsDir?: string;
117
+ description: string;
118
+ getContext?: () => Promise<TContext> | TContext;
119
+ importMetaUrl: string;
120
+ isDevRun?: boolean;
121
+ packageName?: string;
122
+ printVersion?: (version: string) => void;
123
+ version?: string;
124
+ };
125
+ type RegisterParentCommandsFromDefinitionsOptions = {
126
+ description?: (name: string) => string;
127
+ print?: (message: string) => void;
128
+ };
129
+ declare const createCommandProgram: <TContext>({ binName, binNames, commandsDir, description, getContext, importMetaUrl, isDevRun, packageName, printVersion, version, }: CreateCommandProgramOptions<TContext>) => Promise<Program>;
130
+ declare const registerParentCommandsFromDefinitions: (program: Program, definitions: readonly CommandDefinition[], options?: RegisterParentCommandsFromDefinitionsOptions) => void;
131
+ declare const registerCliCommandsFromDirectory: <TContext>({ binName, commandsDir, getContext, program, }: RegisterCliCommandsFromDirectoryOptions<TContext>) => Promise<CommandDefinition[]>;
132
+ declare const getProgramConstructor: () => new () => Program;
133
+
134
+ type CliConfig<TProgram> = {
135
+ createProgram: (binName: string) => TProgram | Promise<TProgram>;
136
+ defaultBinName: string;
137
+ envBinName: string;
138
+ importMetaUrl: string;
139
+ };
140
+ declare const getProgramBin: (config: Pick<CliConfig<unknown>, "defaultBinName" | "envBinName" | "importMetaUrl">) => string;
141
+ declare const isDirectRun: (importMetaUrl: string) => boolean;
142
+
143
+ type CreateCommandCliRunnerOptions<TContext> = {
144
+ binNames?: readonly string[];
145
+ commandsDir?: string;
146
+ defaultBinName: string;
147
+ description: string;
148
+ envBinName: string;
149
+ getContext?: () => Promise<TContext> | TContext;
150
+ importMetaUrl: string;
151
+ isDevRun?: boolean;
152
+ packageName?: string;
153
+ printVersion?: (version: string) => void;
154
+ version?: string;
155
+ };
156
+ type CreatePackageCommandCliRunnerOptions<TContext> = Omit<CreateCommandCliRunnerOptions<TContext>, 'defaultBinName' | 'description' | 'envBinName'> & {
157
+ defaultBinName?: string;
158
+ description?: string;
159
+ envBinName?: string;
160
+ };
161
+ declare const createCliRunner: (config: CliConfig<Program>) => {
162
+ isDirectRun: () => boolean;
163
+ runCli: (args?: string[]) => Promise<number>;
164
+ };
165
+ declare const createPackageCommandCliRunner: <TContext>({ defaultBinName, envBinName, importMetaUrl, ...options }: CreatePackageCommandCliRunnerOptions<TContext>) => {
166
+ isDirectRun: () => boolean;
167
+ runCli: (args?: string[]) => Promise<number>;
168
+ };
169
+ declare const createCommandCliRunner: <TContext>({ binNames, commandsDir, defaultBinName, description, envBinName, getContext, importMetaUrl, isDevRun, packageName, printVersion, version, }: CreateCommandCliRunnerOptions<TContext>) => {
170
+ isDirectRun: () => boolean;
171
+ runCli: (args?: string[]) => Promise<number>;
172
+ };
173
+
174
+ declare enum PackageManager {
175
+ Npm = "npm",
176
+ Pnpm = "pnpm",
177
+ Yarn = "yarn"
178
+ }
179
+ type RegisterUpdateCommandOptions = {
180
+ isDevRun: boolean;
181
+ packageName: string;
182
+ version?: string;
183
+ };
184
+ declare const registerUpdateCommand: (program: Program, options: RegisterUpdateCommandOptions) => void;
185
+ declare function getPackageManagerFromPath(globalBinPath: string): PackageManager | null;
186
+
187
+ type McpToolDefinition = {
188
+ name: string;
189
+ description: string;
190
+ inputSchema: unknown;
191
+ outputSchema: unknown;
192
+ annotations?: {
193
+ readOnlyHint?: boolean;
194
+ destructiveHint?: boolean;
195
+ idempotentHint?: boolean;
196
+ openWorldHint?: boolean;
197
+ requiresConfirmation?: boolean;
198
+ sideEffects?: string[];
199
+ };
200
+ };
201
+ type JsonRpcRequest = {
202
+ id?: number | string;
203
+ jsonrpc?: '2.0';
204
+ method?: string;
205
+ params?: unknown;
206
+ };
207
+ type ToolCallParams = {
208
+ name?: string;
209
+ arguments?: Record<string, unknown>;
210
+ };
211
+ type McpResultEnvelope = {
212
+ data: unknown;
213
+ progress?: Record<string, unknown>;
214
+ };
215
+ type McpResourceDefinition = {
216
+ uri: string;
217
+ name: string;
218
+ description: string;
219
+ mimeType: string;
220
+ };
221
+ type McpResourceTemplateDefinition = {
222
+ uriTemplate: string;
223
+ name: string;
224
+ description: string;
225
+ mimeType: string;
226
+ };
227
+ type ResourceReadParams = {
228
+ uri?: string;
229
+ };
230
+ type CommandResourceRoute = {
231
+ command: CommandDefinition;
232
+ handler: (args: Record<string, unknown>) => Promise<unknown> | unknown;
233
+ inputNames: string[];
234
+ mimeType: string;
235
+ name: string;
236
+ uriTemplate: string;
237
+ };
238
+ type CreateMcpServerOptions = {
239
+ name: string;
240
+ tools: McpToolDefinition[];
241
+ resources?: McpResourceDefinition[];
242
+ resourceTemplates?: McpResourceTemplateDefinition[];
243
+ callTool: (params: unknown) => Promise<unknown> | unknown;
244
+ readResource?: (params: unknown) => Promise<unknown> | unknown;
245
+ };
246
+ type CreateSingleToolMcpServerOptions = {
247
+ serverName: string;
248
+ tool: McpToolDefinition;
249
+ callTool: (args: Record<string, unknown>) => Promise<unknown> | unknown;
250
+ };
251
+ type CreateCommandMcpServerOptions<TContext> = {
252
+ commandsDir?: string;
253
+ getContext?: () => Promise<TContext> | TContext;
254
+ importMetaUrl: string;
255
+ name: string;
256
+ prefix?: string;
257
+ };
258
+ type CreatePackageCommandMcpServerOptions<TContext> = Omit<CreateCommandMcpServerOptions<TContext>, 'name' | 'prefix'> & {
259
+ mcpServerPrefix?: string;
260
+ name?: string;
261
+ prefix?: string;
262
+ };
263
+ type CommandMcpRoute = {
264
+ command: CommandDefinition;
265
+ inputSchema: ZodType;
266
+ outputSchema: ZodType;
267
+ handler: (args: Record<string, unknown>) => Promise<unknown> | unknown;
268
+ };
269
+ type CommandMcpRouteFactory<TContext> = (getContext: () => Promise<TContext> | TContext) => CommandMcpRoute;
270
+ type CreateCommandMcpRouterOptions = {
271
+ prefix?: string;
272
+ routes: readonly CommandMcpRoute[];
273
+ };
274
+
275
+ type ContextFactory<TContext> = () => Promise<TContext> | TContext;
276
+ type Handler<TInput, TResult> = {
277
+ handle(input: TInput): Promise<TResult> | TResult;
278
+ }['handle'];
279
+ type ContextHandler<TContext, TInput, TResult> = {
280
+ handle(context: TContext, input: TInput): Promise<TResult> | TResult;
281
+ }['handle'];
282
+ type CommandRegistrarContext<TContext> = {
283
+ binName?: string;
284
+ getContext?: ContextFactory<TContext>;
285
+ };
286
+ type CommandAdaptersReturn<TContext, THandler> = {
287
+ cli: (program: Program, context?: CommandRegistrarContext<TContext>) => void;
288
+ handler: THandler;
289
+ mcp: (getContext?: ContextFactory<TContext>) => CommandMcpRoute;
290
+ metadata: CommandDefinition;
291
+ };
292
+ type CommandPrint<TContext, TInputSchema extends ZodType, TResult> = (output: TResult, input: z.infer<TInputSchema>, context?: TContext) => Promise<void> | void;
293
+ type BaseCommandAdaptersOptions<TInputSchema extends ZodType, TOutputSchema extends ZodType, TResult> = {
294
+ metadata: CommandDefinition<TInputSchema, TOutputSchema>;
295
+ print?: CommandPrint<unknown, TInputSchema, TResult>;
296
+ };
297
+ type CommandAdaptersOptions<TInputSchema extends ZodType, TOutputSchema extends ZodType, TResult> = BaseCommandAdaptersOptions<TInputSchema, TOutputSchema, TResult> & {
298
+ handler: Handler<z.infer<TInputSchema>, TResult>;
299
+ };
300
+ type ContextCommandAdaptersOptions<TContext, TInputSchema extends ZodType, TOutputSchema extends ZodType, TResult> = Omit<BaseCommandAdaptersOptions<TInputSchema, TOutputSchema, TResult>, 'print'> & {
301
+ handler: ContextHandler<TContext, z.infer<TInputSchema>, TResult>;
302
+ print?: CommandPrint<TContext, TInputSchema, TResult>;
303
+ };
304
+ declare function createCommandAdapters<TInputSchema extends ZodType = ZodType<Record<string, unknown>>, TOutputSchema extends ZodType = ZodType, TResult = unknown>(options: CommandAdaptersOptions<TInputSchema, TOutputSchema, TResult>): CommandAdaptersReturn<unknown, Handler<z.infer<TInputSchema>, TResult>>;
305
+ declare function createCommandAdapters<TContext, TInputSchema extends ZodType = ZodType<Record<string, unknown>>, TOutputSchema extends ZodType = ZodType, TResult = unknown>(options: ContextCommandAdaptersOptions<TContext, TInputSchema, TOutputSchema, TResult>): CommandAdaptersReturn<TContext, ContextHandler<TContext, z.infer<TInputSchema>, TResult>>;
306
+
307
+ type CommandModule = Record<string, unknown>;
308
+ type CommandAdapterExport = Pick<CommandAdaptersReturn<unknown, unknown>, 'cli'> & Partial<Pick<CommandAdaptersReturn<unknown, unknown>, 'mcp' | 'metadata'>>;
309
+ declare const loadCommandModules: (commandsDir: string) => Promise<CommandModule[]>;
310
+ declare const loadCommandModulesFromFiles: (files: readonly string[]) => Promise<CommandModule[]>;
311
+ declare const commandDefinitionsFromModules: (modules: readonly CommandModule[]) => CommandDefinition[];
312
+ declare const commandExportsFromModules: <TExport>(modules: readonly CommandModule[], isExport: (name: string, value: unknown) => boolean) => TExport[];
313
+ declare const isCommandAdapterExport: (value: unknown) => value is CommandAdapterExport;
314
+
315
+ declare const DEFAULT_COMMANDS_DIR = "commands";
316
+ declare const PROGRAM_NAME_ENV_SUFFIX = "_PROG_NAME";
317
+
318
+ type GenerateReadmeCommandDocsOptions = {
319
+ binName: string;
320
+ commandDefinitions?: readonly CommandDefinition[];
321
+ commandsDir?: string;
322
+ markerName?: string;
323
+ readmePath?: string;
324
+ };
325
+ declare const generateReadmeCommandDocs: ({ binName, commandDefinitions, commandsDir, markerName, readmePath, }: GenerateReadmeCommandDocsOptions) => Promise<void>;
326
+ declare const formatCommandDocs: (commands: readonly CommandDefinition[], binName: string) => string;
327
+
328
+ declare const loadCommandMcpRoutes: <TContext>(commandsDir: string, getContext?: () => Promise<TContext> | TContext) => Promise<CommandMcpRoute[]>;
329
+ declare const createCommandMcpServer: <TContext>({ commandsDir, getContext, importMetaUrl, name, prefix, }: CreateCommandMcpServerOptions<TContext>) => Promise<{
330
+ start: () => Promise<void>;
331
+ }>;
332
+ declare const startCommandMcpServer: <TContext>(options: CreateCommandMcpServerOptions<TContext>) => Promise<void>;
333
+ declare const startPackageCommandMcpServer: <TContext>({ importMetaUrl, mcpServerPrefix, name, prefix, ...options }: CreatePackageCommandMcpServerOptions<TContext>) => Promise<void>;
334
+
335
+ declare const assertToolName: (expectedName: string, actualName: string | undefined) => void;
336
+ declare const throwUnknownTool: (name: string | undefined) => never;
337
+
338
+ declare const commandMcpRouteToResourceRoute: (route: CommandMcpRoute) => CommandResourceRoute[];
339
+ declare const commandResourceRouteToResource: (route: CommandResourceRoute) => McpResourceDefinition;
340
+ declare const commandResourceRouteToResourceTemplate: (route: CommandResourceRoute) => McpResourceTemplateDefinition;
341
+ declare const commandResourceInput: (route: CommandResourceRoute, uri: string | undefined) => {
342
+ [k: string]: string;
343
+ } | undefined;
344
+ declare const isResourceTemplate: (uri: string) => boolean;
345
+ declare const resourceResult: (params: unknown, data: unknown) => {
346
+ contents: {
347
+ uri: string;
348
+ mimeType: string;
349
+ text: string;
350
+ }[];
351
+ };
352
+
353
+ declare const createCommandMcpRoute: ({ command, handler, inputSchema, outputSchema, }: CommandMcpRoute) => CommandMcpRoute;
354
+ declare const commandMcpRouteToTool: (route: CommandMcpRoute, prefix?: string) => {
355
+ name: string;
356
+ description: string;
357
+ inputSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
358
+ outputSchema: {
359
+ type: string;
360
+ properties: {
361
+ data: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
362
+ progress: {
363
+ type: string;
364
+ properties: {
365
+ count: {
366
+ type: string;
367
+ };
368
+ elapsedMs: {
369
+ type: string;
370
+ };
371
+ changed: {
372
+ type: string;
373
+ };
374
+ errors: {
375
+ type: string;
376
+ items: {
377
+ type: string;
378
+ };
379
+ };
380
+ matched: {
381
+ type: string;
382
+ };
383
+ nextCursor: {
384
+ type: string;
385
+ };
386
+ processed: {
387
+ type: string;
388
+ };
389
+ skipped: {
390
+ type: string;
391
+ };
392
+ };
393
+ required: string[];
394
+ additionalProperties: boolean;
395
+ };
396
+ status: {
397
+ type: string;
398
+ enum: string[];
399
+ };
400
+ };
401
+ required: string[];
402
+ additionalProperties: boolean;
403
+ };
404
+ annotations: {
405
+ readOnlyHint: boolean;
406
+ destructiveHint: boolean;
407
+ idempotentHint: boolean;
408
+ openWorldHint: boolean;
409
+ requiresConfirmation: boolean;
410
+ sideEffects: string[] | undefined;
411
+ } | undefined;
412
+ };
413
+ declare const commandNameToMcpToolName: (name: string, prefix?: string) => string;
414
+ declare const createCommandMcpRouter: ({ prefix, routes }: CreateCommandMcpRouterOptions) => {
415
+ tools: {
416
+ name: string;
417
+ description: string;
418
+ inputSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
419
+ outputSchema: {
420
+ type: string;
421
+ properties: {
422
+ data: z.core.ZodStandardJSONSchemaPayload<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
423
+ progress: {
424
+ type: string;
425
+ properties: {
426
+ count: {
427
+ type: string;
428
+ };
429
+ elapsedMs: {
430
+ type: string;
431
+ };
432
+ changed: {
433
+ type: string;
434
+ };
435
+ errors: {
436
+ type: string;
437
+ items: {
438
+ type: string;
439
+ };
440
+ };
441
+ matched: {
442
+ type: string;
443
+ };
444
+ nextCursor: {
445
+ type: string;
446
+ };
447
+ processed: {
448
+ type: string;
449
+ };
450
+ skipped: {
451
+ type: string;
452
+ };
453
+ };
454
+ required: string[];
455
+ additionalProperties: boolean;
456
+ };
457
+ status: {
458
+ type: string;
459
+ enum: string[];
460
+ };
461
+ };
462
+ required: string[];
463
+ additionalProperties: boolean;
464
+ };
465
+ annotations: {
466
+ readOnlyHint: boolean;
467
+ destructiveHint: boolean;
468
+ idempotentHint: boolean;
469
+ openWorldHint: boolean;
470
+ requiresConfirmation: boolean;
471
+ sideEffects: string[] | undefined;
472
+ } | undefined;
473
+ }[];
474
+ resources: McpResourceDefinition[];
475
+ resourceTemplates: McpResourceTemplateDefinition[];
476
+ callTool: (params: unknown) => Promise<{
477
+ data: unknown;
478
+ progress: {
479
+ changed: number;
480
+ matched: number;
481
+ processed: number;
482
+ skipped: number;
483
+ } | undefined;
484
+ }>;
485
+ readResource: (params: unknown) => Promise<unknown>;
486
+ };
487
+
488
+ declare const mcpToolOutputSchema: (dataSchema: ZodType) => {
489
+ type: string;
490
+ properties: {
491
+ data: z.core.ZodStandardJSONSchemaPayload<ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
492
+ progress: {
493
+ type: string;
494
+ properties: {
495
+ count: {
496
+ type: string;
497
+ };
498
+ elapsedMs: {
499
+ type: string;
500
+ };
501
+ changed: {
502
+ type: string;
503
+ };
504
+ errors: {
505
+ type: string;
506
+ items: {
507
+ type: string;
508
+ };
509
+ };
510
+ matched: {
511
+ type: string;
512
+ };
513
+ nextCursor: {
514
+ type: string;
515
+ };
516
+ processed: {
517
+ type: string;
518
+ };
519
+ skipped: {
520
+ type: string;
521
+ };
522
+ };
523
+ required: string[];
524
+ additionalProperties: boolean;
525
+ };
526
+ status: {
527
+ type: string;
528
+ enum: string[];
529
+ };
530
+ };
531
+ required: string[];
532
+ additionalProperties: boolean;
533
+ };
534
+ declare const emptyMcpInputSchema: {
535
+ readonly type: "object";
536
+ readonly properties: {};
537
+ readonly required: readonly [];
538
+ readonly additionalProperties: false;
539
+ };
540
+
541
+ declare const createSingleToolMcpServer: ({ serverName, tool, callTool, }: CreateSingleToolMcpServerOptions) => {
542
+ start: () => Promise<void>;
543
+ };
544
+ declare const createMcpServer: ({ name, tools, resources, resourceTemplates, callTool, readResource, }: CreateMcpServerOptions) => {
545
+ start: () => Promise<void>;
546
+ };
547
+
548
+ type PackageJson = {
549
+ bin?: Record<string, string>;
550
+ description?: string;
551
+ name?: string;
552
+ version?: string;
553
+ };
554
+ type PackageBinEntry = {
555
+ binPath: string;
556
+ commandName: string;
557
+ };
558
+ declare const packageRoot: (importMetaUrl: string) => string;
559
+ declare const readPackageJson: (packageDir: string) => PackageJson;
560
+ declare const shortPackageName: (name?: string) => string;
561
+ declare const packageEnvPrefix: (name?: string) => string;
562
+ declare const packageBinEntry: (packageDir: string, packageJson: PackageJson) => PackageBinEntry;
563
+
564
+ type PackageCommandMetadata = {
565
+ binName: string;
566
+ binNames: string[];
567
+ description?: string;
568
+ envBinName: string;
569
+ mcpPrefix: string;
570
+ mcpServerName: string;
571
+ packageDir: string;
572
+ packageName: string;
573
+ version?: string;
574
+ };
575
+ type PackageCommandMetadataOptions = {
576
+ mcpServerPrefix?: string;
577
+ };
578
+ declare const packageCommandMetadata: (importMetaUrl: string, options?: PackageCommandMetadataOptions) => PackageCommandMetadata;
579
+
580
+ type DevCommandConfig = {
581
+ binDirEnvName: string;
582
+ cliPath: string;
583
+ commandName: string;
584
+ packageDir: string;
585
+ programNameEnvName: string;
586
+ };
587
+ type PackageDevCommandOptions = {
588
+ commandName: string;
589
+ };
590
+ type PackageDevCommandsOptions = {
591
+ commandNames: readonly string[];
592
+ };
593
+ declare const installDevCommand: (config: DevCommandConfig) => void;
594
+ declare const installPackageDevCommand: (importMetaUrl: string, options: PackageDevCommandOptions) => void;
595
+ declare const installPackageDevCommands: (importMetaUrl: string, options: PackageDevCommandsOptions) => void;
596
+ declare const uninstallDevCommand: (config: Pick<DevCommandConfig, "binDirEnvName" | "commandName">) => void;
597
+ declare const uninstallPackageDevCommand: (importMetaUrl: string, options: PackageDevCommandOptions) => void;
598
+ declare const uninstallPackageDevCommands: (importMetaUrl: string, options: PackageDevCommandsOptions) => void;
599
+
600
+ type DevCommandShimConfig = {
601
+ cliPath: string;
602
+ commandName: string;
603
+ packageDir: string;
604
+ programNameEnvName: string;
605
+ };
606
+ declare const installCommandShim: (binDir: string, config: DevCommandShimConfig) => void;
607
+ declare const getBinDir: (envName: string) => string;
608
+
609
+ export { type CliConfig, type CommandAdapterExport, type CommandAdaptersReturn, type CommandArgumentDefinition, type CommandCompletionDefinition, type CommandDefinition, type CommandExamplesDefinition, type CommandMcpMetadata, type CommandMcpResourceMetadata, type CommandMcpRoute, type CommandMcpRouteFactory, type CommandMcpToolMetadata, type CommandModule, type CommandOptionDefinition, type CommandRegistrar, type CommandRegistrarContext$1 as CommandRegistrarContext, type CommandResourceRoute, type CompletionConfig, type CreateCommandMcpRouterOptions, type CreateCommandMcpServerOptions, type CreateCommandProgramOptions, type CreateMcpServerOptions, type CreatePackageCommandMcpServerOptions, type CreateSingleToolMcpServerOptions, DEFAULT_COMMANDS_DIR, type DefineCommandDefinition, type DevCommandShimConfig, type GenerateReadmeCommandDocsOptions, type JsonRpcRequest, type JsonSchemaProperty, type McpResourceDefinition, type McpResourceTemplateDefinition, type McpResultEnvelope, type McpToolDefinition, PROGRAM_NAME_ENV_SUFFIX, type PackageBinEntry, type PackageCommandMetadata, type PackageJson, PackageManager, type RegisterCliCommandsFromDirectoryOptions, type RegisterParentCommandsFromDefinitionsOptions, type RegisterUpdateCommandOptions, type ResourceReadParams, type ShellCompletionSnippet, type ToolCallParams, assertToolName, commandActionInput, commandDefinitionToInputSchema, commandDefinitionToZodInputSchema, commandDefinitionsFromModules, commandExportsFromModules, commandInputString, commandInputValue, commandMcpRouteToResourceRoute, commandMcpRouteToTool, commandNameToMcpToolName, commandOptionSynopsis, commandResourceInput, commandResourceRouteToResource, commandResourceRouteToResourceTemplate, createCliRunner, createCommandAdapters, createCommandCliRunner, createCommandMcpRoute, createCommandMcpRouter, createCommandMcpServer, createCommandProgram, createMcpServer, createPackageCommandCliRunner, createSingleToolMcpServer, defineCommand, emptyMcpInputSchema, formatCommandDocs, generateReadmeCommandDocs, getBinDir, getPackageManagerFromPath, getProgramBin, getProgramConstructor, installCommandShim, installDevCommand, installPackageDevCommand, installPackageDevCommands, isCommandAdapterExport, isCommandMcpResourceMetadata, isCommandMcpToolMetadata, isDirectRun, isGlobalHelpRequest, isResourceTemplate, loadCommandMcpRoutes, loadCommandModules, loadCommandModulesFromFiles, mcpToolOutputSchema, normalizeCommandInputAliases, packageBinEntry, packageCommandMetadata, packageEnvPrefix, packageRoot, printProgramHelp, readPackageJson, registerCliCommandsFromDirectory, registerCommand, registerCompletionCommand, registerParentCommandsFromDefinitions, registerUpdateCommand, resourceResult, setProgramExamples, shortPackageName, startCommandMcpServer, startPackageCommandMcpServer, throwUnknownTool, uninstallDevCommand, uninstallPackageDevCommand, uninstallPackageDevCommands };