unbound-cli 1.26.2 → 1.26.3

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
@@ -339,11 +339,11 @@ Needs Admin or Analytics Viewer over the whole organization (a token needs `anal
339
339
  | Command | Description |
340
340
  |---------|-------------|
341
341
  | `unbound delivery summary` | AI branches, PRs opened and merged, merge rate, AI spend, cost per PR and time to first PR |
342
- | `unbound delivery branches` | AI branches with their PR, ticket, work group, users and cost (`--outcome`, `--ticket-status`, `--work-group`, `--search`, `--sort first_seen\|cost`) |
342
+ | `unbound delivery branches` | AI branches with their PR, ticket, work group, users and cost (`--outcome`, `--ticket-status`, `--work-group`, `--search`, `--sort first-seen\|cost`) |
343
343
  | `unbound delivery branch <id>` | One branch with its PR and ticket links, timeline and sessions |
344
- | `unbound delivery users` | AI spend, PRs raised and merged per person (`--sort ai_spend`, `merge_rate_pct`, ...) |
344
+ | `unbound delivery users` | AI spend, PRs raised and merged per person (`--sort ai-spend`, `merge-rate-pct`, ...) |
345
345
  | `unbound delivery teams` | The same per department, with active AI users and share of branches with a ticket |
346
- | `unbound delivery spend --by outcome\|work-group` | AI spend by PR outcome, or by work group (`--pr-state all\|merged\|open\|no_pr`) |
346
+ | `unbound delivery spend --by outcome\|work-group` | AI spend by PR outcome, or by work group (`--pr-state all\|merged\|open\|no-pr`) |
347
347
  | `unbound delivery repos` | Repositories with AI work in the window, the values `--repo` takes |
348
348
 
349
349
  Every command except `branch` takes `--time-window ONE_DAY|THREE_DAYS|SEVEN_DAYS|FOURTEEN_DAYS|THIRTY_DAYS` (default `THIRTY_DAYS`) or `--start/--end YYYY-MM-DD` (max 31 days, within the last 31 days). `summary`, `branches`, `users`, `teams` and `spend` also filter by `--user` (user IDs, not emails), `--team`, `--manager`, `--tool` and `--repo`. `--json` prints the raw response.
@@ -352,7 +352,7 @@ Every command except `branch` takes `--time-window ONE_DAY|THREE_DAYS|SEVEN_DAYS
352
352
  unbound delivery summary --time-window SEVEN_DAYS
353
353
  unbound delivery branches --outcome merged --json | jq '.results[] | {name, pr: .pr.number, cost}'
354
354
  unbound delivery branch 4821
355
- unbound delivery users --sort merge_rate_pct --team Platform
355
+ unbound delivery users --sort merge-rate-pct --team Platform
356
356
  unbound delivery spend --by work-group --pr-state merged
357
357
  ```
358
358
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unbound-cli",
3
- "version": "1.26.2",
3
+ "version": "1.26.3",
4
4
  "description": "CLI tool for Unbound - AI Gateway management",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -88,11 +88,19 @@ function normalizeChoice(value) {
88
88
  return String(value).trim().toLowerCase().replace(/-/g, '_');
89
89
  }
90
90
 
91
+ function dashed(choice) {
92
+ return String(choice).replace(/_/g, '-');
93
+ }
94
+
95
+ function listChoices(choices, separator = ', ') {
96
+ return choices.map(dashed).join(separator);
97
+ }
98
+
91
99
  function parseChoice(flag, value, choices) {
92
100
  if (value === undefined) return undefined;
93
101
  const choice = normalizeChoice(value);
94
102
  if (!choices.includes(choice)) {
95
- throw new Error(`Invalid ${flag} "${value}". Must be one of: ${choices.join(', ')}.`);
103
+ throw new Error(`Invalid ${flag} "${value}". Must be one of: ${listChoices(choices)}.`);
96
104
  }
97
105
  return choice;
98
106
  }
@@ -380,7 +388,7 @@ function peopleColumn(key) {
380
388
  function warnSortFallback(data, requestedSort) {
381
389
  if (!requestedSort || !data.sort_by || data.sort_by === requestedSort) return;
382
390
  const reason = data.github ? 'is shown only when GitHub is not connected' : 'needs GitHub connected';
383
- output.warn(`Sorted by ${safe(data.sort_by)}: ${requestedSort} ${reason}.`);
391
+ output.warn(`Sorted by ${dashed(safe(data.sort_by))}: ${dashed(requestedSort)} ${reason}.`);
384
392
  }
385
393
 
386
394
  async function listPeople(noun, opts) {
@@ -471,10 +479,10 @@ function addFilterOptions(command) {
471
479
 
472
480
  function addTableOptions(command, sortChoices, defaultSort) {
473
481
  return command
474
- .option('--ticket-status <statuses>', `Ticket status, comma-separated: ${TICKET_STATUSES.join(', ')}`)
475
- .option('--work-group <groups>', `Work group, comma-separated: ${WORK_GROUPS.join(', ')}`)
482
+ .option('--ticket-status <statuses>', `Ticket status, comma-separated: ${listChoices(TICKET_STATUSES)}`)
483
+ .option('--work-group <groups>', `Work group, comma-separated: ${listChoices(WORK_GROUPS)}`)
476
484
  .option('--search <text>', 'Search text')
477
- .option('--sort <column>', `${sortChoices.join(' | ')} (default ${defaultSort})`)
485
+ .option('--sort <column>', `${listChoices(sortChoices, ' | ')} (default ${dashed(defaultSort)})`)
478
486
  .option('--order <order>', 'desc | asc (default desc)')
479
487
  .option('--page <n>', 'Page number')
480
488
  .option('--page-size <n>', `Rows per page, up to ${MAX_PAGE_SIZE} (default 10)`)
@@ -492,7 +500,7 @@ Examples:
492
500
  $ unbound delivery branches --outcome merged --sort cost
493
501
  $ unbound delivery branches --outcome merged --json | jq '.results[] | {name, pr: .pr.number, cost}'
494
502
  $ unbound delivery branch 4821
495
- $ unbound delivery users --sort merge_rate_pct --team Platform
503
+ $ unbound delivery users --sort merge-rate-pct --team Platform
496
504
  $ unbound delivery spend --by work-group --pr-state merged
497
505
 
498
506
  A PR appears only when an agent's own tool call created it.
@@ -511,10 +519,10 @@ Admin or Analytics Viewer (whole organization).
511
519
  addTableOptions(addFilterOptions(delivery
512
520
  .command('branches')
513
521
  .description('List AI branches created in the window.')
514
- .option('--outcome <outcome>', `PR outcome: ${OUTCOMES.join(', ')}`)), BRANCH_SORTS, 'first_seen')
522
+ .option('--outcome <outcome>', `PR outcome: ${listChoices(OUTCOMES)}`)), BRANCH_SORTS, 'first_seen')
515
523
  .addHelpText('after', `${WINDOW_HELP}${FILTER_HELP}
516
524
  Examples:
517
- $ unbound delivery branches --outcome no_pr --sort cost
525
+ $ unbound delivery branches --outcome no-pr --sort cost
518
526
  $ unbound delivery branches --ticket-status done --work-group fix
519
527
  $ unbound delivery branches --repo acme/web --page 2 --json
520
528
 
@@ -545,7 +553,7 @@ With --work-group, branches are windowed by PR time (merged, else opened) instea
545
553
  .command('spend')
546
554
  .description('Show AI spend by PR outcome or by work group.')
547
555
  .option('--by <dimension>', 'outcome | work-group (default outcome)')
548
- .option('--pr-state <state>', `With --by work-group: ${PR_STATES.join(', ')} (default all)`)
556
+ .option('--pr-state <state>', `With --by work-group: ${listChoices(PR_STATES)} (default all)`)
549
557
  .option('--json', 'Output the raw JSON response'))
