@go-labs-sg/bb 2.46.0 → 2.47.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.
Files changed (3) hide show
  1. package/README.md +27 -9
  2. package/dist/index.js +16 -6
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,10 +1,22 @@
1
1
  # bb
2
2
 
3
- Command-line interface for **Budget Builder**. Call budgets, bills, claims, approvals, suppliers, dashboard, and more from your terminal or from tools that don’t support MCP (e.g. some AI agents). Responses are JSON on stdout.
3
+ Command-line interface for **Budget Builder**. Call budgets, bills, claims, approvals, suppliers, dashboard, and more from your terminal or from AI agents and automation. The CLI is the maintained integration surface; the former MCP server is deprecated. Responses are JSON on stdout.
4
4
 
5
- For AI agents: bills and claims are stored as the same underlying bill records. Use the `isClaimable` column/flag to distinguish them: `isClaimable=false` means a normal bill, while `isClaimable=true` means a reimbursable claim.
5
+ ## First step: update before use
6
+
7
+ Before starting a task, **update to the latest published release first**, including when an AI agent runs this CLI:
8
+
9
+ ```bash
10
+ bun add --global @go-labs-sg/bb@latest
11
+ bb version
12
+ bb --help
13
+ ```
6
14
 
7
- For AI agents using this CLI: always check whether a newer `@go-labs-sg/bb` version is available before running Budget Builder commands, then update the CLI if needed so command flags and API behavior stay current.
15
+ Run this sequence once per task, not before every command. Re-read the updated help before choosing commands or flags. If updating fails, stop and report the failure rather than silently using an outdated CLI. If the user explicitly requested a pinned version or a development/staging build, preserve that version instead of replacing it with the public release.
16
+
17
+ New installation? Follow the runtime and installation instructions below to install Bun first, then return to this step.
18
+
19
+ For AI agents: bills and claims are stored as the same underlying bill records. Use the `isClaimable` column/flag to distinguish them: `isClaimable=false` means a normal bill, while `isClaimable=true` means a reimbursable claim.
8
20
 
9
21
  For AI agents using this CLI: run `bb auth whoami` before reading or changing Budget Builder data. The CLI displays every command regardless of the authenticated user's role, but the API authorizes each request using the current browser-authorized CLI user or automation API-key owner, resource ownership or project assignment, current workflow state, and approval assignment. See the [role-aware agent guide](./role-aware-agent-guide.md) before choosing commands.
10
22
 
@@ -14,11 +26,17 @@ For AI agents using this CLI: do not execute mutations until the user explicitly
14
26
 
15
27
  ## Bill and claim list summaries
16
28
 
17
- `bb bill list` / `bb claim list` (legacy `list-bills` / `list-claims`) now use `bill.getList`. Lists return summary fields, `isClaimable`, `lineItemCount` and `hasPendingApproval`, plus the existing pagination, counts and metrics envelope. Filters and sorting are unchanged. They no longer return attachment, detailed line-item or approval arrays, full supplier/budget/project/company records, or detail-only payment/integration/verification metadata.
29
+ `bb bill list` / `bb claim list` (legacy `list-bills` / `list-claims`) use the updated summary-only `bill.getAll`. Lists return summary fields, `isClaimable`, `lineItemCount` and `hasPendingApproval`, plus the existing pagination, counts and metrics envelope. Filters, sorting and the CLI's existing summary output are unchanged. Lists do not return attachment, detailed line-item or approval arrays, full supplier/budget/project/company records, or detail-only payment/integration/verification metadata.
30
+
31
+ **Breaking API migration:** `bill.getList` is removed completely, with no alias or fallback. Direct scripts reading the former rich `bill.getAll` response must adopt summaries and fetch selected bill/claim details with `bb get-bill-details <billId>`. Do not fetch details for every list row unless the task actually needs them. No rich-list flag or automatic detail expansion is added.
32
+
33
+ Coordinate the matching API/web deployment and CLI release/installations. MCP is deprecated and is not a rollout or acceptance gate. Published CLI builds still calling `getList` receive `NOT_FOUND` after API rollout, so a mixed-revision deployment is not compatible. Update those installations to the matching CLI release. Budget-list options are unchanged. This source change does not publish the CLI or deploy the API.
34
+
35
+ ## Inventory list reads
18
36
 
