@bosun-sh/logbook 1.0.0 → 2.0.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 (455) hide show
  1. package/CHANGELOG.md +139 -0
  2. package/README.md +252 -272
  3. package/bin/logbook.cjs +18 -0
  4. package/dist/context/attachments.d.ts +55 -0
  5. package/dist/context/attachments.d.ts.map +1 -0
  6. package/dist/context/attachments.js +329 -0
  7. package/dist/context/attachments.js.map +1 -0
  8. package/dist/context/create.d.ts +31 -0
  9. package/dist/context/create.d.ts.map +1 -0
  10. package/dist/context/create.js +101 -0
  11. package/dist/context/create.js.map +1 -0
  12. package/dist/context/delete.d.ts +20 -0
  13. package/dist/context/delete.d.ts.map +1 -0
  14. package/dist/context/delete.js +55 -0
  15. package/dist/context/delete.js.map +1 -0
  16. package/dist/context/get.d.ts +20 -0
  17. package/dist/context/get.d.ts.map +1 -0
  18. package/dist/context/get.js +55 -0
  19. package/dist/context/get.js.map +1 -0
  20. package/dist/context/list.d.ts +30 -0
  21. package/dist/context/list.d.ts.map +1 -0
  22. package/dist/context/list.js +172 -0
  23. package/dist/context/list.js.map +1 -0
  24. package/dist/context/schema.d.ts +156 -0
  25. package/dist/context/schema.d.ts.map +1 -0
  26. package/dist/context/schema.js +34 -0
  27. package/dist/context/schema.js.map +1 -0
  28. package/dist/context/search.d.ts +27 -0
  29. package/dist/context/search.d.ts.map +1 -0
  30. package/dist/context/search.js +266 -0
  31. package/dist/context/search.js.map +1 -0
  32. package/dist/context/topics.d.ts +4 -0
  33. package/dist/context/topics.d.ts.map +1 -0
  34. package/dist/context/topics.js +54 -0
  35. package/dist/context/topics.js.map +1 -0
  36. package/dist/context/update.d.ts +29 -0
  37. package/dist/context/update.d.ts.map +1 -0
  38. package/dist/context/update.js +134 -0
  39. package/dist/context/update.js.map +1 -0
  40. package/dist/epic/cascade-delete.d.ts +30 -0
  41. package/dist/epic/cascade-delete.d.ts.map +1 -0
  42. package/dist/epic/cascade-delete.js +173 -0
  43. package/dist/epic/cascade-delete.js.map +1 -0
  44. package/dist/epic/create.d.ts +24 -0
  45. package/dist/epic/create.d.ts.map +1 -0
  46. package/dist/epic/create.js +54 -0
  47. package/dist/epic/create.js.map +1 -0
  48. package/dist/epic/delete.d.ts +21 -0
  49. package/dist/epic/delete.d.ts.map +1 -0
  50. package/dist/epic/delete.js +42 -0
  51. package/dist/epic/delete.js.map +1 -0
  52. package/dist/epic/get.d.ts +19 -0
  53. package/dist/epic/get.d.ts.map +1 -0
  54. package/dist/epic/get.js +31 -0
  55. package/dist/epic/get.js.map +1 -0
  56. package/dist/epic/list.d.ts +25 -0
  57. package/dist/epic/list.d.ts.map +1 -0
  58. package/dist/epic/list.js +114 -0
  59. package/dist/epic/list.js.map +1 -0
  60. package/dist/epic/rules.d.ts +34 -0
  61. package/dist/epic/rules.d.ts.map +1 -0
  62. package/dist/epic/rules.js +127 -0
  63. package/dist/epic/rules.js.map +1 -0
  64. package/dist/epic/schema.d.ts +85 -0
  65. package/dist/epic/schema.d.ts.map +1 -0
  66. package/dist/epic/schema.js +14 -0
  67. package/dist/epic/schema.js.map +1 -0
  68. package/dist/epic/update.d.ts +25 -0
  69. package/dist/epic/update.d.ts.map +1 -0
  70. package/dist/epic/update.js +69 -0
  71. package/dist/epic/update.js.map +1 -0
  72. package/dist/hook/list.d.ts +71 -0
  73. package/dist/hook/list.d.ts.map +1 -0
  74. package/dist/hook/list.js +364 -0
  75. package/dist/hook/list.js.map +1 -0
  76. package/dist/hook/ports.d.ts +16 -0
  77. package/dist/hook/ports.d.ts.map +1 -0
  78. package/dist/hook/ports.js +3 -0
  79. package/dist/hook/ports.js.map +1 -0
  80. package/dist/hook/run.d.ts +24 -0
  81. package/dist/hook/run.d.ts.map +1 -0
  82. package/dist/hook/run.js +185 -0
  83. package/dist/hook/run.js.map +1 -0
  84. package/dist/index.d.ts +31 -0
  85. package/dist/index.d.ts.map +1 -0
  86. package/dist/index.js +31 -0
  87. package/dist/index.js.map +1 -0
  88. package/dist/plugin/hook-tools.d.ts +8 -0
  89. package/dist/plugin/hook-tools.d.ts.map +1 -0
  90. package/dist/plugin/hook-tools.js +31 -0
  91. package/dist/plugin/hook-tools.js.map +1 -0
  92. package/dist/plugin/linear-pull-tool.d.ts +20 -0
  93. package/dist/plugin/linear-pull-tool.d.ts.map +1 -0
  94. package/dist/plugin/linear-pull-tool.js +19 -0
  95. package/dist/plugin/linear-pull-tool.js.map +1 -0
  96. package/dist/plugin/linear-push-tool.d.ts +20 -0
  97. package/dist/plugin/linear-push-tool.d.ts.map +1 -0
  98. package/dist/plugin/linear-push-tool.js +27 -0
  99. package/dist/plugin/linear-push-tool.js.map +1 -0
  100. package/dist/plugin/linear-setup-tool.d.ts +2 -0
  101. package/dist/plugin/linear-setup-tool.d.ts.map +1 -0
  102. package/dist/plugin/linear-setup-tool.js +22 -0
  103. package/dist/plugin/linear-setup-tool.js.map +1 -0
  104. package/dist/plugin/linear-status-tool.d.ts +10 -0
  105. package/dist/plugin/linear-status-tool.d.ts.map +1 -0
  106. package/dist/plugin/linear-status-tool.js +10 -0
  107. package/dist/plugin/linear-status-tool.js.map +1 -0
  108. package/dist/plugin/list.d.ts +15 -0
  109. package/dist/plugin/list.d.ts.map +1 -0
  110. package/dist/plugin/list.js +87 -0
  111. package/dist/plugin/list.js.map +1 -0
  112. package/dist/plugin/public-schemas.d.ts +42 -0
  113. package/dist/plugin/public-schemas.d.ts.map +1 -0
  114. package/dist/plugin/public-schemas.js +577 -0
  115. package/dist/plugin/public-schemas.js.map +1 -0
  116. package/dist/plugin/registry.d.ts +3 -0
  117. package/dist/plugin/registry.d.ts.map +1 -0
  118. package/dist/plugin/registry.js +3 -0
  119. package/dist/plugin/registry.js.map +1 -0
  120. package/dist/plugin/results.d.ts +8 -0
  121. package/dist/plugin/results.d.ts.map +1 -0
  122. package/dist/plugin/results.js +114 -0
  123. package/dist/plugin/results.js.map +1 -0
  124. package/dist/plugin/sync-conflict-tools.d.ts +2 -0
  125. package/dist/plugin/sync-conflict-tools.d.ts.map +1 -0
  126. package/dist/plugin/sync-conflict-tools.js +5 -0
  127. package/dist/plugin/sync-conflict-tools.js.map +1 -0
  128. package/dist/plugin/tool-registry.d.ts +23 -0
  129. package/dist/plugin/tool-registry.d.ts.map +1 -0
  130. package/dist/plugin/tool-registry.js +251 -0
  131. package/dist/plugin/tool-registry.js.map +1 -0
  132. package/dist/plugin/workspace-init-tool.d.ts +2 -0
  133. package/dist/plugin/workspace-init-tool.d.ts.map +1 -0
  134. package/dist/plugin/workspace-init-tool.js +16 -0
  135. package/dist/plugin/workspace-init-tool.js.map +1 -0
  136. package/dist/plugin/workspace-status-tool.d.ts +2 -0
  137. package/dist/plugin/workspace-status-tool.d.ts.map +1 -0
  138. package/dist/plugin/workspace-status-tool.js +15 -0
  139. package/dist/plugin/workspace-status-tool.js.map +1 -0
  140. package/dist/shared/ids.d.ts +3 -0
  141. package/dist/shared/ids.d.ts.map +1 -0
  142. package/dist/shared/ids.js +15 -0
  143. package/dist/shared/ids.js.map +1 -0
  144. package/dist/shared/pagination.d.ts +19 -0
  145. package/dist/shared/pagination.d.ts.map +1 -0
  146. package/dist/shared/pagination.js +110 -0
  147. package/dist/shared/pagination.js.map +1 -0
  148. package/dist/shared/result.d.ts +20 -0
  149. package/dist/shared/result.d.ts.map +1 -0
  150. package/dist/shared/result.js +6 -0
  151. package/dist/shared/result.js.map +1 -0
  152. package/dist/shared/schema/value-objects.d.ts +363 -0
  153. package/dist/shared/schema/value-objects.d.ts.map +1 -0
  154. package/dist/shared/schema/value-objects.js +112 -0
  155. package/dist/shared/schema/value-objects.js.map +1 -0
  156. package/dist/shared/storage/atomic-write.d.ts +25 -0
  157. package/dist/shared/storage/atomic-write.d.ts.map +1 -0
  158. package/dist/shared/storage/atomic-write.js +71 -0
  159. package/dist/shared/storage/atomic-write.js.map +1 -0
  160. package/dist/shared/storage/jsonl-repository.d.ts +85 -0
  161. package/dist/shared/storage/jsonl-repository.d.ts.map +1 -0
  162. package/dist/shared/storage/jsonl-repository.js +278 -0
  163. package/dist/shared/storage/jsonl-repository.js.map +1 -0
  164. package/dist/shared/storage/transaction.d.ts +3 -0
  165. package/dist/shared/storage/transaction.d.ts.map +1 -0
  166. package/dist/shared/storage/transaction.js +22 -0
  167. package/dist/shared/storage/transaction.js.map +1 -0
  168. package/dist/shared/time.d.ts +3 -0
  169. package/dist/shared/time.d.ts.map +1 -0
  170. package/dist/shared/time.js +3 -0
  171. package/dist/shared/time.js.map +1 -0
  172. package/dist/story/cascade-delete.d.ts +22 -0
  173. package/dist/story/cascade-delete.d.ts.map +1 -0
  174. package/dist/story/cascade-delete.js +117 -0
  175. package/dist/story/cascade-delete.js.map +1 -0
  176. package/dist/story/create.d.ts +30 -0
  177. package/dist/story/create.d.ts.map +1 -0
  178. package/dist/story/create.js +69 -0
  179. package/dist/story/create.js.map +1 -0
  180. package/dist/story/delete.d.ts +21 -0
  181. package/dist/story/delete.d.ts.map +1 -0
  182. package/dist/story/delete.js +42 -0
  183. package/dist/story/delete.js.map +1 -0
  184. package/dist/story/get.d.ts +19 -0
  185. package/dist/story/get.d.ts.map +1 -0
  186. package/dist/story/get.js +31 -0
  187. package/dist/story/get.js.map +1 -0
  188. package/dist/story/hierarchy.d.ts +20 -0
  189. package/dist/story/hierarchy.d.ts.map +1 -0
  190. package/dist/story/hierarchy.js +30 -0
  191. package/dist/story/hierarchy.js.map +1 -0
  192. package/dist/story/list.d.ts +25 -0
  193. package/dist/story/list.d.ts.map +1 -0
  194. package/dist/story/list.js +118 -0
  195. package/dist/story/list.js.map +1 -0
  196. package/dist/story/rules.d.ts +34 -0
  197. package/dist/story/rules.d.ts.map +1 -0
  198. package/dist/story/rules.js +100 -0
  199. package/dist/story/rules.js.map +1 -0
  200. package/dist/story/schema.d.ts +65 -0
  201. package/dist/story/schema.d.ts.map +1 -0
  202. package/dist/story/schema.js +14 -0
  203. package/dist/story/schema.js.map +1 -0
  204. package/dist/story/update.d.ts +23 -0
  205. package/dist/story/update.d.ts.map +1 -0
  206. package/dist/story/update.js +67 -0
  207. package/dist/story/update.js.map +1 -0
  208. package/dist/sync/base-snapshot.d.ts +38 -0
  209. package/dist/sync/base-snapshot.d.ts.map +1 -0
  210. package/dist/sync/base-snapshot.js +86 -0
  211. package/dist/sync/base-snapshot.js.map +1 -0
  212. package/dist/sync/conflict-tools.d.ts +75 -0
  213. package/dist/sync/conflict-tools.d.ts.map +1 -0
  214. package/dist/sync/conflict-tools.js +53 -0
  215. package/dist/sync/conflict-tools.js.map +1 -0
  216. package/dist/sync/conflicts.d.ts +201 -0
  217. package/dist/sync/conflicts.d.ts.map +1 -0
  218. package/dist/sync/conflicts.js +526 -0
  219. package/dist/sync/conflicts.js.map +1 -0
  220. package/dist/sync/deferred-providers.d.ts +2 -0
  221. package/dist/sync/deferred-providers.d.ts.map +1 -0
  222. package/dist/sync/deferred-providers.js +6 -0
  223. package/dist/sync/deferred-providers.js.map +1 -0
  224. package/dist/sync/events.d.ts +401 -0
  225. package/dist/sync/events.d.ts.map +1 -0
  226. package/dist/sync/events.js +357 -0
  227. package/dist/sync/events.js.map +1 -0
  228. package/dist/sync/external-links.d.ts +154 -0
  229. package/dist/sync/external-links.d.ts.map +1 -0
  230. package/dist/sync/external-links.js +306 -0
  231. package/dist/sync/external-links.js.map +1 -0
  232. package/dist/sync/linear/config.d.ts +60 -0
  233. package/dist/sync/linear/config.d.ts.map +1 -0
  234. package/dist/sync/linear/config.js +302 -0
  235. package/dist/sync/linear/config.js.map +1 -0
  236. package/dist/sync/linear/mapping.d.ts +115 -0
  237. package/dist/sync/linear/mapping.d.ts.map +1 -0
  238. package/dist/sync/linear/mapping.js +159 -0
  239. package/dist/sync/linear/mapping.js.map +1 -0
  240. package/dist/sync/linear/pull.d.ts +33 -0
  241. package/dist/sync/linear/pull.d.ts.map +1 -0
  242. package/dist/sync/linear/pull.js +376 -0
  243. package/dist/sync/linear/pull.js.map +1 -0
  244. package/dist/sync/linear/push.d.ts +34 -0
  245. package/dist/sync/linear/push.d.ts.map +1 -0
  246. package/dist/sync/linear/push.js +681 -0
  247. package/dist/sync/linear/push.js.map +1 -0
  248. package/dist/sync/linear/setup.d.ts +33 -0
  249. package/dist/sync/linear/setup.d.ts.map +1 -0
  250. package/dist/sync/linear/setup.js +129 -0
  251. package/dist/sync/linear/setup.js.map +1 -0
  252. package/dist/sync/linear/status.d.ts +35 -0
  253. package/dist/sync/linear/status.d.ts.map +1 -0
  254. package/dist/sync/linear/status.js +138 -0
  255. package/dist/sync/linear/status.js.map +1 -0
  256. package/dist/sync/linear/transport.d.ts +47 -0
  257. package/dist/sync/linear/transport.d.ts.map +1 -0
  258. package/dist/sync/linear/transport.js +249 -0
  259. package/dist/sync/linear/transport.js.map +1 -0
  260. package/dist/sync/provider-port.d.ts +81 -0
  261. package/dist/sync/provider-port.d.ts.map +1 -0
  262. package/dist/sync/provider-port.js +16 -0
  263. package/dist/sync/provider-port.js.map +1 -0
  264. package/dist/sync/provider-registry.d.ts +38 -0
  265. package/dist/sync/provider-registry.d.ts.map +1 -0
  266. package/dist/sync/provider-registry.js +115 -0
  267. package/dist/sync/provider-registry.js.map +1 -0
  268. package/dist/sync/schema.d.ts +147 -0
  269. package/dist/sync/schema.d.ts.map +1 -0
  270. package/dist/sync/schema.js +28 -0
  271. package/dist/sync/schema.js.map +1 -0
  272. package/dist/task/comments.d.ts +9 -0
  273. package/dist/task/comments.d.ts.map +1 -0
  274. package/dist/task/comments.js +79 -0
  275. package/dist/task/comments.js.map +1 -0
  276. package/dist/task/create.d.ts +34 -0
  277. package/dist/task/create.d.ts.map +1 -0
  278. package/dist/task/create.js +126 -0
  279. package/dist/task/create.js.map +1 -0
  280. package/dist/task/current.d.ts +18 -0
  281. package/dist/task/current.d.ts.map +1 -0
  282. package/dist/task/current.js +105 -0
  283. package/dist/task/current.js.map +1 -0
  284. package/dist/task/edit.d.ts +22 -0
  285. package/dist/task/edit.d.ts.map +1 -0
  286. package/dist/task/edit.js +105 -0
  287. package/dist/task/edit.js.map +1 -0
  288. package/dist/task/estimate.d.ts +20 -0
  289. package/dist/task/estimate.d.ts.map +1 -0
  290. package/dist/task/estimate.js +141 -0
  291. package/dist/task/estimate.js.map +1 -0
  292. package/dist/task/get.d.ts +13 -0
  293. package/dist/task/get.d.ts.map +1 -0
  294. package/dist/task/get.js +29 -0
  295. package/dist/task/get.js.map +1 -0
  296. package/dist/task/hierarchy.d.ts +18 -0
  297. package/dist/task/hierarchy.d.ts.map +1 -0
  298. package/dist/task/hierarchy.js +56 -0
  299. package/dist/task/hierarchy.js.map +1 -0
  300. package/dist/task/lifecycle.d.ts +14 -0
  301. package/dist/task/lifecycle.d.ts.map +1 -0
  302. package/dist/task/lifecycle.js +80 -0
  303. package/dist/task/lifecycle.js.map +1 -0
  304. package/dist/task/list.d.ts +24 -0
  305. package/dist/task/list.d.ts.map +1 -0
  306. package/dist/task/list.js +116 -0
  307. package/dist/task/list.js.map +1 -0
  308. package/dist/task/model-assignment.d.ts +33 -0
  309. package/dist/task/model-assignment.d.ts.map +1 -0
  310. package/dist/task/model-assignment.js +145 -0
  311. package/dist/task/model-assignment.js.map +1 -0
  312. package/dist/task/ordering.d.ts +4 -0
  313. package/dist/task/ordering.d.ts.map +1 -0
  314. package/dist/task/ordering.js +14 -0
  315. package/dist/task/ordering.js.map +1 -0
  316. package/dist/task/ports.d.ts +37 -0
  317. package/dist/task/ports.d.ts.map +1 -0
  318. package/dist/task/ports.js +3 -0
  319. package/dist/task/ports.js.map +1 -0
  320. package/dist/task/schema.d.ts +447 -0
  321. package/dist/task/schema.d.ts.map +1 -0
  322. package/dist/task/schema.js +35 -0
  323. package/dist/task/schema.js.map +1 -0
  324. package/dist/task/session-assignment.d.ts +23 -0
  325. package/dist/task/session-assignment.d.ts.map +1 -0
  326. package/dist/task/session-assignment.js +197 -0
  327. package/dist/task/session-assignment.js.map +1 -0
  328. package/dist/task/session-registry.d.ts +8 -0
  329. package/dist/task/session-registry.d.ts.map +1 -0
  330. package/dist/task/session-registry.js +3 -0
  331. package/dist/task/session-registry.js.map +1 -0
  332. package/dist/task/update.d.ts +23 -0
  333. package/dist/task/update.d.ts.map +1 -0
  334. package/dist/task/update.js +92 -0
  335. package/dist/task/update.js.map +1 -0
  336. package/dist/task/v1-compat.d.ts +94 -0
  337. package/dist/task/v1-compat.d.ts.map +1 -0
  338. package/dist/task/v1-compat.js +181 -0
  339. package/dist/task/v1-compat.js.map +1 -0
  340. package/dist/workspace/bin-cli.d.ts +2 -0
  341. package/dist/workspace/bin-cli.d.ts.map +1 -0
  342. package/dist/workspace/bin-cli.js +36 -0
  343. package/dist/workspace/bin-cli.js.map +1 -0
  344. package/dist/workspace/cli-adapter.d.ts +16 -0
  345. package/dist/workspace/cli-adapter.d.ts.map +1 -0
  346. package/dist/workspace/cli-adapter.js +229 -0
  347. package/dist/workspace/cli-adapter.js.map +1 -0
  348. package/dist/workspace/cli-commands.d.ts +11 -0
  349. package/dist/workspace/cli-commands.d.ts.map +1 -0
  350. package/dist/workspace/cli-commands.js +12 -0
  351. package/dist/workspace/cli-commands.js.map +1 -0
  352. package/dist/workspace/duckdb-index.d.ts +56 -0
  353. package/dist/workspace/duckdb-index.d.ts.map +1 -0
  354. package/dist/workspace/duckdb-index.js +178 -0
  355. package/dist/workspace/duckdb-index.js.map +1 -0
  356. package/dist/workspace/hook-templates/need-info-notify/config.json +10 -0
  357. package/dist/workspace/hook-templates/need-info-notify/script.mjs +68 -0
  358. package/dist/workspace/hook-templates/review-spawn/config.json +10 -0
  359. package/dist/workspace/hook-templates/review-spawn/script.mjs +100 -0
  360. package/dist/workspace/init-onboarding.d.ts +9 -0
  361. package/dist/workspace/init-onboarding.d.ts.map +1 -0
  362. package/dist/workspace/init-onboarding.js +259 -0
  363. package/dist/workspace/init-onboarding.js.map +1 -0
  364. package/dist/workspace/init.d.ts +20 -0
  365. package/dist/workspace/init.d.ts.map +1 -0
  366. package/dist/workspace/init.js +288 -0
  367. package/dist/workspace/init.js.map +1 -0
  368. package/dist/workspace/layers.d.ts +127 -0
  369. package/dist/workspace/layers.d.ts.map +1 -0
  370. package/dist/workspace/layers.js +50 -0
  371. package/dist/workspace/layers.js.map +1 -0
  372. package/dist/workspace/mcp-server.d.ts +28 -0
  373. package/dist/workspace/mcp-server.d.ts.map +1 -0
  374. package/dist/workspace/mcp-server.js +190 -0
  375. package/dist/workspace/mcp-server.js.map +1 -0
  376. package/dist/workspace/mcp-stdio.d.ts +2 -0
  377. package/dist/workspace/mcp-stdio.d.ts.map +1 -0
  378. package/dist/workspace/mcp-stdio.js +66 -0
  379. package/dist/workspace/mcp-stdio.js.map +1 -0
  380. package/dist/workspace/mcp-tools.d.ts +24 -0
  381. package/dist/workspace/mcp-tools.d.ts.map +1 -0
  382. package/dist/workspace/mcp-tools.js +43 -0
  383. package/dist/workspace/mcp-tools.js.map +1 -0
  384. package/dist/workspace/migrate-v1.d.ts +12 -0
  385. package/dist/workspace/migrate-v1.d.ts.map +1 -0
  386. package/dist/workspace/migrate-v1.js +301 -0
  387. package/dist/workspace/migrate-v1.js.map +1 -0
  388. package/dist/workspace/ohtools-app.d.ts +3 -0
  389. package/dist/workspace/ohtools-app.d.ts.map +1 -0
  390. package/dist/workspace/ohtools-app.js +10 -0
  391. package/dist/workspace/ohtools-app.js.map +1 -0
  392. package/dist/workspace/repositories.d.ts +25 -0
  393. package/dist/workspace/repositories.d.ts.map +1 -0
  394. package/dist/workspace/repositories.js +76 -0
  395. package/dist/workspace/repositories.js.map +1 -0
  396. package/dist/workspace/runtime.d.ts +123 -0
  397. package/dist/workspace/runtime.d.ts.map +1 -0
  398. package/dist/workspace/runtime.js +4 -0
  399. package/dist/workspace/runtime.js.map +1 -0
  400. package/dist/workspace/session-liveness.d.ts +6 -0
  401. package/dist/workspace/session-liveness.d.ts.map +1 -0
  402. package/dist/workspace/session-liveness.js +3 -0
  403. package/dist/workspace/session-liveness.js.map +1 -0
  404. package/dist/workspace/status.d.ts +46 -0
  405. package/dist/workspace/status.d.ts.map +1 -0
  406. package/dist/workspace/status.js +345 -0
  407. package/dist/workspace/status.js.map +1 -0
  408. package/dist/workspace/storage-layout.d.ts +19 -0
  409. package/dist/workspace/storage-layout.d.ts.map +1 -0
  410. package/dist/workspace/storage-layout.js +55 -0
  411. package/dist/workspace/storage-layout.js.map +1 -0
  412. package/dist/workspace/storage-paths.d.ts +16 -0
  413. package/dist/workspace/storage-paths.d.ts.map +1 -0
  414. package/dist/workspace/storage-paths.js +15 -0
  415. package/dist/workspace/storage-paths.js.map +1 -0
  416. package/dist/workspace/v1-cli-aliases.d.ts +18 -0
  417. package/dist/workspace/v1-cli-aliases.d.ts.map +1 -0
  418. package/dist/workspace/v1-cli-aliases.js +223 -0
  419. package/dist/workspace/v1-cli-aliases.js.map +1 -0
  420. package/dist/workspace/v1-cli-task.d.ts +2 -0
  421. package/dist/workspace/v1-cli-task.d.ts.map +1 -0
  422. package/dist/workspace/v1-cli-task.js +53 -0
  423. package/dist/workspace/v1-cli-task.js.map +1 -0
  424. package/package.json +29 -12
  425. package/quickstart.md +163 -0
  426. package/hooks/need-info-notify/config.yml +0 -3
  427. package/hooks/need-info-notify/script.ts +0 -69
  428. package/hooks/review-spawn/config.yml +0 -3
  429. package/hooks/review-spawn/script.ts +0 -96
  430. package/src/cli/init.ts +0 -90
  431. package/src/domain/fibonacci.ts +0 -39
  432. package/src/domain/kTokens.ts +0 -65
  433. package/src/domain/status-machine.ts +0 -49
  434. package/src/domain/types.ts +0 -66
  435. package/src/hook/hook-executor.ts +0 -70
  436. package/src/hook/ports.ts +0 -16
  437. package/src/infra/hook-config-loader.ts +0 -111
  438. package/src/infra/jsonl-task-repository.ts +0 -157
  439. package/src/infra/logger.ts +0 -40
  440. package/src/infra/pid-session-registry.ts +0 -67
  441. package/src/mcp/error-codes.ts +0 -213
  442. package/src/mcp/server.ts +0 -413
  443. package/src/mcp/session.ts +0 -1
  444. package/src/mcp/tool-create-task.ts +0 -28
  445. package/src/mcp/tool-current-task.ts +0 -19
  446. package/src/mcp/tool-edit-task.ts +0 -40
  447. package/src/mcp/tool-list-tasks.ts +0 -34
  448. package/src/mcp/tool-update-task.ts +0 -55
  449. package/src/task/create-task.ts +0 -67
  450. package/src/task/current-task.ts +0 -111
  451. package/src/task/edit-task.ts +0 -59
  452. package/src/task/list-tasks.ts +0 -35
  453. package/src/task/ports.ts +0 -15
  454. package/src/task/session-registry.ts +0 -9
  455. package/src/task/update-task.ts +0 -160
