@go-labs-sg/bb 2.34.0 → 2.36.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/README.md CHANGED
@@ -228,9 +228,19 @@ New sources are registered against an existing Typeform form ID and always start
228
228
  with processing disabled in `COLLECT_ONLY`; creating a source does not call any
229
229
  external provider.
230
230
 
231
- Deal-lifecycle retries require Slack and Asana to succeed. Google Calendar is
232
- attempted afterward; a Calendar failure is logged without failing the overall
233
- lifecycle operation.
231
+ Set `asanaCustomFields.bbLinkFieldId` in the automation configuration to the
232
+ Asana Deals project's text custom field **BB Link**. Keep the other configuration
233
+ values when saving. Project creation queues a retryable update of that field
234
+ with the BB project's `/budgets` URL; an unmapped field is left untouched.
235
+ Older inbound snapshots can use the current BB Link mapping for their original
236
+ source and Asana Deals project.
237
+
238
+ Project Calendar descriptions list `bb :`, `asana deal:`, and `slack:` links
239
+ when available. The `asana project:` line appears only after a win and an
240
+ operational Asana project exists. Persisting that Asana project queues a Calendar
241
+ refresh, including recovery paths. Inbound response identity is retained for
242
+ safe reconciliation. Calendar and configured Asana/Slack synchronization failures
243
+ remain retryable in the durable lifecycle outbox.
234
244
 
235
245
  ### Mutation safety
236
246
 
@@ -296,6 +306,52 @@ Bill creation determines its required permissions from the parsed input, for bot
296
306
 
297
307
  **Contact-person estimate email:** `bb budget estimate send --payload '<json>'` calls the same `email.sendEstimateToContactPerson` procedure as the web composer. The payload requires `budgetId`, `estimateId`, optional `estimateDocNumber`, `to`, `cc`, `replyTo`, `subject`, HTML `content`, and HTML `signature`. It durably queues worker delivery of the QuickBooks PDF, standard terms, and Budget Builder budget attachments, and returns the outbound-email and operation IDs immediately. Worker retries reuse one provider idempotency key; the budget becomes `ESTIMATE_SENT` only after Resend accepts the email. The command requires interactive `CONFIRM`; inspect the budget, recipients, and HTML first.
298
308
 