19
- **Output migration:** scripts reading those removed fields must fetch the selected bill/claim with `bb get-bill-details <billId>`. Do not fetch details for every list row unless the task actually needs them. No rich-list flag or automatic detail expansion is added. Older clients can still call the existing `bill.getAll` API.
37
+ `bb item list` / `bb list-items` now use the updated page-only `item.getItems` and separate `item.getItemCounts`. The JSON output remains `{ items, pageCount, counts }`; filters and pagination are unchanged. Neither request carries an acting-user cache ID. The server authenticates the CLI session or API-key owner as usual.
20
38
 
21
- Deploy the API containing `bill.getList` before publishing this CLI; there is no automatic fallback to the old rich list. Budget-list options are unchanged by this bill/claim migration.
39
+ The existing `item.getItems` API is updated in place: it now returns an array rather than `{ items, pageCount, counts }`. There is no separate `getItemPage` procedure. Coordinate the API/web deployment and CLI release/installations: old clients expecting the combined response must be upgraded, and new clients require the revised response and separate counts. Direct integrations should fetch counts only when needed. This PR does not publish the CLI or deploy the API.
22
40
 
23
41
  ## Company discovery and reuse
24
42
 
@@ -165,7 +183,7 @@ The per-user lock directory contains only random ownership markers used to seria
165
183
  login, refresh, and logout. macOS/Linux enforce owner-only POSIX permissions there;
166
184
  Windows uses its native filesystem access controls rather than POSIX mode checks.
167
185
 
168
- Budget Builder API keys remain supported for MCP, CI, and non-interactive
186
+ Budget Builder API keys remain supported for CI and non-interactive CLI
169
187
  automation. When `BB_API_KEY` is present it takes precedence over the interactive
170
188
  session for that process. Create and manage automation keys under **API Keys** or
171
189
  with the commands below:
