incur 0.3.25 → 0.4.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.
- package/README.md +11 -11
- package/SKILL.md +6 -6
- package/dist/Cli.js +14 -14
- package/dist/Cli.js.map +1 -1
- package/dist/Help.js +1 -1
- package/dist/Help.js.map +1 -1
- package/package.json +1 -1
- package/src/Cli.test.ts +64 -41
- package/src/Cli.ts +14 -14
- package/src/Help.test.ts +17 -17
- package/src/Help.ts +1 -1
- package/src/Openapi.test.ts +4 -4
- package/src/e2e.test.ts +59 -41
package/src/Cli.test.ts
CHANGED
|
@@ -630,7 +630,7 @@ describe('serve', () => {
|
|
|
630
630
|
`)
|
|
631
631
|
})
|
|
632
632
|
|
|
633
|
-
test('--
|
|
633
|
+
test('--full-output outputs full envelope', async () => {
|
|
634
634
|
const cli = Cli.create('test')
|
|
635
635
|
cli.command('greet', {
|
|
636
636
|
args: z.object({ name: z.string() }),
|
|
@@ -639,7 +639,7 @@ describe('serve', () => {
|
|
|
639
639
|
},
|
|
640
640
|
})
|
|
641
641
|
|
|
642
|
-
const { output } = await serve(cli, ['greet', 'world', '--
|
|
642
|
+
const { output } = await serve(cli, ['greet', 'world', '--full-output'])
|
|
643
643
|
expect(output).toMatchInlineSnapshot(`
|
|
644
644
|
"ok: true
|
|
645
645
|
data:
|
|
@@ -714,10 +714,10 @@ describe('serve', () => {
|
|
|
714
714
|
`)
|
|
715
715
|
})
|
|
716
716
|
|
|
717
|
-
test('--
|
|
717
|
+
test('--full-output outputs full error envelope for unknown command', async () => {
|
|
718
718
|
const cli = Cli.create('test')
|
|
719
719
|
|
|
720
|
-
const { output, exitCode } = await serve(cli, ['nonexistent', '--
|
|
720
|
+
const { output, exitCode } = await serve(cli, ['nonexistent', '--full-output'])
|
|
721
721
|
expect(exitCode).toBe(1)
|
|
722
722
|
expect(output).toMatchInlineSnapshot(`
|
|
723
723
|
"ok: false
|
|
@@ -787,8 +787,8 @@ describe('serve', () => {
|
|
|
787
787
|
const cli = Cli.create('test')
|
|
788
788
|
cli.command('deploy', { run: () => ({}) })
|
|
789
789
|
|
|
790
|
-
const { output } = await serve(cli, ['deplyo', '--
|
|
791
|
-
expect(output).toContain('test deploy --
|
|
790
|
+
const { output } = await serve(cli, ['deplyo', '--full-output'])
|
|
791
|
+
expect(output).toContain('test deploy --full-output')
|
|
792
792
|
})
|
|
793
793
|
|
|
794
794
|
test('no suggestion when input is too far from any command', async () => {
|
|
@@ -990,10 +990,10 @@ describe('serve', () => {
|
|
|
990
990
|
expect(JSON.parse(output)).toEqual({ pong: true })
|
|
991
991
|
})
|
|
992
992
|
|
|
993
|
-
test('--
|
|
993
|
+
test('--full-output --format json outputs full envelope as JSON', async () => {
|
|
994
994
|
const cli = Cli.create('test')
|
|
995
995
|
cli.command('ping', { run: () => ({ pong: true }) })
|
|
996
|
-
const { output } = await serve(cli, ['ping', '--
|
|
996
|
+
const { output } = await serve(cli, ['ping', '--full-output', '--format', 'json'])
|
|
997
997
|
const parsed = JSON.parse(output)
|
|
998
998
|
expect(parsed.ok).toBe(true)
|
|
999
999
|
expect(parsed.data).toEqual({ pong: true })
|
|
@@ -1479,14 +1479,14 @@ describe('subcommands', () => {
|
|
|
1479
1479
|
`)
|
|
1480
1480
|
})
|
|
1481
1481
|
|
|
1482
|
-
test('--
|
|
1482
|
+
test('--full-output shows full command path in meta', async () => {
|
|
1483
1483
|
const cli = Cli.create('test')
|
|
1484
1484
|
const pr = Cli.create('pr', { description: 'PR management' }).command('list', {
|
|
1485
1485
|
run: () => ({ count: 0 }),
|
|
1486
1486
|
})
|
|
1487
1487
|
cli.command(pr)
|
|
1488
1488
|
|
|
1489
|
-
const { output } = await serve(cli, ['pr', 'list', '--
|
|
1489
|
+
const { output } = await serve(cli, ['pr', 'list', '--full-output'])
|
|
1490
1490
|
expect(output).toMatchInlineSnapshot(`
|
|
1491
1491
|
"ok: true
|
|
1492
1492
|
data:
|
|
@@ -1514,7 +1514,7 @@ describe('subcommands', () => {
|
|
|
1514
1514
|
`)
|
|
1515
1515
|
})
|
|
1516
1516
|
|
|
1517
|
-
test('nested group shows full path in
|
|
1517
|
+
test('nested group shows full path in full-output meta', async () => {
|
|
1518
1518
|
const cli = Cli.create('test')
|
|
1519
1519
|
const review = Cli.create('review', { description: 'Reviews' }).command('approve', {
|
|
1520
1520
|
run: () => ({ approved: true }),
|
|
@@ -1523,7 +1523,7 @@ describe('subcommands', () => {
|
|
|
1523
1523
|
pr.command(review)
|
|
1524
1524
|
cli.command(pr)
|
|
1525
1525
|
|
|
1526
|
-
const { output } = await serve(cli, ['pr', 'review', 'approve', '--
|
|
1526
|
+
const { output } = await serve(cli, ['pr', 'review', 'approve', '--full-output'])
|
|
1527
1527
|
expect(output).toMatchInlineSnapshot(`
|
|
1528
1528
|
"ok: true
|
|
1529
1529
|
data:
|
|
@@ -1596,13 +1596,13 @@ describe('subcommands', () => {
|
|
|
1596
1596
|
Global Options:
|
|
1597
1597
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
1598
1598
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
1599
|
+
--full-output Show full output envelope
|
|
1599
1600
|
--help Show help
|
|
1600
1601
|
--llms, --llms-full Print LLM-readable manifest
|
|
1601
1602
|
--schema Show JSON Schema for command
|
|
1602
1603
|
--token-count Print token count of output (instead of output)
|
|
1603
1604
|
--token-limit <n> Limit output to n tokens
|
|
1604
1605
|
--token-offset <n> Skip first n tokens of output
|
|
1605
|
-
--verbose Show full output envelope
|
|
1606
1606
|
"
|
|
1607
1607
|
`)
|
|
1608
1608
|
})
|
|
@@ -1685,7 +1685,7 @@ describe('cta', () => {
|
|
|
1685
1685
|
},
|
|
1686
1686
|
})
|
|
1687
1687
|
|
|
1688
|
-
const { output } = await serve(cli, ['list', '--
|
|
1688
|
+
const { output } = await serve(cli, ['list', '--full-output', '--format', 'json'])
|
|
1689
1689
|
const parsed = JSON.parse(output)
|
|
1690
1690
|
expect(parsed.meta.cta).toEqual({
|
|
1691
1691
|
description: 'Suggested commands:',
|
|
@@ -1706,7 +1706,7 @@ describe('cta', () => {
|
|
|
1706
1706
|
},
|
|
1707
1707
|
})
|
|
1708
1708
|
|
|
1709
|
-
const { output } = await serve(cli, ['list', '--
|
|
1709
|
+
const { output } = await serve(cli, ['list', '--full-output', '--format', 'json'])
|
|
1710
1710
|
const parsed = JSON.parse(output)
|
|
1711
1711
|
expect(parsed.meta.cta.commands).toEqual([
|
|
1712
1712
|
{ command: 'test get 1', description: 'View item 1' },
|
|
@@ -1735,7 +1735,7 @@ describe('cta', () => {
|
|
|
1735
1735
|
},
|
|
1736
1736
|
})
|
|
1737
1737
|
|
|
1738
|
-
const { output } = await serve(cli, ['create', '--
|
|
1738
|
+
const { output } = await serve(cli, ['create', '--full-output', '--format', 'json'])
|
|
1739
1739
|
const parsed = JSON.parse(output)
|
|
1740
1740
|
expect(parsed.meta.cta.commands).toEqual([
|
|
1741
1741
|
{ command: 'test get 1 --limit 10', description: 'View the item' },
|
|
@@ -1755,7 +1755,7 @@ describe('cta', () => {
|
|
|
1755
1755
|
},
|
|
1756
1756
|
})
|
|
1757
1757
|
|
|
1758
|
-
const { output } = await serve(cli, ['list', '--
|
|
1758
|
+
const { output } = await serve(cli, ['list', '--full-output', '--format', 'json'])
|
|
1759
1759
|
const parsed = JSON.parse(output)
|
|
1760
1760
|
expect(parsed.meta.cta.commands).toEqual([{ command: 'test get <id> --format <format>' }])
|
|
1761
1761
|
})
|
|
@@ -1773,7 +1773,7 @@ describe('cta', () => {
|
|
|
1773
1773
|
},
|
|
1774
1774
|
})
|
|
1775
1775
|
|
|
1776
|
-
const { output } = await serve(cli, ['create', '--
|
|
1776
|
+
const { output } = await serve(cli, ['create', '--full-output', '--format', 'json'])
|
|
1777
1777
|
const parsed = JSON.parse(output)
|
|
1778
1778
|
expect(parsed.meta.cta.description).toBe('View the created item:')
|
|
1779
1779
|
})
|
|
@@ -1782,7 +1782,7 @@ describe('cta', () => {
|
|
|
1782
1782
|
const cli = Cli.create('test')
|
|
1783
1783
|
cli.command('ping', { run: () => ({ pong: true }) })
|
|
1784
1784
|
|
|
1785
|
-
const { output } = await serve(cli, ['ping', '--
|
|
1785
|
+
const { output } = await serve(cli, ['ping', '--full-output', '--format', 'json'])
|
|
1786
1786
|
const parsed = JSON.parse(output)
|
|
1787
1787
|
expect(parsed.meta.cta).toBeUndefined()
|
|
1788
1788
|
})
|
|
@@ -1795,7 +1795,7 @@ describe('cta', () => {
|
|
|
1795
1795
|
},
|
|
1796
1796
|
})
|
|
1797
1797
|
|
|
1798
|
-
const { output } = await serve(cli, ['noop', '--
|
|
1798
|
+
const { output } = await serve(cli, ['noop', '--full-output', '--format', 'json'])
|
|
1799
1799
|
const parsed = JSON.parse(output)
|
|
1800
1800
|
expect(parsed.meta.cta).toBeUndefined()
|
|
1801
1801
|
})
|
|
@@ -1815,7 +1815,7 @@ describe('cta', () => {
|
|
|
1815
1815
|
},
|
|
1816
1816
|
})
|
|
1817
1817
|
|
|
1818
|
-
const { output, exitCode } = await serve(cli, ['fail', '--
|
|
1818
|
+
const { output, exitCode } = await serve(cli, ['fail', '--full-output', '--format', 'json'])
|
|
1819
1819
|
expect(exitCode).toBe(1)
|
|
1820
1820
|
const parsed = JSON.parse(output)
|
|
1821
1821
|
expect(parsed.ok).toBe(false)
|
|
@@ -1833,7 +1833,7 @@ describe('cta', () => {
|
|
|
1833
1833
|
},
|
|
1834
1834
|
})
|
|
1835
1835
|
|
|
1836
|
-
const { output, exitCode } = await serve(cli, ['fail', '--
|
|
1836
|
+
const { output, exitCode } = await serve(cli, ['fail', '--full-output', '--format', 'json'])
|
|
1837
1837
|
expect(exitCode).toBe(1)
|
|
1838
1838
|
const parsed = JSON.parse(output)
|
|
1839
1839
|
expect(parsed.meta.cta).toBeUndefined()
|
|
@@ -1847,7 +1847,7 @@ describe('cta', () => {
|
|
|
1847
1847
|
},
|
|
1848
1848
|
})
|
|
1849
1849
|
|
|
1850
|
-
const { output } = await serve(cli, ['fail', '--
|
|
1850
|
+
const { output } = await serve(cli, ['fail', '--full-output', '--format', 'json'])
|
|
1851
1851
|
const parsed = JSON.parse(output)
|
|
1852
1852
|
expect(parsed.ok).toBe(false)
|
|
1853
1853
|
expect(parsed.meta.cta).toBeUndefined()
|
|
@@ -1869,7 +1869,14 @@ describe('cta', () => {
|
|
|
1869
1869
|
})
|
|
1870
1870
|
cli.command(pr)
|
|
1871
1871
|
|
|
1872
|
-
const { output } = await serve(cli, [
|
|
1872
|
+
const { output } = await serve(cli, [
|
|
1873
|
+
'pr',
|
|
1874
|
+
'create',
|
|
1875
|
+
'my-pr',
|
|
1876
|
+
'--full-output',
|
|
1877
|
+
'--format',
|
|
1878
|
+
'json',
|
|
1879
|
+
])
|
|
1873
1880
|
const parsed = JSON.parse(output)
|
|
1874
1881
|
expect(parsed.meta.cta).toEqual({
|
|
1875
1882
|
description: 'Suggested command:',
|
|
@@ -1909,9 +1916,25 @@ describe('leaf cli', () => {
|
|
|
1909
1916
|
`)
|
|
1910
1917
|
})
|
|
1911
1918
|
|
|
1912
|
-
test('
|
|
1913
|
-
const cli = Cli.create('ping', {
|
|
1919
|
+
test('command option named verbose is parsed by the command', async () => {
|
|
1920
|
+
const cli = Cli.create('ping', {
|
|
1921
|
+
options: z.object({ verbose: z.boolean().default(false) }),
|
|
1922
|
+
run({ options }) {
|
|
1923
|
+
return options
|
|
1924
|
+
},
|
|
1925
|
+
})
|
|
1926
|
+
|
|
1914
1927
|
const { output } = await serve(cli, ['--verbose'])
|
|
1928
|
+
|
|
1929
|
+
expect(output).toMatchInlineSnapshot(`
|
|
1930
|
+
"verbose: true
|
|
1931
|
+
"
|
|
1932
|
+
`)
|
|
1933
|
+
})
|
|
1934
|
+
|
|
1935
|
+
test('--full-output outputs full envelope', async () => {
|
|
1936
|
+
const cli = Cli.create('ping', { run: () => ({ pong: true }) })
|
|
1937
|
+
const { output } = await serve(cli, ['--full-output'])
|
|
1915
1938
|
expect(output).toMatchInlineSnapshot(`
|
|
1916
1939
|
"ok: true
|
|
1917
1940
|
data:
|
|
@@ -2035,6 +2058,7 @@ describe('help', () => {
|
|
|
2035
2058
|
Global Options:
|
|
2036
2059
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
2037
2060
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
2061
|
+
--full-output Show full output envelope
|
|
2038
2062
|
--help Show help
|
|
2039
2063
|
--llms, --llms-full Print LLM-readable manifest
|
|
2040
2064
|
--mcp Start as MCP stdio server
|
|
@@ -2042,7 +2066,6 @@ describe('help', () => {
|
|
|
2042
2066
|
--token-count Print token count of output (instead of output)
|
|
2043
2067
|
--token-limit <n> Limit output to n tokens
|
|
2044
2068
|
--token-offset <n> Skip first n tokens of output
|
|
2045
|
-
--verbose Show full output envelope
|
|
2046
2069
|
--version Show version
|
|
2047
2070
|
"
|
|
2048
2071
|
`)
|
|
@@ -2073,6 +2096,7 @@ describe('help', () => {
|
|
|
2073
2096
|
Global Options:
|
|
2074
2097
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
2075
2098
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
2099
|
+
--full-output Show full output envelope
|
|
2076
2100
|
--help Show help
|
|
2077
2101
|
--llms, --llms-full Print LLM-readable manifest
|
|
2078
2102
|
--mcp Start as MCP stdio server
|
|
@@ -2080,7 +2104,6 @@ describe('help', () => {
|
|
|
2080
2104
|
--token-count Print token count of output (instead of output)
|
|
2081
2105
|
--token-limit <n> Limit output to n tokens
|
|
2082
2106
|
--token-offset <n> Skip first n tokens of output
|
|
2083
|
-
--verbose Show full output envelope
|
|
2084
2107
|
--version Show version
|
|
2085
2108
|
"
|
|
2086
2109
|
`)
|
|
@@ -2107,13 +2130,13 @@ describe('help', () => {
|
|
|
2107
2130
|
Global Options:
|
|
2108
2131
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
2109
2132
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
2133
|
+
--full-output Show full output envelope
|
|
2110
2134
|
--help Show help
|
|
2111
2135
|
--llms, --llms-full Print LLM-readable manifest
|
|
2112
2136
|
--schema Show JSON Schema for command
|
|
2113
2137
|
--token-count Print token count of output (instead of output)
|
|
2114
2138
|
--token-limit <n> Limit output to n tokens
|
|
2115
2139
|
--token-offset <n> Skip first n tokens of output
|
|
2116
|
-
--verbose Show full output envelope
|
|
2117
2140
|
"
|
|
2118
2141
|
`)
|
|
2119
2142
|
})
|
|
@@ -2141,13 +2164,13 @@ describe('help', () => {
|
|
|
2141
2164
|
Global Options:
|
|
2142
2165
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
2143
2166
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
2167
|
+
--full-output Show full output envelope
|
|
2144
2168
|
--help Show help
|
|
2145
2169
|
--llms, --llms-full Print LLM-readable manifest
|
|
2146
2170
|
--schema Show JSON Schema for command
|
|
2147
2171
|
--token-count Print token count of output (instead of output)
|
|
2148
2172
|
--token-limit <n> Limit output to n tokens
|
|
2149
2173
|
--token-offset <n> Skip first n tokens of output
|
|
2150
|
-
--verbose Show full output envelope
|
|
2151
2174
|
"
|
|
2152
2175
|
`)
|
|
2153
2176
|
})
|
|
@@ -2236,6 +2259,7 @@ describe('help', () => {
|
|
|
2236
2259
|
Global Options:
|
|
2237
2260
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
2238
2261
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
2262
|
+
--full-output Show full output envelope
|
|
2239
2263
|
--help Show help
|
|
2240
2264
|
--llms, --llms-full Print LLM-readable manifest
|
|
2241
2265
|
--mcp Start as MCP stdio server
|
|
@@ -2243,7 +2267,6 @@ describe('help', () => {
|
|
|
2243
2267
|
--token-count Print token count of output (instead of output)
|
|
2244
2268
|
--token-limit <n> Limit output to n tokens
|
|
2245
2269
|
--token-offset <n> Skip first n tokens of output
|
|
2246
|
-
--verbose Show full output envelope
|
|
2247
2270
|
--version Show version
|
|
2248
2271
|
"
|
|
2249
2272
|
`)
|
|
@@ -2268,13 +2291,13 @@ describe('help', () => {
|
|
|
2268
2291
|
Global Options:
|
|
2269
2292
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
2270
2293
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
2294
|
+
--full-output Show full output envelope
|
|
2271
2295
|
--help Show help
|
|
2272
2296
|
--llms, --llms-full Print LLM-readable manifest
|
|
2273
2297
|
--schema Show JSON Schema for command
|
|
2274
2298
|
--token-count Print token count of output (instead of output)
|
|
2275
2299
|
--token-limit <n> Limit output to n tokens
|
|
2276
2300
|
--token-offset <n> Skip first n tokens of output
|
|
2277
|
-
--verbose Show full output envelope
|
|
2278
2301
|
"
|
|
2279
2302
|
`)
|
|
2280
2303
|
})
|
|
@@ -2363,13 +2386,13 @@ describe('env', () => {
|
|
|
2363
2386
|
Global Options:
|
|
2364
2387
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
2365
2388
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
2389
|
+
--full-output Show full output envelope
|
|
2366
2390
|
--help Show help
|
|
2367
2391
|
--llms, --llms-full Print LLM-readable manifest
|
|
2368
2392
|
--schema Show JSON Schema for command
|
|
2369
2393
|
--token-count Print token count of output (instead of output)
|
|
2370
2394
|
--token-limit <n> Limit output to n tokens
|
|
2371
2395
|
--token-offset <n> Skip first n tokens of output
|
|
2372
|
-
--verbose Show full output envelope
|
|
2373
2396
|
|
|
2374
2397
|
Environment Variables:
|
|
2375
2398
|
API_TOKEN Auth token
|
|
@@ -2401,13 +2424,13 @@ describe('env', () => {
|
|
|
2401
2424
|
Global Options:
|
|
2402
2425
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
2403
2426
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
2427
|
+
--full-output Show full output envelope
|
|
2404
2428
|
--help Show help
|
|
2405
2429
|
--llms, --llms-full Print LLM-readable manifest
|
|
2406
2430
|
--schema Show JSON Schema for command
|
|
2407
2431
|
--token-count Print token count of output (instead of output)
|
|
2408
2432
|
--token-limit <n> Limit output to n tokens
|
|
2409
2433
|
--token-offset <n> Skip first n tokens of output
|
|
2410
|
-
--verbose Show full output envelope
|
|
2411
2434
|
|
|
2412
2435
|
Environment Variables:
|
|
2413
2436
|
API_TOKEN Auth token (set: ****cret)
|
|
@@ -2941,10 +2964,10 @@ describe('outputPolicy', () => {
|
|
|
2941
2964
|
expect(deploy.output).not.toContain('deploy-123')
|
|
2942
2965
|
expect(deploy.output).toContain('Check status')
|
|
2943
2966
|
|
|
2944
|
-
// deploy --
|
|
2945
|
-
const
|
|
2946
|
-
expect(
|
|
2947
|
-
expect(
|
|
2967
|
+
// deploy --full-output: agent mode shows everything
|
|
2968
|
+
const deployFullOutput = await serve(cli, ['deploy', 'staging', '--full-output'])
|
|
2969
|
+
expect(deployFullOutput.output).toContain('deploy-123')
|
|
2970
|
+
expect(deployFullOutput.output).toContain('staging.example.com')
|
|
2948
2971
|
|
|
2949
2972
|
// deploy --json: agent mode shows data
|
|
2950
2973
|
const deployJson = await serve(cli, ['deploy', 'staging', '--json'])
|
|
@@ -3700,11 +3723,11 @@ describe('fetch', async () => {
|
|
|
3700
3723
|
expect(JSON.parse(output)).toEqual({ ok: true })
|
|
3701
3724
|
})
|
|
3702
3725
|
|
|
3703
|
-
test('--
|
|
3726
|
+
test('--full-output includes request/response meta', async () => {
|
|
3704
3727
|
const cli = Cli.create('test', { description: 'test' }).command('api', {
|
|
3705
3728
|
fetch: app.fetch,
|
|
3706
3729
|
})
|
|
3707
|
-
const { output } = await serve(cli, ['api', 'health', '--
|
|
3730
|
+
const { output } = await serve(cli, ['api', 'health', '--full-output', '--format', 'json'])
|
|
3708
3731
|
const parsed = JSON.parse(output)
|
|
3709
3732
|
expect(parsed.ok).toBe(true)
|
|
3710
3733
|
expect(parsed.data).toEqual({ ok: true })
|
|
@@ -4525,7 +4548,7 @@ describe('displayName', () => {
|
|
|
4525
4548
|
}).command('ping', {
|
|
4526
4549
|
run: (c) => c.ok({ ok: true }, { cta: { commands: ['login'] } }),
|
|
4527
4550
|
})
|
|
4528
|
-
const { output } = await serve(cli, ['ping', '--json', '--
|
|
4551
|
+
const { output } = await serve(cli, ['ping', '--json', '--full-output'])
|
|
4529
4552
|
const parsed = JSON.parse(output)
|
|
4530
4553
|
expect(parsed.meta.cta.commands[0].command).toBe('mc login')
|
|
4531
4554
|
})
|
package/src/Cli.ts
CHANGED
|
@@ -487,7 +487,7 @@ async function serveImpl(
|
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
const {
|
|
490
|
-
|
|
490
|
+
fullOutput,
|
|
491
491
|
format: formatFlag,
|
|
492
492
|
formatExplicit,
|
|
493
493
|
filterOutput,
|
|
@@ -782,9 +782,9 @@ async function serveImpl(
|
|
|
782
782
|
lines.push('')
|
|
783
783
|
lines.push(`Run \`${name} --help\` to see the full command reference.`)
|
|
784
784
|
writeln(lines.join('\n'))
|
|
785
|
-
if (
|
|
785
|
+
if (fullOutput || formatExplicit) {
|
|
786
786
|
const output: Record<string, unknown> = { skills: result.paths }
|
|
787
|
-
if (
|
|
787
|
+
if (fullOutput && result.agents.length > 0) output.agents = result.agents
|
|
788
788
|
writeln(Formatter.format(output, formatExplicit ? formatFlag : 'toon'))
|
|
789
789
|
}
|
|
790
790
|
} catch (err) {
|
|
@@ -865,7 +865,7 @@ async function serveImpl(
|
|
|
865
865
|
for (const s of suggestions) lines.push(` "${s}"`)
|
|
866
866
|
}
|
|
867
867
|
writeln(lines.join('\n'))
|
|
868
|
-
if (
|
|
868
|
+
if (fullOutput || formatExplicit)
|
|
869
869
|
writeln(
|
|
870
870
|
Formatter.format(
|
|
871
871
|
{ name, command: result.command, agents: result.agents },
|
|
@@ -1160,7 +1160,7 @@ async function serveImpl(
|
|
|
1160
1160
|
return writeln(String(estimateTokenCount(formatted)))
|
|
1161
1161
|
}
|
|
1162
1162
|
const cta = output.meta.cta
|
|
1163
|
-
if (human && !
|
|
1163
|
+
if (human && !fullOutput) {
|
|
1164
1164
|
if (output.ok && output.data != null && renderOutput) {
|
|
1165
1165
|
const t = truncate(Formatter.format(output.data, format))
|
|
1166
1166
|
writeln(t.text)
|
|
@@ -1168,7 +1168,7 @@ async function serveImpl(
|
|
|
1168
1168
|
if (cta) writeln(formatHumanCta(cta))
|
|
1169
1169
|
return
|
|
1170
1170
|
}
|
|
1171
|
-
if (
|
|
1171
|
+
if (fullOutput) {
|
|
1172
1172
|
if (tokenLimit != null || tokenOffset != null) {
|
|
1173
1173
|
// Truncate data separately so meta (including nextOffset) is always visible
|
|
1174
1174
|
const dataFormatted =
|
|
@@ -1219,7 +1219,7 @@ async function serveImpl(
|
|
|
1219
1219
|
description: ctaCommands.length === 1 ? 'Suggested command:' : 'Suggested commands:',
|
|
1220
1220
|
commands: ctaCommands,
|
|
1221
1221
|
}
|
|
1222
|
-
if (human && !
|
|
1222
|
+
if (human && !fullOutput) {
|
|
1223
1223
|
writeln(formatHumanError({ code: 'COMMAND_NOT_FOUND', message }))
|
|
1224
1224
|
const mergedCta = skillsCta
|
|
1225
1225
|
? { ...cta, commands: [...cta.commands, ...skillsCta.commands] }
|
|
@@ -1266,7 +1266,7 @@ async function serveImpl(
|
|
|
1266
1266
|
formatExplicit,
|
|
1267
1267
|
human,
|
|
1268
1268
|
renderOutput,
|
|
1269
|
-
|
|
1269
|
+
fullOutput,
|
|
1270
1270
|
truncate,
|
|
1271
1271
|
write,
|
|
1272
1272
|
writeln,
|
|
@@ -1448,7 +1448,7 @@ async function serveImpl(
|
|
|
1448
1448
|
formatExplicit,
|
|
1449
1449
|
human,
|
|
1450
1450
|
renderOutput,
|
|
1451
|
-
|
|
1451
|
+
fullOutput,
|
|
1452
1452
|
truncate,
|
|
1453
1453
|
write,
|
|
1454
1454
|
writeln,
|
|
@@ -2028,11 +2028,11 @@ declare namespace serveImpl {
|
|
|
2028
2028
|
}
|
|
2029
2029
|
}
|
|
2030
2030
|
|
|
2031
|
-
/** @internal Extracts built-in flags (--
|
|
2031
|
+
/** @internal Extracts built-in flags (--full-output, --format, --json, --llms, --help, --version) from argv. */
|
|
2032
2032
|
const validFormats = new Set(['toon', 'json', 'yaml', 'md', 'jsonl'] as const)
|
|
2033
2033
|
|
|
2034
2034
|
function extractBuiltinFlags(argv: string[], options: extractBuiltinFlags.Options = {}) {
|
|
2035
|
-
let
|
|
2035
|
+
let fullOutput = false
|
|
2036
2036
|
let llms = false
|
|
2037
2037
|
let llmsFull = false
|
|
2038
2038
|
let mcp = false
|
|
@@ -2055,7 +2055,7 @@ function extractBuiltinFlags(argv: string[], options: extractBuiltinFlags.Option
|
|
|
2055
2055
|
|
|
2056
2056
|
for (let i = 0; i < argv.length; i++) {
|
|
2057
2057
|
const token = argv[i]!
|
|
2058
|
-
if (token === '--
|
|
2058
|
+
if (token === '--full-output') fullOutput = true
|
|
2059
2059
|
else if (token === '--llms') llms = true
|
|
2060
2060
|
else if (token === '--llms-full') llmsFull = true
|
|
2061
2061
|
else if (token === '--mcp') mcp = true
|
|
@@ -2109,7 +2109,7 @@ function extractBuiltinFlags(argv: string[], options: extractBuiltinFlags.Option
|
|
|
2109
2109
|
}
|
|
2110
2110
|
|
|
2111
2111
|
return {
|
|
2112
|
-
|
|
2112
|
+
fullOutput,
|
|
2113
2113
|
format,
|
|
2114
2114
|
formatExplicit,
|
|
2115
2115
|
configPath,
|
|
@@ -2495,7 +2495,7 @@ async function handleStreaming(
|
|
|
2495
2495
|
formatExplicit: boolean
|
|
2496
2496
|
human: boolean
|
|
2497
2497
|
renderOutput: boolean
|
|
2498
|
-
|
|
2498
|
+
fullOutput: boolean
|
|
2499
2499
|
truncate: (s: string) => { text: string; truncated: boolean; nextOffset?: number | undefined }
|
|
2500
2500
|
write: (output: Output) => void
|
|
2501
2501
|
writeln: (s: string) => void
|
package/src/Help.test.ts
CHANGED
|
@@ -65,13 +65,13 @@ describe('formatCommand', () => {
|
|
|
65
65
|
Global Options:
|
|
66
66
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
67
67
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
68
|
+
--full-output Show full output envelope
|
|
68
69
|
--help Show help
|
|
69
70
|
--llms, --llms-full Print LLM-readable manifest
|
|
70
71
|
--schema Show JSON Schema for command
|
|
71
72
|
--token-count Print token count of output (instead of output)
|
|
72
73
|
--token-limit <n> Limit output to n tokens
|
|
73
|
-
--token-offset <n> Skip first n tokens of output
|
|
74
|
-
--verbose Show full output envelope"
|
|
74
|
+
--token-offset <n> Skip first n tokens of output"
|
|
75
75
|
`)
|
|
76
76
|
})
|
|
77
77
|
|
|
@@ -87,13 +87,13 @@ describe('formatCommand', () => {
|
|
|
87
87
|
Global Options:
|
|
88
88
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
89
89
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
90
|
+
--full-output Show full output envelope
|
|
90
91
|
--help Show help
|
|
91
92
|
--llms, --llms-full Print LLM-readable manifest
|
|
92
93
|
--schema Show JSON Schema for command
|
|
93
94
|
--token-count Print token count of output (instead of output)
|
|
94
95
|
--token-limit <n> Limit output to n tokens
|
|
95
|
-
--token-offset <n> Skip first n tokens of output
|
|
96
|
-
--verbose Show full output envelope"
|
|
96
|
+
--token-offset <n> Skip first n tokens of output"
|
|
97
97
|
`)
|
|
98
98
|
})
|
|
99
99
|
|
|
@@ -116,13 +116,13 @@ describe('formatCommand', () => {
|
|
|
116
116
|
Global Options:
|
|
117
117
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
118
118
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
119
|
+
--full-output Show full output envelope
|
|
119
120
|
--help Show help
|
|
120
121
|
--llms, --llms-full Print LLM-readable manifest
|
|
121
122
|
--schema Show JSON Schema for command
|
|
122
123
|
--token-count Print token count of output (instead of output)
|
|
123
124
|
--token-limit <n> Limit output to n tokens
|
|
124
|
-
--token-offset <n> Skip first n tokens of output
|
|
125
|
-
--verbose Show full output envelope"
|
|
125
|
+
--token-offset <n> Skip first n tokens of output"
|
|
126
126
|
`)
|
|
127
127
|
})
|
|
128
128
|
|
|
@@ -248,14 +248,14 @@ describe('formatCommand', () => {
|
|
|
248
248
|
--config <path> Load JSON option defaults from a file
|
|
249
249
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
250
250
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
251
|
+
--full-output Show full output envelope
|
|
251
252
|
--help Show help
|
|
252
253
|
--llms, --llms-full Print LLM-readable manifest
|
|
253
254
|
--no-config Disable JSON option defaults for this run
|
|
254
255
|
--schema Show JSON Schema for command
|
|
255
256
|
--token-count Print token count of output (instead of output)
|
|
256
257
|
--token-limit <n> Limit output to n tokens
|
|
257
|
-
--token-offset <n> Skip first n tokens of output
|
|
258
|
-
--verbose Show full output envelope"
|
|
258
|
+
--token-offset <n> Skip first n tokens of output"
|
|
259
259
|
`)
|
|
260
260
|
})
|
|
261
261
|
})
|
|
@@ -283,13 +283,13 @@ describe('formatRoot', () => {
|
|
|
283
283
|
Global Options:
|
|
284
284
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
285
285
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
286
|
+
--full-output Show full output envelope
|
|
286
287
|
--help Show help
|
|
287
288
|
--llms, --llms-full Print LLM-readable manifest
|
|
288
289
|
--schema Show JSON Schema for command
|
|
289
290
|
--token-count Print token count of output (instead of output)
|
|
290
291
|
--token-limit <n> Limit output to n tokens
|
|
291
|
-
--token-offset <n> Skip first n tokens of output
|
|
292
|
-
--verbose Show full output envelope"
|
|
292
|
+
--token-offset <n> Skip first n tokens of output"
|
|
293
293
|
`)
|
|
294
294
|
})
|
|
295
295
|
|
|
@@ -308,13 +308,13 @@ describe('formatRoot', () => {
|
|
|
308
308
|
Global Options:
|
|
309
309
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
310
310
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
311
|
+
--full-output Show full output envelope
|
|
311
312
|
--help Show help
|
|
312
313
|
--llms, --llms-full Print LLM-readable manifest
|
|
313
314
|
--schema Show JSON Schema for command
|
|
314
315
|
--token-count Print token count of output (instead of output)
|
|
315
316
|
--token-limit <n> Limit output to n tokens
|
|
316
|
-
--token-offset <n> Skip first n tokens of output
|
|
317
|
-
--verbose Show full output envelope"
|
|
317
|
+
--token-offset <n> Skip first n tokens of output"
|
|
318
318
|
`)
|
|
319
319
|
})
|
|
320
320
|
|
|
@@ -337,13 +337,13 @@ describe('formatRoot', () => {
|
|
|
337
337
|
Global Options:
|
|
338
338
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
339
339
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
340
|
+
--full-output Show full output envelope
|
|
340
341
|
--help Show help
|
|
341
342
|
--llms, --llms-full Print LLM-readable manifest
|
|
342
343
|
--schema Show JSON Schema for command
|
|
343
344
|
--token-count Print token count of output (instead of output)
|
|
344
345
|
--token-limit <n> Limit output to n tokens
|
|
345
|
-
--token-offset <n> Skip first n tokens of output
|
|
346
|
-
--verbose Show full output envelope"
|
|
346
|
+
--token-offset <n> Skip first n tokens of output"
|
|
347
347
|
`)
|
|
348
348
|
})
|
|
349
349
|
|
|
@@ -366,13 +366,13 @@ describe('formatRoot', () => {
|
|
|
366
366
|
Global Options:
|
|
367
367
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
368
368
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
369
|
+
--full-output Show full output envelope
|
|
369
370
|
--help Show help
|
|
370
371
|
--llms, --llms-full Print LLM-readable manifest
|
|
371
372
|
--schema Show JSON Schema for command
|
|
372
373
|
--token-count Print token count of output (instead of output)
|
|
373
374
|
--token-limit <n> Limit output to n tokens
|
|
374
|
-
--token-offset <n> Skip first n tokens of output
|
|
375
|
-
--verbose Show full output envelope"
|
|
375
|
+
--token-offset <n> Skip first n tokens of output"
|
|
376
376
|
`)
|
|
377
377
|
})
|
|
378
378
|
|
|
@@ -399,6 +399,7 @@ describe('formatRoot', () => {
|
|
|
399
399
|
--config <path> Load JSON option defaults from a file
|
|
400
400
|
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
|
401
401
|
--format <toon|json|yaml|md|jsonl> Output format
|
|
402
|
+
--full-output Show full output envelope
|
|
402
403
|
--help Show help
|
|
403
404
|
--llms, --llms-full Print LLM-readable manifest
|
|
404
405
|
--mcp Start as MCP stdio server
|
|
@@ -407,7 +408,6 @@ describe('formatRoot', () => {
|
|
|
407
408
|
--token-count Print token count of output (instead of output)
|
|
408
409
|
--token-limit <n> Limit output to n tokens
|
|
409
410
|
--token-offset <n> Skip first n tokens of output
|
|
410
|
-
--verbose Show full output envelope
|
|
411
411
|
--version Show version"
|
|
412
412
|
`)
|
|
413
413
|
})
|
package/src/Help.ts
CHANGED
|
@@ -380,7 +380,7 @@ function globalOptionsLines(root = false, configFlag?: string): string[] {
|
|
|
380
380
|
{ flag: '--token-count', desc: 'Print token count of output (instead of output)' },
|
|
381
381
|
{ flag: '--token-limit <n>', desc: 'Limit output to n tokens' },
|
|
382
382
|
{ flag: '--token-offset <n>', desc: 'Skip first n tokens of output' },
|
|
383
|
-
{ flag: '--
|
|
383
|
+
{ flag: '--full-output', desc: 'Show full output envelope' },
|
|
384
384
|
...(root ? [{ flag: '--version', desc: 'Show version' }] : []),
|
|
385
385
|
].sort((a, b) => a.flag.localeCompare(b.flag))
|
|
386
386
|
const maxLen = Math.max(...flags.map((f) => f.flag.length))
|