@wirecat/notion-cli 0.0.0-stage → 0.2.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 (262) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/LICENSE +204 -0
  3. package/README.md +42 -2
  4. package/contracts/wirecat.json +1964 -0
  5. package/dist/bin/notion.d.ts +3 -0
  6. package/dist/bin/notion.d.ts.map +1 -0
  7. package/dist/bin/notion.js +40 -0
  8. package/dist/bin/notion.js.map +1 -0
  9. package/dist/bundle/all-profiles-JGYLQZ5C.js +278 -0
  10. package/dist/bundle/anthropic-S2VSMIKQ.js +91 -0
  11. package/dist/bundle/app-server-SASYDBCA.js +240 -0
  12. package/dist/bundle/bun-LU5LP3JI.js +169 -0
  13. package/dist/bundle/bun-sqlite-JBSINB4O.js +76 -0
  14. package/dist/bundle/chunk-22QQUKWA.js +53 -0
  15. package/dist/bundle/chunk-2F4QQ7WB.js +73 -0
  16. package/dist/bundle/chunk-2F6VO5HA.js +73 -0
  17. package/dist/bundle/chunk-2LWO3PDX.js +726 -0
  18. package/dist/bundle/chunk-3AL7QUS3.js +2778 -0
  19. package/dist/bundle/chunk-3Z4YTSRY.js +731 -0
  20. package/dist/bundle/chunk-4HWJOU7N.js +38 -0
  21. package/dist/bundle/chunk-4IPURN72.js +1221 -0
  22. package/dist/bundle/chunk-4ZTVJHWU.js +206 -0
  23. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  24. package/dist/bundle/chunk-5IYKVRH2.js +44811 -0
  25. package/dist/bundle/chunk-5NFK5EM2.js +362 -0
  26. package/dist/bundle/chunk-5QIQEUOG.js +188 -0
  27. package/dist/bundle/chunk-5RDNBG7D.js +72 -0
  28. package/dist/bundle/chunk-5RSC54NA.js +1328 -0
  29. package/dist/bundle/chunk-6EVKHZKN.js +158 -0
  30. package/dist/bundle/chunk-6RA3EABS.js +4012 -0
  31. package/dist/bundle/chunk-AOCUKEAX.js +131 -0
  32. package/dist/bundle/chunk-B26TQZKZ.js +217 -0
  33. package/dist/bundle/chunk-B7ON6KPT.js +1197 -0
  34. package/dist/bundle/chunk-BNPTZ5ZB.js +161 -0
  35. package/dist/bundle/chunk-D72URWJE.js +532 -0
  36. package/dist/bundle/chunk-D7QSEEYW.js +274 -0
  37. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  38. package/dist/bundle/chunk-DH5PRHT4.js +392 -0
  39. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  40. package/dist/bundle/chunk-EUIVXFLJ.js +259 -0
  41. package/dist/bundle/chunk-FPY6EJ7B.js +9568 -0
  42. package/dist/bundle/chunk-FT3LN3HP.js +6848 -0
  43. package/dist/bundle/chunk-FWVBPRL4.js +4436 -0
  44. package/dist/bundle/chunk-FXEJY4OL.js +12538 -0
  45. package/dist/bundle/chunk-G3EZFRSS.js +1297 -0
  46. package/dist/bundle/chunk-GZOUFX3C.js +230 -0
  47. package/dist/bundle/chunk-HL52XXZX.js +78 -0
  48. package/dist/bundle/chunk-KCLOUUYF.js +100 -0
  49. package/dist/bundle/chunk-KFVDL2QS.js +146 -0
  50. package/dist/bundle/chunk-KGERXYTV.js +24 -0
  51. package/dist/bundle/chunk-KM6WHPHI.js +288 -0
  52. package/dist/bundle/chunk-LAYPFBOM.js +95 -0
  53. package/dist/bundle/chunk-LLG2POQ7.js +170 -0
  54. package/dist/bundle/chunk-M3KB25D3.js +1392 -0
  55. package/dist/bundle/chunk-M7S2NDWB.js +76 -0
  56. package/dist/bundle/chunk-MGUEZYFA.js +5546 -0
  57. package/dist/bundle/chunk-MY742GAD.js +1977 -0
  58. package/dist/bundle/chunk-MZU2YFBZ.js +823 -0
  59. package/dist/bundle/chunk-NOQ7B5N7.js +58 -0
  60. package/dist/bundle/chunk-NQWV4WQO.js +300 -0
  61. package/dist/bundle/chunk-ODBZNSZ6.js +1028 -0
  62. package/dist/bundle/chunk-OTV53F34.js +370 -0
  63. package/dist/bundle/chunk-P7CUM5IB.js +18 -0
  64. package/dist/bundle/chunk-RV64YUQX.js +185 -0
  65. package/dist/bundle/chunk-SHJQ6JKG.js +106 -0
  66. package/dist/bundle/chunk-SWAOWNKW.js +52 -0
  67. package/dist/bundle/chunk-SZOVLP44.js +29 -0
  68. package/dist/bundle/chunk-TPX2M45D.js +385 -0
  69. package/dist/bundle/chunk-TSDBSIFM.js +66 -0
  70. package/dist/bundle/chunk-VBHETQVV.js +64146 -0
  71. package/dist/bundle/chunk-VCIALTEM.js +3139 -0
  72. package/dist/bundle/chunk-VKE77B3F.js +2 -0
  73. package/dist/bundle/chunk-WCSOH4JS.js +142 -0
  74. package/dist/bundle/chunk-WF4D56CA.js +54 -0
  75. package/dist/bundle/chunk-WJHZMR2W.js +335 -0
  76. package/dist/bundle/chunk-X4TIMMKJ.js +16 -0
  77. package/dist/bundle/chunk-XF26XKTS.js +82 -0
  78. package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
  79. package/dist/bundle/chunk-XQUUANA2.js +24600 -0
  80. package/dist/bundle/chunk-XYIT2XB3.js +1372 -0
  81. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  82. package/dist/bundle/chunk-YMYUBZWT.js +1068 -0
  83. package/dist/bundle/chunk-YNTLT3Z3.js +2310 -0
  84. package/dist/bundle/chunk-YVI5SQPY.js +46 -0
  85. package/dist/bundle/chunk-Z56QFOBR.js +63 -0
  86. package/dist/bundle/chunk-ZKAEZXUP.js +787 -0
  87. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  88. package/dist/bundle/chunk-ZZ32DXTH.js +23 -0
  89. package/dist/bundle/command-contract-JS5V27NX.js +38 -0
  90. package/dist/bundle/command-server-entry-UFSG7KRO.js +167 -0
  91. package/dist/bundle/decode-7LLWTSPT.js +297 -0
  92. package/dist/bundle/definitions-M3U4UYHN.js +45607 -0
  93. package/dist/bundle/dispatch-2GY6JIJH.js +411 -0
  94. package/dist/bundle/dist-ILNOLGYN.js +7577 -0
  95. package/dist/bundle/echarts-BXX4OQWC.js +42501 -0
  96. package/dist/bundle/embed-JXFNBTKH.js +38 -0
  97. package/dist/bundle/embedder-57YZ44KO.js +111 -0
  98. package/dist/bundle/failure-MYT4HPE3.js +25 -0
  99. package/dist/bundle/first-run-3PF7T74J.js +29 -0
  100. package/dist/bundle/first-screen-7BEROEQR.js +36 -0
  101. package/dist/bundle/instructions-2VECIDXF.js +11 -0
  102. package/dist/bundle/mcp-O6ACR2DX.js +167 -0
  103. package/dist/bundle/mdast-util-from-markdown-R66F4HZA.js +1958 -0
  104. package/dist/bundle/mdast-util-gfm-LN2ELINH.js +2699 -0
  105. package/dist/bundle/meeting-combined-PPUQ3KBR.js +24 -0
  106. package/dist/bundle/meeting-model-ZNMYKMCD.js +26 -0
  107. package/dist/bundle/meeting-semantic-ETN3A4BJ.js +22 -0
  108. package/dist/bundle/micromark-extension-gfm-5X7YT43T.js +1838 -0
  109. package/dist/bundle/node-KM3CUABH.js +2340 -0
  110. package/dist/bundle/node-MPEQSFI3.js +176 -0
  111. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  112. package/dist/bundle/node-sqlite-WA32MYSJ.js +74 -0
  113. package/dist/bundle/notion.js +185 -0
  114. package/dist/bundle/oauth-IAFZG3IR.js +20 -0
  115. package/dist/bundle/open-M3JQUC5G.js +23 -0
  116. package/dist/bundle/openai-HXUEHUSD.js +240 -0
  117. package/dist/bundle/process-F6TKXWWA.js +91 -0
  118. package/dist/bundle/program-Y7JAB6TG.js +33219 -0
  119. package/dist/bundle/prompt-IMUQLZD2.js +17 -0
  120. package/dist/bundle/recognize-2MZAYHAA.js +26 -0
  121. package/dist/bundle/remote-OV4LB6VR.js +32 -0
  122. package/dist/bundle/rerank-ZIULUS34.js +52 -0
  123. package/dist/bundle/schemas-DIVZS6TU.js +12214 -0
  124. package/dist/bundle/serve-YU7QBP6L.js +199 -0
  125. package/dist/bundle/server-FKQET4ZO.js +71 -0
  126. package/dist/bundle/server-LGMNONSB.js +202 -0
  127. package/dist/bundle/services-5WY4DCPJ.js +581 -0
  128. package/dist/bundle/sqlite-runtime-5MXZDETH.js +20 -0
  129. package/dist/bundle/state-LWMZH2KI.js +36 -0
  130. package/dist/bundle/store-EPZYV4VW.js +168 -0
  131. package/dist/bundle/store-QE6FEIZD.js +286 -0
  132. package/dist/bundle/store-maintenance-command-ZUUUFCHL.js +62 -0
  133. package/dist/commands/api.d.ts +4 -0
  134. package/dist/commands/api.d.ts.map +1 -0
  135. package/dist/commands/api.js +140 -0
  136. package/dist/commands/api.js.map +1 -0
  137. package/dist/commands/databases.d.ts +3 -0
  138. package/dist/commands/databases.d.ts.map +1 -0
  139. package/dist/commands/databases.js +65 -0
  140. package/dist/commands/databases.js.map +1 -0
  141. package/dist/commands/documents.d.ts +4 -0
  142. package/dist/commands/documents.d.ts.map +1 -0
  143. package/dist/commands/documents.js +41 -0
  144. package/dist/commands/documents.js.map +1 -0
  145. package/dist/commands/library.d.ts +10 -0
  146. package/dist/commands/library.d.ts.map +1 -0
  147. package/dist/commands/library.js +468 -0
  148. package/dist/commands/library.js.map +1 -0
  149. package/dist/commands/session.d.ts +3 -0
  150. package/dist/commands/session.d.ts.map +1 -0
  151. package/dist/commands/session.js +105 -0
  152. package/dist/commands/session.js.map +1 -0
  153. package/dist/config.d.ts +5 -0
  154. package/dist/config.d.ts.map +1 -0
  155. package/dist/config.js +13 -0
  156. package/dist/config.js.map +1 -0
  157. package/dist/context.d.ts +51 -0
  158. package/dist/context.d.ts.map +1 -0
  159. package/dist/context.js +67 -0
  160. package/dist/context.js.map +1 -0
  161. package/dist/generated/definitions.d.ts +3 -0
  162. package/dist/generated/definitions.d.ts.map +1 -0
  163. package/dist/generated/definitions.js +45603 -0
  164. package/dist/generated/definitions.js.map +1 -0
  165. package/dist/generated/manifest.d.ts +3 -0
  166. package/dist/generated/manifest.d.ts.map +1 -0
  167. package/dist/generated/manifest.js +2089 -0
  168. package/dist/generated/manifest.js.map +1 -0
  169. package/dist/generated/metadata.d.ts +6 -0
  170. package/dist/generated/metadata.d.ts.map +1 -0
  171. package/dist/generated/metadata.js +24 -0
  172. package/dist/generated/metadata.js.map +1 -0
  173. package/dist/generated/schemas.d.ts +1223 -0
  174. package/dist/generated/schemas.d.ts.map +1 -0
  175. package/dist/generated/schemas.js +11557 -0
  176. package/dist/generated/schemas.js.map +1 -0
  177. package/dist/generated/types.d.ts +11120 -0
  178. package/dist/generated/types.d.ts.map +1 -0
  179. package/dist/generated/types.js +5 -0
  180. package/dist/generated/types.js.map +1 -0
  181. package/dist/identity.d.ts +7 -0
  182. package/dist/identity.d.ts.map +1 -0
  183. package/dist/identity.js +30 -0
  184. package/dist/identity.js.map +1 -0
  185. package/dist/index.d.ts +3 -0
  186. package/dist/index.d.ts.map +1 -0
  187. package/dist/index.js +3 -0
  188. package/dist/index.js.map +1 -0
  189. package/dist/knowledge.d.ts +27 -0
  190. package/dist/knowledge.d.ts.map +1 -0
  191. package/dist/knowledge.js +87 -0
  192. package/dist/knowledge.js.map +1 -0
  193. package/dist/library.d.ts +44 -0
  194. package/dist/library.d.ts.map +1 -0
  195. package/dist/library.js +149 -0
  196. package/dist/library.js.map +1 -0
  197. package/dist/notion/client.d.ts +45 -0
  198. package/dist/notion/client.d.ts.map +1 -0
  199. package/dist/notion/client.js +121 -0
  200. package/dist/notion/client.js.map +1 -0
  201. package/dist/notion/errors.d.ts +24 -0
  202. package/dist/notion/errors.d.ts.map +1 -0
  203. package/dist/notion/errors.js +127 -0
  204. package/dist/notion/errors.js.map +1 -0
  205. package/dist/notion/ids.d.ts +7 -0
  206. package/dist/notion/ids.d.ts.map +1 -0
  207. package/dist/notion/ids.js +37 -0
  208. package/dist/notion/ids.js.map +1 -0
  209. package/dist/notion/links.d.ts +6 -0
  210. package/dist/notion/links.d.ts.map +1 -0
  211. package/dist/notion/links.js +22 -0
  212. package/dist/notion/links.js.map +1 -0
  213. package/dist/notion/notion.d.ts +95 -0
  214. package/dist/notion/notion.d.ts.map +1 -0
  215. package/dist/notion/notion.js +269 -0
  216. package/dist/notion/notion.js.map +1 -0
  217. package/dist/notion/port.d.ts +13 -0
  218. package/dist/notion/port.d.ts.map +1 -0
  219. package/dist/notion/port.js +60 -0
  220. package/dist/notion/port.js.map +1 -0
  221. package/dist/notion/read-posts.d.ts +36 -0
  222. package/dist/notion/read-posts.d.ts.map +1 -0
  223. package/dist/notion/read-posts.js +24 -0
  224. package/dist/notion/read-posts.js.map +1 -0
  225. package/dist/notion/reads.d.ts +331 -0
  226. package/dist/notion/reads.d.ts.map +1 -0
  227. package/dist/notion/reads.js +18 -0
  228. package/dist/notion/reads.js.map +1 -0
  229. package/dist/program.d.ts +6 -0
  230. package/dist/program.d.ts.map +1 -0
  231. package/dist/program.js +62 -0
  232. package/dist/program.js.map +1 -0
  233. package/dist/sync/cursor.d.ts +135 -0
  234. package/dist/sync/cursor.d.ts.map +1 -0
  235. package/dist/sync/cursor.js +113 -0
  236. package/dist/sync/cursor.js.map +1 -0
  237. package/dist/sync/files.d.ts +77 -0
  238. package/dist/sync/files.d.ts.map +1 -0
  239. package/dist/sync/files.js +12 -0
  240. package/dist/sync/files.js.map +1 -0
  241. package/dist/sync/front-matter.d.ts +10 -0
  242. package/dist/sync/front-matter.d.ts.map +1 -0
  243. package/dist/sync/front-matter.js +114 -0
  244. package/dist/sync/front-matter.js.map +1 -0
  245. package/dist/sync/markdown.d.ts +11 -0
  246. package/dist/sync/markdown.d.ts.map +1 -0
  247. package/dist/sync/markdown.js +42 -0
  248. package/dist/sync/markdown.js.map +1 -0
  249. package/dist/sync/source.d.ts +11 -0
  250. package/dist/sync/source.d.ts.map +1 -0
  251. package/dist/sync/source.js +995 -0
  252. package/dist/sync/source.js.map +1 -0
  253. package/dist/version.d.ts +2 -0
  254. package/dist/version.d.ts.map +1 -0
  255. package/dist/version.js +2 -0
  256. package/dist/version.js.map +1 -0
  257. package/dist/wcat.d.ts +3 -0
  258. package/dist/wcat.d.ts.map +1 -0
  259. package/dist/wcat.js +4 -0
  260. package/dist/wcat.js.map +1 -0
  261. package/package.json +85 -4
  262. package/skills/notion-cli/SKILL.md +45 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notion.js","sourceRoot":"","sources":["../../src/notion/notion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,iHAAiH;AACjH,gEAAgE;AAEhE,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAA;AACnE,MAAM,MAAM,GAAG,CAAC,KAAiD,EAAE,EAAE,CACnE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAEvD,gJAAgJ;AAChJ,MAAM,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC;IAC3B,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACzB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC3B,GAAG,EAAE,CAAC,CAAC,QAAQ,CACb,CAAC,CAAC,WAAW,CAAC;QACZ,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,IAAI,E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UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;wBAClE,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAA;wBACnC,OAAO;4BACL,EAAE,EAAE,QAAQ,CAAC,EAAE;4BACf,IAAI,EAAE,QAAQ,CAAC,IAAI;4BACnB,IAAI,EAAE,QAAQ,CAAC,IAAI;4BACnB,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;yBAChC,CAAA;oBACH,CAAC,CAAC;iBACH,CAAC,CAAA;YACJ,CAAC;YACD,OAAO;gBACL,EAAE,EAAE,QAAQ,CAAC,EAAE;gBACf,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAC7B,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC;gBACzC,GAAG,EAAE,QAAQ,CAAC,GAAG,IAAI,IAAI;gBACzB,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;gBACjC,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,KAAK;gBACtC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,KAAK;gBACpC,YAAY,EAAE,QAAQ,CAAC,YAAY,IAAI,IAAI;gBAC3C,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,IAAI,IAAI;gBACnD,YAAY,EAAE,OAAO;aACtB,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import type { Client } from "@notionhq/client";
