@wirecat/bitrix24-cli 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/README.md +84 -9
  3. package/dist/api-keys.d.ts +36 -9
  4. package/dist/api-keys.d.ts.map +1 -1
  5. package/dist/api-keys.js +139 -19
  6. package/dist/api-keys.js.map +1 -1
  7. package/dist/bin/b24.js +2 -2
  8. package/dist/bitrix/errors.js +1 -1
  9. package/dist/bitrix/errors.js.map +1 -1
  10. package/dist/bitrix/methods.d.ts.map +1 -1
  11. package/dist/bitrix/methods.js +7 -3
  12. package/dist/bitrix/methods.js.map +1 -1
  13. package/dist/bitrix/transport.d.ts +4 -7
  14. package/dist/bitrix/transport.d.ts.map +1 -1
  15. package/dist/bitrix/transport.js +29 -19
  16. package/dist/bitrix/transport.js.map +1 -1
  17. package/dist/body.d.ts +14 -0
  18. package/dist/body.d.ts.map +1 -0
  19. package/dist/body.js +44 -0
  20. package/dist/body.js.map +1 -0
  21. package/dist/bundle/{chunk-QIPTIUMJ.js → all-profiles-CANIDIDS.js} +12 -7
  22. package/dist/bundle/{anthropic-RHRAVHC2.js → anthropic-JUJB4DCF.js} +5 -5
  23. package/dist/bundle/{app-server-QIT6S7AZ.js → app-server-3V5Z4PTK.js} +68 -54
  24. package/dist/bundle/b24.js +18 -12
  25. package/dist/bundle/{bun-H6RSODZ3.js → bun-LKMV5TY7.js} +2 -2
  26. package/dist/bundle/{bun-sqlite-BO4LTQHX.js → bun-sqlite-S56EF74S.js} +3 -3
  27. package/dist/bundle/{chunk-D5S6QV6R.js → chunk-2I4KWS3H.js} +6 -6
  28. package/dist/bundle/chunk-36PO5NWY.js +147 -0
  29. package/dist/bundle/{chunk-ZIAQPTUS.js → chunk-42F7Q7V6.js} +3 -3
  30. package/dist/bundle/{chunk-6WY72XVQ.js → chunk-4D3K6GZW.js} +18 -4
  31. package/dist/bundle/chunk-5D4MJQ6X.js +22 -0
  32. package/dist/bundle/chunk-5JOPERVF.js +84 -0
  33. package/dist/bundle/chunk-6A4UPWDC.js +15 -0
  34. package/dist/bundle/{chunk-P33NDCDI.js → chunk-6MGWIZG4.js} +1 -1
  35. package/dist/bundle/{chunk-ZDQQCXFG.js → chunk-6YJTNZ7U.js} +13 -13
  36. package/dist/bundle/{chunk-MBDK4YXG.js → chunk-7FBFJ6B4.js} +4 -2
  37. package/dist/bundle/chunk-7VCMOTQP.js +55 -0
  38. package/dist/bundle/{chunk-P364PLIK.js → chunk-A5IMMGYU.js} +36 -34
  39. package/dist/bundle/{chunk-45AKJVKV.js → chunk-ASEHTBNK.js} +1 -1
  40. package/dist/bundle/{chunk-HGL63O5V.js → chunk-B6LPJYPQ.js} +2 -2
  41. package/dist/bundle/{chunk-LSPIOT6Z.js → chunk-BHEE2K6C.js} +7 -7
  42. package/dist/bundle/chunk-BYZQBE63.js +971 -0
  43. package/dist/bundle/{program-H3TGGRQ6.js → chunk-COKGNTDQ.js} +15761 -16685
  44. package/dist/bundle/{chunk-XJXONOB5.js → chunk-DVFYRQGE.js} +1 -1
  45. package/dist/bundle/{chunk-FLUEXJ4X.js → chunk-DVSIBZ3G.js} +1 -1
  46. package/dist/bundle/chunk-EJEIXC6Y.js +273 -0
  47. package/dist/bundle/chunk-EYTGCM44.js +130 -0
  48. package/dist/bundle/{chunk-IRV2PCQ2.js → chunk-EYYOKT23.js} +26 -26
  49. package/dist/bundle/{chunk-PH5FZX6E.js → chunk-FCWPIWSR.js} +2 -2
  50. package/dist/bundle/{chunk-YZ5LHE5Q.js → chunk-FSWRMQWX.js} +2 -2
  51. package/dist/bundle/{chunk-ADLS6FVG.js → chunk-FXBHOCJK.js} +1 -1
  52. package/dist/bundle/chunk-G5MW6RCM.js +723 -0
  53. package/dist/bundle/{chunk-VEWWAGTD.js → chunk-GLTKRLFT.js} +8 -8
  54. package/dist/bundle/chunk-GUUZQ7NE.js +581 -0
  55. package/dist/bundle/{chunk-QSNROIJL.js → chunk-H6RIPOOI.js} +42 -9
  56. package/dist/bundle/{chunk-H2ADPPSH.js → chunk-HGFNC4CR.js} +1819 -597
  57. package/dist/bundle/{chunk-7GRZAKBB.js → chunk-IERYD2N2.js} +6 -6
  58. package/dist/bundle/{chunk-N6FLBXZS.js → chunk-IGCLMEMB.js} +3 -3
  59. package/dist/bundle/{chunk-U5ACMCAQ.js → chunk-J7WCSZ2Q.js} +411 -919
  60. package/dist/bundle/{chunk-W5YAO5G5.js → chunk-JZYHQ4HB.js} +9 -4
  61. package/dist/bundle/{chunk-EVYSBZ3I.js → chunk-K4QM3X5F.js} +4 -4
  62. package/dist/bundle/{chunk-DTXERR44.js → chunk-KFSMY7SZ.js} +2 -2
  63. package/dist/bundle/{chunk-LRGYKOCP.js → chunk-KPEDH5T4.js} +1 -1
  64. package/dist/bundle/{chunk-XRFJWHY5.js → chunk-KUY7LII2.js} +4 -4
  65. package/dist/bundle/{chunk-QC53QBNC.js → chunk-LFXDHLFR.js} +3 -3
  66. package/dist/bundle/{chunk-CNNEA2M4.js → chunk-LGLT4JB6.js} +3 -3
  67. package/dist/bundle/{chunk-QGMDQ2PM.js → chunk-LM4OOBAW.js} +3 -3
  68. package/dist/bundle/chunk-M74BSKMA.js +234 -0
  69. package/dist/bundle/{chunk-2KCZ7BKW.js → chunk-MMMT6ORT.js} +11 -11
  70. package/dist/bundle/{chunk-WII44RXN.js → chunk-NGYD6QTE.js} +2 -2
  71. package/dist/bundle/{chunk-FOTREPNS.js → chunk-NO6QOPVT.js} +10 -19
  72. package/dist/bundle/chunk-O6XC7DZI.js +804 -0
  73. package/dist/bundle/chunk-OE3NFB53.js +64 -0
  74. package/dist/bundle/{chunk-XD4FRDSL.js → chunk-OUMFNB34.js} +13 -149
  75. package/dist/bundle/{chunk-ZGZT5S6B.js → chunk-P2RQTNVJ.js} +806 -850
  76. package/dist/bundle/{chunk-RRJNNPR4.js → chunk-PBIBGIZ7.js} +1 -1
  77. package/dist/bundle/{chunk-EXOOKUEA.js → chunk-Q6VQHTRW.js} +2 -2
  78. package/dist/bundle/{chunk-TE3FR6MI.js → chunk-QHBCNVUG.js} +5 -5
  79. package/dist/bundle/{chunk-SGRYYE4X.js → chunk-QNOXAQ6Y.js} +4 -4
  80. package/dist/bundle/{chunk-QQXH2OPB.js → chunk-R5F2O5GX.js} +15 -272
  81. package/dist/bundle/{chunk-SFRNX2TI.js → chunk-R5PBSKJL.js} +1 -1
  82. package/dist/bundle/{chunk-OTD2ZRXD.js → chunk-RS2BARUU.js} +4 -4
  83. package/dist/bundle/chunk-TG3DSPT5.js +14 -0
  84. package/dist/bundle/{chunk-BCF7P4FZ.js → chunk-U22JMKUO.js} +6 -125
  85. package/dist/bundle/chunk-U66Q5TVK.js +106 -0
  86. package/dist/bundle/{chunk-QMPN6WKD.js → chunk-UCHMQWON.js} +211 -89
  87. package/dist/bundle/{chunk-POC3V3AO.js → chunk-VMJS7FJZ.js} +526 -467
  88. package/dist/bundle/{chunk-FZL7F5NR.js → chunk-VMVAQHDC.js} +77 -615
  89. package/dist/bundle/{chunk-K3UIB6ZF.js → chunk-WWMCJFMT.js} +2 -2
  90. package/dist/bundle/{chunk-CXL33BFL.js → chunk-XTA5TN3H.js} +1 -1
  91. package/dist/bundle/{chunk-WTPMJYMD.js → chunk-XUHHBEA7.js} +652 -131
  92. package/dist/bundle/{chunk-WKRQ44EH.js → chunk-YDZHO4LT.js} +13 -13
  93. package/dist/bundle/{chunk-2SNUMZ7S.js → chunk-ZKINZFIT.js} +6 -6
  94. package/dist/bundle/{chunk-HAXNUIGQ.js → chunk-ZSQXSIFQ.js} +89 -39
  95. package/dist/bundle/{chunk-YYO7D2MO.js → chunk-ZZEHDIEG.js} +58 -54
  96. package/dist/bundle/command-contract-OQV6H7SR.js +36 -0
  97. package/dist/bundle/{decode-5ZPLTYV6.js → decode-QSTBX4MG.js} +3 -3
  98. package/dist/bundle/{echarts-J6LAPIX7.js → echarts-JZELFH2N.js} +2 -2
  99. package/dist/bundle/{embed-YG5LDHME.js → embed-4RIW2LVH.js} +4 -4
  100. package/dist/bundle/{embedder-7FNUA5OZ.js → embedder-SW7DTWSL.js} +7 -7
  101. package/dist/bundle/{first-run-JPZNWIJN.js → first-run-7AISOSOM.js} +8 -8
  102. package/dist/bundle/first-screen-NMHNFZ2B.js +34 -0
  103. package/dist/bundle/{instructions-AXWTQHMR.js → instructions-BZE5YUGG.js} +1 -1
  104. package/dist/bundle/{mcp-7F46P6AM.js → mcp-SDWHDJTY.js} +2 -2
  105. package/dist/bundle/{node-P4E63KXA.js → node-KM3CUABH.js} +9 -9
  106. package/dist/bundle/{node-CWKAIOEM.js → node-LTKZIO4U.js} +2 -2
  107. package/dist/bundle/{node-sqlite-LSEKVRDA.js → node-sqlite-HQ5PN2RH.js} +4 -4
  108. package/dist/bundle/{oauth-THYNLRLD.js → oauth-UH6FOZQL.js} +5 -5
  109. package/dist/bundle/{open-E47QYKFC.js → open-TSUP3XGL.js} +3 -3
  110. package/dist/bundle/{openai-EWSGC3BC.js → openai-GVEE52E3.js} +14 -14
  111. package/dist/bundle/{process-WKTEA3WE.js → process-AGXY76ZE.js} +1 -1
  112. package/dist/bundle/program-BI4A4HFJ.js +2247 -0
  113. package/dist/bundle/{prompt-CAQ7QR3U.js → prompt-NRSUY7FA.js} +3 -3
  114. package/dist/bundle/{recognize-6KGHNZC3.js → recognize-NPDPQ6PJ.js} +2 -2
  115. package/dist/bundle/{remote-3UO2WDC3.js → remote-HFASMVLB.js} +5 -5
  116. package/dist/bundle/{rerank-2JVDPZBX.js → rerank-TL6Z6F7K.js} +5 -5
  117. package/dist/bundle/{chunk-VL6SPMZV.js → serve-VB4DHDZQ.js} +8 -6
  118. package/dist/bundle/server-T5EDRPJI.js +68 -0
  119. package/dist/bundle/{chunk-ZEW4P6AH.js → server-Z6MW6C37.js} +50 -14
  120. package/dist/bundle/source-4IGO5J7E.js +237 -0
  121. package/dist/bundle/sqlite-runtime-YS4POY3W.js +17 -0
  122. package/dist/bundle/{state-7NH5G4XJ.js → state-ISZVVZGR.js} +4 -4
  123. package/dist/bundle/store-IZJBAKJV.js +58 -0
  124. package/dist/bundle/{store-7O4JQD2Z.js → store-L76MSQC3.js} +17 -12
  125. package/dist/bundle/store-PBTIB7BD.js +207 -0
  126. package/dist/bundle/store-maintenance-command-YFKII7TF.js +58 -0
  127. package/dist/bundle/writer-3O5EYMFE.js +214 -0
  128. package/dist/commands/api.d.ts.map +1 -1
  129. package/dist/commands/api.js +81 -30
  130. package/dist/commands/api.js.map +1 -1
  131. package/dist/commands/crm-shared.d.ts +4 -0
  132. package/dist/commands/crm-shared.d.ts.map +1 -0
  133. package/dist/commands/crm-shared.js +94 -0
  134. package/dist/commands/crm-shared.js.map +1 -0
  135. package/dist/commands/crm-writes.d.ts +0 -1
  136. package/dist/commands/crm-writes.d.ts.map +1 -1
  137. package/dist/commands/crm-writes.js +43 -88
  138. package/dist/commands/crm-writes.js.map +1 -1
  139. package/dist/commands/crm.d.ts.map +1 -1
  140. package/dist/commands/crm.js +30 -48
  141. package/dist/commands/crm.js.map +1 -1
  142. package/dist/commands/session.d.ts.map +1 -1
  143. package/dist/commands/session.js +1 -0
  144. package/dist/commands/session.js.map +1 -1
  145. package/dist/commands/write.d.ts +6 -6
  146. package/dist/commands/write.d.ts.map +1 -1
  147. package/dist/commands/write.js +11 -18
  148. package/dist/commands/write.js.map +1 -1
  149. package/dist/config.d.ts +0 -5
  150. package/dist/config.d.ts.map +1 -1
  151. package/dist/config.js +6 -8
  152. package/dist/config.js.map +1 -1
  153. package/dist/crm/capabilities.d.ts +7 -0
  154. package/dist/crm/capabilities.d.ts.map +1 -0
  155. package/dist/crm/capabilities.js +7 -0
  156. package/dist/crm/capabilities.js.map +1 -0
  157. package/dist/crm/conditions.d.ts +1 -1
  158. package/dist/crm/conditions.d.ts.map +1 -1
  159. package/dist/crm/conditions.js +4 -6
  160. package/dist/crm/conditions.js.map +1 -1
  161. package/dist/crm/custom-query.d.ts +19 -0
  162. package/dist/crm/custom-query.d.ts.map +1 -0
  163. package/dist/crm/custom-query.js +79 -0
  164. package/dist/crm/custom-query.js.map +1 -0
  165. package/dist/crm/deal.d.ts +4 -27
  166. package/dist/crm/deal.d.ts.map +1 -1
  167. package/dist/crm/deal.js +15 -48
  168. package/dist/crm/deal.js.map +1 -1
  169. package/dist/crm/fields.d.ts +20 -0
  170. package/dist/crm/fields.d.ts.map +1 -0
  171. package/dist/crm/fields.js +78 -0
  172. package/dist/crm/fields.js.map +1 -0
  173. package/dist/crm/items.d.ts +7 -1
  174. package/dist/crm/items.d.ts.map +1 -1
  175. package/dist/crm/items.js +21 -18
  176. package/dist/crm/items.js.map +1 -1
  177. package/dist/crm/lead.d.ts +5 -36
  178. package/dist/crm/lead.d.ts.map +1 -1
  179. package/dist/crm/lead.js +15 -61
  180. package/dist/crm/lead.js.map +1 -1
  181. package/dist/crm/organization.d.ts +1 -0
  182. package/dist/crm/organization.d.ts.map +1 -1
  183. package/dist/crm/person.d.ts +1 -0
  184. package/dist/crm/person.d.ts.map +1 -1
  185. package/dist/crm/pipelines.d.ts +5 -0
  186. package/dist/crm/pipelines.d.ts.map +1 -0
  187. package/dist/crm/pipelines.js +54 -0
  188. package/dist/crm/pipelines.js.map +1 -0
  189. package/dist/crm/product.d.ts.map +1 -1
  190. package/dist/crm/product.js +2 -2
  191. package/dist/crm/product.js.map +1 -1
  192. package/dist/crm/rest3-fields.d.ts +3 -0
  193. package/dist/crm/rest3-fields.d.ts.map +1 -0
  194. package/dist/crm/rest3-fields.js +38 -0
  195. package/dist/crm/rest3-fields.js.map +1 -0
  196. package/dist/crm/source.d.ts +15 -0
  197. package/dist/crm/source.d.ts.map +1 -0
  198. package/dist/crm/source.js +122 -0
  199. package/dist/crm/source.js.map +1 -0
  200. package/dist/crm/user.d.ts.map +1 -1
  201. package/dist/crm/user.js +2 -2
  202. package/dist/crm/user.js.map +1 -1
  203. package/dist/crm/values.d.ts +26 -5
  204. package/dist/crm/values.d.ts.map +1 -1
  205. package/dist/crm/values.js +40 -5
  206. package/dist/crm/values.js.map +1 -1
  207. package/dist/crm/writer.d.ts +9 -0
  208. package/dist/crm/writer.d.ts.map +1 -0
  209. package/dist/crm/writer.js +119 -0
  210. package/dist/crm/writer.js.map +1 -0
  211. package/dist/program.d.ts.map +1 -1
  212. package/dist/program.js +53 -5
  213. package/dist/program.js.map +1 -1
  214. package/dist/reasons.d.ts.map +1 -1
  215. package/dist/reasons.js +6 -1
  216. package/dist/reasons.js.map +1 -1
  217. package/dist/store.d.ts +15 -0
  218. package/dist/store.d.ts.map +1 -0
  219. package/dist/store.js +33 -0
  220. package/dist/store.js.map +1 -0
  221. package/dist/version.d.ts +1 -1
  222. package/dist/version.js +1 -1
  223. package/package.json +4 -6
  224. package/skills/bitrix24-cli/SKILL.md +16 -10
  225. package/dist/bundle/all-profiles-QJ444GSX.js +0 -24
  226. package/dist/bundle/chunk-XNHSPHUN.js +0 -48
  227. package/dist/bundle/command-contract-OKQOE6G4.js +0 -30
  228. package/dist/bundle/first-screen-VQM4MTS7.js +0 -28
  229. package/dist/bundle/mcp-5RSWNTHS.js +0 -160
  230. package/dist/bundle/mcp-J5R5A65I.js +0 -87
  231. package/dist/bundle/serve-ES7AG5IK.js +0 -19
  232. package/dist/bundle/server-5LE5LNUQ.js +0 -45
  233. package/dist/bundle/server-BU4VBM6S.js +0 -58
  234. package/dist/bundle/store-maintenance-command-UDVGEY2D.js +0 -47
  235. package/dist/commands/doctor.d.ts +0 -77
  236. package/dist/commands/doctor.d.ts.map +0 -1
  237. package/dist/commands/doctor.js +0 -74
  238. package/dist/commands/doctor.js.map +0 -1
  239. package/dist/commands/mcp.d.ts +0 -3
  240. package/dist/commands/mcp.d.ts.map +0 -1
  241. package/dist/commands/mcp.js +0 -97
  242. package/dist/commands/mcp.js.map +0 -1
  243. package/dist/crm/pipeline.d.ts +0 -17
  244. package/dist/crm/pipeline.d.ts.map +0 -1
  245. package/dist/crm/pipeline.js +0 -42
  246. package/dist/crm/pipeline.js.map +0 -1
  247. package/dist/crm/stage.d.ts +0 -20
  248. package/dist/crm/stage.d.ts.map +0 -1
  249. package/dist/crm/stage.js +0 -65
  250. package/dist/crm/stage.js.map +0 -1
  251. package/dist/mcp.d.ts +0 -29
  252. package/dist/mcp.d.ts.map +0 -1
  253. package/dist/mcp.js +0 -99
  254. package/dist/mcp.js.map +0 -1
  255. /package/dist/bundle/{chunk-4PDYYS5K.js → chunk-ZQ3GWKDQ.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,136 @@
2
2
 
3
3
  Notable changes to `@wirecat/bitrix24-cli`. One section per version, newest first.
4
4
 
5
+ ## 0.5.0 — 07.11.2026
6
+
7
+ ### Added
8
+
9
+ - `sync` copies the portal's pipelines, companies, contacts, deals and leads into the local WireCat store: what changed
10
+ since the last sync, or everything with `--rescan`; once a day it also finds what the portal deleted. `store status`
11
+ says how far each kind is. A sync stops before its deadline or `--max-pages`, and the next one goes on from there.
12
+ - `deals close <ref> won|lost` and `leads close`, to the first won or lost stage of the record's pipeline, and
13
+ `deals delete` and `leads delete`, which ask first.
14
+ - `deals create` and `update` take `--pipeline`, `--stage`, `--amount` with `--currency`, `--close-date` and
15
+ `--owner`; leads take the same but `--close-date`. A stage checks the move key, a won or lost one the close key too.
16
+ - `search all` finds stored deals and leads beside the other WireCat tools' messages, notes and events. Under
17
+ `deals.list: deny` it leaves deals out and names them in `missing` and on stderr, and the same for leads; with every
18
+ kind it was asked for denied, it is refused (`search.all-denied`).
19
+ - `b24 --help` and a bare `b24` open with what `b24` is for, what to try first, and where to start.
20
+
21
+ ### Changed — may break callers
22
+
23
+ - `deals`, `leads`, `pipelines` and `stages` are cli-core's shared CRM commands, the same in every WireCat CRM tool.
24
+ Their lists and `show` read the local store, so run `sync` first; `--offline` works for them now.
25
+ - A deal or lead is named by its ref, `deal:12` or `lead:7`, as a list prints it, not by its Bitrix24 id or title.
26
+ - A deal or lead answers `ref`, `pipeline` and `pipeline_name`, `stage` (its name), `status` (`open`, `won` or `lost`),
27
+ `close_date`, `amount` as a decimal string in `currency`, both `null` with no amount, `assignee` as
28
+ `<portal>/user/<id>`, and the portal's own fields in `provider_metadata` by code. `stage_id`, `pipeline_id`,
29
+ `outcome`, `closes_on`, `assigned_to` and `person_ids` are gone from them; contacts are in `people`, the company in
30
+ `organization`.
31
+ - Their list query takes `status`, `stage`, `pipeline` and `organization`; the free word, the time windows and the
32
+ portal's own fields are gone from it. `--all` is gone from those lists.
33
+ - `deals move <ref> <stage>` takes the stage as an argument, not `--stage`.
34
+ - Deal and lead writes have no `--body`. `--field <label or code>=<value>` sets a custom field by the definitions the
35
+ last `sync` stored: a list field takes its option's label or id, a multiple field one `--field` per value, and an
36
+ empty value clears it. A code that names a standard field (`stageId`, `categoryId`, `assignedById`, a lead's
37
+ `STATUS_ID`) is refused, and so is a `--field` with no key before its `=`.
38
+ - A custom field's label and a list option's label are matched as cli-core matches names, for every `--field` and
39
+ query: `е` finds `ё`, and a letter typed as two code points finds the same letter typed as one. `people show` and
40
+ `organizations show` compare a name with the portal's matches the same way. A label that matched one field may now
41
+ match two, which is refused with both.
42
+ - `fields list <deals|leads|people|organizations>` is cli-core's: it reads the definitions `sync` stored, so run
43
+ `sync` first, and each field names its `untrusted` parts.
44
+ - `api.crm.deal.update` (and the other deal and lead `api.*` keys) at `ask` now asks on `deals update`, `move` and
45
+ `close` too, not only on `api call`. `--dry-run` of a deal or lead write names every key it may check: the
46
+ `api.*` key, and the move, close and `crm.assign-others` keys with the option that would make each apply.
47
+ - `sync` reads the portal's field definitions of each kind, one more request per kind, so `--max-pages` reaches the
48
+ records later. A webhook without the rights to read them still syncs; any other failure there fails the sync.
49
+ - Leads stand in one pipeline named `Leads`, since Bitrix24's leads have none.
50
+ - `deals.delete` and `leads.delete` default to `ask`; `api call` that sets a stage checks `deals.close` (or
51
+ `leads.close`) as well as `deals.move`.
52
+ - `mcp` and `doctor` are cli-core's shared commands: `mcp` adds `config`, `add` and `check`, and `--profiles` and
53
+ `--permission` on `serve`; `doctor` adds `--online`.
54
+ - A `--body` or `api call` method that could be read in more than one way is refused before anything is sent: a
55
+ body that names one field twice in any spelling, an `entityTypeId` that is not a plain number, a `fields` that is
56
+ not an object, a method with any suffix but one `.json`, and a `crm.item` method without `entityTypeId`. Send each
57
+ field once, under one spelling.
58
+ - `--operation-id` is gone from every write. On a live portal a create repeated with the same id made a second
59
+ record, so a repeat is never safe: after `outcome_unknown`, `sync` and `show` the record and write it again only if
60
+ it is not there. A deal or lead write given `--operation-id` is refused before anything is sent.
61
+
62
+ ### Fixed
63
+
64
+ - A `sync` after the first one works. It asked the portal for what changed with a time the portal refuses, so
65
+ every kind failed and nothing new was copied. Times in a filter now go in whole seconds with an offset, which also
66
+ fixes `updated_at:` and `created_at:` in `people list` and `organizations list`.
67
+ - A write answered with a server or gateway failure (500, 502, 504) is `outcome_unknown`, not `provider_unavailable`:
68
+ the portal may have made it. A write a cancel cuts is `outcome_unknown` too, never `cancelled`.
69
+ - Stages are read page by page: a directory past REST 2's first 50 rows lost its later stages.
70
+ - An id or owner that is not a number is refused before anything is sent; it went out empty before.
71
+ - `--body` keeps integers past 2^53 as typed; `api call --body -` reads the body from stdin.
72
+ - A request that gets no answer is cut after 10 seconds, not 30, so a read can be tried again before a one-shot
73
+ command's own 30 s run out.
74
+ - `show` for people and organizations fails when the portal's field labels fail for a reason other than missing
75
+ rights, instead of showing the record without its labels.
76
+
77
+ ### Security
78
+
79
+ - Permission checks on `api call` and on `people` and `organizations` writes read a body exactly as it is sent, so
80
+ the key they check is the key the write needs.
81
+ - `api call` reads check the same keys as the commands that read those records, as its writes already did.
82
+
83
+ ## 0.4.0 — 06.11.2026
84
+
85
+ ### Added
86
+
87
+ - `create` and `update` for deals, leads, people and organizations take `--field "<label or code>=<value>"`, repeated
88
+ for more fields or for each value of a multiple field. The label is looked up on the portal; two fields with that
89
+ label are refused with their codes. A list field takes its option's label or id. `--field` wins over `--body` for the
90
+ same field, and `--title`, `--name`, `--first-name` and `--last-name` win over both. Other values go to the portal as
91
+ typed. `--dry-run` does not look the names up.
92
+ - `list` for deals, leads, people and organizations filters by the portal's own fields: `<code or label>:<value>`,
93
+ for the fields the portal can filter by; a list field takes its option's label or id. A label with spaces is
94
+ written `lead_source:web` or `Lead\ source:web`.
95
+ - `list --json=…,provider_metadata.<code>` adds that custom field to each item, as `show` gives it;
96
+ `--json=…,provider_metadata` adds every one. Only codes the portal lists are asked for.
97
+ - `fields list <deals|leads|people|organizations>` lists the portal's custom fields of that kind: code, label, type,
98
+ whether it holds several values, whether a list can filter by it, and a list field's options with their ids.
99
+
100
+ ### Changed — may break callers
101
+
102
+ - `show` gives a list field's value by its option's label, not its id; the id moves to `option_id` beside it. A field
103
+ that holds several options gives both as arrays.
104
+ - `api call` works from an allow list. The CRM, catalog and user reads and the four CRM types' writes are allowed as
105
+ before. Any other method asks, so it needs `--yes` without a terminal, and the families that message people, publish
106
+ or send data out are denied: `imconnector`, `log.blogpost`, public file links and `event.bind` join `im`,
107
+ `imopenlines` and the rest. `api show` names each method's level.
108
+
109
+ ### Fixed
110
+
111
+ - A `deny` in a profile stops a read command again. `b24` handed cli-core only `resolveSettings`, so cli-core never
112
+ saw b24's permission table: `deals.list: deny` did not stop `deals list`, over MCP too, and with any b24 key in the
113
+ config every `--dry-run` failed with "names no command".
114
+ - `api.crm.<type>.add` and `api.crm.<type>.update` now hold on `deals`, `leads`, `people` and `organizations`
115
+ `create`, `update` and `move`, as the command keys already held on `api call`. `--dry-run` names them beside the
116
+ command's own key.
117
+ - `api call --dry-run` names every key the call checks with its level, such as `api.crm.deal.delete` at `ask`, instead
118
+ of "no key, allowed".
119
+ - `api call crm.item.add|update|delete` with `entityTypeId` 1 to 4 checks the lead, deal, contact or company command
120
+ key, as `crm.deal.update` already did: `deals.delete: deny` now stops `crm.item.delete` for a deal.
121
+ - Every method whose name ends in `delete` asks, not only the listed ones. A method name in capitals or with a `.json`
122
+ suffix is read as its plain name, so it no longer gets round a key.
123
+ - A write that sets a stage checks `deals.move` or `leads.move`: `update` and `create` with `stageId` in `--body`, over
124
+ MCP too, and `api call` with `STAGE_ID` or a lead's `STATUS_ID`. `ASSIGNED_BY_ID` checks `crm.assign-others` like
125
+ `assignedById`.
126
+ - A write is sent once. A REST 3.0 write that got no answer was sent up to three more times with the same
127
+ `Idempotency-Key`, which is not yet checked on a live portal; it is now `outcome_unknown` at once, and its message
128
+ names `--operation-id` once.
129
+ - `pipeline_id:0`, the default pipeline, is accepted by `deals list` and `stages list`.
130
+ - The allow list keeps the denied families' reads refused, as before it: `crm.activity.list`, `im.*`, `tasks.*` and
131
+ the rest are `deny`, and `api show` says so.
132
+ - The MCP server applies b24's permission table (WC-PERM-23): a command the profile denies is listed by tools search
133
+ as unavailable, not offered as available.
134
+
5
135
  ## 0.3.0 — 06.11.2026
6
136
 
7
137
  ### Changed — may break callers
package/README.md CHANGED
@@ -1,18 +1,93 @@
1
- # b24
1
+ # b24 — Bitrix24 CRM CLI for AI agents
2
2
 
3
3
  `b24` reads and changes a Bitrix24 portal's sales data from the terminal, from scripts and from AI agents: deals,
4
4
  leads, contacts, companies, pipelines and their stages, products and employees. It signs in with one of the portal's
5
- incoming webhooks and acts with the rights of the employee who made it.
5
+ incoming webhooks and acts with the rights of the employee who made it. Deals and leads are copied into the local
6
+ [WireCat](https://wirecat.dev) store, so lists and search work offline, beside your other WireCat tools' data.
7
+
8
+ ## Quick start
6
9
 
7
10
  ```sh
8
11
  npm install -g @wirecat/bitrix24-cli
12
+ b24 skill install # the agent skill, for Claude Code, Codex, Gemini CLI and OpenClaw
9
13
  b24 work session start # paste the webhook address; it is kept in the keyring
10
- b24 work deals list outcome:open
11
- b24 work leads list updated_at>=7d --json
12
- b24 work deals move 42 --stage "Contract signed"
14
+ b24 work sync # copies pipelines, companies, contacts, deals and leads into the local store
15
+ b24 work deals list status:open
16
+ ```
17
+
18
+ `work` is a profile: a name you choose for one portal. It is the first word of every command that uses an account,
19
+ and none is ever assumed. Make the webhook in Bitrix24 under Developer resources → Other → Incoming webhook, with the
20
+ scopes `crm` and `user`. You need Node.js 22.16 or a later 22.x, or Node.js 24 or later. `b24 doctor` needs no
21
+ network and shows what is set up.
22
+
23
+ More: [installation](docs/installation.md), [usage](docs/usage.md).
24
+
25
+ ## What you can do
26
+
27
+ ```sh
28
+ b24 work leads list stage:"In progress" --json # from the store, offline too
29
+ b24 work deals move deal:42 "Contract signed" # checks deals.move, and deals.close for a won or lost stage
30
+ b24 work search all kitchen # stored deals and leads beside your other WireCat data
31
+ b24 work people update 4 --body '{"post":"Buyer"}' # a contact, in Bitrix24's own field names
32
+ b24 work api call crm.deal.fields --dry-run # any REST method, with every permission it checks
13
33
  ```
14
34
 
15
- Every command answers JSON with `--json`, every write answers an `operation_id` and can be previewed with
16
- `--dry-run`, and `b24 work mcp serve` gives the same commands to an agent. Start with
17
- [installation](docs/installation.md), then [usage](docs/usage.md). The design is in
18
- [docs/dev/DESIGN.md](docs/dev/DESIGN.md).
35
+ Every write answers an `operation_id` and can be previewed with `--dry-run`. More: [usage](docs/usage.md) and the
36
+ [command reference](docs/commands.md).
37
+
38
+ ## For AI agents
39
+
40
+ - **An agent with a terminal** (Claude Code, Codex, Gemini CLI, OpenClaw): `b24 skill install` writes the skill, the
41
+ agent's instruction sheet.
42
+ - **An MCP client**: `b24 work mcp serve`, or `b24 work mcp add claude-code`. `mcp serve --permission deals=deny`
43
+ tightens the levels for one server; an agent can never loosen them.
44
+ - **ChatGPT or Claude in a browser**: `b24 work mcp serve --http` behind your own tunnel.
45
+
46
+ Text from the portal is marked `untrusted` in MCP answers: it is data for the agent, never instructions. `api call`
47
+ and `session start`/`end` are never offered over MCP. With `--json`, every command prints one JSON value, and an error
48
+ comes as JSON with a code to branch on.
49
+
50
+ More: [agents](docs/usage.md#agents).
51
+
52
+ ## Settings and permissions
53
+
54
+ Each profile has a permission level for every command and every REST method: `allow`, `ask`, `readonly` or `deny`.
55
+ Assigning a record to another employee is denied until you allow it, a delete asks first, and methods that message
56
+ people, publish or start the portal's automation are denied, reads too. A stage change can start the portal's own
57
+ robots, which may write to your clients: set `permissions.deals.move` to `ask` if your portal has such robots.
58
+ `B24_READ_ONLY=1` refuses every write.
59
+
60
+ More: [settings](docs/configuration.md#permissions), [security](docs/security.md).
61
+
62
+ ## Limits
63
+
64
+ - The portal allows about 2 requests a second for all its apps together; `b24` keeps to that pace.
65
+ - `people`, `organizations`, `products`, `users` and `fields` still ask the portal on every read and refuse
66
+ `--offline`.
67
+ - Bitrix24 does a repeated write again: on a live portal, a create repeated with the same `Idempotency-Key` made a
68
+ second record. After an `outcome_unknown`, look at the record before you write it again.
69
+
70
+ ## Security
71
+
72
+ The webhook address is the password: anyone who has it can do what its employee can. `b24` keeps it in the system
73
+ keyring and never prints it, in output, errors or run records. Report a vulnerability as [SECURITY.md](SECURITY.md)
74
+ says.
75
+
76
+ ## When it does not work
77
+
78
+ Start with `b24 doctor`, then [troubleshooting](docs/troubleshooting.md).
79
+
80
+ ## Documentation
81
+
82
+ - [Install](docs/installation.md) · [Use it](docs/usage.md) · [Settings](docs/configuration.md) ·
83
+ [Security](docs/security.md) · [Commands](docs/commands.md) · [Troubleshooting](docs/troubleshooting.md)
84
+ - The design: [docs/dev/DESIGN.md](docs/dev/DESIGN.md).
85
+
86
+ ## Part of WireCat
87
+
88
+ `b24` is one of the [WireCat](https://wirecat.dev) tools. They share one local store, so `search all` and an agent see
89
+ your CRM beside your messages, mail, notes and meetings.
90
+
91
+ ## License
92
+
93
+ [Apache-2.0](LICENSE).
@@ -1,20 +1,47 @@
1
+ import type { DealKind } from "@wirecat/cli-core";
2
+ import type { CrmVerb } from "@wirecat/cli-core/crm";
1
3
  import type { Level } from "@wirecat/cli-core/sends";
2
4
  import { type Effect } from "./bitrix/methods.js";
5
+ import { type Body } from "./body.js";
3
6
  export declare const apiKey: (method: string) => string;
4
7
  /**
5
- * Families whose writes reach people or start the portal's own automation: messages and notifications (im,
6
- * imopenlines, imbot; read-only for now, NEED-2278 A), SMS and mail services, telephony, workflows, CRM activities
7
- * (an e-mail activity sends the mail), tasks (the assignee is told), invitations (`user.add` mails one), and `batch`,
8
- * which can hold any of them. Denied until the owner allows them.
8
+ * Families whose writes reach people, publish, or start the portal's own automation: messages and notifications (im,
9
+ * imopenlines, imbot, imconnector's Open Lines; read-only for now, NEED-2278 A), Live Feed posts, SMS and mail
10
+ * services, telephony, workflows, CRM activities (an e-mail activity sends the mail), tasks (the assignee is told),
11
+ * invitations (`user.add` mails one), public file links, event handlers that send portal data to a URL, and `batch`,
12
+ * which can hold any of them. Denied until the owner allows them, reads too: they hold messages, e-mails and tasks.
9
13
  */
10
14
  export declare const DENIED_FAMILIES: string[];
11
- /** A method's default, as WC-PERM-22 has it: a read and an ordinary change allowed, a delete asked. */
12
- export declare const apiDefault: (method: string, effect?: Effect) => Level;
15
+ /** Bitrix24 takes a method in any letter case and with a `.json` suffix; one name keeps the keys from being dodged. */
16
+ export declare const normalMethod: (raw: string) => string;
17
+ /** A field in any letter case, with or without underscores: `parseBody` has refused a body that spells one twice. */
18
+ export declare const fieldOf: (record: Body, name: string) => unknown;
19
+ export declare const fieldsOf: (body: Body) => Record<string, unknown>;
20
+ /** The employee a write assigns the record to, by any spelling of `assignedById`. */
21
+ export declare const assigneeOf: (fields: Body) => string | undefined;
22
+ /** Whether a write changes a deal's or a lead's stage: `stageId`, or a lead's REST 2 `STATUS_ID`. */
23
+ export declare const setsStage: (type: string, fields: Record<string, unknown>) => boolean;
24
+ /** What `api call` sends, checked once: the body `parseBody` gave, its `fields` an object and its type a number. */
25
+ export declare const checkCall: (method: string, body: Body) => void;
13
26
  /**
14
- * The command key a raw call does the same as, so `api call crm.deal.update` cannot get round `deals.update: deny`
15
- * (gcal-cli's `WRITE_METHODS`). An update that sets a stage is a move too.
27
+ * The command keys a raw call does the same as, so `api call` cannot get round `deals: deny` (gcal-cli's
28
+ * `WRITE_METHODS`, WC-PERM-22). A create or update that sets a stage is a move too.
16
29
  */
17
- export declare const commandKeysOf: (method: string, body?: Record<string, unknown>) => string[];
30
+ export declare const commandKeysOf: (method: string, body?: Body) => string[];
31
+ /**
32
+ * A method's default, as WC-PERM-22 has it, from an allow list: the reads `b24` makes and the CRM writes the command
33
+ * keys govern are allowed, a delete and anything else asks, and the families that reach people are denied, reads too.
34
+ */
35
+ export declare const apiDefault: (method: string, effect?: Effect, body?: Body) => Level;
36
+ /** The built-in levels with this call's own key, which the static table cannot list for every method. */
37
+ export declare const callDefaults: (method: string, effect: Effect, body: Body, defaults: Readonly<Record<string, Level>>) => Record<string, Level>;
38
+ /**
39
+ * The `api.*` key a deal's or lead's write sends its request under, so `api.crm.deal.update: deny` holds on `deals
40
+ * update` too: core's `CrmWrites.alsoChecks` and, through `crmAlsoChecks`, its `--dry-run`.
41
+ */
42
+ export declare const crmApiKeys: (kind: DealKind, verb: CrmVerb) => string[];
43
+ /** The same for b24's own `people` and `organizations` writes, by command path. */
44
+ export declare const apiKeysOf: (path: readonly string[]) => string[];
18
45
  /** The keys `permissions` may name for `api`: the known methods and the denied families. */
19
46
  export declare const API_KEYS: string[];
20
47
  export declare const API_DEFAULTS: Record<string, Level>;
@@ -1 +1 @@
1
- {"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../src/api-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,KAAK,MAAM,EAA2B,MAAM,qBAAqB,CAAA;AAE1E,eAAO,MAAM,MAAM,WAAY,MAAM,KAAG,MAAyB,CAAA;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,eAAe,UAe3B,CAAA;AAKD,uGAAuG;AACvG,eAAO,MAAM,UAAU,WAAY,MAAM,WAAU,MAAM,KAA6B,KAGrF,CAAA;AAKD;;;GAGG;AACH,eAAO,MAAM,aAAa,WAAY,MAAM,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAQ,MAAM,EASxF,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O,MAAM,UAAU,WAAY,MAAM,WAAU,MAAM,SAAkC,IAAI,KAAQ,KAKtG,CAAA;AAED,yGAAyG;AACzG,eAAO,MAAM,YAAY,WACf,MAAM,UACN,MAAM,QACR,IAAI,YACA,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,KACxC,MAAM,CAAC,MAAM,EAAE,KAAK,CAA0E,CAAA;AAUjG;;;GAGG;AACH,eAAO,MAAM,UAAU,SAAU,QAAQ,QAAQ,OAAO,KAAG,MAAM,EAA8C,CAAA;AAI/G,mFAAmF;AACnF,eAAO,MAAM,SAAS,SAAU,SAAS,MAAM,EAAE,KAAG,MAAM,EAKzD,CAAA;AAED,4FAA4F;AAC5F,eAAO,MAAM,QAAQ,UAAoF,CAAA;AAEzG,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAQ9C,CAAA"}
package/dist/api-keys.js CHANGED
@@ -1,15 +1,20 @@
1
+ import { CliError } from "@wirecat/cli-base";
1
2
  import { KNOWN_METHODS, methodOf } from "./bitrix/methods.js";
3
+ import { foldCode, isRecord, jsonNumber } from "./body.js";
2
4
  export const apiKey = (method) => `api.${method}`;
3
5
  /**
4
- * Families whose writes reach people or start the portal's own automation: messages and notifications (im,
5
- * imopenlines, imbot; read-only for now, NEED-2278 A), SMS and mail services, telephony, workflows, CRM activities
6
- * (an e-mail activity sends the mail), tasks (the assignee is told), invitations (`user.add` mails one), and `batch`,
7
- * which can hold any of them. Denied until the owner allows them.
6
+ * Families whose writes reach people, publish, or start the portal's own automation: messages and notifications (im,
7
+ * imopenlines, imbot, imconnector's Open Lines; read-only for now, NEED-2278 A), Live Feed posts, SMS and mail
8
+ * services, telephony, workflows, CRM activities (an e-mail activity sends the mail), tasks (the assignee is told),
9
+ * invitations (`user.add` mails one), public file links, event handlers that send portal data to a URL, and `batch`,
10
+ * which can hold any of them. Denied until the owner allows them, reads too: they hold messages, e-mails and tasks.
8
11
  */
9
12
  export const DENIED_FAMILIES = [
10
13
  "im",
11
14
  "imopenlines",
12
15
  "imbot",
16
+ "imconnector",
17
+ "log.blogpost",
13
18
  "messageservice",
14
19
  "mailservice",
15
20
  "telephony",
@@ -20,32 +25,147 @@ export const DENIED_FAMILIES = [
20
25
  "tasks",
21
26
  "task",
22
27
  "user.add",
28
+ "disk.file.getexternallink",
29
+ "disk.folder.getexternallink",
30
+ "event.bind",
23
31
  "batch",
24
32
  ];
25
- const deniedFamily = (method) => DENIED_FAMILIES.some((family) => method === family || method.startsWith(`${family}.`));
26
- /** A method's default, as WC-PERM-22 has it: a read and an ordinary change allowed, a delete asked. */
27
- export const apiDefault = (method, effect = methodOf(method).effect) => {
28
- if (effect !== "read" && deniedFamily(method))
29
- return "deny";
30
- return effect === "destructive" ? "ask" : "allow";
33
+ /** The families `b24` reads itself: a read outside them asks, since it may hold what the owner keeps from agents. */
34
+ const READ_FAMILIES = ["crm", "catalog", "user", "profile", "methods", "method", "scope", "server.time", "app.info"];
35
+ const inFamily = (families, method) => families.some((family) => method === family || method.startsWith(`${family}.`));
36
+ /** Bitrix24 takes a method in any letter case and with a `.json` suffix; one name keeps the keys from being dodged. */
37
+ export const normalMethod = (raw) => raw.toLowerCase().replace(/\.json$/, "");
38
+ /** A field in any letter case, with or without underscores: `parseBody` has refused a body that spells one twice. */
39
+ export const fieldOf = (record, name) => {
40
+ const wanted = foldCode(name);
41
+ const found = Object.keys(record).find((one) => foldCode(one) === wanted);
42
+ return found === undefined ? undefined : record[found];
43
+ };
44
+ export const fieldsOf = (body) => {
45
+ const fields = fieldOf(body, "fields");
46
+ return isRecord(fields) ? fields : {};
31
47
  };
48
+ /** The employee a write assigns the record to, by any spelling of `assignedById`. */
49
+ export const assigneeOf = (fields) => {
50
+ const found = fieldOf(fields, "assignedById");
51
+ return found === undefined || found === null ? undefined : String(found);
52
+ };
53
+ /** Whether a write changes a deal's or a lead's stage: `stageId`, or a lead's REST 2 `STATUS_ID`. */
54
+ export const setsStage = (type, fields) => (type === "deal" || type === "lead") &&
55
+ (fieldOf(fields, "stageId") !== undefined || (type === "lead" && fieldOf(fields, "statusId") !== undefined));
32
56
  const NOUNS = { deal: "deals", lead: "leads", contact: "people", company: "organizations" };
33
57
  const ACTIONS = { add: "create", update: "update", delete: "delete" };
58
+ /** `crm.item.*`'s `entityTypeId` for the four types the commands cover (apidocs "crm.item.add"). */
59
+ const ENTITY_TYPES = { "1": "lead", "2": "deal", "3": "contact", "4": "company" };
60
+ const refused = (message) => new CliError("validation_error", message, { param: "--body", reason: "body.invalid", sent: false });
61
+ /** `"02"`, `" 2"` or `"2.0"` would name no type here while the portal may read them as deals: only digits pass. */
62
+ const entityTypeOf = (body) => {
63
+ const given = fieldOf(body, "entityTypeId");
64
+ if (given === undefined)
65
+ return undefined;
66
+ const digits = jsonNumber(given) ?? (typeof given === "string" ? given : typeof given === "number" ? String(given) : "");
67
+ if (!/^(0|[1-9][0-9]*)$/.test(digits))
68
+ throw refused("entityTypeId takes the type's number, such as 2 for deals");
69
+ return digits;
70
+ };
71
+ /** What `api call` sends, checked once: the body `parseBody` gave, its `fields` an object and its type a number. */
72
+ export const checkCall = (method, body) => {
73
+ entityTypeOf(body);
74
+ const fields = fieldOf(body, "fields");
75
+ if (fields !== undefined && !isRecord(fields))
76
+ throw refused("fields takes a JSON object of field names and values");
77
+ if (/^crm\.item\.(add|update|delete|get|list|fields)$/.test(method) && fieldOf(body, "entityTypeId") === undefined)
78
+ throw refused(`${method} needs entityTypeId, the record type's number`);
79
+ };
80
+ const typeOf = (method, body) => {
81
+ const named = /^crm\.(deal|lead|contact|company)\.(.+)$/.exec(method);
82
+ if (named?.[1] && named[2])
83
+ return { type: named[1], action: named[2] };
84
+ const item = /^crm\.item\.(.+)$/.exec(method);
85
+ const type = ENTITY_TYPES[entityTypeOf(body) ?? ""];
86
+ return item?.[1] && type ? { type, action: item[1] } : undefined;
87
+ };
88
+ /** The CRM type and action a raw write does, whether named `crm.deal.update` or `crm.item.update` with its type id. */
89
+ const crmWriteOf = (method, body) => {
90
+ const found = typeOf(method, body);
91
+ return found && Object.hasOwn(ACTIONS, found.action) ? found : undefined;
92
+ };
93
+ /** The command a raw read reads the same as; any other read of a type, such as its product rows, is its list. */
94
+ const readKeysOf = (method, body) => {
95
+ const crm = typeOf(method, body);
96
+ if (crm) {
97
+ const noun = NOUNS[crm.type];
98
+ if (crm.action === "get")
99
+ return [`${noun}.show`];
100
+ return /^(fields$|field\.|userfield\.)/.test(crm.action) ? ["fields.list"] : [`${noun}.list`];
101
+ }
102
+ // `crm.item.productrow.*` names its record by ownerType in the filter, not entityTypeId (apidocs).
103
+ if (method.startsWith("crm.item.") && fieldOf(body, "entityTypeId") === undefined)
104
+ return Object.values(NOUNS).map((noun) => `${noun}.list`);
105
+ const product = /^(?:crm|catalog)\.product\.(.+)$/.exec(method);
106
+ if (product)
107
+ return [product[1] === "get" ? "products.show" : "products.list"];
108
+ // `users list` and `users show` both read through user.get.
109
+ if (method === "user.get" || method === "user.search")
110
+ return ["users.list", "users.show"];
111
+ if (method.startsWith("crm.category."))
112
+ return ["pipelines.list"];
113
+ if (method.startsWith("crm.status."))
114
+ return ["stages.list"];
115
+ return [];
116
+ };
34
117
  /**
35
- * The command key a raw call does the same as, so `api call crm.deal.update` cannot get round `deals.update: deny`
36
- * (gcal-cli's `WRITE_METHODS`). An update that sets a stage is a move too.
118
+ * The command keys a raw call does the same as, so `api call` cannot get round `deals: deny` (gcal-cli's
119
+ * `WRITE_METHODS`, WC-PERM-22). A create or update that sets a stage is a move too.
37
120
  */
38
121
  export const commandKeysOf = (method, body = {}) => {
39
- const [, type, action] = /^crm\.(deal|lead|contact|company)\.(add|update|delete)$/.exec(method) ?? [];
40
- if (!type || !action)
122
+ if (methodOf(method).effect === "read")
123
+ return readKeysOf(method, body);
124
+ const write = crmWriteOf(method, body);
125
+ if (!write)
41
126
  return [];
42
- const noun = NOUNS[type];
43
- const keys = [`${noun}.${ACTIONS[action]}`];
44
- const fields = (body.fields ?? {});
45
- if (action === "update" && fields.stageId !== undefined && (type === "deal" || type === "lead"))
46
- keys.push(`${noun}.move`);
127
+ const noun = NOUNS[write.type];
128
+ const keys = [`${noun}.${ACTIONS[write.action]}`];
129
+ // Without a lookup a stage may be a won or lost one, so both the move and the close key are checked.
130
+ if (write.action !== "delete" && setsStage(write.type, fieldsOf(body)))
131
+ keys.push(`${noun}.move`, `${noun}.close`);
47
132
  return keys;
48
133
  };
134
+ /**
135
+ * A method's default, as WC-PERM-22 has it, from an allow list: the reads `b24` makes and the CRM writes the command
136
+ * keys govern are allowed, a delete and anything else asks, and the families that reach people are denied, reads too.
137
+ */
138
+ export const apiDefault = (method, effect = methodOf(method).effect, body = {}) => {
139
+ if (inFamily(DENIED_FAMILIES, method))
140
+ return "deny";
141
+ if (effect === "destructive")
142
+ return "ask";
143
+ if (effect === "read")
144
+ return inFamily(READ_FAMILIES, method) ? "allow" : "ask";
145
+ return crmWriteOf(method, body) ? "allow" : "ask";
146
+ };
147
+ /** The built-in levels with this call's own key, which the static table cannot list for every method. */
148
+ export const callDefaults = (method, effect, body, defaults) => ({ ...defaults, [apiKey(method)]: apiDefault(method, effect, body) });
149
+ const METHODS = {
150
+ create: "add",
151
+ update: "update",
152
+ move: "update",
153
+ close: "update",
154
+ remove: "delete",
155
+ };
156
+ /**
157
+ * The `api.*` key a deal's or lead's write sends its request under, so `api.crm.deal.update: deny` holds on `deals
158
+ * update` too: core's `CrmWrites.alsoChecks` and, through `crmAlsoChecks`, its `--dry-run`.
159
+ */
160
+ export const crmApiKeys = (kind, verb) => [apiKey(`crm.${kind}.${METHODS[verb]}`)];
161
+ const OWN_WRITES = { people: "contact", organizations: "company" };
162
+ /** The same for b24's own `people` and `organizations` writes, by command path. */
163
+ export const apiKeysOf = (path) => {
164
+ const [noun, command, ...rest] = path;
165
+ const type = OWN_WRITES[noun ?? ""];
166
+ const method = command === "create" ? "add" : command === "update" ? "update" : undefined;
167
+ return type && method && rest.length === 0 ? [apiKey(`crm.${type}.${method}`)] : [];
168
+ };
49
169
  /** The keys `permissions` may name for `api`: the known methods and the denied families. */
50
170
  export const API_KEYS = [...KNOWN_METHODS.map((one) => apiKey(one.name)), ...DENIED_FAMILIES.map(apiKey)];
51
171
  export const API_DEFAULTS = {
@@ -1 +1 @@
1
- {"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../src/api-keys.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,aAAa,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE1E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,OAAO,MAAM,EAAE,CAAA;AAEjE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI;IACJ,aAAa;IACb,OAAO;IACP,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,YAAY;IACZ,SAAS;IACT,gBAAgB;IAChB,cAAc;IACd,OAAO;IACP,MAAM;IACN,UAAU;IACV,OAAO;CACR,CAAA;AAED,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,EAAE,CACtC,eAAe,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,CAAA;AAExF,uGAAuG;AACvG,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,MAAM,GAAW,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,EAAS,EAAE;IAC5F,IAAI,MAAM,KAAK,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAA;IAC5D,OAAO,MAAM,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;AACnD,CAAC,CAAA;AAED,MAAM,KAAK,GAA2B,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ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AW,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAe,CAAC,CAAC,CAAC;CAC1F,CAAA"}
package/dist/bin/b24.js CHANGED
@@ -9,7 +9,7 @@ if (
9
9
  (words[0] === "--version" || words[0] === "-V") &&
10
10
  !Object.keys(process.env).some((key) => key.endsWith("_TEST_ARGV_LOG"))
11
11
  ) {
12
- process.stdout.write("0.3.0\n")
12
+ process.stdout.write("0.5.0\n")
13
13
  } else {
14
14
  // Before the bundle compiles: the bundle's own call comes after its chunks.
15
15
  module.enableCompileCache()
@@ -28,7 +28,7 @@ if (
28
28
  : next(specifier, context),
29
29
  })
30
30
  }
31
- const chunks = ["../bundle/all-profiles-QJ444GSX.js","../bundle/anthropic-RHRAVHC2.js","../bundle/app-server-QIT6S7AZ.js","../bundle/bun-H6RSODZ3.js","../bundle/bun-sqlite-BO4LTQHX.js","../bundle/decode-5ZPLTYV6.js","../bundle/dist-6Y64DTOE.js","../bundle/echarts-J6LAPIX7.js","../bundle/embed-YG5LDHME.js","../bundle/embedder-7FNUA5OZ.js","../bundle/first-screen-VQM4MTS7.js","../bundle/instructions-AXWTQHMR.js","../bundle/mcp-5RSWNTHS.js","../bundle/mcp-7F46P6AM.js","../bundle/mcp-J5R5A65I.js","../bundle/node-CWKAIOEM.js","../bundle/node-P4E63KXA.js","../bundle/node-TLZSIHIJ.js","../bundle/node-sqlite-LSEKVRDA.js","../bundle/oauth-THYNLRLD.js","../bundle/open-E47QYKFC.js","../bundle/openai-EWSGC3BC.js","../bundle/process-WKTEA3WE.js","../bundle/program-H3TGGRQ6.js","../bundle/prompt-CAQ7QR3U.js","../bundle/recognize-6KGHNZC3.js","../bundle/remote-3UO2WDC3.js","../bundle/rerank-2JVDPZBX.js","../bundle/serve-ES7AG5IK.js","../bundle/server-5LE5LNUQ.js","../bundle/server-BU4VBM6S.js","../bundle/state-7NH5G4XJ.js","../bundle/store-7O4JQD2Z.js","../bundle/store-maintenance-command-UDVGEY2D.js"]
31
+ const chunks = ["../bundle/all-profiles-CANIDIDS.js","../bundle/anthropic-JUJB4DCF.js","../bundle/app-server-3V5Z4PTK.js","../bundle/bun-LKMV5TY7.js","../bundle/bun-sqlite-S56EF74S.js","../bundle/decode-QSTBX4MG.js","../bundle/dist-6Y64DTOE.js","../bundle/echarts-JZELFH2N.js","../bundle/embed-4RIW2LVH.js","../bundle/embedder-SW7DTWSL.js","../bundle/first-screen-NMHNFZ2B.js","../bundle/instructions-BZE5YUGG.js","../bundle/mcp-SDWHDJTY.js","../bundle/node-KM3CUABH.js","../bundle/node-LTKZIO4U.js","../bundle/node-TLZSIHIJ.js","../bundle/node-sqlite-HQ5PN2RH.js","../bundle/oauth-UH6FOZQL.js","../bundle/open-TSUP3XGL.js","../bundle/openai-GVEE52E3.js","../bundle/process-AGXY76ZE.js","../bundle/program-BI4A4HFJ.js","../bundle/prompt-NRSUY7FA.js","../bundle/recognize-NPDPQ6PJ.js","../bundle/remote-HFASMVLB.js","../bundle/rerank-TL6Z6F7K.js","../bundle/serve-VB4DHDZQ.js","../bundle/server-T5EDRPJI.js","../bundle/server-Z6MW6C37.js","../bundle/source-4IGO5J7E.js","../bundle/sqlite-runtime-YS4POY3W.js","../bundle/state-ISZVVZGR.js","../bundle/store-IZJBAKJV.js","../bundle/store-L76MSQC3.js","../bundle/store-PBTIB7BD.js","../bundle/store-maintenance-command-YFKII7TF.js","../bundle/writer-3O5EYMFE.js"]
32
32
  if (((words) => words
33
33
  .filter((word) => !word.startsWith("-"))
34
34
  .slice(0, 2)
@@ -65,7 +65,7 @@ export const bitrixError = (method, status, body, { now = Date.now(), waitMs } =
65
65
  if (code && NOT_FOUND.has(code))
66
66
  return as("not_found", `${method}: Bitrix24 has no such record${named}`);
67
67
  if (code === "BITRIX_REST_V3_EXCEPTION_IDEMPOTENCYKEYREUSEDEXCEPTION")
68
- return as("conflict", `${method}: this --operation-id was already used for a different request; leave it out for a new write`, { reason: "operation.reused" });
68
+ return as("conflict", `${method}: Bitrix24 refused this write's operation id as already used for a different request`, { reason: "operation.reused" });
69
69
  const fields = fieldsOf(body);
70
70
  if (status === 400 || code?.startsWith("BITRIX_REST_V3_EXCEPTION_"))
71
71
  return as("validation_error", `Bitrix24 refused ${method}${named}${fields.length ? `; check ${fields.join(", ")}` : ""}`, fields.length ? { fields } : {});
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/bitrix/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAwC,MAAM,mBAAmB,CAAA;AAClF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAEtE,4FAA4F;AAC5F,MAAM,mBAAmB,GAAG,KAAK,CAAA;AACjC,sGAAsG;AACtG,MAAM,iBAAiB,GAAG,MAAM,CAAA;AAEhC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,eAAe,EAAE,qBAAqB,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC,CAAA;AACtH,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,oBAAoB,EAAE,qDAAqD,CAAC,CAAC,CAAA;AACpG,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,eAAe,EAAE,mBAAmB,EAAE,gDAAgD,CAAC,CAAC,CAAA;AAChH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,kDAAkD,CAAC,CAAC,CAAA;AAS5F,MAAM,IAAI,GAAG,uBAAuB,CAAA;AAEpC,8GAA8G;AAC9G,MAAM,MAAM,GAAG,CAAC,IAA+B,EAAsB,EAAE;IACrE,MAAM,GAAG,GAAG,OAAO,IAAI,EAAE,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,I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AO,MAAM,QAAQ,SAAU,MAAM,KAAG,MAKtC,CAAA;AAEF,sEAAsE;AACtE,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAM1C,CAAA"}
1
+ {"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../src/bitrix/methods.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC,CAAA;AAC/B,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,CAAA;AAErD,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,WAAW,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd;AA2BD,qHAAqH;AACrH,eAAO,MAAM,QAAQ,SAAU,MAAM,KAAG,MAKtC,CAAA;AAEF,sEAAsE;AACtE,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAQ1C,CAAA"}