burgee 0.13.2 → 0.14.0

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/argv.js CHANGED
@@ -8,5 +8,5 @@ export function isJsonFlag(arg) {
8
8
  export function mayServe(argv) {
9
9
  const head = beforeTerminator(argv);
10
10
  const first = argv[0];
11
- return first === '__complete' || first === 'completion' || first === 'help' || head[0] === '--mcp' || (head[0] === 'config' && head[1] === 'explain') || head.includes('--schema');
11
+ return first === '__complete' || first === 'completion' || first === 'help' || first === 'schema' || head[0] === '--mcp' || (head[0] === 'config' && head[1] === 'explain') || head.includes('--schema');
12
12
  }
package/dist/help.js CHANGED
@@ -39,6 +39,7 @@ const GLOBAL = [
39
39
  { term: '--json', text: 'machine-readable output', kind: 'flag' },
40
40
  { term: '--help', text: 'show this help', kind: 'flag' },
41
41
  ];
42
+ const ROOT_GLOBAL = [...GLOBAL, { term: '--schema', text: 'the program as data', kind: 'flag' }];
42
43
  function deprecation(d) {
43
44
  if (d === undefined || d === false)
44
45
  return '';
@@ -194,13 +195,14 @@ export function renderHelp(manifest, node, opts = {}) {
194
195
  const args = argumentRows(node.arguments ?? []);
195
196
  const options = optionRows(node.options, verbose);
196
197
  const env = environmentRows(node.options);
197
- const column = termColumn([...args, ...options, ...GLOBAL, ...commands.flatMap((s) => s.rows), ...env], width);
198
+ const global = node.path.length === root.length ? ROOT_GLOBAL : GLOBAL;
199
+ const column = termColumn([...args, ...options, ...global, ...commands.flatMap((s) => s.rows), ...env], width);
198
200
  const lines = [usageLine(node, root, commands.length > 0, paint), ''];
199
201
  if (node.description !== undefined)
200
202
  lines.push(...wrap(`${node.description}${deprecation(node.deprecated)}`, width), '');
201
203
  lines.push(...section('Arguments:', layout(args, width, column, paint), paint));
202
204
  lines.push(...section('Options:', layout(options, width, column, paint), paint));
203
- lines.push(...section('Global options:', layout(GLOBAL, width, column, paint), paint));
205
+ lines.push(...section('Global options:', layout(global, width, column, paint), paint));
204
206
  for (const s of commands)
205
207
  lines.push(...section(s.title, layout(s.rows, width, column, paint), paint));
206
208
  lines.push(...section('Examples:', exampleLines(node.examples ?? [], width), paint));
package/dist/surfaces.js CHANGED
@@ -69,6 +69,13 @@ async function helpCommand(manifest, argv, root, io) {
69
69
  const { node } = manifest.resolve(argv, root);
70
70
  return renderHelp(manifest, node ?? rootNode(manifest, root), io);
71
71
  }
72
+ function schemaAlias(manifest, argv) {
73
+ const top = manifest.find(manifest.rootPath);
74
+ const takesWords = (top?.run ?? top?.load) !== undefined && (top?.arguments?.length ?? 0) > 0;
75
+ if (argv[0] !== 'schema' || takesWords || manifest.find([...manifest.rootPath, 'schema']) !== undefined)
76
+ return undefined;
77
+ return ['--schema', ...argv.slice(1)];
78
+ }
72
79
  export async function serve(manifest, argv, io, engine) {
73
80
  const head = beforeTerminator(argv);
74
81
  if (argv[0] === '__complete') {
@@ -87,9 +94,11 @@ export async function serve(manifest, argv, io, engine) {
87
94
  io.out.write(await helpCommand(manifest, argv.slice(1), manifest.rootPath, io));
88
95
  return true;
89
96
  }
90
- if (head.includes('--schema')) {
97
+ const asked = schemaAlias(manifest, argv) ?? argv;
98
+ const askedHead = beforeTerminator(asked);
99
+ if (askedHead.includes('--schema')) {
91
100
  const { schemaSurface } = await import('./schema-surface.js');
92
- io.out.write(`${await machineJson(await schemaSurface(manifest, argv), head)}\n`);
101
+ io.out.write(`${await machineJson(await schemaSurface(manifest, asked), askedHead)}\n`);
93
102
  return true;
94
103
  }
95
104
  if (head[0] === '--mcp') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "burgee",
3
- "version": "0.13.2",
3
+ "version": "0.14.0",
4
4
  "description": "An agent-native CLI framework, drop-in compatible with commander and yargs. One declaration; help, --json, --schema, --mcp and completions all projected from it.",
5
5
  "license": "MIT",
6
6
  "type": "module",