burgee 0.13.0 → 0.13.2

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 CHANGED
@@ -20,7 +20,8 @@
20
20
  </p>
21
21
 
22
22
  <p align="center">
23
- Docs: <a href="https://burgee.interlace.tools/docs/packages/burgee">https://burgee.interlace.tools/docs/packages/burgee</a>
23
+ Docs: <a href="https://burgee.interlace.tools/docs/packages/burgee">https://burgee.interlace.tools/docs/packages/burgee</a><br />
24
+ Migrating from: <a href="https://burgee.interlace.tools/docs/vs/commander">commander</a> · <a href="https://burgee.interlace.tools/docs/vs/yargs">yargs</a>
24
25
  </p>
25
26
 
26
27
  A **burgee** is the small swallowtail flag a boat flies to say which club or fleet it
package/dist/brand.js CHANGED
@@ -75,9 +75,9 @@ export function chargeRotation() {
75
75
  export function placeCharge(markup, scale = CHARGE.scale) {
76
76
  return `<g transform="${chargeTransform(scale)}">${markup}</g>`;
77
77
  }
78
+ const bar = (at, fill) => `<rect x="${at.x}" y="${at.y}" width="${BAR.width}" height="${BAR.height}"` +
79
+ ` rx="${BAR.radius}" fill="${fill}"/>`;
78
80
  export function chargeGroup(colors, scale = CHARGE.scale) {
79
- const bar = (at, fill) => `<rect x="${at.x}" y="${at.y}" width="${BAR.width}" height="${BAR.height}"` +
80
- ` rx="${BAR.radius}" fill="${fill}"/>`;
81
81
  return (`<g transform="${chargeTransform(scale)}">` +
82
82
  `<g transform="${chargeRotation()}">` +
83
83
  `${bar(LEAD_BAR, colors.lead)}${bar(FOLLOW_BAR, colors.follow)}</g></g>`);
@@ -727,7 +727,7 @@ Expecting one of '${HOOK_EVENTS.join("', '")}'`);
727
727
  if (arg.required && this.args[i] == null)
728
728
  this.missingArgument(arg.name());
729
729
  });
730
- const last = this.registeredArguments[this.registeredArguments.length - 1];
730
+ const last = this.registeredArguments.at(-1);
731
731
  if (this.registeredArguments.length > 0 && last?.variadic)
732
732
  return;
733
733
  if (this.args.length > this.registeredArguments.length)
@@ -1193,7 +1193,7 @@ Expecting one of '${HOOK_EVENTS.join("', '")}'`);
1193
1193
  if (alias === undefined)
1194
1194
  return this._aliases[0];
1195
1195
  let command = this;
1196
- const last = this.commands[this.commands.length - 1];
1196
+ const last = this.commands.at(-1);
1197
1197
  if (this.commands.length !== 0 && last?._executableHandler) {
1198
1198
  command = last;
1199
1199
  }
@@ -54,7 +54,7 @@ const promise = (program, root) => walk(root).some((n) => Object.values(n.option
54
54
  const fname = (program, path) => `_${[program, ...path].join('_').replaceAll(/[^A-Za-z0-9_]/g, '_')}`;
55
55
  function bashCase(program, node) {
56
56
  const opts = Object.entries(node.options).flatMap(([n, s]) => flags(n, s));
57
- const subs = node.children.map((c) => c.path[c.path.length - 1] ?? '');
57
+ const subs = node.children.map((c) => c.path.at(-1) ?? '');
58
58
  const valued = Object.entries(node.options)
59
59
  .filter(([, s]) => takesValue(s))
60
60
  .map(([n, s]) => isDynamic(s)
@@ -114,8 +114,8 @@ function zshFunction(program, node) {
114
114
  if (node.children.length === 0) {
115
115
  return `${fname(program, node.path)}() {\n _arguments -s ${options.join(' ')} '*: :_files'\n}`;
116
116
  }
117
- const subs = node.children.map((c) => sq(`${c.path[c.path.length - 1] ?? ''}[${c.description.replaceAll(/[[\]:]/g, ' ')}]`)).join(' ');
118
- const dispatch = node.children.map((c) => ` ${c.path[c.path.length - 1] ?? ''}) ${fname(program, c.path)} ;;`).join('\n');
117
+ const subs = node.children.map((c) => sq(`${c.path.at(-1) ?? ''}[${c.description.replaceAll(/[[\]:]/g, ' ')}]`)).join(' ');
118
+ const dispatch = node.children.map((c) => ` ${c.path.at(-1) ?? ''}) ${fname(program, c.path)} ;;`).join('\n');
119
119
  return `${fname(program, node.path)}() {
120
120
  local context state state_descr line
121
121
  typeset -A opt_args
@@ -153,7 +153,7 @@ function fish(program, root) {
153
153
  for (const node of walk(root)) {
154
154
  const cond = sq(fishCondition(node));
155
155
  for (const c of node.children)
156
- lines.push(`complete -c ${program} -n ${cond} -f -a ${c.path[c.path.length - 1] ?? ''} -d ${sq(c.description)}`);
156
+ lines.push(`complete -c ${program} -n ${cond} -f -a ${c.path.at(-1) ?? ''} -d ${sq(c.description)}`);
157
157
  for (const [name, spec] of Object.entries(node.options)) {
158
158
  lines.push(fishOption({ program, cond, node }, kebab(name), spec));
159
159
  if (spec.negatable === true) {
@@ -168,7 +168,7 @@ ${lines.join('\n')}
168
168
  `;
169
169
  }
170
170
  function pwshEntry(node) {
171
- const subs = node.children.map((c) => `@('${c.path[c.path.length - 1] ?? ''}', 'Command', '${c.description.replaceAll("'", "''")}')`);
171
+ const subs = node.children.map((c) => `@('${c.path.at(-1) ?? ''}', 'Command', '${c.description.replaceAll("'", "''")}')`);
172
172
  const opts = Object.entries(node.options).flatMap(([n, s]) => flags(n, s).map((f) => `@('${f}', 'ParameterName', '${(s.description ?? '').replaceAll("'", "''")}')`));
173
173
  const values = Object.entries(node.options)
174
174
  .filter(([, s]) => s.choices !== undefined)
@@ -230,7 +230,7 @@ export function renderFigSpec(manifest) {
230
230
  const { program, root } = completionTree(manifest);
231
231
  const entries = new Map();
232
232
  for (const node of walk(root)) {
233
- const entry = { name: node.path[node.path.length - 1] ?? program, options: figOptions(node) };
233
+ const entry = { name: node.path.at(-1) ?? program, options: figOptions(node) };
234
234
  if (node.description !== '')
235
235
  entry.description = node.description;
236
236
  entries.set(node.path.join(' '), entry);
package/dist/help.js CHANGED
@@ -96,7 +96,7 @@ function commandSections(manifest, node) {
96
96
  for (const c of children) {
97
97
  const heading = c.group ?? 'Commands:';
98
98
  const rows = groups.get(heading) ?? [];
99
- rows.push({ term: c.path[c.path.length - 1] ?? '', text: `${c.summary ?? c.description ?? ''}${deprecation(c.deprecated)}`.trim(), kind: 'command' });
99
+ rows.push({ term: c.path.at(-1) ?? '', text: `${c.summary ?? c.description ?? ''}${deprecation(c.deprecated)}`.trim(), kind: 'command' });
100
100
  groups.set(heading, rows);
101
101
  }
102
102
  return [...groups].map(([title, rows]) => ({ title, rows }));
@@ -56,7 +56,7 @@ export class UI {
56
56
  width: i === 0 && columns.length > 1 ? leftColumnWidth : undefined,
57
57
  })));
58
58
  });
59
- return this.rows[this.rows.length - 1];
59
+ return this.rows.at(-1);
60
60
  }
61
61
  colFromString(text) {
62
62
  return { text, padding: this.measurePadding(text) };
@@ -743,7 +743,7 @@ export class YargsInstance {
743
743
  return false;
744
744
  return supportedOpts.includes(k);
745
745
  });
746
- const fullCommand = this.#context.fullCommands[this.#context.fullCommands.length - 1];
746
+ const fullCommand = this.#context.fullCommands.at(-1);
747
747
  const parseOptions = fullCommand ? this.#command.cmdToParseOptions(fullCommand) : { array: [], alias: {}, default: {}, demand: {} };
748
748
  objectKeys(parseOptions).forEach((pk) => {
749
749
  const parseOption = parseOptions[pk];
@@ -1515,7 +1515,7 @@ export class YargsInstance {
1515
1515
  return this.#postProcess(argv, populateDoubleDash, !!calledFromCommand, false);
1516
1516
  if (this.#helpOpt) {
1517
1517
  const helpCmds = [this.#helpOpt].concat(aliases[this.#helpOpt] || []).filter((k) => k.length > 1);
1518
- if (helpCmds.includes(`${argv._[argv._.length - 1]}`)) {
1518
+ if (helpCmds.includes(`${argv._.at(-1)}`)) {
1519
1519
  argv._.pop();
1520
1520
  helpOptSet = true;
1521
1521
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "burgee",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
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",
@@ -147,11 +147,11 @@
147
147
  "provenance": true
148
148
  },
149
149
  "dependencies": {
150
- "bellpull": "^0.4.1",
151
- "closeout": "^0.5.2",
152
- "linegauge": "^0.5.3",
153
- "roundel": "^0.5.2",
154
- "seniority": "^0.6.1"
150
+ "bellpull": "^0.4.2",
151
+ "closeout": "^0.5.4",
152
+ "linegauge": "^0.5.4",
153
+ "roundel": "^0.5.4",
154
+ "seniority": "^0.6.3"
155
155
  },
156
156
  "devDependencies": {
157
157
  "vitest": "^5.0.1"