@@ -276,7 +294,7 @@ Global options and command flags use `--key=value` or `--key value`. Run `bb hel
276
294
 
277
295
  Run `bb version` before agent-driven work to record the installed package version and production API target. This is read-only and does not require authentication.
278
296
 
279
- **Authoritative command list:** run `bb help` or inspect the generated `command-reference.md` / `command-manifest.json`. The catalog includes every canonical route, global option, and effect classification, but does not filter by the current `whoami` role. During the handler migration, command-specific arguments retain the compatibility dispatcher's validation and are explicitly marked `legacy-passthrough` in the manifest; use `bb help --legacy` for their detailed transition reference. Version 2 uses grouped, resource-first commands such as `bb budget list` and `bb bill attachment upload`. Flat commands such as `bb list-budgets` and their MCP-style `snake_case` aliases remain available during the v2 transition, with a deprecation notice and an equivalent grouped command in help. MCP exposes a subset of the same tRPC surface; the CLI additionally includes a few procedures mainly used by the web UI.
297
+ **Authoritative command list:** run `bb help` or inspect the generated `command-reference.md` / `command-manifest.json`. The catalog includes every canonical route, global option, and effect classification, but does not filter by the current `whoami` role. During the handler migration, command-specific arguments retain the compatibility dispatcher's validation and are explicitly marked `legacy-passthrough` in the manifest; use `bb help --legacy` for their detailed transition reference. Version 2 uses grouped, resource-first commands such as `bb budget list` and `bb bill attachment upload`. Flat commands such as `bb list-budgets` and their legacy `snake_case` aliases remain available during the v2 transition, with a deprecation notice and an equivalent grouped command in help. The CLI calls the shared tRPC API, including procedures also used by the web UI.
280
298
 
281
299
  **Budget status automation:** Setting a budget to `ESTIMATE_ACCEPTED` requires a confirmed win-proof attachment. `--invoiceSettings '<json>'` remains available when the project needs saved delivery preferences, but invoice creation chooses its amount independently from those settings. If the parent project is `PITCH` or `LOST`, the API marks it `WON` automatically and runs enabled Asana automation. When rejecting the only accepted/closed budget on a commercial project, pass `--projectStatusOnCommercialRejection PITCH|LOST`.
282
300
 
@@ -483,7 +501,7 @@ bb budget version list <budgetId> --all
483
501
  - `--all` explicitly collects all visible history through sequential bounded requests. It cannot be combined with `--cursor`; `--limit` controls each request's size. It can still be expensive and retains the complete result in memory. A failed page aborts without emitting a successful partial export.
484
502
  - Pages preserve newest-first `createdAt`/`id` ordering, role visibility, and creator/version-group metadata. They are not a point-in-time database snapshot; versions added after traversal starts require a fresh first-page read, and concurrent changes to visibility can affect traversal.
485
503
 
486
- The backend must expose `budgetVersion.getBudgetVersionsPage`. The legacy unbounded tRPC `getBudgetVersions` remains available but deprecated for external compatibility; unknown external clients are not silently capped. Removing that endpoint requires a separate usage/compatibility review. This change does not publish the CLI, deploy the backend/MCP server, delete audit snapshots, or establish measured RU savings.
504
+ The backend must expose `budgetVersion.getBudgetVersionsPage`. The legacy unbounded tRPC `getBudgetVersions` remains available but deprecated for external compatibility; unknown external clients are not silently capped. Removing that endpoint requires a separate usage/compatibility review. This change does not publish the CLI, deploy the backend, delete audit snapshots, or establish measured RU savings.
487
505
 
488
506
  ### Link an existing QuickBooks invoice
489
507
 
package/dist/index.js CHANGED
@@ -9024,7 +9024,7 @@ async function listBills(opts) {
9024
9024
  page: opts.page ?? 1,
9025
9025
  pageSize: opts.pageSize ?? 20
9026
9026
  };
9027
- const result = await api2.bill.getList.query(input);
9027
+ const result = await api2.bill.getAll.query(input);
9028
9028
  out(result);
9029
9029
  }
9030
9030
  async function approveBill(billId, overBudgetOverrideReason) {
@@ -10611,13 +10611,16 @@ async function listContacts(companyId) {
10611
10611
  out(contacts);
10612
10612
  }
10613
10613
  async function listItems(opts) {
10614
- const result = await api2.item.getItems.query({
10614
+ const filters = {
10615
10615
  includeQuickBooksDeactivationPending: opts.includeQuickBooksDeactivationPending,
10616
- page: opts.page ?? 1,
10617
- perPage: opts.perPage ?? 20,
10618
10616
  name: opts.name
10619
- });
10620
- out(result);
10617
+ };
10618
+ const perPage = opts.perPage ?? 20;
10619
+ const [items, { total, counts }] = await Promise.all([
10620
+ api2.item.getItems.query({ ...filters, page: opts.page ?? 1, perPage }),
10621
+ api2.item.getItemCounts.query(filters)
10622
+ ]);
10623
+ out({ items, pageCount: Math.ceil(total / perPage), counts });
10621
10624
  }
10622
10625
  async function getItem(id) {
10623
10626
  const item = await api2.item.getItem.query({ id });
@@ -11801,9 +11804,12 @@ var resolveCommand = (argv) => {
11801
11804
  isLegacyAlias: true
11802
11805
  };
11803
11806
  };
11807
+ var updateBeforeUse = "First step before each task: update to the latest published release with 'bun add --global @go-labs-sg/bb@latest', then run 'bb version' and 'bb --help' before using commands. Update once per task. If updating fails, stop and report it. Preserve an explicitly requested pinned or development/staging version.";
11804
11808
  var createHumanHelp = (command) => {
11805
11809
  if (command) {
11806
11810
  return [
11811
+ updateBeforeUse,
11812
+ "",
11807
11813
  `Usage: bb ${command.path.join(" ")} [options] [args]`,
11808
11814
  "",
11809
11815
  command.summary,
@@ -11828,6 +11834,8 @@ var createHumanHelp = (command) => {
11828
11834
  return [
11829
11835
  "bb \u2014 Budget Builder CLI",
11830
11836
  "",
11837
+ updateBeforeUse,
11838
+ "",
11831
11839
  "Usage: bb <resource> <operation> [options] [args]",
11832
11840
  "",
11833
11841
  "Global options",
@@ -12023,6 +12031,8 @@ function printLegacyHelp(runtime) {
12023
12031
  const help = `
12024
12032
  bb \u2014 Budget Builder CLI for AI agents (parity with MCP tools)
12025
12033
 
12034
+ First step before each task: update to the latest published release with 'bun add --global @go-labs-sg/bb@latest', then run 'bb version' and 'bb --help' before using commands. Update once per task. If updating fails, stop and report it. Preserve an explicitly requested pinned or development/staging version.
12035
+
12026
12036
  Usage: bb <command> [options] [args]
12027
12037
 
12028
12038
  Identity: bb version \u2014 print the installed CLI package version and API target as JSON.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-labs-sg/bb",
3
- "version": "2.46.0",
3
+ "version": "2.47.0",
4
4
  "description": "Budget Builder CLI for AI agents — manage budgets, bills, claims, quotations, and customer invoices with explicit workflow previews for sensitive changes.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",