309
+ ### Acceptance invoice splits and grouped sending
310
+
311
+ After `bb budget won mark` (or an accepted status update), the JSON result includes an `invoiceSetup` prompt for QuickBooks-backed estimates. Choose the split amounts and each split's contractual due date; invoice creation does not wait for those due dates. There is no separate split-approval request.
312
+
313
+ 1. `bb customer-invoice splits <budgetId>` returns the current revision, row IDs, billing defaults, and invoice approval/delivery states.
314
+ 2. `bb customer-invoice preview-splits --payload '<json>'` previews amounts including GST and due-date changes, without writes.
315
+ 3. `bb customer-invoice save-splits --payload '<json>'` saves that setup only. It does not create QBO invoices or request invoice approval. Re-read `splits` for the new revision and instalment IDs.
316
+ 4. `bb customer-invoice create-splits --payload '{"budgetId":"budget_1","expectedRevision":2,"instalmentIds":["row_1","row_2"]}'` creates selected ready invoices in QBO. Non-admin creation automatically requests admin approval **after creation**; admin creation auto-approves. No customer email is sent.
317
+ 5. An admin uses the existing `bb customer-invoice approve <batchId>` action for each pending invoice batch. Approval does not send the invoice to the customer.
318
+ 6. The user re-reads `splits`, then runs `bb customer-invoice send-group --payload '{"budgetId":"budget_1","expectedRevision":2,"instalmentIds":["row_1","row_2"]}'` to send approved invoices together in one email. Select one row for individual sending. Alternatively, use `--all-approved --payload '{"budgetId":"budget_1","expectedRevision":2}'` to select all approved, unsent invoices in that budget. Do not combine `--all-approved` with `instalmentIds`.
319
+
320
+ Preview/save use this shape, populated from the current `splits` result and the signed terms (IDs, addresses, and dates below are examples only):
321
+
322
+ ```json
323
+ {
324
+ "budgetId": "budget_1",
325
+ "expectedRevision": 1,
326
+ "scope": "BASE",
327
+ "changeReason": "Confirmed invoice split and due dates from signed estimate",
328
+ "definition": {
329
+ "rows": [
330
+ { "key": "deposit", "label": "Deposit", "amount": { "type": "PERCENTAGE", "value": 70 }, "due": { "type": "CONFIRMATION" }, "issue": { "type": "ACCEPTANCE" } },
331
+ { "key": "balance", "label": "Balance", "amount": { "type": "PERCENTAGE", "value": 30 }, "due": { "type": "FIXED_DATE", "date": "2026-12-01" }, "issue": { "type": "ACCEPTANCE" } }
332
+ ],
333
+ "reminderLeadDays": 7,
334
+ "billingRestriction": ""
335
+ },
336
+ "billing": {
337
+ "legalEntityName": "Customer legal entity",
338
+ "purchaseOrder": "PO-reference",
339
+ "billingAddress": "Customer billing address",
340
+ "to": "billing@example.invalid",
341
+ "cc": [],
342
+ "replyTo": "owner@example.invalid",
343
+ "deliveryMethod": "EMAIL",
344
+ "uploadUrl": null
345
+ }
346
+ }
347
+ ```
348
+
349
+ Use the exact current revision (or `null` only when no schedule exists). Fixed amounts use **pre-GST cents**; percentages use percentage points. Event-relative due rules are `EVENT_START` or `EVENT_END` with `offsetDays`. Preview and resolve missing dates, past-due review or unresolved amounts rather than inventing replacements.
350
+
351
+ Non-interactive save requires `--allow-state-change`; creation requires `--allow-state-change --allow-financial-write --allow-external-write --allow-email` (approval-request email, not customer invoice delivery); grouped sending requires `--allow-state-change --allow-email --allow-external-write`. These flags acknowledge effects, not role permissions or user authorisation. Both ordinary users and admins still need server-granted project access. Pending/rejected invoices cannot be sent; a mixed selection is rejected rather than silently dropping invoices. Sending uses each issued invoice's original billing revision, not later edits. Invoices with different original billing instructions must be sent in separate groups. Do not blindly retry uncertain QBO or email outcomes.
352
+
353
+ These commands require the matching API deployment and a new CLI release; changing this repository does not publish the CLI or deploy production.
354
+
299
355
  ### Quotation amounts and line allocations
300
356
 
301
357
  Quotation create and update payloads use `amountWithoutGst` for the supplier subtotal and `gstAmount` for GST. Keep GST separate; do not add it to `amountWithoutGst`. When a quotation covers more than one budget item, `lineAmounts` is required and must contain each selected item exactly once. The line amounts must sum to `amountWithoutGst`.
@@ -3829,6 +3829,275 @@
3829
3829
  "effects": ["state-change", "financial-write"],
3830
3830
  "legacyTarget": "import-qbo-customer-invoice"
3831
3831
  },
