@go-labs-sg/bb 3.21.1 → 3.22.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/dist/index.js CHANGED
@@ -50,15 +50,13 @@ var __toESMCache_node, __toESMCache_esm, __toESM = __name2((mod, isNodeMode, tar
50
50
  y[45] = 1, y[46] = 1, y[95] = 1;
51
51
  function H(e) {
52
52
  let n = {}, t = e.toString();
53
- t = t.replace(new __cliRegExp("\\r\\n?", "mg"), `
54
- `);
53
+ t = t.replace(new __cliRegExp("\\r\\n?", "mg"), "\n");
55
54
  let r;
56
55
  for (; (r = G.exec(t)) != null; ) {
57
56
  let o = r[1], i = r[2] || "";
58
57
  i = i.trim();
59
58
  let c = i[0];
60
- i = i.replace(new __cliRegExp("^(['\"`])([\\s\\S]*)\\1$", "mg"), "$2"), c === '"' && (i = i.replace(new __cliRegExp("\\\\n", "g"), `
61
- `), i = i.replace(new __cliRegExp("\\\\r", "g"), "\r")), n[o] = i;
59
+ i = i.replace(new __cliRegExp("^(['\"`])([\\s\\S]*)\\1$", "mg"), "$2"), c === '"' && (i = i.replace(new __cliRegExp("\\\\n", "g"), "\n"), i = i.replace(new __cliRegExp("\\\\r", "g"), "\r")), n[o] = i;
62
60
  }
63
61
  return n;
64
62
  }
@@ -73,8 +71,7 @@ var __toESMCache_node, __toESMCache_esm, __toESM = __name2((mod, isNodeMode, tar
73
71
  __name(O, "O"), __name2(O, "O");
74
72
  function V(e) {
75
73
  let n = {}, t = typeof e == "string" ? e : e.toString();
76
- t.indexOf("\r") !== -1 && (t = t.replace(new __cliRegExp("\\r\\n?", "g"), `
77
- `));
74
+ t.indexOf("\r") !== -1 && (t = t.replace(new __cliRegExp("\\r\\n?", "g"), "\n"));
78
75
  let r = t.length, o = 0;
79
76
  for (; o < r; ) {
80
77
  let i = t.charCodeAt(o);
@@ -130,8 +127,7 @@ var __toESMCache_node, __toESMCache_esm, __toESM = __name2((mod, isNodeMode, tar
130
127
  }
131
128
  }
132
129
  if (!q) {
133
- let u = t.indexOf(`
134
- `, d);
130
+ let u = t.indexOf("\n", d);
135
131
  u === -1 && (u = r);
136
132
  let s;
137
133
  if (r < 4096) s = t.indexOf("#", d), (s === -1 || s > u) && (s = u);
@@ -142,8 +138,7 @@ var __toESMCache_node, __toESMCache_esm, __toESM = __name2((mod, isNodeMode, tar
142
138
  let x = t.charCodeAt(f);
143
139
  if (a = t.slice(f, h), a.includes("\u2028") || a.includes("\u2029") ? a = a.replace(new __cliRegExp("^(['\"`])([\\s\\S]*)\\1$", "mg"), "$2") : h - f >= 2 && (x === 39 || x === 34 || x === 96) && t.charCodeAt(h - 1) === x && (a = t.slice(f + 1, h - 1)), o = s, s < u) for (; o < r && !O(t.charCodeAt(o)); ) o++;
144
140
  }
145
- C === 34 && (q || l < o) && a.indexOf("\\") !== -1 && (a = a.replace(new __cliRegExp("\\\\n", "g"), `
146
- `).replace(new __cliRegExp("\\\\r", "g"), "\r")), n[k] = a;
141
+ C === 34 && (q || l < o) && a.indexOf("\\") !== -1 && (a = a.replace(new __cliRegExp("\\\\n", "g"), "\n").replace(new __cliRegExp("\\\\r", "g"), "\r")), n[k] = a;
147
142
  }
148
143
  return n;
149
144
  }
@@ -908,7 +903,8 @@ function emoji() {
908
903
  return new RegExp(_emoji, "u");
909
904
  }
910
905
  __name(emoji, "emoji"), __name2(emoji, "emoji");
911
- var ipv4 = new __cliRegExp("^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$", ""), ipv6 = new __cliRegExp("^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$", ""), cidrv4 = new __cliRegExp("^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/([0-9]|[1-2][0-9]|3[0-2])$", ""), cidrv6 = new __cliRegExp("^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$", ""), base64 = new __cliRegExp("^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$", ""), base64url = new __cliRegExp("^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$", ""), httpProtocol = new __cliRegExp("^https?$", ""), e164 = new __cliRegExp("^\\+[1-9]\\d{6,14}$", ""), dateSource = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";
906
+ var ipv4 = new __cliRegExp("^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$", ""), ipv6 = new __cliRegExp("^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$", ""), cidrv4 = new __cliRegExp("^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/([0-9]|[1-2][0-9]|3[0-2])$", ""), cidrv6 = new __cliRegExp("^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a\
907
+ -fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$", ""), base64 = new __cliRegExp("^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$", ""), base64url = new __cliRegExp("^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$", ""), httpProtocol = new __cliRegExp("^https?$", ""), e164 = new __cliRegExp("^\\+[1-9]\\d{6,14}$", ""), dateSource = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";
912
908
  function anchor(source) {
913
909
  return new RegExp("^".concat(source, "$"));
914
910
  }
@@ -1060,16 +1056,12 @@ class Doc {
1060
1056
  arg(this, { execution: "sync" }), arg(this, { execution: "async" });
1061
1057
  return;
1062
1058
  }
1063
- const lines = arg.split(`
1064
- `).filter((x) => x), minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length)), dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
1059
+ const lines = arg.split("\n").filter((x) => x), minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length)), dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
1065
1060
  for (const line of dedented) this.content.push(line);
1066
1061
  }
1067
1062
  compile() {
1068
1063
  const F = Function, content = this?.content ?? [""];
1069
- return new F(...Object.keys(this.closed), "return function (".concat(this.args.join(", "), `) {
1070
- `).concat(content.join(`
1071
- `), `
1072
- };`))(...Object.values(this.closed));
1064
+ return new F(...Object.keys(this.closed), "return function (".concat(this.args.join(", "), ") {\n").concat(content.join("\n"), "\n};"))(...Object.values(this.closed));
1073
1065
  }
1074
1066
  }
1075
1067
  var version = { major: 4, minor: 6, patch: 7 }, $ZodType = $constructor("$ZodType", (inst, def) => {
@@ -1499,18 +1491,7 @@ var $ZodObject = $constructor("$ZodObject", (inst, def) => {
1499
1491
  }), $ZodObjectJIT = $constructor("$ZodObjectJIT", (inst, def) => {
1500
1492
  $ZodObject.init(inst, def);
1501
1493
  const superParse = inst._zod.parse, _normalized = cached(() => normalizeDef(def)), memo2 = globalConfig.memoizer, generateFastpass = __name2((shape) => {
1502
- const normalized = _normalized.value, syms = normalized.symbolKeys, doc = new Doc(["payload", "ctx"], { shape, inst, memo: memo2, syms }), parseStr = __name2((k) => "shape[".concat(k, "]._zod.run({ value: input[").concat(k, "], issues: [] }, ctx)"), "parseStr"), prefixStr = __name2((id, k) => `
1503
- let `.concat(id, `_ab = false;
1504
- for (let i = 0; i < `).concat(id, `.issues.length; i++) {
1505
- const iss = `).concat(id, `.issues[i];
1506
- iss.path = iss.path ? [`).concat(k, ", ...iss.path] : [").concat(k, `];
1507
- payload.issues.push(iss);
1508
- if (iss.continue !== true) `).concat(id, `_ab = true;
1509
- }
1510
- if (`).concat(id, `_ab && ctx && ctx.abortEarly) {
1511
- payload.value = newResult;
1512
- return payload;
1513
- }`), "prefixStr");
1494
+ const normalized = _normalized.value, syms = normalized.symbolKeys, doc = new Doc(["payload", "ctx"], { shape, inst, memo: memo2, syms }), parseStr = __name2((k) => "shape[".concat(k, "]._zod.run({ value: input[").concat(k, "], issues: [] }, ctx)"), "parseStr"), prefixStr = __name2((id, k) => "\n let ".concat(id, "_ab = false;\n for (let i = 0; i < ").concat(id, ".issues.length; i++) {\n const iss = ").concat(id, ".issues[i];\n iss.path = iss.path ? [").concat(k, ", ...iss.path] : [").concat(k, "];\n payload.issues.push(iss);\n if (iss.continue !== true) ").concat(id, "_ab = true;\n }\n if (").concat(id, "_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }"), "prefixStr");
1514
1495
  doc.write("const input = payload.value;");
1515
1496
  const ids = /* @__PURE__ */ Object.create(null);
1516
1497
  let counter = 0;
@@ -1521,47 +1502,9 @@ var $ZodObject = $constructor("$ZodObject", (inst, def) => {
1521
1502
  const id = ids[key], k = typeof key == "symbol" ? "syms[".concat(syms.indexOf(key), "]") : esc(key), isPresent = "".concat(k, " in input"), schema = shape[key], optin = schema?._zod?.optin, isOptionalIn = optin !== void 0, isOptionalOut = schema?._zod?.optout === "optional";
1522
1503
  if (doc.write("const ".concat(id, " = ").concat(parseStr(k), ";")), isOptionalIn && isOptionalOut) {
1523
1504
  const assign = optin === "optional" ? "".concat(id, "_present") : "".concat(id, ".value !== undefined || ").concat(id, "_present");
1524
- doc.write(`
1525
- const `.concat(id, "_present = ").concat(isPresent, `;
1526
- if (!`).concat(id, ".issues.length || ").concat(id, `_present) {
1527
- if (`).concat(id, ".issues.length) {").concat(prefixStr(id, k), `
1528
- }
1529
-
1530
- if (`).concat(assign, `) {
1531
- newResult[`).concat(k, "] = ").concat(id, `.value;
1532
- }
1533
- }
1534
-
1535
- `));
1536
- } else isOptionalIn ? (doc.write(`
1537
- if (`.concat(id, ".issues.length) {").concat(prefixStr(id, k), `
1538
- }
1539
- `)), optin === "defaulted" ? doc.write("newResult[".concat(k, "] = ").concat(id, ".value;")) : doc.write(`
1540
- if (`.concat(id, ".value !== undefined || ").concat(isPresent, `) {
1541
- newResult[`).concat(k, "] = ").concat(id, `.value;
1542
- }
1543
- `))) : doc.write(`
1544
- const `.concat(id, "_present = ").concat(isPresent, `;
1545
- if (`).concat(id, ".issues.length) {").concat(prefixStr(id, k), `
1546
- }
1547
- if (!`).concat(id, "_present && !").concat(id, `.issues.length) {
1548
- payload.issues.push({
1549
- code: "invalid_type",
1550
- expected: "nonoptional",
1551
- input: undefined,
1552
- path: [`).concat(k, `]
1553
- });
1554
- if (ctx && ctx.abortEarly) {
1555
- payload.value = newResult;
1556
- return payload;
1557
- }
1558
- }
1559
-
1560
- if (`).concat(id, `_present) {
1561
- newResult[`).concat(k, "] = ").concat(id, `.value;
1562
- }
1563
-
1564
- `));
1505
+ doc.write("\n const ".concat(id, "_present = ").concat(isPresent, ";\n if (!").concat(id, ".issues.length || ").concat(id, "_present) {\n if (").concat(id, ".issues.length) {").concat(prefixStr(id, k), "\n }\n\n if (").concat(assign, ") {\n newResult[").concat(k, "] = ").concat(id, ".value;\n }\n }\n\n "));
1506
+ } else isOptionalIn ? (doc.write("\n if (".concat(id, ".issues.length) {").concat(prefixStr(id, k), "\n }\n ")), optin === "defaulted" ? doc.write("newResult[".concat(k, "] = ").concat(id, ".value;")) : doc.write("\n if (".concat(id, ".value !== undefined || ").concat(isPresent, ") {\n newResult[").concat(k, "] = ").concat(id, ".value;\n }\n "))) : doc.write("\n const ".concat(id, "_present = ").concat(isPresent, ";\n if (").concat(id, ".issues.length) {").concat(prefixStr(id, k), "\n }\n if (!").concat(id, "_present && !").concat(id, '.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [').concat(k, "]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (").concat(id, "_present\
1507
+ ) {\n newResult[").concat(k, "] = ").concat(id, ".value;\n }\n\n "));
1565
1508
  }
1566
1509
  return doc.write("payload.value = newResult;"), doc.write("return payload;"), doc.compile();
1567
1510
  }, "generateFastpass");
@@ -3476,7 +3419,8 @@ var MINIMUM_BUN_VERSION = [1, 4, 0], parseBunVersion = __name2((version2) => {
3476
3419
  }, "compareVersions"), assertBunRuntime = __name2((runtime = globalThis.Bun) => {
3477
3420
  if (!runtime) throw new Error("This CLI requires Bun 1.4.0 or newer. Install it with `npm install --global bun`, then retry the command.");
3478
3421
  if (compareVersions(parseBunVersion(runtime.version), MINIMUM_BUN_VERSION) < 0) throw new Error("This CLI requires Bun 1.4.0 or newer (found ".concat(runtime.version, "). Run `bun upgrade`, then retry the command."));
3479
- }, "assertBunRuntime"), guidance = { "missing-library": "Install the runtime's native credential-store library and ensure your own native keyring/session is accessible and unlocked; Linux desktop storage requires libsecret AND an accessible, unlocked Secret Service.", "bus-unavailable": "The Linux user D-Bus session is absent or unreachable. --no-browser does not provide storage. Start or repair your own user session and native keyring before retrying.", "bus-denied": "Access to the Linux user bus was denied. Fix your own native keyring/session permissions or host policy; do not change bus/socket permissions or borrow another user's bus.", "service-unavailable": "The user bus is reachable but your own Secret Service is unavailable. Start or repair your own native keyring session; do not expose another user's store.", locked: "Unlock your own native credential collection/session before retrying. The CLI will not wait indefinitely for an unlock prompt.", timeout: "The native credential backend did not finish within 10 seconds and its process was terminated. Fix or unlock your own native keyring/session outside the CLI; the CLI will not bypass host permissions.", "invalid-response": "The native credential backend returned an invalid response. Check your own keyring/session and configuration; no credential output was disclosed.", "read-failed": "The native credential backend could not read credentials. Check your own keyring/session availability and permissions; this is not evidence that you are logged out.", "write-failed": "The native credential backend could not persist credentials. Check your own keyring/session write permissions and availability; no plaintext fallback is used.", "delete-failed": "The native credential backend could not delete its entry. Check your own keyring/session permissions and remove any non-secret preflight probe through that backend if necessary." };
3422
+ }, "assertBunRuntime"), guidance = { "missing-library": "Install the runtime's native credential-store library and ensure your own native keyring/session is accessible and unlocked; Linux desktop storage requires libsecret AND an accessible, unlocked Secret Service.", "bus-unavailable": "The Linux user D-Bus session is absent or unreachable. --no-browser does not provide storage. Start or repair your own user session and native keyring before retrying.", "bus-denied": "Access to the Linux user bus was denied. Fix your own native keyring/session permissions or host policy; do not change bus/socket permissions or borrow another user's bus.", "service-unavailable": "The user bus is reachable but your own Secret Service is unavailable. Start or repair your own native keyring session; do not expose another user's store.", locked: "Unlock your own native credential collection/session before retrying. The CLI will not wait indefinitely for an unlock prompt.", timeout: "The native credential b\
3423
+ ackend did not finish within 10 seconds and its process was terminated. Fix or unlock your own native keyring/session outside the CLI; the CLI will not bypass host permissions.", "invalid-response": "The native credential backend returned an invalid response. Check your own keyring/session and configuration; no credential output was disclosed.", "read-failed": "The native credential backend could not read credentials. Check your own keyring/session availability and permissions; this is not evidence that you are logged out.", "write-failed": "The native credential backend could not persist credentials. Check your own keyring/session write permissions and availability; no plaintext fallback is used.", "delete-failed": "The native credential backend could not delete its entry. Check your own keyring/session permissions and remove any non-secret preflight probe through that backend if necessary." };
3480
3424
  class CliCredentialStoreUnavailableError extends Error {
3481
3425
  static {
3482
3426
  __name(this, "CliCredentialStoreUnavailableError");
@@ -3512,8 +3456,7 @@ var getCliStorageError = __name2((error2) => {
3512
3456
  }, "getCliStorageError"), timeoutMs = 1e4, maxBuffer = 64 * 1024, runBackend = __name2((product, executable, args, input, failure2) => new Promise((resolve, reject) => {
3513
3457
  const child = execFile(executable, args, { timeout: timeoutMs, killSignal: "SIGKILL", maxBuffer, windowsHide: !0 }, (error2, stdout, stderr) => {
3514
3458
  if (error2) {
3515
- const reason = error2.code === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER" ? "invalid-response" : error2.killed ? "timeout" : classifyCredentialStoreFailure("".concat(stdout, `
3516
- `).concat(stderr), failure2);
3459
+ const reason = error2.code === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER" ? "invalid-response" : error2.killed ? "timeout" : classifyCredentialStoreFailure("".concat(stdout, "\n").concat(stderr), failure2);
3517
3460
  reject(new CliCredentialStoreUnavailableError(product, reason));
3518
3461
  return;
3519
3462
  }
@@ -3521,19 +3464,7 @@ var getCliStorageError = __name2((error2) => {
3521
3464
  });
3522
3465
  child.stdin?.on("error", () => {
3523
3466
  }), child.stdin?.end(input);
3524
- }), "runBackend"), nativeWorker = `
3525
- try {
3526
- const { operation, input } = JSON.parse(await Bun.stdin.text());
3527
- const value = await Bun.secrets[operation](input);
3528
- process.stdout.write(JSON.stringify({ value: value ?? null }));
3529
- } catch (error) {
3530
- const message = error instanceof Error ? error.message : "Credential backend failed";
3531
- // libsecret's bus transport errors can omit the D-Bus context.
3532
- const context = process.platform === "linux" && /^Could not connect:/i.test(message) ? "D-Bus: " : "";
3533
- process.stderr.write(context + message);
3534
- process.exitCode = 1;
3535
- }
3536
- `, nativeResponse = object({ value: union([string2(), boolean2(), _null3()]) }).strict(), createIsolatedBunSecrets = __name2((product) => {
3467
+ }), "runBackend"), nativeWorker = '\ntry {\n const { operation, input } = JSON.parse(await Bun.stdin.text());\n const value = await Bun.secrets[operation](input);\n process.stdout.write(JSON.stringify({ value: value ?? null }));\n} catch (error) {\n const message = error instanceof Error ? error.message : "Credential backend failed";\n // libsecret\'s bus transport errors can omit the D-Bus context.\n const context = process.platform === "linux" && /^Could not connect:/i.test(message) ? "D-Bus: " : "";\n process.stderr.write(context + message);\n process.exitCode = 1;\n}\n', nativeResponse = object({ value: union([string2(), boolean2(), _null3()]) }).strict(), createIsolatedBunSecrets = __name2((product) => {
3537
3468
  const run = __name2(async (operation, input) => {
3538
3469
  assertBunRuntime();
3539
3470
  const output = await runBackend(product, process.execPath, ["--no-env-file", "--eval", nativeWorker], JSON.stringify({ operation, input }), operation === "set" ? "write-failed" : operation === "delete" ? "delete-failed" : "read-failed");
@@ -3795,7 +3726,9 @@ var normalizeCliAuthIssuer = __name2((value) => {
3795
3726
  });
3796
3727
  }, "logoutCliSession");
3797
3728
  import { readFileSync } from "fs";
3798
- var INVENTORY_SORT_IDS = ["itemCategory", "category", "supplier", "cost", "name", "createdAt", "updatedAt"], ITEM_CATEGORY_SORT_IDS = ["name", "itemCount", "createdAt", "createdBy"], EstimationMode = { MICRO: "MICRO", MANPOWER_SPECIFIED: "MANPOWER_SPECIFIED" }, ProjectStatus = { PITCH: "PITCH", WON: "WON", COMPLETED: "COMPLETED", RECONCILED: "RECONCILED", LOST: "LOST" }, BudgetStatus = { DRAFT: "DRAFT", PENDING_APPROVAL: "PENDING_APPROVAL", APPROVED: "APPROVED", REJECTED: "REJECTED", ESTIMATE_CREATED: "ESTIMATE_CREATED", ESTIMATE_SENT: "ESTIMATE_SENT", ESTIMATE_ACCEPTED: "ESTIMATE_ACCEPTED", ESTIMATE_REJECTED: "ESTIMATE_REJECTED", ESTIMATE_CLOSED: "ESTIMATE_CLOSED" }, ApprovalStatus = { PENDING_APPROVAL: "PENDING_APPROVAL", APPROVED: "APPROVED", REJECTED: "REJECTED", SUPERSEDED: "SUPERSEDED" }, ApprovalType = { BUDGET: "BUDGET", SUPPLIER: "SUPPLIER", BILL: "BILL", CUSTOMER_INVOICE: "CUSTOMER_INVOICE", QUOTATION: "QUOTATION" }, ErrorSeverity = { LOW: "LOW", MEDIUM: "MEDIUM", HIGH: "HIGH", CRITICAL: "CRITICAL" }, ErrorStatus = { UNRESOLVED: "UNRESOLVED", INVESTIGATING: "INVESTIGATING", RESOLVED: "RESOLVED", IGNORED: "IGNORED" }, CustomerInvoiceBatchStatus = { CREATING: "CREATING", PENDING_APPROVAL: "PENDING_APPROVAL", APPROVED: "APPROVED", REJECTED_VOIDED: "REJECTED_VOIDED", EXPIRED_VOIDED: "EXPIRED_VOIDED", PARTIAL_QBO_FAILURE: "PARTIAL_QBO_FAILURE" }, CustomerInvoiceStatus = { CREATED_IN_QBO: "CREATED_IN_QBO", APPROVED: "APPROVED", SENT: "SENT", PAID: "PAID", VOIDED: "VOIDED", QBO_SYNC_ERROR: "QBO_SYNC_ERROR" }, BillStatus = { DRAFT: "DRAFT", PENDING_APPROVAL: "PENDING_APPROVAL", CHECKED: "CHECKED", APPROVED: "APPROVED", PAID: "PAID", REJECTED: "REJECTED" }, ExtendedApprovalStatus = { ...ApprovalStatus, ALL: "ALL" }, ExtendedApprovalType = { ...ApprovalType, ALL: "ALL" }, ExtendedProjectStatus = { ...ProjectStatus, ALL: "ALL" }, ExtendedBudgetStatus = { ...BudgetStatus, ALL: "ALL" }, ExtendedBillStatus = { ...BillStatus, ALL: "ALL" }, ExtendedEstimationMode = { ...EstimationMode, ALL: "ALL" }, BudgetRole = { ALL: "ALL", BD: "BD", CREATOR: "CREATOR", INSIDE_SALES: "INSIDE_SALES" }, Deals = { ALL: "ALL", SUCCESSFUL: "SUCCESSFUL", LOST: "LOST" }, TimeFrame = { ALL: "ALL", LAST_YEAR: "LAST_YEAR", LAST_6_MONTHS: "LAST_6_MONTHS", LAST_3_MONTHS: "LAST_3_MONTHS", CUSTOM: "CUSTOM" }, ChartTimeFrame = { LAST_30_DAYS: "last_30_days", LAST_3_MONTHS: "last_3_months", LAST_6_MONTHS: "last_6_months", LAST_1_YEAR: "last_1_year", ALL_TIME: "all_time" }, ExtendedErrorSeverity = { ALL: "ALL", ...ErrorSeverity }, ExtendedErrorStatus = { ALL: "ALL", ...ErrorStatus }, cliQuietSession = !1, setCliQuiet = __name2((quiet) => {
3729
+ var INVENTORY_SORT_IDS = ["itemCategory", "category", "supplier", "cost", "name", "createdAt", "updatedAt"], ITEM_CATEGORY_SORT_IDS = ["name", "itemCount", "createdAt", "createdBy"], EstimationMode = { MICRO: "MICRO", MANPOWER_SPECIFIED: "MANPOWER_SPECIFIED" }, ProjectStatus = { PITCH: "PITCH", WON: "WON", COMPLETED: "COMPLETED", RECONCILED: "RECONCILED", LOST: "LOST" }, BudgetStatus = { DRAFT: "DRAFT", PENDING_APPROVAL: "PENDING_APPROVAL", APPROVED: "APPROVED", REJECTED: "REJECTED", ESTIMATE_CREATED: "ESTIMATE_CREATED", ESTIMATE_SENT: "ESTIMATE_SENT", ESTIMATE_ACCEPTED: "ESTIMATE_ACCEPTED", ESTIMATE_REJECTED: "ESTIMATE_REJECTED", ESTIMATE_CLOSED: "ESTIMATE_CLOSED" }, ApprovalStatus = { PENDING_APPROVAL: "PENDING_APPROVAL", APPROVED: "APPROVED", REJECTED: "REJECTED", SUPERSEDED: "SUPERSEDED" }, ApprovalType = { BUDGET: "BUDGET", SUPPLIER: "SUPPLIER", BILL: "BILL", CUSTOMER_INVOICE: "CUSTOMER_INVOICE", QUOTATION: "QUOTATION" }, ErrorSeverity = { LOW: "LOW", MEDIUM: "MEDIUM", HIGH: "HIGH",
3730
+ CRITICAL: "CRITICAL" }, ErrorStatus = { UNRESOLVED: "UNRESOLVED", INVESTIGATING: "INVESTIGATING", RESOLVED: "RESOLVED", IGNORED: "IGNORED" }, CustomerInvoiceBatchStatus = { CREATING: "CREATING", PENDING_APPROVAL: "PENDING_APPROVAL", APPROVED: "APPROVED", REJECTED_VOIDED: "REJECTED_VOIDED", EXPIRED_VOIDED: "EXPIRED_VOIDED", PARTIAL_QBO_FAILURE: "PARTIAL_QBO_FAILURE" }, CustomerInvoiceStatus = { CREATED_IN_QBO: "CREATED_IN_QBO", APPROVED: "APPROVED", SENT: "SENT", PAID: "PAID", VOIDED: "VOIDED", QBO_SYNC_ERROR: "QBO_SYNC_ERROR" }, BillStatus = { DRAFT: "DRAFT", PENDING_APPROVAL: "PENDING_APPROVAL", CHECKED: "CHECKED", APPROVED: "APPROVED", PAID: "PAID", REJECTED: "REJECTED" }, ExtendedApprovalStatus = { ...ApprovalStatus, ALL: "ALL" }, ExtendedApprovalType = { ...ApprovalType, ALL: "ALL" }, ExtendedProjectStatus = { ...ProjectStatus, ALL: "ALL" }, ExtendedBudgetStatus = { ...BudgetStatus, ALL: "ALL" }, ExtendedBillStatus = { ...BillStatus, ALL: "ALL" }, ExtendedEstimationMode = { ...EstimationMode,
3731
+ ALL: "ALL" }, BudgetRole = { ALL: "ALL", BD: "BD", CREATOR: "CREATOR", INSIDE_SALES: "INSIDE_SALES" }, Deals = { ALL: "ALL", SUCCESSFUL: "SUCCESSFUL", LOST: "LOST" }, TimeFrame = { ALL: "ALL", LAST_YEAR: "LAST_YEAR", LAST_6_MONTHS: "LAST_6_MONTHS", LAST_3_MONTHS: "LAST_3_MONTHS", CUSTOM: "CUSTOM" }, ChartTimeFrame = { LAST_30_DAYS: "last_30_days", LAST_3_MONTHS: "last_3_months", LAST_6_MONTHS: "last_6_months", LAST_1_YEAR: "last_1_year", ALL_TIME: "all_time" }, ExtendedErrorSeverity = { ALL: "ALL", ...ErrorSeverity }, ExtendedErrorStatus = { ALL: "ALL", ...ErrorStatus }, cliQuietSession = !1, setCliQuiet = __name2((quiet) => {
3799
3732
  cliQuietSession = quiet;
3800
3733
  }, "setCliQuiet"), isCliQuiet = __name2(() => cliQuietSession || process.env.BB_CLI_QUIET === "1", "isCliQuiet"), shouldLogCliActions = __name2(() => !isCliQuiet(), "shouldLogCliActions"), SENSITIVE_FLAG = /* @__PURE__ */ new Set(["payload", "apikey", "bb_api_key", "token", "password", "payment-proof", "paymentproof", "paymentreference", "receipt", "secret", "authorization"]), SENSITIVE_TRACE_FIELD = /* @__PURE__ */ new Set(["secret", "paymentproof", "paymentproofattachments", "paymentproofpath", "paymentreference", "proof", "receipt"]), isPresignedUrl = __name2((value) => typeof value == "string" && (new __cliRegExp("[?&]X-Amz-(?:Algorithm|Credential|Signature)=", "i").test(value) || new __cliRegExp("[?&]X-Goog-(?:Algorithm|Credential|Signature)=", "i").test(value)), "isPresignedUrl"), sanitizeValueForTrace = __name2(
3801
3734
  (value, seen = /* @__PURE__ */ new WeakSet()) => {
@@ -4572,11 +4505,7 @@ function constructPartsAndArgs(opts) {
4572
4505
  const [lightRegular, darkRegular] = palettes.ansi.regular[type], [lightBold, darkBold] = palettes.ansi.bold[type];
4573
4506
  parts.push(direction === "up" ? lightRegular : darkRegular, direction === "up" ? ">>" : "<<", type, direction === "up" ? lightBold : darkBold, "#".concat(id), path2, "\x1B[0m");
4574
4507
  } else {
4575
- const [light, dark] = palettes.css[type], css = `
4576
- background-color: #`.concat(direction === "up" ? light : dark, `;
4577
- color: `).concat(direction === "up" ? "black" : "white", `;
4578
- padding: 2px;
4579
- `);
4508
+ const [light, dark] = palettes.css[type], css = "\n background-color: #".concat(direction === "up" ? light : dark, ";\n color: ").concat(direction === "up" ? "black" : "white", ";\n padding: 2px;\n ");
4580
4509
  parts.push("%c", direction === "up" ? ">>" : "<<", type, "#".concat(id), "%c".concat(path2, "%c"), "%O"), args.push(css, "".concat(css, "; font-weight: bold;"), "".concat(css, "; font-weight: normal;"));
4581
4510
  }
4582
4511
  return direction === "up" ? args.push(withContext ? { input, context: opts.context } : { input }) : args.push(_objectSpread2(
@@ -4866,7 +4795,8 @@ var containsRawApiKey = __name2((value, seen = /* @__PURE__ */ new WeakSet()) =>
4866
4795
  return BUDGET_BUILDER_API_BASE_URL = normalized, activeClient = createBudgetBuilderClient(normalized), normalized;
4867
4796
  }, "configureBudgetBuilderApiBaseUrl"), configureBudgetBuilderAccessToken = __name2((accessToken) => {
4868
4797
  interactiveAccessToken = accessToken, activeClient = createBudgetBuilderClient(BUDGET_BUILDER_API_BASE_URL);
4869
- }, "configureBudgetBuilderAccessToken"), api2 = new Proxy({}, { get: __name2((_target, property, receiver) => Reflect.get(activeClient, property, receiver), "get") }), ProjectStatus2 = { PITCH: "PITCH", WON: "WON", COMPLETED: "COMPLETED", RECONCILED: "RECONCILED", LOST: "LOST" }, SupplierQuotationStatus = { DRAFT: "DRAFT", PENDING_APPROVAL: "PENDING_APPROVAL", APPROVED: "APPROVED", REJECTED: "REJECTED", SUPERSEDED: "SUPERSEDED" }, BudgetStatus2 = { DRAFT: "DRAFT", PENDING_APPROVAL: "PENDING_APPROVAL", APPROVED: "APPROVED", REJECTED: "REJECTED", ESTIMATE_CREATED: "ESTIMATE_CREATED", ESTIMATE_SENT: "ESTIMATE_SENT", ESTIMATE_ACCEPTED: "ESTIMATE_ACCEPTED", ESTIMATE_REJECTED: "ESTIMATE_REJECTED", ESTIMATE_CLOSED: "ESTIMATE_CLOSED" }, ApprovalStatus2 = { PENDING_APPROVAL: "PENDING_APPROVAL", APPROVED: "APPROVED", REJECTED: "REJECTED", SUPERSEDED: "SUPERSEDED" }, ApprovalType2 = { BUDGET: "BUDGET", SUPPLIER: "SUPPLIER", BILL: "BILL", CUSTOMER_INVOICE: "CUSTOMER_INVOICE", QUOTATION: "QUOTATION" }, UserRole = { USER: "USER", LEAD: "LEAD", ADMIN: "ADMIN", INSIDE_SALES: "INSIDE_SALES", ACCOUNTING_TEAM: "ACCOUNTING_TEAM" }, BillStatus2 = { DRAFT: "DRAFT", PENDING_APPROVAL: "PENDING_APPROVAL", CHECKED: "CHECKED", APPROVED: "APPROVED", PAID: "PAID", REJECTED: "REJECTED" }, BillVerificationStatus = { PENDING: "PENDING", PASS: "PASS", FAIL: "FAIL", MANUAL_REVIEW: "MANUAL_REVIEW" }, SupplierQuotationFileRole = { ORIGINAL: "ORIGINAL", STAFF_SIGNED: "STAFF_SIGNED", FINAL_SIGNED: "FINAL_SIGNED" }, InboundProcessingMode = { COLLECT_ONLY: "COLLECT_ONLY", SHADOW: "SHADOW", ACTIVE: "ACTIVE" }, AttachmentType = { GLOBAL_ATTACHMENT: "GLOBAL_ATTACHMENT", BUDGET: "BUDGET", BUDGET_WIN_PROOF: "BUDGET_WIN_PROOF", ITEM: "ITEM", SUPPLIER: "SUPPLIER", BILL: "BILL", BILL_PAYMENT_PROOF: "BILL_PAYMENT_PROOF", QUOTATION: "QUOTATION" };
4798
+ }, "configureBudgetBuilderAccessToken"), api2 = new Proxy({}, { get: __name2((_target, property, receiver) => Reflect.get(activeClient, property, receiver), "get") }), ProjectStatus2 = { PITCH: "PITCH", WON: "WON", COMPLETED: "COMPLETED", RECONCILED: "RECONCILED", LOST: "LOST" }, SupplierQuotationStatus = { DRAFT: "DRAFT", PENDING_APPROVAL: "PENDING_APPROVAL", APPROVED: "APPROVED", REJECTED: "REJECTED", SUPERSEDED: "SUPERSEDED" }, BudgetStatus2 = { DRAFT: "DRAFT", PENDING_APPROVAL: "PENDING_APPROVAL", APPROVED: "APPROVED", REJECTED: "REJECTED", ESTIMATE_CREATED: "ESTIMATE_CREATED", ESTIMATE_SENT: "ESTIMATE_SENT", ESTIMATE_ACCEPTED: "ESTIMATE_ACCEPTED", ESTIMATE_REJECTED: "ESTIMATE_REJECTED", ESTIMATE_CLOSED: "ESTIMATE_CLOSED" }, ApprovalStatus2 = { PENDING_APPROVAL: "PENDING_APPROVAL", APPROVED: "APPROVED", REJECTED: "REJECTED", SUPERSEDED: "SUPERSEDED" }, ApprovalType2 = { BUDGET: "BUDGET", SUPPLIER: "SUPPLIER", BILL: "BILL", CUSTOMER_INVOICE: "CUSTOMER_INVOICE", QUOTATION: "QUOTATION" },
4799
+ UserRole = { USER: "USER", LEAD: "LEAD", ADMIN: "ADMIN", INSIDE_SALES: "INSIDE_SALES", ACCOUNTING_TEAM: "ACCOUNTING_TEAM" }, BillStatus2 = { DRAFT: "DRAFT", PENDING_APPROVAL: "PENDING_APPROVAL", CHECKED: "CHECKED", APPROVED: "APPROVED", PAID: "PAID", REJECTED: "REJECTED" }, BillVerificationStatus = { PENDING: "PENDING", PASS: "PASS", FAIL: "FAIL", MANUAL_REVIEW: "MANUAL_REVIEW" }, SupplierQuotationFileRole = { ORIGINAL: "ORIGINAL", STAFF_SIGNED: "STAFF_SIGNED", FINAL_SIGNED: "FINAL_SIGNED" }, InboundProcessingMode = { COLLECT_ONLY: "COLLECT_ONLY", SHADOW: "SHADOW", ACTIVE: "ACTIVE" }, AttachmentType = { GLOBAL_ATTACHMENT: "GLOBAL_ATTACHMENT", BUDGET: "BUDGET", BUDGET_WIN_PROOF: "BUDGET_WIN_PROOF", ITEM: "ITEM", SUPPLIER: "SUPPLIER", BILL: "BILL", BILL_PAYMENT_PROOF: "BILL_PAYMENT_PROOF", QUOTATION: "QUOTATION" };
4870
4800
  import { randomUUID as randomUUID2 } from "crypto";
4871
4801
  import { readFile as readFile2, writeFile } from "fs/promises";
4872
4802
  import { basename } from "path";
@@ -5517,8 +5447,22 @@ function parseUpdateProjectPayload(raw) {
5517
5447
  let confirmEstimateInvalidation;
5518
5448
  if (typeof estimateInvalidation == "boolean") confirmEstimateInvalidation = estimateInvalidation;
5519
5449
  else if (estimateInvalidation != null) throw validationError("update-project payload.confirmEstimateInvalidation must be a boolean when set.");
5520
- const slackChannelId = optionalString(o.slackChannelId), slackChannelUrl = optionalString(o.slackChannelUrl), slackChannelName = optionalString(o.slackChannelName), slackPatch = slackChannelId !== void 0 && slackChannelUrl !== void 0 && slackChannelName !== void 0 ? { slackChannelId, slackChannelUrl, slackChannelName } : {};
5521
- return { id: requiredString(o.id, "update-project payload.id"), name: parseQuickBooksName(o.name), description: optionalString(o.description), companyId: requiredString(o.companyId, "update-project payload.companyId"), contactPersonId: requiredString(o.contactPersonId, "update-project payload.contactPersonId"), asanaTaskId: requiredString(o.asanaTaskId, "update-project payload.asanaTaskId"), insideSalesId: requiredString(o.insideSalesId, "update-project payload.insideSalesId"), businessDevelopmentId: requiredString(o.businessDevelopmentId, "update-project payload.businessDevelopmentId"), projectManagerId: optionalString(o.projectManagerId), venue: requiredString(o.venue, "update-project payload.venue"), pax: optionalString(o.pax), dateRange: { from: toDate(range.from, "dateRange.from"), to: range.to === void 0 || range.to === null ? void 0 : toDate(range.to, "dateRange.to") }, ...slackPatch, ...requestQboAccountantNotification !== void 0 && { requestQboAccountantNotification }, ...confirmEstimateInvalidation !== void 0 && { confirmEstimateInvalidation } };
5450
+ return {
5451
+ id: requiredString(o.id, "update-project payload.id"),
5452
+ name: parseQuickBooksName(o.name),
5453
+ description: optionalString(o.description),
5454
+ companyId: requiredString(o.companyId, "update-project payload.companyId"),
5455
+ contactPersonId: requiredString(o.contactPersonId, "update-project payload.contactPersonId"),
5456
+ asanaTaskId: requiredString(o.asanaTaskId, "update-project payload.asanaTaskId"),
5457
+ insideSalesId: requiredString(o.insideSalesId, "update-project payload.insideSalesId"),
5458
+ businessDevelopmentId: requiredString(o.businessDevelopmentId, "update-project payload.businessDevelopmentId"),
5459
+ projectManagerId: optionalString(o.projectManagerId),
5460
+ venue: requiredString(o.venue, "update-project payload.venue"),
5461
+ pax: optionalString(o.pax),
5462
+ dateRange: { from: toDate(range.from, "dateRange.from"), to: range.to === void 0 || range.to === null ? void 0 : toDate(range.to, "dateRange.to") },
5463
+ ...requestQboAccountantNotification !== void 0 && { requestQboAccountantNotification },
5464
+ ...confirmEstimateInvalidation !== void 0 && { confirmEstimateInvalidation }
5465
+ };
5522
5466
  }
5523
5467
  __name(parseUpdateProjectPayload, "parseUpdateProjectPayload"), __name2(parseUpdateProjectPayload, "parseUpdateProjectPayload");
5524
5468
  var parseQuickBooksName = __name2((value) => {
@@ -5557,7 +5501,9 @@ function parseContactUpdatePayload(raw) {
5557
5501
  }
5558
5502
  __name(parseContactUpdatePayload, "parseContactUpdatePayload"), __name2(parseContactUpdatePayload, "parseContactUpdatePayload");
5559
5503
  function parseCompanyUpdatePayload(raw) {
5560
- const input = requireObject(raw, "update-company payload"), billingEmails = parseCompanyBillingEmails(input.billingEmails);
5504
+ const input = requireObject(raw, "update-company payload"), billingEmails = parseCompanyBillingEmails(
5505
+ input.billingEmails
5506
+ );
5561
5507
  if (input.confirmDistinct !== void 0 && typeof input.confirmDistinct != "boolean") throw validationError("confirmDistinct must be a boolean.");
5562
5508
  return { id: requiredString(input.id, "id"), name: parseQuickBooksName(input.name), website: requiredString(input.website, "website"), ...input.confirmDistinct === void 0 ? {} : { confirmDistinct: input.confirmDistinct }, ...billingEmails === void 0 ? {} : { billingEmails } };
5563
5509
  }
@@ -5566,8 +5512,7 @@ var parseCompanyBillingEmails = __name2((raw) => {
5566
5512
  if (raw !== void 0) {
5567
5513
  if (!Array.isArray(raw) || raw.length > 50) throw validationError("billingEmails must be a JSON array of up to 50 email strings.");
5568
5514
  return raw.map((email2) => {
5569
- if (typeof email2 != "string")
5570
- throw validationError("billingEmails must contain only email strings.");
5515
+ if (typeof email2 != "string") throw validationError("billingEmails must contain only email strings.");
5571
5516
  return email2;
5572
5517
  });
5573
5518
  }
@@ -5584,8 +5529,7 @@ var parseCompanyBillingEmails = __name2((raw) => {
5584
5529
  case "financial-write":
5585
5530
  return permissions.allowFinancialWrite === !0;
5586
5531
  }
5587
- }, "isEffectAllowed"), uniqueEffects = __name2((effects) => [...new Set(effects)], "uniqueEffects"), getRequiredEffectPermissions = __name2((effects, permissions) => uniqueEffects(effects).filter((effect) => !isEffectAllowed(effect, permissions)), "getRequiredEffectPermissions"), formatConfirmationPreview = __name2((request) => ["Budget Builder workflow preview", "Action: ".concat(request.action), "Target: ".concat(request.target?.trim() || "not specified"), "Effects: ".concat(uniqueEffects(request.effects).map((effect) => effectLabels[effect]).join("; ") || "none"), ...request.details === void 0 ? [] : ["Details: ".concat(request.details)]].join(`
5588
- `), "formatConfirmationPreview"), confirmSensitiveCommand = __name2(async (runtime, request) => {
5532
+ }, "isEffectAllowed"), uniqueEffects = __name2((effects) => [...new Set(effects)], "uniqueEffects"), getRequiredEffectPermissions = __name2((effects, permissions) => uniqueEffects(effects).filter((effect) => !isEffectAllowed(effect, permissions)), "getRequiredEffectPermissions"), formatConfirmationPreview = __name2((request) => ["Budget Builder workflow preview", "Action: ".concat(request.action), "Target: ".concat(request.target?.trim() || "not specified"), "Effects: ".concat(uniqueEffects(request.effects).map((effect) => effectLabels[effect]).join("; ") || "none"), ...request.details === void 0 ? [] : ["Details: ".concat(request.details)]].join("\n"), "formatConfirmationPreview"), confirmSensitiveCommand = __name2(async (runtime, request) => {
5589
5533
  const requiredPermissions = getRequiredEffectPermissions(request.effects, request.permissions);
5590
5534
  if (request.effects.length === 0) return { confirmed: !0, requiredPermissions };
5591
5535
  const target = request.target?.trim();
@@ -5595,14 +5539,17 @@ var parseCompanyBillingEmails = __name2((raw) => {
5595
5539
  const missing = requiredPermissions.map((effect) => "--allow-".concat(effect));
5596
5540
  throw new CliRuntimeError("CONFIRMATION_REQUIRED", "Non-interactive sensitive commands require an explicit target and all applicable allow flags.", { details: { action: request.action, effects: requiredPermissions, missingFlags: missing } });
5597
5541
  }
5598
- if (requiredPermissions.length === 0) return { confirmed: !0, requiredPermissions };
5542
+ if (requiredPermissions.length === 0) return {
5543
+ confirmed: !0,
5544
+ requiredPermissions
5545
+ };
5599
5546
  const preview = formatConfirmationPreview(request);
5600
- if (runtime.stderr.write("".concat(preview, `
5601
- `)), runtime.prompt === void 0) throw new CliRuntimeError("CONFIRMATION_REQUIRED", "This command needs an interactive confirmation prompt.");
5547
+ if (runtime.stderr.write("".concat(preview, "\n")), runtime.prompt === void 0) throw new CliRuntimeError("CONFIRMATION_REQUIRED", "This command needs an interactive confirmation prompt.");
5602
5548
  if (await runtime.prompt("Type CONFIRM to continue: ") !== "CONFIRM") throw new CliRuntimeError("ABORTED", "Command aborted by user.");
5603
5549
  return { confirmed: !0, preview, requiredPermissions };
5604
- }, "confirmSensitiveCommand"), sensitiveKeys = /* @__PURE__ */ new Set(["apikey", "authorization", "bb_api_key", "password", "paymentproof", "paymentproofattachments", "paymentproofpath", "paymentreference", "payload", "proof", "receipt", "secret", "token"]), serialize = __name2((value) => "".concat(JSON.stringify(value, null, 2), `
5605
- `), "serialize"), createSuccessEnvelope = __name2((data, invocation) => ({ ok: !0, data, meta: { command: invocation.command, cliVersion: invocation.cliVersion, apiBaseUrl: invocation.apiBaseUrl } }), "createSuccessEnvelope"), emitCliSuccess = __name2((runtime, invocation, data) => (runtime.stdout.write(serialize(invocation.legacy ? data : createSuccessEnvelope(data, invocation))), 0), "emitCliSuccess"), emitCliError = __name2((runtime, invocation, error2) => {
5550
+ }, "confirmSensitiveCommand"), sensitiveKeys = /* @__PURE__ */ new Set(["apikey", "authorization", "bb_api_key", "password", "paymentproof", "paymentproofattachments", "paymentproofpath", "paymentreference", "payload", "proof", "receipt", "secret", "token"]), serialize = __name2((value) => "".concat(JSON.stringify(value, null, 2), "\n"), "serialize"), createSuccessEnvelope = __name2((data, invocation) => ({ ok: !0, data, meta: { command: invocation.command, cliVersion: invocation.cliVersion, apiBaseUrl: invocation.apiBaseUrl } }), "createSuccessEnvelope"), emitCliSuccess = __name2((runtime, invocation, data) => (runtime.stdout.write(serialize(
5551
+ invocation.legacy ? data : createSuccessEnvelope(data, invocation)
5552
+ )), 0), "emitCliSuccess"), emitCliError = __name2((runtime, invocation, error2) => {
5606
5553
  const normalized = normalizeCliError(error2);
5607
5554
  if (invocation.legacy) runtime.stderr.write(serialize({ error: normalized.message }));
5608
5555
  else {
@@ -5623,9 +5570,12 @@ var createProcessRuntime = __name2(() => ({ stdout: { write: __name2((value) =>
5623
5570
  } finally {
5624
5571
  prompt.close();
5625
5572
  }
5626
- }, "prompt"), now: __name2(() => /* @__PURE__ */ new Date(), "now") }), "createProcessRuntime"), activeSession, setActiveCliSession = __name2((session) => {
5627
- activeSession = { ...session, confirmedEffects: /* @__PURE__ */ new Set() };
5628
- }, "setActiveCliSession"), clearActiveCliSession = __name2(() => {
5573
+ }, "prompt"), now: __name2(() => /* @__PURE__ */ new Date(), "now") }), "createProcessRuntime"), activeSession, setActiveCliSession = __name2(
5574
+ (session) => {
5575
+ activeSession = { ...session, confirmedEffects: /* @__PURE__ */ new Set() };
5576
+ },
5577
+ "setActiveCliSession"
5578
+ ), clearActiveCliSession = __name2(() => {
5629
5579
  activeSession = void 0;
5630
5580
  }, "clearActiveCliSession"), getActiveCliSession = __name2(() => activeSession, "getActiveCliSession"), requireSession = __name2(() => {
5631
5581
  if (activeSession === void 0) throw new Error("Budget Builder CLI runtime session is not configured.");
@@ -5635,11 +5585,7 @@ var createProcessRuntime = __name2(() => ({ stdout: { write: __name2((value) =>
5635
5585
  return serialized === void 0 ? null : JSON.parse(serialized);
5636
5586
  }, "toJsonValue"), emitCommandResult = __name2((data) => {
5637
5587
  const session = requireSession();
5638
- return emitCliSuccess(
5639
- session.runtime,
5640
- session.invocation,
5641
- toJsonValue(data)
5642
- );
5588
+ return emitCliSuccess(session.runtime, session.invocation, toJsonValue(data));
5643
5589
  }, "emitCommandResult"), emitCommandError = __name2((error2) => {
5644
5590
  const session = requireSession();
5645
5591
  return emitCliError(session.runtime, session.invocation, error2);
@@ -5677,13 +5623,10 @@ var out = __name2((data) => {
5677
5623
  if (section.gid && ASANA_WON_LOST_SECTION_GIDS.has(section.gid)) return !0;
5678
5624
  const name = section.name?.trim().toLowerCase();
5679
5625
  return !!(name && new __cliRegExp("\\b(won|lost)\\b", "").test(name));
5680
- }), "isWonOrLostAsanaTask"), asanaCandidateFromTask = __name2(
5681
- (task, details) => {
5682
- const source = details ?? task, sourceRecord = isRecord2(source) ? source : void 0, gid = (sourceRecord ? stringField(sourceRecord, "gid") : void 0) ?? task.gid, name = (sourceRecord ? stringField(sourceRecord, "name") : void 0) ?? task.name ?? gid;
5683
- return !gid || isWonOrLostAsanaTask(source) ? null : { gid, name, modifiedAt: (sourceRecord ? stringField(sourceRecord, "modified_at") : void 0) ?? task.modified_at, createdAt: (sourceRecord ? stringField(sourceRecord, "created_at") : void 0) ?? task.created_at, sections: asanaSectionsForTask(source) };
5684
- },
5685
- "asanaCandidateFromTask"
5686
- ), uniqueSearchQueries = __name2((...queries) => {
5626
+ }), "isWonOrLostAsanaTask"), asanaCandidateFromTask = __name2((task, details) => {
5627
+ const source = details ?? task, sourceRecord = isRecord2(source) ? source : void 0, gid = (sourceRecord ? stringField(sourceRecord, "gid") : void 0) ?? task.gid, name = (sourceRecord ? stringField(sourceRecord, "name") : void 0) ?? task.name ?? gid;
5628
+ return !gid || isWonOrLostAsanaTask(source) ? null : { gid, name, modifiedAt: (sourceRecord ? stringField(sourceRecord, "modified_at") : void 0) ?? task.modified_at, createdAt: (sourceRecord ? stringField(sourceRecord, "created_at") : void 0) ?? task.created_at, sections: asanaSectionsForTask(source) };
5629
+ }, "asanaCandidateFromTask"), uniqueSearchQueries = __name2((...queries) => {
5687
5630
  const seen = /* @__PURE__ */ new Set(), unique = [];
5688
5631
  for (const query of queries) {
5689
5632
  const normalized = query?.trim() ?? "";
@@ -5714,13 +5657,10 @@ var out = __name2((data) => {
5714
5657
  const sectionText = candidate.sections.map((section) => section.name ?? section.gid).filter(Boolean).join(", ") || "stage unavailable", dateText = candidate.modifiedAt ? "modified ".concat(new Date(candidate.modifiedAt).toISOString()) : candidate.createdAt ? "created ".concat(new Date(candidate.createdAt).toISOString()) : "date unavailable";
5715
5658
  return "".concat(sectionText, "; ").concat(dateText, "; ").concat(candidate.gid);
5716
5659
  }, "formatAsanaCandidateMetadata"), promptForAsanaLeadCandidate = __name2(async (candidates) => {
5717
- if (candidates.length === 0) throw new Error("create-project requires an existing Asana deal task in the Deals project; none matched. For a new direct client, create the deal task using the website form first, then pass --asanaTaskId or --asanaSearch. The Slack channel comes from that task.");
5718
- if (!process.stdin.isTTY || !process.stderr.isTTY) throw new Error("create-project requires an existing Asana deal task: pass --asanaTaskId in non-interactive runs. Create the deal task using the website form first for a new direct client. The Slack channel comes from that task; interactive runs can choose from matching tasks.");
5660
+ if (candidates.length === 0) throw new Error("create-project requires an existing Asana deal task in the Deals project; none matched. For a new direct client, create the deal task using the website form first, then pass --asanaTaskId or --asanaSearch.");
5661
+ if (!process.stdin.isTTY || !process.stderr.isTTY) throw new Error("create-project requires an existing Asana deal task: pass --asanaTaskId in non-interactive runs. Create the deal task using the website form first for a new direct client. Interactive runs can choose from matching tasks.");
5719
5662
  console.error("Select the Asana lead task to link to this project:"), candidates.forEach((candidate, index) => {
5720
- console.error("".concat(index + 1, ". ").concat(candidate.name, " (").concat(
5721
- formatAsanaCandidateMetadata(candidate),
5722
- ")"
5723
- ));
5663
+ console.error("".concat(index + 1, ". ").concat(candidate.name, " (").concat(formatAsanaCandidateMetadata(candidate), ")"));
5724
5664
  });
5725
5665
  const rl = createInterface2({ input: process.stdin, output: process.stderr });
5726
5666
  try {
@@ -5737,19 +5677,7 @@ var out = __name2((data) => {
5737
5677
  } finally {
5738
5678
  rl.close();
5739
5679
  }
5740
- }, "promptForAsanaLeadCandidate"), resolveAsanaDealSlackChannel = __name2(async (asanaTaskId) => {
5741
- const result = await api2.asana.getDealSlackChannel.query({ id: asanaTaskId });
5742
- if (result.status !== "resolved") throw new Error(result.message);
5743
- return console.error("Resolved Slack channel from Asana deal: #".concat(result.channel.slackChannelName, " (").concat(result.channel.slackChannelId, ")")), result.channel;
5744
- }, "resolveAsanaDealSlackChannel"), resolveCreateProjectLinks = __name2(
5745
- async (opts) => {
5746
- const asanaTaskId = opts.asanaTaskId?.trim() || (await promptForAsanaLeadCandidate(await searchOpenAsanaLeadCandidates({ projectName: opts.name, searchQuery: opts.asanaSearch }))).gid;
5747
- if (opts.slackChannelId && opts.slackChannelUrl && opts.slackChannelName) return { asanaTaskId, slackChannelId: opts.slackChannelId, slackChannelUrl: opts.slackChannelUrl, slackChannelName: opts.slackChannelName };
5748
- const slackChannel = await resolveAsanaDealSlackChannel(asanaTaskId);
5749
- return { asanaTaskId, ...slackChannel };
5750
- },
5751
- "resolveCreateProjectLinks"
5752
- ), combineDateAndTime = __name2((day, time2) => {
5680
+ }, "promptForAsanaLeadCandidate"), resolveCreateProjectAsanaTaskId = __name2(async (opts) => opts.asanaTaskId?.trim() || (await promptForAsanaLeadCandidate(await searchOpenAsanaLeadCandidates({ projectName: opts.name, searchQuery: opts.asanaSearch }))).gid, "resolveCreateProjectAsanaTaskId"), combineDateAndTime = __name2((day, time2) => {
5753
5681
  const d = new Date(day);
5754
5682
  return d.setHours(time2.getHours(), time2.getMinutes(), time2.getSeconds(), 0), d;
5755
5683
  }, "combineDateAndTime"), formatOptionalProjectPaxInput = __name2((pax) => typeof pax != "number" || !Number.isFinite(pax) || pax <= 0 ? "" : String(pax), "formatOptionalProjectPaxInput"), contentTypeHeaderForFileName = __name2((fileName) => {
@@ -5775,8 +5703,7 @@ var out = __name2((data) => {
5775
5703
  throw new Error("Unsupported quotation attachment type: ".concat(fileName, ". Use PDF, JPEG, or PNG."));
5776
5704
  }, "quotationAttachmentContentTypeForFileName"), LOCKED_BUDGET_STATUSES_REQUIRING_CONFIRMATION = /* @__PURE__ */ new Set([BudgetStatus2.ESTIMATE_CREATED, BudgetStatus2.ESTIMATE_SENT, BudgetStatus2.ESTIMATE_ACCEPTED, BudgetStatus2.ESTIMATE_REJECTED, BudgetStatus2.ESTIMATE_CLOSED]), lockedBudgetStatusLabels = { ESTIMATE_CREATED: "Estimate Created", ESTIMATE_SENT: "Estimate Sent", ESTIMATE_ACCEPTED: "Estimate Accepted", ESTIMATE_REJECTED: "Estimate Rejected", ESTIMATE_CLOSED: "Estimate Closed" }, lockedBudgetStatusLabel = __name2((status) => status in lockedBudgetStatusLabels ? lockedBudgetStatusLabels[status] : status, "lockedBudgetStatusLabel"), buildSensitiveWorkflowPreview = __name2(({ action, entity, details }) => {
5777
5705
  const effects = details ?? "may change workflow state or send notifications";
5778
- return ["Budget Builder workflow preview", "Action: ".concat(action), "Target: ".concat(entity), "Effects: ".concat(effects)].join(`
5779
- `);
5706
+ return ["Budget Builder workflow preview", "Action: ".concat(action), "Target: ".concat(entity), "Effects: ".concat(effects)].join("\n");
5780
5707
  }, "buildSensitiveWorkflowPreview"), assertSensitiveWorkflowConfirmed = __name2(
5781
5708
  async (input) => {
5782
5709
  if (getActiveCliSession()?.invocation.legacy !== !0) {
@@ -5784,12 +5711,10 @@ var out = __name2((data) => {
5784
5711
  return;
5785
5712
  }
5786
5713
  const expected = "CONFIRM", preview = buildSensitiveWorkflowPreview(input);
5787
- if (!process.stdin.isTTY || !process.stderr.isTTY) throw new Error("".concat(preview, `
5788
- This is a sensitive workflow change. Run it in an interactive terminal only after the user explicitly confirms this exact action, then type "`).concat(expected, '" to continue.'));
5714
+ if (!process.stdin.isTTY || !process.stderr.isTTY) throw new Error("".concat(preview, '\nThis is a sensitive workflow change. Run it in an interactive terminal only after the user explicitly confirms this exact action, then type "').concat(expected, '" to continue.'));
5789
5715
  const rl = createInterface2({ input: process.stdin, output: process.stderr });
5790
5716
  try {
5791
- if ((await rl.question("".concat(preview, `
5792
- Confirm the user explicitly approved this exact action, then type "`).concat(expected, '" to continue: '))).trim() !== expected) throw new Error("Aborted.");
5717
+ if ((await rl.question("".concat(preview, '\nConfirm the user explicitly approved this exact action, then type "').concat(expected, '" to continue: '))).trim() !== expected) throw new Error("Aborted.");
5793
5718
  } finally {
5794
5719
  rl.close();
5795
5720
  }
@@ -5849,7 +5774,7 @@ var assertBudgetActionReadiness = __name2(async ({ budgetId, requireQuickbooksPr
5849
5774
  if (preflight && (preflight.company && await api2.company.updateCompany.mutate(preflight.company), preflight.contactPerson && await api2.contactPerson.updateContactPerson.mutate(preflight.contactPerson), preflight.eventDetails)) {
5850
5775
  const budget = await api2.budget.getBudget.query(
5851
5776
  { id: budgetId }
5852
- ), project = await api2.project.getProjectById.query({ id: budget.projectId }), day = new Date(preflight.eventDetails.date), start = new Date(preflight.eventDetails.startTime), end = new Date(preflight.eventDetails.endTime), payload = { id: project.id, name: project.name, description: project.description ?? void 0, dateRange: { from: combineDateAndTime(day, start), to: combineDateAndTime(day, end) }, companyId: project.companyId, contactPersonId: project.contactPersonId, asanaTaskId: project.asanaTaskId ?? "", insideSalesId: project.insideSalesId ?? "", businessDevelopmentId: project.businessDevelopmentId ?? "", venue: project.venue ?? "", pax: formatOptionalProjectPaxInput(project.pax), ...project.slackChannelId && project.slackChannelUrl && project.slackChannelName ? { slackChannelId: project.slackChannelId, slackChannelUrl: project.slackChannelUrl, slackChannelName: project.slackChannelName } : {} };
5777
+ ), project = await api2.project.getProjectById.query({ id: budget.projectId }), day = new Date(preflight.eventDetails.date), start = new Date(preflight.eventDetails.startTime), end = new Date(preflight.eventDetails.endTime), payload = { id: project.id, name: project.name, description: project.description ?? void 0, dateRange: { from: combineDateAndTime(day, start), to: combineDateAndTime(day, end) }, companyId: project.companyId, contactPersonId: project.contactPersonId, asanaTaskId: project.asanaTaskId ?? "", insideSalesId: project.insideSalesId ?? "", businessDevelopmentId: project.businessDevelopmentId ?? "", venue: project.venue ?? "", pax: formatOptionalProjectPaxInput(project.pax) };
5853
5778
  await updateProjectWithEstimateInvalidationConfirmation(payload);
5854
5779
  }
5855
5780
  }, "runBudgetPreflight"), listBills = __name2(async (input) => {
@@ -5871,7 +5796,9 @@ async function approveBill(billId, overBudgetOverrideReason) {
5871
5796
  const delivery = result.emailDelivery;
5872
5797
  email2 = createApprovalEmailDeliveryReport(delivery);
5873
5798
  } catch (error2) {
5874
- email2 = createApprovalEmailDeliveryFailure(error2 instanceof Error ? error2.message : String(error2));
5799
+ email2 = createApprovalEmailDeliveryFailure(error2 instanceof Error ? error2.message : String(
5800
+ error2
5801
+ ));
5875
5802
  }
5876
5803
  out({ ...result, email: email2 });
5877
5804
  }
@@ -5908,17 +5835,15 @@ var validateBillStatusUpdateOptions = __name2((opts) => {
5908
5835
  if (opts.status === BillStatus2.PAID && !opts.paymentReference?.trim()) throw new Error("update-bill-status requires --paymentReference when status is PAID.");
5909
5836
  if (opts.status !== BillStatus2.PAID && opts.paymentProofPath !== void 0) throw new Error("--paymentProof can only be used when status is PAID.");
5910
5837
  if (opts.paymentProofPath !== void 0 && !opts.paymentProofPath.trim()) throw new Error("--paymentProof requires a PDF file path.");
5911
- }, "validateBillStatusUpdateOptions"), deleteStagedPaymentProof = __name2(
5912
- async (projectId, key) => {
5913
- await api2.attachment.deleteStagedBillAttachments.mutate({ projectId, keys: [key] });
5914
- },
5915
- "deleteStagedPaymentProof"
5916
- ), rethrowAfterStagedPaymentProofCleanup = __name2(async (error2, cleanup) => {
5917
- if (cleanup) try {
5918
- await cleanup();
5919
- } catch (cleanupError) {
5920
- throw new AggregateError([error2, cleanupError], "Bill status update failed and its staged payment proof could not be cleaned up.");
5921
- }
5838
+ }, "validateBillStatusUpdateOptions"), deleteStagedPaymentProof = __name2(async (projectId, key) => {
5839
+ await api2.attachment.deleteStagedBillAttachments.mutate({ projectId, keys: [key] });
5840
+ }, "deleteStagedPaymentProof"), rethrowAfterStagedPaymentProofCleanup = __name2(async (error2, cleanup) => {
5841
+ if (cleanup)
5842
+ try {
5843
+ await cleanup();
5844
+ } catch (cleanupError) {
5845
+ throw new AggregateError([error2, cleanupError], "Bill status update failed and its staged payment proof could not be cleaned up.");
5846
+ }
5922
5847
  throw error2;
5923
5848
  }, "rethrowAfterStagedPaymentProofCleanup"), stageBillPaymentProof = __name2(async (projectId, filePath) => {
5924
5849
  const buffer = await readFile2(filePath), fileName = basename(filePath), size = buffer.byteLength, contentType2 = billAttachmentContentTypeForFileName(fileName);
@@ -5943,7 +5868,15 @@ async function updateBillStatus(opts) {
5943
5868
  validateBillStatusUpdateOptions(opts), await assertSensitiveWorkflowConfirmed({ action: "Update bill status", entity: "bill ".concat(opts.id), details: "to ".concat(opts.status) });
5944
5869
  const bill = opts.paymentProofPath ? await api2.bill.getPayment.query({ id: opts.id }) : null, paymentProof = bill && opts.paymentProofPath ? await stageBillPaymentProof(bill.projectId, opts.paymentProofPath) : void 0;
5945
5870
  try {
5946
- const result = await api2.bill.updateStatus.mutate({ id: opts.id, status: opts.status, rejectionReason: opts.rejectionReason, paymentTrackingUrl: opts.paymentTrackingUrl, paymentReference: opts.paymentReference, paymentProofAttachments: paymentProof ? [paymentProof] : void 0, overBudgetOverrideReason: opts.overBudgetOverrideReason });
5871
+ const result = await api2.bill.updateStatus.mutate({
5872
+ id: opts.id,
5873
+ status: opts.status,
5874
+ rejectionReason: opts.rejectionReason,
5875
+ paymentTrackingUrl: opts.paymentTrackingUrl,
5876
+ paymentReference: opts.paymentReference,
5877
+ paymentProofAttachments: paymentProof ? [paymentProof] : void 0,
5878
+ overBudgetOverrideReason: opts.overBudgetOverrideReason
5879
+ });
5947
5880
  out(result);
5948
5881
  } catch (error2) {
5949
5882
  await rethrowAfterStagedPaymentProofCleanup(error2, bill && paymentProof ? async () => {
@@ -5957,7 +5890,10 @@ var listExternalBillPaymentAccounts = __name2(async () => {
5957
5890
  }, "listExternalBillPaymentAccounts"), refreshExternalBillPaymentAccounts = __name2(async () => {
5958
5891
  await confirmCurrentCommand({ action: "refresh QuickBooks payment accounts", target: "the cached external payment-account list", effects: ["state-change"], details: "Queue a read of QuickBooks bank and credit-card accounts; nothing is written to QuickBooks." }), out(await api2.bill.refreshExternalPaymentAccounts.mutate());
5959
5892
  }, "refreshExternalBillPaymentAccounts"), recordExternalBillPayment = __name2(async (opts) => {
5960
- if (!opts.paymentReference.trim() || !opts.paymentAccount.trim() || !new __cliRegExp("^\\d{4}-\\d{2}-\\d{2}$", "").test(opts.paymentDate) || new Date("".concat(opts.paymentDate, "T00:00:00Z")).toISOString().slice(0, 10) !== opts.paymentDate) throw new Error("Supply --paymentReference, --paymentDate YYYY-MM-DD, and --paymentAccount <QBO account ID>.");
5893
+ if (!opts.paymentReference.trim() || !opts.paymentAccount.trim() || !new __cliRegExp(
5894
+ "^\\d{4}-\\d{2}-\\d{2}$",
5895
+ ""
5896
+ ).test(opts.paymentDate) || new Date("".concat(opts.paymentDate, "T00:00:00Z")).toISOString().slice(0, 10) !== opts.paymentDate) throw new Error("Supply --paymentReference, --paymentDate YYYY-MM-DD, and --paymentAccount <QBO account ID>.");
5961
5897
  await assertSensitiveWorkflowConfirmed({ action: "Record external payment (no email)", entity: "bill ".concat(opts.id), details: "already paid on ".concat(opts.paymentDate, "; reference ").concat(opts.paymentReference, "; QBO account ").concat(opts.paymentAccount, ". No money is transferred.") });
5962
5898
  const bill = await api2.bill.getPayment.query({ id: opts.id }), proof = !bill.externalPayment && opts.paymentProofPath ? await stageBillPaymentProof(bill.projectId, opts.paymentProofPath) : void 0;
5963
5899
  try {
@@ -5998,7 +5934,9 @@ var getBillAttachments = __name2(async (input) => {
5998
5934
  async function stageBillAttachmentsFromPaths(projectId, filePaths) {
5999
5935
  const attachments = [];
6000
5936
  for (const filePath of filePaths) {
6001
- const buffer = await readFile2(filePath), fileName = basename(filePath), size = buffer.byteLength, contentType2 = billAttachmentContentTypeForFileName(fileName), { uploadUrl, key } = await api2.attachment.requestStagedBillAttachmentUpload.mutate({ projectId, fileName, size, contentType: contentType2 }), response = await fetch(uploadUrl, { method: "PUT", body: buffer, headers: { "Content-Type": contentType2 } });
5937
+ const buffer = await readFile2(filePath), fileName = basename(filePath), size = buffer.byteLength, contentType2 = billAttachmentContentTypeForFileName(
5938
+ fileName
5939
+ ), { uploadUrl, key } = await api2.attachment.requestStagedBillAttachmentUpload.mutate({ projectId, fileName, size, contentType: contentType2 }), response = await fetch(uploadUrl, { method: "PUT", body: buffer, headers: { "Content-Type": contentType2 } });
6002
5940
  if (!response.ok) throw new Error("S3 upload failed: HTTP ".concat(response.status, " ").concat((await response.text()).slice(0, 500)));
6003
5941
  attachments.push({ id: randomUUID2(), key, name: fileName, size });
6004
5942
  }
@@ -6022,7 +5960,11 @@ var uploadSingleBillAttachmentFromPath = __name2(async (billId, filePath, type =
6022
5960
  async function uploadBillAttachmentsFromPaths(billId, filePaths, type = AttachmentType.BILL) {
6023
5961
  if (filePaths.length === 0) throw new Error("At least one bill attachment file path is required");
6024
5962
  const results = [];
6025
- for (const filePath of filePaths) results.push(await uploadSingleBillAttachmentFromPath(billId, filePath, type));
5963
+ for (const filePath of filePaths) results.push(await uploadSingleBillAttachmentFromPath(
5964
+ billId,
5965
+ filePath,
5966
+ type
5967
+ ));
6026
5968
  out({ success: !0, billId, type, count: results.length, attachments: results.map((result) => result.attachment), results });
6027
5969
  }
6028
5970
  __name(uploadBillAttachmentsFromPaths, "uploadBillAttachmentsFromPaths"), __name2(uploadBillAttachmentsFromPaths, "uploadBillAttachmentsFromPaths");
@@ -6032,7 +5974,10 @@ async function uploadBillDocumentsFromPaths({ billId, invoicePaths = [], payment
6032
5974
  for (const filePath of invoicePaths) invoiceResults.push(await uploadSingleBillAttachmentFromPath(billId, filePath, AttachmentType.BILL));
6033
5975
  const paymentProofResults = [];
6034
5976
  for (const filePath of paymentProofPaths) paymentProofResults.push(await uploadSingleBillAttachmentFromPath(billId, filePath, AttachmentType.BILL_PAYMENT_PROOF));
6035
- out({ success: !0, billId, count: invoiceResults.length + paymentProofResults.length, invoiceAttachments: invoiceResults.map((result) => result.attachment), paymentProofAttachments: paymentProofResults.map((result) => result.attachment), results: [...invoiceResults, ...paymentProofResults] });
5977
+ out({ success: !0, billId, count: invoiceResults.length + paymentProofResults.length, invoiceAttachments: invoiceResults.map((result) => result.attachment), paymentProofAttachments: paymentProofResults.map((result) => result.attachment), results: [
5978
+ ...invoiceResults,
5979
+ ...paymentProofResults
5980
+ ] });
6036
5981
  }
6037
5982
  __name(uploadBillDocumentsFromPaths, "uploadBillDocumentsFromPaths"), __name2(uploadBillDocumentsFromPaths, "uploadBillDocumentsFromPaths");
6038
5983
  async function uploadQuotationAttachmentFromPath(projectId, filePath) {
@@ -6050,10 +5995,10 @@ var cleanupStagedQuotationAttachments = __name2(async (projectId, keys) => {
6050
5995
  async function uploadBudgetAttachmentFromPath(budgetId, filePath) {
6051
5996
  await confirmLockedBudgetChangeByBudgetId(budgetId, "Upload budget attachment");
6052
5997
  const buf = await readFile2(filePath), fileName = basename(filePath), size = buf.byteLength, attachmentContentType = attachmentContentTypeForFileName(fileName), { uploadUrl, key } = await api2.attachment.requestBudgetAttachmentUpload.mutate({ budgetId, contentType: attachmentContentType, fileName, size }), res = await fetch(uploadUrl, { method: "PUT", body: buf, headers: { "Content-Type": attachmentContentType } });
6053
- if (!res.ok) throw new Error(
6054
- "S3 upload failed: HTTP ".concat(res.status, " ").concat((await res.text()).slice(0, 500))
5998
+ if (!res.ok) throw new Error("S3 upload failed: HTTP ".concat(res.status, " ").concat((await res.text()).slice(0, 500)));
5999
+ const confirmed = await api2.attachment.confirmBudgetAttachment.mutate(
6000
+ { budgetId, key, name: fileName, size }
6055
6001
  );
6056
- const confirmed = await api2.attachment.confirmBudgetAttachment.mutate({ budgetId, key, name: fileName, size });
6057
6002
  out(confirmed);
6058
6003
  }
6059
6004
  __name(uploadBudgetAttachmentFromPath, "uploadBudgetAttachmentFromPath"), __name2(uploadBudgetAttachmentFromPath, "uploadBudgetAttachmentFromPath");
@@ -6061,7 +6006,12 @@ async function uploadBudgetWinProofFromPath(budgetId, filePath, opts) {
6061
6006
  await assertSensitiveWorkflowConfirmed({ action: "Mark budget won", entity: "budget ".concat(budgetId), details: "by uploading proof and setting status to ESTIMATE_ACCEPTED" }), await confirmLockedBudgetChangeByBudgetId(budgetId, "Mark budget won");
6062
6007
  const buf = await readFile2(filePath), fileName = basename(filePath), size = buf.byteLength, attachmentContentType = attachmentContentTypeForFileName(fileName), { uploadUrl, key } = await api2.attachment.requestBudgetWinProofUpload.mutate({ budgetId, contentType: attachmentContentType, fileName, size }), res = await fetch(uploadUrl, { method: "PUT", body: buf, headers: { "Content-Type": attachmentContentType } });
6063
6008
  if (!res.ok) throw new Error("S3 upload failed: HTTP ".concat(res.status, " ").concat((await res.text()).slice(0, 500)));
6064
- await api2.attachment.confirmBudgetWinProofAttachment.mutate({ budgetId, key, name: fileName, size });
6009
+ await api2.attachment.confirmBudgetWinProofAttachment.mutate({
6010
+ budgetId,
6011
+ key,
6012
+ name: fileName,
6013
+ size
6014
+ });
6065
6015
  const result = await api2.budget.updateBudgetStatus.mutate({ id: budgetId, status: BudgetStatus2.ESTIMATE_ACCEPTED, ...opts?.projectManagerId !== void 0 && { projectManagerId: opts.projectManagerId }, ...opts?.markProjectWon !== void 0 && { markProjectWon: opts.markProjectWon }, ...opts?.projectInvoiceSettings !== void 0 && { projectInvoiceSettings: opts.projectInvoiceSettings } });
6066
6016
  out({ ...result, invoiceSetup: result.hasQuickbooksEstimate ? invoiceSplitSetupNextAction(budgetId) : null });
6067
6017
  }
@@ -6074,10 +6024,7 @@ async function getBillDetails(id) {
6074
6024
  const result = await api2.bill.getById.query({ id });
6075
6025
  out(result);
6076
6026
  }
6077
- __name(getBillDetails, "getBillDetails"), __name2(
6078
- getBillDetails,
6079
- "getBillDetails"
6080
- );
6027
+ __name(getBillDetails, "getBillDetails"), __name2(getBillDetails, "getBillDetails");
6081
6028
  async function getBudgetItemsOnly(budgetId, opts) {
6082
6029
  const includeInactive = opts?.includeInactive ?? !1, [items, totals] = await Promise.all([api2.budget.getBudgetItems.query({ budgetId, includeInactive }), api2.budget.getBudgetItemTotals.query({ budgetId, includeInactive })]);
6083
6030
  out({ ...items, totals });
@@ -6096,7 +6043,10 @@ async function updateBudgetItem(input) {
6096
6043
  }
6097
6044
  __name(updateBudgetItem, "updateBudgetItem"), __name2(updateBudgetItem, "updateBudgetItem");
6098
6045
  async function removeBudgetItem(budgetItemId) {
6099
- await confirmLockedBudgetChangeByBudgetItemId(budgetItemId, "Remove budget item");
6046
+ await confirmLockedBudgetChangeByBudgetItemId(
6047
+ budgetItemId,
6048
+ "Remove budget item"
6049
+ );
6100
6050
  const result = await api2.budgetItem.removeBudgetItem.mutate({ budgetItemId });
6101
6051
  out(result);
6102
6052
  }
@@ -6124,11 +6074,7 @@ var replaceBudgetItem = __name2(async (input) => {
6124
6074
  out({ versions, nextCursor: cursor ?? null });
6125
6075
  }, "getBudgetVersions");
6126
6076
  async function createBudgetApproval(budgetId, preflight) {
6127
- await assertSensitiveWorkflowConfirmed({ action: "Create budget approval request", entity: "budget ".concat(budgetId), details: "and send approval request emails" }), await confirmLockedBudgetChangeByBudgetId(budgetId, "Create budget approval"), await runBudgetPreflight(budgetId, preflight), await assertBudgetActionReadiness({
6128
- budgetId,
6129
- requireQuickbooksProject: !1,
6130
- actionLabel: "request approval"
6131
- });
6077
+ await assertSensitiveWorkflowConfirmed({ action: "Create budget approval request", entity: "budget ".concat(budgetId), details: "and send approval request emails" }), await confirmLockedBudgetChangeByBudgetId(budgetId, "Create budget approval"), await runBudgetPreflight(budgetId, preflight), await assertBudgetActionReadiness({ budgetId, requireQuickbooksProject: !1, actionLabel: "request approval" });
6132
6078
  const result = await api2.budget.createBudgetApproval.mutate({ budgetId }), approvalIds = (result.results ?? []).map((item) => ({ id: item.id }));
6133
6079
  let email2;
6134
6080
  if (approvalIds.length === 0) email2 = createApprovalEmailDeliveryFailure("No approval ids returned");
@@ -6164,7 +6110,10 @@ async function createBudgetFromPayload(raw) {
6164
6110
  try {
6165
6111
  result = await api2.budget.createBudget.mutate(input);
6166
6112
  } catch (error2) {
6167
- throw budgetCreateUncertainError(error2, input) || error2;
6113
+ throw budgetCreateUncertainError(
6114
+ error2,
6115
+ input
6116
+ ) || error2;
6168
6117
  }
6169
6118
  out(result);
6170
6119
  }
@@ -6243,10 +6192,7 @@ var deleteBudgetDiscount = __name2(async (budgetId) => {
6243
6192
  out(result);
6244
6193
  }, "deleteBudgetCommission"), setBudgetItemsNotUtilized = __name2(async (budgetItemIds, notUtilized) => {
6245
6194
  await assertSensitiveWorkflowConfirmed({ action: notUtilized ? "Mark budget lines Not Utilized" : "Restore budget line", entity: "budget item".concat(budgetItemIds.length === 1 ? "" : "s", " ").concat(budgetItemIds.join(", ")), details: notUtilized ? "and queue removal of linked QuickBooks placeholder expenses" : "and queue restoring its QuickBooks placeholder expense when required" });
6246
- const result = await api2.budget.setBudgetItemsNotUtilized.mutate({
6247
- budgetItemIds,
6248
- notUtilized
6249
- });
6195
+ const result = await api2.budget.setBudgetItemsNotUtilized.mutate({ budgetItemIds, notUtilized });
6250
6196
  out(result);
6251
6197
  }, "setBudgetItemsNotUtilized"), createPlaceholderBillForBudgetItem = __name2(async (budgetItemId) => {
6252
6198
  await assertSensitiveWorkflowConfirmed({ action: "Queue QuickBooks placeholder bill", entity: "budget item ".concat(budgetItemId) });
@@ -6324,17 +6270,17 @@ async function createBillFromPayload(raw, draftOnlyFlag, quotationExempt = !1) {
6324
6270
  __name(createBillFromPayload, "createBillFromPayload"), __name2(createBillFromPayload, "createBillFromPayload");
6325
6271
  var listQuotations = __name2(async (input) => {
6326
6272
  out(await api2.quotation.listPage.query(input));
6327
- }, "listQuotations"), countQuotations = __name2(
6328
- async (input) => {
6329
- out(await api2.quotation.getCounts.query(input));
6330
- },
6331
- "countQuotations"
6332
- );
6273
+ }, "listQuotations"), countQuotations = __name2(async (input) => {
6274
+ out(await api2.quotation.getCounts.query(input));
6275
+ }, "countQuotations");
6333
6276
  async function getQuotationDetails(id) {
6334
6277
  const result = await api2.quotation.getById.query({ id });
6335
6278
  out(result);
6336
6279
  }
6337
- __name(getQuotationDetails, "getQuotationDetails"), __name2(getQuotationDetails, "getQuotationDetails");
6280
+ __name(getQuotationDetails, "getQuotationDetails"), __name2(
6281
+ getQuotationDetails,
6282
+ "getQuotationDetails"
6283
+ );
6338
6284
  var getQuotationLineItems = __name2(async (input) => {
6339
6285
  out(await api2.quotation.getLineItems.query(input));
6340
6286
  }, "getQuotationLineItems");
@@ -6355,7 +6301,10 @@ async function submitQuotation(id, overBudgetOverrideReason) {
6355
6301
  const result = await api2.quotation.submitForApproval.mutate({ id, overBudgetOverrideReason });
6356
6302
  out(result);
6357
6303
  }
6358
- __name(submitQuotation, "submitQuotation"), __name2(submitQuotation, "submitQuotation");
6304
+ __name(submitQuotation, "submitQuotation"), __name2(
6305
+ submitQuotation,
6306
+ "submitQuotation"
6307
+ );
6359
6308
  async function downloadQuotationPdf(id, fileRole) {
6360
6309
  const result = await api2.quotation.getSignedDownloadUrl.query({ id, fileRole });
6361
6310
  out(result);
@@ -6371,13 +6320,10 @@ var checkCustomerInvoiceReadiness = __name2(async (budgetId) => {
6371
6320
  }, "countCustomerInvoices"), listEligibleCustomerInvoiceBudgets = __name2(async (projectId) => {
6372
6321
  const result = await api2.customerInvoice.getEligibleBudgets.query({ projectId });
6373
6322
  out(result);
6374
- }, "listEligibleCustomerInvoiceBudgets"), previewCustomerInvoiceAmount = __name2(
6375
- async (budgetId, percentage) => {
6376
- const result = await api2.customerInvoice.getInvoiceAmountPreview.query({ budgetId, percentage });
6377
- out(result);
6378
- },
6379
- "previewCustomerInvoiceAmount"
6380
- ), listAvailableQboCustomerInvoices = __name2(async (budgetId) => {
6323
+ }, "listEligibleCustomerInvoiceBudgets"), previewCustomerInvoiceAmount = __name2(async (budgetId, percentage) => {
6324
+ const result = await api2.customerInvoice.getInvoiceAmountPreview.query({ budgetId, percentage });
6325
+ out(result);
6326
+ }, "previewCustomerInvoiceAmount"), listAvailableQboCustomerInvoices = __name2(async (budgetId) => {
6381
6327
  const result = await api2.customerInvoice.getExistingInvoiceCandidates.query({ budgetId });
6382
6328
  out(result);
6383
6329
  }, "listAvailableQboCustomerInvoices"), getCustomerInvoice = __name2(async (batchId) => {
@@ -6399,25 +6345,19 @@ var checkCustomerInvoiceReadiness = __name2(async (budgetId) => {
6399
6345
  }, "getCustomerInvoiceEmailContext"), previewQboCustomerInvoice = __name2(async (input) => {
6400
6346
  const result = await api2.customerInvoice.previewExistingInvoice.mutate(input);
6401
6347
  out(result);
6402
- }, "previewQboCustomerInvoice"), importQboCustomerInvoice = __name2(
6403
- async (input) => {
6404
- await confirmCurrentCommand({ action: "Link existing QuickBooks invoice", target: "QuickBooks invoice ".concat(input.qboInvoiceId, " to budget ").concat(input.budgetId), details: "records the reviewed invoice in Budget Builder only; QuickBooks access is read-only; preserves original evidence and revalidates the preview token" });
6405
- const result = await api2.customerInvoice.linkExistingInvoice.mutate(input);
6406
- out(result);
6407
- },
6408
- "importQboCustomerInvoice"
6409
- ), createCustomerInvoice = __name2(async (raw) => {
6348
+ }, "previewQboCustomerInvoice"), importQboCustomerInvoice = __name2(async (input) => {
6349
+ await confirmCurrentCommand({ action: "Link existing QuickBooks invoice", target: "QuickBooks invoice ".concat(input.qboInvoiceId, " to budget ").concat(input.budgetId), details: "records the reviewed invoice in Budget Builder only; QuickBooks access is read-only; preserves original evidence and revalidates the preview token" });
6350
+ const result = await api2.customerInvoice.linkExistingInvoice.mutate(input);
6351
+ out(result);
6352
+ }, "importQboCustomerInvoice"), createCustomerInvoice = __name2(async (raw) => {
6410
6353
  const input = parseCreateCustomerInvoicePayload(raw), readiness = await api2.customerInvoice.getInvoiceReadiness.query({ budgetId: input.budgetId, includePreview: !0 });
6411
6354
  if (!readiness.ready) throw new CliRuntimeError("VALIDATION", readiness.issues.join("; ") || "Invoice is not ready for creation.");
6412
6355
  await assertSensitiveWorkflowConfirmed({ action: "Create customer invoice", entity: "budget ".concat(input.budgetId), details: "queues ".concat(input.splits.length, " invoice(s) for creation in QuickBooks from the budget's remaining uninvoiced balance: ").concat(input.splits.map((split) => "".concat(split.label, " (").concat(split.percentage, "% of the estimate), due ").concat(new Date(split.dueDate).toISOString().slice(0, 10))).join("; "), ". Admin creation is auto-approved; other creators request approval. No customer email is sent.") });
6413
6356
  const result = await api2.customerInvoice.createInvoiceBatch.mutate(input);
6414
6357
  out(result);
6415
- }, "createCustomerInvoice"), resubmitCustomerInvoice = __name2(
6416
- async (batchId) => {
6417
- await assertSensitiveWorkflowConfirmed({ action: "Resubmit expired customer invoice", entity: "invoice batch ".concat(batchId), details: "queues one replacement QuickBooks invoice after confirmed expiry voiding, using the current estimate and the original percentage, due date and details; only the original requester may resubmit; no customer email is sent" }), out(await api2.customerInvoice.resubmitInvoiceBatch.mutate({ batchId }));
6418
- },
6419
- "resubmitCustomerInvoice"
6420
- ), discardCreatingCustomerInvoice = __name2(async (batchId) => {
6358
+ }, "createCustomerInvoice"), resubmitCustomerInvoice = __name2(async (batchId) => {
6359
+ await assertSensitiveWorkflowConfirmed({ action: "Resubmit expired customer invoice", entity: "invoice batch ".concat(batchId), details: "queues one replacement QuickBooks invoice after confirmed expiry voiding, using the current estimate and the original percentage, due date and details; only the original requester may resubmit; no customer email is sent" }), out(await api2.customerInvoice.resubmitInvoiceBatch.mutate({ batchId }));
6360
+ }, "resubmitCustomerInvoice"), discardCreatingCustomerInvoice = __name2(async (batchId) => {
6421
6361
  await assertSensitiveWorkflowConfirmed({ action: "Discard unfinished customer invoice", entity: "invoice batch ".concat(batchId), details: "removes only a reserved CREATING batch that has no invoice created in QuickBooks" });
6422
6362
  const result = await api2.customerInvoice.discardCreatingInvoiceBatch.mutate({ batchId });
6423
6363
  out(result);
@@ -6468,10 +6408,13 @@ async function updateBillFromPayload(raw) {
6468
6408
  out(result);
6469
6409
  }
6470
6410
  __name(updateBillFromPayload, "updateBillFromPayload"), __name2(updateBillFromPayload, "updateBillFromPayload");
6471
- var validateBillSelectionFromPayload = __name2(async (raw, quotationFlags) => {
6472
- const input = parseValidateBillSelectionPayload(raw, quotationFlags), result = await api2.bill.validateSelection.mutate(input);
6473
- out(result);
6474
- }, "validateBillSelectionFromPayload"), linkBillQuotations = __name2(async (billId, raw) => {
6411
+ var validateBillSelectionFromPayload = __name2(
6412
+ async (raw, quotationFlags) => {
6413
+ const input = parseValidateBillSelectionPayload(raw, quotationFlags), result = await api2.bill.validateSelection.mutate(input);
6414
+ out(result);
6415
+ },
6416
+ "validateBillSelectionFromPayload"
6417
+ ), linkBillQuotations = __name2(async (billId, raw) => {
6475
6418
  const input = parseLinkBillQuotationsPayload(billId, raw), result = await api2.bill.linkQuotations.mutate(input);
6476
6419
  out(result);
6477
6420
  }, "linkBillQuotations"), updateBillPaymentEvidenceFromPayload = __name2(async (raw) => {
@@ -6537,7 +6480,10 @@ async function createContactPersonFromPayload(raw) {
6537
6480
  const input = parseContactCreatePayload(raw), result = await api2.contactPerson.createContactPerson.mutate(input);
6538
6481
  out(result);
6539
6482
  }
6540
- __name(createContactPersonFromPayload, "createContactPersonFromPayload"), __name2(createContactPersonFromPayload, "createContactPersonFromPayload");
6483
+ __name(createContactPersonFromPayload, "createContactPersonFromPayload"), __name2(
6484
+ createContactPersonFromPayload,
6485
+ "createContactPersonFromPayload"
6486
+ );
6541
6487
  async function updateContactPersonFromPayload(raw) {
6542
6488
  const input = parseContactUpdatePayload(raw), result = await api2.contactPerson.updateContactPerson.mutate(input);
6543
6489
  out(result);
@@ -6573,9 +6519,10 @@ async function approveBudget(budgetId) {
6573
6519
  }
6574
6520
  __name(approveBudget, "approveBudget"), __name2(approveBudget, "approveBudget");
6575
6521
  async function rejectBudget(budgetId, reason) {
6576
- await assertSensitiveWorkflowConfirmed(
6577
- { action: "Reject budget", entity: "budget ".concat(budgetId), details: 'with reason "'.concat(reason, '" and send requester reply email') }
6578
- );
6522
+ await assertSensitiveWorkflowConfirmed({ action: "Reject budget", entity: "budget ".concat(budgetId), details: 'with reason "'.concat(
6523
+ reason,
6524
+ '" and send requester reply email'
6525
+ ) });
6579
6526
  const approval = (await getAllNotifications()).filter((n) => n.notificationType === "request" && n.status === ExtendedApprovalStatus.PENDING_APPROVAL && n.type === ExtendedApprovalType.BUDGET && (n.budgetId === budgetId || n.budget?.id === budgetId))[0];
6580
6527
  if (!approval) throw new Error("No pending budget approval found for this budget and approver.");
6581
6528
  const result = await api2.budget.updateBudgetApproval.mutate({ budgetApprovalId: approval.id, status: ExtendedApprovalStatus.REJECTED, rejectionReason: reason });
@@ -6603,7 +6550,8 @@ async function getSupplierItems(supplierId) {
6603
6550
  __name(getSupplierItems, "getSupplierItems"), __name2(getSupplierItems, "getSupplierItems");
6604
6551
  async function getSupplierDetails(supplierId) {
6605
6552
  const supplier = await api2.supplier.getSupplierById.query({ id: supplierId }), respondedStatuses = /* @__PURE__ */ new Set([ExtendedApprovalStatus.APPROVED, ExtendedApprovalStatus.REJECTED]), latestRespondedApproval = [...supplier.approvals.filter((approval) => respondedStatuses.has(approval.status))].sort((a, b) => new Date(b.respondedAt ?? b.updatedAt).getTime() - new Date(a.respondedAt ?? a.updatedAt).getTime() || new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())[0], pendingApprovals = supplier.approvals.filter((approval) => approval.status === ExtendedApprovalStatus.PENDING_APPROVAL), supersededApprovals = supplier.approvals.filter((approval) => approval.status === ExtendedApprovalStatus.SUPERSEDED), respondedByApproval = latestRespondedApproval ?? null, responseUser = respondedByApproval ? respondedByApproval.responder ?? respondedByApproval.approver : null;
6606
- out({ ...supplier, supplierApprovalSummary: { pendingApprovalCount: pendingApprovals.length, pendingApprovers: pendingApprovals.map((approval) => ({ approvalId: approval.id, approverId: approval.approverId, name: approval.approver.name, email: approval.approver.email, createdAt: approval.createdAt, updatedAt: approval.updatedAt })), supersededApprovalCount: supersededApprovals.length, supersededApprovers: supersededApprovals.map((approval) => ({ approvalId: approval.id, approverId: approval.approverId, name: approval.approver.name, email: approval.approver.email, respondedAt: approval.respondedAt, responder: approval.responder ? { id: approval.responder.id, name: approval.responder.name, email: approval.responder.email } : null })), respondedBy: respondedByApproval && responseUser ? { approvalId: respondedByApproval.id, status: respondedByApproval.status, approverId: respondedByApproval.approverId, responderId: respondedByApproval.responderId, name: responseUser.name, email: responseUser.email, respondedAt: respondedByApproval.respondedAt, updatedAt: respondedByApproval.updatedAt } : null } });
6553
+ out({ ...supplier, supplierApprovalSummary: { pendingApprovalCount: pendingApprovals.length, pendingApprovers: pendingApprovals.map((approval) => ({ approvalId: approval.id, approverId: approval.approverId, name: approval.approver.name, email: approval.approver.email, createdAt: approval.createdAt, updatedAt: approval.updatedAt })), supersededApprovalCount: supersededApprovals.length, supersededApprovers: supersededApprovals.map((approval) => ({ approvalId: approval.id, approverId: approval.approverId, name: approval.approver.name, email: approval.approver.email, respondedAt: approval.respondedAt, responder: approval.responder ? { id: approval.responder.id, name: approval.responder.name, email: approval.responder.email } : null })), respondedBy: respondedByApproval && responseUser ? { approvalId: respondedByApproval.id, status: respondedByApproval.status, approverId: respondedByApproval.approverId, responderId: respondedByApproval.responderId, name: responseUser.name, email: responseUser.
6554
+ email, respondedAt: respondedByApproval.respondedAt, updatedAt: respondedByApproval.updatedAt } : null } });
6607
6555
  }
6608
6556
  __name(getSupplierDetails, "getSupplierDetails"), __name2(getSupplierDetails, "getSupplierDetails");
6609
6557
  async function approveSupplier(supplierId) {
@@ -6612,7 +6560,11 @@ async function approveSupplier(supplierId) {
6612
6560
  await assertSensitiveWorkflowConfirmed({ action: "Re-approve supplier", entity: "supplier ".concat(supplierId), effects: ["state-change", "external-write"], details: supplier.active ? "and queue its QuickBooks vendor sync (it is usable once QuickBooks confirms); append a new approval and retain earlier history; no requester reply email is sent" : "and queue its QuickBooks vendor sync; append a new approval and retain earlier history; it remains archived and no requester reply email is sent" }), out(await api2.supplier.reapproveSupplier.mutate({ supplierId }));
6613
6561
  return;
6614
6562
  }
6615
- await assertSensitiveWorkflowConfirmed({ action: "Approve supplier", entity: "supplier ".concat(supplierId), details: "and send requester reply email" });
6563
+ await assertSensitiveWorkflowConfirmed({
6564
+ action: "Approve supplier",
6565
+ entity: "supplier ".concat(supplierId),
6566
+ details: "and send requester reply email"
6567
+ });
6616
6568
  const approval = (await getAllNotifications()).filter((n) => n.notificationType === "request" && n.status === ExtendedApprovalStatus.PENDING_APPROVAL && n.type === ExtendedApprovalType.SUPPLIER && (n.supplierId === supplierId || n.supplier?.id === supplierId))[0];
6617
6569
  if (!approval) throw new Error("No pending supplier approval found.");
6618
6570
  const result = await api2.supplier.updateSupplierApproval.mutate({ supplierApprovalId: approval.id, status: ExtendedApprovalStatus.APPROVED });
@@ -6720,13 +6672,16 @@ var getProjectHubStatus = __name2(async (projectId) => {
6720
6672
  await assertSensitiveWorkflowConfirmed({ action: "Set up Project Hub", entity: "project ".concat(projectId), details: "queue Asana, Drive, and client Hub provisioning" });
6721
6673
  const result = await api2.project.setupProjectHub.mutate({ projectId });
6722
6674
  out(result);
6723
- }, "setupProjectHub"), syncProjectHubCommercialDocuments = __name2(async (projectId) => {
6724
- await assertSensitiveWorkflowConfirmed({ action: "Sync Project Hub commercial documents", entity: "project ".concat(projectId), details: "queue a full Budget Builder to Google Drive and Asana reconciliation" });
6725
- const result = await api2.project.syncProjectHubCommercialDocuments.mutate({ projectId });
6726
- out(result);
6727
- }, "syncProjectHubCommercialDocuments");
6675
+ }, "setupProjectHub"), syncProjectHubCommercialDocuments = __name2(
6676
+ async (projectId) => {
6677
+ await assertSensitiveWorkflowConfirmed({ action: "Sync Project Hub commercial documents", entity: "project ".concat(projectId), details: "queue a full Budget Builder to Google Drive and Asana reconciliation" });
6678
+ const result = await api2.project.syncProjectHubCommercialDocuments.mutate({ projectId });
6679
+ out(result);
6680
+ },
6681
+ "syncProjectHubCommercialDocuments"
6682
+ );
6728
6683
  async function createProject(opts) {
6729
- const name = parseQuickBooksName(opts.name), links = await resolveCreateProjectLinks({ name, asanaTaskId: opts.asanaTaskId, asanaSearch: opts.asanaSearch, slackChannelId: opts.slackChannelId, slackChannelUrl: opts.slackChannelUrl, slackChannelName: opts.slackChannelName }), result = await api2.project.createProject.mutate({ name, description: opts.description, companyId: opts.companyId, contactPersonId: opts.contactPersonId, insideSalesId: opts.insideSalesId, businessDevelopmentId: opts.businessDevelopmentId, projectManagerId: opts.projectManagerId, venue: opts.venue, pax: opts.pax, asanaTaskId: links.asanaTaskId, slackChannelId: links.slackChannelId, slackChannelUrl: links.slackChannelUrl, slackChannelName: links.slackChannelName, dateRange: { from: new Date(opts.startDate), to: opts.endDate ? new Date(opts.endDate) : void 0 } });
6684
+ const name = parseQuickBooksName(opts.name), asanaTaskId = await resolveCreateProjectAsanaTaskId({ name, asanaTaskId: opts.asanaTaskId, asanaSearch: opts.asanaSearch }), result = await api2.project.createProject.mutate({ name, description: opts.description, companyId: opts.companyId, contactPersonId: opts.contactPersonId, insideSalesId: opts.insideSalesId, businessDevelopmentId: opts.businessDevelopmentId, projectManagerId: opts.projectManagerId, venue: opts.venue, pax: opts.pax, asanaTaskId, dateRange: { from: new Date(opts.startDate), to: opts.endDate ? new Date(opts.endDate) : void 0 } });
6730
6685
  out(result);
6731
6686
  }
6732
6687
  __name(createProject, "createProject"), __name2(createProject, "createProject");
@@ -6755,9 +6710,7 @@ var checkProjectReconciliation = __name2(async (projectId) => {
6755
6710
  }, "listWebhookEndpoints"), getWebhookEndpoint = __name2(async (id) => {
6756
6711
  out(await api2.webhook.getEndpoint.query({ id }));
6757
6712
  }, "getWebhookEndpoint"), createWebhookEndpoint = __name2(async (input) => {
6758
- const result = await api2.webhook.createEndpoint.mutate(
6759
- input
6760
- );
6713
+ const result = await api2.webhook.createEndpoint.mutate(input);
6761
6714
  out({ ...result, note: "Store the signing secret now; Budget Builder never shows it again." });
6762
6715
  }, "createWebhookEndpoint"), updateWebhookEndpoint = __name2(async (input) => {
6763
6716
  out(await api2.webhook.updateEndpoint.mutate(input));
@@ -6784,9 +6737,7 @@ var checkProjectReconciliation = __name2(async (projectId) => {
6784
6737
  }, "getIntegrationOperation"), countIntegrationOperations = __name2(async (input) => {
6785
6738
  out(await api2.integration.getCounts.query(input));
6786
6739
  }, "countIntegrationOperations"), retryIntegrationOperation = __name2(async (operationId, confirmExternalStateReconciled, outboundEmailResolution, providerMessageId) => {
6787
- await assertSensitiveWorkflowConfirmed(
6788
- { action: outboundEmailResolution === "ACCEPTED" ? "Reconcile integration operation as completed" : "Retry integration operation (QuickBooks jobs with a saved attempt check QuickBooks first and never resend an applied change)", entity: "operation ".concat(operationId), details: outboundEmailResolution === "ACCEPTED" ? "mark provider-accepted email sent with message ID ".concat(providerMessageId ?? "<missing>") : outboundEmailResolution === "NOT_ACCEPTED_RETRY" ? "rotate the Resend idempotency key and retry provider delivery" : confirmExternalStateReconciled ? "after confirming the external state has been reconciled" : void 0 }
6789
- );
6740
+ await assertSensitiveWorkflowConfirmed({ action: outboundEmailResolution === "ACCEPTED" ? "Reconcile integration operation as completed" : "Retry integration operation (QuickBooks jobs with a saved attempt check QuickBooks first and never resend an applied change)", entity: "operation ".concat(operationId), details: outboundEmailResolution === "ACCEPTED" ? "mark provider-accepted email sent with message ID ".concat(providerMessageId ?? "<missing>") : outboundEmailResolution === "NOT_ACCEPTED_RETRY" ? "rotate the Resend idempotency key and retry provider delivery" : confirmExternalStateReconciled ? "after confirming the external state has been reconciled" : void 0 });
6790
6741
  const result = await api2.integration.retryOperation.mutate({ operationId, confirmExternalStateReconciled, outboundEmailResolution, providerMessageId });
6791
6742
  out(result);
6792
6743
  }, "retryIntegrationOperation"), reconcileResourceOperation = __name2(async (operationId) => {
@@ -6808,16 +6759,15 @@ var checkProjectReconciliation = __name2(async (projectId) => {
6808
6759
  }, "getInboundSource"), updateInboundSource = __name2(async (sourceId, name) => {
6809
6760
  const result = await api2.inbound.updateSource.mutate({ name, sourceId });
6810
6761
  out(result);
6811
- }, "updateInboundSource"), listInboundSubmissions = __name2(
6812
- async (input) => {
6813
- const result = await api2.inbound.listSubmissions.query(input);
6814
- out(result);
6815
- },
6816
- "listInboundSubmissions"
6817
- ), countInboundSubmissions = __name2(async (input) => {
6762
+ }, "updateInboundSource"), listInboundSubmissions = __name2(async (input) => {
6763
+ const result = await api2.inbound.listSubmissions.query(input);
6764
+ out(result);
6765
+ }, "listInboundSubmissions"), countInboundSubmissions = __name2(async (input) => {
6818
6766
  out(await api2.inbound.countSubmissions.query(input));
6819
6767
  }, "countInboundSubmissions"), getInboundSubmission = __name2(async (submissionId) => {
6820
- const result = await api2.inbound.getSubmission.query({ submissionId });
6768
+ const result = await api2.inbound.getSubmission.query(
6769
+ { submissionId }
6770
+ );
6821
6771
  out(result);
6822
6772
  }, "getInboundSubmission"), saveInboundMappingVersion = __name2(async (sourceId, mappings) => {
6823
6773
  const source = await api2.inbound.getSource.query({ sourceId }), result = await api2.inbound.saveMappingVersion.mutate({ expectedActiveMappingVersion: source.activeMappingVersion, mappings, sourceId });
@@ -6836,9 +6786,12 @@ async function listContacts(companyId) {
6836
6786
  __name(listContacts, "listContacts"), __name2(listContacts, "listContacts");
6837
6787
  var listItems = __name2(async (input) => {
6838
6788
  out(await api2.item.getItems.query(input));
6839
- }, "listItems"), countItems = __name2(async (input) => {
6840
- out(await api2.item.getItemCounts.query(input));
6841
- }, "countItems");
6789
+ }, "listItems"), countItems = __name2(
6790
+ async (input) => {
6791
+ out(await api2.item.getItemCounts.query(input));
6792
+ },
6793
+ "countItems"
6794
+ );
6842
6795
  async function getItem(id) {
6843
6796
  const item = await api2.item.getItem.query({ id });
6844
6797
  out(item);
@@ -6853,12 +6806,9 @@ var getItemQuickBooksSyncStatus = __name2(async (itemId) => {
6853
6806
  out(await api2.itemCategory.getCounts.query(input));
6854
6807
  }, "countItemCategories"), getSupplierAnalytics = __name2(async (input) => {
6855
6808
  out(await api2.dashboard.getSupplierTableData.query(input));
6856
- }, "getSupplierAnalytics"), countSupplierAnalytics = __name2(
6857
- async (input) => {
6858
- out(await api2.dashboard.getSupplierTableCounts.query(input));
6859
- },
6860
- "countSupplierAnalytics"
6861
- );
6809
+ }, "getSupplierAnalytics"), countSupplierAnalytics = __name2(async (input) => {
6810
+ out(await api2.dashboard.getSupplierTableCounts.query(input));
6811
+ }, "countSupplierAnalytics");
6862
6812
  async function createUser(input) {
6863
6813
  const user = await api2.user.create.mutate(input);
6864
6814
  out(user);
@@ -6908,10 +6858,7 @@ async function getSystemOverview(input) {
6908
6858
  const result = await api2.dashboard.getSystemOverview.query({ userId: input.userId, role: input.role ?? "ALL", deals: input.deals ?? "ALL", timeFrame: input.timeFrame ?? "ALL", startDate: input.startDate, endDate: input.endDate });
6909
6859
  out(result);
6910
6860
  }
6911
- __name(getSystemOverview, "getSystemOverview"), __name2(
6912
- getSystemOverview,
6913
- "getSystemOverview"
6914
- );
6861
+ __name(getSystemOverview, "getSystemOverview"), __name2(getSystemOverview, "getSystemOverview");
6915
6862
  async function getEstimatePerformance(input) {
6916
6863
  const result = await api2.dashboard.getEstimatePerformance.query({ userId: input.userId, role: input.role ?? "ALL", deals: input.deals ?? "ALL", timeFrame: input.timeFrame ?? "ALL", startDate: input.startDate, endDate: input.endDate });
6917
6864
  out(result);
@@ -6948,7 +6895,9 @@ async function getApprovedBudgets(opts) {
6948
6895
  const maxR = opts.maxRevenue;
6949
6896
  filtered = filtered.filter((i) => i.revenue <= maxR);
6950
6897
  }
6951
- out({ budgets: filtered, count: filtered.length, totalCount });
6898
+ out(
6899
+ { budgets: filtered, count: filtered.length, totalCount }
6900
+ );
6952
6901
  }
6953
6902
  __name(getApprovedBudgets, "getApprovedBudgets"), __name2(getApprovedBudgets, "getApprovedBudgets");
6954
6903
  async function getBudgetCategoryBenchmarks(opts) {
@@ -7016,139 +6965,319 @@ function parseOptionalNumber(raw, label) {
7016
6965
  return n;
7017
6966
  }
7018
6967
  __name(parseOptionalNumber, "parseOptionalNumber"), __name2(parseOptionalNumber, "parseOptionalNumber");
7019
- var payloadHelp = { "create-budget": { required: "name: string; budget: decimal string; paymentTerm: string; categoryId: string; projectId: string", optional: "sourceBudgetId: string; unavailableItemReviewAcknowledged: boolean (only after review)", example: '{"name":"Event budget","budget":"1500","paymentTerm":"Net 30","categoryId":"<category-id>","projectId":"<project-id>"}' }, "update-budget": { required: "id: string; name: string; budget: decimal string; paymentTerm: string; categoryId: string; projectId: string", optional: "sourceBudgetId: string", example: '{"id":"<budget-id>","name":"Event budget","budget":"1500","paymentTerm":"Net 30","categoryId":"<category-id>","projectId":"<project-id>"}' }, "create-item": { required: "name: string (QuickBooks-safe characters); categoryId: string; supplierId: string; cost: decimal string or number", optional: "description: string; gstInclusive: boolean; gstOutOfScope: boolean; goLabsProduct: boolean; attachments: array", example: '{"name":"Event Crew per hour","categoryId":"<category-id>","supplierId":"<supplier-id>","cost":19}' }, "update-item": { required: "id: string; name: string; categoryId: string; supplierId: string; cost: decimal string or number", optional: "description: string; gstInclusive: boolean; gstOutOfScope: boolean; goLabsProduct: boolean; attachments: array", example: '{"id":"<item-id>","name":"Event Crew per hour","categoryId":"<category-id>","supplierId":"<supplier-id>","cost":"19"}' }, "create-contact-person": { required: "companyId: string; title: MR|MRS|MS|DR; firstName: string; lastName: string|null; email: string; mobile: string", optional: "address: {streetAddress1?, city?, state?, postalCode?, countryCode? (ISO 3166-1 alpha-2, e.g. SG)}", example: '{"companyId":"<company-id>","title":"MS","firstName":"Jane","lastName":"Tan","email":"jane@example.com","mobile":"+65 9123 4567"}' }, "update-contact-person": { required: "id: string; companyId: string; title: MR|MRS|MS|DR; firstName: string; lastName: string|null; email: string; mobile: string", optional: "address: object", example: '{"id":"<contact-id>","companyId":"<company-id>","title":"MS","firstName":"Jane","lastName":"Tan","email":"jane@example.com","mobile":"+65 9123 4567"}' }, "update-company": { required: "id: string; name: string; website: URL string", optional: "confirmDistinct: boolean; billingEmails: email string[] (max 50; omit to preserve, [] to clear; trimmed, lowercased and deduplicated by the API)", example: '{"id":"<company-id>","name":"Example Co","website":"https://example.com","billingEmails":["ap@example.com","finance@example.com"]}' }, "update-project": { required: "id: string; name: string; companyId: string; contactPersonId: string; asanaTaskId: string; insideSalesId: string; businessDevelopmentId: string; venue: string; dateRange: {from: ISO date}", optional: "dateRange.to: ISO date; projectManagerId: string; pax: string; description: string; slackChannelId/slackChannelUrl/slackChannelName: strings (supply all three); requestQboAccountantNotification: boolean; confirmEstimateInvalidation: boolean. Changing companyId requires a contactPersonId from the new company; the company change itself does not reject existing estimates or touch existing invoices, but date, pax or venue changes in the same save still require confirmEstimateInvalidation.", example: '{"id":"<project-id>","name":"Launch","companyId":"<company-id>","contactPersonId":"<contact-id>","asanaTaskId":"<asana-task-id>","insideSalesId":"<user-id>","businessDevelopmentId":"<user-id>","venue":"Hall","dateRange":{"from":"2026-10-01T09:00:00Z"}}' }, "create-supplier": { required: "name: string; primaryContactPerson: string; email: string; phone: string; paymentMethodId: string; paymentTerm: string; roleId: string", optional: "gstRegistered: boolean; tags: string[]; website: URL string; address: object; attachments: array; bank and PayNow fields", example: '{"name":"Example Supplier","primaryContactPerson":"Jane Tan","email":"jane@example.com","phone":"91234567","paymentMethodId":"<method-id>","paymentTerm":"Net 30","roleId":"<role-id>"}' }, "update-supplier": { required: "id: string; name: string; primaryContactPerson: string; email: string; phone: string; paymentMethodId: string; paymentTerm: string; roleId: string", optional: "gstRegistered: boolean; tags: string[]; website: URL string; address: object; attachments: array; bank and PayNow fields", example: '{"id":"<supplier-id>","name":"Example Supplier","primaryContactPerson":"Jane Tan","email":"jane@example.com","phone":"91234567","paymentMethodId":"<method-id>","paymentTerm":"Net 30","roleId":"<role-id>"}' }, "update-budget-commission": { required: "budgetId: string; name: string; percentage: decimal string; totalSellingAfterDiscount: number", optional: "none", example: '{"budgetId":"<budget-id>","name":"Sales commission","percentage":"10","totalSellingAfterDiscount":1500}' }, "update-budget-discount": { required: "budgetId: string; name: string; type: percentage|amount; value: decimal string; totalSellingBeforeDiscount: number", optional: "none", example: '{"budgetId":"<budget-id>","name":"Discount","type":"amount","value":"100","totalSellingBeforeDiscount":1500}' }, "send-estimate-to-contact-person": { required: "estimateId: string; budgetId: string; to: email; cc: email[]; replyTo: email; subject: string; content: HTML string; signature: HTML string", optional: "estimateDocNumber: string", example: '{"estimateId":"<estimate-id>","budgetId":"<budget-id>","to":"client@example.com","cc":[],"replyTo":"team@example.com","subject":"Estimate","content":"<p>Attached estimate</p>","signature":"<p>Team</p>"}' }, "create-bill": { required: "budgetId: string; projectId: string; supplierId: string; amount: number (ex-GST); budgetItemIds: string[]; isClaimable: boolean; supplier bills: quotationIds: string[] or quotationAllocations: {budgetItemId, quotationId, amount}[] (unless --quotation-exempt)", optional: "lineAmounts: {budgetItemId, amount}[] (required with quotationAllocations); attachments: {id,name,key,size}[]; invoiceNumber: string; invoiceDate: ISO date; draftOnly: boolean; alreadyPaid: boolean; extractedAmount: number", example: '{"budgetId":"<budget-id>","projectId":"<project-id>","supplierId":"<supplier-id>","amount":1800,"budgetItemIds":["<budget-item-id>"],"isClaimable":false,"quotationIds":["<quotation-id>"],"attachments":[]}' }, "update-bill": { required: "id: string; budgetId: string; projectId: string; supplierId: string; amount: number (ex-GST); budgetItemIds: string[]; isClaimable: boolean", optional: "quotationIds: string[]; quotationAllocations: {budgetItemId, quotationId, amount}[]; lineAmounts: {budgetItemId, amount}[]; attachments: {id,name,key,size}[]; invoiceNumber: string; invoiceDate: ISO date", example: '{"id":"<bill-id>","budgetId":"<budget-id>","projectId":"<project-id>","supplierId":"<supplier-id>","amount":1800,"budgetItemIds":["<budget-item-id>"],"isClaimable":false,"quotationIds":["<quotation-id>"],"attachments":[]}' }, "validate-bill-selection": { required: "projectId: string; supplierId: string; budgetItemIds: string[]", optional: "quotationIds: string[] for supplier bills; isClaimable: boolean; amount: number; lineAmounts: {budgetItemId, amount}[]; quotationAllocations: {budgetItemId, quotationId, amount}[] (requires amount and lineAmounts)", example: '{"projectId":"<project-id>","supplierId":"<supplier-id>","budgetItemIds":["<budget-item-id>"],"quotationIds":["<quotation-id>"]}' }, "link-bill-quotations": { required: "positional <billId>; quotationIds: string[] or quotationAllocations: {budgetItemId, quotationId, amount}[]", optional: "none (legacy quotationId is not supported)", example: '{"quotationIds":["<quotation-id>"]}' }, "update-bill-payment-evidence": { required: "id: string; paymentReference: string; paymentProofAttachments: {id,name (PDF),key,size}[] (at least one)", optional: "none", example: '{"id":"<bill-id>","paymentReference":"TRANSFER-123","paymentProofAttachments":[{"id":"<attachment-id>","name":"receipt.pdf","key":"<staged-key>","size":1000}]}' }, "create-quotation": { required: "projectId: string; budgetId: string; supplierId: string; budgetItemIds: string[]; amountWithoutGst: number; gstAmount: number; attachments: array (uploaded attachment)", optional: 'lineAmounts: {budgetItemId, amount}[] (required for multiple budget items unless documentOnly); documentOnly: boolean (default false; true for a $0 supplier document: amountWithoutGst 0, gstAmount 0, zero lineAmounts, lineAmounts may be omitted; never a valid bill quotation source). Document-only example: {"projectId":"<project-id>","budgetId":"<budget-id>","supplierId":"<supplier-id>","budgetItemIds":["<budget-item-id>"],"amountWithoutGst":0,"gstAmount":0,"documentOnly":true,"attachments":[{...}]}', example: '{"projectId":"<project-id>","budgetId":"<budget-id>","supplierId":"<supplier-id>","budgetItemIds":["<budget-item-id>"],"amountWithoutGst":1200,"gstAmount":0,"attachments":[{"id":"<attachment-id>","name":"quote.pdf","key":"<staged-key>","size":1000}]}' }, "update-quotation": { required: "id: string; projectId: string; budgetId: string; supplierId: string; budgetItemIds: string[]; amountWithoutGst: number; gstAmount: number; attachments: array", optional: "lineAmounts: {budgetItemId, amount}[] (required for multiple budget items unless documentOnly); documentOnly: boolean (default false; update is a full replace, so send documentOnly: true again, with amountWithoutGst 0 and gstAmount 0, for a document-only quotation)", example: '{"id":"<quotation-id>","projectId":"<project-id>","budgetId":"<budget-id>","supplierId":"<supplier-id>","budgetItemIds":["<budget-item-id>"],"amountWithoutGst":1200,"gstAmount":0,"attachments":[{"id":"<attachment-id>","name":"quote.pdf","key":"<staged-key>","size":1000}]}' }, "create-customer-invoice": { required: "budgetId: string; splits: [{label: string, percentage: number, dueDate: ISO date}] (exactly one)", optional: "requestId: UUID string (recommended); invoiceDate: ISO date; details: {billingAddress: string, customerMemo: string}; isCustomPercentage: boolean", example: '{"budgetId":"<budget-id>","splits":[{"label":"Deposit","percentage":50,"dueDate":"2026-10-15"}],"details":{"billingAddress":"1 Example St","customerMemo":"Thanks"}}' }, "send-customer-invoice-to-contact-person": { required: "invoiceId: string; to: email; replyTo: email; subject: string; content: HTML string; signature: HTML string", optional: "cc: email[] (max 50; omit to use company billing defaults, explicit list replaces defaults, [] removes defaults; required internal Cc still applies)", example: '{"invoiceId":"<invoice-id>","to":"client@example.com","cc":[],"replyTo":"team@example.com","subject":"Invoice","content":"<p>Attached invoice</p>","signature":"<p>Team</p>"}' }, "save-inbound-mapping": { required: "positional <sourceId>; payload: [{canonicalField: enum, typeformFieldId: string, required?: boolean, typeformFieldRef?: string|null}] (1-50 entries)", optional: "required defaults false; typeformFieldRef may be omitted", example: '[{"canonicalField":"CONTACT_FIRST_NAME","typeformFieldId":"<typeform-field-id>"}]' }, "save-inbound-automation-config": { required: "positional <sourceId>; asanaCustomFields: object; asanaDefaultAssigneeId: string|null; asanaDefaultAssigneeName: string|null; asanaFollowerIds: string[]; asanaProjectId: string; asanaSectionId: string; asanaWonSectionId: string; asanaLostSectionId: string; googleCalendarId: string; googleCalendarTimeZone: string; goshBriefBaseUrl: URL; slackDefaultAssigneeId: string|null; slackInboundChannelId: string; slackInviteUserIds: string[]; slackPitchChannelPrefix: string", optional: "asanaDiscussionSectionId, asanaFirstContactSectionId, asanaFirstProposalSentSectionId, asanaProposalWipSectionId: string|null; googlePitchCalendarId: string|null (PITCH project events; must differ from googleCalendarId; null keeps them in googleCalendarId); asanaCustomFields.*: mapped IDs", example: '{"asanaCustomFields":{},"asanaDefaultAssigneeId":null,"asanaDefaultAssigneeName":null,"asanaFollowerIds":[],"asanaProjectId":"<asana-project-id>","asanaSectionId":"<asana-section-id>","asanaWonSectionId":"<asana-won-id>","asanaLostSectionId":"<asana-lost-id>","googleCalendarId":"team@example.com","googleCalendarTimeZone":"Asia/Singapore","goshBriefBaseUrl":"https://example.com/brief","slackDefaultAssigneeId":null,"slackInboundChannelId":"<slack-channel-id>","slackInviteUserIds":[],"slackPitchChannelPrefix":"pitch"}' } }, formatPayloadHelp = __name2((command) => {
6968
+ var payloadHelp = { "create-budget": { required: "name: string; budget: decimal string; paymentTerm: string; categoryId: string; projectId: string", optional: "sourceBudgetId: string; unavailableItemReviewAcknowledged: boolean (only after review)", example: '{"name":"Event budget","budget":"1500","paymentTerm":"Net 30","categoryId":"<category-id>","projectId":"<project-id>"}' }, "update-budget": { required: "id: string; name: string; budget: decimal string; paymentTerm: string; categoryId: string; projectId: string", optional: "sourceBudgetId: string", example: '{"id":"<budget-id>","name":"Event budget","budget":"1500","paymentTerm":"Net 30","categoryId":"<category-id>","projectId":"<project-id>"}' }, "create-item": { required: "name: string (QuickBooks-safe characters); categoryId: string; supplierId: string; cost: decimal string or number", optional: "description: string; gstInclusive: boolean; gstOutOfScope: boolean; goLabsProduct: boolean; attachments: array", example: '{"name":"Ev\
6969
+ ent Crew per hour","categoryId":"<category-id>","supplierId":"<supplier-id>","cost":19}' }, "update-item": { required: "id: string; name: string; categoryId: string; supplierId: string; cost: decimal string or number", optional: "description: string; gstInclusive: boolean; gstOutOfScope: boolean; goLabsProduct: boolean; attachments: array", example: '{"id":"<item-id>","name":"Event Crew per hour","categoryId":"<category-id>","supplierId":"<supplier-id>","cost":"19"}' }, "create-contact-person": { required: "companyId: string; title: MR|MRS|MS|DR; firstName: string; lastName: string|null; email: string; mobile: string", optional: "address: {streetAddress1?, city?, state?, postalCode?, countryCode? (ISO 3166-1 alpha-2, e.g. SG)}", example: '{"companyId":"<company-id>","title":"MS","firstName":"Jane","lastName":"Tan","email":"jane@example.com","mobile":"+65 9123 4567"}' }, "update-contact-person": { required: "id: string; companyId: string; title: MR|MRS|MS|DR; firstName: string; lastName\
6970
+ : string|null; email: string; mobile: string", optional: "address: object", example: '{"id":"<contact-id>","companyId":"<company-id>","title":"MS","firstName":"Jane","lastName":"Tan","email":"jane@example.com","mobile":"+65 9123 4567"}' }, "update-company": { required: "id: string; name: string; website: URL string", optional: "confirmDistinct: boolean; billingEmails: email string[] (max 50; omit to preserve, [] to clear; trimmed, lowercased and deduplicated by the API)", example: '{"id":"<company-id>","name":"Example Co","website":"https://example.com","billingEmails":["ap@example.com","finance@example.com"]}' }, "update-project": { required: "id: string; name: string; companyId: string; contactPersonId: string; asanaTaskId: string; insideSalesId: string; businessDevelopmentId: string; venue: string; dateRange: {from: ISO date}", optional: "dateRange.to: ISO date; projectManagerId: string; pax: string; description: string; requestQboAccountantNotification: boolean; confirmEstimateInva\
6971
+ lidation: boolean. Changing companyId requires a contactPersonId from the new company; the company change itself does not reject existing estimates or touch existing invoices, but date, pax or venue changes in the same save still require confirmEstimateInvalidation.", example: '{"id":"<project-id>","name":"Launch","companyId":"<company-id>","contactPersonId":"<contact-id>","asanaTaskId":"<asana-task-id>","insideSalesId":"<user-id>","businessDevelopmentId":"<user-id>","venue":"Hall","dateRange":{"from":"2026-10-01T09:00:00Z"}}' }, "create-supplier": { required: "name: string; primaryContactPerson: string; email: string; phone: string; paymentMethodId: string; paymentTerm: string; roleId: string", optional: "gstRegistered: boolean; tags: string[]; website: URL string; address: object; attachments: array; bank and PayNow fields", example: '{"name":"Example Supplier","primaryContactPerson":"Jane Tan","email":"jane@example.com","phone":"91234567","paymentMethodId":"<method-id>","paymentTerm\
6972
+ ":"Net 30","roleId":"<role-id>"}' }, "update-supplier": { required: "id: string; name: string; primaryContactPerson: string; email: string; phone: string; paymentMethodId: string; paymentTerm: string; roleId: string", optional: "gstRegistered: boolean; tags: string[]; website: URL string; address: object; attachments: array; bank and PayNow fields", example: '{"id":"<supplier-id>","name":"Example Supplier","primaryContactPerson":"Jane Tan","email":"jane@example.com","phone":"91234567","paymentMethodId":"<method-id>","paymentTerm":"Net 30","roleId":"<role-id>"}' }, "update-budget-commission": { required: "budgetId: string; name: string; percentage: decimal string; totalSellingAfterDiscount: number", optional: "none", example: '{"budgetId":"<budget-id>","name":"Sales commission","percentage":"10","totalSellingAfterDiscount":1500}' }, "update-budget-discount": { required: "budgetId: string; name: string; type: percentage|amount; value: decimal string; totalSellingBeforeDiscount: number", optional: "\
6973
+ none", example: '{"budgetId":"<budget-id>","name":"Discount","type":"amount","value":"100","totalSellingBeforeDiscount":1500}' }, "send-estimate-to-contact-person": { required: "estimateId: string; budgetId: string; to: email; cc: email[]; replyTo: email; subject: string; content: HTML string; signature: HTML string", optional: "estimateDocNumber: string", example: '{"estimateId":"<estimate-id>","budgetId":"<budget-id>","to":"client@example.com","cc":[],"replyTo":"team@example.com","subject":"Estimate","content":"<p>Attached estimate</p>","signature":"<p>Team</p>"}' }, "create-bill": { required: "budgetId: string; projectId: string; supplierId: string; amount: number (ex-GST); budgetItemIds: string[]; isClaimable: boolean; supplier bills: quotationIds: string[] or quotationAllocations: {budgetItemId, quotationId, amount}[] (unless --quotation-exempt)", optional: "lineAmounts: {budgetItemId, amount}[] (required with quotationAllocations); attachments: {id,name,key,size}[]; invoiceNumber\
6974
+ : string; invoiceDate: ISO date; draftOnly: boolean; alreadyPaid: boolean; extractedAmount: number", example: '{"budgetId":"<budget-id>","projectId":"<project-id>","supplierId":"<supplier-id>","amount":1800,"budgetItemIds":["<budget-item-id>"],"isClaimable":false,"quotationIds":["<quotation-id>"],"attachments":[]}' }, "update-bill": { required: "id: string; budgetId: string; projectId: string; supplierId: string; amount: number (ex-GST); budgetItemIds: string[]; isClaimable: boolean", optional: "quotationIds: string[]; quotationAllocations: {budgetItemId, quotationId, amount}[]; lineAmounts: {budgetItemId, amount}[]; attachments: {id,name,key,size}[]; invoiceNumber: string; invoiceDate: ISO date", example: '{"id":"<bill-id>","budgetId":"<budget-id>","projectId":"<project-id>","supplierId":"<supplier-id>","amount":1800,"budgetItemIds":["<budget-item-id>"],"isClaimable":false,"quotationIds":["<quotation-id>"],"attachments":[]}' }, "validate-bill-selection": { required: "projectId: string\
6975
+ ; supplierId: string; budgetItemIds: string[]", optional: "quotationIds: string[] for supplier bills; isClaimable: boolean; amount: number; lineAmounts: {budgetItemId, amount}[]; quotationAllocations: {budgetItemId, quotationId, amount}[] (requires amount and lineAmounts)", example: '{"projectId":"<project-id>","supplierId":"<supplier-id>","budgetItemIds":["<budget-item-id>"],"quotationIds":["<quotation-id>"]}' }, "link-bill-quotations": { required: "positional <billId>; quotationIds: string[] or quotationAllocations: {budgetItemId, quotationId, amount}[]", optional: "none (legacy quotationId is not supported)", example: '{"quotationIds":["<quotation-id>"]}' }, "update-bill-payment-evidence": { required: "id: string; paymentReference: string; paymentProofAttachments: {id,name (PDF),key,size}[] (at least one)", optional: "none", example: '{"id":"<bill-id>","paymentReference":"TRANSFER-123","paymentProofAttachments":[{"id":"<attachment-id>","name":"receipt.pdf","key":"<staged-key>","size\
6976
+ ":1000}]}' }, "create-quotation": { required: "projectId: string; budgetId: string; supplierId: string; budgetItemIds: string[]; amountWithoutGst: number; gstAmount: number; attachments: array (uploaded attachment)", optional: 'lineAmounts: {budgetItemId, amount}[] (required for multiple budget items unless documentOnly); documentOnly: boolean (default false; true for a $0 supplier document: amountWithoutGst 0, gstAmount 0, zero lineAmounts, lineAmounts may be omitted; never a valid bill quotation source). Document-only example: {"projectId":"<project-id>","budgetId":"<budget-id>","supplierId":"<supplier-id>","budgetItemIds":["<budget-item-id>"],"amountWithoutGst":0,"gstAmount":0,"documentOnly":true,"attachments":[{...}]}', example: '{"projectId":"<project-id>","budgetId":"<budget-id>","supplierId":"<supplier-id>","budgetItemIds":["<budget-item-id>"],"amountWithoutGst":1200,"gstAmount":0,"attachments":[{"id":"<attachment-id>","name":"quote.pdf","key":"<staged-key>","size":1000}]}' }, "\
6977
+ update-quotation": { required: "id: string; projectId: string; budgetId: string; supplierId: string; budgetItemIds: string[]; amountWithoutGst: number; gstAmount: number; attachments: array", optional: "lineAmounts: {budgetItemId, amount}[] (required for multiple budget items unless documentOnly); documentOnly: boolean (default false; update is a full replace, so send documentOnly: true again, with amountWithoutGst 0 and gstAmount 0, for a document-only quotation)", example: '{"id":"<quotation-id>","projectId":"<project-id>","budgetId":"<budget-id>","supplierId":"<supplier-id>","budgetItemIds":["<budget-item-id>"],"amountWithoutGst":1200,"gstAmount":0,"attachments":[{"id":"<attachment-id>","name":"quote.pdf","key":"<staged-key>","size":1000}]}' }, "create-customer-invoice": { required: "budgetId: string; splits: [{label: string, percentage: number, dueDate: ISO date}] (exactly one)", optional: "requestId: UUID string (recommended); invoiceDate: ISO date; details: {billingAddress: strin\
6978
+ g, customerMemo: string}; isCustomPercentage: boolean", example: '{"budgetId":"<budget-id>","splits":[{"label":"Deposit","percentage":50,"dueDate":"2026-10-15"}],"details":{"billingAddress":"1 Example St","customerMemo":"Thanks"}}' }, "send-customer-invoice-to-contact-person": { required: "invoiceId: string; to: email; replyTo: email; subject: string; content: HTML string; signature: HTML string", optional: "cc: email[] (max 50; omit to use company billing defaults, explicit list replaces defaults, [] removes defaults; required internal Cc still applies)", example: '{"invoiceId":"<invoice-id>","to":"client@example.com","cc":[],"replyTo":"team@example.com","subject":"Invoice","content":"<p>Attached invoice</p>","signature":"<p>Team</p>"}' }, "save-inbound-mapping": { required: "positional <sourceId>; payload: [{canonicalField: enum, typeformFieldId: string, required?: boolean, typeformFieldRef?: string|null}] (1-50 entries)", optional: "required defaults false; typeformFieldRef may be o\
6979
+ mitted", example: '[{"canonicalField":"CONTACT_FIRST_NAME","typeformFieldId":"<typeform-field-id>"}]' }, "save-inbound-automation-config": { required: "positional <sourceId>; asanaCustomFields: object; asanaDefaultAssigneeId: string|null; asanaDefaultAssigneeName: string|null; asanaFollowerIds: string[]; asanaProjectId: string; asanaSectionId: string; asanaWonSectionId: string; asanaLostSectionId: string; googleCalendarId: string; googleCalendarTimeZone: string; goshBriefBaseUrl: URL", optional: "asanaDiscussionSectionId, asanaFirstContactSectionId, asanaFirstProposalSentSectionId, asanaProposalWipSectionId: string|null; googlePitchCalendarId: string|null (PITCH project events; must differ from googleCalendarId; null keeps them in googleCalendarId); asanaCustomFields.*: mapped IDs", example: '{"asanaCustomFields":{},"asanaDefaultAssigneeId":null,"asanaDefaultAssigneeName":null,"asanaFollowerIds":[],"asanaProjectId":"<asana-project-id>","asanaSectionId":"<asana-section-id>","asanaWonSec\
6980
+ tionId":"<asana-won-id>","asanaLostSectionId":"<asana-lost-id>","googleCalendarId":"team@example.com","googleCalendarTimeZone":"Asia/Singapore","goshBriefBaseUrl":"https://example.com/brief"}' } }, formatPayloadHelp = __name2((command) => {
7020
6981
  const help = payloadHelp[command];
7021
- return help ? ["Payload fields (--payload JSON)", " Required: ".concat(help.required), " Optional: ".concat(help.optional), " Example: bb ".concat(command).concat(command === "link-bill-quotations" ? " <billId>" : command.startsWith("save-inbound-") ? " <sourceId>" : "", " --payload '").concat(help.example, "'"), ""] : [];
7022
- }, "formatPayloadHelp"), globalCommandOptions = [{ name: "--help", description: "Show help for this command." }, { name: "--quiet", description: "Suppress non-error diagnostics." }, { name: "--debug", description: "Emit sanitized diagnostic traces." }, { name: "--api-url", description: "Override the Budget Builder API base URL." }, { name: "--no-browser", description: "Print the authorization URL without opening a browser." }, { name: "--allow-state-change", description: "Allow a Budget Builder state change in non-interactive use." }, { name: "--allow-email", description: "Allow sending email in non-interactive use." }, { name: "--allow-external-write", description: "Allow writes to external systems in non-interactive use." }, { name: "--allow-delete", description: "Allow deleting data in non-interactive use." }, { name: "--allow-financial-write", description: "Allow financial-record changes in non-interactive use." }], mutationPrefixes = ["add-", "approve-", "archive-", "attach-", "cleanup-", "complete-", "create-", "delete-", "discard-", "import-", "link-", "mark-", "patch-", "reactivate-", "reconcile-", "record-", "refresh-", "reject-", "remove-", "replace-", "rename-", "reorder-", "restore-", "retry-", "revoke-", "save-", "send-", "stage-", "setup-", "submit-", "sync-", "update-", "use-existing-", "upload-", "void-"], emailTargets = /* @__PURE__ */ new Set(["approve-bill", "approve-budget", "approve-customer-invoice", "approve-supplier", "create-bill", "create-bill-approval", "create-budget-approval", "create-customer-invoice", "create-supplier", "reject-bill", "reject-budget", "reject-customer-invoice", "reject-supplier", "send-estimate-email", "send-estimate-to-contact-person", "send-customer-invoice-to-contact-person", "update-bill-status", "update-supplier"]), externalWriteTargets = /* @__PURE__ */ new Set(["update-customer-invoice-details", "update-customer-invoice-qbo-drift", "record-external-bill-payment", "approve-bill", "approve-customer-invoice", "approve-supplier", "complete-project", "create-bill", "create-company", "use-existing-company", "create-estimate", "create-placeholder-bill", "create-customer-invoice", "create-item", "create-item-category", "create-project", "create-supplier", "delete-bill", "delete-budget", "delete-company", "delete-customer-invoice", "delete-item", "delete-project", "delete-suppliers", "discard-customer-invoice", "import-qbo-project", "mark-budget-items-not-utilized", "mark-budget-won", "reconcile-project", "reject-customer-invoice", "reactivate-suppliers", "restore-budget-item", "restore-budget-version", "retry-integration-operation", "setup-project-hub", "sync-project-hub-commercial-documents", "sync-customer-invoice", "update-bill", "update-budget-status", "update-company", "update-item", "update-item-category", "update-project", "update-project-status", "update-supplier", "void-customer-invoice"]), financialWriteTargets = /* @__PURE__ */ new Set(["update-customer-invoice-qbo-drift", "record-external-bill-payment", "import-qbo-customer-invoice", "link-bill-quotations", "approve-bill", "approve-customer-invoice", "complete-project", "create-bill", "create-customer-invoice", "create-estimate", "create-placeholder-bill", "delete-budget-commission", "delete-budget-discount", "delete-bill", "delete-budget", "delete-customer-invoice", "mark-budget-items-not-utilized", "mark-budget-won", "mark-customer-invoice-sent-externally", "patch-bill-payment", "reject-customer-invoice", "restore-budget-item", "restore-budget-version", "replace-budget-item", "sync-customer-invoice", "update-bill", "update-bill-payment-evidence", "update-bill-status", "update-budget-commission", "update-budget-discount", "update-budget-status", "update-project-status", "void-customer-invoice"]), deleteTargets = /* @__PURE__ */ new Set(["cleanup-staged-bill-attachments", "delete-webhook-endpoint", "cleanup-staged-quotation-attachments", "discard-customer-invoice", "complete-project", "mark-budget-items-not-utilized", "remove-budget-item", "restore-budget-version", "update-project-status"]), explicitEffects = { "resubmit-customer-invoice": ["state-change", "external-write", "financial-write", "email"], "rotate-webhook-secret": ["state-change"], "replay-webhook-delivery": ["state-change", "external-write"] }, effectsFor = __name2((legacyTarget) => {
6982
+ return help ? ["Payload fields (--payload JSON)", " Required: ".concat(help.required), " Optional: ".concat(help.optional), " Example: bb ".concat(command).concat(
6983
+ command === "link-bill-quotations" ? " <billId>" : command.startsWith("save-inbound-") ? " <sourceId>" : "",
6984
+ " --payload '"
6985
+ ).concat(help.example, "'"), ""] : [];
6986
+ }, "formatPayloadHelp"), globalCommandOptions = [{ name: "--help", description: "Show help for this command." }, { name: "--quiet", description: "Suppress non-error diagnostics." }, { name: "--debug", description: "Emit sanitized diagnostic traces." }, { name: "--api-url", description: "Override the Budget Builder API base URL." }, { name: "--no-browser", description: "Print the authorization URL without opening a browser." }, { name: "--allow-state-change", description: "Allow a Budget Builder state change in non-interactive use." }, { name: "--allow-email", description: "Allow sending email in non-interactive use." }, { name: "--allow-external-write", description: "Allow writes to external systems in non-interactive use." }, { name: "--allow-delete", description: "Allow deleting data in non-interactive use." }, { name: "--allow-financial-write", description: "Allow financial-record changes in non-interactive use." }], mutationPrefixes = ["add-", "approve-", "archive-", "attach-", "cl\
6987
+ eanup-", "complete-", "create-", "delete-", "discard-", "import-", "link-", "mark-", "patch-", "reactivate-", "reconcile-", "record-", "refresh-", "reject-", "remove-", "replace-", "rename-", "reorder-", "restore-", "retry-", "revoke-", "save-", "send-", "stage-", "setup-", "submit-", "sync-", "update-", "use-existing-", "upload-", "void-"], emailTargets = /* @__PURE__ */ new Set(["approve-bill", "approve-budget", "approve-customer-invoice", "approve-supplier", "create-bill", "create-bill-approval", "create-budget-approval", "create-customer-invoice", "create-supplier", "reject-bill", "reject-budget", "reject-customer-invoice", "reject-supplier", "send-estimate-email", "send-estimate-to-contact-person", "send-customer-invoice-to-contact-person", "update-bill-status", "update-supplier"]), externalWriteTargets = /* @__PURE__ */ new Set(["update-customer-invoice-details", "update-customer-invoice-qbo-drift", "record-external-bill-payment", "approve-bill", "approve-customer-invoice", "appr\
6988
+ ove-supplier", "complete-project", "create-bill", "create-company", "use-existing-company", "create-estimate", "create-placeholder-bill", "create-customer-invoice", "create-item", "create-item-category", "create-project", "create-supplier", "delete-bill", "delete-budget", "delete-company", "delete-customer-invoice", "delete-item", "delete-project", "delete-suppliers", "discard-customer-invoice", "import-qbo-project", "mark-budget-items-not-utilized", "mark-budget-won", "reconcile-project", "reject-customer-invoice", "reactivate-suppliers", "restore-budget-item", "restore-budget-version", "retry-integration-operation", "setup-project-hub", "sync-project-hub-commercial-documents", "sync-customer-invoice", "update-bill", "update-budget-status", "update-company", "update-item", "update-item-category", "update-project", "update-project-status", "update-supplier", "void-customer-invoice"]), financialWriteTargets = /* @__PURE__ */ new Set(["update-customer-invoice-qbo-drift", "record-external\
6989
+ -bill-payment", "import-qbo-customer-invoice", "link-bill-quotations", "approve-bill", "approve-customer-invoice", "complete-project", "create-bill", "create-customer-invoice", "create-estimate", "create-placeholder-bill", "delete-budget-commission", "delete-budget-discount", "delete-bill", "delete-budget", "delete-customer-invoice", "mark-budget-items-not-utilized", "mark-budget-won", "mark-customer-invoice-sent-externally", "patch-bill-payment", "reject-customer-invoice", "restore-budget-item", "restore-budget-version", "replace-budget-item", "sync-customer-invoice", "update-bill", "update-bill-payment-evidence", "update-bill-status", "update-budget-commission", "update-budget-discount", "update-budget-status", "update-project-status", "void-customer-invoice"]), deleteTargets = /* @__PURE__ */ new Set(["cleanup-staged-bill-attachments", "delete-webhook-endpoint", "cleanup-staged-quotation-attachments", "discard-customer-invoice", "complete-project", "mark-budget-items-not-utilized", "\
6990
+ remove-budget-item", "restore-budget-version", "update-project-status"]), explicitEffects = { "resubmit-customer-invoice": [
6991
+ "state-change",
6992
+ "external-write",
6993
+ "financial-write",
6994
+ "email"
6995
+ ], "rotate-webhook-secret": ["state-change"], "replay-webhook-delivery": ["state-change", "external-write"] }, effectsFor = __name2((legacyTarget) => {
7023
6996
  const explicit = explicitEffects[legacyTarget];
7024
6997
  if (explicit) return explicit;
7025
6998
  const effects = /* @__PURE__ */ new Set();
7026
6999
  return mutationPrefixes.some((prefix) => legacyTarget.startsWith(prefix)) && effects.add("state-change"), (legacyTarget.startsWith("delete-") || deleteTargets.has(legacyTarget)) && effects.add("delete"), emailTargets.has(legacyTarget) && effects.add("email"), externalWriteTargets.has(legacyTarget) && effects.add("external-write"), financialWriteTargets.has(legacyTarget) && effects.add("financial-write"), [...effects];
7027
- }, "effectsFor"), titleCase = __name2((value) => value.split("-").map((word) => "".concat(word.slice(0, 1).toUpperCase()).concat(word.slice(1))).join(" "), "titleCase"), SUMMARIES = /* @__PURE__ */ new Map([
7028
- ["update-budget-status", "Update budget status. APPROVED requires a current Lead/Admin role; budget management permission alone is insufficient. Ordinary users must request approval. Status changes invalidate old pending requests."],
7029
- ["approve-budget", "Decide your assigned pending budget approval as a current Lead/Admin. Material edits supersede old requests; inspect the latest content and use a fresh request after edits."],
7030
- ["reject-budget", "Decide your assigned pending budget approval as a current Lead/Admin. Material edits supersede old requests; inspect the latest content and use a fresh request after edits."],
7031
- ["create-budget-approval", "Request budget approval for the current content, superseding older pending requests. Existing Lead/Admin autoapproval remains available."],
7032
- ["update-budget-item-supplier", "Change a budget item's eligible supplier/GST snapshot as a material financial edit. Supersede pending approvals and apply the standard budget-to-DRAFT reset policy; inspect and request approval again. An unchanged supplier is a no-op."],
7033
- ["submit-quotation", "Submit a quotation for signing and approval. Claim the captured revision and exact allocation selection; concurrent edits, budget-item deletion or restore cascades conflict instead of attaching old signed PDFs. Refresh and resubmit the current content. The signed PDF is stamped by a queued job (pdfProcessing: PROCESSING until linked); a file whose PDF conversion failed must be uploaded again first. The result includes gstMismatch (null, or the basis, expected GST, saved GST and their difference; see create-quotation); it is a warning only and the approval email shows it to approvers."],
7034
- ["approve-quotation", "Approve your assigned pending quotation as a current Admin. Claim the captured revision and exact allocation selection after signing; concurrent changes conflict and roll back the decision, signed-PDF job and email/outbox. Refresh and review the current content before retrying. The final signed PDF is stamped by a queued job (pdfProcessing); a stopped earlier PDF step blocks approval until it is retried."],
7035
- ["approve-supplier", "Approve a pending supplier request and send a requester reply email, or directly re-approve a rejected supplier as Admin/Lead without a pending request or email. The QuickBooks vendor is created, linked or updated by a queued job (quickBooksSyncQueued, operationId); the supplier stays PENDING_APPROVAL until QuickBooks confirms, and archived suppliers remain archived. Argument: <supplierId>."],
7036
- ["get-bill-details", "Get a bill's summary as shown in the web app: status, amounts, people, payment and line totals. Use get-bill-line-items, get-bill-approvals, get-bill-attachments or get-bill-payment for more detail. Argument: <billId>."],
7037
- ["get-bill-line-items", "List a bill's line items with budget-item and quotation-allocation detail. <billId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
7038
- ["get-bill-approvals", "List a bill's approval requests with approver, requester and responder. <billId> [--limit 1-50] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
7039
- ["get-bill-payment", "Get a bill's payment status, reference, date, tracking URL, QuickBooks link and external payment. Argument: <billId>."],
7040
- ["get-quotation", "Get a quotation as shown in the web app: status, documentOnly (true for a $0 supplier document that is never a bill quotation source and does not count as coverage), amounts, people, line totals, files and approvals. pdfProcessing is { status: PROCESSING | FAILED, step: NORMALIZE | STAMP, operationId, error } while a queued PDF conversion or signing step has not linked its PDF, else null. gstMismatch is null, or { basis, expectedGstAmount, enteredGstAmount, difference, message } when the saved GST is non-zero and more than $0.05 away from the expected GST (TAXABLE_LINES: the bill calculation for the quoted lines; FULL_SUBTOTAL: 9% of the subtotal); check it before approving. Use get-quotation-line-items for budget-item detail. Argument: <quotationId>."],
7041
- ["get-customer-invoice", "Get an invoice batch as shown in the web app: status, totals, people, approvals and invoice summaries. Use get-customer-invoice-invoices, get-customer-invoice-lines, get-customer-invoice-approvals or get-customer-invoice-history for more detail. Argument: <batchId>."],
7042
- ["get-customer-invoice-invoices", "List a batch's invoices with QuickBooks id/doc number, issue/due dates, amounts, sync state and sender. Argument: <batchId>."],
7043
- ["get-customer-invoice-lines", "List one invoice's lines (name, description, QuickBooks item/tax code, quantity, amounts). <invoiceId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
7044
- ["get-customer-invoice-approvals", "List an invoice batch's approval requests with approver, requester and responder. <batchId> [--limit 1-50] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
7045
- ["get-customer-invoice-history", "List an invoice batch's status history (batch/invoice status changes, source, note, actor). <batchId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
7046
- ["get-customer-invoice-payments", "List the payments QuickBooks applied to one invoice: payment id, date, reference, amount applied, total and attachment names. Argument: <invoiceId> (from get-customer-invoice-invoices). Live QuickBooks read."],
7047
- ["get-quotation-line-items", "List a quotation's line items with budget-item, supplier and budget detail. <quotationId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
7048
- ["get-bill-attachments", "List bill attachments with cursor pagination. <billId> [--limit 1-50] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
7049
- ["get-budget-categories", "List budget categories with cursor pagination. [--q] [--limit 1-100] [--cursor <token>] Active categories, name A\u2013Z. Returns { items, pageInfo }; follow nextCursor with the same --q."],
7050
- ["get-supplier-overview", "Get a supplier's profile, approvals, pending update, attachments and tab counts (usageCount, _count.items). Skips usage rows, spending and items; use get-supplier-usage or get-supplier-items for those."],
7051
- ["get-supplier-usage", "Get a supplier's usage rows (accepted/closed budget lines and lines with its actual spending) plus spending, actualSpending and estimatedSpending."],
7052
- ["get-supplier-items", "Get the inventory items catalogued under a supplier."],
7053
- ["get-supplier-analytics", "List supplier analytics rows with cursor pagination. [--name] [--status CSV] [--gstRegistered true|false] [--createdBy <text>] [--timeFrame ALL|LAST_YEAR|LAST_6_MONTHS|LAST_3_MONTHS|CUSTOM] [--startDate <ISO> --endDate <ISO>] [--sortBy name|gstRegistered|status|phone|email|updatedAt|createdAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Admin. Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected."],
7054
- ["list-api-keys", "List API keys with cursor pagination. [--userId <userId>] [--limit 1-100] [--cursor <token>] (newest first, { items, pageInfo }; defaults to the caller; admin required for another user)"],
7055
- ["list-claims", "List reimbursable claims with cursor pagination. Same flags as list-bills (--limit 1-100, --cursor, --direction forward|backward); ignores --isClaimable. Returns { items, pageInfo }."],
7056
- ["list-bills", "List bills with cursor pagination. [--projectId] [--budgetId] [--status CSV] [--search <text>] [--isClaimable true|false] [--createdByIds <csv>] [--sortBy createdAt|amount|status] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Returns { items, pageInfo }; pass nextCursor with --direction forward or previousCursor with --direction backward, keeping the same filters and sort. --page/--pageSize/--perPage are rejected."],
7057
- ["list-customer-invoices", "List customer invoice batches with cursor pagination. [budgetId] [--projectId <id>] [--companyIds CSV] [--projectIds CSV] [--budgetIds CSV] [--createdByIds CSV] [--status CSV] [--search] [--sortBy createdAt|status|totalInvoiceAmount|approvalExpiresAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected. No scope flag lists invoices globally. --projectId uses the project scope. A positional budgetId is a backward-compatible shortcut for --budgetIds."],
7058
- ["list-quotations", "List quotations with cursor pagination. [--projectId] [--budgetId] [--supplierId] [--status CSV] [--createdBy CSV] [--search] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Newest first; returns { items, pageInfo }; each row carries documentOnly (document-only $0 quotations are listed and counted like any other). Follow nextCursor/previousCursor with the same filters. --page/--pageSize/--perPage are rejected; --requesterIds remains an alias for --createdBy."],
7059
- ["list-users", "List users with cursor pagination. [--q] [--projectTeamOnly true|false] [--limit 1-100] [--cursor <token>] Name A\u2013Z. Returns { items, pageInfo }; follow nextCursor with the same --q and --projectTeamOnly. --projectTeamOnly true lists only active @getout.sg users, the only accounts accepted as Inside Sales, Business Development or Project Manager. --page/--perPage are rejected."],
7060
- ["list-companies", "List companies with cursor pagination. Returns { items, pageInfo }; default sort is createdAt descending with limit 20. Pass nextCursor forward or previousCursor backward unchanged. Legacy page/perPage flags are rejected."],
7061
- ["count-companies", "Count companies independently from list pagination. Returns { totalCount, counts: { active: { true, false } } }; accepts filters only and rejects pagination/sorting flags."],
7062
- ["list-projects", "List projects with cursor pagination. Returns { items, pageInfo }; default sort is createdAt descending with limit 20. Supports legacy --status plus optional --statuses, WON-date filters (--wonFrom, --wonTo, --wonWithinDays) and --sortBy wonAt; pass nextCursor forward or previousCursor backward unchanged. Legacy page/perPage flags are rejected."],
7063
- ["count-projects", "Count projects independently from list pagination. Returns { totalCount, counts: { status, active: { true, false } } }; accepts project filters only and rejects pagination/sorting flags."],
7064
- ["search-existing-companies", "Search BB and QuickBooks companies without writes. --query <name> [--limit 1-50] [--cursor <token>]. Returns { items, totalCount, pageInfo }; follow pageInfo.nextCursor with the same --query. Legacy --page is rejected."],
7065
- ["use-existing-company", "Reuse a company in BB and QuickBooks, creating only its missing counterpart. Supply --companyId <bbId> and/or --quickbooksId <qboId>; both explicitly connect records with different names. Importing a QuickBooks-only company also needs --name <QuickBooks name from search-existing-companies>. --website <url> fills a missing QBO import website only. --confirmDistinct true confirms no similar record represents this entity. BB saves the company now; its QuickBooks customer is checked, found or created and linked by a queued job (quickBooksSyncQueued, operationId). Estimates, invoices and QuickBooks projects wait for that link."],
7066
- ["create-company", "Create or reuse a company in BB and QuickBooks. --name <name> --website <url> [--billingEmails '<json-array>'] (up to 50 invoice Cc defaults, stored in BB only for new companies; reused company defaults are preserved). Similar names require --confirmDistinct true; inactive companies are never reactivated. BB saves the company now; its QuickBooks customer is found or created by a queued job (quickBooksSyncQueued, operationId), which stops if similar QuickBooks customers exist without --confirmDistinct."],
7067
- ["create-project", "Create a project linked to an existing Asana Deals lead task. Supply --asanaTaskId in non-interactive use; interactive use searches for and selects a lead task (optionally --asanaSearch). The Slack channel is resolved from the selected Asana task unless all three Slack channel flags are supplied. For a new direct client, create the lead task using the website form first."],
7068
- ["create-supplier", "Create a supplier using --payload JSON; pending-approval suppliers also request approval and send emails. Reusing an archived name requires Admin; normal users and Leads must ask an Admin to reactivate it before editing. Recreation preserves the existing approval status and creator. Lead/Admin-created suppliers (and archived-name revivals) queue their QuickBooks vendor create or link (quickBooksSyncQueued, operationId) and become usable once QuickBooks confirms; the request makes no QuickBooks call."],
7069
- ["preview-qbo-customer-invoice", "Preview an available QuickBooks invoice selected for a BB budget using read-only QBO access. Arguments: <budgetId> <qboInvoiceId>."],
7070
- ["preview-customer-invoice-amount", "Preview amount before GST, GST, and total for a percentage of an accepted estimate. Arguments: <budgetId> <percentage-of-estimate>."],
7071
- ["list-available-qbo-customer-invoices", "List unlinked QuickBooks invoices available for an accepted or closed estimate. Argument: <budgetId>."],
7072
- ["resubmit-customer-invoice", "Resubmit a confirmed expired-and-voided BB invoice as its original requester. Argument: <batchId>. Queues one replacement using the current estimate, original percentage, due date and details; retries return the same replacement. No customer email."],
7073
- ["create-customer-invoice", "Create one invoice from an eligible budget using --payload JSON with invoice date, due date, billing address, customer memo, and a percentage of the original estimate that does not exceed its remaining coverage."],
7074
- ["import-qbo-customer-invoice", "Link an existing QuickBooks invoice in BB only after reviewing preview-qbo. Arguments: <budgetId> <qboInvoiceId> --token <previewToken>. Supports closed estimates; no QBO writes or emails."],
7075
- ["whoami", "Show the active API-key identity."],
7076
- ["list-budgets", "List one cursor page of budgets ({ items, pageInfo }; --limit/--cursor/--direction). Omit --active for active budgets only; use --active false or --active all for Admin-only historical reads."],
7077
- ["list-items", "List one cursor page of catalogue items ({ items, pageInfo }; --limit/--cursor/--direction, optional --sortBy/--sortDir). --page/--perPage are rejected."],
7078
- ["list-item-categories", "List one cursor page of active item categories ({ items, pageInfo }; --limit/--cursor/--direction, optional --name/--sortBy/--sortDir). --page/--perPage are rejected."],
7079
- ["create-item-category", "Admin only. Create (or reactivate) an item category. Budget Builder saves it now and a queued job creates or links the QuickBooks category (quickBooksSyncQueued, operationId); the request makes no QuickBooks call."],
7080
- ["update-item-category", "Rename an item category. Budget Builder saves the name immediately; a category linked to QuickBooks is renamed there by a queued job (quickBooksSyncQueued: true, operationId), never during the request."],
7081
- ["count-item-categories", "Count active item categories matching --name: { totalCount }."],
7082
- ["list-webhook-deliveries", "Admin-only: list webhook deliveries newest first. Returns { items, pageInfo }; follow pageInfo.nextCursor (or previousCursor with --direction backward). Cursors are opaque and filter-bound; raw delivery ids are rejected."],
7083
- ["list-integration-operations", "List one cursor page of integration operations, newest first ({ items, pageInfo }; --limit/--cursor/--direction). --page/--perPage are rejected. Admin only."],
7084
- ["count-integration-operations", "Provider filter options for integration operations: { filterOptions }. No total; filter flags are accepted but do not change the result. Admin only."],
7085
- ["count-items", "Count catalogue items matching filters: total plus category and supplier facets (each ignores its own filter)."],
7086
- ["count-budgets", "Count budgets matching filters: totalCount plus status and active facets. Omit --active for active budgets only."],
7087
- ["get-budget", "Get a budget by ID. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."],
7088
- ["get-budget-items", "Get line items for a budget. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."],
7089
- ["get-budget-details", "Get budget details. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."],
7090
- ["create-bill", "Create a bill or claim with an approved supplier. All amount fields exclude GST: amount is the portion billed; extractedAmount is the full invoice subtotal; lineAmounts and quotationAllocations also exclude GST. Example: 1800 + 162 GST = 1962 total requires amount=1800 and extractedAmount=1800 for a full bill. The CLI does not strip GST from input. If the selected quotations cannot split the bill amount across every selected line (a line without a quoted amount that cannot be derived from the quotation total), pass lineAmounts; updates that keep the same amount and lines reuse the existing line amounts. --draft-only guarantees DRAFT without email or external writes; otherwise unpaid creation skips email permission but keeps external-write permission. The result includes quotationOverBillingWarnings; a non-empty list means linked non-rejected bills exceed a quotation's quoted amount. It is a warning only and the write still succeeds. An Admin's unpaid bill is approved on creation and its QuickBooks bill is created by a queued job: the result has quickBooksSyncQueued: true and operationId; follow it with list-integration-operations. The request itself never writes to QuickBooks. Quotations with documentOnly: true (a $0 supplier document) are never valid bill quotation sources and are rejected; a budget line covered only by one still counts as unquoted."],
7091
- ["record-external-bill-payment", "Record an already-made payment on an APPROVED bill or claim, with no email and no money transfer. Requires <billId> --paymentReference --paymentDate YYYY-MM-DD --paymentAccount <QBO account ID> [--paymentProof receipt.pdf]. The account must be in the cached list (list-external-payment-accounts); the request makes no QuickBooks call. An inactive account (inactiveAccounts) only links the bill's existing QuickBooks payment when the bill is already settled; if there is none, the job is refused before anything is created and the bill goes back to APPROVED. Reuses settled QBO payment links or queues one dated payment from the selected account; the queued job re-checks the account in QuickBooks and stops in the Integration Queue if it is not active. Exact retries are safe; do not pay again while reconciliation is pending."],
7092
- ["mark-customer-invoice-sent-externally", "Admin only. Record an APPROVED customer invoice as SENT (source EXTERNAL) because it was emailed to the customer outside Budget Builder. Sends no email and writes nothing to QuickBooks. Requires <invoiceId> --sentAt <ISO datetime, not in the future, not before approval> --recipients a@x.com,b@y.com [--note <message reference>]."],
7093
- ["list-external-payment-accounts", "List active QuickBooks bank and credit-card account IDs for recording external payments (admin only), from Budget Builder's cached list: { accounts, cacheState, inactiveAccounts, refreshedAt, refresh }. inactiveAccounts can only link an already-settled bill's existing payment. No QuickBooks call. The worker refreshes the list automatically every day and after a QuickBooks company change; cacheState is READY, NOT_LOADED (first load pending), REALM_CHANGED (refreshing after a company change; no accounts served and external payments refused until it lands) or DISCONNECTED."],
7094
- ["refresh-external-payment-accounts", "Admin only. Queue a refresh of the cached QuickBooks payment-account list ({ operationId, status: QUEUED }); a refresh already waiting is reused. Optional: the worker already refreshes the list every day and after a QuickBooks company change. Check refreshedAt with list-external-payment-accounts."],
7095
- ["update-bill", "Update a bill or claim with a partial payload including id; omitted fields are preserved. Comment-only updates are allowed on approved/paid bills without altering financial data or QuickBooks. All amount fields exclude GST: amount is the portion billed; extractedAmount is the full invoice subtotal; lineAmounts and quotationAllocations also exclude GST. Example: 1800 + 162 GST = 1962 total requires amount=1800 and extractedAmount=1800 for a full bill. The CLI does not strip GST from input. If the selected quotations cannot split the bill amount across every selected line (a line without a quoted amount that cannot be derived from the quotation total), pass lineAmounts; updates that keep the same amount and lines reuse the existing line amounts. Re-read and verify both amount fields and allocations after correcting a gross/net mistake. The result includes quotationOverBillingWarnings; a non-empty list means linked non-rejected bills exceed a quotation's quoted amount. It is a warning only and the write still succeeds. Quotations with documentOnly: true (a $0 supplier document) are never valid bill quotation sources and are rejected; a budget line covered only by one still counts as unquoted."],
7096
- ["validate-bill-selection", "Validate the approved supplier and selected bill line items. Supplier bills need approved quotation sources (quotationIds, legacy quotationId, or quotationAllocations with lineAmounts) for every line that is not quotation-exempt (Go Internal lines, or projects/budgets created before the quotation cutoff). With billId, lines already on the bill keep their stored sources unless new sources are supplied. Exemption is decided by the server, so there is no --quotation-exempt flag here. Amounts (amount, lineAmounts, quotationAllocations) are ex-GST dollars with at most 2 decimal places. Returns { success, quotationOverBillingWarnings }: a non-empty warning list means the selection would bill a quotation above its quoted amount (counting other non-rejected bills); this is a warning only and does not fail validation. Quotations with documentOnly: true (a $0 supplier document) are never valid bill quotation sources and are rejected; a budget line covered only by one still counts as unquoted."],
7097
- ["create-quotation", 'Create a quotation with an approved supplier using --payload JSON. Include projectId, budgetId, supplierId, budgetItemIds, amountWithoutGst, gstAmount, and one uploaded attachment in attachments. Multiple budget items require lineAmounts: [{"budgetItemId":"<first-id>","amount":750},{"budgetItemId":"<second-id>","amount":450}], covering every selected budget-item ID exactly once and summing to amountWithoutGst. Amounts exclude GST; use gstAmount: 0 for no GST. Example: amountWithoutGst: 1200 with line amounts 750 and 450. The upload is checked and converted to PDF by a queued job (pdfProcessing in the result and in get-quotation). The result includes gstMismatch: null, or { basis, expectedGstAmount, enteredGstAmount, difference, message } when gstAmount is non-zero and more than $0.05 away from the expected GST. basis TAXABLE_LINES uses the bill calculation for the quoted lines (9% of each in-scope line, rounded per line; none for a non-GST-registered supplier); FULL_SUBTOTAL is 9% of amountWithoutGst, used when line amounts are unknown. It is a warning only (GST 0 is always accepted) and the write still succeeds. Document-only quotation (a $0 supplier document, for example a supplier contract or proposal with no price): set documentOnly: true with amountWithoutGst: 0, gstAmount: 0 and every lineAmounts amount 0 (lineAmounts may be omitted; the API fills zeros). It uses the normal draft, submit, sign and Admin approve flow with the attachment, appears in list/get output with documentOnly: true, counts in quotation lists and approval queues, but does not count as quotation coverage: a budget line covered only by it still counts as unquoted, and it is never a valid bill quotation source (create-bill, update-bill, validate-bill-selection and link-bill-quotations are rejected by the API). Without documentOnly (default false), amountWithoutGst must be positive.'],
7098
- ["cleanup-staged-quotation-attachments", "Queue independent cleanup operations for unattached staged quotation uploads; returns operation IDs and queued/skipped counts, not deletion confirmation. Arguments: <projectId> --keys <csv>."],
7099
- ["update-quotation", 'Update a DRAFT or REJECTED quotation using --payload JSON with id and the complete creation payload. Multiple budget items require lineAmounts: [{"budgetItemId":"<first-id>","amount":750},{"budgetItemId":"<second-id>","amount":450}], covering every budgetItemIds entry exactly once and summing to amountWithoutGst. Amounts exclude GST; use gstAmount: 0 for no GST. The result includes gstMismatch: null, or { basis, expectedGstAmount, enteredGstAmount, difference, message } when gstAmount is non-zero and more than $0.05 away from the expected GST. basis TAXABLE_LINES uses the bill calculation for the quoted lines (9% of each in-scope line, rounded per line; none for a non-GST-registered supplier); FULL_SUBTOTAL is 9% of amountWithoutGst, used when line amounts are unknown. It is a warning only (GST 0 is always accepted) and the write still succeeds. Update is a full replace: send documentOnly: true again when updating a document-only quotation (documentOnly: true with amountWithoutGst: 0, gstAmount: 0 and zero lineAmounts; default false requires a positive amountWithoutGst), or it is treated as a priced quotation. Document-only quotations are never valid bill quotation sources and do not count as quotation coverage.'],
7100
- ["download-customer-invoice-pdf", "Download a customer invoice PDF when permitted."],
7101
- ["send-customer-invoice-to-contact-person", "Send a customer invoice and update the project billing email. Omit payload cc to use company billing defaults; an explicit list replaces them and [] removes them. Required internal Cc still applies."],
7102
- ["update-company", "Save company fields in BB and queue independent QuickBooks name/website synchronization; returns operation ID, not provider completion. Optional payload billingEmails: email string array (max 50), omit to preserve defaults or [] to clear. Billing emails stay in BB; estimates are unchanged."],
7103
- ["get-company-quickbooks-sync-status", "Read saved company synchronization status without provider calls or polling; use companyId."],
7104
- ["get-item-quickbooks-sync-status", "Read saved item QuickBooks synchronization status without provider calls or polling; use itemId."],
7105
- ["create-webhook-endpoint", "Admin-only: subscribe an HTTPS endpoint to BB events. --name --url --events <type|prefix.*|*,...>. Prints the whsec_ signing secret once; deliveries use Standard Webhooks headers."],
7106
- ["rotate-webhook-secret", "Admin-only: issue a new signing secret; older secrets keep signing for --previousSecretTtlHours (default 24). Prints the new secret once. Argument: <endpointId>."],
7107
- ["send-webhook-test-event", "Admin-only: send a signed webhook.test event to one endpoint. Argument: <endpointId>."],
7108
- ["replay-webhook-delivery", "Admin-only: resend a finished webhook delivery with the same eventId on a fresh attempt chain. Argument: <deliveryId>."],
7109
- ["get-error", "Admin-only: one error log with full diagnostics (stack, cause, request details, metadata, AI summary, resolution). Argument: <errorId>. error recent list returns table columns only."],
7110
- ["get-webhook-delivery", "Admin-only: one webhook delivery with payload and attempts (status codes, errors, durations). Argument: <deliveryId>."],
7111
- ["list-webhook-event-types", "List the outbound webhook event catalogue with group and live/planned status."],
7112
- ["reconcile-resource-operation", "Admin-only check of a saved QuickBooks invoice/company/item job outcome; reads the provider only when uncertain. Applied changes are finished locally without repeating the provider mutation; provably unapplied ones are queued again. Argument: <operationId>."],
7113
- ["get-integration-operation", "Admin-only read of one integration job: who queued it, the records it is for with app links, saved QuickBooks progress, admin actions and Retry state. No provider calls. Argument: <operationId>."],
7114
- ["retry-integration-operation", "Admin-only retry of a failed integration job. QuickBooks jobs with a saved attempt check QuickBooks first: applied changes finish without resending, provably unapplied ones are sent again, unprovable ones stay stopped with the reason. Argument: <operationId>."]
7115
- ]), summaryFor = __name2((legacyTarget) => {
7000
+ }, "effectsFor"), titleCase = __name2((value) => value.split("-").map((word) => "".concat(word.slice(0, 1).toUpperCase()).concat(word.slice(1))).join(" "), "titleCase"), SUMMARIES = /* @__PURE__ */ new Map([["update-budget-status", "Update budget status. APPROVED requires a current Lead/Admin role; budget management permission alone is insufficient. Ordinary users must request approval. Status changes invalidate old pending requests."], ["approve-budget", "Decide your assigned pending budget approval as a current Lead/Admin. Material edits supersede old requests; inspect the latest content and use a fresh request after edits."], ["reject-budget", "Decide your assigned pending budget approval as a current Lead/Admin. Material edits supersede old requests; inspect the latest content and use a fresh request after edits."], ["create-budget-approval", "Request budget approval for the current content, superseding older pending requests. Existing Lead/Admin autoapproval remains available."], [
7001
+ "update-budget-item-supplier", "Change a budget item's eligible supplier/GST snapshot as a material financial edit. Supersede pending approvals and apply the standard budget-to-DRAFT reset policy; inspect and request approval again. An unchanged supplier is a no-op."], ["submit-quotation", "Submit a quotation for signing and approval. Claim the captured revision and exact allocation selection; concurrent edits, budget-item deletion or restore cascades conflict instead of attaching old signed PDFs. Refresh and resubmit the current content. The signed PDF is stamped by a queued job (pdfProcessing: PROCESSING until linked); a file whose PDF conversion failed must be uploaded again first. The result includes gstMismatch (null, or the basis, expected GST, saved GST and their difference; see create-quotation); it is a warning only and the approval email shows it to approvers."], ["approve-quotation", "Approve your assigned pending quotation as a current Admin. Claim the captured revision and\
7002
+ exact allocation selection after signing; concurrent changes conflict and roll back the decision, signed-PDF job and email/outbox. Refresh and review the current content before retrying. The final signed PDF is stamped by a queued job (pdfProcessing); a stopped earlier PDF step blocks approval until it is retried."], ["approve-supplier", "Approve a pending supplier request and send a requester reply email, or directly re-approve a rejected supplier as Admin/Lead without a pending request or email. The QuickBooks vendor is created, linked or updated by a queued job (quickBooksSyncQueued, operationId); the supplier stays PENDING_APPROVAL until QuickBooks confirms, and archived suppliers remain archived. Argument: <supplierId>."], ["get-bill-details", "Get a bill's summary as shown in the web app: status, amounts, people, payment and line totals. Use get-bill-line-items, get-bill-approvals, get-bill-attachments or get-bill-payment for more detail. Argument: <billId>."], ["get-bill-line-i\
7003
+ tems", "List a bill's line items with budget-item and quotation-allocation detail. <billId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."], ["get-bill-approvals", "List a bill's approval requests with approver, requester and responder. <billId> [--limit 1-50] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."], ["get-bill-payment", "Get a bill's payment status, reference, date, tracking URL, QuickBooks link and external payment. Argument: <billId>."], ["get-quotation", "Get a quotation as shown in the web app: status, documentOnly (true for a $0 supplier document that is never a bill quotation source and does not count as coverage), amounts, people, line totals, files and approvals. pdfProcessing is { status: PROCESSING | FAILED, step: NORMALIZE | STAMP, operationId, error } while a queued PDF conversion or signing step has not linked its PDF, else null. gstMismatch is null, or { basis, expectedGstAmount\
7004
+ , enteredGstAmount, difference, message } when the saved GST is non-zero and more than $0.05 away from the expected GST (TAXABLE_LINES: the bill calculation for the quoted lines; FULL_SUBTOTAL: 9% of the subtotal); check it before approving. Use get-quotation-line-items for budget-item detail. Argument: <quotationId>."], ["get-customer-invoice", "Get an invoice batch as shown in the web app: status, totals, people, approvals and invoice summaries. Use get-customer-invoice-invoices, get-customer-invoice-lines, get-customer-invoice-approvals or get-customer-invoice-history for more detail. Argument: <batchId>."], ["get-customer-invoice-invoices", "List a batch's invoices with QuickBooks id/doc number, issue/due dates, amounts, sync state and sender. Argument: <batchId>."], ["get-customer-invoice-lines", "List one invoice's lines (name, description, QuickBooks item/tax code, quantity, amounts). <invoiceId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follo\
7005
+ w nextCursor."], ["get-customer-invoice-approvals", "List an invoice batch's approval requests with approver, requester and responder. <batchId> [--limit 1-50] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."], ["get-customer-invoice-history", "List an invoice batch's status history (batch/invoice status changes, source, note, actor). <batchId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."], ["get-customer-invoice-payments", "List the payments QuickBooks applied to one invoice: payment id, date, reference, amount applied, total and attachment names. Argument: <invoiceId> (from get-customer-invoice-invoices). Live QuickBooks read."], ["get-quotation-line-items", "List a quotation's line items with budget-item, supplier and budget detail. <quotationId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."], ["get-bill-attachments", "List bill attachments with c\
7006
+ ursor pagination. <billId> [--limit 1-50] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."], ["get-budget-categories", "List budget categories with cursor pagination. [--q] [--limit 1-100] [--cursor <token>] Active categories, name A\u2013Z. Returns { items, pageInfo }; follow nextCursor with the same --q."], ["get-supplier-overview", "Get a supplier's profile, approvals, pending update, attachments and tab counts (usageCount, _count.items). Skips usage rows, spending and items; use get-supplier-usage or get-supplier-items for those."], ["get-supplier-usage", "Get a supplier's usage rows (accepted/closed budget lines and lines with its actual spending) plus spending, actualSpending and estimatedSpending."], ["get-supplier-items", "Get the inventory items catalogued under a supplier."], ["get-supplier-analytics", "List supplier analytics rows with cursor pagination. [--name] [--status CSV] [--gstRegistered true|false] [--createdBy <text>] [--timeFrame AL\
7007
+ L|LAST_YEAR|LAST_6_MONTHS|LAST_3_MONTHS|CUSTOM] [--startDate <ISO> --endDate <ISO>] [--sortBy name|gstRegistered|status|phone|email|updatedAt|createdAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Admin. Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected."], ["list-api-keys", "List API keys with cursor pagination. [--userId <userId>] [--limit 1-100] [--cursor <token>] (newest first, { items, pageInfo }; defaults to the caller; admin required for another user)"], ["list-claims", "List reimbursable claims with cursor pagination. Same flags as list-bills (--limit 1-100, --cursor, --direction forward|backward); ignores --isClaimable. Returns { items, pageInfo }."], ["list-bills", "List bills with cursor pagination. [--projectId] [--budgetId] [--status CSV] [--search <text>] [--isClaimable true|false] [--createdByIds <csv>] [--sortBy createdAt|amount|status] [--sortDir asc|des\
7008
+ c] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Returns { items, pageInfo }; pass nextCursor with --direction forward or previousCursor with --direction backward, keeping the same filters and sort. --page/--pageSize/--perPage are rejected."], ["list-customer-invoices", "List customer invoice batches with cursor pagination. [budgetId] [--projectId <id>] [--companyIds CSV] [--projectIds CSV] [--budgetIds CSV] [--createdByIds CSV] [--status CSV] [--search] [--sortBy createdAt|status|totalInvoiceAmount|approvalExpiresAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected. No scope flag lists invoices globally. --projectId uses the project scope. A positional budgetId is a backward-compatible shortcut for --budgetIds."], ["list-quotations", "List quotations with cursor pagination. [--projectId] [--budgetId] [--su\
7009
+ pplierId] [--status CSV] [--createdBy CSV] [--search] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Newest first; returns { items, pageInfo }; each row carries documentOnly (document-only $0 quotations are listed and counted like any other). Follow nextCursor/previousCursor with the same filters. --page/--pageSize/--perPage are rejected; --requesterIds remains an alias for --createdBy."], ["list-users", "List users with cursor pagination. [--q] [--projectTeamOnly true|false] [--limit 1-100] [--cursor <token>] Name A\u2013Z. Returns { items, pageInfo }; follow nextCursor with the same --q and --projectTeamOnly. --projectTeamOnly true lists only active @getout.sg users, the only accounts accepted as Inside Sales, Business Development or Project Manager. --page/--perPage are rejected."], ["list-companies", "List companies with cursor pagination. Returns { items, pageInfo }; default sort is createdAt descending with limit 20. Pass nextCursor forward or previousCursor ba\
7010
+ ckward unchanged. Legacy page/perPage flags are rejected."], ["count-companies", "Count companies independently from list pagination. Returns { totalCount, counts: { active: { true, false } } }; accepts filters only and rejects pagination/sorting flags."], ["list-projects", "List projects with cursor pagination. Returns { items, pageInfo }; default sort is createdAt descending with limit 20. Supports legacy --status plus optional --statuses, WON-date filters (--wonFrom, --wonTo, --wonWithinDays) and --sortBy wonAt; pass nextCursor forward or previousCursor backward unchanged. Legacy page/perPage flags are rejected."], ["count-projects", "Count projects independently from list pagination. Returns { totalCount, counts: { status, active: { true, false } } }; accepts project filters only and rejects pagination/sorting flags."], ["search-existing-companies", "Search BB and QuickBooks companies without writes. --query <name> [--limit 1-50] [--cursor <token>]. Returns { items, totalCount, pag\
7011
+ eInfo }; follow pageInfo.nextCursor with the same --query. Legacy --page is rejected."], ["use-existing-company", "Reuse a company in BB and QuickBooks, creating only its missing counterpart. Supply --companyId <bbId> and/or --quickbooksId <qboId>; both explicitly connect records with different names. Importing a QuickBooks-only company also needs --name <QuickBooks name from search-existing-companies>. --website <url> fills a missing QBO import website only. --confirmDistinct true confirms no similar record represents this entity. BB saves the company now; its QuickBooks customer is checked, found or created and linked by a queued job (quickBooksSyncQueued, operationId). Estimates, invoices and QuickBooks projects wait for that link."], ["create-company", "Create or reuse a company in BB and QuickBooks. --name <name> --website <url> [--billingEmails '<json-array>'] (up to 50 invoice Cc defaults, stored in BB only for new companies; reused company defaults are preserved). Similar names\
7012
+ require --confirmDistinct true; inactive companies are never reactivated. BB saves the company now; its QuickBooks customer is found or created by a queued job (quickBooksSyncQueued, operationId), which stops if similar QuickBooks customers exist without --confirmDistinct."], ["create-project", "Create a project linked to an existing Asana Deals lead task. Supply --asanaTaskId in non-interactive use; interactive use searches for and selects a lead task (optionally --asanaSearch). For a new direct client, create the lead task using the website form first."], ["create-supplier", "Create a supplier using --payload JSON; pending-approval suppliers also request approval and send emails. Reusing an archived name requires Admin; normal users and Leads must ask an Admin to reactivate it before editing. Recreation preserves the existing approval status and creator. Lead/Admin-created suppliers (and archived-name revivals) queue their QuickBooks vendor create or link (quickBooksSyncQueued, oper\
7013
+ ationId) and become usable once QuickBooks confirms; the request makes no QuickBooks call."], ["preview-qbo-customer-invoice", "Preview an available QuickBooks invoice selected for a BB budget using read-only QBO access. Arguments: <budgetId> <qboInvoiceId>."], ["preview-customer-invoice-amount", "Preview amount before GST, GST, and total for a percentage of an accepted estimate. Arguments: <budgetId> <percentage-of-estimate>."], ["list-available-qbo-customer-invoices", "List unlinked QuickBooks invoices available for an accepted or closed estimate. Argument: <budgetId>."], ["resubmit-customer-invoice", "Resubmit a confirmed expired-and-voided BB invoice as its original requester. Argument: <batchId>. Queues one replacement using the current estimate, original percentage, due date and details; retries return the same replacement. No customer email."], ["create-customer-invoice", "Create one invoice from an eligible budget using --payload JSON with invoice date, due date, billing addres\
7014
+ s, customer memo, and a percentage of the original estimate that does not exceed its remaining coverage."], ["import-qbo-customer-invoice", "Link an existing QuickBooks invoice in BB only after reviewing preview-qbo. Arguments: <budgetId> <qboInvoiceId> --token <previewToken>. Supports closed estimates; no QBO writes or emails."], ["whoami", "Show the active API-key identity."], ["list-budgets", "List one cursor page of budgets ({ items, pageInfo }; --limit/--cursor/--direction). Omit --active for active budgets only; use --active false or --active all for Admin-only historical reads."], ["list-items", "List one cursor page of catalogue items ({ items, pageInfo }; --limit/--cursor/--direction, optional --sortBy/--sortDir). --page/--perPage are rejected."], ["list-item-categories", "List one cursor page of active item categories ({ items, pageInfo }; --limit/--cursor/--direction, optional --name/--sortBy/--sortDir). --page/--perPage are rejected."], ["create-item-category", "Admin only.\
7015
+ Create (or reactivate) an item category. Budget Builder saves it now and a queued job creates or links the QuickBooks category (quickBooksSyncQueued, operationId); the request makes no QuickBooks call."], ["update-item-category", "Rename an item category. Budget Builder saves the name immediately; a category linked to QuickBooks is renamed there by a queued job (quickBooksSyncQueued: true, operationId), never during the request."], ["count-item-categories", "Count active item categories matching --name: { totalCount }."], ["list-webhook-deliveries", "Admin-only: list webhook deliveries newest first. Returns { items, pageInfo }; follow pageInfo.nextCursor (or previousCursor with --direction backward). Cursors are opaque and filter-bound; raw delivery ids are rejected."], ["list-integration-operations", "List one cursor page of integration operations, newest first ({ items, pageInfo }; --limit/--cursor/--direction). --page/--perPage are rejected. Admin only."], ["count-integration-opera\
7016
+ tions", "Provider filter options for integration operations: { filterOptions }. No total; filter flags are accepted but do not change the result. Admin only."], ["count-items", "Count catalogue items matching filters: total plus category and supplier facets (each ignores its own filter)."], ["count-budgets", "Count budgets matching filters: totalCount plus status and active facets. Omit --active for active budgets only."], ["get-budget", "Get a budget by ID. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."], ["get-budget-items", "Get line items for a budget. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."], ["get-budget-details", "Get budget details. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."], ["create-bill", "Create a bill or claim with an approved supplier. All amount fields exclude GST: amount is the portion billed; extra\
7017
+ ctedAmount is the full invoice subtotal; lineAmounts and quotationAllocations also exclude GST. Example: 1800 + 162 GST = 1962 total requires amount=1800 and extractedAmount=1800 for a full bill. The CLI does not strip GST from input. If the selected quotations cannot split the bill amount across every selected line (a line without a quoted amount that cannot be derived from the quotation total), pass lineAmounts; updates that keep the same amount and lines reuse the existing line amounts. --draft-only guarantees DRAFT without email or external writes; otherwise unpaid creation skips email permission but keeps external-write permission. The result includes quotationOverBillingWarnings; a non-empty list means linked non-rejected bills exceed a quotation's quoted amount. It is a warning only and the write still succeeds. An Admin's unpaid bill is approved on creation and its QuickBooks bill is created by a queued job: the result has quickBooksSyncQueued: true and operationId; follow it w\
7018
+ ith list-integration-operations. The request itself never writes to QuickBooks. Quotations with documentOnly: true (a $0 supplier document) are never valid bill quotation sources and are rejected; a budget line covered only by one still counts as unquoted."], ["record-external-bill-payment", "Record an already-made payment on an APPROVED bill or claim, with no email and no money transfer. Requires <billId> --paymentReference --paymentDate YYYY-MM-DD --paymentAccount <QBO account ID> [--paymentProof receipt.pdf]. The account must be in the cached list (list-external-payment-accounts); the request makes no QuickBooks call. An inactive account (inactiveAccounts) only links the bill's existing QuickBooks payment when the bill is already settled; if there is none, the job is refused before anything is created and the bill goes back to APPROVED. Reuses settled QBO payment links or queues one dated payment from the selected account; the queued job re-checks the account in QuickBooks and stops\
7019
+ in the Integration Queue if it is not active. Exact retries are safe; do not pay again while reconciliation is pending."], ["mark-customer-invoice-sent-externally", "Admin only. Record an APPROVED customer invoice as SENT (source EXTERNAL) because it was emailed to the customer outside Budget Builder. Sends no email and writes nothing to QuickBooks. Requires <invoiceId> --sentAt <ISO datetime, not in the future, not before approval> --recipients a@x.com,b@y.com [--note <message reference>]."], ["list-external-payment-accounts", "List active QuickBooks bank and credit-card account IDs for recording external payments (admin only), from Budget Builder's cached list: { accounts, cacheState, inactiveAccounts, refreshedAt, refresh }. inactiveAccounts can only link an already-settled bill's existing payment. No QuickBooks call. The worker refreshes the list automatically every day and after a QuickBooks company change; cacheState is READY, NOT_LOADED (first load pending), REALM_CHANGED (refr\
7020
+ eshing after a company change; no accounts served and external payments refused until it lands) or DISCONNECTED."], ["refresh-external-payment-accounts", "Admin only. Queue a refresh of the cached QuickBooks payment-account list ({ operationId, status: QUEUED }); a refresh already waiting is reused. Optional: the worker already refreshes the list every day and after a QuickBooks company change. Check refreshedAt with list-external-payment-accounts."], ["update-bill", "Update a bill or claim with a partial payload including id; omitted fields are preserved. Comment-only updates are allowed on approved/paid bills without altering financial data or QuickBooks. All amount fields exclude GST: amount is the portion billed; extractedAmount is the full invoice subtotal; lineAmounts and quotationAllocations also exclude GST. Example: 1800 + 162 GST = 1962 total requires amount=1800 and extractedAmount=1800 for a full bill. The CLI does not strip GST from input. If the selected quotations cannot\
7021
+ split the bill amount across every selected line (a line without a quoted amount that cannot be derived from the quotation total), pass lineAmounts; updates that keep the same amount and lines reuse the existing line amounts. Re-read and verify both amount fields and allocations after correcting a gross/net mistake. The result includes quotationOverBillingWarnings; a non-empty list means linked non-rejected bills exceed a quotation's quoted amount. It is a warning only and the write still succeeds. Quotations with documentOnly: true (a $0 supplier document) are never valid bill quotation sources and are rejected; a budget line covered only by one still counts as unquoted."], ["validate-bill-selection", "Validate the approved supplier and selected bill line items. Supplier bills need approved quotation sources (quotationIds, legacy quotationId, or quotationAllocations with lineAmounts) for every line that is not quotation-exempt (Go Internal lines, or projects/budgets created before th\
7022
+ e quotation cutoff). With billId, lines already on the bill keep their stored sources unless new sources are supplied. Exemption is decided by the server, so there is no --quotation-exempt flag here. Amounts (amount, lineAmounts, quotationAllocations) are ex-GST dollars with at most 2 decimal places. Returns { success, quotationOverBillingWarnings }: a non-empty warning list means the selection would bill a quotation above its quoted amount (counting other non-rejected bills); this is a warning only and does not fail validation. Quotations with documentOnly: true (a $0 supplier document) are never valid bill quotation sources and are rejected; a budget line covered only by one still counts as unquoted."], ["create-quotation", 'Create a quotation with an approved supplier using --payload JSON. Include projectId, budgetId, supplierId, budgetItemIds, amountWithoutGst, gstAmount, and one uploaded attachment in attachments. Multiple budget items require lineAmounts: [{"budgetItemId":"<first\
7023
+ -id>","amount":750},{"budgetItemId":"<second-id>","amount":450}], covering every selected budget-item ID exactly once and summing to amountWithoutGst. Amounts exclude GST; use gstAmount: 0 for no GST. Example: amountWithoutGst: 1200 with line amounts 750 and 450. The upload is checked and converted to PDF by a queued job (pdfProcessing in the result and in get-quotation). The result includes gstMismatch: null, or { basis, expectedGstAmount, enteredGstAmount, difference, message } when gstAmount is non-zero and more than $0.05 away from the expected GST. basis TAXABLE_LINES uses the bill calculation for the quoted lines (9% of each in-scope line, rounded per line; none for a non-GST-registered supplier); FULL_SUBTOTAL is 9% of amountWithoutGst, used when line amounts are unknown. It is a warning only (GST 0 is always accepted) and the write still succeeds. Document-only quotation (a $0 supplier document, for example a supplier contract or proposal with no price): set documentOnly: true \
7024
+ with amountWithoutGst: 0, gstAmount: 0 and every lineAmounts amount 0 (lineAmounts may be omitted; the API fills zeros). It uses the normal draft, submit, sign and Admin approve flow with the attachment, appears in list/get output with documentOnly: true, counts in quotation lists and approval queues, but does not count as quotation coverage: a budget line covered only by it still counts as unquoted, and it is never a valid bill quotation source (create-bill, update-bill, validate-bill-selection and link-bill-quotations are rejected by the API). Without documentOnly (default false), amountWithoutGst must be positive.'], ["cleanup-staged-quotation-attachments", "Queue independent cleanup operations for unattached staged quotation uploads; returns operation IDs and queued/skipped counts, not deletion confirmation. Arguments: <projectId> --keys <csv>."], ["update-quotation", 'Update a DRAFT or REJECTED quotation using --payload JSON with id and the complete creation payload. Multiple budg\
7025
+ et items require lineAmounts: [{"budgetItemId":"<first-id>","amount":750},{"budgetItemId":"<second-id>","amount":450}], covering every budgetItemIds entry exactly once and summing to amountWithoutGst. Amounts exclude GST; use gstAmount: 0 for no GST. The result includes gstMismatch: null, or { basis, expectedGstAmount, enteredGstAmount, difference, message } when gstAmount is non-zero and more than $0.05 away from the expected GST. basis TAXABLE_LINES uses the bill calculation for the quoted lines (9% of each in-scope line, rounded per line; none for a non-GST-registered supplier); FULL_SUBTOTAL is 9% of amountWithoutGst, used when line amounts are unknown. It is a warning only (GST 0 is always accepted) and the write still succeeds. Update is a full replace: send documentOnly: true again when updating a document-only quotation (documentOnly: true with amountWithoutGst: 0, gstAmount: 0 and zero lineAmounts; default false requires a positive amountWithoutGst), or it is treated as a pric\
7026
+ ed quotation. Document-only quotations are never valid bill quotation sources and do not count as quotation coverage.'], ["download-customer-invoice-pdf", "Download a customer invoice PDF when permitted."], ["send-customer-invoice-to-contact-person", "Send a customer invoice and update the project billing email. Omit payload cc to use company billing defaults; an explicit list replaces them and [] removes them. Required internal Cc still applies."], ["update-company", "Save company fields in BB and queue independent QuickBooks name/website synchronization; returns operation ID, not provider completion. Optional payload billingEmails: email string array (max 50), omit to preserve defaults or [] to clear. Billing emails stay in BB; estimates are unchanged."], ["get-company-quickbooks-sync-status", "Read saved company synchronization status without provider calls or polling; use companyId."], ["get-item-quickbooks-sync-status", "Read saved item QuickBooks synchronization status without pr\
7027
+ ovider calls or polling; use itemId."], ["create-webhook-endpoint", "Admin-only: subscribe an HTTPS endpoint to BB events. --name --url --events <type|prefix.*|*,...>. Prints the whsec_ signing secret once; deliveries use Standard Webhooks headers."], ["rotate-webhook-secret", "Admin-only: issue a new signing secret; older secrets keep signing for --previousSecretTtlHours (default 24). Prints the new secret once. Argument: <endpointId>."], ["send-webhook-test-event", "Admin-only: send a signed webhook.test event to one endpoint. Argument: <endpointId>."], ["replay-webhook-delivery", "Admin-only: resend a finished webhook delivery with the same eventId on a fresh attempt chain. Argument: <deliveryId>."], ["get-error", "Admin-only: one error log with full diagnostics (stack, cause, request details, metadata, AI summary, resolution). Argument: <errorId>. error recent list returns table columns only."], ["get-webhook-delivery", "Admin-only: one webhook delivery with payload and attempts (s\
7028
+ tatus codes, errors, durations). Argument: <deliveryId>."], ["list-webhook-event-types", "List the outbound webhook event catalogue with group and live/planned status."], ["reconcile-resource-operation", "Admin-only check of a saved QuickBooks invoice/company/item job outcome; reads the provider only when uncertain. Applied changes are finished locally without repeating the provider mutation; provably unapplied ones are queued again. Argument: <operationId>."], ["get-integration-operation", "Admin-only read of one integration job: who queued it, the records it is for with app links, saved QuickBooks progress, admin actions and Retry state. No provider calls. Argument: <operationId>."], ["retry-integration-operation", "Admin-only retry of a failed integration job. QuickBooks jobs with a saved attempt check QuickBooks first: applied changes finish without resending, provably unapplied ones are sent again, unprovable ones stay stopped with the reason. Argument: <operationId>."]]), summaryFor = __name2(
7029
+ (legacyTarget) => {
7116
7030
  const summary = SUMMARIES.get(legacyTarget);
7117
7031
  return summary !== void 0 ? summary : legacyTarget.startsWith("list-") ? "List ".concat(legacyTarget.slice(5).replaceAll("-", " "), ".") : legacyTarget.startsWith("get-") ? "Get ".concat(legacyTarget.slice(4).replaceAll("-", " "), ".") : "".concat(titleCase(legacyTarget), ".");
7118
- }, "summaryFor"), aliasesFor = __name2((legacyTarget, aliases) => [...new Set([legacyTarget, ...aliases].flatMap((alias) => [alias, alias.replaceAll("-", "_")]))], "aliasesFor"), legacyCommand = __name2((legacyTarget, path2, aliases = [], commandOptions = []) => ({ path: path2, legacyAliases: aliasesFor(legacyTarget, aliases), summary: summaryFor(legacyTarget), options: [...globalCommandOptions, ...commandOptions], effects: effectsFor(legacyTarget), legacyTarget }), "legacyCommand"), budgetPreflightOptions = [{ name: "--companyPayload <json>", description: "Company update JSON object with id, name, and website fields." }, { name: "--contactPayload <json>", description: "Contact update JSON object with companyId, title, firstName, lastName, email, and mobile fields." }, { name: "--eventPayload <json>", description: "Event timing JSON object with date, startTime, and endTime fields." }], authCommand = __name2((action, summary) => ({ path: ["auth", action], legacyAliases: [], summary, options: globalCommandOptions, effects: [], load: __name2(async () => async () => ({}), "load") }), "authCommand"), registry2 = [authCommand("login", "Authorize this device through Budget Builder in your browser."), authCommand("status", "Show the active CLI authentication method and session status."), authCommand("logout", "Revoke the interactive CLI session and remove its local credential."), legacyCommand("whoami", ["auth", "whoami"]), legacyCommand("list-budgets", ["budget", "list"], [], [{ name: "--active <true|false|all>", description: "Omit for active budgets only; false or all requires Admin access." }, { name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]), legacyCommand("count-budgets", ["budget", "count"], [], [{ name: "--active <true|false|all>", description: "Omit for active budgets only; false or all requires Admin access." }]), legacyCommand("get-budget", ["budget", "get"], [], [{ name: "--includeInactive", description: "Include inactive historical budgets; Admin only." }]), legacyCommand("upload-budget-attachment", ["budget", "attachment", "upload"]), legacyCommand("mark-budget-won", ["budget", "won", "mark"]), legacyCommand("get-budget-items", ["budget", "item", "list"], [], [{ name: "--includeInactive", description: "Include inactive historical budgets; Admin only." }]), legacyCommand("get-budget-details", ["budget", "detail", "get"], [], [{ name: "--includeInactive", description: "Include inactive historical budgets; Admin only." }]), legacyCommand("get-budget-categories", ["budget", "category", "list"], [], [{ name: "--q <text>", description: "Search active category names (name A\u2013Z). A bare --q is rejected; use -q/--quiet to hide logs." }, { name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]), legacyCommand("get-budget-versions", ["budget", "version", "list"], [], [{ name: "--limit <1-50>", description: "Versions per page (default 20). Returns versions and nextCursor, not a full-history array." }, { name: "--cursor <versionId>", description: "Load the next page using the previous nextCursor; null means complete." }, { name: "--all", description: "Explicitly fetch all visible history in bounded pages; cannot combine with --cursor. May be expensive." }]), legacyCommand("rename-budget-version", ["budget", "version", "rename"]), legacyCommand("restore-budget-version", ["budget", "version", "restore"]), legacyCommand("update-budget-status", ["budget", "status", "update"]), legacyCommand("create-budget-approval", ["budget", "approval", "create"], [], budgetPreflightOptions), legacyCommand("create-estimate", ["budget", "estimate", "create"], [], budgetPreflightOptions), legacyCommand("send-estimate-to-contact-person", ["budget", "estimate", "send"], ["send-estimate-email"]), legacyCommand("create-budget", ["budget", "create"]), legacyCommand("update-budget", ["budget", "update"]), legacyCommand("delete-budget", ["budget", "delete"]), legacyCommand("add-budget-items", ["budget", "item", "add"]), legacyCommand("update-budget-item", ["budget", "item", "update"]), legacyCommand("remove-budget-item", ["budget", "item", "remove"]), legacyCommand("replace-budget-item", ["budget", "item", "replace"]), legacyCommand("approve-unavailable-item-exception", ["budget", "item", "exception", "approve"]), legacyCommand("reorder-budget-items", ["budget", "item", "reorder"]), legacyCommand("update-budget-item-supplier", ["budget", "item", "supplier", "update"]), legacyCommand("create-budget-category", ["budget", "category", "create"]), legacyCommand("update-budget-category", ["budget", "category", "update"]), legacyCommand("delete-budget-category", ["budget", "category", "delete"]), legacyCommand("update-budget-commission", ["budget", "commission", "update"]), legacyCommand("update-budget-discount", ["budget", "discount", "update"]), legacyCommand("delete-budget-commission", ["budget", "commission", "delete"]), legacyCommand("delete-budget-discount", ["budget", "discount", "delete"]), legacyCommand("mark-budget-items-not-utilized", ["budget", "item", "mark-not-utilized"]), legacyCommand("restore-budget-item", ["budget", "item", "restore"]), legacyCommand("create-placeholder-bill", ["budget", "item", "placeholder-bill", "create"]), legacyCommand("list-bills", ["bill", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]), legacyCommand("list-claims", ["claim", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]), legacyCommand("count-bills", ["bill", "count"]), legacyCommand("count-claims", ["claim", "count"]), legacyCommand("create-bill-approval", ["bill", "approval", "create"]), legacyCommand("create-bill", ["bill", "create"], [], [{ name: "--draft-only", description: "Create a draft for every role; no approval, email, or QuickBooks writes. Conflicts with alreadyPaid: true." }, { name: "--quotation-exempt", description: "Explicitly request an eligible server-validated supplier-bill quotation exemption. Cannot be combined with quotation IDs." }]), legacyCommand("validate-bill-selection", ["bill", "selection", "validate"], [], [{ name: "--quotationIds <csv>", description: "Approved quotation IDs for a supplier bill. Each selected budget item must be covered once." }, { name: "--quotationId <id>", description: "Legacy syntax for selecting one approved quotation." }]), legacyCommand("link-bill-quotations", ["bill", "quotation", "link"], ["billId"], [{ name: "--payload <json>", description: "Explicit quotationAllocations for split source coverage on the bill's stored line amounts; documentOnly quotations are rejected." }, { name: "--quotationIds <csv>", description: "Approved quotation IDs to link across the bill's disjoint line coverage; documentOnly quotations are rejected." }]), legacyCommand("update-bill", ["bill", "update"]), legacyCommand("update-bill-payment-evidence", ["bill", "payment-evidence", "update"]), legacyCommand("delete-bill", ["bill", "delete"]), legacyCommand("update-bill-status", ["bill", "status", "update"]), legacyCommand("record-external-bill-payment", ["bill", "payment", "record-external"]), legacyCommand("list-external-payment-accounts", ["bill", "payment", "accounts"]), legacyCommand("refresh-external-payment-accounts", ["bill", "payment", "accounts-refresh"]), legacyCommand("patch-bill-payment", ["bill", "payment", "patch"]), legacyCommand("patch-bill-invoice-number", ["bill", "invoice-number", "patch"]), legacyCommand("get-bill-attachments", ["bill", "attachment", "list"], [], [{ name: "--limit <1-50>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]), legacyCommand("stage-bill-attachment", ["bill", "attachment", "stage"]), legacyCommand("cleanup-staged-bill-attachments", ["bill", "attachment", "staged", "cleanup"]), legacyCommand("upload-bill-attachment", ["bill", "attachment", "upload"], ["attach-bill-attachment"]), legacyCommand("attach-bill-payment-receipt", ["bill", "payment-receipt", "attach"]), legacyCommand("attach-bill-documents", ["bill", "document", "attach"]), legacyCommand("get-bill-details", ["bill", "get"]), legacyCommand("get-bill-line-items", ["bill", "line-item", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]), legacyCommand("get-bill-approvals", ["bill", "approval", "list"], [], [{ name: "--limit <1-50>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]), legacyCommand("get-bill-payment", ["bill", "payment", "get"]), legacyCommand("list-quotations", ["quotation", "list"], [], [
7119
- { name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." },
7120
- { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." },
7121
- { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }
7122
- ]), legacyCommand("count-quotations", ["quotation", "count"]), legacyCommand("get-quotation", ["quotation", "get"]), legacyCommand("get-quotation-line-items", ["quotation", "line-item", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]), legacyCommand("upload-quotation-attachment", ["quotation", "attachment", "upload"]), legacyCommand("cleanup-staged-quotation-attachments", ["quotation", "attachment", "staged", "cleanup"]), legacyCommand("create-quotation", ["quotation", "create"], [], [{ name: "--payload", description: "Quotation JSON including lineAmounts for multiple selected budget items; see the payload format above. Set documentOnly: true with zero amounts for a $0 supplier document.", required: !0 }]), legacyCommand("update-quotation", ["quotation", "update"], [], [{ name: "--payload", description: "Complete quotation JSON plus id, including lineAmounts for multiple selected budget items. Send documentOnly: true again when updating a document-only quotation.", required: !0 }]), legacyCommand("delete-quotation", ["quotation", "delete"]), legacyCommand("submit-quotation", ["quotation", "submit"]), legacyCommand("approve-quotation", ["quotation", "approve"]), legacyCommand("reject-quotation", ["quotation", "reject"]), legacyCommand("download-quotation-pdf", ["quotation", "pdf", "download"]), legacyCommand("check-customer-invoice-readiness", ["customer-invoice", "readiness", "check"]), legacyCommand("list-eligible-customer-invoice-budgets", ["customer-invoice", "eligible-budget", "list"]), legacyCommand("preview-customer-invoice-amount", ["customer-invoice", "amount", "preview"]), legacyCommand("list-available-qbo-customer-invoices", ["customer-invoice", "existing", "list"]), legacyCommand("list-customer-invoices", ["customer-invoice", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]), legacyCommand("count-customer-invoices", ["customer-invoice", "count"]), legacyCommand("get-customer-invoice", ["customer-invoice", "get"]), legacyCommand("get-customer-invoice-invoices", ["customer-invoice", "invoice", "list"]), legacyCommand("get-customer-invoice-lines", ["customer-invoice", "line", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]), legacyCommand("get-customer-invoice-approvals", ["customer-invoice", "approval", "list"], [], [{ name: "--limit <1-50>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]), legacyCommand("get-customer-invoice-history", ["customer-invoice", "history", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]), legacyCommand("get-customer-invoice-payments", ["customer-invoice", "payments", "list"]), legacyCommand("get-customer-invoice-email-context", ["customer-invoice", "email-context", "get"]), legacyCommand("preview-qbo-customer-invoice", ["customer-invoice", "preview-qbo"]), legacyCommand("import-qbo-customer-invoice", ["customer-invoice", "import-qbo"]), legacyCommand("create-customer-invoice", ["customer-invoice", "create"]), legacyCommand(
7123
- "resubmit-customer-invoice",
7124
- ["customer-invoice", "resubmit"]
7125
- ), legacyCommand("discard-customer-invoice", ["customer-invoice", "discard"]), legacyCommand("delete-customer-invoice", ["customer-invoice", "delete"]), legacyCommand("void-customer-invoice", ["customer-invoice", "void"]), legacyCommand("approve-customer-invoice", ["customer-invoice", "approve"]), legacyCommand("reject-customer-invoice", ["customer-invoice", "reject"]), legacyCommand("send-customer-invoice-to-contact-person", ["customer-invoice", "send"]), legacyCommand("download-customer-invoice-pdf", ["customer-invoice", "pdf", "download"]), legacyCommand("sync-customer-invoice", ["customer-invoice", "sync"]), legacyCommand("update-customer-invoice-details", ["customer-invoice", "details", "update"]), legacyCommand("update-customer-invoice-qbo-drift", ["customer-invoice", "qbo-drift", "resolve"]), legacyCommand("mark-customer-invoice-sent-externally", ["customer-invoice", "mark-sent-externally"]), legacyCommand("list-approvals", ["approval", "list"], ["get-pending-approvals"]), legacyCommand("approve-bill", ["bill", "approve"]), legacyCommand("reject-bill", ["bill", "reject"]), legacyCommand("approve-budget", ["budget", "approve"]), legacyCommand("reject-budget", ["budget", "reject"]), legacyCommand("approve-supplier", ["supplier", "approve"]), legacyCommand("reject-supplier", ["supplier", "reject"]), legacyCommand("get-supplier-details", ["supplier", "detail", "get"]), legacyCommand("get-supplier-overview", ["supplier", "overview", "get"]), legacyCommand("get-supplier-usage", ["supplier", "usage", "get"]), legacyCommand("get-supplier-items", ["supplier", "items", "get"]), legacyCommand("list-companies", ["company", "list"], [], [{ name: "--name <text>", description: "Filter by company name substring." }, { name: "--createdBy <userId>", description: "Filter by one creator user ID." }, { name: "--createdByIds <csv>", description: "Filter by a comma-separated creator user ID list." }, { name: "--active <true|false>", description: "Filter by active status; omit to include both states." }, { name: "--sortBy <name|createdAt>", description: "Sort field (default createdAt)." }, { name: "--sortDir <asc|desc>", description: "Sort direction (default desc)." }, { name: "--limit <1-100>", description: "Bounded page size (default 20)." }, { name: "--cursor <token>", description: "Opaque pageInfo cursor; pass nextCursor forward or previousCursor backward unchanged." }, { name: "--direction <forward|backward>", description: "Use forward by default; backward requires --cursor." }]), legacyCommand("count-companies", ["company", "count"], [], [{ name: "--name <text>", description: "Filter by company name substring." }, { name: "--createdBy <userId>", description: "Filter by one creator user ID." }, { name: "--createdByIds <csv>", description: "Filter by a comma-separated creator user ID list." }, { name: "--active <true|false>", description: "Filter by active status; facets omit this self-filter." }]), legacyCommand("get-company", ["company", "get"]), legacyCommand("search-existing-companies", ["company", "search"], [], [{ name: "--query", description: "Company name to search in BB and QuickBooks." }, { name: "--limit", description: "Matches per page, 1\u201350 (default 8)." }, { name: "--cursor", description: "pageInfo.nextCursor from the previous page, unchanged." }]), legacyCommand("use-existing-company", ["company", "use"], [], [{ name: "--companyId", description: "Existing BB company ID; combine with quickbooksId to explicitly connect both records." }, { name: "--quickbooksId", description: "Existing QBO customer ID; alone imports or reuses its BB company." }, { name: "--name", description: "QuickBooks company name (from search-existing-companies); required for a QBO-only import." }, { name: "--website", description: "Website only when missing from a QBO-only import." }, { name: "--confirmDistinct", description: "Set true only when similar records do not represent this legal entity." }]), legacyCommand("create-company", ["company", "create"], [], [{ name: "--billingEmails", description: "JSON email array (max 50) for new company invoice Cc defaults; reused companies keep their saved defaults." }, { name: "--confirmDistinct", description: "Set true to confirm a separate legal entity despite similar names." }]), legacyCommand("update-company", ["company", "update"]), legacyCommand("get-company-quickbooks-sync-status", ["company", "sync", "status"]), legacyCommand("delete-company", ["company", "delete"]), legacyCommand("list-projects", ["project", "list"], [], [
7126
- { name: "--companyId <id>", description: "Filter by company ID." },
7127
- { name: "--name <text>", description: "Filter by project name substring." },
7128
- { name: "--status <status|ALL>", description: "Legacy single-status filter; use --statuses for multiple statuses." },
7129
- { name: "--statuses <csv>", description: "Filter by a comma-separated project status list." },
7130
- { name: "--active <true|false>", description: "Filter by active status; omit to include both states." },
7131
- { name: "--wonFrom <iso>", description: "Only projects marked WON on or after this ISO date or datetime (UTC)." },
7132
- { name: "--wonTo <iso>", description: "Only projects marked WON on or before this ISO date (inclusive) or datetime (UTC)." },
7133
- { name: "--wonWithinDays <1-3650>", description: "Only projects marked WON in the last N days." },
7134
- { name: "--limit <1-100>", description: "Bounded page size (default 20)." },
7135
- { name: "--cursor <token>", description: "Opaque pageInfo cursor; pass nextCursor forward or previousCursor backward unchanged." },
7136
- { name: "--direction <forward|backward>", description: "Use forward by default; backward requires --cursor." },
7137
- { name: "--sortBy <name|createdAt|status|companyName|wonAt>", description: "Sort field (default createdAt); wonAt puts unwon projects last." },
7138
- { name: "--sortDir <asc|desc>", description: "Sort direction (default desc)." }
7139
- ]), legacyCommand("count-projects", ["project", "count"], [], [{ name: "--companyId <id>", description: "Filter by company ID." }, { name: "--name <text>", description: "Filter by project name substring." }, { name: "--status <status|ALL>", description: "Legacy single-status filter." }, { name: "--statuses <csv>", description: "Filter by a comma-separated project status list." }, { name: "--active <true|false>", description: "Filter by active status; facets exclude this self-filter." }, { name: "--wonFrom <iso>", description: "Only projects marked WON on or after this ISO date or datetime (UTC)." }, { name: "--wonTo <iso>", description: "Only projects marked WON on or before this ISO date (inclusive) or datetime (UTC)." }, { name: "--wonWithinDays <1-3650>", description: "Only projects marked WON in the last N days." }]), legacyCommand("list-project-hubs", ["project", "hub", "list"], [], [{ name: "--q", description: "Search project and company names." }, { name: "--status", description: "Filter by comma-separated project statuses." }, { name: "--limit", description: "Page size, 1-100 (default 20)." }, { name: "--cursor", description: "Opaque nextCursor/previousCursor from the last page." }, { name: "--direction", description: "forward (default) or backward; backward needs --cursor." }, { name: "--sortBy", description: "Sort by startDate, name, companyName, or status." }, { name: "--sortDir", description: "Sort in asc or desc order." }]), legacyCommand(
7140
- "count-project-hubs",
7141
- ["project", "hub", "count"],
7142
- [],
7143
- [{ name: "--q", description: "Search project and company names." }, { name: "--status", description: "Filter by comma-separated project statuses." }]
7144
- ), legacyCommand("get-project", ["project", "get"]), legacyCommand("get-project-hub-status", ["project", "hub", "status"]), legacyCommand("setup-project-hub", ["project", "hub", "setup"]), legacyCommand("sync-project-hub-commercial-documents", ["project", "hub", "sync"]), legacyCommand("create-project", ["project", "create"]), legacyCommand("update-project", ["project", "update"]), legacyCommand("delete-project", ["project", "delete"]), legacyCommand("check-project-reconciliation", ["project", "reconciliation", "check"]), legacyCommand("reconcile-project", ["project", "reconcile"]), legacyCommand("complete-project", ["project", "complete"]), legacyCommand("import-qbo-project", ["project", "quickbooks", "import"]), legacyCommand("update-project-status", ["project", "status", "update"]), legacyCommand("list-contacts", ["contact", "list"]), legacyCommand("create-contact-person", ["contact", "create"]), legacyCommand("update-contact-person", ["contact", "update"]), legacyCommand("list-suppliers", ["supplier", "list"], [], [{ name: "--name <text>", description: "Filter supplier name or email." }, { name: "--createdBy <csv>", description: "Filter by creator IDs." }, { name: "--gstRegistered <true|false>", description: "Filter GST registration." }, { name: "--status <csv>", description: "Filter approval statuses; ALL means no status filter." }, { name: "--supplierTags <csv>", description: "Filter by supplier tag IDs." }, { name: "--active <true|false>", description: "Active by default; false selects archived." }, { name: "--limit <1-100>", description: "Bounded page size (default 10). Retired page/perPage flags are rejected." }, { name: "--cursor <token>", description: "Opaque nextCursor or previousCursor from items/pageInfo." }, { name: "--direction <forward|backward>", description: "Forward by default; backward requires a cursor." }, { name: "--sortBy <field>", description: "name, email, phone, gstRegistered, status, active, createdAt or updatedAt." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by default." }, { name: "--sort <json>", description: "Ordered {id,desc} array for multi-column sorting; cannot combine with sortBy/sortDir." }]), legacyCommand("count-suppliers", ["supplier", "count"], [], [{ name: "--name <text>", description: "Filter supplier name or email." }, { name: "--createdBy <csv>", description: "Filter by creator IDs." }, { name: "--gstRegistered <true|false>", description: "Filter GST registration." }, { name: "--status <csv>", description: "Filter approval statuses." }, { name: "--supplierTags <csv>", description: "Filter by supplier tag IDs." }, { name: "--active <true|false>", description: "Active by default; false selects archived. No pagination/sort flags." }]), legacyCommand("create-supplier", ["supplier", "create"]), legacyCommand("update-supplier", ["supplier", "update"]), legacyCommand("delete-suppliers", ["supplier", "delete"]), legacyCommand("reactivate-suppliers", ["supplier", "reactivate"]), legacyCommand("create-certification", ["supplier", "certification", "create"]), legacyCommand("create-payment-method", ["supplier", "payment-method", "create"]), legacyCommand("create-supplier-role", ["supplier", "role", "create"]), legacyCommand("create-supplier-tag", ["supplier", "tag", "create"]), legacyCommand("get-supplier-analytics", ["supplier", "analytics", "get"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]), legacyCommand("count-supplier-analytics", ["supplier", "analytics", "count"]), legacyCommand("list-items", ["item", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]), legacyCommand("count-items", ["item", "count"]), legacyCommand("get-item", ["item", "get"]), legacyCommand("get-item-quickbooks-sync-status", ["item", "sync", "status"]), legacyCommand("create-item", ["item", "create"]), legacyCommand("update-item", ["item", "update"]), legacyCommand("archive-items", ["item", "archive"]), legacyCommand("delete-item", ["item", "delete"]), legacyCommand("list-item-categories", ["item", "category", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]), legacyCommand("count-item-categories", ["item", "category", "count"]), legacyCommand("create-item-category", ["item", "category", "create"]), legacyCommand("update-item-category", ["item", "category", "update"]), legacyCommand("delete-item-categories", ["item", "category", "delete"]), legacyCommand("list-users", ["user", "list"], [], [{ name: "--q <text>", description: "Search user names and emails (name A\u2013Z). A bare --q is rejected; use -q/--quiet to hide logs." }, { name: "--projectTeamOnly <true|false>", description: "true lists only active @getout.sg users, the only accounts accepted as Inside Sales, Business Development or Project Manager." }, { name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]), legacyCommand("count-users", ["user", "count"]), legacyCommand("create-user", ["user", "create"]), legacyCommand("create-api-key", ["user", "api-key", "create"]), legacyCommand("list-api-keys", [
7145
- "user",
7146
- "api-key",
7147
- "list"
7148
- ], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]), legacyCommand("revoke-api-key", ["user", "api-key", "revoke"]), legacyCommand("get-user-performance", ["user", "performance", "get"]), legacyCommand("get-dashboard", ["dashboard", "get"]), legacyCommand("get-monthly-metrics", ["dashboard", "monthly-metrics", "get"]), legacyCommand("get-system-overview", ["dashboard", "system-overview", "get"]), legacyCommand("get-estimate-performance", ["dashboard", "estimate-performance", "get"]), legacyCommand("get-financial-overview", ["dashboard", "financial-overview", "get"]), legacyCommand("get-recent-errors", ["error", "recent", "list"], [], [{ name: "--cursor <token>", description: "Pass a returned pageInfo boundary unchanged, with the same filters." }, { name: "--direction <direction>", description: "forward (default) uses nextCursor; backward uses previousCursor." }, { name: "--limit <number>", description: "1\u2013100 rows (default 10). Returns items and pageInfo, without a total." }, { name: "--severity <severity>", description: "Error severity or ALL." }, { name: "--status <status>", description: "Error status or ALL." }, { name: "--timeFrame <period>", description: "all_time (default), last_30_days, last_3_months, last_6_months or last_1_year." }]), legacyCommand("count-errors", ["error", "recent", "count"], [], [{ name: "--severity <severity>", description: "Error severity or ALL." }, { name: "--status <status>", description: "Error status or ALL." }, { name: "--timeFrame <period>", description: "Same filters as error recent list; returns independent totalCount." }]), legacyCommand("get-error", ["error", "get"]), legacyCommand("get-error-metrics", ["error", "metrics", "get"]), legacyCommand("list-integration-operations", ["integration", "operation", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]), legacyCommand("count-integration-operations", ["integration", "operation", "count"]), legacyCommand("get-integration-operation", ["integration", "operation", "get"]), legacyCommand("retry-integration-operation", ["integration", "operation", "retry"]), legacyCommand("reconcile-resource-operation", ["integration", "operation", "reconcile-resource"]), legacyCommand("list-webhook-event-types", ["webhook", "event-type", "list"]), legacyCommand("list-webhook-endpoints", ["webhook", "endpoint", "list"]), legacyCommand("get-webhook-endpoint", ["webhook", "endpoint", "get"]), legacyCommand("create-webhook-endpoint", ["webhook", "endpoint", "create"]), legacyCommand("update-webhook-endpoint", ["webhook", "endpoint", "update"]), legacyCommand("delete-webhook-endpoint", ["webhook", "endpoint", "delete"]), legacyCommand("rotate-webhook-secret", ["webhook", "secret", "rotate"]), legacyCommand("send-webhook-test-event", ["webhook", "endpoint", "test"]), legacyCommand("list-webhook-deliveries", ["webhook", "delivery", "list"], [], [{ name: "--endpointId <id>", description: "Only deliveries to this endpoint." }, { name: "--status <PENDING|SUCCEEDED|FAILED,...>", description: "Comma-separated delivery statuses." }, { name: "--eventType <type>", description: "Exact event type, e.g. bill.approved." }, { name: "--limit <n>", description: "Rows per cursor page (1..100; default 20)." }, { name: "--cursor <token>", description: "Opaque token from pageInfo.nextCursor or pageInfo.previousCursor; bound to the same filters." }, { name: "--direction <value>", description: "forward or backward (default forward; backward requires cursor)." }]), legacyCommand("get-webhook-delivery", ["webhook", "delivery", "get"]), legacyCommand("replay-webhook-delivery", ["webhook", "delivery", "replay"]), legacyCommand("list-inbound-sources", ["inbound", "source", "list"], [], [{
7149
- name: "--limit <n>",
7150
- description: "Rows per cursor page (1..100; default 25)."
7151
- }, { name: "--cursor <token>", description: "Opaque source continuation token returned by pageInfo." }, { name: "--direction <value>", description: "forward or backward (default forward; backward requires cursor)." }, { name: "--search <text>", description: "Search source name or Typeform form ID." }, { name: "--processingEnabled <boolean>", description: "Filter processing enabled state." }, { name: "--processingMode <mode>", description: "ACTIVE, COLLECT_ONLY or SHADOW." }]), legacyCommand("count-inbound-sources", ["inbound", "source", "count"], [], [{ name: "--search <text>", description: "Search source name or Typeform form ID." }, { name: "--processingEnabled <boolean>", description: "Filter processing enabled state." }, { name: "--processingMode <mode>", description: "ACTIVE, COLLECT_ONLY or SHADOW." }]), legacyCommand("create-inbound-source", ["inbound", "source", "create"]), legacyCommand("get-inbound-source", ["inbound", "source", "get"]), legacyCommand("update-inbound-source", ["inbound", "source", "update"]), legacyCommand("list-inbound-submissions", ["inbound", "submission", "list"], [], [{ name: "--limit <number>", description: "Page size from 1 to 100 (default 25). Returns submissions, hasMore and nextCursor; no total." }, { name: "--cursor <token>", description: "Pass the previous response's nextCursor unchanged. Omit for newest submissions. Replaces --page/--perPage." }, { name: "--sourceId <id>", description: "Filter submissions to this source; keep the same filter while following cursors." }]), legacyCommand("count-inbound-submissions", ["inbound", "submission", "count"], [], [{ name: "--sourceId <id>", description: "Optional source filter. Returns an independently calculated exact totalCount, not a list snapshot." }]), legacyCommand("get-inbound-submission", ["inbound", "submission", "get"]), legacyCommand("save-inbound-mapping", ["inbound", "mapping", "save"]), legacyCommand("save-inbound-automation-config", ["inbound", "automation", "save"]), legacyCommand("update-inbound-processing", ["inbound", "processing", "update"]), legacyCommand("get-approved-budgets", ["budget", "approved", "list"]), legacyCommand("get-budget-category-benchmarks", ["budget", "category", "benchmark", "get"]), legacyCommand("get-item-pricing-history", ["item", "pricing-history", "list"]), legacyCommand("get-supplier-pricing-history", ["supplier", "pricing-history", "list"])], normalizeToken = __name2((value) => value.replaceAll("_", "-"), "normalizeToken"), normalizedPath = __name2((path2) => path2.map(normalizeToken), "normalizedPath"), assertRegistry = __name2((commands) => {
7032
+ }, "summaryFor"), aliasesFor = __name2((legacyTarget, aliases) => [...new Set([legacyTarget, ...aliases].flatMap((alias) => [alias, alias.replaceAll("-", "_")]))], "aliasesFor"), legacyCommand = __name2((legacyTarget, path2, aliases = [], commandOptions = []) => ({
7033
+ path: path2,
7034
+ legacyAliases: aliasesFor(legacyTarget, aliases),
7035
+ summary: summaryFor(legacyTarget),
7036
+ options: [...globalCommandOptions, ...commandOptions],
7037
+ effects: effectsFor(legacyTarget),
7038
+ legacyTarget
7039
+ }), "legacyCommand"), budgetPreflightOptions = [{ name: "--companyPayload <json>", description: "Company update JSON object with id, name, and website fields." }, { name: "--contactPayload <json>", description: "Contact update JSON object with companyId, title, firstName, lastName, email, and mobile fields." }, { name: "--eventPayload <json>", description: "Event timing JSON object with date, startTime, and endTime fields." }], authCommand = __name2((action, summary) => ({ path: ["auth", action], legacyAliases: [], summary, options: globalCommandOptions, effects: [], load: __name2(async () => async () => ({}), "load") }), "authCommand"), registry2 = [
7040
+ authCommand("login", "Authorize this device through Budget Builder in your browser."),
7041
+ authCommand("status", "Show the active CLI authentication method and session status."),
7042
+ authCommand("logout", "Revoke the interactive CLI session and remove its local credential."),
7043
+ legacyCommand("whoami", ["auth", "whoami"]),
7044
+ legacyCommand("list-budgets", ["budget", "list"], [], [{ name: "--active <true|false|all>", description: "Omit for active budgets only; false or all requires Admin access." }, { name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
7045
+ legacyCommand("count-budgets", ["budget", "count"], [], [{ name: "--active <true|false|all>", description: "Omit for active budgets only; false or all requires Admin access." }]),
7046
+ legacyCommand("get-budget", ["budget", "get"], [], [{ name: "--includeInactive", description: "Include inactive historical budgets; Admin only." }]),
7047
+ legacyCommand("upload-budget-attachment", ["budget", "attachment", "upload"]),
7048
+ legacyCommand("mark-budget-won", ["budget", "won", "mark"]),
7049
+ legacyCommand("get-budget-items", ["budget", "item", "list"], [], [{ name: "--includeInactive", description: "Include inactive historical budgets; Admin only." }]),
7050
+ legacyCommand("get-budget-details", ["budget", "detail", "get"], [], [{ name: "--includeInactive", description: "Include inactive historical budgets; Admin only." }]),
7051
+ legacyCommand("get-budget-categories", ["budget", "category", "list"], [], [{ name: "--q <text>", description: "Search active category names (name A\u2013Z). A bare --q is rejected; use -q/--quiet to hide logs." }, { name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
7052
+ legacyCommand("get-budget-versions", ["budget", "version", "list"], [], [{ name: "--limit <1-50>", description: "Versions per page (default 20). Returns versions and nextCursor, not a full-history array." }, { name: "--cursor <versionId>", description: "Load the next page using the previous nextCursor; null means complete." }, { name: "--all", description: "Explicitly fetch all visible history in bounded pages; cannot combine with --cursor. May be expensive." }]),
7053
+ legacyCommand("rename-budget-version", ["budget", "version", "rename"]),
7054
+ legacyCommand("restore-budget-version", ["budget", "version", "restore"]),
7055
+ legacyCommand("update-budget-status", ["budget", "status", "update"]),
7056
+ legacyCommand("create-budget-approval", ["budget", "approval", "create"], [], budgetPreflightOptions),
7057
+ legacyCommand("create-estimate", ["budget", "estimate", "create"], [], budgetPreflightOptions),
7058
+ legacyCommand("send-estimate-to-contact-person", ["budget", "estimate", "send"], ["send-estimate-email"]),
7059
+ legacyCommand("create-budget", ["budget", "create"]),
7060
+ legacyCommand("update-budget", ["budget", "update"]),
7061
+ legacyCommand("delete-budget", ["budget", "delete"]),
7062
+ legacyCommand("add-budget-items", ["budget", "item", "add"]),
7063
+ legacyCommand("update-budget-item", ["budget", "item", "update"]),
7064
+ legacyCommand("remove-budget-item", ["budget", "item", "remove"]),
7065
+ legacyCommand("replace-budget-item", ["budget", "item", "replace"]),
7066
+ legacyCommand("approve-unavailable-item-exception", ["budget", "item", "exception", "approve"]),
7067
+ legacyCommand("reorder-budget-items", ["budget", "item", "reorder"]),
7068
+ legacyCommand("update-budget-item-supplier", ["budget", "item", "supplier", "update"]),
7069
+ legacyCommand("create-budget-category", ["budget", "category", "create"]),
7070
+ legacyCommand("update-budget-category", ["budget", "category", "update"]),
7071
+ legacyCommand("delete-budget-category", ["budget", "category", "delete"]),
7072
+ legacyCommand("update-budget-commission", ["budget", "commission", "update"]),
7073
+ legacyCommand("update-budget-discount", ["budget", "discount", "update"]),
7074
+ legacyCommand("delete-budget-commission", ["budget", "commission", "delete"]),
7075
+ legacyCommand("delete-budget-discount", ["budget", "discount", "delete"]),
7076
+ legacyCommand("mark-budget-items-not-utilized", ["budget", "item", "mark-not-utilized"]),
7077
+ legacyCommand("restore-budget-item", ["budget", "item", "restore"]),
7078
+ legacyCommand("create-placeholder-bill", ["budget", "item", "placeholder-bill", "create"]),
7079
+ legacyCommand("list-bills", ["bill", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
7080
+ legacyCommand("list-claims", ["claim", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
7081
+ legacyCommand("count-bills", ["bill", "count"]),
7082
+ legacyCommand(
7083
+ "count-claims",
7084
+ ["claim", "count"]
7085
+ ),
7086
+ legacyCommand("create-bill-approval", ["bill", "approval", "create"]),
7087
+ legacyCommand("create-bill", ["bill", "create"], [], [{ name: "--draft-only", description: "Create a draft for every role; no approval, email, or QuickBooks writes. Conflicts with alreadyPaid: true." }, { name: "--quotation-exempt", description: "Explicitly request an eligible server-validated supplier-bill quotation exemption. Cannot be combined with quotation IDs." }]),
7088
+ legacyCommand("validate-bill-selection", ["bill", "selection", "validate"], [], [{ name: "--quotationIds <csv>", description: "Approved quotation IDs for a supplier bill. Each selected budget item must be covered once." }, { name: "--quotationId <id>", description: "Legacy syntax for selecting one approved quotation." }]),
7089
+ legacyCommand("link-bill-quotations", ["bill", "quotation", "link"], ["billId"], [{ name: "--payload <json>", description: "Explicit quotationAllocations for split source coverage on the bill's stored line amounts; documentOnly quotations are rejected." }, { name: "--quotationIds <csv>", description: "Approved quotation IDs to link across the bill's disjoint line coverage; documentOnly quotations are rejected." }]),
7090
+ legacyCommand("update-bill", ["bill", "update"]),
7091
+ legacyCommand("update-bill-payment-evidence", ["bill", "payment-evidence", "update"]),
7092
+ legacyCommand("delete-bill", ["bill", "delete"]),
7093
+ legacyCommand("update-bill-status", ["bill", "status", "update"]),
7094
+ legacyCommand("record-external-bill-payment", ["bill", "payment", "record-external"]),
7095
+ legacyCommand("list-external-payment-accounts", ["bill", "payment", "accounts"]),
7096
+ legacyCommand("refresh-external-payment-accounts", ["bill", "payment", "accounts-refresh"]),
7097
+ legacyCommand("patch-bill-payment", ["bill", "payment", "patch"]),
7098
+ legacyCommand("patch-bill-invoice-number", ["bill", "invoice-number", "patch"]),
7099
+ legacyCommand("get-bill-attachments", ["bill", "attachment", "list"], [], [{ name: "--limit <1-50>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
7100
+ legacyCommand("stage-bill-attachment", ["bill", "attachment", "stage"]),
7101
+ legacyCommand("cleanup-staged-bill-attachments", ["bill", "attachment", "staged", "cleanup"]),
7102
+ legacyCommand("upload-bill-attachment", ["bill", "attachment", "upload"], ["attach-bill-attachment"]),
7103
+ legacyCommand("attach-bill-payment-receipt", ["bill", "payment-receipt", "attach"]),
7104
+ legacyCommand("attach-bill-documents", ["bill", "document", "attach"]),
7105
+ legacyCommand("get-bill-details", ["bill", "get"]),
7106
+ legacyCommand("get-bill-line-items", ["bill", "line-item", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
7107
+ legacyCommand("get-bill-approvals", ["bill", "approval", "list"], [], [{ name: "--limit <1-50>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
7108
+ legacyCommand("get-bill-payment", ["bill", "payment", "get"]),
7109
+ legacyCommand("list-quotations", ["quotation", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
7110
+ legacyCommand("count-quotations", ["quotation", "count"]),
7111
+ legacyCommand("get-quotation", ["quotation", "get"]),
7112
+ legacyCommand("get-quotation-line-items", ["quotation", "line-item", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
7113
+ legacyCommand("upload-quotation-attachment", ["quotation", "attachment", "upload"]),
7114
+ legacyCommand(
7115
+ "cleanup-staged-quotation-attachments",
7116
+ ["quotation", "attachment", "staged", "cleanup"]
7117
+ ),
7118
+ legacyCommand("create-quotation", ["quotation", "create"], [], [{ name: "--payload", description: "Quotation JSON including lineAmounts for multiple selected budget items; see the payload format above. Set documentOnly: true with zero amounts for a $0 supplier document.", required: !0 }]),
7119
+ legacyCommand("update-quotation", ["quotation", "update"], [], [{ name: "--payload", description: "Complete quotation JSON plus id, including lineAmounts for multiple selected budget items. Send documentOnly: true again when updating a document-only quotation.", required: !0 }]),
7120
+ legacyCommand("delete-quotation", ["quotation", "delete"]),
7121
+ legacyCommand("submit-quotation", ["quotation", "submit"]),
7122
+ legacyCommand("approve-quotation", ["quotation", "approve"]),
7123
+ legacyCommand("reject-quotation", ["quotation", "reject"]),
7124
+ legacyCommand("download-quotation-pdf", ["quotation", "pdf", "download"]),
7125
+ legacyCommand("check-customer-invoice-readiness", ["customer-invoice", "readiness", "check"]),
7126
+ legacyCommand("list-eligible-customer-invoice-budgets", ["customer-invoice", "eligible-budget", "list"]),
7127
+ legacyCommand("preview-customer-invoice-amount", ["customer-invoice", "amount", "preview"]),
7128
+ legacyCommand("list-available-qbo-customer-invoices", ["customer-invoice", "existing", "list"]),
7129
+ legacyCommand("list-customer-invoices", ["customer-invoice", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
7130
+ legacyCommand("count-customer-invoices", ["customer-invoice", "count"]),
7131
+ legacyCommand("get-customer-invoice", ["customer-invoice", "get"]),
7132
+ legacyCommand("get-customer-invoice-invoices", ["customer-invoice", "invoice", "list"]),
7133
+ legacyCommand("get-customer-invoice-lines", ["customer-invoice", "line", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
7134
+ legacyCommand("get-customer-invoice-approvals", ["customer-invoice", "approval", "list"], [], [{ name: "--limit <1-50>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
7135
+ legacyCommand("get-customer-invoice-history", ["customer-invoice", "history", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
7136
+ legacyCommand("get-customer-invoice-payments", ["customer-invoice", "payments", "list"]),
7137
+ legacyCommand("get-customer-invoice-email-context", ["customer-invoice", "email-context", "get"]),
7138
+ legacyCommand("preview-qbo-customer-invoice", ["customer-invoice", "preview-qbo"]),
7139
+ legacyCommand("import-qbo-customer-invoice", ["customer-invoice", "import-qbo"]),
7140
+ legacyCommand("create-customer-invoice", ["customer-invoice", "create"]),
7141
+ legacyCommand("resubmit-customer-invoice", ["customer-invoice", "resubmit"]),
7142
+ legacyCommand("discard-customer-invoice", ["customer-invoice", "discard"]),
7143
+ legacyCommand("delete-customer-invoice", ["customer-invoice", "delete"]),
7144
+ legacyCommand("void-customer-invoice", ["customer-invoice", "void"]),
7145
+ legacyCommand("approve-customer-invoice", ["customer-invoice", "approve"]),
7146
+ legacyCommand("reject-customer-invoice", ["customer-invoice", "reject"]),
7147
+ legacyCommand("send-customer-invoice-to-contact-person", ["customer-invoice", "send"]),
7148
+ legacyCommand("download-customer-invoice-pdf", ["customer-invoice", "pdf", "download"]),
7149
+ legacyCommand("sync-customer-invoice", ["customer-invoice", "sync"]),
7150
+ legacyCommand("update-customer-invoice-details", ["customer-invoice", "details", "update"]),
7151
+ legacyCommand(
7152
+ "update-customer-invoice-qbo-drift",
7153
+ ["customer-invoice", "qbo-drift", "resolve"]
7154
+ ),
7155
+ legacyCommand("mark-customer-invoice-sent-externally", ["customer-invoice", "mark-sent-externally"]),
7156
+ legacyCommand("list-approvals", ["approval", "list"], ["get-pending-approvals"]),
7157
+ legacyCommand("approve-bill", ["bill", "approve"]),
7158
+ legacyCommand("reject-bill", ["bill", "reject"]),
7159
+ legacyCommand("approve-budget", ["budget", "approve"]),
7160
+ legacyCommand("reject-budget", ["budget", "reject"]),
7161
+ legacyCommand("approve-supplier", ["supplier", "approve"]),
7162
+ legacyCommand("reject-supplier", ["supplier", "reject"]),
7163
+ legacyCommand("get-supplier-details", ["supplier", "detail", "get"]),
7164
+ legacyCommand("get-supplier-overview", ["supplier", "overview", "get"]),
7165
+ legacyCommand("get-supplier-usage", ["supplier", "usage", "get"]),
7166
+ legacyCommand("get-supplier-items", ["supplier", "items", "get"]),
7167
+ legacyCommand("list-companies", ["company", "list"], [], [{ name: "--name <text>", description: "Filter by company name substring." }, { name: "--createdBy <userId>", description: "Filter by one creator user ID." }, { name: "--createdByIds <csv>", description: "Filter by a comma-separated creator user ID list." }, { name: "--active <true|false>", description: "Filter by active status; omit to include both states." }, { name: "--sortBy <name|createdAt>", description: "Sort field (default createdAt)." }, { name: "--sortDir <asc|desc>", description: "Sort direction (default desc)." }, { name: "--limit <1-100>", description: "Bounded page size (default 20)." }, { name: "--cursor <token>", description: "Opaque pageInfo cursor; pass nextCursor forward or previousCursor backward unchanged." }, { name: "--direction <forward|backward>", description: "Use forward by default; backward requires --cursor." }]),
7168
+ legacyCommand("count-companies", ["company", "count"], [], [{ name: "--name <text>", description: "Filter by company name substring." }, { name: "--createdBy <userId>", description: "Filter by one creator user ID." }, { name: "--createdByIds <csv>", description: "Filter by a comma-separated creator user ID list." }, { name: "--active <true|false>", description: "Filter by active status; facets omit this self-filter." }]),
7169
+ legacyCommand("get-company", ["company", "get"]),
7170
+ legacyCommand("search-existing-companies", ["company", "search"], [], [{ name: "--query", description: "Company name to search in BB and QuickBooks." }, { name: "--limit", description: "Matches per page, 1\u201350 (default 8)." }, { name: "--cursor", description: "pageInfo.nextCursor from the previous page, unchanged." }]),
7171
+ legacyCommand("use-existing-company", ["company", "use"], [], [{ name: "--companyId", description: "Existing BB company ID; combine with quickbooksId to explicitly connect both records." }, { name: "--quickbooksId", description: "Existing QBO customer ID; alone imports or reuses its BB company." }, { name: "--name", description: "QuickBooks company name (from search-existing-companies); required for a QBO-only import." }, { name: "--website", description: "Website only when missing from a QBO-only import." }, { name: "--confirmDistinct", description: "Set true only when similar records do not represent this legal entity." }]),
7172
+ legacyCommand("create-company", ["company", "create"], [], [{ name: "--billingEmails", description: "JSON email array (max 50) for new company invoice Cc defaults; reused companies keep their saved defaults." }, { name: "--confirmDistinct", description: "Set true to confirm a separate legal entity despite similar names." }]),
7173
+ legacyCommand("update-company", ["company", "update"]),
7174
+ legacyCommand("get-company-quickbooks-sync-status", ["company", "sync", "status"]),
7175
+ legacyCommand("delete-company", ["company", "delete"]),
7176
+ legacyCommand("list-projects", ["project", "list"], [], [{ name: "--companyId <id>", description: "Filter by company ID." }, { name: "--name <text>", description: "Filter by project name substring." }, { name: "--status <status|ALL>", description: "Legacy single-status filter; use --statuses for multiple statuses." }, { name: "--statuses <csv>", description: "Filter by a comma-separated project status list." }, { name: "--active <true|false>", description: "Filter by active status; omit to include both states." }, { name: "--wonFrom <iso>", description: "Only projects marked WON on or after this ISO date or datetime (UTC)." }, { name: "--wonTo <iso>", description: "Only projects marked WON on or before this ISO date (inclusive) or datetime (UTC)." }, { name: "--wonWithinDays <1-3650>", description: "Only projects marked WON in the last N days." }, { name: "--limit <1-100>", description: "Bounded page size (default 20)." }, { name: "--cursor <token>", description: "Opaque pageInfo cur\
7177
+ sor; pass nextCursor forward or previousCursor backward unchanged." }, { name: "--direction <forward|backward>", description: "Use forward by default; backward requires --cursor." }, { name: "--sortBy <name|createdAt|status|companyName|wonAt>", description: "Sort field (default createdAt); wonAt puts unwon projects last." }, { name: "--sortDir <asc|desc>", description: "Sort direction (default desc)." }]),
7178
+ legacyCommand("count-projects", ["project", "count"], [], [{ name: "--companyId <id>", description: "Filter by company ID." }, { name: "--name <text>", description: "Filter by project name substring." }, { name: "--status <status|ALL>", description: "Legacy single-status filter." }, { name: "--statuses <csv>", description: "Filter by a comma-separated project status list." }, { name: "--active <true|false>", description: "Filter by active status; facets exclude this self-filter." }, { name: "--wonFrom <iso>", description: "Only projects marked WON on or after this ISO date or datetime (UTC)." }, { name: "--wonTo <iso>", description: "Only projects marked WON on or before this ISO date (inclusive) or datetime (UTC)." }, { name: "--wonWithinDays <1-3650>", description: "Only projects marked WON in the last N days." }]),
7179
+ legacyCommand("list-project-hubs", ["project", "hub", "list"], [], [{ name: "--q", description: "Search project and company names." }, { name: "--status", description: "Filter by comma-separated project statuses." }, { name: "--limit", description: "Page size, 1-100 (default 20)." }, { name: "--cursor", description: "Opaque nextCursor/previousCursor from the last page." }, { name: "--direction", description: "forward (default) or backward; backward needs --cursor." }, { name: "--sortBy", description: "Sort by startDate, name, companyName, or status." }, { name: "--sortDir", description: "Sort in asc or desc order." }]),
7180
+ legacyCommand("count-project-hubs", ["project", "hub", "count"], [], [{ name: "--q", description: "Search project and company names." }, { name: "--status", description: "Filter by comma-separated project statuses." }]),
7181
+ legacyCommand("get-project", ["project", "get"]),
7182
+ legacyCommand("get-project-hub-status", ["project", "hub", "status"]),
7183
+ legacyCommand("setup-project-hub", ["project", "hub", "setup"]),
7184
+ legacyCommand("sync-project-hub-commercial-documents", ["project", "hub", "sync"]),
7185
+ legacyCommand("create-project", ["project", "create"]),
7186
+ legacyCommand("update-project", ["project", "update"]),
7187
+ legacyCommand("delete-project", ["project", "delete"]),
7188
+ legacyCommand("check-project-reconciliation", ["project", "reconciliation", "check"]),
7189
+ legacyCommand("reconcile-project", ["project", "reconcile"]),
7190
+ legacyCommand("complete-project", ["project", "complete"]),
7191
+ legacyCommand("import-qbo-project", ["project", "quickbooks", "import"]),
7192
+ legacyCommand("update-project-status", ["project", "status", "update"]),
7193
+ legacyCommand("list-contacts", ["contact", "list"]),
7194
+ legacyCommand("create-contact-person", ["contact", "create"]),
7195
+ legacyCommand("update-contact-person", ["contact", "update"]),
7196
+ legacyCommand("list-suppliers", ["supplier", "list"], [], [{ name: "--name <text>", description: "Filter supplier name or email." }, { name: "--createdBy <csv>", description: "Filter by creator IDs." }, { name: "--gstRegistered <true|false>", description: "Filter GST registration." }, { name: "--status <csv>", description: "Filter approval statuses; ALL means no status filter." }, { name: "--supplierTags <csv>", description: "Filter by supplier tag IDs." }, { name: "--active <true|false>", description: "Active by default; false selects archived." }, { name: "--limit <1-100>", description: "Bounded page size (default 10). Retired page/perPage flags are rejected." }, { name: "--cursor <token>", description: "Opaque nextCursor or previousCursor from items/pageInfo." }, { name: "--direction <forward|backward>", description: "Forward by default; backward requires a cursor." }, { name: "--sortBy <field>", description: "name, email, phone, gstRegistered, status, active, createdAt or updated\
7197
+ At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by default." }, { name: "--sort <json>", description: "Ordered {id,desc} array for multi-column sorting; cannot combine with sortBy/sortDir." }]),
7198
+ legacyCommand("count-suppliers", ["supplier", "count"], [], [{ name: "--name <text>", description: "Filter supplier name or email." }, { name: "--createdBy <csv>", description: "Filter by creator IDs." }, { name: "--gstRegistered <true|false>", description: "Filter GST registration." }, { name: "--status <csv>", description: "Filter approval statuses." }, { name: "--supplierTags <csv>", description: "Filter by supplier tag IDs." }, { name: "--active <true|false>", description: "Active by default; false selects archived. No pagination/sort flags." }]),
7199
+ legacyCommand(
7200
+ "create-supplier",
7201
+ ["supplier", "create"]
7202
+ ),
7203
+ legacyCommand("update-supplier", ["supplier", "update"]),
7204
+ legacyCommand("delete-suppliers", ["supplier", "delete"]),
7205
+ legacyCommand("reactivate-suppliers", ["supplier", "reactivate"]),
7206
+ legacyCommand("create-certification", ["supplier", "certification", "create"]),
7207
+ legacyCommand("create-payment-method", ["supplier", "payment-method", "create"]),
7208
+ legacyCommand("create-supplier-role", ["supplier", "role", "create"]),
7209
+ legacyCommand("create-supplier-tag", ["supplier", "tag", "create"]),
7210
+ legacyCommand("get-supplier-analytics", ["supplier", "analytics", "get"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
7211
+ legacyCommand("count-supplier-analytics", ["supplier", "analytics", "count"]),
7212
+ legacyCommand("list-items", ["item", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
7213
+ legacyCommand("count-items", ["item", "count"]),
7214
+ legacyCommand("get-item", ["item", "get"]),
7215
+ legacyCommand("get-item-quickbooks-sync-status", ["item", "sync", "status"]),
7216
+ legacyCommand("create-item", ["item", "create"]),
7217
+ legacyCommand("update-item", ["item", "update"]),
7218
+ legacyCommand("archive-items", ["item", "archive"]),
7219
+ legacyCommand("delete-item", ["item", "delete"]),
7220
+ legacyCommand("list-item-categories", ["item", "category", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
7221
+ legacyCommand("count-item-categories", ["item", "category", "count"]),
7222
+ legacyCommand("create-item-category", ["item", "category", "create"]),
7223
+ legacyCommand("update-item-category", ["item", "category", "update"]),
7224
+ legacyCommand("delete-item-categories", ["item", "category", "delete"]),
7225
+ legacyCommand("list-users", ["user", "list"], [], [{ name: "--q <text>", description: "Search user names and emails (name A\u2013Z). A bare --q is rejected; use -q/--quiet to hide logs." }, { name: "--projectTeamOnly <true|false>", description: "true lists only active @getout.sg users, the only accounts accepted as Inside Sales, Business Development or Project Manager." }, { name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
7226
+ legacyCommand("count-users", ["user", "count"]),
7227
+ legacyCommand("create-user", ["user", "create"]),
7228
+ legacyCommand("create-api-key", ["user", "api-key", "create"]),
7229
+ legacyCommand("list-api-keys", ["user", "api-key", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
7230
+ legacyCommand("revoke-api-key", ["user", "api-key", "revoke"]),
7231
+ legacyCommand("get-user-performance", ["user", "performance", "get"]),
7232
+ legacyCommand("get-dashboard", ["dashboard", "get"]),
7233
+ legacyCommand("get-monthly-metrics", ["dashboard", "monthly-metrics", "get"]),
7234
+ legacyCommand("get-system-overview", ["dashboard", "system-overview", "get"]),
7235
+ legacyCommand("get-estimate-performance", ["dashboard", "estimate-performance", "get"]),
7236
+ legacyCommand("get-financial-overview", ["dashboard", "financial-overview", "get"]),
7237
+ legacyCommand("get-recent-errors", [
7238
+ "error",
7239
+ "recent",
7240
+ "list"
7241
+ ], [], [{ name: "--cursor <token>", description: "Pass a returned pageInfo boundary unchanged, with the same filters." }, { name: "--direction <direction>", description: "forward (default) uses nextCursor; backward uses previousCursor." }, { name: "--limit <number>", description: "1\u2013100 rows (default 10). Returns items and pageInfo, without a total." }, { name: "--severity <severity>", description: "Error severity or ALL." }, { name: "--status <status>", description: "Error status or ALL." }, { name: "--timeFrame <period>", description: "all_time (default), last_30_days, last_3_months, last_6_months or last_1_year." }]),
7242
+ legacyCommand("count-errors", ["error", "recent", "count"], [], [{ name: "--severity <severity>", description: "Error severity or ALL." }, { name: "--status <status>", description: "Error status or ALL." }, { name: "--timeFrame <period>", description: "Same filters as error recent list; returns independent totalCount." }]),
7243
+ legacyCommand("get-error", ["error", "get"]),
7244
+ legacyCommand("get-error-metrics", [
7245
+ "error",
7246
+ "metrics",
7247
+ "get"
7248
+ ]),
7249
+ legacyCommand("list-integration-operations", ["integration", "operation", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
7250
+ legacyCommand("count-integration-operations", ["integration", "operation", "count"]),
7251
+ legacyCommand("get-integration-operation", ["integration", "operation", "get"]),
7252
+ legacyCommand("retry-integration-operation", ["integration", "operation", "retry"]),
7253
+ legacyCommand("reconcile-resource-operation", ["integration", "operation", "reconcile-resource"]),
7254
+ legacyCommand("list-webhook-event-types", ["webhook", "event-type", "list"]),
7255
+ legacyCommand("list-webhook-endpoints", ["webhook", "endpoint", "list"]),
7256
+ legacyCommand("get-webhook-endpoint", ["webhook", "endpoint", "get"]),
7257
+ legacyCommand("create-webhook-endpoint", ["webhook", "endpoint", "create"]),
7258
+ legacyCommand("update-webhook-endpoint", ["webhook", "endpoint", "update"]),
7259
+ legacyCommand("delete-webhook-endpoint", ["webhook", "endpoint", "delete"]),
7260
+ legacyCommand("rotate-webhook-secret", ["webhook", "secret", "rotate"]),
7261
+ legacyCommand("send-webhook-test-event", ["webhook", "endpoint", "test"]),
7262
+ legacyCommand("list-webhook-deliveries", ["webhook", "delivery", "list"], [], [{ name: "--endpointId <id>", description: "Only deliveries to this endpoint." }, { name: "--status <PENDING|SUCCEEDED|FAILED,...>", description: "Comma-separated delivery statuses." }, { name: "--eventType <type>", description: "Exact event type, e.g. bill.approved." }, { name: "--limit <n>", description: "Rows per cursor page (1..100; default 20)." }, { name: "--cursor <token>", description: "Opaque token from pageInfo.nextCursor or pageInfo.previousCursor; bound to the same filters." }, { name: "--direction <value>", description: "forward or backward (default forward; backward requires cursor)." }]),
7263
+ legacyCommand("get-webhook-delivery", ["webhook", "delivery", "get"]),
7264
+ legacyCommand("replay-webhook-delivery", ["webhook", "delivery", "replay"]),
7265
+ legacyCommand("list-inbound-sources", ["inbound", "source", "list"], [], [{ name: "--limit <n>", description: "Rows per cursor page (1..100; default 25)." }, { name: "--cursor <token>", description: "Opaque source continuation token returned by pageInfo." }, { name: "--direction <value>", description: "forward or backward (default forward; backward requires cursor)." }, { name: "--search <text>", description: "Search source name or Typeform form ID." }, { name: "--processingEnabled <boolean>", description: "Filter processing enabled state." }, { name: "--processingMode <mode>", description: "ACTIVE, COLLECT_ONLY or SHADOW." }]),
7266
+ legacyCommand("count-inbound-sources", ["inbound", "source", "count"], [], [{ name: "--search <text>", description: "Search source name or Typeform form ID." }, { name: "--processingEnabled <boolean>", description: "Filter processing enabled state." }, { name: "--processingMode <mode>", description: "ACTIVE, COLLECT_ONLY or SHADOW." }]),
7267
+ legacyCommand("create-inbound-source", ["inbound", "source", "create"]),
7268
+ legacyCommand("get-inbound-source", ["inbound", "source", "get"]),
7269
+ legacyCommand("update-inbound-source", ["inbound", "source", "update"]),
7270
+ legacyCommand("list-inbound-submissions", ["inbound", "submission", "list"], [], [{ name: "--limit <number>", description: "Page size from 1 to 100 (default 25). Returns submissions, hasMore and nextCursor; no total." }, { name: "--cursor <token>", description: "Pass the previous response's nextCursor unchanged. Omit for newest submissions. Replaces --page/--perPage." }, { name: "--sourceId <id>", description: "Filter submissions to this source; keep the same filter while following cursors." }]),
7271
+ legacyCommand("count-inbound-submissions", ["inbound", "submission", "count"], [], [{ name: "--sourceId <id>", description: "Optional source filter. Returns an independently calculated exact totalCount, not a list snapshot." }]),
7272
+ legacyCommand("get-inbound-submission", ["inbound", "submission", "get"]),
7273
+ legacyCommand("save-inbound-mapping", ["inbound", "mapping", "save"]),
7274
+ legacyCommand("save-inbound-automation-config", ["inbound", "automation", "save"]),
7275
+ legacyCommand("update-inbound-processing", ["inbound", "processing", "update"]),
7276
+ legacyCommand("get-approved-budgets", ["budget", "approved", "list"]),
7277
+ legacyCommand("get-budget-category-benchmarks", ["budget", "category", "benchmark", "get"]),
7278
+ legacyCommand("get-item-pricing-history", ["item", "pricing-history", "list"]),
7279
+ legacyCommand("get-supplier-pricing-history", ["supplier", "pricing-history", "list"])
7280
+ ], normalizeToken = __name2((value) => value.replaceAll("_", "-"), "normalizeToken"), normalizedPath = __name2((path2) => path2.map(normalizeToken), "normalizedPath"), assertRegistry = __name2((commands) => {
7152
7281
  const paths = /* @__PURE__ */ new Set(), aliases = /* @__PURE__ */ new Set();
7153
7282
  for (const command of commands) {
7154
7283
  const path2 = command.path.join(" ");
@@ -7158,9 +7287,7 @@ var payloadHelp = { "create-budget": { required: "name: string; budget: decimal
7158
7287
  for (const alias of command.legacyAliases) {
7159
7288
  const normalizedAlias = normalizeToken(alias);
7160
7289
  if (!commandAliases.has(normalizedAlias)) {
7161
- if (commandAliases.add(normalizedAlias), aliases.has(normalizedAlias)) throw new Error("Duplicate legacy command alias: ".concat(
7162
- alias
7163
- ));
7290
+ if (commandAliases.add(normalizedAlias), aliases.has(normalizedAlias)) throw new Error("Duplicate legacy command alias: ".concat(alias));
7164
7291
  aliases.add(normalizedAlias);
7165
7292
  }
7166
7293
  }
@@ -7173,19 +7300,18 @@ var commandRegistry = registry2, resolveCommand = __name2((argv) => {
7173
7300
  const rawAlias = argv[0];
7174
7301
  if (!rawAlias) return;
7175
7302
  const normalizedAlias = normalizeToken(rawAlias), legacy = commandRegistry.find((command) => command.legacyAliases.some((alias) => normalizeToken(alias) === normalizedAlias));
7176
- if (legacy) return { command: legacy, argv: argv.slice(1), invokedAs: [rawAlias], isLegacyAlias: !0 };
7303
+ if (legacy) return { command: legacy, argv: argv.slice(1), invokedAs: [
7304
+ rawAlias
7305
+ ], isLegacyAlias: !0 };
7177
7306
  }, "resolveCommand"), 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.", createHumanHelp = __name2((command) => {
7178
- if (command) return [updateBeforeUse, "", "Usage: bb ".concat(command.path.join(" "), " [options] [args]"), "", command.summary, "", "Legacy aliases: ".concat(command.legacyAliases.join(", ")), "", "Options", ...command.options.map((option) => " ".concat(option.name, `
7179
- `).concat(option.description)), "", ...formatPayloadHelp(command.legacyTarget ?? ""), "Use `bb help --legacy` for additional command arguments."].join(`
7180
- `);
7307
+ if (command) return [updateBeforeUse, "", "Usage: bb ".concat(command.path.join(" "), " [options] [args]"), "", command.summary, "", "Legacy aliases: ".concat(command.legacyAliases.join(", ")), "", "Options", ...command.options.map((option) => " ".concat(option.name, "\n ").concat(option.description)), "", ...formatPayloadHelp(command.legacyTarget ?? ""), "Use `bb help --legacy` for additional command arguments."].join("\n");
7181
7308
  const lines = commandRegistry.map((command2) => {
7182
- const canonical = "bb ".concat(command2.path.join(" ")), aliases = command2.legacyAliases.filter((alias) => alias.includes("-")).map((alias) => "bb ".concat(alias)).join(", ");
7183
- return " ".concat(canonical, `
7184
- `).concat(command2.summary).concat(aliases ? " Legacy: ".concat(aliases, ".") : "");
7309
+ const canonical = "bb ".concat(command2.path.join(" ")), aliases = command2.legacyAliases.filter((alias) => alias.includes("-")).map((alias) => "bb ".concat(
7310
+ alias
7311
+ )).join(", ");
7312
+ return " ".concat(canonical, "\n ").concat(command2.summary).concat(aliases ? " Legacy: ".concat(aliases, ".") : "");
7185
7313
  });
7186
- return ["bb \u2014 Budget Builder CLI", "", updateBeforeUse, "", "Usage: bb <resource> <operation> [options] [args]", "", "Global options", ...globalCommandOptions.map((option) => " ".concat(option.name, `
7187
- `).concat(option.description)), "", "Canonical commands", ...lines, "", "Use `bb completion <shell>` to generate shell completion scripts."].join(`
7188
- `);
7314
+ return ["bb \u2014 Budget Builder CLI", "", updateBeforeUse, "", "Usage: bb <resource> <operation> [options] [args]", "", "Global options", ...globalCommandOptions.map((option) => " ".concat(option.name, "\n ").concat(option.description)), "", "Canonical commands", ...lines, "", "Use `bb completion <shell>` to generate shell completion scripts."].join("\n");
7189
7315
  }, "createHumanHelp"), completionWords = __name2(() => {
7190
7316
  const words = /* @__PURE__ */ new Set();
7191
7317
  for (const command of commandRegistry) {
@@ -7197,31 +7323,13 @@ var commandRegistry = registry2, resolveCommand = __name2((argv) => {
7197
7323
  const words = completionWords().join(" ");
7198
7324
  switch (shell) {
7199
7325
  case "bash":
7200
- return `# bash completion for bb
7201
- _bb() {
7202
- COMPREPLY=( $(compgen -W '`.concat(words, `' -- "\${COMP_WORDS[COMP_CWORD]}") )
7203
- }
7204
- complete -F _bb bb
7205
- `);
7326
+ return "# bash completion for bb\n_bb() {\n COMPREPLY=( $(compgen -W '".concat(words, '\' -- "${COMP_WORDS[COMP_CWORD]}") )\n}\ncomplete -F _bb bb\n');
7206
7327
  case "zsh":
7207
- return `#compdef bb
7208
- _bb() {
7209
- local -a commands
7210
- commands=(`.concat(words, `)
7211
- _describe 'bb command' commands
7212
- }
7213
- compdef _bb bb
7214
- `);
7328
+ return "#compdef bb\n_bb() {\n local -a commands\n commands=(".concat(words, ")\n _describe 'bb command' commands\n}\ncompdef _bb bb\n");
7215
7329
  case "fish":
7216
- return completionWords().map((word) => "complete -c bb -f -a '".concat(word, "'")).join(`
7217
- `).concat(`
7218
- `);
7330
+ return completionWords().map((word) => "complete -c bb -f -a '".concat(word, "'")).join("\n").concat("\n");
7219
7331
  case "powershell":
7220
- return `Register-ArgumentCompleter -Native -CommandName bb -ScriptBlock {
7221
- param($wordToComplete)
7222
- '`.concat(words, `'.Split(' ') | Where-Object { $_ -like "$wordToComplete*" }
7223
- }
7224
- `);
7332
+ return "Register-ArgumentCompleter -Native -CommandName bb -ScriptBlock {\n param($wordToComplete)\n '".concat(words, "'.Split(' ') | Where-Object { $_ -like \"$wordToComplete*\" }\n}\n");
7225
7333
  }
7226
7334
  }, "createCompletionScript"), SUPPLIER_ANALYTICS_SORT_IDS = ["name", "gstRegistered", "status", "phone", "email", "updatedAt", "createdAt"];
7227
7335
  function parsePositiveIntFlag(value, flagName) {
@@ -7231,7 +7339,10 @@ function parsePositiveIntFlag(value, flagName) {
7231
7339
  return parsed;
7232
7340
  }
7233
7341
  __name(parsePositiveIntFlag, "parsePositiveIntFlag"), __name2(parsePositiveIntFlag, "parsePositiveIntFlag");
7234
- var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = ["asc", "desc"], COMPANY_PAGE_FLAGS = ["page", "perPage", "pageSize", "page-size", "per-page", "page_size", "per_page"], rejectBareFlag = __name2((flags, key) => {
7342
+ var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = [
7343
+ "asc",
7344
+ "desc"
7345
+ ], COMPANY_PAGE_FLAGS = ["page", "perPage", "pageSize", "page-size", "per-page", "page_size", "per_page"], rejectBareFlag = __name2((flags, key) => {
7235
7346
  if (flags[key] === !0) throw new Error("--".concat(key, " requires a value."));
7236
7347
  }, "rejectBareFlag"), rejectCompanyPageFlags = __name2((flags, command) => {
7237
7348
  for (const key of COMPANY_PAGE_FLAGS) if (flags[key] !== void 0) throw new Error("--".concat(key, " is not supported by company ").concat(command, "; use --limit and --cursor for list or company count for totals."));
@@ -7240,11 +7351,14 @@ var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = ["asc
7240
7351
  const parsed = Number(String(value));
7241
7352
  if (!Number.isInteger(parsed) || parsed < 1 || parsed > 100) throw new Error("--limit must be an integer from 1 to 100.");
7242
7353
  return parsed;
7243
- }, "parseCompanyLimit"), parseCompanySortBy = __name2((value) => {
7244
- if (value === void 0) return "createdAt";
7245
- if (!COMPANY_SORT_FIELDS.includes(value)) throw new Error('Invalid --sortBy "'.concat(value, '". Use one of: ').concat(COMPANY_SORT_FIELDS.join(", "), "."));
7246
- return value;
7247
- }, "parseCompanySortBy"), parseCompanySortDir = __name2((value) => {
7354
+ }, "parseCompanyLimit"), parseCompanySortBy = __name2(
7355
+ (value) => {
7356
+ if (value === void 0) return "createdAt";
7357
+ if (!COMPANY_SORT_FIELDS.includes(value)) throw new Error('Invalid --sortBy "'.concat(value, '". Use one of: ').concat(COMPANY_SORT_FIELDS.join(", "), "."));
7358
+ return value;
7359
+ },
7360
+ "parseCompanySortBy"
7361
+ ), parseCompanySortDir = __name2((value) => {
7248
7362
  if (value === void 0) return "desc";
7249
7363
  if (!COMPANY_SORT_DIRECTIONS.includes(value)) throw new Error('Invalid --sortDir "'.concat(value, '". Use one of: ').concat(COMPANY_SORT_DIRECTIONS.join(", "), "."));
7250
7364
  return value;
@@ -7258,15 +7372,19 @@ var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = ["asc
7258
7372
  const cursor = getFlag(flags, "cursor"), direction = parseCompanyDirection(getFlag(flags, "direction"));
7259
7373
  if (direction === "backward" && cursor === void 0) throw new Error("--direction backward requires --cursor <token>.");
7260
7374
  if (cursor === "") throw new Error("--cursor requires a non-empty token.");
7261
- return { name: getFlag(flags, "name"), createdBy: getFlag(flags, "createdBy"), createdByIds: parseCommaSeparatedIds(getFlag(flags, "createdByIds")), active: parseOptionalBoolFlag(flags, "active"), limit: parseCompanyLimit(
7262
- getFlag(flags, "limit")
7263
- ), cursor, direction, sortBy: parseCompanySortBy(getFlag(flags, "sortBy")), sortDir: parseCompanySortDir(getFlag(flags, "sortDir")) };
7375
+ return { name: getFlag(
7376
+ flags,
7377
+ "name"
7378
+ ), createdBy: getFlag(flags, "createdBy"), createdByIds: parseCommaSeparatedIds(getFlag(flags, "createdByIds")), active: parseOptionalBoolFlag(flags, "active"), limit: parseCompanyLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseCompanySortBy(getFlag(flags, "sortBy")), sortDir: parseCompanySortDir(getFlag(flags, "sortDir")) };
7264
7379
  }, "parseCompanyListFlags"), parseCompanyCountFlags = __name2((flags) => {
7265
7380
  rejectCompanyPageFlags(flags, "count");
7266
7381
  for (const key of ["name", "createdBy", "createdByIds", "active", "limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
7267
7382
  if (flags.limit !== void 0 || flags.cursor !== void 0 || flags.direction !== void 0) throw new Error("company count does not accept list pagination flags.");
7268
7383
  if (flags.sortBy !== void 0 || flags.sortDir !== void 0) throw new Error("company count does not accept list sorting flags.");
7269
- return { name: getFlag(flags, "name"), createdBy: getFlag(flags, "createdBy"), createdByIds: parseCommaSeparatedIds(getFlag(flags, "createdByIds")), active: parseOptionalBoolFlag(flags, "active") };
7384
+ return { name: getFlag(flags, "name"), createdBy: getFlag(flags, "createdBy"), createdByIds: parseCommaSeparatedIds(getFlag(flags, "createdByIds")), active: parseOptionalBoolFlag(
7385
+ flags,
7386
+ "active"
7387
+ ) };
7270
7388
  }, "parseCompanyCountFlags"), PROJECT_SORT_FIELDS = ["name", "createdAt", "status", "companyName", "wonAt"], PROJECT_SORT_DIRECTIONS = ["asc", "desc"], PROJECT_PAGE_FLAGS = ["page", "perPage", "pageSize", "page-size", "per-page", "page_size", "per_page"], rejectProjectPageFlags = __name2((flags, command) => {
7271
7389
  for (const key of PROJECT_PAGE_FLAGS) if (flags[key] !== void 0) throw new Error("--".concat(key, " is not supported by project ").concat(command, "; use --limit and --cursor for list or project count for totals."));
7272
7390
  }, "rejectProjectPageFlags"), parseProjectLimit = __name2((value) => {
@@ -7280,10 +7398,7 @@ var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = ["asc
7280
7398
  return value;
7281
7399
  }, "parseProjectSortBy"), parseProjectSortDir = __name2((value) => {
7282
7400
  if (value === void 0) return "desc";
7283
- if (!PROJECT_SORT_DIRECTIONS.includes(value)) throw new Error('Invalid --sortDir "'.concat(
7284
- value,
7285
- '". Use one of: '
7286
- ).concat(PROJECT_SORT_DIRECTIONS.join(", "), "."));
7401
+ if (!PROJECT_SORT_DIRECTIONS.includes(value)) throw new Error('Invalid --sortDir "'.concat(value, '". Use one of: ').concat(PROJECT_SORT_DIRECTIONS.join(", "), "."));
7287
7402
  return value;
7288
7403
  }, "parseProjectSortDir"), parseProjectWonWithinDays = __name2((value) => {
7289
7404
  if (value === void 0) return;
@@ -7296,7 +7411,10 @@ var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = ["asc
7296
7411
  return value;
7297
7412
  }, "parseProjectDirection"), parseProjectListFlags = __name2((flags) => {
7298
7413
  rejectProjectPageFlags(flags, "list");
7299
- for (const key of ["companyId", "name", "status", "statuses", "active", "wonFrom", "wonTo", "wonWithinDays", "limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
7414
+ for (const key of ["companyId", "name", "status", "statuses", "active", "wonFrom", "wonTo", "wonWithinDays", "limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(
7415
+ flags,
7416
+ key
7417
+ );
7300
7418
  const cursor = getFlag(flags, "cursor"), direction = parseProjectDirection(getFlag(flags, "direction"));
7301
7419
  if (direction === "backward" && cursor === void 0) throw new Error("--direction backward requires --cursor <token>.");
7302
7420
  if (cursor === "") throw new Error("--cursor requires a non-empty token.");
@@ -7314,9 +7432,7 @@ function parseOptionalBoolFlag(flags, key) {
7314
7432
  const s = String(v).toLowerCase();
7315
7433
  if (s === "true" || s === "1") return !0;
7316
7434
  if (s === "false" || s === "0") return !1;
7317
- throw new Error(
7318
- "--".concat(key, " must be true or false.")
7319
- );
7435
+ throw new Error("--".concat(key, " must be true or false."));
7320
7436
  }
7321
7437
  __name(parseOptionalBoolFlag, "parseOptionalBoolFlag"), __name2(parseOptionalBoolFlag, "parseOptionalBoolFlag");
7322
7438
  function parseBudgetActiveFlag(flags) {
@@ -7353,10 +7469,7 @@ var rejectRetiredPageFlags = __name2((flags) => {
7353
7469
  if (!id) throw new Error("".concat(command, " requires ").concat(idLabel));
7354
7470
  rejectRetiredPageFlags(flags);
7355
7471
  for (const key of ["limit", "cursor"]) rejectBareFlag(flags, key);
7356
- if (flags.direction !== void 0) throw new Error("".concat(
7357
- command,
7358
- " pages forward only; follow pageInfo.nextCursor with --cursor."
7359
- ));
7472
+ if (flags.direction !== void 0) throw new Error("".concat(command, " pages forward only; follow pageInfo.nextCursor with --cursor."));
7360
7473
  const cursor = getFlag(flags, "cursor");
7361
7474
  if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
7362
7475
  const limitFlag = getFlag(flags, "limit"), limit = limitFlag === void 0 ? void 0 : Number(limitFlag);
@@ -7373,7 +7486,9 @@ function parseListBillsFlags(flags) {
7373
7486
  rejectRetiredPageFlags(flags);
7374
7487
  for (const key of ["limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
7375
7488
  const sortByRaw = getFlag(flags, "sortBy"), sortDirRaw = getFlag(flags, "sortDir"), cursor = getFlag(flags, "cursor");
7376
- if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
7489
+ if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error(
7490
+ "--cursor must be a non-empty opaque token of at most 8192 characters."
7491
+ );
7377
7492
  const direction = parseProjectDirection(getFlag(flags, "direction"));
7378
7493
  if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
7379
7494
  return { ...parseBillFilterFlags(flags), sortBy: parseOptionalBillListSortBy(sortByRaw !== void 0 ? String(sortByRaw) : void 0), sortDir: parseOptionalBillListSortDir(sortDirRaw !== void 0 ? String(sortDirRaw) : void 0), limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction };
@@ -7397,24 +7512,25 @@ var parseSupplierFilters = __name2((flags) => {
7397
7512
  for (const key of ["name", "createdBy", "gstRegistered", "status", "supplierTags", "active"]) rejectBareFlag(flags, key);
7398
7513
  return { name: getFlag(flags, "name"), createdBy: parseCommaSeparatedIds(getFlag(flags, "createdBy")), gstRegistered: parseOptionalBoolFlag(flags, "gstRegistered") ?? null, status: parseCommaSeparatedSupplierStatuses(getFlag(flags, "status")), supplierTags: parseCommaSeparatedIds(getFlag(flags, "supplierTags")), active: parseOptionalBoolFlag(flags, "active") ?? !0 };
7399
7514
  }, "parseSupplierFilters"), rejectSupplierPageFlags = __name2((flags) => {
7400
- for (const key of PROJECT_PAGE_FLAGS) if (flags[key] !== void 0) throw new Error("--".concat(key, " is retired for suppliers; use --limit/--cursor or supplier count for totals."));
7401
- }, "rejectSupplierPageFlags"), parseSupplierListSortEntries = __name2(
7402
- (sortRaw) => {
7403
- const parsed = parseJsonFlag(sortRaw, "--sort");
7404
- if (!Array.isArray(parsed) || parsed.length > 8) throw new Error("--sort must be a JSON array of at most eight {id, desc} entries.");
7405
- return parsed.map((item) => {
7406
- if (typeof item != "object" || item === null || !("id" in item) || !("desc" in item) || typeof item.id != "string" || typeof item.desc != "boolean" || Object.keys(item).some((key) => key !== "id" && key !== "desc")) throw new Error("Invalid --sort entry; use {id, desc}.");
7407
- const id = parseOptionalSupplierSortBy(item.id);
7408
- if (!id) throw new Error("Invalid --sort field.");
7409
- return { id, desc: item.desc };
7410
- });
7411
- },
7412
- "parseSupplierListSortEntries"
7413
- ), parseSupplierListSort = __name2((flags) => {
7515
+ for (const key of PROJECT_PAGE_FLAGS) if (flags[key] !== void 0) throw new Error(
7516
+ "--".concat(key, " is retired for suppliers; use --limit/--cursor or supplier count for totals.")
7517
+ );
7518
+ }, "rejectSupplierPageFlags"), parseSupplierListSortEntries = __name2((sortRaw) => {
7519
+ const parsed = parseJsonFlag(sortRaw, "--sort");
7520
+ if (!Array.isArray(parsed) || parsed.length > 8) throw new Error("--sort must be a JSON array of at most eight {id, desc} entries.");
7521
+ return parsed.map((item) => {
7522
+ if (typeof item != "object" || item === null || !("id" in item) || !("desc" in item) || typeof item.id != "string" || typeof item.desc != "boolean" || Object.keys(item).some((key) => key !== "id" && key !== "desc")) throw new Error("Invalid --sort entry; use {id, desc}.");
7523
+ const id = parseOptionalSupplierSortBy(item.id);
7524
+ if (!id) throw new Error("Invalid --sort field.");
7525
+ return { id, desc: item.desc };
7526
+ });
7527
+ }, "parseSupplierListSortEntries"), parseSupplierListSort = __name2((flags) => {
7414
7528
  const sortRaw = getFlag(flags, "sort");
7415
7529
  if (sortRaw !== void 0) {
7416
7530
  if (flags.sortBy !== void 0 || flags.sortDir !== void 0) throw new Error("Use --sort or --sortBy/--sortDir, not both.");
7417
- return parseSupplierListSortEntries(sortRaw);
7531
+ return parseSupplierListSortEntries(
7532
+ sortRaw
7533
+ );
7418
7534
  }
7419
7535
  const sortBy = parseOptionalSupplierSortBy(getFlag(flags, "sortBy")), sortDir = parseOptionalBillListSortDir(getFlag(flags, "sortDir"));
7420
7536
  return [{ id: sortBy ?? "createdAt", desc: (sortDir ?? "desc") === "desc" }];
@@ -7428,7 +7544,9 @@ var parseSupplierFilters = __name2((flags) => {
7428
7544
  const sort = parseSupplierListSort(flags);
7429
7545
  return { ...parseSupplierFilters(flags), limit, cursor, direction, sort };
7430
7546
  }, "parseListSuppliersFlags"), parseCountSuppliersFlags = __name2((flags) => {
7431
- rejectSupplierPageFlags(flags);
7547
+ rejectSupplierPageFlags(
7548
+ flags
7549
+ );
7432
7550
  for (const key of ["limit", "cursor", "direction", "sort", "sortBy", "sortDir"]) if (flags[key] !== void 0) throw new Error("supplier count does not accept --".concat(key, "; totals use filters only."));
7433
7551
  return parseSupplierFilters(flags);
7434
7552
  }, "parseCountSuppliersFlags");
@@ -7438,323 +7556,44 @@ function parseDashboardQueryFlags(flags) {
7438
7556
  }
7439
7557
  __name(parseDashboardQueryFlags, "parseDashboardQueryFlags"), __name2(parseDashboardQueryFlags, "parseDashboardQueryFlags");
7440
7558
  function printLegacyHelp(runtime) {
7441
- const help = `
7442
- bb \u2014 Budget Builder CLI for AI agents (parity with MCP tools)
7443
-
7444
- 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.
7445
-
7446
- Usage: bb <command> [options] [args]
7447
-
7448
- Identity: bb version \u2014 print the installed CLI package version and API target as JSON.
7449
-
7450
- Global: --quiet | -q | BB_CLI_QUIET=1 \u2014 hide action logs (default: log command + each tRPC call to stderr; stdout JSON unchanged).
7451
-
7452
- Auth: Run bb auth login for interactive use. BB_API_KEY remains supported for MCP, CI, and non-interactive automation.
7453
-
7454
- Authorization: Run bb whoami before choosing commands. bb help lists the full
7455
- catalog for every role; it does not prove the active credential may call a command.
7456
- The API evaluates whoami.role (USER, INSIDE_SALES, LEAD, ACCOUNTING_TEAM, or
7457
- ADMIN) together with resource ownership/project assignment, current state, and
7458
- pending-approver assignment. On FORBIDDEN, stop and report the identity, role,
7459
- command, and target; do not switch keys or try a lower-level procedure.
7460
-
7461
- Sensitive workflow changes: approval decisions/requests, entity status updates,
7462
- estimate emails, customer invoices, integration retries and QuickBooks outcome
7463
- verification, mark-budget-won,
7464
- submit-quotation, and supplier approval request side effects require an
7465
- interactive CONFIRM prompt and abort in non-interactive shells.
7466
- AI agents must inspect the entity first, summarize the exact entity, target
7467
- state, and side effects, then wait for explicit user confirmation before running
7468
- the sensitive command.
7469
-
7470
- Budget mutations return a conflict while an estimate email is queued,
7471
- processing, or awaiting provider reconciliation.
7472
-
7473
- Budgets
7474
- list-budgets [--projectId] [--name] [--status CSV] [--createdBy] [--dateFrom] [--dateTo] [--sortBy lastActivityAt|createdAt|status|budget|date|createdBy] [--sortDir] [--limit 1-100] [--cursor <token>] [--direction forward|backward] [--summary]
7475
- Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.
7476
- count-budgets [same filter flags as list-budgets] totalCount plus status and active facets (each ignores its own filter)
7477
- get-budget <id> Budget + line items
7478
- get-budget-items <id> Line items only
7479
- get-budget-details <id> Full detail (margins, suppliers, etc.)
7480
- get-budget-categories [--q] [--limit 1-100] [--cursor <token>]
7481
- Active categories, name A\u2013Z. Returns { items, pageInfo }; follow nextCursor with the same --q.
7482
- get-budget-versions <budgetId> [--limit <1-50>] [--cursor <token> | --all]
7483
- rename-budget-version <versionId> --name <text>
7484
- restore-budget-version <versionId> Replace current budget data and return it to DRAFT.
7485
- update-budget-status <id> <status> [--projectManagerId <id>] [--markProjectWon true|false] [--projectStatusOnCommercialRejection PITCH|LOST]
7486
- APPROVED requires a current Lead/Admin role, regardless of budget management permissions. Ordinary users must request approval.
7487
- Material edits and generic status changes invalidate older pending budget requests; decide only a fresh request for the content reviewed.
7488
- Budget-changing commands require interactive "yes" confirmation when the current budget is ESTIMATE_CREATED, ESTIMATE_SENT, ESTIMATE_ACCEPTED, ESTIMATE_REJECTED, or ESTIMATE_CLOSED.
7489
- ESTIMATE_ACCEPTED requires win proof, auto-marks PITCH or LOST projects WON, requires --projectManagerId when the project has no PM, and auto-creates the Asana project/section when enabled.
7490
- ESTIMATE_REJECTED requires --projectStatusOnCommercialRejection when rejecting the only accepted/closed budget on a commercial project.
7491
- status: `.concat(budgetStatusesForHelp.join(", "), `
7492
- mark-budget-won <budgetId> <filePath> [--projectManagerId <id>] [--invoiceSettings <json>] Upload signed quote/PO proof and set status to ESTIMATE_ACCEPTED; invoice settings optionally save project delivery preferences
7493
- create-budget --payload '<json>' (budget.createBudget; when sourceBudgetId contains unavailable items, set unavailableItemReviewAcknowledged=true after explicit review)
7494
- update-budget --payload '<json>' (budget.updateBudget; must include id)
7495
- delete-budget <budgetId>
7496
- create-budget-approval <budgetId> (also queues approval request emails)
7497
- create-estimate <budgetId> (queues QuickBooks estimate creation; budget is read-only until it settles; supports preflight updates)
7498
- send-estimate-to-contact-person --payload '<json>' Send using the web contact-person workflow; payload includes recipient fields plus HTML content/signature.
7499
- add-budget-items --budgetId --items '[{"itemId":"\u2026","quantity":1,"markup":30},\u2026]'
7500
- update-budget-item --id <budgetItemId> [--description plain-text] [--note plain-text] [--quantity] [--markup] [--cost] [--unitPrice] [--isFreeOfCharge true|false] [--gstInclusive true|false] [--gstOutOfScope true|false]
7501
- remove-budget-item <budgetItemId>
7502
- replace-budget-item --budgetItemId <id> --replacementItemId <activeCatalogueItemId>
7503
- approve-unavailable-item-exception --budgetItemId <id> --reason <text> Lead/Admin only; reason must be 5-1000 characters.
7504
- reorder-budget-items <budgetId> --itemIds <csv>
7505
- update-budget-item-supplier --budgetItemId --supplierId Material supplier/GST edit: supersedes pending approvals and applies the standard budget reset policy; unchanged supplier is a no-op.
7506
- create-budget-category --name <text>
7507
- update-budget-category --id --name
7508
- delete-budget-category <id>
7509
- update-budget-commission --payload '<json>' (budget.updateBudgetCommission)
7510
- update-budget-discount --payload '<json>' (budget.updateBudgetDiscount; type percentage|amount)
7511
- delete-budget-commission <budgetId> Remove commission and return the budget to DRAFT.
7512
- delete-budget-discount <budgetId> Remove discount and return the budget to DRAFT.
7513
- mark-budget-items-not-utilized --ids <csv> Remove unused lines from reconciliation and queue clearing their QBO placeholders.
7514
- restore-budget-item <budgetItemId> Restore one Not Utilized line and queue its QBO placeholder when required.
7515
- create-placeholder-bill <budgetItemId> Admin-only placeholder recovery; queues the QBO placeholder (operationId, status QUEUED).
7516
- upload-budget-attachment <budgetId> <filePath> Presigned S3 upload + confirm
7517
-
7518
- Bills
7519
- list-bills [--projectId] [--budgetId] [--status CSV] [--search <text>] [--isClaimable true|false] [--createdByIds <csv>] [--sortBy createdAt|amount|status] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]
7520
- Returns { items, pageInfo }; pass nextCursor with --direction forward or previousCursor with --direction backward, keeping the same filters and sort. --page/--pageSize/--perPage are rejected.
7521
- list-claims same flags as list-bills; only reimbursable claims (ignores --isClaimable)
7522
- count-bills [--projectId] [--budgetId] [--status CSV] [--search <text>] [--isClaimable true|false] [--createdByIds <csv>] [--includeMetrics true|false] totalCount, status facets (ignore --status) and optional amount metrics; no pagination/sort flags
7523
- count-claims same flags as count-bills; only reimbursable claims
7524
- Both lists return summaries; use get-bill-details <billId> for full detail.
7525
- isClaimable differentiates the shared bill/claim records: false = bill, true = claim.
7526
- Create supplier bills from approved quotations from the same supplier and project. Use quotationAllocations plus lineAmounts when quotations split one bill line. Eligible exemptions require explicit --quotation-exempt intent; claims do not consume or link quotations. Document-only quotations (documentOnly: true, $0) are never valid bill sources; create-bill, update-bill, validate-bill-selection and link-bill-quotations reject them, and a line covered only by one still counts as unquoted.
7527
- Amounts for create/update (including drafts) exclude GST: amount = portion billed; extractedAmount = full invoice subtotal; lineAmounts[].amount and quotationAllocations[].amount also exclude GST. The CLI does not strip GST from input.
7528
- Example: invoice subtotal 1800 + GST 162 = total 1962 -> amount: 1800, extractedAmount: 1800, allocations totaling 1800. BB calculates applicable GST separately. Re-read and verify both amount fields after writing.
7529
- create-bill-approval <billId> (also queues approval request emails)
7530
- create-bill --payload '<json>' [--draft-only] [--quotation-exempt] (bill.create; supplier bills use payload.quotationAllocations for split sources or quotationIds for disjoint coverage; explicit allocations require lineAmounts; claims reject quotation sources; an Admin's unpaid bill queues its QuickBooks bill: quickBooksSyncQueued, operationId)
7531
- validate-bill-selection --payload '<json>' [--quotationIds <csv> | --quotationId <id>] Validate an approved supplier and approved quotation coverage for each supplier-bill line. --quotationId is legacy single-quotation syntax.
7532
- link-bill-quotations <billId> (--payload '<json>' | --quotationIds <csv>) Admin-only source-link repair; payload.quotationAllocations supports same-line splits.
7533
- stage-bill-attachment <projectId> <filePath...> [--file <path>] [--files <csv>] Upload files before create-bill; returns attachment JSON for attachments/paymentProofAttachments
7534
- cleanup-staged-bill-attachments <projectId> --keys <csv> Queue cleanup of unattached staged uploads; returns operation IDs.
7535
- update-bill --payload '<json>' (bill.update; must include id)
7536
- update-bill-payment-evidence --payload '<json>' Replace paymentReference/paymentProofAttachments for an already-paid bill.
7537
- delete-bill <billId>
7538
- update-bill-status <id> <status> [--rejectionReason] [--paymentTrackingUrl] [--paymentReference] [--paymentProof <receipt.pdf>] [--overBudgetOverrideReason <text>]
7539
- status (`).concat(billStatusesForUpdateHelp.join(", "), `) \u2014 not PENDING_APPROVAL; use create-bill-approval
7540
- PAID requires --paymentReference and a payment-proof PDF. Use --paymentProof to stage and submit the PDF atomically, or omit it only when BB already has a BILL_PAYMENT_PROOF attachment.
7541
- Moving a bill or claim to PAID runs the server's paid-bill notification workflow.
7542
- patch-bill-payment <billId> [--paymentTrackingUrl] [--paymentReference] [--quickbooksBillId] [--paymentDate <ISO>]
7543
- Clear a field: --clearPaymentTrackingUrl true | --clearPaymentReference true | --clearQuickbooksBillId true | --clearPaymentDate true
7544
- patch-bill-invoice-number <billId> <invoiceNumber>
7545
- get-bill-attachments <billId> [--limit 1-50] [--cursor <token>]
7546
- Newest first. Returns { items, pageInfo }; follow nextCursor.
7547
- upload-bill-attachment <billId> <filePath...> [--file <path>] [--files <csv>] Attach invoice/supporting files as BILL attachments to any bill status, including PAID bills
7548
- attach-bill-payment-receipt <billId> <filePath...> [--file <path>] [--files <csv>] Attach Wise/payment-proof PDFs as BILL_PAYMENT_PROOF attachments
7549
- attach-bill-documents <billId> [--invoice <path>] [--invoices <csv>] [--paymentProof|--payment-proof|--proof <path>] [--paymentProofs|--payment-proofs|--proofs <csv>] Attach invoice and/or payment proof files with separate BB attachment types
7550
- get-bill-details <billId> Bill summary as shown in the web app (status, amounts, people, payment, line totals)
7551
- get-bill-line-items <billId> [--limit 1-100] [--cursor <token>] Line items with budget-item/quotation detail; { items, pageInfo }
7552
- get-bill-approvals <billId> [--limit 1-50] [--cursor <token>] Approval requests with approver/requester/responder; { items, pageInfo }
7553
- get-bill-payment <billId> Payment status, reference, date, tracking URL, QuickBooks link and external payment
7554
-
7555
- Quotations
7556
- list-quotations [--projectId] [--budgetId] [--supplierId] [--status CSV] [--createdBy CSV] [--search] [--limit 1-100] [--cursor <token>] [--direction forward|backward]
7557
- Newest first; returns { items, pageInfo }; rows carry documentOnly (document-only $0 quotations are listed and counted like any other). Follow nextCursor/previousCursor with the same filters. --page/--pageSize/--perPage are rejected; --requesterIds remains an alias for --createdBy.
7558
- count-quotations [--projectId] [--budgetId] [--supplierId] [--status CSV] [--createdBy CSV] [--search] [--includeMetrics true|false] totalCount, status facets (ignore --status) and optional amount metrics
7559
- get-quotation <quotationId> Quotation as shown in the web app (status, documentOnly, amounts, people, line totals, files, approvals; pdfProcessing is PROCESSING or FAILED until queued PDF conversion/signing links the PDF; gstMismatch warns when GST differs from the expected GST)
7560
- get-quotation-line-items <quotationId> [--limit 1-100] [--cursor <token>] Line items with budget-item detail; { items, pageInfo }
7561
- upload-quotation-attachment <projectId> <filePath> Upload one PDF, JPEG, or PNG up to 20MB; returns attachment JSON for a quotation payload.
7562
- cleanup-staged-quotation-attachments <projectId> --keys <csv> Queue cleanup of unattached quotation uploads; returns operation IDs.
7563
- create-quotation --payload '<json>' (quotation.createDraft; requires amountWithoutGst, gstAmount, and lineAmounts [{budgetItemId, amount}] for multiple budgetItemIds; amounts before GST must sum to amountWithoutGst; result gstMismatch warns when gstAmount is not 0 or the expected GST)
7564
- Document-only ($0 supplier document, e.g. a contract or proposal with no price): set documentOnly: true with amountWithoutGst: 0, gstAmount: 0 and zero lineAmounts (lineAmounts may be omitted). It goes through submit/sign/approve like any quotation and shows documentOnly: true in list/get output, but it is never a valid bill quotation source (create-bill, update-bill, validate-bill-selection and link-bill-quotations are rejected by the API) and does not count as quotation coverage: a budget line covered only by it still counts as unquoted. Without documentOnly (default false), amountWithoutGst must be positive.
7565
- Example: --payload '{"projectId":"<id>","budgetId":"<id>","supplierId":"<id>","budgetItemIds":["<id>"],"amountWithoutGst":0,"gstAmount":0,"documentOnly":true,"attachments":[<uploaded attachment>]}'
7566
- update-quotation --payload '<json>' Update a DRAFT or REJECTED quotation; same allocation payload plus id; use lineAmounts [{budgetItemId, amount}] for every selected item. Result gstMismatch warns when gstAmount is not 0 or the expected GST. Update is a full replace: send documentOnly: true again when updating a document-only quotation, or it is treated as a priced quotation and needs a positive amountWithoutGst.
7567
- delete-quotation <quotationId>
7568
- submit-quotation <quotationId> [--overBudgetOverrideReason <text>] (signed PDF is made by a queued job: pdfProcessing; gstMismatch warns when GST is not 0 or the expected GST)
7569
- approve-quotation <quotationId> [--overBudgetOverrideReason <text>] (assigned pending request/current Admin; concurrent revision or allocation changes conflict; final signed PDF is queued: pdfProcessing)
7570
- reject-quotation <quotationId> --reason <text>
7571
- download-quotation-pdf <quotationId> [original|staff|final] (refused with "still processing" until the queued PDF step links it)
7572
-
7573
- Customer invoices
7574
- check-customer-invoice-readiness <budgetId> Readiness plus the full remaining-balance amount preview and live QuickBooks validation.
7575
- list-eligible-customer-invoice-budgets <projectId> Accepted budgets that are ready and still have invoice coverage remaining, including estimate total, invoiced/remaining percentages, and available amount.
7576
- preview-customer-invoice-amount <budgetId> <percentage-of-estimate> Preview amount before GST, GST, and total for a percentage of the original estimate. The percentage cannot exceed the budget's remaining coverage.
7577
- list-available-qbo-customer-invoices <budgetId> List unlinked QuickBooks invoices available for this accepted or closed estimate before previewing and importing one.
7578
- list-customer-invoices [budgetId] [--projectId <id>] [--companyIds CSV] [--projectIds CSV] [--budgetIds CSV] [--createdByIds CSV] [--status CSV] [--search] [--sortBy createdAt|status|totalInvoiceAmount|approvalExpiresAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]
7579
- Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.
7580
- No scope flag lists invoices globally. --projectId uses the project scope. A positional budgetId is a backward-compatible shortcut for --budgetIds.
7581
- count-customer-invoices [budgetId] [same filter flags as list-customer-invoices] totalCount, lifecycle status facets (ignore --status) and amount metrics; no paging or sort flags
7582
- get-customer-invoice <batchId> Batch as shown in the web app: status, totals, people, approvals and invoice summaries
7583
- get-customer-invoice-invoices <batchId> Invoices with QuickBooks identity, dates, sync state, bill email (from QuickBooks) and held QuickBooks changes (qboDetailsDrift)
7584
- get-customer-invoice-lines <invoiceId> [--limit 1-100] [--cursor <token>] One invoice's lines; { items, pageInfo }
7585
- get-customer-invoice-approvals <batchId> [--limit 1-50] [--cursor <token>] Approval requests with approver/requester/responder; { items, pageInfo }
7586
- get-customer-invoice-history <batchId> [--limit 1-100] [--cursor <token>] Status history; { items, pageInfo }
7587
- get-customer-invoice-payments <invoiceId> Payments QuickBooks applied to one invoice (date, reference, amount applied, attachment names). Live QuickBooks read.
7588
- get-customer-invoice-email-context <batchId> Contact, required CC, budget, and project context for composing an invoice email.
7589
- preview-qbo-customer-invoice <budgetId> <qboInvoiceId> Preview an invoice selected from list-available-qbo-customer-invoices; works on accepted/closed estimates.
7590
- import-qbo-customer-invoice <budgetId> <qboInvoiceId> --token <previewToken> Confirm the reviewed BB-only link; requires --allow-state-change --allow-financial-write in automation.
7591
- create-customer-invoice --payload '<json>' Create one invoice from an eligible budget. Include budgetId, a recommended UUID requestId, invoiceDate, details {billingAddress, customerMemo}, and exactly one split {label, percentage, dueDate}. Percentage is of the original estimate and cannot exceed the remaining coverage. Never sends.
7592
- discard-customer-invoice <batchId> Discard a reserved CREATING batch with no created QBO invoices.
7593
- delete-customer-invoice <batchId> Delete QBO invoices and the local batch.
7594
- void-customer-invoice <batchId> Void the invoice batch in QuickBooks.
7595
- resubmit-customer-invoice <batchId> Original requester only. Queues one replacement after confirmed expiry voiding; retries return the same replacement. Never sends to the customer.
7596
- approve-customer-invoice <batchId> Admin approval; rejects voided invoices, notifies the creator, and closes the estimate at cumulative 100% coverage.
7597
- reject-customer-invoice <batchId> --reason <text> Admin rejection; voids QBO invoices and notifies the creator.
7598
- send-customer-invoice-to-contact-person --payload '<json>' Queues same composer workflow as web; requires invoiceId, to, cc, replyTo, subject, HTML content, and HTML signature.
7599
- download-customer-invoice-pdf <invoiceId> [--output <path>]
7600
- mark-customer-invoice-sent-externally <invoiceId> --sentAt <ISO datetime> --recipients a@x.com,b@y.com [--note <text>] Admin only. Record an APPROVED invoice as SENT because it was emailed outside Budget Builder; sends no email.
7601
- sync-customer-invoice <invoiceId> Refresh local status and balance from QuickBooks; paid invoices become PAID, reversals restore delivery/approval, and QBO voids can reopen an estimate. QuickBooks edits to bill-to address, memo, bill email or total are not applied: they are flagged as qboDetailsDrift and admins are emailed.
7602
- update-customer-invoice-details <invoiceId> --billingAddress <text> --customerMemo <text> [--requestId <uuid>]
7603
- Save bill-to address and memo in BB and queue the QuickBooks update (external write). Bill email is managed in QuickBooks.
7604
- update-customer-invoice-qbo-drift <invoiceId> --resolution ACCEPT_QBO|KEEP_BB [--requestId <uuid>]
7605
- Admin: resolve flagged QuickBooks changes. ACCEPT_QBO copies them into BB only; KEEP_BB queues BB's address and memo to QuickBooks.
7606
-
7607
- Approvals
7608
- list-approvals | get-pending-approvals [--type budget|supplier|bill|quotation|customer_invoice|all]
7609
- approve-bill <billId> [--overBudgetOverrideReason <text>] (also sends requester reply email)
7610
- reject-bill <billId> --reason <text> (also sends requester reply email)
7611
- approve-budget <budgetId> (also sends requester reply email)
7612
- reject-budget <budgetId> --reason <text> (also sends requester reply email)
7613
- approve-supplier <supplierId> (approve a pending request, or Admin/Lead re-approve a rejected supplier; QuickBooks vendor sync is queued)
7614
- reject-supplier <supplierId> --reason <text> (also sends requester reply email)
7615
-
7616
- Companies & projects
7617
- list-companies [--name] [--createdBy] [--createdByIds CSV] [--active true|false] [--sortBy name|createdAt] [--sortDir asc|desc] [--limit 1-100] [--cursor] [--direction forward|backward]
7618
- Returns { items, pageInfo }; pass nextCursor with direction forward or previousCursor with direction backward. Omit --cursor to restart.
7619
- count-companies [--name] [--createdBy] [--createdByIds CSV] [--active true|false]
7620
- Returns independent { totalCount, counts: { active: { true, false } } }; no pagination or sorting flags.
7621
- get-company <id>
7622
- search-existing-companies --query <name> [--limit 1-50] [--cursor <token>] (BB + QuickBooks, read-only; follow pageInfo.nextCursor)
7623
- use-existing-company --companyId <bbId> and/or --quickbooksId <qboId> [--name <qboName>] [--website <url>] [--confirmDistinct true]
7624
- Supply both IDs to explicitly connect existing records with different names.
7625
- Reuses both records, creating only the missing counterpart. A QBO-only import needs --name (from search-existing-companies);
7626
- website is needed only for a QBO import without one. The QuickBooks link is queued (quickBooksSyncQueued, operationId).
7627
- create-company --name --website <url> [--confirmDistinct true] [--billingEmails '<json-array>'] (QuickBooks customer queued)
7628
- Exact existing companies are reused. Similar names require explicit separate-entity confirmation.
7629
- update-company --payload '<json>' (optional billingEmails: omit to preserve, [] to clear; returns queued QBO operation ID, not completion)
7630
- get-company-quickbooks-sync-status <companyId> (saved status only; no provider call or polling)
7631
- delete-company <id>
7632
- list-projects [--companyId] [--name] [--status|--statuses CSV] [--active true|false] [--wonFrom ISO] [--wonTo ISO] [--wonWithinDays N] [--limit 1-100] [--cursor] [--direction forward|backward] [--sortBy name|createdAt|status|companyName|wonAt] [--sortDir asc|desc]
7633
- Returns { items, pageInfo }; pass nextCursor with direction forward or previousCursor with direction backward. Legacy --page/--perPage are rejected.
7634
- --sortBy wonAt orders by when the project was marked WON (unwon projects last). Each project includes wonAt, wonBy { id, name } and wonAtEstimated (true for backfilled dates).
7635
- count-projects [--companyId] [--name] [--status|--statuses CSV] [--active true|false] [--wonFrom ISO] [--wonTo ISO] [--wonWithinDays N]
7636
- Returns independent { totalCount, counts: { status, active: { true, false } } }; no pagination or sorting flags.
7637
- list-project-hubs [--q] [--status CSV] [--sortBy startDate|name|companyName|status] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]
7638
- Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.
7639
- count-project-hubs [--q] [--status CSV] totalCount plus status facet
7640
- List active projects that have a Project Hub integration.
7641
- get-project <id>
7642
- Budget overview totalRevenue includes Estimate Accepted and Estimate Closed budgets only.
7643
- create-project --name --companyId --contactPersonId --insideSalesId --businessDevelopmentId --venue --startDate <ISO> [--projectManagerId <userId>] [--asanaTaskId] [--asanaSearch <text>] [--slackChannelId --slackChannelUrl --slackChannelName] [--pax] [--endDate <ISO>] [--description]
7644
- update-project --payload '<json>' (project.updateProject; warns before estimate-affecting changes reject linked estimates; a companyId change (with a contactPersonId from that company) does not itself reject estimates or touch invoices, but date/pax/venue changes in the same save still do; optional projectManagerId and requestQboAccountantNotification)
7645
- delete-project <id>
7646
- check-project-reconciliation <id> Run the same live reconciliation review as the web app without changing status.
7647
- reconcile-project <id> Rerun all checks transactionally and mark an eligible WON project RECONCILED.
7648
- complete-project <id> Rerun reconciliation validation, mark a RECONCILED project COMPLETED, and queue QBO placeholder cleanup.
7649
- import-qbo-project <projectId> --url <quickBooksProjectUrl>
7650
- update-project-status <id> <status> [--projectManagerId <userId>] [--projectManagerEmail <email>]
7651
- PITCH \u2192 WON requires an accepted/closed estimate. To win a pitch, accept its estimate with mark-budget-won <budgetId> <signed-quote.pdf>, which moves the project to WON.
7652
- Required when moving PITCH \u2192 WON: supply --projectManagerId or --projectManagerEmail.
7653
- The project manager must be an active @getout.sg user; list eligible users with list-users --projectTeamOnly true.
7654
- status: `).concat(projectStatusesForHelp.join(", "), `
7655
-
7656
- Contacts
7657
- list-contacts <companyId>
7658
- create-contact-person --payload '<json>' (contactPerson.createContactPerson; title MR|MRS|MS|DR)
7659
- update-contact-person --payload '<json>' (contactPerson.updateContactPerson; must include id)
7660
-
7661
- Suppliers & items
7662
- list-suppliers [--name] [--limit 1-100] [--cursor <token>] [--direction forward|backward] [--sortBy createdAt|updatedAt|name|email|phone|gstRegistered|status|active] [--sortDir asc|desc | --sort JSON] [--createdBy <csv>] [--gstRegistered true|false] [--status CSV] [--supplierTags <csv>] [--active true|false]
7663
- count-suppliers [--name] [--createdBy <csv>] [--gstRegistered true|false] [--status CSV] [--supplierTags <csv>] [--active true|false] (independent totals/facets; no pagination/sort flags)
7664
- Defaults: --active true, --limit 10, --sortBy createdAt, --sortDir desc (same as the web list); pass --active false for archived suppliers.
7665
- create-supplier --payload '<json>' (supplier.createSupplier; archived-name recreation is Admin-only; auto-requests approval + emails when status is PENDING_APPROVAL; Lead/Admin creates queue the QuickBooks vendor: quickBooksSyncQueued, operationId)
7666
- update-supplier --payload '<json>' (authenticated; normal-user edits require server-enforced approval; Lead/Admin edits of a linked supplier queue the QuickBooks sync)
7667
- delete-suppliers --ids <csv> (supplier.deleteSuppliers; admin; archives/deactivates supplier items)
7668
- reactivate-suppliers --ids <csv> (supplier.reactivateSuppliers; admin; queues QuickBooks vendor reactivation, then the suppliers and their items become active: queuedSuppliers, operations)
7669
- create-certification --name (supplier.createCertification)
7670
- create-payment-method --name (supplier.createPaymentMethod)
7671
- create-supplier-role --name (supplier.createSupplierRole)
7672
- create-supplier-tag --name (supplier.createSupplierTag)
7673
- create-item --payload '<json>' (item.createItem; saves the item and queues its QuickBooks create: quickBooksSyncQueued, operationId)
7674
- update-item --payload '<json>' (item.updateItem; must include id)
7675
- archive-items --ids <csv> (item.archiveItems; Budget Builder only; max 100; users can archive their own items, leads/admins any item; open estimates retain snapshot lines and require resolution before send/acceptance)
7676
- delete-item <id> (item.deleteItem; admin; archives in Budget Builder and makes the item inactive in QuickBooks; blocked while used by an open estimate)
7677
- get-supplier-details <supplierId>
7678
- get-supplier-overview <supplierId> (supplier.getSupplierOverview; profile, approvals, attachments and tab counts; no usage or items)
7679
- get-supplier-usage <supplierId> (supplier.getSupplierUsage; usage rows and spending)
7680
- get-supplier-items <supplierId> (supplier.getSupplierItems; inventory items)
7681
- get-supplier-analytics [--name] [--status CSV] [--gstRegistered true|false] [--createdBy <text>] [--timeFrame ALL|LAST_YEAR|LAST_6_MONTHS|LAST_3_MONTHS|CUSTOM] [--startDate <ISO> --endDate <ISO>] [--sortBy name|gstRegistered|status|phone|email|updatedAt|createdAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]
7682
- Admin. Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.
7683
- count-supplier-analytics [--name] [--status] [--gstRegistered] [--createdBy] [--timeFrame] [--startDate --endDate] Admin. totalCount for the same filters
7684
- list-items [--name] [--includeQuickBooksDeactivationPending true] [--sortBy createdAt|updatedAt|name|cost|itemCategory|supplier] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]
7685
- Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.
7686
- count-items [same filter flags as list-items] total plus category and supplier facets
7687
- get-item <id>
7688
- get-item-quickbooks-sync-status <itemId> (saved status only; no provider call or polling)
7689
- list-item-categories [--name] [--sortBy createdAt|name|itemCount|createdBy] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]
7690
- Active categories only; returns { items, pageInfo }. Follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.
7691
- count-item-categories [--name] totalCount of active categories
7692
- create-item-category --name (admin; saves the category and queues its QuickBooks create: quickBooksSyncQueued, operationId)
7693
- update-item-category --id --name (authenticated; renames in BB now and queues the QuickBooks rename: quickBooksSyncQueued, operationId)
7694
- delete-item-categories --ids <csv> (itemCategory.deleteItemCategories; admin; empty categories only)
7695
-
7696
- Dashboard & users
7697
- whoami Show the user identity and role for the active API key.
7698
- list-users [--q] [--projectTeamOnly true|false] [--limit 1-100] [--cursor <token>]
7699
- Name A\u2013Z. Returns { items, pageInfo }; follow nextCursor with the same --q and --projectTeamOnly. --page/--perPage are rejected.
7700
- --projectTeamOnly true lists only active @getout.sg users, the only accounts accepted as Inside Sales, Business Development or Project Manager.
7701
- count-users [--q] [--projectTeamOnly true|false] totalCount for the same search
7702
- create-user --email <email> [--name <name>] [--role `).concat(userRolesForHelp.join("|"), `] (admin; API-only service identity with no Google sign-in)
7703
- create-api-key --name <label> [--userId <userId>] (defaults to the caller; admin required for another user; raw key is shown once)
7704
- list-api-keys [--userId <userId>] [--limit 1-100] [--cursor <token>] (newest first, { items, pageInfo }; defaults to the caller; admin required for another user)
7705
- revoke-api-key <apiKeyId> [--userId <userId>] (defaults to the caller; admin required for another user)
7706
- get-user-performance [--userId] (admin)
7707
- get-dashboard [--userId] [--role BD|CREATOR|INSIDE_SALES|ALL] [--deals ALL|SUCCESSFUL|LOST] [--timeFrame] [--startDate] [--endDate] (admin)
7708
- get-monthly-metrics [same optional flags as get-dashboard] (admin; dashboard.getMonthlyMetrics)
7709
- get-system-overview [same optional flags as get-dashboard] (admin; dashboard.getSystemOverview)
7710
- get-estimate-performance [same optional flags as get-dashboard] (admin; dashboard.getEstimatePerformance)
7711
- get-financial-overview [same optional flags as dashboard; role uses BudgetRole enum] (admin)
7712
-
7713
- Errors
7714
- get-recent-errors [--cursor] [--direction forward|backward] [--limit] [--severity] [--status] [--timeFrame] (admin)
7715
- count-errors [--severity] [--status] [--timeFrame] (admin)
7716
- get-error <errorId> Full diagnostics: stack, cause, request, metadata (admin)
7717
- get-error-metrics (admin)
7718
-
7719
- Automation (admin)
7720
- list-integration-operations [--search] [--destination <provider,...>] [--status <PENDING|PROCESSING|FAILED|COMPLETED,...>] [--limit 1-100] [--cursor <token>] [--direction forward|backward]
7721
- Newest first; returns { items, pageInfo }. Follow nextCursor/previousCursor with the same filters. --page/--perPage are rejected.
7722
- count-integration-operations [same filter flags] provider filter options only (no total; filters do not change the result)
7723
- get-integration-operation <operationId> (one job: who queued it, what it is for, saved progress, Retry state)
7724
- retry-integration-operation <operationId> [--confirmExternalStateReconciled true|false] [--outboundEmailResolution ACCEPTED|NOT_ACCEPTED_RETRY] [--providerMessageId <id>] (QuickBooks jobs with a saved attempt check QuickBooks first: applied changes finish without resending, unapplied ones are sent again)
7725
- reconcile-resource-operation <operationId> (admin: check a QuickBooks invoice/company/item job outcome without retrying; same check Retry runs first)
7726
-
7727
- Webhooks (admin)
7728
- list-webhook-event-types (event catalogue: type, group, live|planned)
7729
- list-webhook-endpoints
7730
- get-webhook-endpoint <endpointId>
7731
- create-webhook-endpoint --name <name> --url <https-url> --events <type|prefix.*|*,...> [--enabled true|false] (prints the signing secret once)
7732
- update-webhook-endpoint <endpointId> [--name] [--url] [--events <...>] [--enabled true|false]
7733
- delete-webhook-endpoint <endpointId>
7734
- rotate-webhook-secret <endpointId> [--previousSecretTtlHours <0-168>] (prints the new secret once)
7735
- send-webhook-test-event <endpointId>
7736
- list-webhook-deliveries [--endpointId] [--status <PENDING|SUCCEEDED|FAILED,...>] [--eventType] [--limit 1-100] [--cursor <token>] [--direction forward|backward] (newest first; prints items + pageInfo)
7737
- get-webhook-delivery <deliveryId> (attempts with response codes)
7738
- replay-webhook-delivery <deliveryId> (same eventId, new attempt chain)
7739
-
7740
- Historical / benchmarks
7741
- get-approved-budgets [--projectId] [--limit] [--minRevenue] [--maxRevenue]
7742
- get-budget-category-benchmarks <categoryId> [--limit]
7743
- get-item-pricing-history [--itemName] [--categoryId] [--supplierId] [--limit]
7744
- get-supplier-pricing-history <supplierId> [--itemCategoryId] [--limit]
7745
-
7746
- Output: JSON to stdout. Errors to stderr; exit 1 on failure.
7747
-
7748
- MCP parity: every MCP tool maps to one command above. The CLI also exposes
7749
- reorder-budget-items and update-budget-item-supplier (web UI\u2013oriented tRPC).
7750
- You may use MCP-style snake_case (e.g. bb list_bills) \u2014 normalized to kebab-case.
7751
-
7752
- Note: MCP also exposes a Prisma schema resource; the CLI has no equivalent.
7753
-
7754
- Not covered vs MCP get_budget: "get-budget" also fetches line items in one call.
7755
- `).trim();
7756
- runtime.stdout.write("".concat(help, `
7757
- `));
7559
+ const help = "\nbb \u2014 Budget Builder CLI for AI agents (parity with MCP tools)\n\nFirst 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.\n\nUsage: bb <command> [options] [args]\n\nIdentity: bb version \u2014 print the installed CLI package version and API target as JSON.\n\nGlobal: --quiet | -q | BB_CLI_QUIET=1 \u2014 hide action logs (default: log command + each tRPC call to stderr; stdout JSON unchanged).\n\nAuth: Run bb auth login for interactive use. BB_API_KEY remains supported for MCP, CI, and non-interactive automation.\n\nAuthorization: Run bb whoami before choosing commands. bb help lists the full\ncatalog for every role; it does not prove the active credential may call a command.\nThe API evaluates whoami.role (USER, INSIDE_SALES, LEAD, ACCOUNTING_TE\
7560
+ AM, or\nADMIN) together with resource ownership/project assignment, current state, and\npending-approver assignment. On FORBIDDEN, stop and report the identity, role,\ncommand, and target; do not switch keys or try a lower-level procedure.\n\nSensitive workflow changes: approval decisions/requests, entity status updates,\nestimate emails, customer invoices, integration retries and QuickBooks outcome\nverification, mark-budget-won,\nsubmit-quotation, and supplier approval request side effects require an\ninteractive CONFIRM prompt and abort in non-interactive shells.\nAI agents must inspect the entity first, summarize the exact entity, target\nstate, and side effects, then wait for explicit user confirmation before running\nthe sensitive command.\n\nBudget mutations return a conflict while an estimate email is queued,\nprocessing, or awaiting provider reconciliation.\n\nBudgets\n list-budgets [--projectId] [--name] [--status CSV] [--createdBy] [--dateFrom] [--dateTo] [--sortBy lastActivityA\
7561
+ t|createdAt|status|budget|date|createdBy] [--sortDir] [--limit 1-100] [--cursor <token>] [--direction forward|backward] [--summary]\n Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.\n count-budgets [same filter flags as list-budgets] totalCount plus status and active facets (each ignores its own filter)\n get-budget <id> Budget + line items\n get-budget-items <id> Line items only\n get-budget-details <id> Full detail (margins, suppliers, etc.)\n get-budget-categories [--q] [--limit 1-100] [--cursor <token>]\n Active categories, name A\u2013Z. Returns { items, pageInfo }; follow nextCursor with the same --q.\n get-budget-versions <budgetId> [--limit <1-50>] [--cursor <token> | --all]\n rename-budget-version <versionId> --name <text>\n restore-budget-version <versionId> Replace current budget data and return it to DRAFT.\n update-budget-status <id> <status> [--projectManage\
7562
+ rId <id>] [--markProjectWon true|false] [--projectStatusOnCommercialRejection PITCH|LOST]\n APPROVED requires a current Lead/Admin role, regardless of budget management permissions. Ordinary users must request approval.\n Material edits and generic status changes invalidate older pending budget requests; decide only a fresh request for the content reviewed.\n Budget-changing commands require interactive \"yes\" confirmation when the current budget is ESTIMATE_CREATED, ESTIMATE_SENT, ESTIMATE_ACCEPTED, ESTIMATE_REJECTED, or ESTIMATE_CLOSED.\n ESTIMATE_ACCEPTED requires win proof, auto-marks PITCH or LOST projects WON, requires --projectManagerId when the project has no PM, and auto-creates the Asana project/section when enabled.\n ESTIMATE_REJECTED requires --projectStatusOnCommercialRejection when rejecting the only accepted/closed budget on a commercial project.\n status: ".concat(budgetStatusesForHelp.join(", "), "\n mark-budget-won <budgetId> <filePath> [--projectMa\
7563
+ nagerId <id>] [--invoiceSettings <json>] Upload signed quote/PO proof and set status to ESTIMATE_ACCEPTED; invoice settings optionally save project delivery preferences\n create-budget --payload '<json>' (budget.createBudget; when sourceBudgetId contains unavailable items, set unavailableItemReviewAcknowledged=true after explicit review)\n update-budget --payload '<json>' (budget.updateBudget; must include id)\n delete-budget <budgetId>\n create-budget-approval <budgetId> (also queues approval request emails)\n create-estimate <budgetId> (queues QuickBooks estimate creation; budget is read-only until it settles; supports preflight updates)\n send-estimate-to-contact-person --payload '<json>' Send using the web contact-person workflow; payload includes recipient fields plus HTML content/signature.\n add-budget-items --budgetId --items '[{\"itemId\":\"\u2026\",\"quantity\":1,\"markup\":30},\u2026]'\n update-budget-item --id <budgetItemId> [--des\
7564
+ cription plain-text] [--note plain-text] [--quantity] [--markup] [--cost] [--unitPrice] [--isFreeOfCharge true|false] [--gstInclusive true|false] [--gstOutOfScope true|false]\n remove-budget-item <budgetItemId>\n replace-budget-item --budgetItemId <id> --replacementItemId <activeCatalogueItemId>\n approve-unavailable-item-exception --budgetItemId <id> --reason <text> Lead/Admin only; reason must be 5-1000 characters.\n reorder-budget-items <budgetId> --itemIds <csv>\n update-budget-item-supplier --budgetItemId --supplierId Material supplier/GST edit: supersedes pending approvals and applies the standard budget reset policy; unchanged supplier is a no-op.\n create-budget-category --name <text>\n update-budget-category --id --name\n delete-budget-category <id>\n update-budget-commission --payload '<json>' (budget.updateBudgetCommission)\n update-budget-discount --payload '<json>' (budget.updateBudgetDiscount; type percentage|amount)\n delete-budget-commis\
7565
+ sion <budgetId> Remove commission and return the budget to DRAFT.\n delete-budget-discount <budgetId> Remove discount and return the budget to DRAFT.\n mark-budget-items-not-utilized --ids <csv> Remove unused lines from reconciliation and queue clearing their QBO placeholders.\n restore-budget-item <budgetItemId> Restore one Not Utilized line and queue its QBO placeholder when required.\n create-placeholder-bill <budgetItemId> Admin-only placeholder recovery; queues the QBO placeholder (operationId, status QUEUED).\n upload-budget-attachment <budgetId> <filePath> Presigned S3 upload + confirm\n\nBills\n list-bills [--projectId] [--budgetId] [--status CSV] [--search <text>] [--isClaimable true|false] [--createdByIds <csv>] [--sortBy createdAt|amount|status] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Returns { items, pageInfo }; pass nextCursor with --direction forward or previousCursor with --directi\
7566
+ on backward, keeping the same filters and sort. --page/--pageSize/--perPage are rejected.\n list-claims same flags as list-bills; only reimbursable claims (ignores --isClaimable)\n count-bills [--projectId] [--budgetId] [--status CSV] [--search <text>] [--isClaimable true|false] [--createdByIds <csv>] [--includeMetrics true|false] totalCount, status facets (ignore --status) and optional amount metrics; no pagination/sort flags\n count-claims same flags as count-bills; only reimbursable claims\n Both lists return summaries; use get-bill-details <billId> for full detail.\n isClaimable differentiates the shared bill/claim records: false = bill, true = claim.\n Create supplier bills from approved quotations from the same supplier and project. Use quotationAllocations plus lineAmounts when quotations split one bill line. Eligible exemptions require explicit --quotation-exempt intent; claims do not consume or link quot\
7567
+ ations. Document-only quotations (documentOnly: true, $0) are never valid bill sources; create-bill, update-bill, validate-bill-selection and link-bill-quotations reject them, and a line covered only by one still counts as unquoted.\n Amounts for create/update (including drafts) exclude GST: amount = portion billed; extractedAmount = full invoice subtotal; lineAmounts[].amount and quotationAllocations[].amount also exclude GST. The CLI does not strip GST from input.\n Example: invoice subtotal 1800 + GST 162 = total 1962 -> amount: 1800, extractedAmount: 1800, allocations totaling 1800. BB calculates applicable GST separately. Re-read and verify both amount fields after writing.\n create-bill-approval <billId> (also queues approval request emails)\n create-bill --payload '<json>' [--draft-only] [--quotation-exempt] (bill.create; supplier bills use payload.quotationAllocations for split sources or quotationIds for disjoint coverage; explicit allocations require lin\
7568
+ eAmounts; claims reject quotation sources; an Admin's unpaid bill queues its QuickBooks bill: quickBooksSyncQueued, operationId)\n validate-bill-selection --payload '<json>' [--quotationIds <csv> | --quotationId <id>] Validate an approved supplier and approved quotation coverage for each supplier-bill line. --quotationId is legacy single-quotation syntax.\n link-bill-quotations <billId> (--payload '<json>' | --quotationIds <csv>) Admin-only source-link repair; payload.quotationAllocations supports same-line splits.\n stage-bill-attachment <projectId> <filePath...> [--file <path>] [--files <csv>] Upload files before create-bill; returns attachment JSON for attachments/paymentProofAttachments\n cleanup-staged-bill-attachments <projectId> --keys <csv> Queue cleanup of unattached staged uploads; returns operation IDs.\n update-bill --payload '<json>' (bill.update; must include id)\n update-bill-payment-evidence --payload '<json>' Replace paymentReference/pay\
7569
+ mentProofAttachments for an already-paid bill.\n delete-bill <billId>\n update-bill-status <id> <status> [--rejectionReason] [--paymentTrackingUrl] [--paymentReference] [--paymentProof <receipt.pdf>] [--overBudgetOverrideReason <text>]\n status (").concat(billStatusesForUpdateHelp.join(", "), ') \u2014 not PENDING_APPROVAL; use create-bill-approval\n PAID requires --paymentReference and a payment-proof PDF. Use --paymentProof to stage and submit the PDF atomically, or omit it only when BB already has a BILL_PAYMENT_PROOF attachment.\n Moving a bill or claim to PAID runs the server\'s paid-bill notification workflow.\n patch-bill-payment <billId> [--paymentTrackingUrl] [--paymentReference] [--quickbooksBillId] [--paymentDate <ISO>]\n Clear a field: --clearPaymentTrackingUrl true | --clearPaymentReference true | --clearQuickbooksBillId true | --clearPaymentDate true\n patch-bill-invoice-number <billId> <invoiceNumber>\n get-bill-attachments <billId> [--limit 1-50] [--cursor <token>]\
7570
+ \n Newest first. Returns { items, pageInfo }; follow nextCursor.\n upload-bill-attachment <billId> <filePath...> [--file <path>] [--files <csv>] Attach invoice/supporting files as BILL attachments to any bill status, including PAID bills\n attach-bill-payment-receipt <billId> <filePath...> [--file <path>] [--files <csv>] Attach Wise/payment-proof PDFs as BILL_PAYMENT_PROOF attachments\n attach-bill-documents <billId> [--invoice <path>] [--invoices <csv>] [--paymentProof|--payment-proof|--proof <path>] [--paymentProofs|--payment-proofs|--proofs <csv>] Attach invoice and/or payment proof files with separate BB attachment types\n get-bill-details <billId> Bill summary as shown in the web app (status, amounts, people, payment, line totals)\n get-bill-line-items <billId> [--limit 1-100] [--cursor <token>] Line items with budget-item/quotation detail; { items, pageInfo }\n get-bill-approvals <billId> [--limit 1-50] [--cursor <token>] Approval requests with approver/requester/re\
7571
+ sponder; { items, pageInfo }\n get-bill-payment <billId> Payment status, reference, date, tracking URL, QuickBooks link and external payment\n\nQuotations\n list-quotations [--projectId] [--budgetId] [--supplierId] [--status CSV] [--createdBy CSV] [--search] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Newest first; returns { items, pageInfo }; rows carry documentOnly (document-only $0 quotations are listed and counted like any other). Follow nextCursor/previousCursor with the same filters. --page/--pageSize/--perPage are rejected; --requesterIds remains an alias for --createdBy.\n count-quotations [--projectId] [--budgetId] [--supplierId] [--status CSV] [--createdBy CSV] [--search] [--includeMetrics true|false] totalCount, status facets (ignore --status) and optional amount metrics\n get-quotation <quotationId> Quotation as shown in the web app (status, documentOnly, amounts, people, line totals, files, approvals; pdfProcessing is PROC\
7572
+ ESSING or FAILED until queued PDF conversion/signing links the PDF; gstMismatch warns when GST differs from the expected GST)\n get-quotation-line-items <quotationId> [--limit 1-100] [--cursor <token>] Line items with budget-item detail; { items, pageInfo }\n upload-quotation-attachment <projectId> <filePath> Upload one PDF, JPEG, or PNG up to 20MB; returns attachment JSON for a quotation payload.\n cleanup-staged-quotation-attachments <projectId> --keys <csv> Queue cleanup of unattached quotation uploads; returns operation IDs.\n create-quotation --payload \'<json>\' (quotation.createDraft; requires amountWithoutGst, gstAmount, and lineAmounts [{budgetItemId, amount}] for multiple budgetItemIds; amounts before GST must sum to amountWithoutGst; result gstMismatch warns when gstAmount is not 0 or the expected GST)\n Document-only ($0 supplier document, e.g. a contract or proposal with no price): set documentOnly: true with amountWithoutGst: 0, gstAmount: 0 and zero line\
7573
+ Amounts (lineAmounts may be omitted). It goes through submit/sign/approve like any quotation and shows documentOnly: true in list/get output, but it is never a valid bill quotation source (create-bill, update-bill, validate-bill-selection and link-bill-quotations are rejected by the API) and does not count as quotation coverage: a budget line covered only by it still counts as unquoted. Without documentOnly (default false), amountWithoutGst must be positive.\n Example: --payload \'{"projectId":"<id>","budgetId":"<id>","supplierId":"<id>","budgetItemIds":["<id>"],"amountWithoutGst":0,"gstAmount":0,"documentOnly":true,"attachments":[<uploaded attachment>]}\'\n update-quotation --payload \'<json>\' Update a DRAFT or REJECTED quotation; same allocation payload plus id; use lineAmounts [{budgetItemId, amount}] for every selected item. Result gstMismatch warns when gstAmount is not 0 or the expected GST. Update is a full replace: send documentOnly: true again when updating a documen\
7574
+ t-only quotation, or it is treated as a priced quotation and needs a positive amountWithoutGst.\n delete-quotation <quotationId>\n submit-quotation <quotationId> [--overBudgetOverrideReason <text>] (signed PDF is made by a queued job: pdfProcessing; gstMismatch warns when GST is not 0 or the expected GST)\n approve-quotation <quotationId> [--overBudgetOverrideReason <text>] (assigned pending request/current Admin; concurrent revision or allocation changes conflict; final signed PDF is queued: pdfProcessing)\n reject-quotation <quotationId> --reason <text>\n download-quotation-pdf <quotationId> [original|staff|final] (refused with "still processing" until the queued PDF step links it)\n\nCustomer invoices\n check-customer-invoice-readiness <budgetId> Readiness plus the full remaining-balance amount preview and live QuickBooks validation.\n list-eligible-customer-invoice-budgets <projectId> Accepted budgets that are ready and still have invoice coverage remaining, including \
7575
+ estimate total, invoiced/remaining percentages, and available amount.\n preview-customer-invoice-amount <budgetId> <percentage-of-estimate> Preview amount before GST, GST, and total for a percentage of the original estimate. The percentage cannot exceed the budget\'s remaining coverage.\n list-available-qbo-customer-invoices <budgetId> List unlinked QuickBooks invoices available for this accepted or closed estimate before previewing and importing one.\n list-customer-invoices [budgetId] [--projectId <id>] [--companyIds CSV] [--projectIds CSV] [--budgetIds CSV] [--createdByIds CSV] [--status CSV] [--search] [--sortBy createdAt|status|totalInvoiceAmount|approvalExpiresAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.\n No scope flag lists invoices globally. --projectId uses the project scope. A positional budgetI\
7576
+ d is a backward-compatible shortcut for --budgetIds.\n count-customer-invoices [budgetId] [same filter flags as list-customer-invoices] totalCount, lifecycle status facets (ignore --status) and amount metrics; no paging or sort flags\n get-customer-invoice <batchId> Batch as shown in the web app: status, totals, people, approvals and invoice summaries\n get-customer-invoice-invoices <batchId> Invoices with QuickBooks identity, dates, sync state, bill email (from QuickBooks) and held QuickBooks changes (qboDetailsDrift)\n get-customer-invoice-lines <invoiceId> [--limit 1-100] [--cursor <token>] One invoice\'s lines; { items, pageInfo }\n get-customer-invoice-approvals <batchId> [--limit 1-50] [--cursor <token>] Approval requests with approver/requester/responder; { items, pageInfo }\n get-customer-invoice-history <batchId> [--limit 1-100] [--cursor <token>] Status history; { items, pageInfo }\n get-customer-invoice-payments <invoiceId> P\
7577
+ ayments QuickBooks applied to one invoice (date, reference, amount applied, attachment names). Live QuickBooks read.\n get-customer-invoice-email-context <batchId> Contact, required CC, budget, and project context for composing an invoice email.\n preview-qbo-customer-invoice <budgetId> <qboInvoiceId> Preview an invoice selected from list-available-qbo-customer-invoices; works on accepted/closed estimates.\n import-qbo-customer-invoice <budgetId> <qboInvoiceId> --token <previewToken> Confirm the reviewed BB-only link; requires --allow-state-change --allow-financial-write in automation.\n create-customer-invoice --payload \'<json>\' Create one invoice from an eligible budget. Include budgetId, a recommended UUID requestId, invoiceDate, details {billingAddress, customerMemo}, and exactly one split {label, percentage, dueDate}. Percentage is of the original estimate and cannot exceed the remaining coverage. Never sends.\n discard-customer-invoice <batchId> Discard a r\
7578
+ eserved CREATING batch with no created QBO invoices.\n delete-customer-invoice <batchId> Delete QBO invoices and the local batch.\n void-customer-invoice <batchId> Void the invoice batch in QuickBooks.\n resubmit-customer-invoice <batchId> Original requester only. Queues one replacement after confirmed expiry voiding; retries return the same replacement. Never sends to the customer.\n approve-customer-invoice <batchId> Admin approval; rejects voided invoices, notifies the creator, and closes the estimate at cumulative 100% coverage.\n reject-customer-invoice <batchId> --reason <text> Admin rejection; voids QBO invoices and notifies the creator.\n send-customer-invoice-to-contact-person --payload \'<json>\' Queues same composer workflow as web; requires invoiceId, to, cc, replyTo, subject, HTML content, and HTML signature.\n download-customer-invoice-pdf <invoiceId> [--output <path>]\n mark-customer-invoice-sent-externally <invoiceId> --sentA\
7579
+ t <ISO datetime> --recipients a@x.com,b@y.com [--note <text>] Admin only. Record an APPROVED invoice as SENT because it was emailed outside Budget Builder; sends no email.\n sync-customer-invoice <invoiceId> Refresh local status and balance from QuickBooks; paid invoices become PAID, reversals restore delivery/approval, and QBO voids can reopen an estimate. QuickBooks edits to bill-to address, memo, bill email or total are not applied: they are flagged as qboDetailsDrift and admins are emailed.\n update-customer-invoice-details <invoiceId> --billingAddress <text> --customerMemo <text> [--requestId <uuid>]\n Save bill-to address and memo in BB and queue the QuickBooks update (external write). Bill email is managed in QuickBooks.\n update-customer-invoice-qbo-drift <invoiceId> --resolution ACCEPT_QBO|KEEP_BB [--requestId <uuid>]\n Admin: resolve flagged QuickBooks changes. ACCEPT_QBO\
7580
+ copies them into BB only; KEEP_BB queues BB\'s address and memo to QuickBooks.\n\nApprovals\n list-approvals | get-pending-approvals [--type budget|supplier|bill|quotation|customer_invoice|all]\n approve-bill <billId> [--overBudgetOverrideReason <text>] (also sends requester reply email)\n reject-bill <billId> --reason <text> (also sends requester reply email)\n approve-budget <budgetId> (also sends requester reply email)\n reject-budget <budgetId> --reason <text> (also sends requester reply email)\n approve-supplier <supplierId> (approve a pending request, or Admin/Lead re-approve a rejected supplier; QuickBooks vendor sync is queued)\n reject-supplier <supplierId> --reason <text> (also sends requester reply email)\n\nCompanies & projects\n list-companies [--name] [--createdBy] [--createdByIds CSV] [--active true|false] [--sortBy name|createdAt] [--sortDir asc|desc] [--limit 1-100] [--cursor] [--direction forward|backward]\n Returns { items, pageInfo }; p\
7581
+ ass nextCursor with direction forward or previousCursor with direction backward. Omit --cursor to restart.\n count-companies [--name] [--createdBy] [--createdByIds CSV] [--active true|false]\n Returns independent { totalCount, counts: { active: { true, false } } }; no pagination or sorting flags.\n get-company <id>\n search-existing-companies --query <name> [--limit 1-50] [--cursor <token>] (BB + QuickBooks, read-only; follow pageInfo.nextCursor)\n use-existing-company --companyId <bbId> and/or --quickbooksId <qboId> [--name <qboName>] [--website <url>] [--confirmDistinct true]\n Supply both IDs to explicitly connect existing records with different names.\n Reuses both records, creating only the missing counterpart. A QBO-only import needs --name (from search-existing-companies);\n website is needed only for a QBO import without one. The QuickBooks link is queued (quickBooksSyncQueued, operationId).\n create-company --name --website <url> [--confirm\
7582
+ Distinct true] [--billingEmails \'<json-array>\'] (QuickBooks customer queued)\n Exact existing companies are reused. Similar names require explicit separate-entity confirmation.\n update-company --payload \'<json>\' (optional billingEmails: omit to preserve, [] to clear; returns queued QBO operation ID, not completion)\n get-company-quickbooks-sync-status <companyId> (saved status only; no provider call or polling)\n delete-company <id>\n list-projects [--companyId] [--name] [--status|--statuses CSV] [--active true|false] [--wonFrom ISO] [--wonTo ISO] [--wonWithinDays N] [--limit 1-100] [--cursor] [--direction forward|backward] [--sortBy name|createdAt|status|companyName|wonAt] [--sortDir asc|desc]\n Returns { items, pageInfo }; pass nextCursor with direction forward or previousCursor with direction backward. Legacy --page/--perPage are rejected.\n --sortBy wonAt orders by when the project was marked WON (unwon projects last). Each project includes wonAt,\
7583
+ wonBy { id, name } and wonAtEstimated (true for backfilled dates).\n count-projects [--companyId] [--name] [--status|--statuses CSV] [--active true|false] [--wonFrom ISO] [--wonTo ISO] [--wonWithinDays N]\n Returns independent { totalCount, counts: { status, active: { true, false } } }; no pagination or sorting flags.\n list-project-hubs [--q] [--status CSV] [--sortBy startDate|name|companyName|status] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.\n count-project-hubs [--q] [--status CSV] totalCount plus status facet\n List active projects that have a Project Hub integration.\n get-project <id>\n Budget overview totalRevenue includes Estimate Accepted and Estimate Closed budgets only.\n create-project --name --companyId --contactPersonId --insideSalesId --businessDevelo\
7584
+ pmentId --venue --startDate <ISO> [--projectManagerId <userId>] [--asanaTaskId] [--asanaSearch <text>] [--pax] [--endDate <ISO>] [--description]\n update-project --payload \'<json>\' (project.updateProject; warns before estimate-affecting changes reject linked estimates; a companyId change (with a contactPersonId from that company) does not itself reject estimates or touch invoices, but date/pax/venue changes in the same save still do; optional projectManagerId and requestQboAccountantNotification)\n delete-project <id>\n check-project-reconciliation <id> Run the same live reconciliation review as the web app without changing status.\n reconcile-project <id> Rerun all checks transactionally and mark an eligible WON project RECONCILED.\n complete-project <id> Rerun reconciliation validation, mark a RECONCILED project COMPLETED, and queue QBO placeholder cleanup.\n import-qbo-project <projectId> --url <quickBooksProjectUrl>\n update-project-status \
7585
+ <id> <status> [--projectManagerId <userId>] [--projectManagerEmail <email>]\n PITCH \u2192 WON requires an accepted/closed estimate. To win a pitch, accept its estimate with mark-budget-won <budgetId> <signed-quote.pdf>, which moves the project to WON.\n Required when moving PITCH \u2192 WON: supply --projectManagerId or --projectManagerEmail.\n The project manager must be an active @getout.sg user; list eligible users with list-users --projectTeamOnly true.\n status: ').concat(projectStatusesForHelp.join(", "), "\n\nContacts\n list-contacts <companyId>\n create-contact-person --payload '<json>' (contactPerson.createContactPerson; title MR|MRS|MS|DR)\n update-contact-person --payload '<json>' (contactPerson.updateContactPerson; must include id)\n\nSuppliers & items\n list-suppliers [--name] [--limit 1-100] [--cursor <token>] [--direction forward|backward] [--sortBy createdAt|updatedAt|name|email|phone|gstRegistered|status|active] [--sortDir asc|desc | --\
7586
+ sort JSON] [--createdBy <csv>] [--gstRegistered true|false] [--status CSV] [--supplierTags <csv>] [--active true|false]\n count-suppliers [--name] [--createdBy <csv>] [--gstRegistered true|false] [--status CSV] [--supplierTags <csv>] [--active true|false] (independent totals/facets; no pagination/sort flags)\n Defaults: --active true, --limit 10, --sortBy createdAt, --sortDir desc (same as the web list); pass --active false for archived suppliers.\n create-supplier --payload '<json>' (supplier.createSupplier; archived-name recreation is Admin-only; auto-requests approval + emails when status is PENDING_APPROVAL; Lead/Admin creates queue the QuickBooks vendor: quickBooksSyncQueued, operationId)\n update-supplier --payload '<json>' (authenticated; normal-user edits require server-enforced approval; Lead/Admin edits of a linked supplier queue the QuickBooks sync)\n delete-suppliers --ids <csv> (supplier.deleteSuppliers; admin; archives/deact\
7587
+ ivates supplier items)\n reactivate-suppliers --ids <csv> (supplier.reactivateSuppliers; admin; queues QuickBooks vendor reactivation, then the suppliers and their items become active: queuedSuppliers, operations)\n create-certification --name (supplier.createCertification)\n create-payment-method --name (supplier.createPaymentMethod)\n create-supplier-role --name (supplier.createSupplierRole)\n create-supplier-tag --name (supplier.createSupplierTag)\n create-item --payload '<json>' (item.createItem; saves the item and queues its QuickBooks create: quickBooksSyncQueued, operationId)\n update-item --payload '<json>' (item.updateItem; must include id)\n archive-items --ids <csv> (item.archiveItems; Budget Builder only; max 100; users can archive their own items, leads/admins any item; open estimates retain snapshot lines and require resolution before send/acceptance)\n delete-item <id> (item.delete\
7588
+ Item; admin; archives in Budget Builder and makes the item inactive in QuickBooks; blocked while used by an open estimate)\n get-supplier-details <supplierId>\n get-supplier-overview <supplierId> (supplier.getSupplierOverview; profile, approvals, attachments and tab counts; no usage or items)\n get-supplier-usage <supplierId> (supplier.getSupplierUsage; usage rows and spending)\n get-supplier-items <supplierId> (supplier.getSupplierItems; inventory items)\n get-supplier-analytics [--name] [--status CSV] [--gstRegistered true|false] [--createdBy <text>] [--timeFrame ALL|LAST_YEAR|LAST_6_MONTHS|LAST_3_MONTHS|CUSTOM] [--startDate <ISO> --endDate <ISO>] [--sortBy name|gstRegistered|status|phone|email|updatedAt|createdAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Admin. Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.\n count-supplier-analytics [--na\
7589
+ me] [--status] [--gstRegistered] [--createdBy] [--timeFrame] [--startDate --endDate] Admin. totalCount for the same filters\n list-items [--name] [--includeQuickBooksDeactivationPending true] [--sortBy createdAt|updatedAt|name|cost|itemCategory|supplier] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.\n count-items [same filter flags as list-items] total plus category and supplier facets\n get-item <id>\n get-item-quickbooks-sync-status <itemId> (saved status only; no provider call or polling)\n list-item-categories [--name] [--sortBy createdAt|name|itemCount|createdBy] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Active categories only; returns { items, pageInfo }. Follow nextCursor/previousCursor with the same filters and sort. --pa\
7590
+ ge/--perPage are rejected.\n count-item-categories [--name] totalCount of active categories\n create-item-category --name (admin; saves the category and queues its QuickBooks create: quickBooksSyncQueued, operationId)\n update-item-category --id --name (authenticated; renames in BB now and queues the QuickBooks rename: quickBooksSyncQueued, operationId)\n delete-item-categories --ids <csv> (itemCategory.deleteItemCategories; admin; empty categories only)\n\nDashboard & users\n whoami Show the user identity and role for the active API key.\n list-users [--q] [--projectTeamOnly true|false] [--limit 1-100] [--cursor <token>]\n Name A\u2013Z. Returns { items, pageInfo }; follow nextCursor with the same --q and --projectTeamOnly. --page/--perPage are rejected.\n --projectTeamOnly true lists only active @getout.sg users, the only accounts accepted as Inside Sales, Business Development or Project Manager.\n count-users [\
7591
+ --q] [--projectTeamOnly true|false] totalCount for the same search\n create-user --email <email> [--name <name>] [--role ").concat(userRolesForHelp.join("|"), '] (admin; API-only service identity with no Google sign-in)\n create-api-key --name <label> [--userId <userId>] (defaults to the caller; admin required for another user; raw key is shown once)\n list-api-keys [--userId <userId>] [--limit 1-100] [--cursor <token>] (newest first, { items, pageInfo }; defaults to the caller; admin required for another user)\n revoke-api-key <apiKeyId> [--userId <userId>] (defaults to the caller; admin required for another user)\n get-user-performance [--userId] (admin)\n get-dashboard [--userId] [--role BD|CREATOR|INSIDE_SALES|ALL] [--deals ALL|SUCCESSFUL|LOST] [--timeFrame] [--startDate] [--endDate] (admin)\n get-monthly-metrics [same optional flags as get-dashboard] (admin; dashboard.getMonthlyMetrics)\n get-system-overv\
7592
+ iew [same optional flags as get-dashboard] (admin; dashboard.getSystemOverview)\n get-estimate-performance [same optional flags as get-dashboard] (admin; dashboard.getEstimatePerformance)\n get-financial-overview [same optional flags as dashboard; role uses BudgetRole enum] (admin)\n\nErrors\n get-recent-errors [--cursor] [--direction forward|backward] [--limit] [--severity] [--status] [--timeFrame] (admin)\n count-errors [--severity] [--status] [--timeFrame] (admin)\n get-error <errorId> Full diagnostics: stack, cause, request, metadata (admin)\n get-error-metrics (admin)\n\nAutomation (admin)\n list-integration-operations [--search] [--destination <provider,...>] [--status <PENDING|PROCESSING|FAILED|COMPLETED,...>] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Newest first; returns { items, pageInfo }. Follow nextCursor/previousCursor with the same filters. --page/--perPage are rejected.\n count-integration-\
7593
+ operations [same filter flags] provider filter options only (no total; filters do not change the result)\n get-integration-operation <operationId> (one job: who queued it, what it is for, saved progress, Retry state)\n retry-integration-operation <operationId> [--confirmExternalStateReconciled true|false] [--outboundEmailResolution ACCEPTED|NOT_ACCEPTED_RETRY] [--providerMessageId <id>] (QuickBooks jobs with a saved attempt check QuickBooks first: applied changes finish without resending, unapplied ones are sent again)\n reconcile-resource-operation <operationId> (admin: check a QuickBooks invoice/company/item job outcome without retrying; same check Retry runs first)\n\nWebhooks (admin)\n list-webhook-event-types (event catalogue: type, group, live|planned)\n list-webhook-endpoints\n get-webhook-endpoint <endpointId>\n create-webhook-endpoint --name <name> --url <https-url> --events <type|prefix.*|*,...> [--enabled true|false] (prints the signing secret once)\n update-webhook-en\
7594
+ dpoint <endpointId> [--name] [--url] [--events <...>] [--enabled true|false]\n delete-webhook-endpoint <endpointId>\n rotate-webhook-secret <endpointId> [--previousSecretTtlHours <0-168>] (prints the new secret once)\n send-webhook-test-event <endpointId>\n list-webhook-deliveries [--endpointId] [--status <PENDING|SUCCEEDED|FAILED,...>] [--eventType] [--limit 1-100] [--cursor <token>] [--direction forward|backward] (newest first; prints items + pageInfo)\n get-webhook-delivery <deliveryId> (attempts with response codes)\n replay-webhook-delivery <deliveryId> (same eventId, new attempt chain)\n\nHistorical / benchmarks\n get-approved-budgets [--projectId] [--limit] [--minRevenue] [--maxRevenue]\n get-budget-category-benchmarks <categoryId> [--limit]\n get-item-pricing-history [--itemName] [--categoryId] [--supplierId] [--limit]\n get-supplier-pricing-history <supplierId> [--itemCategoryId] [--limit]\n\nOutput: JSON to stdout. Errors to stderr; exit 1 on failure.\n\nMCP parity: eve\
7595
+ ry MCP tool maps to one command above. The CLI also exposes\n reorder-budget-items and update-budget-item-supplier (web UI\u2013oriented tRPC).\n You may use MCP-style snake_case (e.g. bb list_bills) \u2014 normalized to kebab-case.\n\nNote: MCP also exposes a Prisma schema resource; the CLI has no equivalent.\n\nNot covered vs MCP get_budget: "get-budget" also fetches line items in one call.\n').trim();
7596
+ runtime.stdout.write("".concat(help, "\n"));
7758
7597
  }
7759
7598
  __name(printLegacyHelp, "printLegacyHelp"), __name2(printLegacyHelp, "printLegacyHelp");
7760
7599
  var getCliPackageMetadata = __name2(() => {
@@ -7770,9 +7609,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
7770
7609
  for (let index = 0; index < argv.length; index++) {
7771
7610
  const value = argv[index];
7772
7611
  if (value === "".concat(flag, "=true") || value === "".concat(flag, "=1")) return !0;
7773
- if (value?.startsWith(
7774
- "".concat(flag, "=")
7775
- )) return !1;
7612
+ if (value?.startsWith("".concat(flag, "="))) return !1;
7776
7613
  if (value !== flag) continue;
7777
7614
  const next = argv[index + 1];
7778
7615
  return next !== void 0 && booleanFlagValues.has(next) ? next === "true" || next === "1" : !0;
@@ -7793,10 +7630,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
7793
7630
  continue;
7794
7631
  }
7795
7632
  if (value === "--api-url") {
7796
- apiBaseUrl = readApiUrlArgumentValue(
7797
- argv,
7798
- index
7799
- ), index++;
7633
+ apiBaseUrl = readApiUrlArgumentValue(argv, index), index++;
7800
7634
  continue;
7801
7635
  }
7802
7636
  if (isRuntimeOnlyArgument(value)) {
@@ -7815,13 +7649,13 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
7815
7649
  const positionalTarget = resolvedCommand.argv.find((value) => value !== "--" && !value.startsWith("-"));
7816
7650
  return positionalTarget !== void 0 && !positionalTarget.startsWith("{") && !positionalTarget.startsWith("[") ? positionalTarget : resolvedCommand.command.path.join(" ");
7817
7651
  }, "commandConfirmationTarget"), PAGING_FLAG_KEYS = ["limit", "cursor", "direction", "sortBy", "sortDir"], rejectCountPagingFlags = __name2((flags, commandName) => {
7818
- for (const key of PAGING_FLAG_KEYS) if (flags[key] !== void 0) throw new Error("".concat(commandName, " does not accept --").concat(key, "; totals use filters only."));
7819
- }, "rejectCountPagingFlags"), rejectBarePagingFlags = __name2(
7820
- (flags) => {
7821
- for (const key of PAGING_FLAG_KEYS) rejectBareFlag(flags, key);
7822
- },
7823
- "rejectBarePagingFlags"
7824
- ), parseCursorAndDirection = __name2((flags) => {
7652
+ for (const key of PAGING_FLAG_KEYS) if (flags[key] !== void 0) throw new Error("".concat(
7653
+ commandName,
7654
+ " does not accept --"
7655
+ ).concat(key, "; totals use filters only."));
7656
+ }, "rejectCountPagingFlags"), rejectBarePagingFlags = __name2((flags) => {
7657
+ for (const key of PAGING_FLAG_KEYS) rejectBareFlag(flags, key);
7658
+ }, "rejectBarePagingFlags"), parseCursorAndDirection = __name2((flags) => {
7825
7659
  const cursor = getFlag(flags, "cursor");
7826
7660
  if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
7827
7661
  const direction = parseProjectDirection(getFlag(flags, "direction"));
@@ -7834,10 +7668,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
7834
7668
  }, "parseAscDescSortDir"), commandWhoami = __name2(async () => {
7835
7669
  await whoAmI();
7836
7670
  }, "commandWhoami"), commandListBudgets = __name2(async ({ cmd, flags }) => {
7837
- const statusStr = getFlag(flags, "status"), statuses = parseCommaSeparatedBudgetStatuses(statusStr !== void 0 ? String(statusStr) : void 0), filters = { projectId: getFlag(
7671
+ const statusStr = getFlag(
7838
7672
  flags,
7839
- "projectId"
7840
- ), name: getFlag(flags, "name"), statuses, createdBy: getFlag(flags, "createdBy"), dateFrom: getFlag(flags, "dateFrom"), dateTo: getFlag(flags, "dateTo"), active: parseBudgetActiveFlag(flags) };
7673
+ "status"
7674
+ ), statuses = parseCommaSeparatedBudgetStatuses(statusStr !== void 0 ? String(statusStr) : void 0), filters = { projectId: getFlag(flags, "projectId"), name: getFlag(flags, "name"), statuses, createdBy: getFlag(flags, "createdBy"), dateFrom: getFlag(flags, "dateFrom"), dateTo: getFlag(flags, "dateTo"), active: parseBudgetActiveFlag(flags) };
7841
7675
  if (rejectRetiredPageFlags(flags), cmd === "count-budgets") {
7842
7676
  for (const key of ["limit", "cursor", "direction", "sortBy", "sortDir"]) if (flags[key] !== void 0) throw new Error("count-budgets does not accept --".concat(key, "; totals use filters only."));
7843
7677
  await countBudgets(filters);
@@ -7848,10 +7682,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
7848
7682
  if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
7849
7683
  const direction = parseProjectDirection(getFlag(flags, "direction"));
7850
7684
  if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
7851
- await listBudgets({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: getFlag(
7852
- flags,
7853
- "sortBy"
7854
- ), sortDir: getFlag(flags, "sortDir"), includeDetails: flags.summary === !0 ? !1 : parseOptionalBoolFlag(flags, "includeDetails") ?? !0 });
7685
+ await listBudgets({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: getFlag(flags, "sortBy"), sortDir: getFlag(flags, "sortDir"), includeDetails: flags.summary === !0 ? !1 : parseOptionalBoolFlag(flags, "includeDetails") ?? !0 });
7855
7686
  }, "commandListBudgets"), commandGetBudget = __name2(async ({ flags, positional }) => {
7856
7687
  const id = positional[0];
7857
7688
  if (!id) throw new Error("get-budget requires <id>");
@@ -7874,10 +7705,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
7874
7705
  await getBudgetDetails(id, { includeInactive: flags.includeInactive === !0 ? !0 : parseOptionalBoolFlag(flags, "includeInactive") ?? !1 });
7875
7706
  }, "commandGetBudgetDetails"), commandGetBudgetCategories = __name2(async ({ flags }) => {
7876
7707
  rejectRetiredPageFlags(flags);
7877
- for (const key of ["limit", "cursor"]) rejectBareFlag(
7878
- flags,
7879
- key
7880
- );
7708
+ for (const key of ["limit", "cursor"]) rejectBareFlag(flags, key);
7881
7709
  if (flags.direction !== void 0) throw new Error("get-budget-categories pages forward only; follow pageInfo.nextCursor with --cursor.");
7882
7710
  const cursor = getFlag(flags, "cursor");
7883
7711
  if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
@@ -7887,7 +7715,8 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
7887
7715
  if (!id) throw new Error("get-budget-versions requires <budgetId>");
7888
7716
  const limit = flags.limit === void 0 ? void 0 : Number(flags.limit);
7889
7717
  if (flags.limit === !0 || limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > 50)) throw new CliRuntimeError("USAGE", "--limit must be an integer from 1 to 50.");
7890
- if (flags.cursor === !0 || flags.cursor === "") throw new CliRuntimeError("USAGE", "--cursor requires the nextCursor token from the previous page.");
7718
+ if (flags.cursor === !0 || flags.cursor === "")
7719
+ throw new CliRuntimeError("USAGE", "--cursor requires the nextCursor token from the previous page.");
7891
7720
  await getBudgetVersions(id, { limit, cursor: flags.cursor, all: flags.all === !0 || (parseOptionalBoolFlag(flags, "all") ?? !1) });
7892
7721
  }, "commandGetBudgetVersions"), commandRenameBudgetVersion = __name2(async ({ flags, positional }) => {
7893
7722
  const versionId = positional[0], newName = getFlag(flags, "name");
@@ -7900,19 +7729,15 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
7900
7729
  }, "commandRestoreBudgetVersion"), commandUpdateBudgetStatus = __name2(async ({ flags, positional }) => {
7901
7730
  const [id, status] = positional;
7902
7731
  if (!id || !status) throw new Error("update-budget-status requires <id> <status>");
7903
- if (!isBudgetStatusUpdate(status)) throw new Error("Invalid status. Use one of: ".concat(budgetStatusesForHelp.join(", ")));
7904
- await updateBudgetStatus(id, status, { projectManagerId: getFlag(
7905
- flags,
7906
- "projectManagerId"
7907
- ) !== void 0 ? String(getFlag(flags, "projectManagerId")) : void 0, markProjectWon: parseOptionalBoolFlag(flags, "markProjectWon"), projectStatusOnCommercialRejection: parseCommercialRejectionProjectStatus(flags), projectInvoiceSettings: getFlag(flags, "invoiceSettings") !== void 0 ? parseJsonFlag(String(getFlag(flags, "invoiceSettings")), "--invoiceSettings") : void 0 });
7732
+ if (!isBudgetStatusUpdate(status)) throw new Error(
7733
+ "Invalid status. Use one of: ".concat(budgetStatusesForHelp.join(", "))
7734
+ );
7735
+ await updateBudgetStatus(id, status, { projectManagerId: getFlag(flags, "projectManagerId") !== void 0 ? String(getFlag(flags, "projectManagerId")) : void 0, markProjectWon: parseOptionalBoolFlag(flags, "markProjectWon"), projectStatusOnCommercialRejection: parseCommercialRejectionProjectStatus(flags), projectInvoiceSettings: getFlag(flags, "invoiceSettings") !== void 0 ? parseJsonFlag(String(getFlag(flags, "invoiceSettings")), "--invoiceSettings") : void 0 });
7908
7736
  }, "commandUpdateBudgetStatus"), commandCreateBudgetApproval = __name2(async ({ flags, positional }) => {
7909
7737
  const id = positional[0];
7910
7738
  if (!id) throw new Error("create-budget-approval requires <budgetId>");
7911
7739
  const companyPayloadRaw = getFlag(flags, "companyPayload"), contactPayloadRaw = getFlag(flags, "contactPayload"), eventPayloadRaw = getFlag(flags, "eventPayload");
7912
- await createBudgetApproval(id, { company: companyPayloadRaw !== void 0 ? parseJsonObjectFlag(String(companyPayloadRaw), "--companyPayload") : void 0, contactPerson: contactPayloadRaw !== void 0 ? parseJsonObjectFlag(String(contactPayloadRaw), "--contactPayload") : void 0, eventDetails: eventPayloadRaw !== void 0 ? parseJsonObjectFlag(
7913
- String(eventPayloadRaw),
7914
- "--eventPayload"
7915
- ) : void 0 });
7740
+ await createBudgetApproval(id, { company: companyPayloadRaw !== void 0 ? parseJsonObjectFlag(String(companyPayloadRaw), "--companyPayload") : void 0, contactPerson: contactPayloadRaw !== void 0 ? parseJsonObjectFlag(String(contactPayloadRaw), "--contactPayload") : void 0, eventDetails: eventPayloadRaw !== void 0 ? parseJsonObjectFlag(String(eventPayloadRaw), "--eventPayload") : void 0 });
7916
7741
  }, "commandCreateBudgetApproval"), commandCreateEstimate = __name2(async ({ flags, positional }) => {
7917
7742
  const id = positional[0];
7918
7743
  if (!id) throw new Error("create-estimate requires <budgetId>");
@@ -7920,7 +7745,8 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
7920
7745
  await createEstimate(id, { company: companyPayloadRaw !== void 0 ? parseJsonObjectFlag(String(companyPayloadRaw), "--companyPayload") : void 0, contactPerson: contactPayloadRaw !== void 0 ? parseJsonObjectFlag(String(contactPayloadRaw), "--contactPayload") : void 0, eventDetails: eventPayloadRaw !== void 0 ? parseJsonObjectFlag(String(eventPayloadRaw), "--eventPayload") : void 0 });
7921
7746
  }, "commandCreateEstimate"), commandSendEstimateEmail = __name2(async ({ flags }) => {
7922
7747
  const payloadRaw = getFlag(flags, "payload");
7923
- if (!payloadRaw) throw new Error("send-estimate-to-contact-person requires --payload '<json>'");
7748
+ if (!payloadRaw)
7749
+ throw new Error("send-estimate-to-contact-person requires --payload '<json>'");
7924
7750
  const raw = parseJsonFlag(String(payloadRaw), "--payload");
7925
7751
  await sendEstimateToContactPersonFromPayload(raw);
7926
7752
  }, "commandSendEstimateEmail"), commandCreateBudget = __name2(async ({ flags }) => {
@@ -7938,24 +7764,22 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
7938
7764
  if (!id) throw new Error("delete-budget requires <budgetId>");
7939
7765
  await deleteBudgetById(id);
7940
7766
  }, "commandDeleteBudget"), commandAddBudgetItems = __name2(async ({ flags }) => {
7941
- const budgetId = getFlag(flags, "budgetId");
7767
+ const budgetId = getFlag(
7768
+ flags,
7769
+ "budgetId"
7770
+ );
7942
7771
  if (!budgetId) throw new Error("add-budget-items requires --budgetId");
7943
- const items = parseJsonFlag(String(
7944
- getFlag(flags, "items")
7945
- ), "--items");
7772
+ const items = parseJsonFlag(String(getFlag(flags, "items")), "--items");
7946
7773
  await addBudgetItems({ budgetId: String(budgetId), items });
7947
7774
  }, "commandAddBudgetItems"), commandUpdateBudgetItem = __name2(async ({ flags }) => {
7948
7775
  const id = getFlag(flags, "id");
7949
7776
  if (!id) throw new Error("update-budget-item requires --id");
7950
7777
  await updateBudgetItem({ id: String(id), description: getFlag(flags, "description"), note: getFlag(flags, "note"), quantity: parseOptionalNumber(getFlag(flags, "quantity"), "--quantity"), markup: parseOptionalNumber(getFlag(flags, "markup"), "--markup"), cost: parseOptionalNumber(getFlag(flags, "cost"), "--cost"), unitPrice: parseOptionalNumber(getFlag(flags, "unitPrice"), "--unitPrice"), isFreeOfCharge: parseOptionalBoolFlag(flags, "isFreeOfCharge"), gstInclusive: parseOptionalBoolFlag(flags, "gstInclusive"), gstOutOfScope: parseOptionalBoolFlag(flags, "gstOutOfScope") });
7951
- }, "commandUpdateBudgetItem"), commandRemoveBudgetItem = __name2(
7952
- async ({ positional }) => {
7953
- const id = positional[0];
7954
- if (!id) throw new Error("remove-budget-item requires <budgetItemId>");
7955
- await removeBudgetItem(id);
7956
- },
7957
- "commandRemoveBudgetItem"
7958
- ), commandReplaceBudgetItem = __name2(async ({ flags }) => {
7778
+ }, "commandUpdateBudgetItem"), commandRemoveBudgetItem = __name2(async ({ positional }) => {
7779
+ const id = positional[0];
7780
+ if (!id) throw new Error("remove-budget-item requires <budgetItemId>");
7781
+ await removeBudgetItem(id);
7782
+ }, "commandRemoveBudgetItem"), commandReplaceBudgetItem = __name2(async ({ flags }) => {
7959
7783
  const budgetItemId = getFlag(flags, "budgetItemId"), replacementItemId = getFlag(flags, "replacementItemId");
7960
7784
  if (!budgetItemId || !replacementItemId) throw new Error("replace-budget-item requires --budgetItemId and --replacementItemId");
7961
7785
  await replaceBudgetItem({ budgetItemId: String(budgetItemId), replacementItemId: String(replacementItemId) });
@@ -7963,11 +7787,12 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
7963
7787
  const budgetItemId = getFlag(flags, "budgetItemId"), reason = getFlag(flags, "reason");
7964
7788
  if (!budgetItemId || !reason) throw new Error("approve-unavailable-item-exception requires --budgetItemId and --reason");
7965
7789
  await approveUnavailableItemException({ budgetItemId: String(budgetItemId), reason: String(reason) });
7966
- }, "commandApproveUnavailableItemException"), commandReorderBudgetItems = __name2(async ({ flags, positional }) => {
7790
+ }, "commandApproveUnavailableItemException"), commandReorderBudgetItems = __name2(async ({
7791
+ flags,
7792
+ positional
7793
+ }) => {
7967
7794
  const budgetId = positional[0], itemIdsRaw = getFlag(flags, "itemIds");
7968
- if (!budgetId || itemIdsRaw === void 0) throw new Error(
7969
- "reorder-budget-items requires <budgetId> --itemIds <csv>"
7970
- );
7795
+ if (!budgetId || itemIdsRaw === void 0) throw new Error("reorder-budget-items requires <budgetId> --itemIds <csv>");
7971
7796
  const itemIds = parseCommaSeparatedIds(String(itemIdsRaw));
7972
7797
  if (!itemIds?.length) throw new Error("reorder-budget-items requires non-empty --itemIds <csv>");
7973
7798
  await reorderBudgetItemsCli({ budgetId, itemIds });
@@ -7978,12 +7803,11 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
7978
7803
  }, "commandUpdateBudgetItemSupplier"), commandCreateBudgetCategory = __name2(async ({ flags }) => {
7979
7804
  const name = getFlag(flags, "name");
7980
7805
  if (!name) throw new Error("create-budget-category requires --name");
7981
- await createBudgetCategory(String(name));
7806
+ await createBudgetCategory(String(
7807
+ name
7808
+ ));
7982
7809
  }, "commandCreateBudgetCategory"), commandUpdateBudgetCategory = __name2(async ({ flags }) => {
7983
- const id = getFlag(flags, "id"), name = getFlag(
7984
- flags,
7985
- "name"
7986
- );
7810
+ const id = getFlag(flags, "id"), name = getFlag(flags, "name");
7987
7811
  if (!id || !name) throw new Error("update-budget-category requires --id and --name");
7988
7812
  await updateBudgetCategory({ id: String(id), name: String(name) });
7989
7813
  }, "commandUpdateBudgetCategory"), commandDeleteBudgetCategory = __name2(async ({ positional }) => {
@@ -8015,10 +7839,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8015
7839
  }, "commandMarkBudgetItemsNotUtilized"), commandRestoreBudgetItem = __name2(async ({ positional }) => {
8016
7840
  const budgetItemId = positional[0];
8017
7841
  if (!budgetItemId) throw new Error("restore-budget-item requires <budgetItemId>");
8018
- await setBudgetItemsNotUtilized(
8019
- [budgetItemId],
8020
- !1
8021
- );
7842
+ await setBudgetItemsNotUtilized([budgetItemId], !1);
8022
7843
  }, "commandRestoreBudgetItem"), commandCreatePlaceholderBill = __name2(async ({ positional }) => {
8023
7844
  const budgetItemId = positional[0];
8024
7845
  if (!budgetItemId) throw new Error("create-placeholder-bill requires <budgetItemId>");
@@ -8033,11 +7854,11 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8033
7854
  await countBills({ ...parseCountBillsFlags(flags), isClaimable: !0 });
8034
7855
  }, "commandCountClaims"), commandCreateBillApproval = __name2(async ({ positional }) => {
8035
7856
  const id = positional[0];
8036
- if (!id) throw new Error("create-bill-approval requires <billId>");
7857
+ if (!id) throw new Error(
7858
+ "create-bill-approval requires <billId>"
7859
+ );
8037
7860
  await createBillApproval(id);
8038
- }, "commandCreateBillApproval"), commandCreateBill = __name2(async ({
8039
- flags
8040
- }) => {
7861
+ }, "commandCreateBillApproval"), commandCreateBill = __name2(async ({ flags }) => {
8041
7862
  const payloadRaw = getFlag(flags, "payload");
8042
7863
  if (!payloadRaw) throw new Error("create-bill requires --payload '<json>'");
8043
7864
  const raw = parseJsonFlag(String(payloadRaw), "--payload"), draftOnly = flags["draft-only"] === !0 ? !0 : parseOptionalBoolFlag(flags, "draft-only"), quotationExempt = flags["quotation-exempt"] === !0;
@@ -8048,20 +7869,17 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8048
7869
  if (!payloadRaw) throw new Error("validate-bill-selection requires --payload '<json>'");
8049
7870
  const raw = parseJsonFlag(String(payloadRaw), "--payload");
8050
7871
  if (flags.quotationIds === !0 || flags.quotationId === !0) throw new Error("--quotationIds requires a CSV value and --quotationId requires an ID value.");
8051
- const quotationIds = parseCommaSeparatedIds(getFlag(flags, "quotationIds")), quotationId = getFlag(
8052
- flags,
8053
- "quotationId"
8054
- )?.trim() || void 0;
7872
+ const quotationIds = parseCommaSeparatedIds(getFlag(flags, "quotationIds")), quotationId = getFlag(flags, "quotationId")?.trim() || void 0;
8055
7873
  if (quotationId && quotationIds && (quotationIds.length !== 1 || quotationIds[0] !== quotationId)) throw new Error("--quotationId conflicts with --quotationIds.");
8056
7874
  if (quotationIds && new Set(quotationIds).size !== quotationIds.length) throw new Error("--quotationIds must not contain duplicates.");
8057
7875
  await validateBillSelectionFromPayload(raw, { ...quotationId ? { quotationId } : {}, ...quotationIds ? { quotationIds } : {} });
8058
7876
  }, "commandValidateBillSelection"), commandLinkBillQuotations = __name2(async ({ flags, positional }) => {
8059
7877
  const billId = positional[0], payloadRaw = getFlag(flags, "payload"), quotationIds = parseCommaSeparatedIds(getFlag(flags, "quotationIds"));
8060
7878
  if (!billId || !payloadRaw && (!quotationIds || quotationIds.length === 0)) throw new Error("link-bill-quotations requires <billId> and either --payload '<json>' or --quotationIds <csv>");
8061
- if (payloadRaw && quotationIds) throw new Error("--payload cannot be combined with --quotationIds.");
8062
- if (quotationIds && new Set(quotationIds).size !== quotationIds.length) throw new Error(
8063
- "--quotationIds must not contain duplicates."
7879
+ if (payloadRaw && quotationIds) throw new Error(
7880
+ "--payload cannot be combined with --quotationIds."
8064
7881
  );
7882
+ if (quotationIds && new Set(quotationIds).size !== quotationIds.length) throw new Error("--quotationIds must not contain duplicates.");
8065
7883
  await linkBillQuotations(billId, payloadRaw ? parseJsonFlag(String(payloadRaw), "--payload") : { quotationIds });
8066
7884
  }, "commandLinkBillQuotations"), commandUpdateBill = __name2(async ({ flags }) => {
8067
7885
  const payloadRaw = getFlag(flags, "payload");
@@ -8075,7 +7893,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8075
7893
  await updateBillPaymentEvidenceFromPayload(raw);
8076
7894
  }, "commandUpdateBillPaymentEvidence"), commandDeleteBill = __name2(async ({ positional }) => {
8077
7895
  const id = positional[0];
8078
- if (!id) throw new Error("delete-bill requires <billId>");
7896
+ if (!id) throw new Error(
7897
+ "delete-bill requires <billId>"
7898
+ );
8079
7899
  await deleteBillById(id);
8080
7900
  }, "commandDeleteBill"), commandUpdateBillStatus = __name2(async ({ flags, positional }) => {
8081
7901
  const [id, statusRaw] = positional;
@@ -8096,7 +7916,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8096
7916
  const id = positional[0];
8097
7917
  if (!id) throw new Error("patch-bill-payment requires <billId>");
8098
7918
  const paymentTrackingUrl = (() => {
8099
- const clear = parseOptionalBoolFlag(flags, "clearPaymentTrackingUrl"), raw = getFlag(flags, "paymentTrackingUrl");
7919
+ const clear = parseOptionalBoolFlag(
7920
+ flags,
7921
+ "clearPaymentTrackingUrl"
7922
+ ), raw = getFlag(flags, "paymentTrackingUrl");
8100
7923
  if (clear === !0 && raw !== void 0) throw new Error("Use either --paymentTrackingUrl or --clearPaymentTrackingUrl true, not both");
8101
7924
  if (clear === !0) return null;
8102
7925
  if (raw !== void 0) return String(raw);
@@ -8128,7 +7951,13 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8128
7951
  const page = parseDetailFeedPage("get-bill-approvals", "<billId>", positional, flags, 50);
8129
7952
  await getBillApprovals(page);
8130
7953
  }, "commandGetBillApprovals"), commandGetBillLineItems = __name2(async ({ flags, positional }) => {
8131
- const page = parseDetailFeedPage("get-bill-line-items", "<billId>", positional, flags, 100);
7954
+ const page = parseDetailFeedPage(
7955
+ "get-bill-line-items",
7956
+ "<billId>",
7957
+ positional,
7958
+ flags,
7959
+ 100
7960
+ );
8132
7961
  await getBillLineItems(page);
8133
7962
  }, "commandGetBillLineItems"), commandGetBillPayment = __name2(async ({ positional }) => {
8134
7963
  const id = positional[0];
@@ -8139,28 +7968,37 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8139
7968
  if (!projectId || filePaths.length === 0) throw new Error("stage-bill-attachment requires <projectId> <filePath...> or --file/--files");
8140
7969
  await stageBillAttachmentsFromPaths(projectId, filePaths);
8141
7970
  }, "commandStageBillAttachment"), commandCleanupStagedBillAttachments = __name2(async ({ flags, positional }) => {
8142
- const projectId = positional[0], keys = parseCommaSeparatedIds(getFlag(flags, "keys"));
7971
+ const projectId = positional[0], keys = parseCommaSeparatedIds(getFlag(
7972
+ flags,
7973
+ "keys"
7974
+ ));
8143
7975
  if (!projectId || !keys) throw new Error("cleanup-staged-bill-attachments requires <projectId> --keys <csv>");
8144
7976
  await cleanupStagedBillAttachments(projectId, keys);
8145
- }, "commandCleanupStagedBillAttachments"), commandUploadBillAttachment = __name2(async ({ cmd, flags, positional }) => {
8146
- const [billId, ...positionalFilePaths] = positional, fileFlag = getFlag(flags, "file"), filesFlag = getFlag(flags, "files"), filePaths = [...positionalFilePaths, ...fileFlag !== void 0 ? [String(fileFlag)] : [], ...filesFlag !== void 0 ? String(filesFlag).split(",").map((value) => value.trim()).filter(Boolean) : []];
8147
- if (!billId || filePaths.length === 0) throw new Error("".concat(cmd, " requires <billId> <filePath...> or --file/--files"));
8148
- const attachmentType = cmd === "attach-bill-payment-receipt" ? AttachmentType.BILL_PAYMENT_PROOF : AttachmentType.BILL, [firstFilePath] = filePaths;
8149
- filePaths.length === 1 && firstFilePath !== void 0 ? await uploadBillAttachmentFromPath(billId, firstFilePath, attachmentType) : await uploadBillAttachmentsFromPaths(billId, filePaths, attachmentType);
8150
- }, "commandUploadBillAttachment"), commandAttachBillDocuments = __name2(async ({ flags, positional }) => {
8151
- const billId = positional[0];
8152
- if (!billId) throw new Error("attach-bill-documents requires <billId>");
8153
- const getFlagAlias = __name2((...flagNames) => {
8154
- for (const flagName of flagNames) {
8155
- const value = getFlag(flags, flagName);
8156
- if (value !== void 0) return value;
8157
- }
8158
- }, "getFlagAlias"), parseFilesFlag = __name2((...flagNames) => {
8159
- const raw = getFlagAlias(...flagNames);
8160
- return raw === void 0 ? [] : String(raw).split(",").map((value) => value.trim()).filter(Boolean);
8161
- }, "parseFilesFlag"), invoicePath = getFlagAlias("invoice", "invoice-file"), paymentProofPath = getFlagAlias("paymentProof", "payment-proof", "proof", "receipt"), invoicePaths = [...invoicePath !== void 0 ? [String(invoicePath)] : [], ...parseFilesFlag("invoices", "invoice-files")], paymentProofPaths = [...paymentProofPath !== void 0 ? [String(paymentProofPath)] : [], ...parseFilesFlag("paymentProofs", "payment-proofs", "proofs", "receipts")];
8162
- await uploadBillDocumentsFromPaths({ billId, invoicePaths, paymentProofPaths });
8163
- }, "commandAttachBillDocuments"), commandGetBillDetails = __name2(async ({ positional }) => {
7977
+ }, "commandCleanupStagedBillAttachments"), commandUploadBillAttachment = __name2(
7978
+ async ({ cmd, flags, positional }) => {
7979
+ const [billId, ...positionalFilePaths] = positional, fileFlag = getFlag(flags, "file"), filesFlag = getFlag(flags, "files"), filePaths = [...positionalFilePaths, ...fileFlag !== void 0 ? [String(fileFlag)] : [], ...filesFlag !== void 0 ? String(filesFlag).split(",").map((value) => value.trim()).filter(Boolean) : []];
7980
+ if (!billId || filePaths.length === 0) throw new Error("".concat(cmd, " requires <billId> <filePath...> or --file/--files"));
7981
+ const attachmentType = cmd === "attach-bill-payment-receipt" ? AttachmentType.BILL_PAYMENT_PROOF : AttachmentType.BILL, [firstFilePath] = filePaths;
7982
+ filePaths.length === 1 && firstFilePath !== void 0 ? await uploadBillAttachmentFromPath(billId, firstFilePath, attachmentType) : await uploadBillAttachmentsFromPaths(billId, filePaths, attachmentType);
7983
+ },
7984
+ "commandUploadBillAttachment"
7985
+ ), commandAttachBillDocuments = __name2(
7986
+ async ({ flags, positional }) => {
7987
+ const billId = positional[0];
7988
+ if (!billId) throw new Error("attach-bill-documents requires <billId>");
7989
+ const getFlagAlias = __name2((...flagNames) => {
7990
+ for (const flagName of flagNames) {
7991
+ const value = getFlag(flags, flagName);
7992
+ if (value !== void 0) return value;
7993
+ }
7994
+ }, "getFlagAlias"), parseFilesFlag = __name2((...flagNames) => {
7995
+ const raw = getFlagAlias(...flagNames);
7996
+ return raw === void 0 ? [] : String(raw).split(",").map((value) => value.trim()).filter(Boolean);
7997
+ }, "parseFilesFlag"), invoicePath = getFlagAlias("invoice", "invoice-file"), paymentProofPath = getFlagAlias("paymentProof", "payment-proof", "proof", "receipt"), invoicePaths = [...invoicePath !== void 0 ? [String(invoicePath)] : [], ...parseFilesFlag("invoices", "invoice-files")], paymentProofPaths = [...paymentProofPath !== void 0 ? [String(paymentProofPath)] : [], ...parseFilesFlag("paymentProofs", "payment-proofs", "proofs", "receipts")];
7998
+ await uploadBillDocumentsFromPaths({ billId, invoicePaths, paymentProofPaths });
7999
+ },
8000
+ "commandAttachBillDocuments"
8001
+ ), commandGetBillDetails = __name2(async ({ positional }) => {
8164
8002
  const id = positional[0];
8165
8003
  if (!id) throw new Error("get-bill-details requires <billId>");
8166
8004
  await getBillDetails(id);
@@ -8174,10 +8012,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8174
8012
  await listQuotations({ ...parseQuotationFilterFlags(flags), limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction });
8175
8013
  }, "commandListQuotations"), commandCountQuotations = __name2(async ({ flags }) => {
8176
8014
  rejectRetiredPageFlags(flags);
8177
- for (const key of ["limit", "cursor", "direction"]) if (flags[key] !== void 0) throw new Error("count-quotations does not accept --".concat(key, "; totals use filters only."));
8178
- await countQuotations(
8179
- { ...parseQuotationFilterFlags(flags), includeMetrics: parseOptionalBoolFlag(flags, "includeMetrics") ?? !1 }
8015
+ for (const key of ["limit", "cursor", "direction"]) if (flags[key] !== void 0) throw new Error(
8016
+ "count-quotations does not accept --".concat(key, "; totals use filters only.")
8180
8017
  );
8018
+ await countQuotations({ ...parseQuotationFilterFlags(flags), includeMetrics: parseOptionalBoolFlag(flags, "includeMetrics") ?? !1 });
8181
8019
  }, "commandCountQuotations"), commandGetQuotation = __name2(async ({ positional }) => {
8182
8020
  const id = positional[0];
8183
8021
  if (!id) throw new Error("get-quotation requires <quotationId>");
@@ -8189,7 +8027,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8189
8027
  const [projectId, filePath] = positional;
8190
8028
  if (!projectId || !filePath) throw new Error("upload-quotation-attachment requires <projectId> <filePath>");
8191
8029
  await uploadQuotationAttachmentFromPath(projectId, filePath);
8192
- }, "commandUploadQuotationAttachment"), commandCleanupStagedQuotationAttachments = __name2(async ({ flags, positional }) => {
8030
+ }, "commandUploadQuotationAttachment"), commandCleanupStagedQuotationAttachments = __name2(async ({
8031
+ flags,
8032
+ positional
8033
+ }) => {
8193
8034
  const projectId = positional[0], keys = parseCommaSeparatedIds(getFlag(flags, "keys"));
8194
8035
  if (!projectId || !keys) throw new Error("cleanup-staged-quotation-attachments requires <projectId> --keys <csv>");
8195
8036
  await cleanupStagedQuotationAttachments(projectId, keys);
@@ -8207,14 +8048,11 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8207
8048
  const id = positional[0];
8208
8049
  if (!id) throw new Error("delete-quotation requires <quotationId>");
8209
8050
  await deleteQuotationById(id);
8210
- }, "commandDeleteQuotation"), commandSubmitQuotation = __name2(
8211
- async ({ flags, positional }) => {
8212
- const id = positional[0];
8213
- if (!id) throw new Error("submit-quotation requires <quotationId>");
8214
- await submitQuotation(id, getFlag(flags, "overBudgetOverrideReason"));
8215
- },
8216
- "commandSubmitQuotation"
8217
- ), commandApproveQuotation = __name2(async ({ flags, positional }) => {
8051
+ }, "commandDeleteQuotation"), commandSubmitQuotation = __name2(async ({ flags, positional }) => {
8052
+ const id = positional[0];
8053
+ if (!id) throw new Error("submit-quotation requires <quotationId>");
8054
+ await submitQuotation(id, getFlag(flags, "overBudgetOverrideReason"));
8055
+ }, "commandSubmitQuotation"), commandApproveQuotation = __name2(async ({ flags, positional }) => {
8218
8056
  const id = positional[0];
8219
8057
  if (!id) throw new Error("approve-quotation requires <quotationId>");
8220
8058
  await approveQuotation(id, getFlag(flags, "overBudgetOverrideReason"));
@@ -8236,11 +8074,14 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8236
8074
  const projectId = positional[0];
8237
8075
  if (!projectId) throw new Error("list-eligible-customer-invoice-budgets requires <projectId>");
8238
8076
  await listEligibleCustomerInvoiceBudgets(projectId);
8239
- }, "commandListEligibleCustomerInvoiceBudgets"), commandPreviewCustomerInvoiceAmount = __name2(async ({ positional }) => {
8240
- const [budgetId, rawPercentage] = positional, percentage = Number(rawPercentage);
8241
- if (!budgetId || !rawPercentage || positional.length !== 2 || !Number.isFinite(percentage) || percentage <= 0 || percentage > 100 || Math.round(percentage * 100) !== percentage * 100) throw new Error("preview-customer-invoice-amount requires <budgetId> <percentage-of-estimate> between 0.01 and 100");
8242
- await previewCustomerInvoiceAmount(budgetId, percentage);
8243
- }, "commandPreviewCustomerInvoiceAmount"), commandListAvailableQboCustomerInvoices = __name2(async ({ positional }) => {
8077
+ }, "commandListEligibleCustomerInvoiceBudgets"), commandPreviewCustomerInvoiceAmount = __name2(
8078
+ async ({ positional }) => {
8079
+ const [budgetId, rawPercentage] = positional, percentage = Number(rawPercentage);
8080
+ if (!budgetId || !rawPercentage || positional.length !== 2 || !Number.isFinite(percentage) || percentage <= 0 || percentage > 100 || Math.round(percentage * 100) !== percentage * 100) throw new Error("preview-customer-invoice-amount requires <budgetId> <percentage-of-estimate> between 0.01 and 100");
8081
+ await previewCustomerInvoiceAmount(budgetId, percentage);
8082
+ },
8083
+ "commandPreviewCustomerInvoiceAmount"
8084
+ ), commandListAvailableQboCustomerInvoices = __name2(async ({ positional }) => {
8244
8085
  const budgetId = positional[0];
8245
8086
  if (!budgetId || positional.length !== 1) throw new Error("list-available-qbo-customer-invoices requires <budgetId>");
8246
8087
  await listAvailableQboCustomerInvoices(budgetId);
@@ -8256,10 +8097,11 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8256
8097
  return;
8257
8098
  }
8258
8099
  rejectBarePagingFlags(flags);
8259
- const { cursor, direction } = parseCursorAndDirection(flags), sortDir = parseOptionalBillListSortDir(getFlag(flags, "sortDir"));
8260
- await listCustomerInvoices(
8261
- { ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseCustomerInvoiceSortBy(getFlag(flags, "sortBy")), sortDir: sortDir ?? "desc" }
8262
- );
8100
+ const {
8101
+ cursor,
8102
+ direction
8103
+ } = parseCursorAndDirection(flags), sortDir = parseOptionalBillListSortDir(getFlag(flags, "sortDir"));
8104
+ await listCustomerInvoices({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseCustomerInvoiceSortBy(getFlag(flags, "sortBy")), sortDir: sortDir ?? "desc" });
8263
8105
  }, "commandListCustomerInvoices"), commandGetCustomerInvoice = __name2(async ({ positional }) => {
8264
8106
  const batchId = positional[0];
8265
8107
  if (!batchId) throw new Error("get-customer-invoice requires <batchId>");
@@ -8299,14 +8141,11 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8299
8141
  const payloadRaw = getFlag(flags, "payload");
8300
8142
  if (!payloadRaw) throw new Error("create-customer-invoice requires --payload '<json>'");
8301
8143
  await createCustomerInvoice(parseJsonFlag(String(payloadRaw), "--payload"));
8302
- }, "commandCreateCustomerInvoice"), commandResubmitCustomerInvoice = __name2(
8303
- async ({ positional }) => {
8304
- const batchId = positional[0];
8305
- if (!batchId) throw new Error("resubmit-customer-invoice requires <batchId>");
8306
- await resubmitCustomerInvoice(batchId);
8307
- },
8308
- "commandResubmitCustomerInvoice"
8309
- ), commandDiscardCustomerInvoice = __name2(async ({ positional }) => {
8144
+ }, "commandCreateCustomerInvoice"), commandResubmitCustomerInvoice = __name2(async ({ positional }) => {
8145
+ const batchId = positional[0];
8146
+ if (!batchId) throw new Error("resubmit-customer-invoice requires <batchId>");
8147
+ await resubmitCustomerInvoice(batchId);
8148
+ }, "commandResubmitCustomerInvoice"), commandDiscardCustomerInvoice = __name2(async ({ positional }) => {
8310
8149
  const batchId = positional[0];
8311
8150
  if (!batchId) throw new Error("discard-customer-invoice requires <batchId>");
8312
8151
  await discardCreatingCustomerInvoice(batchId);
@@ -8320,9 +8159,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8320
8159
  await voidCustomerInvoice(batchId);
8321
8160
  }, "commandVoidCustomerInvoice"), commandApproveCustomerInvoice = __name2(async ({ positional }) => {
8322
8161
  const batchId = positional[0];
8323
- if (!batchId) throw new Error(
8324
- "approve-customer-invoice requires <batchId>"
8325
- );
8162
+ if (!batchId) throw new Error("approve-customer-invoice requires <batchId>");
8326
8163
  await approveCustomerInvoice(batchId);
8327
8164
  }, "commandApproveCustomerInvoice"), commandRejectCustomerInvoice = __name2(async ({ flags, positional }) => {
8328
8165
  const batchId = positional[0], reason = getFlag(flags, "reason");
@@ -8332,27 +8169,27 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8332
8169
  const payloadRaw = getFlag(flags, "payload");
8333
8170
  if (!payloadRaw) throw new Error("send-customer-invoice-to-contact-person requires --payload '<json>'");
8334
8171
  await sendCustomerInvoiceToContactPersonFromPayload(parseJsonFlag(String(payloadRaw), "--payload"));
8335
- }, "commandSendCustomerInvoiceToContactPerson"), commandDownloadCustomerInvoicePdf = __name2(async ({ flags, positional }) => {
8336
- const invoiceId = positional[0];
8337
- if (!invoiceId) throw new Error("download-customer-invoice-pdf requires <invoiceId> [--output <path>]");
8338
- await downloadCustomerInvoicePdf(
8339
- invoiceId,
8340
- getFlag(flags, "output")
8341
- );
8342
- }, "commandDownloadCustomerInvoicePdf"), commandUpdateCustomerInvoiceDetails = __name2(async ({ flags, positional }) => {
8172
+ }, "commandSendCustomerInvoiceToContactPerson"), commandDownloadCustomerInvoicePdf = __name2(
8173
+ async ({ flags, positional }) => {
8174
+ const invoiceId = positional[0];
8175
+ if (!invoiceId) throw new Error("download-customer-invoice-pdf requires <invoiceId> [--output <path>]");
8176
+ await downloadCustomerInvoicePdf(invoiceId, getFlag(flags, "output"));
8177
+ },
8178
+ "commandDownloadCustomerInvoicePdf"
8179
+ ), commandUpdateCustomerInvoiceDetails = __name2(async ({ flags, positional }) => {
8343
8180
  const invoiceId = positional[0], billingAddress = getFlag(flags, "billingAddress"), customerMemo = getFlag(flags, "customerMemo");
8344
8181
  if (!invoiceId || typeof billingAddress != "string" || typeof customerMemo != "string") throw new Error("update-customer-invoice-details requires <invoiceId> --billingAddress <text> --customerMemo <text> (send both; use \\n for address lines). The bill email is managed in QuickBooks.");
8345
8182
  const requestId = getFlag(flags, "requestId");
8346
- await updateCustomerInvoiceDetails({ billingAddress: billingAddress.replaceAll("\\n", `
8347
- `), customerMemo, invoiceId, ...typeof requestId == "string" ? { requestId } : {} });
8348
- }, "commandUpdateCustomerInvoiceDetails"), commandUpdateCustomerInvoiceQboDrift = __name2(async ({ flags, positional }) => {
8349
- const invoiceId = positional[0], resolution = getFlag(flags, "resolution");
8350
- if (!invoiceId || resolution !== "ACCEPT_QBO" && resolution !== "KEEP_BB") throw new Error(
8351
- "update-customer-invoice-qbo-drift requires <invoiceId> --resolution ACCEPT_QBO|KEEP_BB"
8352
- );
8353
- const requestId = getFlag(flags, "requestId");
8354
- await updateCustomerInvoiceQboDrift({ invoiceId, resolution, ...typeof requestId == "string" ? { requestId } : {} });
8355
- }, "commandUpdateCustomerInvoiceQboDrift"), commandMarkCustomerInvoiceSentExternally = __name2(async ({ flags, positional }) => {
8183
+ await updateCustomerInvoiceDetails({ billingAddress: billingAddress.replaceAll("\\n", "\n"), customerMemo, invoiceId, ...typeof requestId == "string" ? { requestId } : {} });
8184
+ }, "commandUpdateCustomerInvoiceDetails"), commandUpdateCustomerInvoiceQboDrift = __name2(
8185
+ async ({ flags, positional }) => {
8186
+ const invoiceId = positional[0], resolution = getFlag(flags, "resolution");
8187
+ if (!invoiceId || resolution !== "ACCEPT_QBO" && resolution !== "KEEP_BB") throw new Error("update-customer-invoice-qbo-drift requires <invoiceId> --resolution ACCEPT_QBO|KEEP_BB");
8188
+ const requestId = getFlag(flags, "requestId");
8189
+ await updateCustomerInvoiceQboDrift({ invoiceId, resolution, ...typeof requestId == "string" ? { requestId } : {} });
8190
+ },
8191
+ "commandUpdateCustomerInvoiceQboDrift"
8192
+ ), commandMarkCustomerInvoiceSentExternally = __name2(async ({ flags, positional }) => {
8356
8193
  const invoiceId = positional[0], sentAt = getFlag(flags, "sentAt"), recipients = getFlag(flags, "recipients");
8357
8194
  if (!invoiceId || !sentAt || !recipients) throw new Error("mark-customer-invoice-sent-externally requires <invoiceId> --sentAt <ISO datetime> --recipients a@x.com,b@y.com [--note <text>]");
8358
8195
  await markCustomerInvoiceSentExternally({ invoiceId, sentAt, recipients: recipients.split(",").map((recipient) => recipient.trim()).filter(Boolean), note: getFlag(flags, "note") });
@@ -8373,7 +8210,8 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8373
8210
  await rejectBill(id, reason);
8374
8211
  }, "commandRejectBill"), commandApproveBudget = __name2(async ({ positional }) => {
8375
8212
  const id = positional[0];
8376
- if (!id) throw new Error("approve-budget requires <budgetId>");
8213
+ if (!id)
8214
+ throw new Error("approve-budget requires <budgetId>");
8377
8215
  await approveBudget(id);
8378
8216
  }, "commandApproveBudget"), commandRejectBudget = __name2(async ({ flags, positional }) => {
8379
8217
  const id = positional[0], reason = getFlag(flags, "reason");
@@ -8394,9 +8232,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8394
8232
  }, "commandGetSupplierDetails"), commandGetSupplierOverview = __name2(async ({ positional }) => {
8395
8233
  const id = positional[0];
8396
8234
  if (!id) throw new Error("get-supplier-overview requires <supplierId>");
8397
- await getSupplierOverview(
8398
- id
8399
- );
8235
+ await getSupplierOverview(id);
8400
8236
  }, "commandGetSupplierOverview"), commandGetSupplierUsage = __name2(async ({ positional }) => {
8401
8237
  const id = positional[0];
8402
8238
  if (!id) throw new Error("get-supplier-usage requires <supplierId>");
@@ -8412,7 +8248,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8412
8248
  }, "commandCountCompanies"), commandGetCompany = __name2(async ({ positional }) => {
8413
8249
  const id = positional[0];
8414
8250
  if (!id) throw new Error("get-company requires <id>");
8415
- await getCompany(id);
8251
+ await getCompany(
8252
+ id
8253
+ );
8416
8254
  }, "commandGetCompany"), commandCreateCompany = __name2(async ({ flags }) => {
8417
8255
  rejectBareFlag(flags, "billingEmails");
8418
8256
  const billingEmailsRaw = getFlag(flags, "billingEmails"), billingEmails = billingEmailsRaw === void 0 ? void 0 : parseCompanyBillingEmails(parseJsonFlag(billingEmailsRaw, "--billingEmails")), name = getFlag(flags, "name"), website = getFlag(flags, "website");
@@ -8426,9 +8264,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8426
8264
  const cursor = getFlag(flags, "cursor");
8427
8265
  if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
8428
8266
  const limitFlag = getFlag(flags, "limit"), limit = limitFlag === void 0 ? void 0 : Number(limitFlag);
8429
- if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > 50)) throw new Error(
8430
- "--limit must be an integer from 1 to 50."
8431
- );
8267
+ if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > 50)) throw new Error("--limit must be an integer from 1 to 50.");
8432
8268
  await searchExistingCompanies({ query, limit, cursor });
8433
8269
  }, "commandSearchExistingCompanies"), commandUseExistingCompany = __name2(async ({ flags }) => {
8434
8270
  const companyId = getFlag(flags, "companyId"), quickbooksId = getFlag(flags, "quickbooksId");
@@ -8439,14 +8275,11 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8439
8275
  if (!payloadRaw) throw new Error("update-company requires --payload '<json>'");
8440
8276
  const raw = parseJsonFlag(String(payloadRaw), "--payload");
8441
8277
  await updateCompanyFromPayload(raw);
8442
- }, "commandUpdateCompany"), commandGetCompanyQuickbooksSyncStatus = __name2(
8443
- async ({ positional }) => {
8444
- const id = positional[0];
8445
- if (!id) throw new Error("get-company-quickbooks-sync-status requires <companyId>");
8446
- await getCompanyQuickBooksSyncStatus(id);
8447
- },
8448
- "commandGetCompanyQuickbooksSyncStatus"
8449
- ), commandDeleteCompany = __name2(async ({ positional }) => {
8278
+ }, "commandUpdateCompany"), commandGetCompanyQuickbooksSyncStatus = __name2(async ({ positional }) => {
8279
+ const id = positional[0];
8280
+ if (!id) throw new Error("get-company-quickbooks-sync-status requires <companyId>");
8281
+ await getCompanyQuickBooksSyncStatus(id);
8282
+ }, "commandGetCompanyQuickbooksSyncStatus"), commandDeleteCompany = __name2(async ({ positional }) => {
8450
8283
  const id = positional[0];
8451
8284
  if (!id) throw new Error("delete-company requires <id>");
8452
8285
  await deleteCompanyById(id);
@@ -8456,12 +8289,11 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8456
8289
  await countProjects(parseProjectCountFlags(flags));
8457
8290
  }, "commandCountProjects"), commandListProjectHubs = __name2(async ({ cmd, flags }) => {
8458
8291
  rejectRetiredPageFlags(flags);
8459
- const filters = { q: getFlag(flags, "q"), statuses: parseCommaSeparatedProjectStatuses(getFlag(flags, "status")) };
8292
+ const filters = { q: getFlag(flags, "q"), statuses: parseCommaSeparatedProjectStatuses(
8293
+ getFlag(flags, "status")
8294
+ ) };
8460
8295
  if (cmd === "count-project-hubs") {
8461
- for (const key of ["limit", "cursor", "direction", "sortBy", "sortDir"]) if (flags[key] !== void 0) throw new Error("count-project-hubs does not accept --".concat(
8462
- key,
8463
- "; totals use filters only."
8464
- ));
8296
+ for (const key of ["limit", "cursor", "direction", "sortBy", "sortDir"]) if (flags[key] !== void 0) throw new Error("count-project-hubs does not accept --".concat(key, "; totals use filters only."));
8465
8297
  await countProjectHubs(filters);
8466
8298
  return;
8467
8299
  }
@@ -8488,10 +8320,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8488
8320
  if (!projectId) throw new Error("sync-project-hub-commercial-documents requires <projectId>");
8489
8321
  await syncProjectHubCommercialDocuments(projectId);
8490
8322
  }, "commandSyncProjectHubCommercialDocuments"), commandCreateProject = __name2(async ({ flags }) => {
8491
- const name = getFlag(flags, "name"), companyId = getFlag(flags, "companyId"), contactPersonId = getFlag(flags, "contactPersonId"), insideSalesId = getFlag(flags, "insideSalesId"), businessDevelopmentId = getFlag(flags, "businessDevelopmentId"), projectManagerId = getFlag(flags, "projectManagerId"), venue = getFlag(flags, "venue"), pax = getFlag(
8492
- flags,
8493
- "pax"
8494
- ), asanaTaskId = getFlag(flags, "asanaTaskId"), asanaSearch = getFlag(flags, "asanaSearch"), slackChannelId = getFlag(flags, "slackChannelId"), slackChannelUrl = getFlag(flags, "slackChannelUrl"), slackChannelName = getFlag(flags, "slackChannelName"), startDate = getFlag(flags, "startDate");
8323
+ const name = getFlag(flags, "name"), companyId = getFlag(flags, "companyId"), contactPersonId = getFlag(flags, "contactPersonId"), insideSalesId = getFlag(flags, "insideSalesId"), businessDevelopmentId = getFlag(flags, "businessDevelopmentId"), projectManagerId = getFlag(flags, "projectManagerId"), venue = getFlag(flags, "venue"), pax = getFlag(flags, "pax"), asanaTaskId = getFlag(flags, "asanaTaskId"), asanaSearch = getFlag(flags, "asanaSearch"), startDate = getFlag(flags, "startDate");
8495
8324
  if (getFlag(flags, "requestQboAccountantNotification") !== void 0) throw new Error("create-project does not allow --requestQboAccountantNotification; CLI project creation always requests the QuickBooks project import like the web app.");
8496
8325
  if (!name || !companyId || !contactPersonId || !insideSalesId || !businessDevelopmentId || !venue || !startDate) throw new Error("create-project requires --name --companyId --contactPersonId --insideSalesId --businessDevelopmentId --venue --startDate (ISO/datetime flags as appropriate); optional --projectManagerId, --asanaTaskId, --asanaSearch, --pax and --endDate");
8497
8326
  await createProject({
@@ -8505,9 +8334,6 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
8505
8334
  pax,
8506
8335
  asanaTaskId,
8507
8336
  asanaSearch,
8508
- slackChannelId,
8509
- slackChannelUrl,
8510
- slackChannelName,
8511
8337
  startDate,
8512
8338
  endDate: getFlag(flags, "endDate"),
8513
8339
  description: getFlag(flags, "description")
@@ -9180,8 +9006,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
9180
9006
  return;
9181
9007
  }
9182
9008
  const helpArgv = commandArgv.filter((argument, index) => argument !== "-h" && argument !== "--help" && !argument.startsWith("--help=") && !(commandArgv[index - 1] === "--help" && booleanFlagValues.has(argument))), helpCommand = resolveCommand(helpArgv[0] === "help" ? helpArgv.slice(1) : helpArgv)?.command;
9183
- runtime.stdout.write("".concat(createHumanHelp(helpCommand), `
9184
- `));
9009
+ runtime.stdout.write("".concat(createHumanHelp(helpCommand), "\n"));
9185
9010
  },
9186
9011
  "printCliHelp"
9187
9012
  ), runCompletionCommand = __name2((context, commandArgv) => {
@@ -9197,10 +9022,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
9197
9022
  const { runtime } = context;
9198
9023
  if (authAction === "login") {
9199
9024
  const credentials = await loginWithBrowser(
9200
- { apiBaseUrl: BUDGET_BUILDER_API_BASE_URL, clientVersion: context.version, onVerification: __name2(({ browserOpened, userCode, verificationUriComplete }) => runtime.stderr.write("".concat(browserOpened ? "Opened" : "Open", " ").concat(verificationUriComplete, `
9201
- Code: `).concat(userCode, `
9202
- Waiting for approval\u2026
9203
- `)), "onVerification"), ...isEnabledFlag(rawArgv, "--no-browser") ? { openBrowser: __name2(async () => !1, "openBrowser") } : {}, store }
9025
+ { apiBaseUrl: BUDGET_BUILDER_API_BASE_URL, clientVersion: context.version, onVerification: __name2(({ browserOpened, userCode, verificationUriComplete }) => runtime.stderr.write("".concat(browserOpened ? "Opened" : "Open", " ").concat(verificationUriComplete, "\nCode: ").concat(userCode, "\nWaiting for approval\u2026\n")), "onVerification"), ...isEnabledFlag(rawArgv, "--no-browser") ? { openBrowser: __name2(async () => !1, "openBrowser") } : {}, store }
9204
9026
  );
9205
9027
  emitCommandResult({ authenticated: !0, method: "browser-session", session: credentials.session, storage: "Bun.secrets" });
9206
9028
  } else emitCommandResult(authAction === "status" ? await authStatusResult(runtime, store) : { loggedOut: !0, ...await logoutCliSession({ apiBaseUrl: BUDGET_BUILDER_API_BASE_URL, store }), apiKeyActive: !!runtime.env.BB_API_KEY?.trim() });
@@ -9239,8 +9061,7 @@ Waiting for approval\u2026
9239
9061
  resolvedCommand.isLegacyAlias || CONFIRMATION_EXEMPT_COMMANDS.has(cmd) || resolvedCommand.command.effects.length === 0 || await confirmCurrentCommand({ action: resolvedCommand.command.path.join(" "), target: commandConfirmationTarget(resolvedCommand), details: "Canonical v2 mutation. Supply every effect-specific --allow-* flag for non-interactive execution." });
9240
9062
  }, "confirmCanonicalMutation"), runResolvedCommand = __name2(async (context, argv, rawArgv, resolvedCommand, credentialStore, configureAccessToken) => {
9241
9063
  const { runtime, quiet, debug } = context, effectiveArgv = legacyArgvForCommand(argv, resolvedCommand), { command, positional, flags } = parseArgs(effectiveArgv);
9242
- consumeCliQuietFlags(flags), setCliQuiet(resolvedCommand.isLegacyAlias ? quiet : quiet || !debug), setActiveCliSession({ runtime, invocation: { command: resolvedCommand.command.path.join(" "), cliVersion: context.version, apiBaseUrl: BUDGET_BUILDER_API_BASE_URL, legacy: resolvedCommand.isLegacyAlias, quiet, debug }, effects: resolvedCommand.command.effects, permissions: effectPermissionsFromArgv(rawArgv) }), resolvedCommand.isLegacyAlias && !quiet && runtime.stderr.write('[bb] Deprecated command "'.concat(resolvedCommand.invokedAs.join(" "), '"; use "bb ').concat(resolvedCommand.command.path.join(" "), `".
9243
- `));
9064
+ consumeCliQuietFlags(flags), setCliQuiet(resolvedCommand.isLegacyAlias ? quiet : quiet || !debug), setActiveCliSession({ runtime, invocation: { command: resolvedCommand.command.path.join(" "), cliVersion: context.version, apiBaseUrl: BUDGET_BUILDER_API_BASE_URL, legacy: resolvedCommand.isLegacyAlias, quiet, debug }, effects: resolvedCommand.command.effects, permissions: effectPermissionsFromArgv(rawArgv) }), resolvedCommand.isLegacyAlias && !quiet && runtime.stderr.write('[bb] Deprecated command "'.concat(resolvedCommand.invokedAs.join(" "), '"; use "bb ').concat(resolvedCommand.command.path.join(" "), '".\n'));
9244
9065
  const cmd = normalizeCliCommand(command ?? ""), t0 = Date.now();
9245
9066
  shouldLogCliActions() && logCliAction({ event: "cli.command", phase: "start", command: cmd, positional, flags: sanitizeFlagsForTrace(flags) });
9246
9067
  try {