@go-labs-sg/bb 1.1.0 → 1.1.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 CHANGED
@@ -1,12 +1,12 @@
1
1
  # bb
2
2
 
3
- Command-line interface for **Budget Builder**. Call budgets, bills, approvals, and suppliers 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, 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.
4
4
 
5
5
  **Registry:** [`@go-labs-sg/bb`](https://www.npmjs.com/package/@go-labs-sg/bb)
6
6
 
7
7
  ## Requirements
8
8
 
9
- - **Node.js** 18+
9
+ - **Node.js** 18+ (ESM; relative imports in `dist` use `.js` extensions)
10
10
  - A **Budget Builder API key** (same key used for the MCP server)
11
11
 
12
12
  ## Install
@@ -48,18 +48,21 @@ bb list-suppliers
48
48
 
49
49
  Global options and flags use `--key=value` or `--key value` (see `bb help`).
50
50
 
51
- ## Commands
51
+ **Authoritative command list:** run `bb help` — it includes every command, positional args, and flags (kept in sync with the MCP tool surface). You can also use MCP-style `snake_case` (e.g. `bb list_bills`); it is normalized to kebab-case.
52
52
 
53
- | Command | Description |
53
+ ### Command overview
54
+
55
+ | Area | Commands (non-exhaustive) |
54
56
  | --- | --- |
55
- | `list-budgets` | List budgets. Flags: `--projectId`, `--name`, `--status` (comma-separated), `--page`, `--perPage` |
56
- | `get-budget <id>` | Budget details and line items |
57
- | `update-budget-status <id> <status>` | Change budget status (e.g. `APPROVED`, `REJECTED`, `DRAFT`, …) |
58
- | `list-bills` | List bills and/or claims. Flags: `--projectId`, `--budgetId`, `--status` (CSV, like `DRAFT,PAID` or `ALL`), `--search`, `--isClaimable` (`true`\|`false`), `--createdByIds` (CSV), `--sortBy` (`createdAt`\|`amount`\|`status`), `--sortDir` (`asc`\|`desc`), `--page`, `--pageSize` |
59
- | `list-claims` | Reimbursable claims only; same flags as `list-bills` except `--isClaimable` is ignored (always true) |
60
- | `approve-bill <id>` | Approve a pending bill (matches your pending bill approvals) |
61
- | `list-approvals` | Pending approvals. Flag: `--type` = `budget`, `supplier`, `bill`, or `all` |
62
- | `list-suppliers` | List suppliers. Flags: `--name`, `--page`, `--perPage` |
57
+ | **Budgets** | `list-budgets`, `get-budget`, `get-budget-items`, `get-budget-details`, `get-budget-categories`, `get-budget-versions`, `update-budget-status`, `create-budget-approval`, `add-budget-items`, `update-budget-item`, `remove-budget-item` |
58
+ | **Bills** | `list-bills`, `list-claims`, `create-bill-approval`, `update-bill-status`, `patch-bill-payment`, `patch-bill-invoice-number`, `get-bill-attachments`, `get-bill-details` |
59
+ | **Approvals** | `list-approvals` / `get-pending-approvals`, `approve-bill`, `reject-bill`, `approve-budget`, `reject-budget`, `approve-supplier`, `reject-supplier` |
60
+ | **Companies & projects** | `list-companies`, `get-company`, `create-company`, `list-projects`, `get-project`, `create-project`, `update-project-status` |
61
+ | **Contacts** | `list-contacts` |
62
+ | **Suppliers & items** | `list-suppliers`, `get-supplier-details`, `get-supplier-analytics`, `list-items`, `get-item`, `list-item-categories` |
63
+ | **Dashboard & users** | `list-users`, `get-user-performance`, `get-dashboard`, `get-financial-overview` |
64
+ | **Errors** | `get-recent-errors`, `get-error-metrics` |
65
+ | **Historical / benchmarks** | `get-approved-budgets`, `get-budget-category-benchmarks`, `get-item-pricing-history`, `get-supplier-pricing-history` |
63
66
 
64
67
  ## Output
65
68
 
@@ -71,7 +74,7 @@ A `.env` file in the **current working directory** is loaded automatically (for
71
74
 
72
75
  ## Developing in this repo
73
76
 
74
- From the monorepo root:
77
+ From the monorepo root (after `bun install`):
75
78
 
76
79
  ```bash
77
80
  export BB_API_KEY=...
@@ -81,5 +84,15 @@ bun run bb -- list-budgets
81
84
  Or from `packages/cli`:
82
85
 
83
86
  ```bash
87
+ bun run build # emit dist/ via tsc
88
+ bun run typecheck # tsc --noEmit
84
89
  bun run src/index.ts list-budgets
85
90
  ```
91
+
92
+ ### Layout
93
+
94
+ - **`src/filter-enums.ts`** — “extended” filter enums (ALL + Prisma enums), maintained here so the published package does not depend on unpublished workspace packages. Keep in line with `packages/utils/src/filter-enums.ts` when those values change.
95
+
96
+ ### Publish
97
+
98
+ `prepublishOnly` strips `workspace:` / `catalog:` entries from this package’s `package.json`, runs `tsc`, then `postpack` restores the file — so the npm tarball does not contain monorepo protocol dependencies. Types from `@bb/api` are compile-time only (`import type`). Enum **values** in emitted JS import `@bb/db/enums` (workspace `@bb/db` during monorepo development).
package/dist/commands.js CHANGED
@@ -1,6 +1,6 @@
1
- import { BudgetRole, Deals, ExtendedApprovalStatus, ExtendedApprovalType, ExtendedBudgetStatus, TimeFrame, } from "@bb/utils/filter-enums";
2
- import { api } from "./api-client";
3
- import { billStatusesForApi, } from "./parse-cli-enums";
1
+ import { api } from "./api-client.js";
2
+ import { BudgetRole, Deals, ExtendedApprovalStatus, ExtendedApprovalType, ExtendedBudgetStatus, TimeFrame, } from "./filter-enums.js";
3
+ import { billStatusesForApi, } from "./parse-cli-enums.js";
4
4
  const BUDGET = "BUDGET";
5
5
  const BILL = "BILL";
6
6
  const SUPPLIER = "SUPPLIER";
@@ -0,0 +1,58 @@
1
+ import { ApprovalStatus, ApprovalType, BillStatus, BudgetStatus, ErrorSeverity, ErrorStatus, EstimationMode, ProjectStatus, } from "@bb/db/enums";
2
+ export const ExtendedApprovalStatus = {
3
+ ...ApprovalStatus,
4
+ ALL: "ALL",
5
+ };
6
+ export const ExtendedApprovalType = {
7
+ ...ApprovalType,
8
+ ALL: "ALL",
9
+ };
10
+ export const ExtendedProjectStatus = {
11
+ ...ProjectStatus,
12
+ ALL: "ALL",
13
+ };
14
+ export const ExtendedBudgetStatus = {
15
+ ...BudgetStatus,
16
+ ALL: "ALL",
17
+ };
18
+ export const ExtendedBillStatus = {
19
+ ...BillStatus,
20
+ ALL: "ALL",
21
+ };
22
+ export const ExtendedEstimationMode = {
23
+ ...EstimationMode,
24
+ ALL: "ALL",
25
+ };
26
+ export const BudgetRole = {
27
+ ALL: "ALL",
28
+ BD: "BD",
29
+ CREATOR: "CREATOR",
30
+ INSIDE_SALES: "INSIDE_SALES",
31
+ };
32
+ export const Deals = {
33
+ ALL: "ALL",
34
+ SUCCESSFUL: "SUCCESSFUL",
35
+ LOST: "LOST",
36
+ };
37
+ export const TimeFrame = {
38
+ ALL: "ALL",
39
+ LAST_YEAR: "LAST_YEAR",
40
+ LAST_6_MONTHS: "LAST_6_MONTHS",
41
+ LAST_3_MONTHS: "LAST_3_MONTHS",
42
+ CUSTOM: "CUSTOM",
43
+ };
44
+ export const ChartTimeFrame = {
45
+ LAST_30_DAYS: "last_30_days",
46
+ LAST_3_MONTHS: "last_3_months",
47
+ LAST_6_MONTHS: "last_6_months",
48
+ LAST_1_YEAR: "last_1_year",
49
+ ALL_TIME: "all_time",
50
+ };
51
+ export const ExtendedErrorSeverity = {
52
+ ALL: "ALL",
53
+ ...ErrorSeverity,
54
+ };
55
+ export const ExtendedErrorStatus = {
56
+ ALL: "ALL",
57
+ ...ErrorStatus,
58
+ };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import "./load-env";
3
- import { requireApiKey } from "./api-client";
2
+ import "./load-env.js";
3
+ import { requireApiKey } from "./api-client.js";
4
4
  import { addBudgetItems, approveBill, approveBudget, approveSupplier, createBillApproval, createBudgetApproval, createCompany, createProject, getApprovedBudgets, getBillAttachments, getBillDetails, getBudget, getBudgetCategories, getBudgetCategoryBenchmarks, getBudgetDetails, getBudgetItemsOnly, getBudgetVersions, getCompany, getDashboard, getErrorMetrics, getFinancialOverview, getItem, getItemPricingHistory, getProject, getRecentErrors, getSupplierAnalytics, getSupplierDetails, getSupplierPricingHistory, getUserPerformance, listApprovals, listBills, listBudgets, listCompanies, listContacts, listItemCategories, listItems, listProjects, listSuppliers, listUsers, patchBillInvoiceNumber, patchBillPayment, rejectBill, rejectBudget, rejectSupplier, removeBudgetItem, updateBillStatus, updateBudgetItem, updateBudgetStatus, updateProjectStatus, } from "./commands.js";
5
5
  import { getFlag, parseArgs } from "./parse-args.js";
6
6
  import { billStatusesForUpdateHelp, budgetStatusesForHelp, isBudgetStatusUpdate, parseApprovalTypeFlag, parseBillStatusForUpdate, parseCommaSeparatedBillStatuses, parseCommaSeparatedBudgetStatuses, parseCommaSeparatedIds, parseOptionalBillListSortBy, parseOptionalBillListSortDir, parseOptionalDashboardRole, parseOptionalDeals, parseOptionalErrorSeverity, parseOptionalErrorStatus, parseOptionalExtendedProjectStatus, parseOptionalFinancialRole, parseOptionalSupplierAnalyticsTimeFrame, parseOptionalTimeFrame, parseProjectStatusForUpdate, projectStatusesForHelp, } from "./parse-cli-enums.js";
@@ -1,5 +1,5 @@
1
1
  import { BillStatus, BudgetStatus, ProjectStatus } from "@bb/db/enums";
2
- import { BudgetRole, Deals, ExtendedBillStatus, ExtendedErrorSeverity, ExtendedErrorStatus, ExtendedProjectStatus, TimeFrame, } from "@bb/utils/filter-enums";
2
+ import { BudgetRole, Deals, ExtendedBillStatus, ExtendedErrorSeverity, ExtendedErrorStatus, ExtendedProjectStatus, TimeFrame, } from "./filter-enums.js";
3
3
  const BUDGET_STATUS_VALUES = new Set(Object.values(BudgetStatus));
4
4
  const BILL_STATUS_VALUES = new Set(Object.values(BillStatus));
5
5
  const PROJECT_STATUS_VALUES = new Set(Object.values(ProjectStatus));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-labs-sg/bb",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Budget Builder CLI — list budgets, bills, approvals, suppliers; approve bills; change status. For AI agents (e.g. Chuck/OpenClaw).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",