3832
+ {
3833
+ "path": ["customer-invoice", "splits"],
3834
+ "legacyAliases": [
3835
+ "get-customer-invoice-splits",
3836
+ "get_customer_invoice_splits"
3837
+ ],
3838
+ "summary": "Review acceptance invoice splits, due dates, approval states and saved billing details. Arguments: <budgetId>.",
3839
+ "globalOptions": [
3840
+ {
3841
+ "name": "--help",
3842
+ "description": "Show help for this command."
3843
+ },
3844
+ {
3845
+ "name": "--quiet",
3846
+ "description": "Suppress non-error diagnostics."
3847
+ },
3848
+ {
3849
+ "name": "--debug",
3850
+ "description": "Emit sanitized diagnostic traces."
3851
+ },
3852
+ {
3853
+ "name": "--api-url",
3854
+ "description": "Override the Budget Builder API base URL."
3855
+ },
3856
+ {
3857
+ "name": "--no-browser",
3858
+ "description": "Print the authorization URL without opening a browser."
3859
+ },
3860
+ {
3861
+ "name": "--allow-state-change",
3862
+ "description": "Allow a Budget Builder state change in non-interactive use."
3863
+ },
3864
+ {
3865
+ "name": "--allow-email",
3866
+ "description": "Allow sending email in non-interactive use."
3867
+ },
3868
+ {
3869
+ "name": "--allow-external-write",
3870
+ "description": "Allow writes to external systems in non-interactive use."
3871
+ },
3872
+ {
3873
+ "name": "--allow-delete",
3874
+ "description": "Allow deleting data in non-interactive use."
3875
+ },
3876
+ {
3877
+ "name": "--allow-financial-write",
3878
+ "description": "Allow financial-record changes in non-interactive use."
3879
+ }
3880
+ ],
3881
+ "argumentMode": "legacy-passthrough",
3882
+ "effects": [],
3883
+ "legacyTarget": "get-customer-invoice-splits"
3884
+ },
3885
+ {
3886
+ "path": ["customer-invoice", "preview-splits"],
3887
+ "legacyAliases": [
3888
+ "preview-customer-invoice-splits",
3889
+ "preview_customer_invoice_splits"
3890
+ ],
3891
+ "summary": "Preview splits, GST totals and due-date changes without writes. Requires --payload with the schedule save input.",
3892
+ "globalOptions": [
3893
+ {
3894
+ "name": "--help",
3895
+ "description": "Show help for this command."
3896
+ },
3897
+ {
3898
+ "name": "--quiet",
3899
+ "description": "Suppress non-error diagnostics."
3900
+ },
3901
+ {
3902
+ "name": "--debug",
3903
+ "description": "Emit sanitized diagnostic traces."
3904
+ },
3905
+ {
3906
+ "name": "--api-url",
3907
+ "description": "Override the Budget Builder API base URL."
3908
+ },
3909
+ {
3910
+ "name": "--no-browser",
3911
+ "description": "Print the authorization URL without opening a browser."
3912
+ },
3913
+ {
3914
+ "name": "--allow-state-change",
3915
+ "description": "Allow a Budget Builder state change in non-interactive use."
3916
+ },
3917
+ {
3918
+ "name": "--allow-email",
3919
+ "description": "Allow sending email in non-interactive use."
3920
+ },
3921
+ {
3922
+ "name": "--allow-external-write",
3923
+ "description": "Allow writes to external systems in non-interactive use."
3924
+ },
3925
+ {
3926
+ "name": "--allow-delete",
3927
+ "description": "Allow deleting data in non-interactive use."
3928
+ },
3929
+ {
3930
+ "name": "--allow-financial-write",
3931
+ "description": "Allow financial-record changes in non-interactive use."
3932
+ }
3933
+ ],
3934
+ "argumentMode": "legacy-passthrough",
3935
+ "effects": [],
3936
+ "legacyTarget": "preview-customer-invoice-splits"
3937
+ },
3938
+ {
3939
+ "path": ["customer-invoice", "save-splits"],
3940
+ "legacyAliases": [
3941
+ "save-customer-invoice-splits",
3942
+ "save_customer_invoice_splits"
3943
+ ],
3944
+ "summary": "Save split amounts and separate due dates after estimate acceptance. Requires --payload; does not create invoices or request approval.",
3945
+ "globalOptions": [
3946
+ {
3947
+ "name": "--help",
3948
+ "description": "Show help for this command."
3949
+ },
3950
+ {
3951
+ "name": "--quiet",
3952
+ "description": "Suppress non-error diagnostics."
3953
+ },
3954
+ {
3955
+ "name": "--debug",
3956
+ "description": "Emit sanitized diagnostic traces."
3957
+ },
3958
+ {
3959
+ "name": "--api-url",
3960
+ "description": "Override the Budget Builder API base URL."
3961
+ },
3962
+ {
3963
+ "name": "--no-browser",
3964
+ "description": "Print the authorization URL without opening a browser."
3965
+ },
3966
+ {
3967
+ "name": "--allow-state-change",
3968
+ "description": "Allow a Budget Builder state change in non-interactive use."
3969
+ },
3970
+ {
3971
+ "name": "--allow-email",
3972
+ "description": "Allow sending email in non-interactive use."
3973
+ },
3974
+ {
3975
+ "name": "--allow-external-write",
3976
+ "description": "Allow writes to external systems in non-interactive use."
3977
+ },
3978
+ {
3979
+ "name": "--allow-delete",
3980
+ "description": "Allow deleting data in non-interactive use."
3981
+ },
3982
+ {
3983
+ "name": "--allow-financial-write",
3984
+ "description": "Allow financial-record changes in non-interactive use."
3985
+ }
3986
+ ],
3987
+ "argumentMode": "legacy-passthrough",
3988
+ "effects": ["state-change"],
3989
+ "legacyTarget": "save-customer-invoice-splits"
3990
+ },
3991
+ {
3992
+ "path": ["customer-invoice", "create-splits"],
3993
+ "legacyAliases": [
3994
+ "create-customer-invoice-splits",
3995
+ "create_customer_invoice_splits"
3996
+ ],
3997
+ "summary": "Create selected split invoices in QBO, then request admin approval for non-admin creators or auto-approve admin creators. Requires --payload with budgetId, expectedRevision, instalmentIds. Never sends customer invoices.",
3998
+ "globalOptions": [
3999
+ {
4000
+ "name": "--help",
4001
+ "description": "Show help for this command."
4002
+ },
4003
+ {
4004
+ "name": "--quiet",
4005
+ "description": "Suppress non-error diagnostics."
4006
+ },
4007
+ {
4008
+ "name": "--debug",
4009
+ "description": "Emit sanitized diagnostic traces."
4010
+ },
4011
+ {
4012
+ "name": "--api-url",
4013
+ "description": "Override the Budget Builder API base URL."
4014
+ },
4015
+ {
4016
+ "name": "--no-browser",
4017
+ "description": "Print the authorization URL without opening a browser."
4018
+ },
4019
+ {
4020
+ "name": "--allow-state-change",
4021
+ "description": "Allow a Budget Builder state change in non-interactive use."
4022
+ },
4023
+ {
4024
+ "name": "--allow-email",
4025
+ "description": "Allow sending email in non-interactive use."
4026
+ },
4027
+ {
4028
+ "name": "--allow-external-write",
4029
+ "description": "Allow writes to external systems in non-interactive use."
4030
+ },
4031
+ {
4032
+ "name": "--allow-delete",
4033
+ "description": "Allow deleting data in non-interactive use."
4034
+ },
4035
+ {
4036
+ "name": "--allow-financial-write",
4037
+ "description": "Allow financial-record changes in non-interactive use."
4038
+ }
4039
+ ],
4040
+ "argumentMode": "legacy-passthrough",
4041
+ "effects": ["state-change", "financial-write", "external-write", "email"],
4042
+ "legacyTarget": "create-customer-invoice-splits"
4043
+ },
4044
+ {
4045
+ "path": ["customer-invoice", "send-group"],
4046
+ "legacyAliases": [
4047
+ "send-customer-invoice-group",
4048
+ "send_customer_invoice_group"
4049
+ ],
4050
+ "summary": "Send selected approved invoices together in one email. Requires --payload with budgetId, expectedRevision, instalmentIds, or --all-approved without instalmentIds. Pass one instalment for individual sending.",
4051
+ "globalOptions": [
4052
+ {
4053
+ "name": "--help",
4054
+ "description": "Show help for this command."
4055
+ },
4056
+ {
4057
+ "name": "--quiet",
4058
+ "description": "Suppress non-error diagnostics."
4059
+ },
4060
+ {
4061
+ "name": "--debug",
4062
+ "description": "Emit sanitized diagnostic traces."
4063
+ },
4064
+ {
4065
+ "name": "--api-url",
4066
+ "description": "Override the Budget Builder API base URL."
4067
+ },
4068
+ {
4069
+ "name": "--no-browser",
4070
+ "description": "Print the authorization URL without opening a browser."
4071
+ },
4072
+ {
4073
+ "name": "--allow-state-change",
4074
+ "description": "Allow a Budget Builder state change in non-interactive use."
4075
+ },
4076
+ {
4077
+ "name": "--allow-email",
4078
+ "description": "Allow sending email in non-interactive use."
4079
+ },
4080
+ {
4081
+ "name": "--allow-external-write",
4082
+ "description": "Allow writes to external systems in non-interactive use."
4083
+ },
4084
+ {
4085
+ "name": "--allow-delete",
4086
+ "description": "Allow deleting data in non-interactive use."
4087
+ },
4088
+ {
4089
+ "name": "--allow-financial-write",
4090
+ "description": "Allow financial-record changes in non-interactive use."
4091
+ },
4092
+ {
4093
+ "name": "--all-approved",
4094
+ "description": "Select all approved unsent invoices; payload must contain only budgetId and expectedRevision."
4095
+ }
4096
+ ],
4097
+ "argumentMode": "legacy-passthrough",
4098
+ "effects": ["state-change", "email", "external-write"],
4099
+ "legacyTarget": "send-customer-invoice-group"
4100
+ },
3832
4101
  {
3833
4102
  "path": ["customer-invoice", "create"],
3834
4103
  "legacyAliases": ["create-customer-invoice", "create_customer_invoice"],
@@ -617,6 +617,46 @@ Legacy aliases: `import-qbo-customer-invoice`, `import_qbo_customer_invoice`.
617
617
 
618
618
  Effects: state-change, financial-write.
619
619
 
620
+ ## `bb customer-invoice splits`
621
+
622
+ Review acceptance invoice splits, due dates, approval states and saved billing details. Arguments: <budgetId>.
623
+
624
+ Legacy aliases: `get-customer-invoice-splits`, `get_customer_invoice_splits`.
625
+
626
+ Effects: none.
627
+
628
+ ## `bb customer-invoice preview-splits`
629
+
630
+ Preview splits, GST totals and due-date changes without writes. Requires --payload with the schedule save input.
631
+
632
+ Legacy aliases: `preview-customer-invoice-splits`, `preview_customer_invoice_splits`.
633
+
634
+ Effects: none.
635
+
636
+ ## `bb customer-invoice save-splits`
637
+
638
+ Save split amounts and separate due dates after estimate acceptance. Requires --payload; does not create invoices or request approval.
639
+
640
+ Legacy aliases: `save-customer-invoice-splits`, `save_customer_invoice_splits`.
641
+
642
+ Effects: state-change.
643
+
644
+ ## `bb customer-invoice create-splits`
645
+
646
+ Create selected split invoices in QBO, then request admin approval for non-admin creators or auto-approve admin creators. Requires --payload with budgetId, expectedRevision, instalmentIds. Never sends customer invoices.
647
+
648
+ Legacy aliases: `create-customer-invoice-splits`, `create_customer_invoice_splits`.
649
+
650
+ Effects: state-change, financial-write, external-write, email.
651
+
652
+ ## `bb customer-invoice send-group`
653
+
654
+ Send selected approved invoices together in one email. Requires --payload with budgetId, expectedRevision, instalmentIds, or --all-approved without instalmentIds. Pass one instalment for individual sending.
655
+
656
+ Legacy aliases: `send-customer-invoice-group`, `send_customer_invoice_group`.
657
+
658
+ Effects: state-change, email, external-write.
659
+
620
660
  ## `bb customer-invoice create`
621
661
 
622
662
  Create Customer Invoice.