550
558
  .addHelpText('after', `${WINDOW_HELP}${FILTER_HELP}
551
559
  Examples:
@@ -381,7 +381,7 @@ test('branch detail says when only the newest 100 sessions are shown', async ()
381
381
 
382
382
  test('users and teams send sort, page and ticket filters and print the columns the server lists', async () => {
383
383
  await withBackend(async ({ seen, run }) => {
384
- const users = await run(['delivery', 'users', '--sort', 'merge_rate_pct', '--page', '2', '--ticket-status', 'todo',
384
+ const users = await run(['delivery', 'users', '--sort', 'merge-rate-pct', '--page', '2', '--ticket-status', 'todo',
385
385
  '--work-group', 'fix', '--team', 'Platform']);
386
386
  assert.equal(users.code, 0, users.stderr);
387
387
  assert.equal(seen[0].path, `${BASE}/users/`);
@@ -434,7 +434,7 @@ test('users and teams warn when the server sorted by another column', async () =
434
434
  await withBackend(async ({ run }) => {
435
435
  const r = await run(['delivery', 'teams', '--sort', 'merge_rate_pct']);
436
436
  assert.equal(r.code, 0, r.stderr);
437
- assert.match(r.stderr, /Sorted by ai_spend: merge_rate_pct needs GitHub connected\./);
437
+ assert.match(r.stderr, /Sorted by ai-spend: merge-rate-pct needs GitHub connected\./);
438
438
  const asked = await run(['delivery', 'teams', '--sort', 'ai_spend']);
439
439
  assert.doesNotMatch(asked.stderr, /Sorted by/);
440
440
  const unsorted = await run(['delivery', 'teams']);
@@ -510,6 +510,9 @@ test('bad input fails before any request is sent', async () => {
510
510
  [['delivery', 'users', '--sort', 'name'], /Invalid --sort "name"/],
511
511
  [['delivery', 'users', '--sort', 'active_ai_users'], /Invalid --sort "active_ai_users"/],
512
512
  [['delivery', 'teams', '--sort', 'last_active'], /Invalid --sort "last_active"/],
513
+ [['delivery', 'teams', '--sort', 'last-active'],
514
+ /Must be one of: active-ai-users, ai-branches, prs-raised, prs-merged, merge-rate-pct, ai-spend, cost-per-merged-pr,/],
515
+ [['delivery', 'branches', '--outcome', 'open'], /Must be one of: merged, in-review, closed, no-pr, pr-raised\./],
513
516
  [['delivery', 'teams', '--order', 'up'], /Invalid --order "up"/],
514
517
  [['delivery', 'branch', 'abc'], /Invalid branch ID "abc"/],
515
518
  [['delivery', 'spend', '--by', 'tool'], /Invalid --by "tool"/],