@@ -0,0 +1,681 @@
1
+ import { nowIso } from "../../shared/time.js";
2
+ import { createSyncConflict } from "../../sync/conflicts.js";
3
+ import { appendSyncEvent } from "../../sync/events.js";
4
+ import { findExternalLink, upsertExternalLink } from "../../sync/external-links.js";
5
+ import { readLinearApiToken, readLinearWorkspaceConfig } from "../../sync/linear/config.js";
6
+ import { mapTaskToLinearIssueInput } from "../../sync/linear/mapping.js";
7
+ import { Context, Effect } from "effect";
8
+ const LINEAR_PROVIDER_ID = "linear";
9
+ const DEFAULT_COMMENT_PAGE_SIZE = 100;
10
+ const MAX_COMMENT_PAGE_SIZE = 100;
11
+ const LINEAR_CREATE_ISSUE_OPERATION = "LinearCreateIssue";
12
+ const LINEAR_UPDATE_ISSUE_OPERATION = "LinearUpdateIssue";
13
+ const LINEAR_CREATE_COMMENT_OPERATION = "LinearCreateComment";
14
+ const TaskRepository = Context.GenericTag("TaskRepository");
15
+ const SyncEventRepository = Context.GenericTag("SyncEventRepository");
16
+ const LinearGraphQLClientTag = Context.GenericTag("LinearGraphQLClient");
17
+ export const pushLinearSync = (input) => Effect.gen(function* () {
18
+ const configResult = yield* Effect.promise(() => readLinearWorkspaceConfig());
19
+ if (!configResult.ok) {
20
+ return configResult;
21
+ }
22
+ const config = configResult.data;
23
+ const taskRepo = (yield* TaskRepository);
24
+ const eventRepo = (yield* SyncEventRepository);
25
+ const client = (yield* LinearGraphQLClientTag);
26
+ const defaultTeamId = config?.defaultTeamId;
27
+ const defaultProjectId = config?.defaultProjectId;
28
+ const statusMapping = config?.statusMapping;
29
+ const labelMapping = config?.labelMapping;
30
+ if (readLinearApiToken(config) === undefined) {
31
+ return providerError("auth_failed", "Linear API token is required.", {
32
+ provider: LINEAR_PROVIDER_ID,
33
+ reason: "missing_token",
34
+ });
35
+ }
36
+ const tasksResult = yield* loadTasks(taskRepo, input.taskIds);
37
+ if (!tasksResult.ok) {
38
+ return tasksResult;
39
+ }
40
+ const tasks = tasksResult.data;
41
+ let created = 0;
42
+ let updated = 0;
43
+ let skipped = 0;
44
+ let conflicts = 0;
45
+ const events = [];
46
+ for (const task of tasks) {
47
+ const linkResult = yield* findExternalLink({
48
+ provider: LINEAR_PROVIDER_ID,
49
+ localRecord: { kind: "task", id: task.id },
50
+ limit: 2,
51
+ });
52
+ if (!linkResult.ok) {
53
+ return linkResult;
54
+ }
55
+ const link = linkResult.data.externalLinks[0];
56
+ if (link === undefined) {
57
+ if (defaultTeamId === undefined || defaultTeamId.length === 0) {
58
+ const event = yield* appendAndCollect(events, eventRepo, {
59
+ direction: "push",
60
+ data: {
61
+ result: "skipped",
62
+ providerId: LINEAR_PROVIDER_ID,
63
+ entityType: "task",
64
+ entityId: task.id,
65
+ reason: "missing_mapping",
66
+ },
67
+ });
68
+ if (!event.ok) {
69
+ return event;
70
+ }
71
+ skipped += 1;
72
+ continue;
73
+ }
74
+ if (input.dryRun) {
75
+ const event = yield* appendAndCollect(events, eventRepo, {
76
+ direction: "push",
77
+ data: {
78
+ result: "skipped",
79
+ providerId: LINEAR_PROVIDER_ID,
80
+ entityType: "task",
81
+ entityId: task.id,
82
+ reason: "dry_run",
83
+ },
84
+ });
85
+ if (!event.ok) {
86
+ return event;
87
+ }
88
+ skipped += 1;
89
+ continue;
90
+ }
91
+ const createProjectId = input.projectId ?? defaultProjectId;
92
+ const mapped = mapTaskToLinearIssueInput(task, {
93
+ ...(defaultTeamId === undefined ? {} : { defaultTeamId }),
94
+ ...(createProjectId === undefined ? {} : { defaultProjectId: createProjectId }),
95
+ ...(statusMapping === undefined ? {} : { statusMapping }),
96
+ ...(labelMapping === undefined ? {} : { labelMapping }),
97
+ });
98
+ if (!mapped.ok) {
99
+ return mapped;
100
+ }
101
+ const createdIssue = yield* Effect.either(client.request({
102
+ operationName: LINEAR_CREATE_ISSUE_OPERATION,
103
+ query: LINEAR_CREATE_ISSUE_QUERY,
104
+ variables: mapped.data.input,
105
+ }));
106
+ if (createdIssue._tag === "Left") {
107
+ const failure = yield* appendFailedEvent(events, eventRepo, {
108
+ entityType: "task",
109
+ entityId: task.id,
110
+ error: createdIssue.left,
111
+ });
112
+ if (!failure.ok) {
113
+ return failure;
114
+ }
115
+ return providerError("unknown", "Linear issue creation failed.", {
116
+ provider: LINEAR_PROVIDER_ID,
117
+ error: createdIssue.left,
118
+ });
119
+ }
120
+ const createdRecord = createdIssue.right.issueCreate?.issue;
121
+ if (createdRecord === undefined || createdRecord === null) {
122
+ const failure = yield* appendFailedEvent(events, eventRepo, {
123
+ entityType: "task",
124
+ entityId: task.id,
125
+ error: {
126
+ providerId: LINEAR_PROVIDER_ID,
127
+ code: "not_found",
128
+ retryable: false,
129
+ message: "Linear issue creation returned no issue.",
130
+ },
131
+ });
132
+ if (!failure.ok) {
133
+ return failure;
134
+ }
135
+ return providerError("unknown", "Linear issue creation returned no issue.", {
136
+ provider: LINEAR_PROVIDER_ID,
137
+ });
138
+ }
139
+ const commentResult = yield* pushTaskComments({
140
+ task,
141
+ issueId: createdRecord.id,
142
+ lastPushedLocalVersion: undefined,
143
+ client,
144
+ events,
145
+ eventRepo,
146
+ });
147
+ if (!commentResult.ok) {
148
+ return commentResult;
149
+ }
150
+ const now = yield* nowIso();
151
+ const linked = yield* upsertExternalLink({
152
+ provider: LINEAR_PROVIDER_ID,
153
+ localRecord: { kind: "task", id: task.id },
154
+ remoteRecord: {
155
+ id: createdRecord.id,
156
+ ...(createdRecord.url === undefined || createdRecord.url === null
157
+ ? {}
158
+ : { url: createdRecord.url }),
159
+ type: "issue",
160
+ },
161
+ lastSyncedAt: now,
162
+ lastSeenRemoteVersion: createdRecord.updatedAt,
163
+ lastPushedLocalVersion: task.updatedAt,
164
+ });
165
+ if (!linked.ok) {
166
+ return linked;
167
+ }
168
+ const event = yield* appendAndCollect(events, eventRepo, {
169
+ direction: "push",
170
+ data: {
171
+ result: "created",
172
+ providerId: LINEAR_PROVIDER_ID,
173
+ entityType: "task",
174
+ entityId: task.id,
175
+ remoteId: createdRecord.id,
176
+ fields: commentResult.data.pushedComments > 0
177
+ ? ["title", "description", "status", "priority", "comments"]
178
+ : ["title", "description", "status", "priority"],
179
+ },
180
+ });
181
+ if (!event.ok) {
182
+ return event;
183
+ }
184
+ created += 1;
185
+ continue;
186
+ }
187
+ const issueResult = yield* Effect.either(client.request({
188
+ operationName: "LinearGetIssue",
189
+ query: LINEAR_GET_ISSUE_QUERY,
190
+ variables: {
191
+ id: link.remoteRecord.id,
192
+ },
193
+ }));
194
+ if (issueResult._tag === "Left") {
195
+ const failure = yield* appendFailedEvent(events, eventRepo, {
196
+ entityType: "task",
197
+ entityId: task.id,
198
+ remoteId: link.remoteRecord.id,
199
+ error: issueResult.left,
200
+ });
201
+ if (!failure.ok) {
202
+ return failure;
203
+ }
204
+ return providerError("unknown", "Linear issue lookup failed.", {
205
+ provider: LINEAR_PROVIDER_ID,
206
+ error: issueResult.left,
207
+ });
208
+ }
209
+ const remoteIssue = issueResult.right.issue;
210
+ if (remoteIssue === undefined || remoteIssue === null) {
211
+ const failure = yield* appendFailedEvent(events, eventRepo, {
212
+ entityType: "task",
213
+ entityId: task.id,
214
+ remoteId: link.remoteRecord.id,
215
+ error: {
216
+ providerId: LINEAR_PROVIDER_ID,
217
+ code: "not_found",
218
+ retryable: false,
219
+ message: "Linear issue was not found.",
220
+ },
221
+ });
222
+ if (!failure.ok) {
223
+ return failure;
224
+ }
225
+ return providerError("not_found", "Linear issue was not found.", {
226
+ provider: LINEAR_PROVIDER_ID,
227
+ remoteId: link.remoteRecord.id,
228
+ });
229
+ }
230
+ const localChanged = link.lastPushedLocalVersion !== task.updatedAt;
231
+ const remoteChanged = link.lastSeenRemoteVersion !== remoteIssue.updatedAt;
232
+ if (localChanged && remoteChanged) {
233
+ const conflict = yield* createSyncConflict({
234
+ provider: LINEAR_PROVIDER_ID,
235
+ localRecord: { kind: "task", id: task.id },
236
+ remoteRecord: {
237
+ id: remoteIssue.id,
238
+ ...(remoteIssue.url === undefined || remoteIssue.url === null
239
+ ? {}
240
+ : { url: remoteIssue.url }),
241
+ },
242
+ fields: pushConflictFields(task, remoteIssue),
243
+ });
244
+ if (!conflict.ok) {
245
+ return conflict;
246
+ }
247
+ if (conflict.data.conflict !== undefined) {
248
+ const event = yield* appendAndCollect(events, eventRepo, {
249
+ direction: "push",
250
+ data: {
251
+ result: "conflict",
252
+ providerId: LINEAR_PROVIDER_ID,
253
+ conflictId: conflict.data.conflict.id,
254
+ entityType: "task",
255
+ entityId: task.id,
256
+ fields: [...conflict.data.decision.fields],
257
+ },
258
+ });
259
+ if (!event.ok) {
260
+ return event;
261
+ }
262
+ conflicts += 1;
263
+ }
264
+ continue;
265
+ }
266
+ if (!localChanged) {
267
+ const event = yield* appendAndCollect(events, eventRepo, {
268
+ direction: "push",
269
+ data: {
270
+ result: "skipped",
271
+ providerId: LINEAR_PROVIDER_ID,
272
+ entityType: "task",
273
+ entityId: task.id,
274
+ remoteId: remoteIssue.id,
275
+ reason: "unchanged",
276
+ },
277
+ });
278
+ if (!event.ok) {
279
+ return event;
280
+ }
281
+ skipped += 1;
282
+ continue;
283
+ }
284
+ if (input.dryRun) {
285
+ const event = yield* appendAndCollect(events, eventRepo, {
286
+ direction: "push",
287
+ data: {
288
+ result: "skipped",
289
+ providerId: LINEAR_PROVIDER_ID,
290
+ entityType: "task",
291
+ entityId: task.id,
292
+ remoteId: remoteIssue.id,
293
+ reason: "dry_run",
294
+ },
295
+ });
296
+ if (!event.ok) {
297
+ return event;
298
+ }
299
+ skipped += 1;
300
+ continue;
301
+ }
302
+ const updateTeamId = remoteIssue.team?.id ?? defaultTeamId;
303
+ const updateProjectId = input.projectId ?? defaultProjectId ?? remoteIssue.project?.id;
304
+ const mapped = mapTaskToLinearIssueInput(task, {
305
+ ...(updateTeamId === undefined ? {} : { defaultTeamId: updateTeamId }),
306
+ ...(updateProjectId === undefined ? {} : { defaultProjectId: updateProjectId }),
307
+ ...(statusMapping === undefined ? {} : { statusMapping }),
308
+ ...(labelMapping === undefined ? {} : { labelMapping }),
309
+ });
310
+ if (!mapped.ok) {
311
+ return mapped;
312
+ }
313
+ const updateInput = {
314
+ input: {
315
+ id: remoteIssue.id,
316
+ title: mapped.data.input.title,
317
+ description: mapped.data.input.description,
318
+ teamId: remoteIssue.team?.id ?? mapped.data.input.teamId,
319
+ ...(mapped.data.input.projectId === undefined
320
+ ? {}
321
+ : { projectId: mapped.data.input.projectId }),
322
+ ...(mapped.data.input.stateId === undefined
323
+ ? {}
324
+ : { stateId: mapped.data.input.stateId }),
325
+ priority: mapped.data.input.priority,
326
+ },
327
+ };
328
+ const issueUpdateResult = yield* Effect.either(client.request({
329
+ operationName: LINEAR_UPDATE_ISSUE_OPERATION,
330
+ query: LINEAR_UPDATE_ISSUE_QUERY,
331
+ variables: updateInput,
332
+ }));
333
+ if (issueUpdateResult._tag === "Left") {
334
+ const failure = yield* appendFailedEvent(events, eventRepo, {
335
+ entityType: "task",
336
+ entityId: task.id,
337
+ remoteId: remoteIssue.id,
338
+ error: issueUpdateResult.left,
339
+ });
340
+ if (!failure.ok) {
341
+ return failure;
342
+ }
343
+ return providerError("unknown", "Linear issue update failed.", {
344
+ provider: LINEAR_PROVIDER_ID,
345
+ error: issueUpdateResult.left,
346
+ });
347
+ }
348
+ const updatedRecord = issueUpdateResult.right.issueUpdate?.issue;
349
+ if (updatedRecord === undefined || updatedRecord === null) {
350
+ const failure = yield* appendFailedEvent(events, eventRepo, {
351
+ entityType: "task",
352
+ entityId: task.id,
353
+ remoteId: remoteIssue.id,
354
+ error: {
355
+ providerId: LINEAR_PROVIDER_ID,
356
+ code: "not_found",
357
+ retryable: false,
358
+ message: "Linear issue update returned no issue.",
359
+ },
360
+ });
361
+ if (!failure.ok) {
362
+ return failure;
363
+ }
364
+ return providerError("unknown", "Linear issue update returned no issue.", {
365
+ provider: LINEAR_PROVIDER_ID,
366
+ });
367
+ }
368
+ const commentResult = yield* pushTaskComments({
369
+ task,
370
+ issueId: updatedRecord.id,
371
+ lastPushedLocalVersion: link.lastPushedLocalVersion,
372
+ client,
373
+ events,
374
+ eventRepo,
375
+ });
376
+ if (!commentResult.ok) {
377
+ return commentResult;
378
+ }
379
+ const now = yield* nowIso();
380
+ const linked = yield* upsertExternalLink({
381
+ provider: LINEAR_PROVIDER_ID,
382
+ localRecord: { kind: "task", id: task.id },
383
+ remoteRecord: {
384
+ id: updatedRecord.id,
385
+ ...(updatedRecord.url === undefined || updatedRecord.url === null
386
+ ? {}
387
+ : { url: updatedRecord.url }),
388
+ type: "issue",
389
+ },
390
+ lastSyncedAt: now,
391
+ lastSeenRemoteVersion: updatedRecord.updatedAt,
392
+ lastPushedLocalVersion: task.updatedAt,
393
+ });
394
+ if (!linked.ok) {
395
+ return linked;
396
+ }
397
+ const fields = ["title", "description", "status", "priority"];
398
+ const event = yield* appendAndCollect(events, eventRepo, {
399
+ direction: "push",
400
+ data: {
401
+ result: "updated",
402
+ providerId: LINEAR_PROVIDER_ID,
403
+ entityType: "task",
404
+ entityId: task.id,
405
+ remoteId: updatedRecord.id,
406
+ fields: commentResult.data.pushedComments > 0 ? [...fields, "comments"] : fields,
407
+ },
408
+ });
409
+ if (!event.ok) {
410
+ return event;
411
+ }
412
+ updated += 1;
413
+ }
414
+ return {
415
+ ok: true,
416
+ data: {
417
+ created,
418
+ updated,
419
+ skipped,
420
+ conflicts,
421
+ events,
422
+ },
423
+ };
424
+ });
425
+ const loadTasks = (taskRepo, taskIds) => Effect.gen(function* () {
426
+ if (taskIds === undefined || taskIds.length === 0) {
427
+ const tasks = yield* Effect.either(taskRepo.findByStatus("*"));
428
+ if (tasks._tag === "Left") {
429
+ return repositoryError(tasks.left);
430
+ }
431
+ return { ok: true, data: tasks.right };
432
+ }
433
+ const tasks = [];
434
+ for (const taskId of taskIds) {
435
+ const task = yield* Effect.either(taskRepo.findById(taskId));
436
+ if (task._tag === "Left") {
437
+ return repositoryError(task.left);
438
+ }
439
+ tasks.push(task.right);
440
+ }
441
+ return { ok: true, data: tasks };
442
+ });
443
+ const pushTaskComments = (input) => Effect.gen(function* () {
444
+ const comments = input.task.comments
445
+ .filter((comment) => comment.kind !== "sync")
446
+ .filter((comment) => input.lastPushedLocalVersion === undefined
447
+ ? true
448
+ : comment.createdAt > input.lastPushedLocalVersion)
449
+ .sort((left, right) => left.createdAt.localeCompare(right.createdAt) || left.id.localeCompare(right.id));
450
+ if (comments.length === 0) {
451
+ return {
452
+ ok: true,
453
+ data: { pushedComments: 0 },
454
+ };
455
+ }
456
+ const page = comments.slice(0, MAX_COMMENT_PAGE_SIZE);
457
+ if (comments.length > MAX_COMMENT_PAGE_SIZE) {
458
+ const event = yield* appendAndCollect(input.events, input.eventRepo, {
459
+ direction: "push",
460
+ data: {
461
+ result: "skipped",
462
+ providerId: LINEAR_PROVIDER_ID,
463
+ entityType: "task",
464
+ entityId: input.task.id,
465
+ remoteId: input.issueId,
466
+ reason: "filtered",
467
+ },
468
+ });
469
+ if (!event.ok) {
470
+ return event;
471
+ }
472
+ }
473
+ for (const comment of page) {
474
+ const created = yield* Effect.either(input.client.request({
475
+ operationName: LINEAR_CREATE_COMMENT_OPERATION,
476
+ query: LINEAR_CREATE_COMMENT_QUERY,
477
+ variables: {
478
+ issueId: input.issueId,
479
+ body: comment.content,
480
+ },
481
+ }));
482
+ if (created._tag === "Left") {
483
+ return providerError("unknown", "Linear comment creation failed.", {
484
+ provider: LINEAR_PROVIDER_ID,
485
+ error: created.left,
486
+ });
487
+ }
488
+ if (created.right.commentCreate?.comment === undefined ||
489
+ created.right.commentCreate.comment === null) {
490
+ return providerError("unknown", "Linear comment creation returned no comment.", {
491
+ provider: LINEAR_PROVIDER_ID,
492
+ });
493
+ }
494
+ }
495
+ if (comments.length > MAX_COMMENT_PAGE_SIZE) {
496
+ return {
497
+ ok: true,
498
+ data: {
499
+ pushedComments: page.length,
500
+ },
501
+ warnings: [
502
+ {
503
+ code: "has_more",
504
+ message: "Linear comments exceeded the 100 item limit.",
505
+ details: {
506
+ providerId: LINEAR_PROVIDER_ID,
507
+ issueId: input.issueId,
508
+ hasMore: true,
509
+ limit: MAX_COMMENT_PAGE_SIZE,
510
+ cursor: {
511
+ providerId: LINEAR_PROVIDER_ID,
512
+ cursor: page[page.length - 1]?.id,
513
+ pageSize: DEFAULT_COMMENT_PAGE_SIZE,
514
+ },
515
+ },
516
+ },
517
+ ],
518
+ };
519
+ }
520
+ return {
521
+ ok: true,
522
+ data: {
523
+ pushedComments: page.length,
524
+ },
525
+ };
526
+ });
527
+ const appendAndCollect = (events, eventRepo, input) => Effect.gen(function* () {
528
+ const result = yield* appendSyncEvent(input);
529
+ if (!result.ok) {
530
+ return result;
531
+ }
532
+ events.push(result.data.syncEvent);
533
+ const saved = yield* Effect.either(eventRepo.create(result.data.syncEvent));
534
+ if (saved._tag === "Left") {
535
+ return repositoryError(saved.left);
536
+ }
537
+ return {
538
+ ok: true,
539
+ data: undefined,
540
+ };
541
+ });
542
+ const appendFailedEvent = (events, eventRepo, input) => appendAndCollect(events, eventRepo, {
543
+ direction: "push",
544
+ data: {
545
+ result: "failed",
546
+ providerId: LINEAR_PROVIDER_ID,
547
+ ...(input.entityType === undefined ? {} : { entityType: input.entityType }),
548
+ ...(input.entityId === undefined ? {} : { entityId: input.entityId }),
549
+ ...(input.remoteId === undefined ? {} : { remoteId: input.remoteId }),
550
+ error: normalizeProviderError(input.error),
551
+ },
552
+ });
553
+ const normalizeProviderError = (error) => isProviderError(error)
554
+ ? error
555
+ : {
556
+ providerId: LINEAR_PROVIDER_ID,
557
+ code: "unknown",
558
+ retryable: false,
559
+ message: "Linear provider request failed.",
560
+ details: { error: String(error) },
561
+ };
562
+ const isProviderError = (value) => isRecord(value) &&
563
+ typeof value.providerId === "string" &&
564
+ typeof value.code === "string" &&
565
+ typeof value.retryable === "boolean" &&
566
+ typeof value.message === "string";
567
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
568
+ const repositoryError = (cause) => ({
569
+ ok: false,
570
+ error: {
571
+ code: "storage_error",
572
+ message: "Repository operation failed.",
573
+ ...(cause === undefined ? {} : { details: { cause } }),
574
+ },
575
+ });
576
+ const providerError = (code, message, details) => ({
577
+ ok: false,
578
+ error: {
579
+ code,
580
+ message,
581
+ ...(details === undefined ? {} : { details }),
582
+ },
583
+ });
584
+ const pushConflictFields = (task, issue) => [
585
+ ["title", task.title, issue.title],
586
+ ["description", task.description, issue.description ?? ""],
587
+ ["status", task.status, mapLinearStateToTaskStatus(issue)],
588
+ ["priority", task.priority, issue.priority ?? 0],
589
+ ].map(([path, localValue, remoteValue]) => ({
590
+ path,
591
+ localValue,
592
+ remoteValue,
593
+ }));
594
+ const mapLinearStateToTaskStatus = (issue) => {
595
+ switch (issue.state?.type ?? "unstarted") {
596
+ case "backlog":
597
+ return "backlog";
598
+ case "unstarted":
599
+ return "todo";
600
+ case "started":
601
+ return "in_progress";
602
+ case "completed":
603
+ return "done";
604
+ case "canceled":
605
+ return "canceled";
606
+ default:
607
+ return "todo";
608
+ }
609
+ };
610
+ const LINEAR_CREATE_ISSUE_QUERY = `
611
+ mutation LinearCreateIssue($input: IssueCreateInput!) {
612
+ issueCreate(input: $input) {
613
+ issue {
614
+ id
615
+ identifier
616
+ url
617
+ title
618
+ description
619
+ priority
620
+ updatedAt
621
+ archivedAt
622
+ team { id key name }
623
+ project { id name }
624
+ state { id name type }
625
+ assignee { id name }
626
+ labels { nodes { id name } }
627
+ }
628
+ }
629
+ }
630
+ `;
631
+ const LINEAR_UPDATE_ISSUE_QUERY = `
632
+ mutation LinearUpdateIssue($input: IssueUpdateInput!) {
633
+ issueUpdate(input: $input) {
634
+ issue {
635
+ id
636
+ identifier
637
+ url
638
+ title
639
+ description
640
+ priority
641
+ updatedAt
642
+ archivedAt
643
+ team { id key name }
644
+ project { id name }
645
+ state { id name type }
646
+ assignee { id name }
647
+ labels { nodes { id name } }
648
+ }
649
+ }
650
+ }
651
+ `;
652
+ const LINEAR_CREATE_COMMENT_QUERY = `
653
+ mutation LinearCreateComment($issueId: String!, $body: String!) {
654
+ commentCreate(issueId: $issueId, body: $body) {
655
+ comment {
656
+ id
657
+ createdAt
658
+ }
659
+ }
660
+ }
661
+ `;
662
+ const LINEAR_GET_ISSUE_QUERY = `
663
+ query LinearGetIssue($id: String!) {
664
+ issue(id: $id) {
665
+ id
666
+ identifier
667
+ url
668
+ title
669
+ description
670
+ priority
671
+ updatedAt
672
+ archivedAt
673
+ team { id key name }
674
+ project { id name }
675
+ state { id name type }
676
+ assignee { id name }
677
+ labels { nodes { id name } }
678
+ }
679
+ }
680
+ `;
681
+ //# sourceMappingURL=push.js.map