incur 0.4.7 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Cli.d.ts +65 -19
- package/dist/Cli.d.ts.map +1 -1
- package/dist/Cli.js +294 -66
- package/dist/Cli.js.map +1 -1
- package/dist/Completions.d.ts +2 -1
- package/dist/Completions.d.ts.map +1 -1
- package/dist/Completions.js +52 -13
- package/dist/Completions.js.map +1 -1
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +6 -5
- package/dist/Formatter.js.map +1 -1
- package/dist/Help.d.ts +5 -0
- package/dist/Help.d.ts.map +1 -1
- package/dist/Help.js +19 -5
- package/dist/Help.js.map +1 -1
- package/dist/Mcp.d.ts +21 -0
- package/dist/Mcp.d.ts.map +1 -1
- package/dist/Mcp.js +25 -8
- package/dist/Mcp.js.map +1 -1
- package/dist/Openapi.d.ts +14 -0
- package/dist/Openapi.d.ts.map +1 -1
- package/dist/Openapi.js +85 -1
- package/dist/Openapi.js.map +1 -1
- package/dist/Parser.d.ts +14 -0
- package/dist/Parser.d.ts.map +1 -1
- package/dist/Parser.js +127 -1
- package/dist/Parser.js.map +1 -1
- package/dist/Skill.d.ts.map +1 -1
- package/dist/Skill.js +5 -2
- package/dist/Skill.js.map +1 -1
- package/dist/Skillgen.d.ts.map +1 -1
- package/dist/Skillgen.js +4 -38
- package/dist/Skillgen.js.map +1 -1
- package/dist/SyncMcp.d.ts.map +1 -1
- package/dist/SyncMcp.js +75 -8
- package/dist/SyncMcp.js.map +1 -1
- package/dist/SyncSkills.d.ts +9 -0
- package/dist/SyncSkills.d.ts.map +1 -1
- package/dist/SyncSkills.js +13 -74
- package/dist/SyncSkills.js.map +1 -1
- package/dist/bin.d.ts +1 -1
- package/dist/bin.d.ts.map +1 -1
- package/dist/internal/command.d.ts +2 -0
- package/dist/internal/command.d.ts.map +1 -1
- package/dist/internal/command.js +6 -5
- package/dist/internal/command.js.map +1 -1
- package/dist/internal/cta.d.ts +22 -0
- package/dist/internal/cta.d.ts.map +1 -0
- package/dist/internal/cta.js +25 -0
- package/dist/internal/cta.js.map +1 -0
- package/dist/internal/json.d.ts +5 -0
- package/dist/internal/json.d.ts.map +1 -0
- package/dist/internal/json.js +13 -0
- package/dist/internal/json.js.map +1 -0
- package/dist/internal/yaml.d.ts +12 -0
- package/dist/internal/yaml.d.ts.map +1 -0
- package/dist/internal/yaml.js +20 -0
- package/dist/internal/yaml.js.map +1 -0
- package/dist/middleware.d.ts +8 -4
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +1 -1
- package/dist/middleware.js.map +1 -1
- package/package.json +1 -1
- package/src/Cli.test-d.ts +71 -0
- package/src/Cli.test.ts +1164 -65
- package/src/Cli.ts +456 -101
- package/src/Completions.test.ts +84 -0
- package/src/Completions.ts +48 -9
- package/src/Formatter.test.ts +17 -0
- package/src/Formatter.ts +7 -5
- package/src/Help.test.ts +31 -0
- package/src/Help.ts +42 -4
- package/src/Mcp.test.ts +193 -0
- package/src/Mcp.ts +49 -8
- package/src/Openapi.test.ts +179 -0
- package/src/Openapi.ts +122 -2
- package/src/Parser.test.ts +173 -0
- package/src/Parser.ts +132 -1
- package/src/Skill.test.ts +6 -0
- package/src/Skill.ts +8 -5
- package/src/Skillgen.test.ts +55 -6
- package/src/Skillgen.ts +9 -35
- package/src/SyncMcp.test.ts +89 -0
- package/src/SyncMcp.ts +72 -8
- package/src/SyncSkills.test.ts +78 -1
- package/src/SyncSkills.ts +20 -78
- package/src/bun-compile.test.ts +5 -0
- package/src/e2e.test.ts +162 -8
- package/src/internal/command.ts +8 -4
- package/src/internal/cta.ts +58 -0
- package/src/internal/json.ts +16 -0
- package/src/internal/yaml.ts +23 -0
- package/src/lazy-imports.test.ts +94 -0
- package/src/middleware.ts +12 -3
package/package.json
CHANGED
package/src/Cli.test-d.ts
CHANGED
|
@@ -351,6 +351,43 @@ test('run() context exposes format metadata', () => {
|
|
|
351
351
|
})
|
|
352
352
|
})
|
|
353
353
|
|
|
354
|
+
test('command mcp metadata accepts instructions and annotations', () => {
|
|
355
|
+
Cli.create('test').command('read', {
|
|
356
|
+
mcp: {
|
|
357
|
+
annotations: {
|
|
358
|
+
title: 'Read data',
|
|
359
|
+
readOnlyHint: true,
|
|
360
|
+
destructiveHint: false,
|
|
361
|
+
idempotentHint: true,
|
|
362
|
+
openWorldHint: false,
|
|
363
|
+
},
|
|
364
|
+
instructions: 'Only pass validated input.',
|
|
365
|
+
},
|
|
366
|
+
run: () => ({ ok: true }),
|
|
367
|
+
})
|
|
368
|
+
|
|
369
|
+
Cli.create('test', {
|
|
370
|
+
mcp: {
|
|
371
|
+
instructions: 'Use this server for test commands.',
|
|
372
|
+
stateless: false,
|
|
373
|
+
// @ts-expect-error -- annotations belong on command definitions
|
|
374
|
+
annotations: { readOnlyHint: true },
|
|
375
|
+
},
|
|
376
|
+
})
|
|
377
|
+
})
|
|
378
|
+
|
|
379
|
+
test('command metadata accepts destructive flag', () => {
|
|
380
|
+
Cli.create('test').command('destroy', {
|
|
381
|
+
destructive: true,
|
|
382
|
+
run: () => ({ ok: true }),
|
|
383
|
+
})
|
|
384
|
+
|
|
385
|
+
Cli.create('destroy', {
|
|
386
|
+
destructive: true,
|
|
387
|
+
run: () => ({ ok: true }),
|
|
388
|
+
})
|
|
389
|
+
})
|
|
390
|
+
|
|
354
391
|
test('root run() context exposes displayName', () => {
|
|
355
392
|
Cli.create('test', {
|
|
356
393
|
run(c) {
|
|
@@ -360,6 +397,19 @@ test('root run() context exposes displayName', () => {
|
|
|
360
397
|
})
|
|
361
398
|
})
|
|
362
399
|
|
|
400
|
+
test('create() accepts root command hint', () => {
|
|
401
|
+
Cli.create('test', {
|
|
402
|
+
hint: 'Fetch immediately before sending the transaction.',
|
|
403
|
+
run: () => ({ ok: true }),
|
|
404
|
+
})
|
|
405
|
+
|
|
406
|
+
Cli.create({
|
|
407
|
+
name: 'test',
|
|
408
|
+
hint: 'Fetch immediately before sending the transaction.',
|
|
409
|
+
run: () => ({ ok: true }),
|
|
410
|
+
})
|
|
411
|
+
})
|
|
412
|
+
|
|
363
413
|
test('create() accepts config-file defaults options', () => {
|
|
364
414
|
Cli.create('test', {
|
|
365
415
|
config: {},
|
|
@@ -398,3 +448,24 @@ test('create() accepts config-file defaults options', () => {
|
|
|
398
448
|
config: { files: [42] },
|
|
399
449
|
})
|
|
400
450
|
})
|
|
451
|
+
|
|
452
|
+
test('globals type flows to middleware context', () => {
|
|
453
|
+
Cli.create('test', {
|
|
454
|
+
globals: z.object({ apiKey: z.string().optional() }),
|
|
455
|
+
}).use(async (c, next) => {
|
|
456
|
+
expectTypeOf(c.globals.apiKey).toEqualTypeOf<string | undefined>()
|
|
457
|
+
await next()
|
|
458
|
+
})
|
|
459
|
+
})
|
|
460
|
+
|
|
461
|
+
test('globalAlias keys are constrained to globals schema keys', () => {
|
|
462
|
+
Cli.create('test', {
|
|
463
|
+
globals: z.object({ apiKey: z.string() }),
|
|
464
|
+
globalAlias: { apiKey: 'k' },
|
|
465
|
+
})
|
|
466
|
+
|
|
467
|
+
const globals = z.object({ apiKey: z.string() })
|
|
468
|
+
// @ts-expect-error — 'foo' is not a key of the globals schema
|
|
469
|
+
const badAlias: Partial<Record<keyof z.output<typeof globals>, string>> = { foo: 'f' }
|
|
470
|
+
void badAlias
|
|
471
|
+
})
|