2
+ import type { NotionReads } from "./reads.js";
3
+ /**
4
+ * Notion's clock, from the Date header of its latest answer. The sync compares Notion's timestamps with it, since
5
+ * this computer's clock can be minutes off. Pass `observe` as the client's `onAnswer`.
6
+ */
7
+ export declare const notionClock: () => {
8
+ observe: (response: Response) => void;
9
+ time: () => number | undefined;
10
+ };
11
+ /** The read port src/notion/reads.ts names, over the SDK: the same client, pace, retries and error mapping as the commands. */
12
+ export declare const notionPort: (client: Client, clock?: ReturnType<typeof notionClock>) => NotionReads;
13
+ //# sourceMappingURL=port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../src/notion/port.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAG9C,OAAO,KAAK,EAOV,WAAW,EAEZ,MAAM,YAAY,CAAA;AA0BnB;;;GAGG;AACH,eAAO,MAAM,WAAW;IAGpB,OAAO,aAAa,QAAQ;IAI5B,IAAI;CAEP,CAAA;AAED,+HAA+H;AAC/H,eAAO,MAAM,UAAU,WAAY,MAAM,UAAU,UAAU,CAAC,OAAO,WAAW,CAAC,KAAG,WA6BlF,CAAA"}
@@ -0,0 +1,60 @@
1
+ import { CliError } from "@wirecat/cli-base";
2
+ import { mapped, NOTION } from "./errors.js";
3
+ const isObject = (value) => typeof value === "object" && value !== null;
4
+ /**
5
+ * Notion's own JSON passes through, as the port asks; only the `object` it must be is checked, so an answer of
6
+ * another kind fails here instead of deep in the sync.
7
+ */
8
+ const kind = (object, value) => {
9
+ const wanted = typeof object === "string" ? [object] : object;
10
+ if (isObject(value) && wanted.includes(String(value.object)))
11
+ return value;
12
+ throw new CliError("invalid_response", `${NOTION}'s answer does not have the documented shape`, {
13
+ reason: "notion.invalid-response",
14
+ });
15
+ };
16
+ const list = (items, value) => {
17
+ const page = kind("list", value);
18
+ if (!Array.isArray(page.results) || typeof page.has_more !== "boolean")
19
+ throw new CliError("invalid_response", `${NOTION}'s list does not have the documented shape`, {
20
+ reason: "notion.invalid-response",
21
+ });
22
+ for (const result of page.results)
23
+ kind(items, result);
24
+ return value;
25
+ };
26
+ /**
27
+ * Notion's clock, from the Date header of its latest answer. The sync compares Notion's timestamps with it, since
28
+ * this computer's clock can be minutes off. Pass `observe` as the client's `onAnswer`.
29
+ */
30
+ export const notionClock = () => {
31
+ let last;
32
+ return {
33
+ observe: (response) => {
34
+ const time = Date.parse(response.headers.get("date") ?? "");
35
+ if (Number.isFinite(time))
36
+ last = time;
37
+ },
38
+ time: () => last,
39
+ };
40
+ };
41
+ /** The read port src/notion/reads.ts names, over the SDK: the same client, pace, retries and error mapping as the commands. */
42
+ export const notionPort = (client, clock) => ({
43
+ ...(clock ? { serverTime: clock.time } : {}),
44
+ self: async () => kind("user", await mapped(() => client.users.me({}))),
45
+ search: async (request) => list(["page", "data_source"], await mapped(() => client.search({ ...request }))),
46
+ queryDataSource: async (id, request) => list("page", await mapped(() => client.dataSources.query({ data_source_id: id, ...request }))),
47
+ retrievePage: async (id) => kind("page", await mapped(() => client.pages.retrieve({ page_id: id }))),
48
+ retrieveDatabase: async (id) => kind("database", await mapped(() => client.databases.retrieve({ database_id: id }))),
49
+ retrieveBlock: async (id) => kind("block", await mapped(() => client.blocks.retrieve({ block_id: id }))),
50
+ blockChildren: async (id, startCursor) => list("block", await mapped(() => client.blocks.children.list({
51
+ block_id: id,
52
+ page_size: 100,
53
+ ...(startCursor ? { start_cursor: startCursor } : {}),
54
+ }))),
55
+ pageMarkdown: async (id) => {
56
+ const answer = kind("page_markdown", await mapped(() => client.pages.retrieveMarkdown({ page_id: id, markdown_version: "v2" })));
57
+ return { markdown: answer.markdown, truncated: answer.truncated, unknown_block_ids: answer.unknown_block_ids };
58
+ },
59
+ });
60
+ //# sourceMappingURL=port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"port.js","sourceRoot":"","sources":["../../src/notion/port.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAY5C,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAA;AAElH;;;GAGG;AACH,MAAM,IA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AAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACtG,aAAa,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAc,OAAO,EAAE,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACrH,aAAa,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,CACvC,IAAI,CACF,OAAO,EACP,MAAM,MAAM,CAAC,GAAG,EAAE,CAChB,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC1B,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,GAAG;QACd,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtD,CAAC,CACH,CACF;IACH,YAAY,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QACzB,MAAM,MAAM,GAAG,IAAI,CACjB,eAAe,EACf,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC,CAC3F,CAAA;QACD,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,EAAE,CAAA;IAChH,CAAC;CACF,CAAC,CAAA"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The POST operations that change nothing, by operation id: the generator marks them as reads, and the client may send
3
+ * them again after a failure. One list, so a read the commands offer is never left out of the retries.
4
+ */
5
+ export declare const READ_POSTS: {
6
+ readonly "post-search": {
7
+ readonly path: "/v1/search";
8
+ readonly reason: "a POST that only searches";
9
+ };
10
+ readonly "post-database-query": {
11
+ readonly path: "/v1/data_sources/{data_source_id}/query";
12
+ readonly reason: "a POST that only queries a data source";
13
+ };
14
+ readonly "create-view-query": {
15
+ readonly path: "/v1/views/{view_id}/queries";
16
+ readonly reason: "a POST that runs a view's query; it changes no page";
17
+ };
18
+ readonly "query-meeting-notes": {
19
+ readonly path: "/v1/blocks/meeting_notes/query";
20
+ readonly reason: "a POST that only lists meeting notes";
21
+ };
22
+ readonly "query-agents": {
23
+ readonly path: "/v1/agents/query";
24
+ readonly reason: "a POST that only lists agents";
25
+ };
26
+ readonly "query-sessions": {
27
+ readonly path: "/v1/sessions/query";
28
+ readonly reason: "a POST that only lists sessions";
29
+ };
30
+ readonly "query-session-events": {
31
+ readonly path: "/v1/sessions/{session_id}/events/query";
32
+ readonly reason: "a POST that only lists a session's events";
33
+ };
34
+ };
35
+ export declare const READ_POST_PATHS: RegExp[];
36
+ //# sourceMappingURL=read-posts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-posts.d.ts","sourceRoot":"","sources":["../../src/notion/read-posts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,UAAU;aACrB,aAAa;iBAAI,IAAI,EAAE,YAAY;iBAAE,MAAM,EAAE,2BAA2B;;aACxE,qBAAqB;iBACnB,IAAI,EAAE,yCAAyC;iBAC/C,MAAM,EAAE,wCAAwC;;aAElD,mBAAmB;iBACjB,IAAI,EAAE,6BAA6B;iBACnC,MAAM,EAAE,qDAAqD;;aAE/D,qBAAqB;iBAAI,IAAI,EAAE,gCAAgC;iBAAE,MAAM,EAAE,sCAAsC;;aAC/G,cAAc;iBAAI,IAAI,EAAE,kBAAkB;iBAAE,MAAM,EAAE,+BAA+B;;aACnF,gBAAgB;iBAAI,IAAI,EAAE,oBAAoB;iBAAE,MAAM,EAAE,iCAAiC;;aACzF,sBAAsB;iBACpB,IAAI,EAAE,wCAAwC;iBAC9C,MAAM,EAAE,2CAA2C;;CAE7C,CAAA;AAEV,eAAO,MAAM,eAAe,UAE3B,CAAA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The POST operations that change nothing, by operation id: the generator marks them as reads, and the client may send
3
+ * them again after a failure. One list, so a read the commands offer is never left out of the retries.
4
+ */
5
+ export const READ_POSTS = {
6
+ "post-search": { path: "/v1/search", reason: "a POST that only searches" },
7
+ "post-database-query": {
8
+ path: "/v1/data_sources/{data_source_id}/query",
9
+ reason: "a POST that only queries a data source",
10
+ },
11
+ "create-view-query": {
12
+ path: "/v1/views/{view_id}/queries",
13
+ reason: "a POST that runs a view's query; it changes no page",
14
+ },
15
+ "query-meeting-notes": { path: "/v1/blocks/meeting_notes/query", reason: "a POST that only lists meeting notes" },
16
+ "query-agents": { path: "/v1/agents/query", reason: "a POST that only lists agents" },
17
+ "query-sessions": { path: "/v1/sessions/query", reason: "a POST that only lists sessions" },
18
+ "query-session-events": {
19
+ path: "/v1/sessions/{session_id}/events/query",
20
+ reason: "a POST that only lists a session's events",
21
+ },
22
+ };
23
+ export const READ_POST_PATHS = Object.values(READ_POSTS).map(({ path }) => new RegExp(`^${path.replace(/\{[^}]+\}/gu, "[^/]+")}$`, "u"));
24
+ //# sourceMappingURL=read-posts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-posts.js","sourceRoot":"","sources":["../../src/notion/read-posts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,aAAa,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,2BAA2B,EAAE;IAC1E,qBAAqB,EAAE;QACrB,IAAI,EAAE,yCAAyC;QAC/C,MAAM,EAAE,wCAAwC;KACjD;IACD,mBAAmB,EAAE;QACnB,IAAI,EAAE,6BAA6B;QACnC,MAAM,EAAE,qDAAqD;KAC9D;IACD,qBAAqB,EAAE,EAAE,IAAI,EAAE,gCAAgC,EAAE,MAAM,EAAE,sCAAsC,EAAE;IACjH,cAAc,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,+BAA+B,EAAE;IACrF,gBAAgB,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,EAAE,iCAAiC,EAAE;IAC3F,sBAAsB,EAAE;QACtB,IAAI,EAAE,wCAAwC;QAC9C,MAAM,EAAE,2CAA2C;KACpD;CACO,CAAA;AAEV,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAC1D,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAC3E,CAAA"}
@@ -0,0 +1,331 @@
1
+ /**
2
+ * The reads the incremental sync needs from Notion, and nothing more. The real client implements it; the sync's tests
3
+ * implement it with a strict fake. Shapes are the subset of Notion's own JSON (API version 2026-03-11) the sync reads,
4
+ * so an implementation passes Notion's answers through instead of converting them.
5
+ *
6
+ * Errors, after the implementation's own retries and pacing:
7
+ * - `CliError("not_found")` for 404 `object_not_found`: deleted for good, or not shared with this token. Notion does
8
+ * not say which, and the sync treats both as gone.
9
+ * - `CliError("permission_error")` for 403 `restricted_resource`.
10
+ * - `CliError("rate_limited", …, { retry_after_ms })` for a 429 or 529 the implementation stopped retrying.
11
+ * - `CliError("validation_error")` for a 400, for example a start cursor Notion no longer accepts.
12
+ * - A list answer cut at Notion's 10,000-result cap carries `request_status.type: "incomplete"`; search too.
13
+ *
14
+ * Endpoint pages: https://developers.notion.com/reference/post-search, /query-a-data-source, /retrieve-a-page,
15
+ * /retrieve-a-database, /retrieve-a-block, /get-block-children, /retrieve-page-markdown, /get-self.
16
+ */
17
+ export interface NotionUser {
18
+ object: "user";
19
+ id: string;
20
+ /** Partial users carry only the id. */
21
+ name?: string | null;
22
+ }
23
+ export type NotionParent = {
24
+ type: "workspace";
25
+ workspace: true;
26
+ } | {
27
+ type: "page_id";
28
+ page_id: string;
29
+ } | {
30
+ type: "data_source_id";
31
+ data_source_id: string;
32
+ database_id: string;
33
+ } | {
34
+ type: "database_id";
35
+ database_id: string;
36
+ } | {
37
+ type: "block_id";
38
+ block_id: string;
39
+ };
40
+ export interface NotionRichText {
41
+ plain_text: string;
42
+ href?: string | null;
43
+ }
44
+ export interface NotionDate {
45
+ start: string;
46
+ end?: string | null;
47
+ time_zone?: string | null;
48
+ }
49
+ interface NotionFileValue {
50
+ name: string;
51
+ type?: "file" | "external" | "file_upload";
52
+ file?: {
53
+ url: string;
54
+ expiry_time?: string;
55
+ };
56
+ external?: {
57
+ url: string;
58
+ };
59
+ }
60
+ /**
61
+ * A value as a page or a query row carries it (https://developers.notion.com/reference/page-property-values). Notion
62
+ * adds types over time, so a reader must expect a `type` outside this list and skip it.
63
+ */
64
+ export type NotionPropertyValue = {
65
+ id?: string;
66
+ } & ({
67
+ type: "title";
68
+ title: NotionRichText[];
69
+ } | {
70
+ type: "rich_text";
71
+ rich_text: NotionRichText[];
72
+ } | {
73
+ type: "number";
74
+ number: number | null;
75
+ } | {
76
+ type: "select";
77
+ select: {
78
+ name: string;
79
+ } | null;
80
+ } | {
81
+ type: "status";
82
+ status: {
83
+ name: string;
84
+ } | null;
85
+ } | {
86
+ type: "multi_select";
87
+ multi_select: {
88
+ name: string;
89
+ }[];
90
+ } | {
91
+ type: "date";
92
+ date: NotionDate | null;
93
+ } | {
94
+ type: "people";
95
+ people: NotionUser[];
96
+ } | {
97
+ type: "files";
98
+ files: NotionFileValue[];
99
+ } | {
100
+ type: "checkbox";
101
+ checkbox: boolean;
102
+ } | {
103
+ type: "url";
104
+ url: string | null;
105
+ } | {
106
+ type: "email";
107
+ email: string | null;
108
+ } | {
109
+ type: "phone_number";
110
+ phone_number: string | null;
111
+ } | {
112
+ type: "formula";
113
+ formula: NotionFormula;
114
+ } | {
115
+ type: "relation";
116
+ relation: {
117
+ id: string;
118
+ }[];
119
+ has_more?: boolean;
120
+ } | {
121
+ type: "rollup";
122
+ rollup: NotionRollup;
123
+ } | {
124
+ type: "created_time";
125
+ created_time: string;
126
+ } | {
127
+ type: "last_edited_time";
128
+ last_edited_time: string;
129
+ } | {
130
+ type: "created_by";
131
+ created_by: NotionUser;
132
+ } | {
133
+ type: "last_edited_by";
134
+ last_edited_by: NotionUser;
135
+ } | {
136
+ type: "unique_id";
137
+ unique_id: {
138
+ number: number | null;
139
+ prefix: string | null;
140
+ };
141
+ } | {
142
+ type: "verification";
143
+ verification: {
144
+ state: string;
145
+ verified_by?: NotionUser | null;
146
+ } | null;
147
+ } | {
148
+ type: "place";
149
+ place: {
150
+ name?: string | null;
151
+ address?: string | null;
152
+ } | null;
153
+ } | {
154
+ type: "button";
155
+ button: Record<string, never>;
156
+ });
157
+ export type NotionFormula = {
158
+ type: "string";
159
+ string: string | null;
160
+ } | {
161
+ type: "number";
162
+ number: number | null;
163
+ } | {
164
+ type: "boolean";
165
+ boolean: boolean | null;
166
+ } | {
167
+ type: "date";
168
+ date: NotionDate | null;
169
+ };
170
+ export type NotionRollup = {
171
+ type: "number";
172
+ number: number | null;
173
+ } | {
174
+ type: "date";
175
+ date: NotionDate | null;
176
+ } | {
177
+ type: "array";
178
+ array: NotionPropertyValue[];
179
+ } | {
180
+ type: "incomplete" | "unsupported";
181
+ };
182
+ export interface NotionPage {
183
+ object: "page";
184
+ id: string;
185
+ created_time: string;
186
+ /** Notion rounds it to the minute (not checked live). */
187
+ last_edited_time: string;
188
+ created_by?: NotionUser;
189
+ last_edited_by?: NotionUser;
190
+ in_trash: boolean;
191
+ parent: NotionParent;
192
+ url: string;
193
+ properties: Record<string, NotionPropertyValue>;
194
+ }
195
+ export interface NotionDataSource {
196
+ object: "data_source";
197
+ id: string;
198
+ /** An externally synced source can sit under another source; both forms name the database. */
199
+ parent: {
200
+ type: "database_id";
201
+ database_id: string;
202
+ } | {
203
+ type: "data_source_id";
204
+ data_source_id: string;
205
+ database_id: string;
206
+ };
207
+ last_edited_time: string;
208
+ in_trash: boolean;
209
+ }
210
+ export interface NotionDatabase {
211
+ object: "database";
212
+ id: string;
213
+ title: NotionRichText[];
214
+ parent: NotionParent;
215
+ created_time: string;
216
+ last_edited_time: string;
217
+ in_trash: boolean;
218
+ url: string;
219
+ data_sources: {
220
+ id: string;
221
+ name: string;
222
+ }[];
223
+ }
224
+ export interface NotionBlock {
225
+ object: "block";
226
+ id: string;
227
+ type: string;
228
+ has_children: boolean;
229
+ in_trash?: boolean;
230
+ parent: NotionParent;
231
+ created_time: string;
232
+ last_edited_time: string;
233
+ created_by?: NotionUser;
234
+ last_edited_by?: NotionUser;
235
+ child_page?: {
236
+ title: string;
237
+ };
238
+ child_database?: {
239
+ title: string;
240
+ };
241
+ }
242
+ export interface NotionList<T> {
243
+ results: T[];
244
+ next_cursor: string | null;
245
+ has_more: boolean;
246
+ /** `incomplete` on every page of a query Notion cut at 10,000 results. */
247
+ request_status?: {
248
+ type: "complete" | "incomplete";
249
+ incomplete_reason?: string;
250
+ };
251
+ }
252
+ export interface NotionSearchRequest {
253
+ filter: {
254
+ property: "object";
255
+ value: "page" | "data_source";
256
+ };
257
+ sort: {
258
+ timestamp: "last_edited_time";
259
+ direction: "ascending" | "descending";
260
+ };
261
+ start_cursor?: string;
262
+ page_size?: number;
263
+ }
264
+ export type NotionTimestampFilter = {
265
+ timestamp: "last_edited_time";
266
+ last_edited_time: {
267
+ on_or_after: string;
268
+ };
269
+ } | {
270
+ timestamp: "created_time";
271
+ created_time: {
272
+ on_or_after: string;
273
+ };
274
+ };
275
+ export interface NotionQueryRequest {
276
+ filter?: NotionTimestampFilter | {
277
+ and: NotionTimestampFilter[];
278
+ };
279
+ sorts?: {
280
+ timestamp: "created_time" | "last_edited_time";
281
+ direction: "ascending" | "descending";
282
+ }[];
283
+ start_cursor?: string;
284
+ page_size?: number;
285
+ }
286
+ export interface NotionPageMarkdown {
287
+ /** Markdown v2 (`markdown_version=v2`). */
288
+ markdown: string;
289
+ truncated: boolean;
290
+ /** Truncated and unshared blocks alike; a re-fetch of an unshared one is a 404. */
291
+ unknown_block_ids: string[];
292
+ }
293
+ /** The token's bot user; a personal access token has one too, owned by the person who made it. */
294
+ export interface NotionSelf {
295
+ object: "user";
296
+ id: string;
297
+ type: "bot" | "person";
298
+ name?: string | null;
299
+ bot?: {
300
+ workspace_id?: string;
301
+ workspace_name?: string | null;
302
+ owner?: {
303
+ type: "workspace" | "user";
304
+ };
305
+ };
306
+ }
307
+ export interface NotionReads {
308
+ /** `GET /v1/users/me`. */
309
+ self(): Promise<NotionSelf>;
310
+ /** `POST /v1/search`, without a text query. */
311
+ search(request: NotionSearchRequest): Promise<NotionList<NotionPage | NotionDataSource>>;
312
+ /** `POST /v1/data_sources/{id}/query`. */
313
+ queryDataSource(id: string, request: NotionQueryRequest): Promise<NotionList<NotionPage>>;
314
+ /** `GET /v1/pages/{id}`. A trashed page answers with `in_trash: true`. */
315
+ retrievePage(id: string): Promise<NotionPage>;
316
+ /** `GET /v1/databases/{id}`, with its data sources. */
317
+ retrieveDatabase(id: string): Promise<NotionDatabase>;
318
+ /** `GET /v1/blocks/{id}`, to climb from a page whose parent is a block to the page that holds it. */
319
+ retrieveBlock(id: string): Promise<NotionBlock>;
320
+ /** `GET /v1/blocks/{id}/children`, one page of up to 100. */
321
+ blockChildren(id: string, startCursor?: string): Promise<NotionList<NotionBlock>>;
322
+ /** `GET /v1/pages/{id}/markdown?markdown_version=v2`; a block id fetches that block's subtree. */
323
+ pageMarkdown(id: string): Promise<NotionPageMarkdown>;
324
+ /**
325
+ * Notion's clock: the `Date` header of its latest answer, in milliseconds, or undefined before any answer. Not a
326
+ * request. The sync compares Notion's timestamps with it, never with this computer's clock.
327
+ */
328
+ serverTime?(): number | undefined;
329
+ }
330
+ export {};
331
+ //# sourceMappingURL=reads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reads.d.ts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1
+ /**
2
+ * The reads the incremental sync needs from Notion, and nothing more. The real client implements it; the sync's tests
3
+ * implement it with a strict fake. Shapes are the subset of Notion's own JSON (API version 2026-03-11) the sync reads,
4
+ * so an implementation passes Notion's answers through instead of converting them.
5
+ *
6
+ * Errors, after the implementation's own retries and pacing:
7
+ * - `CliError("not_found")` for 404 `object_not_found`: deleted for good, or not shared with this token. Notion does
8
+ * not say which, and the sync treats both as gone.
9
+ * - `CliError("permission_error")` for 403 `restricted_resource`.
10
+ * - `CliError("rate_limited", …, { retry_after_ms })` for a 429 or 529 the implementation stopped retrying.
11
+ * - `CliError("validation_error")` for a 400, for example a start cursor Notion no longer accepts.
12
+ * - A list answer cut at Notion's 10,000-result cap carries `request_status.type: "incomplete"`; search too.
13
+ *
14
+ * Endpoint pages: https://developers.notion.com/reference/post-search, /query-a-data-source, /retrieve-a-page,
15
+ * /retrieve-a-database, /retrieve-a-block, /get-block-children, /retrieve-page-markdown, /get-self.
16
+ */
17
+ export {};
18
+ //# sourceMappingURL=reads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reads.js","sourceRoot":"","sources":["../../src/notion/reads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
@@ -0,0 +1,6 @@
1
+ import { type ProgramDefinition, type ProgramOptions, type RunOptions } from "@wirecat/cli-core/cli";
2
+ import type { Command } from "commander";
3
+ export declare const definition: () => ProgramDefinition;
4
+ export declare const createProgram: (options?: ProgramOptions) => Command;
5
+ export declare const run: (argv: string[], options?: RunOptions) => Promise<number>;
6
+ //# sourceMappingURL=program.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAEA,OAAO,EAQL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,UAAU,EAKhB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAuCxC,eAAO,MAAM,UAAU,QAAO,iBAsB5B,CAAA;AAEF,eAAO,MAAM,aAAa,aAAc,cAAc,KAAG,OAAqD,CAAA;AAE9G,eAAO,MAAM,GAAG,SAAU,MAAM,EAAE,YAAY,UAAU,KAAG,OAAO,CAAC,MAAM,CAA2C,CAAA"}
@@ -0,0 +1,62 @@
1
+ import { join } from "node:path";
2
+ import { resolvePaths } from "@wirecat/cli-base";
3
+ import { appDoctorCommand, appMcpCommand, commandsCommand, configCommand, createProgram as createSharedProgram, outputFor, ProfileTokenStore, run as runShared, runsCommand, skillCommand, upgradeCommand, } from "@wirecat/cli-core/cli";
4
+ import { appUpdate } from "@wirecat/cli-core/update";
5
+ import { apiCommand } from "./commands/api.js";
6
+ import { databasesCommand } from "./commands/databases.js";
7
+ import { libraryCommands } from "./commands/library.js";
8
+ import { sessionCommand } from "./commands/session.js";
9
+ import { configuration } from "./config.js";
10
+ import { IDENTITY, PACKAGE, SKILL } from "./identity.js";
11
+ const update = appUpdate({
12
+ packageName: PACKAGE,
13
+ command: IDENTITY.command,
14
+ version: IDENTITY.version,
15
+ entry: import.meta.url,
16
+ statePath: (env) => join(resolvePaths({ appName: IDENTITY.appName, prefix: IDENTITY.envPrefix, env }).state, "update-check.json"),
17
+ // biome-ignore lint/plugin/no-own-settings: the update check runs before any command exists to give baseContext
18
+ enabled: (env) => configuration.resolveSettings({}, { env, needsProfile: false }).updateCheck,
19
+ offVariables: [`${IDENTITY.envPrefix}_NO_UPDATE_CHECK`],
20
+ });
21
+ const mcpCommand = () => appMcpCommand(IDENTITY, configuration, {
22
+ name: "Notion",
23
+ // Pages and databases are shared: other members write their text, titles and options (WC-MCP-11).
24
+ untrusted: [
25
+ "page text",
26
+ "page and database titles",
27
+ "database descriptions",
28
+ "property names and options",
29
+ "links",
30
+ "comment text",
31
+ "author names",
32
+ ],
33
+ permissionExample: "documents.get=deny",
34
+ skill: SKILL,
35
+ signedIn: (profile, env, keyring) => new ProfileTokenStore({ app: IDENTITY, env, ...(keyring ? { keyring } : {}) }).signedIn(profile),
36
+ });
37
+ export const definition = () => ({
38
+ app: IDENTITY,
39
+ // The whole object: cli-core refuses a command by its key only when it gets the permission table too.
40
+ configuration,
41
+ commands: () => [
42
+ commandsCommand(IDENTITY),
43
+ sessionCommand(),
44
+ ...libraryCommands(),
45
+ databasesCommand(),
46
+ apiCommand(),
47
+ appDoctorCommand(IDENTITY, configuration, { packageName: PACKAGE }),
48
+ skillCommand(IDENTITY, SKILL),
49
+ mcpCommand(),
50
+ upgradeCommand(IDENTITY, PACKAGE, (command) => ({
51
+ ...outputFor(command),
52
+ installer: () => update.installer({}),
53
+ latest: () => update.latest({}),
54
+ install: (argv) => update.runUpdate(argv, {}),
55
+ })),
56
+ configCommand(IDENTITY, configuration),
57
+ runsCommand(IDENTITY),
58
+ ],
59
+ });
60
+ export const createProgram = (options) => createSharedProgram(definition(), options);
61
+ export const run = (argv, options) => runShared(argv, definition(), options);
62
+ //# sourceMappingURL=program.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,aAAa,EACb,aAAa,IAAI,mBAAmB,EACpC,SAAS,EACT,iBAAiB,EAIjB,GAAG,IAAI,SAAS,EAChB,WAAW,EACX,YAAY,EACZ,cAAc,GACf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAA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