trybeacon 0.1.14 → 0.1.16

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 (297) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +9 -8
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/routes-manifest.json +14 -6
  6. package/.next/server/app/_global-error/page.js +3 -3
  7. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found/page.js +2 -2
  17. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/server/app/_not-found.html +1 -1
  19. package/.next/server/app/_not-found.rsc +2 -2
  20. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  21. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  23. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  24. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  25. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  26. package/.next/server/app/api/board-annotations/[id]/route.js +1 -1
  27. package/.next/server/app/api/board-annotations/route.js +1 -1
  28. package/.next/server/app/api/bug-flags/[id]/route.js +1 -0
  29. package/.next/server/app/api/bug-flags/[id]/route.js.nft.json +1 -0
  30. package/.next/server/app/api/bug-flags/[id]/route_client-reference-manifest.js +1 -0
  31. package/.next/server/app/api/bug-flags/route.js +1 -0
  32. package/.next/server/app/api/{settings → bug-flags}/route.js.nft.json +1 -1
  33. package/.next/server/app/api/bug-flags/route_client-reference-manifest.js +1 -0
  34. package/.next/server/app/api/code-graph/position/route.js +1 -1
  35. package/.next/server/app/api/code-graph/route.js +1 -1
  36. package/.next/server/app/api/context/feature/route.js +1 -1
  37. package/.next/server/app/api/context/file/route.js +1 -1
  38. package/.next/server/app/api/context/route.js +1 -1
  39. package/.next/server/app/api/db/arrange/route.js +1 -1
  40. package/.next/server/app/api/db/backfill-access/route.js +1 -1
  41. package/.next/server/app/api/db/position/route.js +1 -1
  42. package/.next/server/app/api/db/reconcile-endpoints/route.js +1 -1
  43. package/.next/server/app/api/db/relations/[id]/route.js +1 -1
  44. package/.next/server/app/api/db/tables/[id]/route.js +1 -1
  45. package/.next/server/app/api/draft/approve/route.js +2 -2
  46. package/.next/server/app/api/draft/route.js +2 -2
  47. package/.next/server/app/api/draft/status/route.js +1 -1
  48. package/.next/server/app/api/edges/[id]/route.js +1 -1
  49. package/.next/server/app/api/edges/route.js +1 -1
  50. package/.next/server/app/api/endpoints/[id]/route.js +1 -1
  51. package/.next/server/app/api/entities/route.js +1 -1
  52. package/.next/server/app/api/feedback/[id]/route.js +1 -1
  53. package/.next/server/app/api/feedback/[id]/vote/route.js +1 -1
  54. package/.next/server/app/api/feedback/route.js +1 -1
  55. package/.next/server/app/api/ingest/route.js +2 -2
  56. package/.next/server/app/api/init/route.js +2 -2
  57. package/.next/server/app/api/map/describe/route.js +2 -2
  58. package/.next/server/app/api/map/files/route.js +1 -1
  59. package/.next/server/app/api/map/finish/route.js +1 -1
  60. package/.next/server/app/api/map/route.js +1 -1
  61. package/.next/server/app/api/map/start/route.js +1 -1
  62. package/.next/server/app/api/map/touch-active/route.js +1 -1
  63. package/.next/server/app/api/nodes/[id]/position/route.js +1 -1
  64. package/.next/server/app/api/nodes/[id]/route.js +1 -1
  65. package/.next/server/app/api/nodes/positions/route.js +1 -1
  66. package/.next/server/app/api/nodes/route.js +1 -1
  67. package/.next/server/app/api/nodes/subtasks/route.js +1 -1
  68. package/.next/server/app/api/notes/[id]/route.js +1 -1
  69. package/.next/server/app/api/notes/route.js +1 -1
  70. package/.next/server/app/api/open/route.js +1 -1
  71. package/.next/server/app/api/plan/annotations/route.js +3 -3
  72. package/.next/server/app/api/plan/approve/route.js +2 -2
  73. package/.next/server/app/api/plan/history/route.js +1 -1
  74. package/.next/server/app/api/plan/markdown/route.js +1 -1
  75. package/.next/server/app/api/plan/presence/route.js +1 -1
  76. package/.next/server/app/api/plan/route.js +1 -1
  77. package/.next/server/app/api/plan/verdict/route.js +2 -2
  78. package/.next/server/app/api/preferences/route.js +1 -1
  79. package/.next/server/app/api/reset/route.js +1 -1
  80. package/.next/server/app/api/stream/route.js +2 -2
  81. package/.next/server/app/api/version/route.js +1 -1
  82. package/.next/server/app/api/workspace/activate/route.js +1 -1
  83. package/.next/server/app/api/workspace/route.js +1 -1
  84. package/.next/server/app/apple-icon.png/route.js +1 -1
  85. package/.next/server/app/docs/page.js +2 -2
  86. package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  87. package/.next/server/app/docs.html +1 -1
  88. package/.next/server/app/docs.rsc +2 -2
  89. package/.next/server/app/docs.segments/_full.segment.rsc +2 -2
  90. package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  91. package/.next/server/app/docs.segments/_index.segment.rsc +2 -2
  92. package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
  93. package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
  94. package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  95. package/.next/server/app/feedback/page.js +2 -2
  96. package/.next/server/app/feedback/page_client-reference-manifest.js +1 -1
  97. package/.next/server/app/feedback.html +1 -1
  98. package/.next/server/app/feedback.rsc +2 -2
  99. package/.next/server/app/feedback.segments/_full.segment.rsc +2 -2
  100. package/.next/server/app/feedback.segments/_head.segment.rsc +1 -1
  101. package/.next/server/app/feedback.segments/_index.segment.rsc +2 -2
  102. package/.next/server/app/feedback.segments/_tree.segment.rsc +2 -2
  103. package/.next/server/app/feedback.segments/feedback/__PAGE__.segment.rsc +1 -1
  104. package/.next/server/app/feedback.segments/feedback.segment.rsc +1 -1
  105. package/.next/server/app/help/page.js +2 -2
  106. package/.next/server/app/help/page_client-reference-manifest.js +1 -1
  107. package/.next/server/app/help.html +1 -1
  108. package/.next/server/app/help.rsc +20 -19
  109. package/.next/server/app/help.segments/_full.segment.rsc +20 -19
  110. package/.next/server/app/help.segments/_head.segment.rsc +1 -1
  111. package/.next/server/app/help.segments/_index.segment.rsc +2 -2
  112. package/.next/server/app/help.segments/_tree.segment.rsc +2 -2
  113. package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +1 -1
  114. package/.next/server/app/help.segments/help.segment.rsc +1 -1
  115. package/.next/server/app/icon.svg/route.js +1 -1
  116. package/.next/server/app/index.html +1 -1
  117. package/.next/server/app/index.rsc +3 -3
  118. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  119. package/.next/server/app/index.segments/_full.segment.rsc +3 -3
  120. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  121. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  122. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  123. package/.next/server/app/map/page.js +2 -2
  124. package/.next/server/app/map/page.js.nft.json +1 -1
  125. package/.next/server/app/map/page_client-reference-manifest.js +1 -1
  126. package/.next/server/app/page.js +2 -2
  127. package/.next/server/app/page_client-reference-manifest.js +1 -1
  128. package/.next/server/app/plan/page.js +2 -2
  129. package/.next/server/app/plan/page.js.nft.json +1 -1
  130. package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
  131. package/.next/server/app/settings/page.js +2 -2
  132. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  133. package/.next/server/app-paths-manifest.json +9 -8
  134. package/.next/server/chunks/1130.js +1 -1
  135. package/.next/server/chunks/1263.js +1 -0
  136. package/.next/server/chunks/{3968.js → 2574.js} +2 -2
  137. package/.next/server/chunks/2933.js +1 -1
  138. package/.next/server/chunks/9683.js +1 -1
  139. package/.next/server/instrumentation.js +1 -1
  140. package/.next/server/middleware-build-manifest.js +1 -1
  141. package/.next/server/middleware.js +3 -3
  142. package/.next/server/pages/404.html +1 -1
  143. package/.next/server/pages/500.html +1 -1
  144. package/.next/server/server-reference-manifest.js +1 -1
  145. package/.next/server/server-reference-manifest.json +1 -1
  146. package/.next/static/chunks/1202-dfeac8ec49693586.js +1 -0
  147. package/.next/static/chunks/6666-31528aed4743588c.js +1 -0
  148. package/.next/static/chunks/app/_global-error/{page-3b9ad860c9e9f7cb.js → page-0fdd2f2bb2631a50.js} +1 -1
  149. package/.next/static/chunks/app/api/board-annotations/[id]/{route-3b9ad860c9e9f7cb.js → route-0fdd2f2bb2631a50.js} +1 -1
  150. package/.next/static/chunks/app/api/board-annotations/{route-3b9ad860c9e9f7cb.js → route-0fdd2f2bb2631a50.js} +1 -1
  151. package/.next/static/chunks/app/api/{code-graph/position/route-3b9ad860c9e9f7cb.js → bug-flags/[id]/route-0fdd2f2bb2631a50.js} +1 -1
  152. package/.next/static/chunks/app/api/bug-flags/route-0fdd2f2bb2631a50.js +1 -0
  153. package/.next/static/chunks/app/api/code-graph/position/route-0fdd2f2bb2631a50.js +1 -0
  154. package/.next/static/chunks/app/api/code-graph/route-0fdd2f2bb2631a50.js +1 -0
  155. package/.next/static/chunks/app/api/context/feature/route-0fdd2f2bb2631a50.js +1 -0
  156. package/.next/static/chunks/app/api/context/file/route-0fdd2f2bb2631a50.js +1 -0
  157. package/.next/static/chunks/app/api/context/route-0fdd2f2bb2631a50.js +1 -0
  158. package/.next/static/chunks/app/api/db/arrange/route-0fdd2f2bb2631a50.js +1 -0
  159. package/.next/static/chunks/app/api/db/backfill-access/route-0fdd2f2bb2631a50.js +1 -0
  160. package/.next/static/chunks/app/api/db/position/route-0fdd2f2bb2631a50.js +1 -0
  161. package/.next/static/chunks/app/api/db/reconcile-endpoints/route-0fdd2f2bb2631a50.js +1 -0
  162. package/.next/static/chunks/app/api/db/relations/[id]/route-0fdd2f2bb2631a50.js +1 -0
  163. package/.next/static/chunks/app/api/db/tables/[id]/route-0fdd2f2bb2631a50.js +1 -0
  164. package/.next/static/chunks/app/api/draft/approve/route-0fdd2f2bb2631a50.js +1 -0
  165. package/.next/static/chunks/app/api/draft/route-0fdd2f2bb2631a50.js +1 -0
  166. package/.next/static/chunks/app/api/draft/status/route-0fdd2f2bb2631a50.js +1 -0
  167. package/.next/static/chunks/app/api/edges/[id]/route-0fdd2f2bb2631a50.js +1 -0
  168. package/.next/static/chunks/app/api/edges/route-0fdd2f2bb2631a50.js +1 -0
  169. package/.next/static/chunks/app/api/endpoints/[id]/route-0fdd2f2bb2631a50.js +1 -0
  170. package/.next/static/chunks/app/api/entities/route-0fdd2f2bb2631a50.js +1 -0
  171. package/.next/static/chunks/app/api/feedback/[id]/route-0fdd2f2bb2631a50.js +1 -0
  172. package/.next/static/chunks/app/api/feedback/[id]/vote/route-0fdd2f2bb2631a50.js +1 -0
  173. package/.next/static/chunks/app/api/feedback/route-0fdd2f2bb2631a50.js +1 -0
  174. package/.next/static/chunks/app/api/ingest/route-0fdd2f2bb2631a50.js +1 -0
  175. package/.next/static/chunks/app/api/init/route-0fdd2f2bb2631a50.js +1 -0
  176. package/.next/static/chunks/app/api/map/describe/route-0fdd2f2bb2631a50.js +1 -0
  177. package/.next/static/chunks/app/api/map/files/route-0fdd2f2bb2631a50.js +1 -0
  178. package/.next/static/chunks/app/api/map/finish/route-0fdd2f2bb2631a50.js +1 -0
  179. package/.next/static/chunks/app/api/map/route-0fdd2f2bb2631a50.js +1 -0
  180. package/.next/static/chunks/app/api/map/start/route-0fdd2f2bb2631a50.js +1 -0
  181. package/.next/static/chunks/app/api/map/touch-active/route-0fdd2f2bb2631a50.js +1 -0
  182. package/.next/static/chunks/app/api/nodes/[id]/position/route-0fdd2f2bb2631a50.js +1 -0
  183. package/.next/static/chunks/app/api/nodes/[id]/route-0fdd2f2bb2631a50.js +1 -0
  184. package/.next/static/chunks/app/api/nodes/positions/route-0fdd2f2bb2631a50.js +1 -0
  185. package/.next/static/chunks/app/api/nodes/route-0fdd2f2bb2631a50.js +1 -0
  186. package/.next/static/chunks/app/api/nodes/subtasks/route-0fdd2f2bb2631a50.js +1 -0
  187. package/.next/static/chunks/app/api/notes/[id]/route-0fdd2f2bb2631a50.js +1 -0
  188. package/.next/static/chunks/app/api/notes/route-0fdd2f2bb2631a50.js +1 -0
  189. package/.next/static/chunks/app/api/open/route-0fdd2f2bb2631a50.js +1 -0
  190. package/.next/static/chunks/app/api/plan/annotations/route-0fdd2f2bb2631a50.js +1 -0
  191. package/.next/static/chunks/app/api/plan/approve/route-0fdd2f2bb2631a50.js +1 -0
  192. package/.next/static/chunks/app/api/plan/history/route-0fdd2f2bb2631a50.js +1 -0
  193. package/.next/static/chunks/app/api/plan/markdown/route-0fdd2f2bb2631a50.js +1 -0
  194. package/.next/static/chunks/app/api/plan/presence/route-0fdd2f2bb2631a50.js +1 -0
  195. package/.next/static/chunks/app/api/plan/route-0fdd2f2bb2631a50.js +1 -0
  196. package/.next/static/chunks/app/api/plan/verdict/route-0fdd2f2bb2631a50.js +1 -0
  197. package/.next/static/chunks/app/api/preferences/route-0fdd2f2bb2631a50.js +1 -0
  198. package/.next/static/chunks/app/api/reset/route-0fdd2f2bb2631a50.js +1 -0
  199. package/.next/static/chunks/app/api/stream/route-0fdd2f2bb2631a50.js +1 -0
  200. package/.next/static/chunks/app/api/version/route-0fdd2f2bb2631a50.js +1 -0
  201. package/.next/static/chunks/app/api/workspace/activate/route-0fdd2f2bb2631a50.js +1 -0
  202. package/.next/static/chunks/app/api/workspace/route-0fdd2f2bb2631a50.js +1 -0
  203. package/.next/static/chunks/app/map/{page-834f326619f2477b.js → page-5020db02dba43678.js} +1 -1
  204. package/.next/static/chunks/app/page-2c4582b256e877c0.js +1 -0
  205. package/.next/static/chunks/app/plan/{page-86a130ff444297a1.js → page-cd3785902dd95dce.js} +1 -1
  206. package/.next/static/chunks/next/dist/client/components/builtin/app-error-0fdd2f2bb2631a50.js +1 -0
  207. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-0fdd2f2bb2631a50.js +1 -0
  208. package/.next/static/chunks/next/dist/client/components/builtin/not-found-0fdd2f2bb2631a50.js +1 -0
  209. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-0fdd2f2bb2631a50.js +1 -0
  210. package/.next/static/css/f0c8ee0772c6d74d.css +1 -0
  211. package/.next/static/{dmwr94-U2a-24WsqmRue9 → fnj-duECSYw_AlTFP7r7a}/_buildManifest.js +1 -1
  212. package/.next/trace +37 -37
  213. package/.next/trace-build +1 -1
  214. package/.next/types/app/api/bug-flags/[id]/route.ts +351 -0
  215. package/.next/types/app/api/{settings → bug-flags}/route.ts +3 -3
  216. package/.next/types/routes.d.ts +3 -2
  217. package/.next/types/validator.ts +18 -9
  218. package/dist/bin/beacon.js +6 -6
  219. package/dist/bin/doctor.js +54 -36
  220. package/dist/bin/hook.js +53 -34
  221. package/dist/bin/mcp.js +63 -45
  222. package/dist/bin/plan.js +57 -35
  223. package/dist/bin/prompt.js +1 -1
  224. package/dist/bin/stop-hook.js +2 -2
  225. package/dist/bin/uninstall.js +54 -36
  226. package/dist/lib/assets.js +27 -22
  227. package/dist/lib/global-install.js +52 -34
  228. package/drizzle/0002_square_firestar.sql +2 -0
  229. package/drizzle/0003_glorious_stick.sql +12 -0
  230. package/drizzle/0004_fair_namora.sql +1 -0
  231. package/drizzle/meta/0002_snapshot.json +1655 -0
  232. package/drizzle/meta/0003_snapshot.json +1737 -0
  233. package/drizzle/meta/0004_snapshot.json +1730 -0
  234. package/drizzle/meta/_journal.json +21 -0
  235. package/package.json +1 -2
  236. package/.next/server/app/api/settings/route.js +0 -1
  237. package/.next/server/app/api/settings/route_client-reference-manifest.js +0 -1
  238. package/.next/server/chunks/8465.js +0 -1
  239. package/.next/static/chunks/3973-c52f930a38c6c787.js +0 -1
  240. package/.next/static/chunks/58-aec6c638db75ae0a.js +0 -1
  241. package/.next/static/chunks/app/api/code-graph/route-3b9ad860c9e9f7cb.js +0 -1
  242. package/.next/static/chunks/app/api/context/feature/route-3b9ad860c9e9f7cb.js +0 -1
  243. package/.next/static/chunks/app/api/context/file/route-3b9ad860c9e9f7cb.js +0 -1
  244. package/.next/static/chunks/app/api/context/route-3b9ad860c9e9f7cb.js +0 -1
  245. package/.next/static/chunks/app/api/db/arrange/route-3b9ad860c9e9f7cb.js +0 -1
  246. package/.next/static/chunks/app/api/db/backfill-access/route-3b9ad860c9e9f7cb.js +0 -1
  247. package/.next/static/chunks/app/api/db/position/route-3b9ad860c9e9f7cb.js +0 -1
  248. package/.next/static/chunks/app/api/db/reconcile-endpoints/route-3b9ad860c9e9f7cb.js +0 -1
  249. package/.next/static/chunks/app/api/db/relations/[id]/route-3b9ad860c9e9f7cb.js +0 -1
  250. package/.next/static/chunks/app/api/db/tables/[id]/route-3b9ad860c9e9f7cb.js +0 -1
  251. package/.next/static/chunks/app/api/draft/approve/route-3b9ad860c9e9f7cb.js +0 -1
  252. package/.next/static/chunks/app/api/draft/route-3b9ad860c9e9f7cb.js +0 -1
  253. package/.next/static/chunks/app/api/draft/status/route-3b9ad860c9e9f7cb.js +0 -1
  254. package/.next/static/chunks/app/api/edges/[id]/route-3b9ad860c9e9f7cb.js +0 -1
  255. package/.next/static/chunks/app/api/edges/route-3b9ad860c9e9f7cb.js +0 -1
  256. package/.next/static/chunks/app/api/endpoints/[id]/route-3b9ad860c9e9f7cb.js +0 -1
  257. package/.next/static/chunks/app/api/entities/route-3b9ad860c9e9f7cb.js +0 -1
  258. package/.next/static/chunks/app/api/feedback/[id]/route-3b9ad860c9e9f7cb.js +0 -1
  259. package/.next/static/chunks/app/api/feedback/[id]/vote/route-3b9ad860c9e9f7cb.js +0 -1
  260. package/.next/static/chunks/app/api/feedback/route-3b9ad860c9e9f7cb.js +0 -1
  261. package/.next/static/chunks/app/api/ingest/route-3b9ad860c9e9f7cb.js +0 -1
  262. package/.next/static/chunks/app/api/init/route-3b9ad860c9e9f7cb.js +0 -1
  263. package/.next/static/chunks/app/api/map/describe/route-3b9ad860c9e9f7cb.js +0 -1
  264. package/.next/static/chunks/app/api/map/files/route-3b9ad860c9e9f7cb.js +0 -1
  265. package/.next/static/chunks/app/api/map/finish/route-3b9ad860c9e9f7cb.js +0 -1
  266. package/.next/static/chunks/app/api/map/route-3b9ad860c9e9f7cb.js +0 -1
  267. package/.next/static/chunks/app/api/map/start/route-3b9ad860c9e9f7cb.js +0 -1
  268. package/.next/static/chunks/app/api/map/touch-active/route-3b9ad860c9e9f7cb.js +0 -1
  269. package/.next/static/chunks/app/api/nodes/[id]/position/route-3b9ad860c9e9f7cb.js +0 -1
  270. package/.next/static/chunks/app/api/nodes/[id]/route-3b9ad860c9e9f7cb.js +0 -1
  271. package/.next/static/chunks/app/api/nodes/positions/route-3b9ad860c9e9f7cb.js +0 -1
  272. package/.next/static/chunks/app/api/nodes/route-3b9ad860c9e9f7cb.js +0 -1
  273. package/.next/static/chunks/app/api/nodes/subtasks/route-3b9ad860c9e9f7cb.js +0 -1
  274. package/.next/static/chunks/app/api/notes/[id]/route-3b9ad860c9e9f7cb.js +0 -1
  275. package/.next/static/chunks/app/api/notes/route-3b9ad860c9e9f7cb.js +0 -1
  276. package/.next/static/chunks/app/api/open/route-3b9ad860c9e9f7cb.js +0 -1
  277. package/.next/static/chunks/app/api/plan/annotations/route-3b9ad860c9e9f7cb.js +0 -1
  278. package/.next/static/chunks/app/api/plan/approve/route-3b9ad860c9e9f7cb.js +0 -1
  279. package/.next/static/chunks/app/api/plan/history/route-3b9ad860c9e9f7cb.js +0 -1
  280. package/.next/static/chunks/app/api/plan/markdown/route-3b9ad860c9e9f7cb.js +0 -1
  281. package/.next/static/chunks/app/api/plan/presence/route-3b9ad860c9e9f7cb.js +0 -1
  282. package/.next/static/chunks/app/api/plan/route-3b9ad860c9e9f7cb.js +0 -1
  283. package/.next/static/chunks/app/api/plan/verdict/route-3b9ad860c9e9f7cb.js +0 -1
  284. package/.next/static/chunks/app/api/preferences/route-3b9ad860c9e9f7cb.js +0 -1
  285. package/.next/static/chunks/app/api/reset/route-3b9ad860c9e9f7cb.js +0 -1
  286. package/.next/static/chunks/app/api/settings/route-3b9ad860c9e9f7cb.js +0 -1
  287. package/.next/static/chunks/app/api/stream/route-3b9ad860c9e9f7cb.js +0 -1
  288. package/.next/static/chunks/app/api/version/route-3b9ad860c9e9f7cb.js +0 -1
  289. package/.next/static/chunks/app/api/workspace/activate/route-3b9ad860c9e9f7cb.js +0 -1
  290. package/.next/static/chunks/app/api/workspace/route-3b9ad860c9e9f7cb.js +0 -1
  291. package/.next/static/chunks/app/page-ccb55081f850db63.js +0 -1
  292. package/.next/static/chunks/next/dist/client/components/builtin/app-error-3b9ad860c9e9f7cb.js +0 -1
  293. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-3b9ad860c9e9f7cb.js +0 -1
  294. package/.next/static/chunks/next/dist/client/components/builtin/not-found-3b9ad860c9e9f7cb.js +0 -1
  295. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-3b9ad860c9e9f7cb.js +0 -1
  296. package/.next/static/css/0745ea0e6e3229f6.css +0 -1
  297. /package/.next/static/{dmwr94-U2a-24WsqmRue9 → fnj-duECSYw_AlTFP7r7a}/_ssgManifest.js +0 -0
package/dist/bin/plan.js CHANGED
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var AQ=Object.defineProperty;var kQ=(Q)=>Q;function wQ(Q,X){this[Q]=kQ.bind(null,X)}var o=(Q,X)=>{for(var Z in X)AQ(Q,Z,{get:X[Z],enumerable:!0,configurable:!0,set:wQ.bind(X,Z)})};var r=(Q,X)=>()=>(Q&&(X=Q(Q=0)),X);var ZQ={};o(ZQ,{removeRepoAssets:()=>hQ,installRefreshSkill:()=>_Q,installPlanSkill:()=>LQ,installInitSkill:()=>gQ,ensureWorkflowDoc:()=>bQ,ensureMcp:()=>yQ,auditRepo:()=>SQ,REFRESH_SKILL:()=>QQ,PLAN_SKILL:()=>XQ,INIT_SKILL:()=>e});import{existsSync as w,mkdirSync as g,readFileSync as B,rmSync as k,writeFileSync as x}from"fs";import{join as q}from"path";function gQ(Q){let X=q(Q,".claude","skills","beacon-init");g(X,{recursive:!0});let Z=q(X,"SKILL.md");return x(Z,e),Z}function _Q(Q){let X=q(Q,".claude","skills","beacon-refresh");g(X,{recursive:!0});let Z=q(X,"SKILL.md");return x(Z,QQ),Z}function LQ(Q){let X=q(Q,".claude","skills","beacon-plan");g(X,{recursive:!0});let Z=q(X,"SKILL.md");return x(Z,XQ),Z}function bQ(Q){let X=q(Q,"AGENTS.md"),Z="";try{Z=B(X,"utf8")}catch{}let $=new RegExp(`${f}[\\s\\S]*?${_}`);Z=$.test(Z)?Z.replace($,i):`${Z.trim()}
3
+ var xZ=Object.defineProperty;var KZ=(Q)=>Q;function NZ(Q,Z){this[Q]=KZ.bind(null,Z)}var QQ=(Q,Z)=>{for(var $ in Z)xZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:NZ.bind(Z,$)})};var N=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var JQ={};QQ(JQ,{removeRepoAssets:()=>RZ,installRefreshSkill:()=>CZ,installPlanSkill:()=>MZ,installInitSkill:()=>vZ,installCodexRepoSkills:()=>wZ,ensureWorkflowDoc:()=>gZ,ensureMcp:()=>FZ,auditRepo:()=>uZ,REFRESH_SKILL:()=>$Q,PLAN_SKILL:()=>bQ,INIT_SKILL:()=>ZQ});import{existsSync as v,mkdirSync as I,readFileSync as P,rmSync as b,writeFileSync as H}from"fs";import{join as W}from"path";function vZ(Q){let Z=W(Q,".claude","skills","beacon-init");I(Z,{recursive:!0});let $=W(Z,"SKILL.md");return H($,ZQ),$}function CZ(Q){let Z=W(Q,".claude","skills","beacon-refresh");I(Z,{recursive:!0});let $=W(Z,"SKILL.md");return H($,$Q),$}function MZ(Q){let Z=W(Q,".claude","skills","beacon-plan");I(Z,{recursive:!0});let $=W(Z,"SKILL.md");return H($,bQ),$}function wZ(Q){let Z=[];for(let $ of TZ){let Y=W(Q,".agents","skills",$.name);I(Y,{recursive:!0});let J=W(Y,"SKILL.md");H(J,$.body()),Z.push(J)}return Z}function gZ(Q){let Z=W(Q,"AGENTS.md"),$="";try{$=P(Z,"utf8")}catch{}let Y=new RegExp(`${A}[\\s\\S]*?${YQ}`);$=Y.test($)?$.replace(Y,fQ):`${$.trim()}
4
4
 
5
- ${i}
6
- `.trimStart(),x(X,Z.endsWith(`
7
- `)?Z:`${Z}
8
- `);let Y=q(Q,"CLAUDE.md"),J="";try{J=B(Y,"utf8")}catch{}if(!/@AGENTS\.md/.test(J))x(Y,`${J?`${J.trim()}
5
+ ${fQ}
6
+ `.trimStart(),H(Z,$.endsWith(`
7
+ `)?$:`${$}
8
+ `);let J=W(Q,"CLAUDE.md"),V="";try{V=P(J,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))H(J,`${V?`${V.trim()}
9
9
 
10
10
  `:""}@AGENTS.md
11
- `)}function yQ(Q){let X=q(Q,".mcp.json"),Z={};try{Z=JSON.parse(B(X,"utf8"))}catch{}if(Z.mcpServers=Z.mcpServers??{},Z.mcpServers.beacon)return{path:X,added:!1};return Z.mcpServers.beacon={command:"beacon",args:["mcp"]},x(X,JSON.stringify(Z,null,2)+`
12
- `),{path:X,added:!0}}function SQ(Q){let X=q(Q,".mcp.json"),Z=!1;try{Z=!!JSON.parse(B(X,"utf8")).mcpServers?.beacon}catch{}let $=!1;try{$=B(q(Q,"AGENTS.md"),"utf8").includes(f)}catch{}let Y=!1;try{Y=/@AGENTS\.md/.test(B(q(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:Z,agentsMdBlock:$,claudeMdImport:Y,skills:{"beacon-init":w(q(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":w(q(Q,".claude","skills","beacon-refresh","SKILL.md"))}}}function hQ(Q){let X=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let N=q(Q,".claude","skills",z);if(w(N))k(N,{recursive:!0,force:!0}),X.push(z)}let Z=!1,$=q(Q,".mcp.json");try{let z=JSON.parse(B($,"utf8"));if(z.mcpServers?.beacon){if(delete z.mcpServers.beacon,Z=!0,z.mcpServers&&Object.keys(z.mcpServers).length===0)delete z.mcpServers;if(Object.keys(z).length===0)k($,{force:!0});else x($,JSON.stringify(z,null,2)+`
13
- `)}}catch{}let Y=!1,J=q(Q,"AGENTS.md");try{let z=B(J,"utf8"),N=new RegExp(`\\n?${f}[\\s\\S]*?${_}\\n?`);if(N.test(z)){let M=z.replace(N,`
11
+ `)}function FZ(Q){let Z=W(Q,".mcp.json"),$={};try{$=JSON.parse(P(Z,"utf8"))}catch{}if($.mcpServers=$.mcpServers??{},$.mcpServers.beacon)return{path:Z,added:!1};return $.mcpServers.beacon={command:"beacon",args:["mcp"]},H(Z,JSON.stringify($,null,2)+`
12
+ `),{path:Z,added:!0}}function uZ(Q){let Z=W(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(P(Z,"utf8")).mcpServers?.beacon}catch{}let Y=!1;try{Y=P(W(Q,"AGENTS.md"),"utf8").includes(A)}catch{}let J=!1;try{J=/@AGENTS\.md/.test(P(W(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:Y,claudeMdImport:J,skills:{"beacon-init":v(W(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":v(W(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":v(W(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":v(W(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function RZ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let U=W(Q,".claude","skills",z);if(v(U))b(U,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let U=W(Q,".agents","skills",z);if(v(U))b(U,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,Y=W(Q,".mcp.json");try{let z=JSON.parse(P(Y,"utf8"));if(z.mcpServers?.beacon){if(delete z.mcpServers.beacon,$=!0,z.mcpServers&&Object.keys(z.mcpServers).length===0)delete z.mcpServers;if(Object.keys(z).length===0)b(Y,{force:!0});else H(Y,JSON.stringify(z,null,2)+`
13
+ `)}}catch{}let J=!1,V=W(Q,"AGENTS.md");try{let z=P(V,"utf8"),U=new RegExp(`\\n?${A}[\\s\\S]*?${YQ}\\n?`);if(U.test(z)){let T=z.replace(U,`
14
14
  `).replace(/\n{3,}/g,`
15
15
 
16
- `).trimStart();x(J,M.endsWith(`
17
- `)?M:`${M}
18
- `),Y=!0}}catch{}let H=!1,V=q(Q,"CLAUDE.md");try{let z=B(V,"utf8"),N=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(N!==z){if(!N.trim())k(V,{force:!0});else x(V,N);H=!0}}catch{}return{skillsRemoved:X,mcpUnregistered:Z,agentsBlockRemoved:Y,claudeImportRemoved:H}}var e=`---
16
+ `).trimStart();H(V,T.endsWith(`
17
+ `)?T:`${T}
18
+ `),J=!0}}catch{}let X=!1,q=W(Q,"CLAUDE.md");try{let z=P(q,"utf8"),U=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(U!==z){if(!U.trim())b(q,{force:!0});else H(q,U);X=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:J,claudeImportRemoved:X}}var ZQ=`---
19
19
  name: beacon-init
20
20
  description: Read this repository and map its architecture, schema, and roadmap into Beacon (the local visual planning panel). Use when the user runs /beacon-init, asks to "set up Beacon for this repo", or asks to initialize/bootstrap Beacon's map of this codebase.
21
21
  ---
@@ -28,7 +28,7 @@ The user already has Beacon running. You're going to map this repository's archi
28
28
 
29
29
  A single \`beacon_init_persist\` MCP tool call with:
30
30
 
31
- - **components**: 8\u201325 main building blocks of this codebase. NOT every file. Group them by \`domain\` (short UPPERCASE: AUTH, API, DATA, UI, JOBS, INFRA, BILLING, SEARCH, \u2026). For each: a one-line technical \`role\`, a one-sentence plain-language \`plain\`, the few \`files\` that implement it (repo-relative), and \`depends\` listing other component titles it relies on. Use the dependency graph you can see in the source \u2014 files that import each other heavily usually belong together.
31
+ - **components**: 8\u201325 main building blocks of this codebase. NOT every file. Group them by \`domain\` (short UPPERCASE: AUTH, API, DATA, UI, JOBS, INFRA, BILLING, SEARCH, \u2026). For each: a one-line technical \`role\`, a one-sentence plain-language \`plain\`, the few \`files\` that implement it (repo-relative), and \`depends\` listing other component titles it relies on. Use the dependency graph you can see in the source \u2014 files that import each other heavily usually belong together. If you spot a bug or something worth investigating while reading a component's code, add \`bugs: [{ note }]\` to that component \u2014 it renders as a bug flag on the node (attributed to the agent). Only flag what you actually saw in the code; don't speculate.
32
32
  - **roadmap**: 3\u20136 BROAD strategic directions. Big-picture themes only \u2014 "Harden auth & security", "Add observability", "Scale the data layer", "Pay down test-coverage debt". NOT detailed tasks. NOT file-level. Each gets a short title and one-line \`why\`.
33
33
  - **overview**: one paragraph describing what this project is and its stack. This lands in AGENTS.md as the project intro.
34
34
  - **conventions**: 3\u20138 concrete rules a contributor MUST follow \u2014 build/test commands, where code goes, patterns, things easy to get wrong. Infer from actual files, not assumptions.
@@ -52,7 +52,7 @@ A single \`beacon_init_persist\` MCP tool call with:
52
52
  If \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-init.
53
53
 
54
54
  After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
55
- `,QQ=`---
55
+ `,$Q=`---
56
56
  name: beacon-refresh
57
57
  description: Re-survey the repo and update Beacon's architecture / schema / endpoints map after /beacon-init was already run \u2014 picks up new components, removed ones, schema changes, and new routes. Use when the user runs /beacon-refresh or asks to "refresh", "update", "re-sync", or "bring Beacon up to date" with the current code.
58
58
  ---
@@ -87,7 +87,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
87
87
  - **~ changed**: COMPONENT_X (role expanded to cover Y)
88
88
  - **schema**: + 2 new tables (TableA, TableB); + 3 new endpoints; \u2212 1 deprecated endpoint
89
89
  No need to wait for confirmation \u2014 just show the diff so the user sees what's about to land.
90
- 5. **Call \`beacon_init_persist\`** ONCE with the refreshed full analysis (same shape as init: \`components\`, \`roadmap\`, \`overview\`, \`conventions\`, \`snapshot\`). It replaces all init-source nodes and regenerates \`AGENTS.md\`.
90
+ 5. **Call \`beacon_init_persist\`** ONCE with the refreshed full analysis (same shape as init: \`components\`, \`roadmap\`, \`overview\`, \`conventions\`, \`snapshot\`). It replaces all init-source nodes and regenerates \`AGENTS.md\`. Bug flags already on a component survive the refresh (they're carried over by title); add \`bugs: [{ note }]\` for anything NEW you found worth investigating \u2014 identical open flags are not duplicated.
91
91
 
92
92
  ## What you should NOT do
93
93
 
@@ -99,7 +99,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
99
99
  If \`beacon_entities\` or \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-refresh.
100
100
 
101
101
  After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
102
- `,XQ=`---
102
+ `,bQ=`---
103
103
  name: beacon-plan
104
104
  description: Present your current plan or approach to the user on Beacon's /plan canvas for review \u2014 instead of asking for approval in prose. Use when the user says "present the plan", "show me the plan", "let me see it / the plan", or whenever you are about to end a turn asking whether to proceed with a plan, design, or approach.
105
105
  ---
@@ -138,9 +138,10 @@ If it returns feedback, revise and call it again.
138
138
  - **Anything else** (a code-change plan, a mixed plan, a "how should I approach X") \u2192 use
139
139
  \`beacon_present_plan\` with markdown so the full reasoning shows on /plan.
140
140
 
141
- If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to presenting via
142
- ExitPlanMode with the same \`\`\`beacon block, or tell the user to run \`beacon\` in this repo once.
143
- `,f="<!-- beacon:workflow:start -->",_="<!-- beacon:workflow:end -->",i;var $Q=r(()=>{i=`${f}
141
+ If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
142
+ with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
143
+ run \`beacon\` in this repo once.
144
+ `,TZ,A="<!-- beacon:workflow:start -->",YQ="<!-- beacon:workflow:end -->",fQ;var VQ=N(()=>{TZ=[{name:"beacon-init",body:()=>ZQ},{name:"beacon-refresh",body:()=>$Q}];fQ=`${A}
144
145
  ## Beacon \u2014 feature workflow
145
146
 
146
147
  This project uses Beacon (a local planning/visualization panel; run \`beacon\` to open it). When you start work on a FEATURE \u2014 whether referenced via an \`@beacon:feature://\u2026\` mention, an \`@beacon:note://\u2026\` note the user wrote in the Notes panel (treat its checkbox \`- [ ]\` todos as subtasks and order features by their dependencies), or just described in chat \u2014 follow these steps in order:
@@ -171,6 +172,8 @@ When listing features, give each \`dependsOn: ["Other feature title", \u2026]\`
171
172
 
172
173
  ### 2b. Presenting a plan in plan mode (ExitPlanMode)
173
174
 
175
+ In Codex (which has no ExitPlanMode), always present plans via \`beacon_present_plan\` / \`beacon_propose_plan\` instead \u2014 this section applies to Claude Code's plan mode only.
176
+
174
177
  When you present a plan via ExitPlanMode (not \`beacon_propose_plan\`) and it proposes DB tables/relations/endpoints or roadmap features, embed ONE fenced \`\`\`beacon code block of JSON in the plan \u2014 the same shapes \`beacon_propose_plan\` accepts:
175
178
 
176
179
  \`\`\`beacon
@@ -181,16 +184,42 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
181
184
 
182
185
  **The board is built ONLY from the block \u2014 prose is NOT parsed.** If your plan describes ANY database models/tables/columns in the prose (e.g. "Model \`legal_precedent.py\` \u2014 natural key (court, \u2026)"), you MUST also put them in the block's \`tables\` array (with \`columns\`), or the /db tab will be empty for that plan. Same for endpoints (\`endpoints\` with \`uses:[{table,access}]\`) and features (\`features\`). A plan that lists five tables in prose but ships a block with only \`features\` renders an empty database board \u2014 exactly the "I described models but the DB tab is empty" failure. Mirror every DB entity you mention into the block.
183
186
 
184
- ### 3. At the end, register the work
187
+ ### 3. At the end, register the work \u2014 in ONE call
188
+
189
+ Call \`beacon_describe_feature\` **ONCE** with a \`features\` array \u2014 one entry per feature the plan created \u2014 each with the files you touched and a short markdown description. This flips each one to **Done** \u2014 including its sub-tasks (the cascade completes every PENDING/IN_PROGRESS child; a sub-task you did NOT finish must be set BLOCKED or CANCELLED before registering, so it survives visibly) \u2014 and keeps \`beacon_context_for_feature\` accurate for the next session.
185
190
 
186
- Call \`beacon_describe_feature\` for **EVERY** feature the plan created \u2014 once per feature, **by its exact title** (the same titles you listed in \`features\`/the \`\`\`beacon block) \u2014 with the files you touched and a short markdown description. This flips each one to **Done** and keeps \`beacon_context_for_feature\` accurate for the next session.
191
+ Key each entry by its node \`id\`: the ids are handed back to you when the plan is approved (in the approval message / additionalContext), so you don't fuzzy-match titles or pay a disambiguation round-trip. If you don't have an id, \`title\` still works.
187
192
 
188
- Do this per feature. If a plan added five features, that's five \`beacon_describe_feature\` calls \u2014 registering only an umbrella ("Harden auth") leaves the individual features stuck on **Pending** on the map.
193
+ Register them all in that single batched call. If a plan added five features, that's ONE \`beacon_describe_feature\` call with five entries \u2014 NOT five calls, and NOT just an umbrella ("Harden auth"), which leaves the individual features stuck on **Pending**.
189
194
 
190
195
  If the feature added or materially changed a REAL architectural component (a subsystem \u2014 NOT a file), also pass \`architecture: [{ title, domain, role, \u2026 }]\` so the Architecture map stays accurate. It upserts curated components by title; never list files as components.
191
196
 
192
197
  Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
193
- ${_}`});var HQ={};o(HQ,{provisionDb:()=>HX});import{createClient as eQ}from"@libsql/client";import{drizzle as QX}from"drizzle-orm/libsql";import{migrate as XX}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as ZX}from"drizzle-orm/migrator";import{dirname as c,join as $X}from"path";import{fileURLToPath as YX}from"url";async function I(Q,X){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[X]})).rows.length>0}async function qX(Q,X){let Z=await Q.execute(`PRAGMA table_info("${X}")`);return new Set(Z.rows.map(($)=>String($.name)))}async function GQ(Q){if(!await I(Q,"__drizzle_migrations"))return 0;let X=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(X.rows[0]?.n??0)}async function GX(Q){for(let[X,Z]of Object.entries(zX)){if(!await I(Q,X))continue;let $=await qX(Q,X);for(let Y of Z){if(!$.has(Y))continue;await Q.execute(`UPDATE "${X}" SET "${Y}" = CAST((julianday("${Y}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${Y}") = 'text'`)}}}async function HX(Q,X=VX){let Z=eQ({url:Q});try{await Z.execute("PRAGMA journal_mode = WAL;"),await Z.execute("PRAGMA foreign_keys = ON;");let $=await I(Z,"__drizzle_migrations"),Y=await I(Z,"Node"),J=!1;if(Y&&!$){let V=ZX({migrationsFolder:X})[0];if(V)await Z.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await Z.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[V.hash,V.folderMillis]}),J=!0}let H=await GQ(Z);if(await XX(QX(Z),{migrationsFolder:X}),await GQ(Z)>H)J=!0;return await GX(Z),{migrated:J}}finally{Z.close()}}var JX,VX,zX;var NQ=r(async()=>{JX=c(c(c(YX(import.meta.url)))),VX=process.env.BEACON_MIGRATIONS_DIR||$X(JX,"drizzle"),zX={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});import{existsSync as b,mkdirSync as y,readFileSync as F,rmSync as mQ,writeFileSync as u}from"fs";import{homedir as pQ}from"os";import{join as W}from"path";function cQ(){return process.env.HOME||process.env.USERPROFILE||pQ()}var j=()=>W(cQ(),".claude"),S=()=>W(j(),"skills"),YQ=()=>W(j(),"settings.json"),P=()=>W(j(),"CLAUDE.md"),O="<!-- beacon:global:start -->",L="<!-- beacon:global:end -->",h=["beacon-init","beacon-refresh","beacon-plan"],m=[{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"PermissionRequest",matcher:"ExitPlanMode",command:"beacon plan",description:"Pipe the agent's plan markdown into Beacon's /plan canvas for review."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose (instead of presenting it), nudge it to present the plan on Beacon's /plan canvas. Bounded by stop_hook_active \u2014 at most one nudge."}],lQ=`## Beacon (visual planning panel)
198
+ ${YQ}`});import{existsSync as IQ,mkdirSync as zQ,readFileSync as E,rmSync as fZ,writeFileSync as O}from"fs";import{dirname as AQ,join as D}from"path";function qQ(Q){try{return JSON.parse(E(Q,"utf8"))}catch{return{}}}function DQ(Q,Z){zQ(AQ(Q),{recursive:!0}),O(Q,JSON.stringify(Z,null,2)+`
199
+ `)}function y(Q,Z){let $=qQ(Q);$.hooks=$.hooks??{},$.hooks[Z.event]=$.hooks[Z.event]??[];let Y=$.hooks[Z.event];if(Y.some((V)=>V.matcher===Z.matcher&&V.hooks?.some((X)=>X.command===Z.command)))return!1;return Y.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),DQ(Q,$),!0}function k(Q,Z){return(qQ(Q).hooks?.[Z.event]??[]).some((J)=>J.hooks?.some((V)=>V.command===Z.command))}function L(Q,Z){let $=qQ(Q),Y=$.hooks?.[Z.event];if(!Y)return!1;let J=!1,V=Y.map((X)=>{let q=X.hooks?.length??0,z=(X.hooks??[]).filter((U)=>U.command!==Z.command);if(z.length!==q)J=!0;return{...X,hooks:z}}).filter((X)=>(X.hooks??[]).length>0);if(!J)return!1;if(V.length)$.hooks[Z.event]=V;else delete $.hooks[Z.event];if($.hooks&&Object.keys($.hooks).length===0)delete $.hooks;return DQ(Q,$),!0}function _(Q,Z,$,Y){let J=`${Z}
200
+ ${Y.trim()}
201
+ ${$}`,V="";try{V=E(Q,"utf8")}catch{}let X=new RegExp(`${Z}[\\s\\S]*?${$}`);V=X.test(V)?V.replace(X,J):V.trim()?`${V.trim()}
202
+
203
+ ${J}
204
+ `:`${J}
205
+ `,zQ(AQ(Q),{recursive:!0}),O(Q,V.endsWith(`
206
+ `)?V:`${V}
207
+ `)}function w(Q,Z){try{return E(Q,"utf8").includes(Z)}catch{return!1}}function h(Q,Z,$){let Y="";try{Y=E(Q,"utf8")}catch{return!1}let J=new RegExp(`${Z}[\\s\\S]*?${$}\\n?`);if(!J.test(Y))return!1;let V=Y.replace(J,"").replace(/\n{3,}/g,`
208
+
209
+ `).trimStart();return O(Q,V),!0}function S(Q,Z,$){let Y=D(Q,Z);zQ(Y,{recursive:!0});let J=D(Y,"SKILL.md");return O(J,$),J}function g(Q,Z){return IQ(D(Q,Z,"SKILL.md"))}function m(Q,Z){let $=D(Q,Z);if(!IQ($))return!1;return fZ($,{recursive:!0,force:!0}),!0}var XQ=()=>{};import{mkdirSync as bZ,renameSync as IZ,rmSync as AZ,writeFileSync as DZ}from"fs";import{dirname as EZ}from"path";function WQ(Q,Z){bZ(EZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{DZ($,Z),IZ($,Q)}catch(Y){throw AZ($,{force:!0}),Y}}var EQ=()=>{};var mQ={};QQ(mQ,{setupCodexAssets:()=>LZ,removeCodexMcp:()=>SQ,removeCodexArtifacts:()=>hZ,hasCodexMcp:()=>PQ,ensureCodexMcp:()=>hQ,codexMcpProblem:()=>kZ,codexDetected:()=>kQ,auditCodex:()=>_Z,CODEX_HOOKS:()=>a});import{readFileSync as l}from"fs";import{homedir as OZ}from"os";import{join as R}from"path";function OQ(){return process.env.HOME||process.env.USERPROFILE||OZ()}function kQ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(UQ===void 0)UQ=Bun.which("codex")!==null;return UQ}function u(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function PQ(){try{return Boolean(u(l(C(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function kZ(){let Q="";try{Q=l(C(),"utf8")}catch{return null}let Z=u(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${F}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${F}`;return null}function hQ(){let Q="",Z=!1;try{Q=l(C(),"utf8"),Z=!0}catch{}if(Z){let V=u(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${F}`};if(V.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(Q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${F}`}}let $=!Q?"":Q.endsWith(`
210
+ `)?`
211
+ `:`
212
+
213
+ `,Y=Q+$+yZ;if(u(Y)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${F}`};return WQ(C(),Y),{added:!0}}function SQ(){let Q="";try{Q=l(C(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
214
+ `),$=Z.indexOf(LQ);if($===-1)return{removed:!1,skipped:PQ()};let Y=Z.indexOf(_Q,$);if(Y===-1)return{removed:!1,skipped:!0};Z.splice($,Y-$+1);let J=Z.join(`
215
+ `).replace(/\n{3,}/g,`
216
+
217
+ `).replace(/^\n+/,"");if(u(J)===null)return{removed:!1,skipped:!0};return WQ(C(),J),{removed:!0}}async function LZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (VQ(),JQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},J=[];for(let z of j){if(!g(c(),z))J.push(z);S(c(),z,Y[z])}let V=0;for(let z of a)if(y(HQ(),{event:z.event,matcher:z.matcher,command:z.command}))V++;let X=w(p(),d);_(p(),d,yQ,jQ);let q=hQ();return{skillsAdded:J,hooksAdded:V,agentsMdBlockTouched:!X,mcp:q}}function _Z(){let Q={};for(let $ of j)Q[$]=g(c(),$);let Z={};for(let $ of a)Z[$.event]=k(HQ(),{event:$.event,command:$.command});return{detected:kQ(),skills:Q,hooks:Z,agentsMdBlock:w(p(),d),mcp:PQ()}}function hZ(){let Q=[];for(let J of j)if(m(c(),J))Q.push(J);let Z=0;for(let J of a)if(L(HQ(),{event:J.event,command:J.command}))Z++;let $=h(p(),d,yQ),Y=SQ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:Y.removed,mcpSkipped:Y.skipped}}var BQ=()=>R(OQ(),".codex"),HQ=()=>R(BQ(),"hooks.json"),C=()=>R(BQ(),"config.toml"),p=()=>R(BQ(),"AGENTS.md"),c=()=>R(OQ(),".agents","skills"),d="<!-- beacon:global:start -->",yQ="<!-- beacon:global:end -->",a,UQ,LQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",_Q="# beacon:end",yZ,F="add it manually: codex mcp add beacon -- beacon mcp";var pQ=N(()=>{XQ();EQ();GQ();a=[{event:"PostToolUse",matcher:"apply_patch",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose, nudge it to present the plan on Beacon's /plan canvas."}];yZ=`${LQ}
218
+ [mcp_servers.beacon]
219
+ command = "beacon"
220
+ args = ["mcp"]
221
+ ${_Q}
222
+ `});import{existsSync as SZ}from"fs";import{homedir as mZ}from"os";import{join as n}from"path";function pZ(){return process.env.HOME||process.env.USERPROFILE||mZ()}function cZ(Q,Z){return S(xQ(),Q,Z)}function dQ(Q){return g(xQ(),Q)}function dZ(Q){return m(xQ(),Q)}function lZ(Q){return y(KQ(),Q)}function aZ(Q){return k(KQ(),Q)}function nZ(Q){return L(KQ(),Q)}function tZ(Q){_(NQ(),vQ,cQ,Q)}function lQ(){return w(NQ(),vQ)}function sZ(){return h(NQ(),vQ,cQ)}function W1(){let Q={};for(let $ of j)Q[$]=dQ($);let Z={};for(let $ of CQ)Z[$.event]=aZ({event:$.event,command:$.command});return{homeExists:SZ(t()),skills:Q,hooks:Z,claudeMdBlock:lQ()}}async function rZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (VQ(),JQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},J=[];for(let q of j){if(!dQ(q))J.push(q);cZ(q,Y[q])}let V=0;for(let q of CQ)if(lZ({event:q.event,matcher:q.matcher,command:q.command}))V++;let X=lQ();return tZ(jQ),{skillsAdded:J,hooksAdded:V,claudeMdBlockTouched:!X}}async function aQ(){let Q;try{Q={ok:!0,...await rZ()}}catch(Z){Q={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}try{let Z=await Promise.resolve().then(() => (pQ(),mQ));if(Z.codexDetected())Q.codex={ok:!0,...await Z.setupCodexAssets()}}catch(Z){Q.codex={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,agentsMdBlockTouched:!1,mcp:{added:!1}}}return Q}function U1(){let Q=[];for(let Y of j)if(dZ(Y))Q.push(Y);let Z=0;for(let Y of CQ)if(nZ(Y))Z++;let $=sZ();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}var t=()=>n(pZ(),".claude"),xQ=()=>n(t(),"skills"),KQ=()=>n(t(),"settings.json"),NQ=()=>n(t(),"CLAUDE.md"),vQ="<!-- beacon:global:start -->",cQ="<!-- beacon:global:end -->",j,CQ,jQ=`## Beacon (visual planning panel)
194
223
 
195
224
  This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
196
225
  agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
@@ -211,18 +240,11 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
211
240
  Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
212
241
  on the /map and /db boards (added features, attached subtasks, edited columns, new
213
242
  endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
214
- verbatim. Do NOT implement until the tool returns approval.`;function dQ(Q,X){let Z=W(S(),Q);y(Z,{recursive:!0});let $=W(Z,"SKILL.md");return u($,X),$}function JQ(Q){return b(W(S(),Q,"SKILL.md"))}function tQ(Q){let X=W(S(),Q);if(!b(X))return!1;return mQ(X,{recursive:!0,force:!0}),!0}function p(){try{return JSON.parse(F(YQ(),"utf8"))}catch{return{}}}function VQ(Q){y(j(),{recursive:!0}),u(YQ(),JSON.stringify(Q,null,2)+`
215
- `)}function aQ(Q){let X=p();X.hooks=X.hooks??{},X.hooks[Q.event]=X.hooks[Q.event]??[];let Z=X.hooks[Q.event];if(Z.some((Y)=>Y.matcher===Q.matcher&&Y.hooks?.some((J)=>J.command===Q.command)))return!1;return Z.push({matcher:Q.matcher,hooks:[{type:"command",command:Q.command}]}),VQ(X),!0}function nQ(Q){return(p().hooks?.[Q.event]??[]).some(($)=>$.hooks?.some((Y)=>Y.command===Q.command))}function sQ(Q){let X=p(),Z=X.hooks?.[Q.event];if(!Z)return!1;let $=!1,Y=Z.map((J)=>{let H=J.hooks?.length??0,V=(J.hooks??[]).filter((z)=>z.command!==Q.command);if(V.length!==H)$=!0;return{...J,hooks:V}}).filter((J)=>(J.hooks??[]).length>0);if(!$)return!1;if(Y.length)X.hooks[Q.event]=Y;else delete X.hooks[Q.event];if(X.hooks&&Object.keys(X.hooks).length===0)delete X.hooks;return VQ(X),!0}function oQ(Q){let X=`${O}
216
- ${Q.trim()}
217
- ${L}`,Z="";try{Z=F(P(),"utf8")}catch{}let $=new RegExp(`${O}[\\s\\S]*?${L}`);Z=$.test(Z)?Z.replace($,X):Z.trim()?`${Z.trim()}
218
-
219
- ${X}
220
- `:`${X}
221
- `,y(j(),{recursive:!0}),u(P(),Z.endsWith(`
222
- `)?Z:`${Z}
223
- `)}function zQ(){try{return F(P(),"utf8").includes(O)}catch{return!1}}function rQ(){let Q="";try{Q=F(P(),"utf8")}catch{return!1}let X=new RegExp(`${O}[\\s\\S]*?${L}\\n?`);if(!X.test(Q))return!1;let Z=Q.replace(X,"").replace(/\n{3,}/g,`
243
+ verbatim. Do NOT implement until the tool returns approval.`;var GQ=N(()=>{XQ();j=["beacon-init","beacon-refresh","beacon-plan"],CQ=[{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"PermissionRequest",matcher:"ExitPlanMode",command:"beacon plan",description:"Pipe the agent's plan markdown into Beacon's /plan canvas for review."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose (instead of presenting it), nudge it to present the plan on Beacon's /plan canvas. Bounded by stop_hook_active \u2014 at most one nudge."}]});var tQ={};QQ(tQ,{provisionDb:()=>X0});import{createClient as oZ}from"@libsql/client";import{drizzle as iZ}from"drizzle-orm/libsql";import{migrate as eZ}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as Q0}from"drizzle-orm/migrator";import{dirname as MQ,join as Z0}from"path";import{fileURLToPath as $0}from"url";async function s(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function z0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((Y)=>String(Y.name)))}async function nQ(Q){if(!await s(Q,"__drizzle_migrations"))return 0;let Z=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(Z.rows[0]?.n??0)}async function q0(Q){for(let[Z,$]of Object.entries(V0)){if(!await s(Q,Z))continue;let Y=await z0(Q,Z);for(let J of $){if(!Y.has(J))continue;await Q.execute(`UPDATE "${Z}" SET "${J}" = CAST((julianday("${J}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${J}") = 'text'`)}}}async function X0(Q,Z=J0){let $=oZ({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;");let Y=await s($,"__drizzle_migrations"),J=await s($,"Node"),V=!1;if(J&&!Y){let q=Q0({migrationsFolder:Z})[0];if(q)await $.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await $.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[q.hash,q.folderMillis]}),V=!0}let X=await nQ($);if(await eZ(iZ($),{migrationsFolder:Z}),await nQ($)>X)V=!0;return await q0($),{migrated:V}}finally{$.close()}}var Y0,J0,V0;var sQ=N(async()=>{Y0=MQ(MQ(MQ($0(import.meta.url)))),J0=process.env.BEACON_MIGRATIONS_DIR||Z0(Y0,"drizzle"),V0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});import{AsyncLocalStorage as W0}from"async_hooks";import{spawnSync as U0}from"child_process";import{createHash as B0}from"crypto";import{existsSync as oQ,mkdirSync as r,readFileSync as iQ,writeFileSync as eQ}from"fs";import{homedir as H0}from"os";import{basename as P0,join as M}from"path";function x(){return process.env.BEACON_HOME||M(H0(),".beacon")}function TQ(){return M(x(),"workspaces.json")}function QZ(Q){return B0("sha256").update(Q).digest("hex").slice(0,12)}function g1(Q=process.cwd()){let Z=U0("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(Z.status===0){let $=Z.stdout?.toString().trim();if($)return $}return Q}function wQ(Q){return M(x(),Q)}function j0(Q){return`file:${M(wQ(Q),"db.sqlite")}`}function f(){try{let Q=JSON.parse(iQ(TQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function gQ(Q){r(x(),{recursive:!0}),eQ(TQ(),JSON.stringify(Q,null,2))}function G0(){return f().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function G(Q){return f().find((Z)=>Z.id===Q)??null}function x0(Q,Z,$=new Date().toISOString()){let Y=QZ(Q),J=f(),V=J.find((z)=>z.id===Y),X={id:Y,path:Q,name:Z||V?.name||P0(Q),lastOpenedAt:$},q=[X,...J.filter((z)=>z.id!==Y)];return r(wQ(Y),{recursive:!0}),gQ(q),X}function F1(Q,Z=new Date().toISOString()){let $=f(),Y=$.find((J)=>J.id===Q);if(!Y)return;Y.lastOpenedAt=Z,gQ($)}function u1(Q){if(gQ(f().filter((Z)=>Z.id!==Q)),FQ()===Q)K0(G0()[0]?.id??null)}function ZZ(){return M(x(),"active")}function FQ(){try{return iQ(ZZ(),"utf8").trim()||null}catch{return null}}function K0(Q){r(x(),{recursive:!0}),eQ(ZZ(),Q??"")}function R1(){let Q=FQ();return Q?G(Q):null}function f1(){let Q=v0()??FQ();return Q?G(Q):null}function b1(Q){return G(Q)?.path??null}function I1(){return oQ(TQ())}var $Z="beacon_ws";function YZ(Q,Z){let $=Q.headers.get("cookie");if(!$)return null;for(let Y of $.split(";")){let J=Y.indexOf("=");if(J===-1)continue;if(Y.slice(0,J).trim()===Z)return decodeURIComponent(Y.slice(J+1).trim())}return null}function A1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&G(Z))return Z;let $=YZ(Q,$Z);if($&&G($))return $;return null}var N0="x-beacon-workspace-path";async function D1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&G(Z))return Z;let $=Q.headers.get(N0);if($&&(!Z||QZ($)===Z)){let J=x0($);return await C0(J.id),J.id}let Y=YZ(Q,$Z);if(Y&&G(Y))return Y;return null}var JZ=new W0;function E1(Q,Z){return Q?JZ.run(Q,Z):Z()}function v0(){return JZ.getStore()??null}var rQ=new Set;async function C0(Q){let Z=wQ(Q),$=M(Z,"db.sqlite"),Y=oQ($);if(Y&&rQ.has($))return{ok:!0,created:!1,migrated:!1};try{r(Z,{recursive:!0});let{provisionDb:J}=await sQ().then(() => tQ),V=await J(j0(Q));return rQ.add($),{ok:!0,created:!Y,migrated:Y&&V.migrated}}catch(J){return{ok:!1,created:!1,migrated:!1,error:J instanceof Error?J.message:String(J)}}}GQ();import{execSync as PZ,spawn as F0}from"child_process";import{mkdirSync as u0,openSync as R0,readFileSync as f0,writeFileSync as b0}from"fs";import{homedir as I0,platform as BZ}from"os";import{dirname as A0,join as i}from"path";import{fileURLToPath as D0}from"url";import{createHash as E0}from"crypto";var VZ=1500,zZ=345600000,y1=1800000,k1=3000;import{mkdirSync as S1,readFileSync as T0,writeFileSync as m1}from"fs";import{join as w0}from"path";var M0=["default","acceptEdits","bypassPermissions","auto"];function qZ(Q){return typeof Q==="string"&&M0.includes(Q)}function XZ(Q,Z){let $={behavior:"allow"};if(Q)$.updatedPermissions=[{type:"setMode",mode:Q,destination:"session"}];let Y={hookEventName:"PermissionRequest",decision:$};if(Z?.trim())Y.additionalContext=Z;return{hookSpecificOutput:Y}}function g0(){return w0(x(),"preferences.json")}function WZ(){try{let Q=JSON.parse(T0(g0(),"utf8"));return{planApprovalMode:qZ(Q.planApprovalMode)?Q.planApprovalMode:void 0,planApprovalModeConfigured:Q.planApprovalModeConfigured===!0}}catch{return{}}}function UZ(Q){if(!Q?.length)return"";let Z=Q.map((Y)=>Y.id?` \u2022 ${Y.title} \u2014 id: ${Y.id}`:` \u2022 ${Y.title}`),$=Q.some((Y)=>Y.id);return`
224
244
 
225
- `).trimStart();return u(P(),Z),!0}function iX(){let Q={};for(let Z of h)Q[Z]=JQ(Z);let X={};for(let Z of m)X[Z.event]=nQ({event:Z.event,command:Z.command});return{homeExists:b(j()),skills:Q,hooks:X,claudeMdBlock:zQ()}}async function iQ(){let{INIT_SKILL:Q,REFRESH_SKILL:X,PLAN_SKILL:Z}=await Promise.resolve().then(() => ($Q(),ZQ)),$={"beacon-init":Q,"beacon-refresh":X,"beacon-plan":Z},Y=[];for(let V of h){if(!JQ(V))Y.push(V);dQ(V,$[V])}let J=0;for(let V of m)if(aQ({event:V.event,matcher:V.matcher,command:V.command}))J++;let H=zQ();return oQ(lQ),{skillsAdded:Y,hooksAdded:J,claudeMdBlockTouched:!H}}async function qQ(){try{return{ok:!0,...await iQ()}}catch(Q){return{ok:!1,error:Q instanceof Error?Q.message:String(Q),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}}function eX(){let Q=[];for(let $ of h)if(tQ($))Q.push($);let X=0;for(let $ of m)if(sQ($))X++;let Z=rQ();return{skillsRemoved:Q,hooksRemoved:X,claudeMdBlockRemoved:Z}}import{AsyncLocalStorage as NX}from"async_hooks";import{spawnSync as BX}from"child_process";import{createHash as xX}from"crypto";import{existsSync as xQ,mkdirSync as D,readFileSync as WQ,writeFileSync as UQ}from"fs";import{homedir as WX}from"os";import{basename as UX,join as T}from"path";function K(){return process.env.BEACON_HOME||T(WX(),".beacon")}function l(){return T(K(),"workspaces.json")}function KQ(Q){return xX("sha256").update(Q).digest("hex").slice(0,12)}function xZ(Q=process.cwd()){let X=BX("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(X.status===0){let Z=X.stdout?.toString().trim();if(Z)return Z}return Q}function d(Q){return T(K(),Q)}function KX(Q){return`file:${T(d(Q),"db.sqlite")}`}function v(){try{let Q=JSON.parse(WQ(l(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function t(Q){D(K(),{recursive:!0}),UQ(l(),JSON.stringify(Q,null,2))}function CX(){return v().sort((Q,X)=>X.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function U(Q){return v().find((X)=>X.id===Q)??null}function jX(Q,X,Z=new Date().toISOString()){let $=KQ(Q),Y=v(),J=Y.find((z)=>z.id===$),H={id:$,path:Q,name:X||J?.name||UX(Q),lastOpenedAt:Z},V=[H,...Y.filter((z)=>z.id!==$)];return D(d($),{recursive:!0}),t(V),H}function WZ(Q,X=new Date().toISOString()){let Z=v(),$=Z.find((Y)=>Y.id===Q);if(!$)return;$.lastOpenedAt=X,t(Z)}function UZ(Q){if(t(v().filter((X)=>X.id!==Q)),a()===Q)TX(CX()[0]?.id??null)}function CQ(){return T(K(),"active")}function a(){try{return WQ(CQ(),"utf8").trim()||null}catch{return null}}function TX(Q){D(K(),{recursive:!0}),UQ(CQ(),Q??"")}function KZ(){let Q=a();return Q?U(Q):null}function CZ(){let Q=PX()??a();return Q?U(Q):null}function jZ(Q){return U(Q)?.path??null}function TZ(){return xQ(l())}var jQ="beacon_ws";function TQ(Q,X){let Z=Q.headers.get("cookie");if(!Z)return null;for(let $ of Z.split(";")){let Y=$.indexOf("=");if(Y===-1)continue;if($.slice(0,Y).trim()===X)return decodeURIComponent($.slice(Y+1).trim())}return null}function MZ(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&U(X))return X;let Z=TQ(Q,jQ);if(Z&&U(Z))return Z;return null}var MX="x-beacon-workspace-path";async function PZ(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&U(X))return X;let Z=Q.headers.get(MX);if(Z&&(!X||KQ(Z)===X)){let Y=jX(Z);return await vX(Y.id),Y.id}let $=TQ(Q,jQ);if($&&U($))return $;return null}var MQ=new NX;function vZ(Q,X){return Q?MQ.run(Q,X):X()}function PX(){return MQ.getStore()??null}var BQ=new Set;async function vX(Q){let X=d(Q),Z=T(X,"db.sqlite"),$=xQ(Z);if($&&BQ.has(Z))return{ok:!0,created:!1,migrated:!1};try{D(X,{recursive:!0});let{provisionDb:Y}=await NQ().then(() => HQ),J=await Y(KX(Q));return BQ.add(Z),{ok:!0,created:!$,migrated:$&&J.migrated}}catch(Y){return{ok:!1,created:!1,migrated:!1,error:Y instanceof Error?Y.message:String(Y)}}}import{execSync as DQ,spawn as IX}from"child_process";import{mkdirSync as DX,openSync as EX,readFileSync as RX,writeFileSync as AX}from"fs";import{homedir as kX,platform as uQ}from"os";import{dirname as wX,join as R}from"path";import{fileURLToPath as gX}from"url";import{createHash as _X}from"crypto";var PQ=1500,vQ=345600000,OZ=1800000,FZ=3000;import{mkdirSync as EZ,readFileSync as OX,writeFileSync as RZ}from"fs";import{join as FX}from"path";var fX=["default","acceptEdits","bypassPermissions","auto"];function fQ(Q){return typeof Q==="string"&&fX.includes(Q)}function OQ(Q){let X={behavior:"allow"};if(Q)X.updatedPermissions=[{type:"setMode",mode:Q,destination:"session"}];return{hookSpecificOutput:{hookEventName:"PermissionRequest",decision:X}}}function uX(){return FX(K(),"preferences.json")}function FQ(){try{let Q=JSON.parse(OX(uX(),"utf8"));return{planApprovalMode:fQ(Q.planApprovalMode)?Q.planApprovalMode:void 0,planApprovalModeConfigured:Q.planApprovalModeConfigured===!0}}catch{return{}}}var LX=R(wX(gX(import.meta.url)),".."),s=process.env.BEACON_HOME||R(kX(),".beacon"),EQ=R(s,"server.json"),IQ=process.env.PORT||"4319";function bX(Q){try{return process.kill(Q,0),!0}catch{return!1}}function yX(Q){try{return JSON.parse(RX(Q,"utf8"))}catch{return null}}async function RQ(Q){try{return(await fetch(Q)).ok}catch{return!1}}async function SX(Q,X=60){for(let Z=0;Z<X;Z++){if(await RQ(Q))return!0;await new Promise(($)=>setTimeout($,500))}return!1}function hX(){DX(s,{recursive:!0});let Q=EX(R(s,"server.log"),"a"),X={...process.env,PORT:IQ,BEACON_NO_OPEN:"1"};delete X.BEACON_REPO,delete X.BEACON_DATA_DIR,delete X.DATABASE_URL;let Z=IX("bun",["run","dev"],{cwd:LX,env:X,detached:!0,stdio:["ignore",Q,Q]});Z.unref();let $={pid:Z.pid??0,port:IQ};return AX(EQ,JSON.stringify($)),$}async function mX(){let Q=yX(EQ);if(Q&&bX(Q.pid)&&await RQ(`http://localhost:${Q.port}/api/workspace`))return Q.port;let{port:X}=hX();return await SX(`http://localhost:${X}/api/workspace`),X}function pX(Q){if(process.env.BEACON_NO_OPEN)return;let X=uQ()==="darwin"?"open":uQ()==="win32"?"start":"xdg-open";try{DQ(`${X} "${Q}"`,{stdio:"ignore"})}catch{}}function cX(){try{return DQ("git rev-parse --show-toplevel",{cwd:process.cwd(),stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return""}}function lX(Q){return _X("sha256").update(Q).digest("hex").slice(0,12)}async function dX(){if(process.stdin.isTTY)return null;let Q=[];for await(let Z of process.stdin)Q.push(Z);let X=Buffer.concat(Q).toString("utf8").trim();if(!X)return null;try{return JSON.parse(X)}catch{return null}}function n(Q){return OQ(Q)}function E(Q){return{hookSpecificOutput:{hookEventName:"PermissionRequest",decision:{behavior:"deny",message:Q}}}}function C(Q){process.stdout.write(JSON.stringify(Q)),process.exit(0)}(async()=>{await qQ();let X=(await dX())?.tool_input?.plan;if(!X||!X.trim())C(n());let $=`http://localhost:${await mX()}`,Y=cX()||process.cwd(),J=lX(Y);await fetch(`${$}/api/workspace/activate?id=${J}`).catch(()=>{});let H=X.split(`
226
- `,1)[0]?.replace(/^#+\s*/,"").slice(0,160)||"Plan review",V=await fetch(`${$}/api/plan`,{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":J},body:JSON.stringify({description:H,markdown:X})});if(V.status===422){let G=await V.json().catch(()=>({}));C(E(G.error??"Beacon rejected the plan: every roadmap feature needs a category and a priority. Add them and re-present."))}if(!V.ok)C(n());if(!await fetch(`${$}/api/plan/presence`,{headers:{"x-beacon-workspace":J}}).then((G)=>G.json()).then((G)=>!!G?.live).catch(()=>!1)){let G=encodeURIComponent(`/plan?ws=${J}`);pX(`${$}/api/workspace/activate?id=${J}&redirect=${G}`)}let N=Date.now()+vQ,M=(G)=>new Promise((A)=>setTimeout(A,G));while(Date.now()<N){await M(PQ);let G=await fetch(`${$}/api/plan/verdict`,{headers:{"x-beacon-workspace":J}}).then((A)=>A.json()).catch(()=>null);if(!G)continue;if(G.kind==="approved")C(n(FQ().planApprovalMode));if(G.kind==="discarded")C(E("The user discarded the plan in Beacon. Ask what they want to adjust before re-presenting."));if(G.kind==="feedback")C(E(`The user left feedback on the plan in Beacon (inline comments and/or edits on the /map and /db boards). Revise the plan based on the feedback below, then re-present (call ExitPlanMode again):
245
+ This plan created these roadmap feature(s):
246
+ `+Z.join(`
247
+ `)+"\n\nWhen the work ships, register them in ONE call: `beacon_describe_feature` with a "+"`features` array \u2014 one entry per feature"+($?", each keyed by the `id` above (no title-matching needed)":"")+", each with the files you touched + a short markdown summary. Do them all in that single "+"batched call so every feature flips to Done \u2014 do NOT register only the umbrella, and do "+"NOT make one call per feature."}var O0=i(A0(D0(import.meta.url)),".."),RQ=process.env.BEACON_HOME||i(I0(),".beacon"),jZ=i(RQ,"server.json"),HZ=process.env.PORT||"4319";function y0(Q){try{return process.kill(Q,0),!0}catch{return!1}}function k0(Q){try{return JSON.parse(f0(Q,"utf8"))}catch{return null}}async function GZ(Q){try{return(await fetch(Q)).ok}catch{return!1}}async function L0(Q,Z=60){for(let $=0;$<Z;$++){if(await GZ(Q))return!0;await new Promise((Y)=>setTimeout(Y,500))}return!1}function _0(){u0(RQ,{recursive:!0});let Q=R0(i(RQ,"server.log"),"a"),Z={...process.env,PORT:HZ,BEACON_NO_OPEN:"1"};delete Z.BEACON_REPO,delete Z.BEACON_DATA_DIR,delete Z.DATABASE_URL;let $=F0("bun",["run","dev"],{cwd:O0,env:Z,detached:!0,stdio:["ignore",Q,Q]});$.unref();let Y={pid:$.pid??0,port:HZ};return b0(jZ,JSON.stringify(Y)),Y}async function h0(){let Q=k0(jZ);if(Q&&y0(Q.pid)&&await GZ(`http://localhost:${Q.port}/api/workspace`))return Q.port;let{port:Z}=_0();return await L0(`http://localhost:${Z}/api/workspace`),Z}function S0(Q){if(process.env.BEACON_NO_OPEN)return;let Z=BZ()==="darwin"?"open":BZ()==="win32"?"start":"xdg-open";try{PZ(`${Z} "${Q}"`,{stdio:"ignore"})}catch{}}function m0(){try{return PZ("git rev-parse --show-toplevel",{cwd:process.cwd(),stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return""}}function p0(Q){return E0("sha256").update(Q).digest("hex").slice(0,12)}async function c0(){if(process.stdin.isTTY)return null;let Q=[];for await(let $ of process.stdin)Q.push($);let Z=Buffer.concat(Q).toString("utf8").trim();if(!Z)return null;try{return JSON.parse(Z)}catch{return null}}function uQ(Q,Z){return XZ(Q,Z)}function o(Q){return{hookSpecificOutput:{hookEventName:"PermissionRequest",decision:{behavior:"deny",message:Q}}}}function K(Q){process.stdout.write(JSON.stringify(Q)),process.exit(0)}(async()=>{await aQ();let Z=(await c0())?.tool_input?.plan;if(!Z||!Z.trim())K(uQ());let Y=`http://localhost:${await h0()}`,J=m0()||process.cwd(),V=p0(J);await fetch(`${Y}/api/workspace/activate?id=${V}`).catch(()=>{});let X=Z.split(`
248
+ `,1)[0]?.replace(/^#+\s*/,"").slice(0,160)||"Plan review",q=await fetch(`${Y}/api/plan`,{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":V},body:JSON.stringify({description:X,markdown:Z})});if(q.status===422){let B=await q.json().catch(()=>({}));K(o(B.error??"Beacon rejected the plan: every roadmap feature needs a category and a priority. Add them and re-present."))}if(!q.ok)K(uQ());if(!await fetch(`${Y}/api/plan/presence`,{headers:{"x-beacon-workspace":V}}).then((B)=>B.json()).then((B)=>!!B?.live).catch(()=>!1)){let B=encodeURIComponent(`/plan?ws=${V}`);S0(`${Y}/api/workspace/activate?id=${V}&redirect=${B}`)}let U=Date.now()+zZ,T=(B)=>new Promise((e)=>setTimeout(e,B));while(Date.now()<U){await T(VZ);let B=await fetch(`${Y}/api/plan/verdict`,{headers:{"x-beacon-workspace":V}}).then((e)=>e.json()).catch(()=>null);if(!B)continue;if(B.kind==="approved")K(uQ(WZ().planApprovalMode,UZ(B.features)));if(B.kind==="discarded")K(o("The user discarded the plan in Beacon. Ask what they want to adjust before re-presenting."));if(B.kind==="feedback")K(o(`The user left feedback on the plan in Beacon (inline comments and/or edits on the /map and /db boards). Revise the plan based on the feedback below, then re-present (call ExitPlanMode again):
227
249
 
228
- `+G.feedback))}C(E("Beacon plan review timed out without a verdict. Re-present the plan and ask the user to review it."))})();
250
+ `+B.feedback))}K(o("Beacon plan review timed out without a verdict. Re-present the plan and ask the user to review it."))})();
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{execSync as X}from"child_process";import{existsSync as Y,readFileSync as Z}from"fs";import{join as $}from"path";function D(){process.exit(0)}function f(q){let G=q;try{G=X("git rev-parse --show-toplevel",{cwd:q,stdio:["ignore","pipe","ignore"]}).toString().trim()||q}catch{}for(let Q of new Set([G,q])){let H=$(Q,".mcp.json");try{if(Y(H)&&Z(H,"utf8").includes("beacon"))return!0}catch{}}return!1}var g=/@beacon:feature/i,j=/\b(feature|sub-?tasks?)\b/i,B=/\b(implement|build|add|create|design|develop|work on|wire up|ship|refactor)\b/i,J="";try{for await(let q of process.stdin)J+=q}catch{D()}var z="",P=process.cwd();try{let q=JSON.parse(J||"{}");if(typeof q.prompt==="string")z=q.prompt;if(typeof q.cwd==="string"&&q.cwd)P=q.cwd}catch{D()}var C=g.test(z)||j.test(z)&&B.test(z);if(!z||!C||!f(P))D();var I=["[Beacon] This looks like feature work. Follow Beacon's loop IN ORDER \u2014 do not jump straight to Glob/Grep/Read:","1. Call beacon_context_for_feature({ id | title | query }) FIRST. It returns the attached files, 1-hop import blast radius, the domain's endpoints + tables + FK relations, sibling components, and conventions \u2014 and marks the feature active. That replaces the discovery phase.","2. Design data before code: if the feature needs tables that don't exist yet, call beacon_propose_plan (tables + relations + endpoints) and WAIT for approval on /plan before writing migrations or code.","3. When done, call beacon_describe_feature with the files you touched + a short markdown summary so the map and AGENTS.md stay accurate."].join(`
3
+ import{execSync as X}from"child_process";import{existsSync as Y,readFileSync as Z}from"fs";import{join as $}from"path";function D(){process.exit(0)}function f(q){let G=q;try{G=X("git rev-parse --show-toplevel",{cwd:q,stdio:["ignore","pipe","ignore"]}).toString().trim()||q}catch{}for(let Q of new Set([G,q])){let H=$(Q,".mcp.json");try{if(Y(H)&&Z(H,"utf8").includes("beacon"))return!0}catch{}}return!1}var g=/@beacon:feature/i,j=/\b(feature|sub-?tasks?)\b/i,B=/\b(implement|build|add|create|design|develop|work on|wire up|ship|refactor)\b/i,J="";try{for await(let q of process.stdin)J+=q}catch{D()}var z="",P=process.cwd();try{let q=JSON.parse(J||"{}");if(typeof q.prompt==="string")z=q.prompt;if(typeof q.cwd==="string"&&q.cwd)P=q.cwd}catch{D()}var C=g.test(z)||j.test(z)&&B.test(z);if(!z||!C||!f(P))D();var I=["[Beacon] This looks like feature work. Follow Beacon's loop IN ORDER \u2014 do not start blind codebase searches:","1. Call beacon_context_for_feature({ id | title | query }) FIRST. It returns the attached files, 1-hop import blast radius, the domain's endpoints + tables + FK relations, sibling components, and conventions \u2014 and marks the feature active. That replaces the discovery phase.","2. Design data before code: if the feature needs tables that don't exist yet, call beacon_propose_plan (tables + relations + endpoints) and WAIT for approval on /plan before writing migrations or code.","3. When done, call beacon_describe_feature with the files you touched + a short markdown summary so the map and AGENTS.md stay accurate."].join(`
4
4
  `);process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"UserPromptSubmit",additionalContext:I}}));process.exit(0);
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var Y=Object.defineProperty;var Z=(F)=>F;function $(F,H){this[F]=Z.bind(null,H)}var L=(F,H)=>{for(var I in H)Y(F,I,{get:H[I],enumerable:!0,configurable:!0,set:$.bind(H,I)})};var N=(F,H)=>()=>(F&&(H=F(F=0)),H);import{closeSync as V,fstatSync as _,openSync as w,readSync as z}from"fs";var q=[/\bshould i (go ahead|proceed|start|begin|continue|implement|build|kick)\b/i,/\b(want|do you want|would you like) me to (go ahead|proceed|start|begin|continue|implement|build|kick|do)\b/i,/\bshall i (proceed|start|begin|continue|implement|build|go)\b/i,/\bdoes (this|that|the plan|the approach|it) (look|sound) (right|good|ok|okay|fine)\b/i,/\b(looks?|sounds?) (right|good|fine) to you\b/i,/\blet me know (if|what|how|whether|once|when)\b/i,/\bbefore i (go|start|begin|implement|proceed|dive|write|send|build|continue|move|ship)\b/i,/\b(ready|good) to (proceed|implement|start|build|go)\b/i,/\b(things?|couple|two|a few)\b[^.?!]*\bto confirm\b/i,/\bto confirm[:?]/i,/\bif (this|that|it) looks (right|good|ok|okay)\b/i,/\bwaiting (for|on) your (approval|go-?ahead|sign-?off|ok|review|decision)\b/i,/\b(approve|green-?light|sign off on) (this|the plan|the approach|it)\b/i];function C(F){if(!F||!F.trim())return!1;return q.some((H)=>H.test(F))}function D(F){if(typeof F==="string")return F;if(Array.isArray(F))return F.filter((H)=>H?.type==="text"&&typeof H.text==="string").map((H)=>H.text).join(`
3
+ var Y=Object.defineProperty;var Z=(F)=>F;function $(F,H){this[F]=Z.bind(null,H)}var L=(F,H)=>{for(var I in H)Y(F,I,{get:H[I],enumerable:!0,configurable:!0,set:$.bind(H,I)})};var N=(F,H)=>()=>(F&&(H=F(F=0)),H);import{closeSync as V,fstatSync as _,openSync as w,readSync as z}from"fs";var q=[/\bshould i (go ahead|proceed|start|begin|continue|implement|build|kick)\b/i,/\b(want|do you want|would you like) me to (go ahead|proceed|start|begin|continue|implement|build|kick|do)\b/i,/\bshall i (proceed|start|begin|continue|implement|build|go)\b/i,/\bdoes (this|that|the plan|the approach|it) (look|sound) (right|good|ok|okay|fine)\b/i,/\b(looks?|sounds?) (right|good|fine) to you\b/i,/\blet me know (if|what|how|whether|once|when)\b/i,/\bbefore i (go|start|begin|implement|proceed|dive|write|send|build|continue|move|ship)\b/i,/\b(ready|good) to (proceed|implement|start|build|go)\b/i,/\b(things?|couple|two|a few)\b[^.?!]*\bto confirm\b/i,/\bto confirm[:?]/i,/\bif (this|that|it) looks (right|good|ok|okay)\b/i,/\bwaiting (for|on) your (approval|go-?ahead|sign-?off|ok|review|decision)\b/i,/\b(approve|green-?light|sign off on) (this|the plan|the approach|it)\b/i];function C(F){if(!F||!F.trim())return!1;return q.some((H)=>H.test(F))}function D(F){if(typeof F==="string")return F;if(Array.isArray(F))return F.filter((H)=>(H?.type==="text"||H?.type==="output_text")&&typeof H.text==="string").map((H)=>H.text).join(`
4
4
  `).trim();return""}function G(F){let H=F.split(`
5
- `);for(let I=H.length-1;I>=0;I--){let M=H[I].trim();if(!M)continue;let J;try{J=JSON.parse(M)}catch{continue}let K=J.message??J;if((K.role??J.type)!=="assistant")continue;return D(K.content)}return""}function U(F){let H=F.split(/\n\s*\n/).map((I)=>I.trim()).filter(Boolean);return H.length?H[H.length-1]:""}function W(F){return C(U(G(F)))}var B="It looks like you ended your turn asking the user to approve a plan or decide how to "+"proceed \u2014 in prose. In this project, plans are reviewed on Beacon's /plan canvas, not in the "+"terminal. Present it through Beacon instead: call the `beacon_present_plan` MCP tool with your plan as markdown (embed a ```beacon block for any tables/endpoints/features). It opens /plan and BLOCKS until the user approves, discards, or leaves feedback, then returns their verdict. If this was NOT a plan (just a quick question), ignore this and continue.";function E(F,H=65536){let I=w(F,"r");try{let M=_(I).size,J=Math.max(0,M-H),K=M-J;if(K<=0)return"";let Q=Buffer.alloc(K);return z(I,Q,0,K,J),Q.toString("utf8")}finally{V(I)}}var X="";for await(let F of process.stdin)X+=F;try{let F=JSON.parse(X||"{}");if(F.stop_hook_active)process.exit(0);let H=F.transcript_path;if(typeof H!=="string"||!H)process.exit(0);let I="";try{I=E(H)}catch{process.exit(0)}if(W(I))process.stdout.write(JSON.stringify({decision:"block",reason:B}))}catch{}process.exit(0);
5
+ `);for(let I=H.length-1;I>=0;I--){let M=H[I].trim();if(!M)continue;let J;try{J=JSON.parse(M)}catch{continue}let K=J.message??J.payload??J;if((K.role??J.type)!=="assistant")continue;return D(K.content)}return""}function U(F){let H=F.split(/\n\s*\n/).map((I)=>I.trim()).filter(Boolean);return H.length?H[H.length-1]:""}function W(F){return C(U(G(F)))}var B="It looks like you ended your turn asking the user to approve a plan or decide how to "+"proceed \u2014 in prose. In this project, plans are reviewed on Beacon's /plan canvas, not in the "+"terminal. Present it through Beacon instead: call the `beacon_present_plan` MCP tool with your plan as markdown (embed a ```beacon block for any tables/endpoints/features). It opens /plan and BLOCKS until the user approves, discards, or leaves feedback, then returns their verdict. If this was NOT a plan (just a quick question), ignore this and continue.";function E(F,H=65536){let I=w(F,"r");try{let M=_(I).size,J=Math.max(0,M-H),K=M-J;if(K<=0)return"";let Q=Buffer.alloc(K);return z(I,Q,0,K,J),Q.toString("utf8")}finally{V(I)}}var X="";for await(let F of process.stdin)X+=F;try{let F=JSON.parse(X||"{}");if(F.stop_hook_active)process.exit(0);let H=F.transcript_path;if(typeof H!=="string"||!H)process.exit(0);let I="";try{I=E(H)}catch{process.exit(0)}if(W(I))process.stdout.write(JSON.stringify({decision:"block",reason:B}))}catch{}process.exit(0);
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var IQ=Object.defineProperty;var FQ=(Q)=>Q;function DQ(Q,X){this[Q]=FQ.bind(null,X)}var QQ=(Q,X)=>{for(var Z in X)IQ(Q,Z,{get:X[Z],enumerable:!0,configurable:!0,set:DQ.bind(X,Z)})};var XQ=(Q,X)=>()=>(Q&&(X=Q(Q=0)),X);var VQ={};QQ(VQ,{removeRepoAssets:()=>h,installRefreshSkill:()=>RQ,installPlanSkill:()=>AQ,installInitSkill:()=>wQ,ensureWorkflowDoc:()=>_Q,ensureMcp:()=>kQ,auditRepo:()=>gQ,REFRESH_SKILL:()=>JQ,PLAN_SKILL:()=>YQ,INIT_SKILL:()=>$Q});import{existsSync as b,mkdirSync as y,readFileSync as x,rmSync as L,writeFileSync as B}from"fs";import{join as q}from"path";function wQ(Q){let X=q(Q,".claude","skills","beacon-init");y(X,{recursive:!0});let Z=q(X,"SKILL.md");return B(Z,$Q),Z}function RQ(Q){let X=q(Q,".claude","skills","beacon-refresh");y(X,{recursive:!0});let Z=q(X,"SKILL.md");return B(Z,JQ),Z}function AQ(Q){let X=q(Q,".claude","skills","beacon-plan");y(X,{recursive:!0});let Z=q(X,"SKILL.md");return B(Z,YQ),Z}function _Q(Q){let X=q(Q,"AGENTS.md"),Z="";try{Z=x(X,"utf8")}catch{}let $=new RegExp(`${F}[\\s\\S]*?${S}`);Z=$.test(Z)?Z.replace($,ZQ):`${Z.trim()}
3
+ var xZ=Object.defineProperty;var NZ=(Q)=>Q;function GZ(Q,Z){this[Q]=NZ.bind(null,Z)}var zQ=(Q,Z)=>{for(var $ in Z)xZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:GZ.bind(Z,$)})};var C=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var WQ={};zQ(WQ,{removeRepoAssets:()=>PQ,installRefreshSkill:()=>KZ,installPlanSkill:()=>CZ,installInitSkill:()=>uZ,installCodexRepoSkills:()=>fZ,ensureWorkflowDoc:()=>TZ,ensureMcp:()=>wZ,auditRepo:()=>FZ,REFRESH_SKILL:()=>XQ,PLAN_SKILL:()=>_Q,INIT_SKILL:()=>qQ});import{existsSync as M,mkdirSync as L,readFileSync as v,rmSync as y,writeFileSync as W}from"fs";import{join as q}from"path";function uZ(Q){let Z=q(Q,".claude","skills","beacon-init");L(Z,{recursive:!0});let $=q(Z,"SKILL.md");return W($,qQ),$}function KZ(Q){let Z=q(Q,".claude","skills","beacon-refresh");L(Z,{recursive:!0});let $=q(Z,"SKILL.md");return W($,XQ),$}function CZ(Q){let Z=q(Q,".claude","skills","beacon-plan");L(Z,{recursive:!0});let $=q(Z,"SKILL.md");return W($,_Q),$}function fZ(Q){let Z=[];for(let $ of MZ){let J=q(Q,".agents","skills",$.name);L(J,{recursive:!0});let Y=q(J,"SKILL.md");W(Y,$.body()),Z.push(Y)}return Z}function TZ(Q){let Z=q(Q,"AGENTS.md"),$="";try{$=v(Z,"utf8")}catch{}let J=new RegExp(`${_}[\\s\\S]*?${UQ}`);$=J.test($)?$.replace(J,LQ):`${$.trim()}
4
4
 
5
- ${ZQ}
6
- `.trimStart(),B(X,Z.endsWith(`
7
- `)?Z:`${Z}
8
- `);let J=q(Q,"CLAUDE.md"),Y="";try{Y=x(J,"utf8")}catch{}if(!/@AGENTS\.md/.test(Y))B(J,`${Y?`${Y.trim()}
5
+ ${LQ}
6
+ `.trimStart(),W(Z,$.endsWith(`
7
+ `)?$:`${$}
8
+ `);let Y=q(Q,"CLAUDE.md"),V="";try{V=v(Y,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))W(Y,`${V?`${V.trim()}
9
9
 
10
10
  `:""}@AGENTS.md
11
- `)}function kQ(Q){let X=q(Q,".mcp.json"),Z={};try{Z=JSON.parse(x(X,"utf8"))}catch{}if(Z.mcpServers=Z.mcpServers??{},Z.mcpServers.beacon)return{path:X,added:!1};return Z.mcpServers.beacon={command:"beacon",args:["mcp"]},B(X,JSON.stringify(Z,null,2)+`
12
- `),{path:X,added:!0}}function gQ(Q){let X=q(Q,".mcp.json"),Z=!1;try{Z=!!JSON.parse(x(X,"utf8")).mcpServers?.beacon}catch{}let $=!1;try{$=x(q(Q,"AGENTS.md"),"utf8").includes(F)}catch{}let J=!1;try{J=/@AGENTS\.md/.test(x(q(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:Z,agentsMdBlock:$,claudeMdImport:J,skills:{"beacon-init":b(q(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":b(q(Q,".claude","skills","beacon-refresh","SKILL.md"))}}}function h(Q){let X=[];for(let V of["beacon-init","beacon-refresh","beacon-db-design"]){let N=q(Q,".claude","skills",V);if(b(N))L(N,{recursive:!0,force:!0}),X.push(V)}let Z=!1,$=q(Q,".mcp.json");try{let V=JSON.parse(x($,"utf8"));if(V.mcpServers?.beacon){if(delete V.mcpServers.beacon,Z=!0,V.mcpServers&&Object.keys(V.mcpServers).length===0)delete V.mcpServers;if(Object.keys(V).length===0)L($,{force:!0});else B($,JSON.stringify(V,null,2)+`
13
- `)}}catch{}let J=!1,Y=q(Q,"AGENTS.md");try{let V=x(Y,"utf8"),N=new RegExp(`\\n?${F}[\\s\\S]*?${S}\\n?`);if(N.test(V)){let g=V.replace(N,`
11
+ `)}function wZ(Q){let Z=q(Q,".mcp.json"),$={};try{$=JSON.parse(v(Z,"utf8"))}catch{}if($.mcpServers=$.mcpServers??{},$.mcpServers.beacon)return{path:Z,added:!1};return $.mcpServers.beacon={command:"beacon",args:["mcp"]},W(Z,JSON.stringify($,null,2)+`
12
+ `),{path:Z,added:!0}}function FZ(Q){let Z=q(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(v(Z,"utf8")).mcpServers?.beacon}catch{}let J=!1;try{J=v(q(Q,"AGENTS.md"),"utf8").includes(_)}catch{}let Y=!1;try{Y=/@AGENTS\.md/.test(v(q(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:J,claudeMdImport:Y,skills:{"beacon-init":M(q(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":M(q(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":M(q(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":M(q(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function PQ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let P=q(Q,".claude","skills",z);if(M(P))y(P,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let P=q(Q,".agents","skills",z);if(M(P))y(P,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,J=q(Q,".mcp.json");try{let z=JSON.parse(v(J,"utf8"));if(z.mcpServers?.beacon){if(delete z.mcpServers.beacon,$=!0,z.mcpServers&&Object.keys(z.mcpServers).length===0)delete z.mcpServers;if(Object.keys(z).length===0)y(J,{force:!0});else W(J,JSON.stringify(z,null,2)+`
13
+ `)}}catch{}let Y=!1,V=q(Q,"AGENTS.md");try{let z=v(V,"utf8"),P=new RegExp(`\\n?${_}[\\s\\S]*?${UQ}\\n?`);if(P.test(z)){let VQ=z.replace(P,`
14
14
  `).replace(/\n{3,}/g,`
15
15
 
16
- `).trimStart();B(Y,g.endsWith(`
17
- `)?g:`${g}
18
- `),J=!0}}catch{}let H=!1,z=q(Q,"CLAUDE.md");try{let V=x(z,"utf8"),N=V.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(N!==V){if(!N.trim())L(z,{force:!0});else B(z,N);H=!0}}catch{}return{skillsRemoved:X,mcpUnregistered:Z,agentsBlockRemoved:J,claudeImportRemoved:H}}var $Q=`---
16
+ `).trimStart();W(V,VQ.endsWith(`
17
+ `)?VQ:`${VQ}
18
+ `),Y=!0}}catch{}let X=!1,U=q(Q,"CLAUDE.md");try{let z=v(U,"utf8"),P=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(P!==z){if(!P.trim())y(U,{force:!0});else W(U,P);X=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:Y,claudeImportRemoved:X}}var qQ=`---
19
19
  name: beacon-init
20
20
  description: Read this repository and map its architecture, schema, and roadmap into Beacon (the local visual planning panel). Use when the user runs /beacon-init, asks to "set up Beacon for this repo", or asks to initialize/bootstrap Beacon's map of this codebase.
21
21
  ---
@@ -28,7 +28,7 @@ The user already has Beacon running. You're going to map this repository's archi
28
28
 
29
29
  A single \`beacon_init_persist\` MCP tool call with:
30
30
 
31
- - **components**: 8\u201325 main building blocks of this codebase. NOT every file. Group them by \`domain\` (short UPPERCASE: AUTH, API, DATA, UI, JOBS, INFRA, BILLING, SEARCH, \u2026). For each: a one-line technical \`role\`, a one-sentence plain-language \`plain\`, the few \`files\` that implement it (repo-relative), and \`depends\` listing other component titles it relies on. Use the dependency graph you can see in the source \u2014 files that import each other heavily usually belong together.
31
+ - **components**: 8\u201325 main building blocks of this codebase. NOT every file. Group them by \`domain\` (short UPPERCASE: AUTH, API, DATA, UI, JOBS, INFRA, BILLING, SEARCH, \u2026). For each: a one-line technical \`role\`, a one-sentence plain-language \`plain\`, the few \`files\` that implement it (repo-relative), and \`depends\` listing other component titles it relies on. Use the dependency graph you can see in the source \u2014 files that import each other heavily usually belong together. If you spot a bug or something worth investigating while reading a component's code, add \`bugs: [{ note }]\` to that component \u2014 it renders as a bug flag on the node (attributed to the agent). Only flag what you actually saw in the code; don't speculate.
32
32
  - **roadmap**: 3\u20136 BROAD strategic directions. Big-picture themes only \u2014 "Harden auth & security", "Add observability", "Scale the data layer", "Pay down test-coverage debt". NOT detailed tasks. NOT file-level. Each gets a short title and one-line \`why\`.
33
33
  - **overview**: one paragraph describing what this project is and its stack. This lands in AGENTS.md as the project intro.
34
34
  - **conventions**: 3\u20138 concrete rules a contributor MUST follow \u2014 build/test commands, where code goes, patterns, things easy to get wrong. Infer from actual files, not assumptions.
@@ -52,7 +52,7 @@ A single \`beacon_init_persist\` MCP tool call with:
52
52
  If \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-init.
53
53
 
54
54
  After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
55
- `,JQ=`---
55
+ `,XQ=`---
56
56
  name: beacon-refresh
57
57
  description: Re-survey the repo and update Beacon's architecture / schema / endpoints map after /beacon-init was already run \u2014 picks up new components, removed ones, schema changes, and new routes. Use when the user runs /beacon-refresh or asks to "refresh", "update", "re-sync", or "bring Beacon up to date" with the current code.
58
58
  ---
@@ -87,7 +87,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
87
87
  - **~ changed**: COMPONENT_X (role expanded to cover Y)
88
88
  - **schema**: + 2 new tables (TableA, TableB); + 3 new endpoints; \u2212 1 deprecated endpoint
89
89
  No need to wait for confirmation \u2014 just show the diff so the user sees what's about to land.
90
- 5. **Call \`beacon_init_persist\`** ONCE with the refreshed full analysis (same shape as init: \`components\`, \`roadmap\`, \`overview\`, \`conventions\`, \`snapshot\`). It replaces all init-source nodes and regenerates \`AGENTS.md\`.
90
+ 5. **Call \`beacon_init_persist\`** ONCE with the refreshed full analysis (same shape as init: \`components\`, \`roadmap\`, \`overview\`, \`conventions\`, \`snapshot\`). It replaces all init-source nodes and regenerates \`AGENTS.md\`. Bug flags already on a component survive the refresh (they're carried over by title); add \`bugs: [{ note }]\` for anything NEW you found worth investigating \u2014 identical open flags are not duplicated.
91
91
 
92
92
  ## What you should NOT do
93
93
 
@@ -99,7 +99,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
99
99
  If \`beacon_entities\` or \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-refresh.
100
100
 
101
101
  After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
102
- `,YQ=`---
102
+ `,_Q=`---
103
103
  name: beacon-plan
104
104
  description: Present your current plan or approach to the user on Beacon's /plan canvas for review \u2014 instead of asking for approval in prose. Use when the user says "present the plan", "show me the plan", "let me see it / the plan", or whenever you are about to end a turn asking whether to proceed with a plan, design, or approach.
105
105
  ---
@@ -138,9 +138,10 @@ If it returns feedback, revise and call it again.
138
138
  - **Anything else** (a code-change plan, a mixed plan, a "how should I approach X") \u2192 use
139
139
  \`beacon_present_plan\` with markdown so the full reasoning shows on /plan.
140
140
 
141
- If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to presenting via
142
- ExitPlanMode with the same \`\`\`beacon block, or tell the user to run \`beacon\` in this repo once.
143
- `,F="<!-- beacon:workflow:start -->",S="<!-- beacon:workflow:end -->",ZQ;var m=XQ(()=>{ZQ=`${F}
141
+ If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
142
+ with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
143
+ run \`beacon\` in this repo once.
144
+ `,MZ,_="<!-- beacon:workflow:start -->",UQ="<!-- beacon:workflow:end -->",LQ;var k=C(()=>{MZ=[{name:"beacon-init",body:()=>qQ},{name:"beacon-refresh",body:()=>XQ}];LQ=`${_}
144
145
  ## Beacon \u2014 feature workflow
145
146
 
146
147
  This project uses Beacon (a local planning/visualization panel; run \`beacon\` to open it). When you start work on a FEATURE \u2014 whether referenced via an \`@beacon:feature://\u2026\` mention, an \`@beacon:note://\u2026\` note the user wrote in the Notes panel (treat its checkbox \`- [ ]\` todos as subtasks and order features by their dependencies), or just described in chat \u2014 follow these steps in order:
@@ -171,6 +172,8 @@ When listing features, give each \`dependsOn: ["Other feature title", \u2026]\`
171
172
 
172
173
  ### 2b. Presenting a plan in plan mode (ExitPlanMode)
173
174
 
175
+ In Codex (which has no ExitPlanMode), always present plans via \`beacon_present_plan\` / \`beacon_propose_plan\` instead \u2014 this section applies to Claude Code's plan mode only.
176
+
174
177
  When you present a plan via ExitPlanMode (not \`beacon_propose_plan\`) and it proposes DB tables/relations/endpoints or roadmap features, embed ONE fenced \`\`\`beacon code block of JSON in the plan \u2014 the same shapes \`beacon_propose_plan\` accepts:
175
178
 
176
179
  \`\`\`beacon
@@ -181,16 +184,42 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
181
184
 
182
185
  **The board is built ONLY from the block \u2014 prose is NOT parsed.** If your plan describes ANY database models/tables/columns in the prose (e.g. "Model \`legal_precedent.py\` \u2014 natural key (court, \u2026)"), you MUST also put them in the block's \`tables\` array (with \`columns\`), or the /db tab will be empty for that plan. Same for endpoints (\`endpoints\` with \`uses:[{table,access}]\`) and features (\`features\`). A plan that lists five tables in prose but ships a block with only \`features\` renders an empty database board \u2014 exactly the "I described models but the DB tab is empty" failure. Mirror every DB entity you mention into the block.
183
186
 
184
- ### 3. At the end, register the work
187
+ ### 3. At the end, register the work \u2014 in ONE call
188
+
189
+ Call \`beacon_describe_feature\` **ONCE** with a \`features\` array \u2014 one entry per feature the plan created \u2014 each with the files you touched and a short markdown description. This flips each one to **Done** \u2014 including its sub-tasks (the cascade completes every PENDING/IN_PROGRESS child; a sub-task you did NOT finish must be set BLOCKED or CANCELLED before registering, so it survives visibly) \u2014 and keeps \`beacon_context_for_feature\` accurate for the next session.
185
190
 
186
- Call \`beacon_describe_feature\` for **EVERY** feature the plan created \u2014 once per feature, **by its exact title** (the same titles you listed in \`features\`/the \`\`\`beacon block) \u2014 with the files you touched and a short markdown description. This flips each one to **Done** and keeps \`beacon_context_for_feature\` accurate for the next session.
191
+ Key each entry by its node \`id\`: the ids are handed back to you when the plan is approved (in the approval message / additionalContext), so you don't fuzzy-match titles or pay a disambiguation round-trip. If you don't have an id, \`title\` still works.
187
192
 
188
- Do this per feature. If a plan added five features, that's five \`beacon_describe_feature\` calls \u2014 registering only an umbrella ("Harden auth") leaves the individual features stuck on **Pending** on the map.
193
+ Register them all in that single batched call. If a plan added five features, that's ONE \`beacon_describe_feature\` call with five entries \u2014 NOT five calls, and NOT just an umbrella ("Harden auth"), which leaves the individual features stuck on **Pending**.
189
194
 
190
195
  If the feature added or materially changed a REAL architectural component (a subsystem \u2014 NOT a file), also pass \`architecture: [{ title, domain, role, \u2026 }]\` so the Architecture map stays accurate. It upserts curated components by title; never list files as components.
191
196
 
192
197
  Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
193
- ${S}`});var PQ={};QQ(PQ,{provisionDb:()=>YX});import{createClient as aQ}from"@libsql/client";import{drizzle as sQ}from"drizzle-orm/libsql";import{migrate as rQ}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as oQ}from"drizzle-orm/migrator";import{dirname as d,join as iQ}from"path";import{fileURLToPath as eQ}from"url";async function A(Q,X){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[X]})).rows.length>0}async function $X(Q,X){let Z=await Q.execute(`PRAGMA table_info("${X}")`);return new Set(Z.rows.map(($)=>String($.name)))}async function GQ(Q){if(!await A(Q,"__drizzle_migrations"))return 0;let X=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(X.rows[0]?.n??0)}async function JX(Q){for(let[X,Z]of Object.entries(ZX)){if(!await A(Q,X))continue;let $=await $X(Q,X);for(let J of Z){if(!$.has(J))continue;await Q.execute(`UPDATE "${X}" SET "${J}" = CAST((julianday("${J}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${J}") = 'text'`)}}}async function YX(Q,X=XX){let Z=aQ({url:Q});try{await Z.execute("PRAGMA journal_mode = WAL;"),await Z.execute("PRAGMA foreign_keys = ON;");let $=await A(Z,"__drizzle_migrations"),J=await A(Z,"Node"),Y=!1;if(J&&!$){let z=oQ({migrationsFolder:X})[0];if(z)await Z.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await Z.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[z.hash,z.folderMillis]}),Y=!0}let H=await GQ(Z);if(await rQ(sQ(Z),{migrationsFolder:X}),await GQ(Z)>H)Y=!0;return await JX(Z),{migrated:Y}}finally{Z.close()}}var QX,XX,ZX;var UQ=XQ(async()=>{QX=d(d(d(eQ(import.meta.url)))),XX=process.env.BEACON_MIGRATIONS_DIR||iQ(QX,"drizzle"),ZX={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});import{existsSync as l,mkdirSync as c,readFileSync as w,rmSync as LQ,writeFileSync as R}from"fs";import{homedir as bQ}from"os";import{join as G}from"path";function yQ(){return process.env.HOME||process.env.USERPROFILE||bQ()}var T=()=>G(yQ(),".claude"),n=()=>G(T(),"skills"),zQ=()=>G(T(),"settings.json"),u=()=>G(T(),"CLAUDE.md"),D="<!-- beacon:global:start -->",p="<!-- beacon:global:end -->",K=["beacon-init","beacon-refresh","beacon-plan"],O=[{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"PermissionRequest",matcher:"ExitPlanMode",command:"beacon plan",description:"Pipe the agent's plan markdown into Beacon's /plan canvas for review."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose (instead of presenting it), nudge it to present the plan on Beacon's /plan canvas. Bounded by stop_hook_active \u2014 at most one nudge."}],SQ=`## Beacon (visual planning panel)
198
+ ${UQ}`});import{existsSync as kQ,mkdirSync as HQ,readFileSync as S,rmSync as gZ,writeFileSync as p}from"fs";import{dirname as hQ,join as h}from"path";function BQ(Q){try{return JSON.parse(S(Q,"utf8"))}catch{return{}}}function SQ(Q,Z){HQ(hQ(Q),{recursive:!0}),p(Q,JSON.stringify(Z,null,2)+`
199
+ `)}function m(Q,Z){let $=BQ(Q);$.hooks=$.hooks??{},$.hooks[Z.event]=$.hooks[Z.event]??[];let J=$.hooks[Z.event];if(J.some((V)=>V.matcher===Z.matcher&&V.hooks?.some((X)=>X.command===Z.command)))return!1;return J.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),SQ(Q,$),!0}function c(Q,Z){return(BQ(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>V.command===Z.command))}function l(Q,Z){let $=BQ(Q),J=$.hooks?.[Z.event];if(!J)return!1;let Y=!1,V=J.map((X)=>{let U=X.hooks?.length??0,z=(X.hooks??[]).filter((P)=>P.command!==Z.command);if(z.length!==U)Y=!0;return{...X,hooks:z}}).filter((X)=>(X.hooks??[]).length>0);if(!Y)return!1;if(V.length)$.hooks[Z.event]=V;else delete $.hooks[Z.event];if($.hooks&&Object.keys($.hooks).length===0)delete $.hooks;return SQ(Q,$),!0}function t(Q,Z,$,J){let Y=`${Z}
200
+ ${J.trim()}
201
+ ${$}`,V="";try{V=S(Q,"utf8")}catch{}let X=new RegExp(`${Z}[\\s\\S]*?${$}`);V=X.test(V)?V.replace(X,Y):V.trim()?`${V.trim()}
202
+
203
+ ${Y}
204
+ `:`${Y}
205
+ `,HQ(hQ(Q),{recursive:!0}),p(Q,V.endsWith(`
206
+ `)?V:`${V}
207
+ `)}function g(Q,Z){try{return S(Q,"utf8").includes(Z)}catch{return!1}}function n(Q,Z,$){let J="";try{J=S(Q,"utf8")}catch{return!1}let Y=new RegExp(`${Z}[\\s\\S]*?${$}\\n?`);if(!Y.test(J))return!1;let V=J.replace(Y,"").replace(/\n{3,}/g,`
208
+
209
+ `).trimStart();return p(Q,V),!0}function d(Q,Z,$){let J=h(Q,Z);HQ(J,{recursive:!0});let Y=h(J,"SKILL.md");return p(Y,$),Y}function R(Q,Z){return kQ(h(Q,Z,"SKILL.md"))}function a(Q,Z){let $=h(Q,Z);if(!kQ($))return!1;return gZ($,{recursive:!0,force:!0}),!0}var jQ=()=>{};import{mkdirSync as RZ,renameSync as EZ,rmSync as IZ,writeFileSync as bZ}from"fs";import{dirname as DZ}from"path";function vQ(Q,Z){RZ(DZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{bZ($,Z),EZ($,Q)}catch(J){throw IZ($,{force:!0}),J}}var pQ=()=>{};var sQ={};zQ(sQ,{setupCodexAssets:()=>LZ,removeCodexMcp:()=>aQ,removeCodexArtifacts:()=>CQ,hasCodexMcp:()=>uQ,ensureCodexMcp:()=>dQ,codexMcpProblem:()=>yZ,codexDetected:()=>lQ,auditCodex:()=>KQ,CODEX_HOOKS:()=>T});import{readFileSync as i}from"fs";import{homedir as OZ}from"os";import{join as b}from"path";function mQ(){return process.env.HOME||process.env.USERPROFILE||OZ()}function lQ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(xQ===void 0)xQ=Bun.which("codex")!==null;return xQ}function I(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function uQ(){try{return Boolean(I(i(f(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function yZ(){let Q="";try{Q=i(f(),"utf8")}catch{return null}let Z=I(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${E}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${E}`;return null}function dQ(){let Q="",Z=!1;try{Q=i(f(),"utf8"),Z=!0}catch{}if(Z){let V=I(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${E}`};if(V.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(Q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${E}`}}let $=!Q?"":Q.endsWith(`
210
+ `)?`
211
+ `:`
212
+
213
+ `,J=Q+$+AZ;if(I(J)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${E}`};return vQ(f(),J),{added:!0}}function aQ(){let Q="";try{Q=i(f(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
214
+ `),$=Z.indexOf(tQ);if($===-1)return{removed:!1,skipped:uQ()};let J=Z.indexOf(nQ,$);if(J===-1)return{removed:!1,skipped:!0};Z.splice($,J-$+1);let Y=Z.join(`
215
+ `).replace(/\n{3,}/g,`
216
+
217
+ `).replace(/^\n+/,"");if(I(Y)===null)return{removed:!1,skipped:!0};return vQ(f(),Y),{removed:!0}}async function LZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (k(),WQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},Y=[];for(let z of H){if(!R(r(),z))Y.push(z);d(r(),z,J[z])}let V=0;for(let z of T)if(m(GQ(),{event:z.event,matcher:z.matcher,command:z.command}))V++;let X=g(s(),o);t(s(),o,cQ,fQ);let U=dQ();return{skillsAdded:Y,hooksAdded:V,agentsMdBlockTouched:!X,mcp:U}}function KQ(){let Q={};for(let $ of H)Q[$]=R(r(),$);let Z={};for(let $ of T)Z[$.event]=c(GQ(),{event:$.event,command:$.command});return{detected:lQ(),skills:Q,hooks:Z,agentsMdBlock:g(s(),o),mcp:uQ()}}function CQ(){let Q=[];for(let Y of H)if(a(r(),Y))Q.push(Y);let Z=0;for(let Y of T)if(l(GQ(),{event:Y.event,command:Y.command}))Z++;let $=n(s(),o,cQ),J=aQ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:J.removed,mcpSkipped:J.skipped}}var NQ=()=>b(mQ(),".codex"),GQ=()=>b(NQ(),"hooks.json"),f=()=>b(NQ(),"config.toml"),s=()=>b(NQ(),"AGENTS.md"),r=()=>b(mQ(),".agents","skills"),o="<!-- beacon:global:start -->",cQ="<!-- beacon:global:end -->",T,xQ,tQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",nQ="# beacon:end",AZ,E="add it manually: codex mcp add beacon -- beacon mcp";var MQ=C(()=>{jQ();pQ();TQ();T=[{event:"PostToolUse",matcher:"apply_patch",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose, nudge it to present the plan on Beacon's /plan canvas."}];AZ=`${tQ}
218
+ [mcp_servers.beacon]
219
+ command = "beacon"
220
+ args = ["mcp"]
221
+ ${nQ}
222
+ `});import{existsSync as _Z}from"fs";import{homedir as kZ}from"os";import{join as e}from"path";function hZ(){return process.env.HOME||process.env.USERPROFILE||kZ()}function SZ(Q,Z){return d(wQ(),Q,Z)}function oQ(Q){return R(wQ(),Q)}function pZ(Q){return a(wQ(),Q)}function mZ(Q){return m(FQ(),Q)}function cZ(Q){return c(FQ(),Q)}function lZ(Q){return l(FQ(),Q)}function tZ(Q){t(gQ(),RQ,rQ,Q)}function iQ(){return g(gQ(),RQ)}function nZ(){return n(gQ(),RQ,rQ)}function eQ(){let Q={};for(let $ of H)Q[$]=oQ($);let Z={};for(let $ of D)Z[$.event]=cZ({event:$.event,command:$.command});return{homeExists:_Z(QQ()),skills:Q,hooks:Z,claudeMdBlock:iQ()}}async function dZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (k(),WQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},Y=[];for(let U of H){if(!oQ(U))Y.push(U);SZ(U,J[U])}let V=0;for(let U of D)if(mZ({event:U.event,matcher:U.matcher,command:U.command}))V++;let X=iQ();return tZ(fQ),{skillsAdded:Y,hooksAdded:V,claudeMdBlockTouched:!X}}async function S0(){let Q;try{Q={ok:!0,...await dZ()}}catch(Z){Q={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}try{let Z=await Promise.resolve().then(() => (MQ(),sQ));if(Z.codexDetected())Q.codex={ok:!0,...await Z.setupCodexAssets()}}catch(Z){Q.codex={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,agentsMdBlockTouched:!1,mcp:{added:!1}}}return Q}function QZ(){let Q=[];for(let J of H)if(pZ(J))Q.push(J);let Z=0;for(let J of D)if(lZ(J))Z++;let $=nZ();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}var QQ=()=>e(hZ(),".claude"),wQ=()=>e(QQ(),"skills"),FQ=()=>e(QQ(),"settings.json"),gQ=()=>e(QQ(),"CLAUDE.md"),RQ="<!-- beacon:global:start -->",rQ="<!-- beacon:global:end -->",H,D,fQ=`## Beacon (visual planning panel)
194
223
 
195
224
  This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
196
225
  agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
@@ -211,18 +240,7 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
211
240
  Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
212
241
  on the /map and /db boards (added features, attached subtasks, edited columns, new
213
242
  endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
214
- verbatim. Do NOT implement until the tool returns approval.`;function hQ(Q,X){let Z=G(n(),Q);c(Z,{recursive:!0});let $=G(Z,"SKILL.md");return R($,X),$}function qQ(Q){return l(G(n(),Q,"SKILL.md"))}function mQ(Q){let X=G(n(),Q);if(!l(X))return!1;return LQ(X,{recursive:!0,force:!0}),!0}function t(){try{return JSON.parse(w(zQ(),"utf8"))}catch{return{}}}function HQ(Q){c(T(),{recursive:!0}),R(zQ(),JSON.stringify(Q,null,2)+`
215
- `)}function pQ(Q){let X=t();X.hooks=X.hooks??{},X.hooks[Q.event]=X.hooks[Q.event]??[];let Z=X.hooks[Q.event];if(Z.some((J)=>J.matcher===Q.matcher&&J.hooks?.some((Y)=>Y.command===Q.command)))return!1;return Z.push({matcher:Q.matcher,hooks:[{type:"command",command:Q.command}]}),HQ(X),!0}function lQ(Q){return(t().hooks?.[Q.event]??[]).some(($)=>$.hooks?.some((J)=>J.command===Q.command))}function cQ(Q){let X=t(),Z=X.hooks?.[Q.event];if(!Z)return!1;let $=!1,J=Z.map((Y)=>{let H=Y.hooks?.length??0,z=(Y.hooks??[]).filter((V)=>V.command!==Q.command);if(z.length!==H)$=!0;return{...Y,hooks:z}}).filter((Y)=>(Y.hooks??[]).length>0);if(!$)return!1;if(J.length)X.hooks[Q.event]=J;else delete X.hooks[Q.event];if(X.hooks&&Object.keys(X.hooks).length===0)delete X.hooks;return HQ(X),!0}function nQ(Q){let X=`${D}
216
- ${Q.trim()}
217
- ${p}`,Z="";try{Z=w(u(),"utf8")}catch{}let $=new RegExp(`${D}[\\s\\S]*?${p}`);Z=$.test(Z)?Z.replace($,X):Z.trim()?`${Z.trim()}
218
-
219
- ${X}
220
- `:`${X}
221
- `,c(T(),{recursive:!0}),R(u(),Z.endsWith(`
222
- `)?Z:`${Z}
223
- `)}function NQ(){try{return w(u(),"utf8").includes(D)}catch{return!1}}function tQ(){let Q="";try{Q=w(u(),"utf8")}catch{return!1}let X=new RegExp(`${D}[\\s\\S]*?${p}\\n?`);if(!X.test(Q))return!1;let Z=Q.replace(X,"").replace(/\n{3,}/g,`
224
-
225
- `).trimStart();return R(u(),Z),!0}function xQ(){let Q={};for(let Z of K)Q[Z]=qQ(Z);let X={};for(let Z of O)X[Z.event]=lQ({event:Z.event,command:Z.command});return{homeExists:l(T()),skills:Q,hooks:X,claudeMdBlock:NQ()}}async function dQ(){let{INIT_SKILL:Q,REFRESH_SKILL:X,PLAN_SKILL:Z}=await Promise.resolve().then(() => (m(),VQ)),$={"beacon-init":Q,"beacon-refresh":X,"beacon-plan":Z},J=[];for(let z of K){if(!qQ(z))J.push(z);hQ(z,$[z])}let Y=0;for(let z of O)if(pQ({event:z.event,matcher:z.matcher,command:z.command}))Y++;let H=NQ();return nQ(SQ),{skillsAdded:J,hooksAdded:Y,claudeMdBlockTouched:!H}}async function FX(){try{return{ok:!0,...await dQ()}}catch(Q){return{ok:!1,error:Q instanceof Error?Q.message:String(Q),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}}function BQ(){let Q=[];for(let $ of K)if(mQ($))Q.push($);let X=0;for(let $ of O)if(cQ($))X++;let Z=tQ();return{skillsRemoved:Q,hooksRemoved:X,claudeMdBlockRemoved:Z}}import{AsyncLocalStorage as VX}from"async_hooks";import{spawnSync as zX}from"child_process";import{createHash as qX}from"crypto";import{existsSync as TQ,mkdirSync as _,readFileSync as MQ,writeFileSync as WQ}from"fs";import{homedir as HX}from"os";import{basename as NX,join as M}from"path";function U(){return process.env.BEACON_HOME||M(HX(),".beacon")}function a(){return M(U(),"workspaces.json")}function jQ(Q){return qX("sha256").update(Q).digest("hex").slice(0,12)}function pX(Q=process.cwd()){let X=zX("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(X.status===0){let Z=X.stdout?.toString().trim();if(Z)return Z}return Q}function s(Q){return M(U(),Q)}function xX(Q){return`file:${M(s(Q),"db.sqlite")}`}function E(){try{let Q=JSON.parse(MQ(a(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function r(Q){_(U(),{recursive:!0}),WQ(a(),JSON.stringify(Q,null,2))}function o(){return E().sort((Q,X)=>X.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function P(Q){return E().find((X)=>X.id===Q)??null}function BX(Q,X,Z=new Date().toISOString()){let $=jQ(Q),J=E(),Y=J.find((V)=>V.id===$),H={id:$,path:Q,name:X||Y?.name||NX(Q),lastOpenedAt:Z},z=[H,...J.filter((V)=>V.id!==$)];return _(s($),{recursive:!0}),r(z),H}function lX(Q,X=new Date().toISOString()){let Z=E(),$=Z.find((J)=>J.id===Q);if(!$)return;$.lastOpenedAt=X,r(Z)}function cX(Q){if(r(E().filter((X)=>X.id!==Q)),i()===Q)GX(o()[0]?.id??null)}function CQ(){return M(U(),"active")}function i(){try{return MQ(CQ(),"utf8").trim()||null}catch{return null}}function GX(Q){_(U(),{recursive:!0}),WQ(CQ(),Q??"")}function nX(){let Q=i();return Q?P(Q):null}function tX(){let Q=UX()??i();return Q?P(Q):null}function dX(Q){return P(Q)?.path??null}function aX(){return TQ(a())}var fQ="beacon_ws";function uQ(Q,X){let Z=Q.headers.get("cookie");if(!Z)return null;for(let $ of Z.split(";")){let J=$.indexOf("=");if(J===-1)continue;if($.slice(0,J).trim()===X)return decodeURIComponent($.slice(J+1).trim())}return null}function sX(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&P(X))return X;let Z=uQ(Q,fQ);if(Z&&P(Z))return Z;return null}var PX="x-beacon-workspace-path";async function rX(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&P(X))return X;let Z=Q.headers.get(PX);if(Z&&(!X||jQ(Z)===X)){let J=BX(Z);return await vX(J.id),J.id}let $=uQ(Q,fQ);if($&&P($))return $;return null}var KQ=new VX;function oX(Q,X){return Q?KQ.run(Q,X):X()}function UX(){return KQ.getStore()??null}var vQ=new Set;async function vX(Q){let X=s(Q),Z=M(X,"db.sqlite"),$=TQ(Z);if($&&vQ.has(Z))return{ok:!0,created:!1,migrated:!1};try{_(X,{recursive:!0});let{provisionDb:J}=await UQ().then(() => PQ),Y=await J(xX(Q));return vQ.add(Z),{ok:!0,created:!$,migrated:$&&Y.migrated}}catch(J){return{ok:!1,created:!1,migrated:!1,error:J instanceof Error?J.message:String(J)}}}m();import{existsSync as k,readFileSync as TX,rmSync as MX}from"fs";import{join as WX}from"path";var OQ=process.argv.slice(3),EQ=OQ.includes("--yes")||OQ.includes("-y"),C=(Q)=>`\x1B[32m\u2713\x1B[0m ${Q}`,j=(Q)=>`\x1B[2m${Q}\x1B[0m`,f=(Q)=>`
226
- \x1B[1m${Q}\x1B[0m`,jX=(Q)=>`\x1B[33m!\x1B[0m ${Q}`,v=U(),I=o(),e=xQ();console.log(f(EQ?"Beacon \xB7 uninstall":"Beacon \xB7 uninstall (dry run)"));console.log(f("Global"));console.log(` ${k(v)?`wipe ${v} (${I.length} workspaces)`:`${j(`${v} \u2014 already gone`)}`}`);for(let Q of K)console.log(` ${e.skills[Q]?`remove ~/.claude/skills/${Q}/`:j(`skill ${Q} \u2014 already gone`)}`);for(let Q of O)console.log(` ${e.hooks[Q.event]?`remove hook ${Q.event} \u2192 ${Q.command}`:j(`hook ${Q.event} \u2192 ${Q.command} \u2014 already gone`)}`);console.log(` ${e.claudeMdBlock?"strip Beacon block from ~/.claude/CLAUDE.md":j("global CLAUDE.md block \u2014 already gone")}`);if(I.length){console.log(f(`Per-repo (${I.length})`));for(let Q of I){if(!k(Q.path)){console.log(` ${j(`${Q.path} \u2014 repo no longer on disk, skipping`)}`);continue}console.log(` ${Q.path}`),console.log(` ${j("strip beacon entry from .mcp.json, workflow block from AGENTS.md, skills, CLAUDE.md @-import")}`)}}if(!EQ)console.log(f("Nothing was changed.")),console.log(" Run \x1B[1mbeacon uninstall --yes\x1B[0m to apply."),console.log(` The \x1B[1mbeacon\x1B[0m binary itself (the cloned source + your PATH symlink) is NOT removed by this \u2014 your install script handles that.
227
- `),process.exit(0);console.log(f("Applying\u2026"));var W=BQ();if(W.skillsRemoved.length)console.log(` ${C(`removed skills: ${W.skillsRemoved.join(", ")}`)}`);if(W.hooksRemoved)console.log(` ${C(`removed ${W.hooksRemoved} hook${W.hooksRemoved===1?"":"s"} from ~/.claude/settings.json`)}`);if(W.claudeMdBlockRemoved)console.log(` ${C("stripped Beacon block from ~/.claude/CLAUDE.md")}`);for(let Q of I){if(!k(Q.path))continue;let X=h(Q.path),Z=[];if(X.skillsRemoved.length)Z.push(`skills(${X.skillsRemoved.length})`);if(X.mcpUnregistered)Z.push(".mcp.json");if(X.agentsBlockRemoved)Z.push("AGENTS.md");if(X.claudeImportRemoved)Z.push("CLAUDE.md");if(Z.length)console.log(` ${C(`${Q.path} \u2192 ${Z.join(", ")}`)}`)}var CX=WX(v,"server.json");try{let{pid:Q}=JSON.parse(TX(CX,"utf8"));if(Q)try{process.kill(Q),console.log(` ${C(`stopped daemon (pid ${Q})`)}`)}catch{}}catch{}if(k(v))MX(v,{recursive:!0,force:!0}),console.log(` ${C(`removed ${v}`)}`);console.log(f("Done."));console.log(` ${jX("The `beacon` binary on your PATH is still there \u2014 run the matching uninstall step from your installer to remove it.")}
243
+ verbatim. Do NOT implement until the tool returns approval.`;var TQ=C(()=>{jQ();H=["beacon-init","beacon-refresh","beacon-plan"],D=[{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"PermissionRequest",matcher:"ExitPlanMode",command:"beacon plan",description:"Pipe the agent's plan markdown into Beacon's /plan canvas for review."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose (instead of presenting it), nudge it to present the plan on Beacon's /plan canvas. Bounded by stop_hook_active \u2014 at most one nudge."}]});var $Z={};zQ($Z,{provisionDb:()=>V0});import{createClient as aZ}from"@libsql/client";import{drizzle as sZ}from"drizzle-orm/libsql";import{migrate as rZ}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as oZ}from"drizzle-orm/migrator";import{dirname as EQ,join as iZ}from"path";import{fileURLToPath as eZ}from"url";async function ZQ(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function J0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((J)=>String(J.name)))}async function ZZ(Q){if(!await ZQ(Q,"__drizzle_migrations"))return 0;let Z=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(Z.rows[0]?.n??0)}async function Y0(Q){for(let[Z,$]of Object.entries($0)){if(!await ZQ(Q,Z))continue;let J=await J0(Q,Z);for(let Y of $){if(!J.has(Y))continue;await Q.execute(`UPDATE "${Z}" SET "${Y}" = CAST((julianday("${Y}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${Y}") = 'text'`)}}}async function V0(Q,Z=Z0){let $=aZ({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;");let J=await ZQ($,"__drizzle_migrations"),Y=await ZQ($,"Node"),V=!1;if(Y&&!J){let U=oZ({migrationsFolder:Z})[0];if(U)await $.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await $.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[U.hash,U.folderMillis]}),V=!0}let X=await ZZ($);if(await rZ(sZ($),{migrationsFolder:Z}),await ZZ($)>X)V=!0;return await Y0($),{migrated:V}}finally{$.close()}}var Q0,Z0,$0;var JZ=C(async()=>{Q0=EQ(EQ(EQ(eZ(import.meta.url)))),Z0=process.env.BEACON_MIGRATIONS_DIR||iZ(Q0,"drizzle"),$0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});import{AsyncLocalStorage as z0}from"async_hooks";import{spawnSync as q0}from"child_process";import{createHash as X0}from"crypto";import{existsSync as VZ,mkdirSync as $Q,readFileSync as zZ,writeFileSync as qZ}from"fs";import{homedir as U0}from"os";import{basename as P0,join as w}from"path";function G(){return process.env.BEACON_HOME||w(U0(),".beacon")}function IQ(){return w(G(),"workspaces.json")}function XZ(Q){return X0("sha256").update(Q).digest("hex").slice(0,12)}function Q1(Q=process.cwd()){let Z=q0("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(Z.status===0){let $=Z.stdout?.toString().trim();if($)return $}return Q}function bQ(Q){return w(G(),Q)}function W0(Q){return`file:${w(bQ(Q),"db.sqlite")}`}function O(){try{let Q=JSON.parse(zZ(IQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function DQ(Q){$Q(G(),{recursive:!0}),qZ(IQ(),JSON.stringify(Q,null,2))}function OQ(){return O().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function N(Q){return O().find((Z)=>Z.id===Q)??null}function H0(Q,Z,$=new Date().toISOString()){let J=XZ(Q),Y=O(),V=Y.find((z)=>z.id===J),X={id:J,path:Q,name:Z||V?.name||P0(Q),lastOpenedAt:$},U=[X,...Y.filter((z)=>z.id!==J)];return $Q(bQ(J),{recursive:!0}),DQ(U),X}function Z1(Q,Z=new Date().toISOString()){let $=O(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,DQ($)}function $1(Q){if(DQ(O().filter((Z)=>Z.id!==Q)),AQ()===Q)B0(OQ()[0]?.id??null)}function UZ(){return w(G(),"active")}function AQ(){try{return zZ(UZ(),"utf8").trim()||null}catch{return null}}function B0(Q){$Q(G(),{recursive:!0}),qZ(UZ(),Q??"")}function J1(){let Q=AQ();return Q?N(Q):null}function Y1(){let Q=v0()??AQ();return Q?N(Q):null}function V1(Q){return N(Q)?.path??null}function z1(){return VZ(IQ())}var PZ="beacon_ws";function WZ(Q,Z){let $=Q.headers.get("cookie");if(!$)return null;for(let J of $.split(";")){let Y=J.indexOf("=");if(Y===-1)continue;if(J.slice(0,Y).trim()===Z)return decodeURIComponent(J.slice(Y+1).trim())}return null}function q1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&N(Z))return Z;let $=WZ(Q,PZ);if($&&N($))return $;return null}var j0="x-beacon-workspace-path";async function X1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&N(Z))return Z;let $=Q.headers.get(j0);if($&&(!Z||XZ($)===Z)){let Y=H0($);return await x0(Y.id),Y.id}let J=WZ(Q,PZ);if(J&&N(J))return J;return null}var HZ=new z0;function U1(Q,Z){return Q?HZ.run(Q,Z):Z()}function v0(){return HZ.getStore()??null}var YZ=new Set;async function x0(Q){let Z=bQ(Q),$=w(Z,"db.sqlite"),J=VZ($);if(J&&YZ.has($))return{ok:!0,created:!1,migrated:!1};try{$Q(Z,{recursive:!0});let{provisionDb:Y}=await JZ().then(() => $Z),V=await Y(W0(Q));return YZ.add($),{ok:!0,created:!J,migrated:J&&V.migrated}}catch(Y){return{ok:!1,created:!1,migrated:!1,error:Y instanceof Error?Y.message:String(Y)}}}k();MQ();TQ();import{existsSync as JQ,readFileSync as N0,rmSync as G0}from"fs";import{join as u0}from"path";var BZ=process.argv.slice(3),jZ=BZ.includes("--yes")||BZ.includes("-y"),j=(Q)=>`\x1B[32m\u2713\x1B[0m ${Q}`,B=(Q)=>`\x1B[2m${Q}\x1B[0m`,K=(Q)=>`
244
+ \x1B[1m${Q}\x1B[0m`,vZ=(Q)=>`\x1B[33m!\x1B[0m ${Q}`,u=G(),A=OQ(),yQ=eQ();console.log(K(jZ?"Beacon \xB7 uninstall":"Beacon \xB7 uninstall (dry run)"));console.log(K("Global"));console.log(` ${JQ(u)?`wipe ${u} (${A.length} workspaces)`:`${B(`${u} \u2014 already gone`)}`}`);for(let Q of H)console.log(` ${yQ.skills[Q]?`remove ~/.claude/skills/${Q}/`:B(`skill ${Q} \u2014 already gone`)}`);for(let Q of D)console.log(` ${yQ.hooks[Q.event]?`remove hook ${Q.event} \u2192 ${Q.command}`:B(`hook ${Q.event} \u2192 ${Q.command} \u2014 already gone`)}`);console.log(` ${yQ.claudeMdBlock?"strip Beacon block from ~/.claude/CLAUDE.md":B("global CLAUDE.md block \u2014 already gone")}`);var YQ=KQ();console.log(K("Codex"));for(let Q of H)console.log(` ${YQ.skills[Q]?`remove ~/.agents/skills/${Q}/`:B(`skill ${Q} \u2014 already gone`)}`);for(let Q of T)console.log(` ${YQ.hooks[Q.event]?`remove hook ${Q.event} \u2192 ${Q.command} from ~/.codex/hooks.json`:B(`hook ${Q.event} \u2192 ${Q.command} \u2014 already gone`)}`);console.log(` ${YQ.agentsMdBlock?"strip Beacon block from ~/.codex/AGENTS.md":B("global ~/.codex/AGENTS.md block \u2014 already gone")}`);console.log(` ${YQ.mcp?"strip [mcp_servers.beacon] from ~/.codex/config.toml (if Beacon wrote it)":B("config.toml beacon entry \u2014 already gone")}`);if(A.length){console.log(K(`Per-repo (${A.length})`));for(let Q of A){if(!JQ(Q.path)){console.log(` ${B(`${Q.path} \u2014 repo no longer on disk, skipping`)}`);continue}console.log(` ${Q.path}`),console.log(` ${B("strip beacon entry from .mcp.json, workflow block from AGENTS.md, skills, CLAUDE.md @-import")}`)}}if(!jZ)console.log(K("Nothing was changed.")),console.log(" Run \x1B[1mbeacon uninstall --yes\x1B[0m to apply."),console.log(` The \x1B[1mbeacon\x1B[0m binary itself (the cloned source + your PATH symlink) is NOT removed by this \u2014 your install script handles that.
245
+ `),process.exit(0);console.log(K("Applying\u2026"));var F=QZ();if(F.skillsRemoved.length)console.log(` ${j(`removed skills: ${F.skillsRemoved.join(", ")}`)}`);if(F.hooksRemoved)console.log(` ${j(`removed ${F.hooksRemoved} hook${F.hooksRemoved===1?"":"s"} from ~/.claude/settings.json`)}`);if(F.claudeMdBlockRemoved)console.log(` ${j("stripped Beacon block from ~/.claude/CLAUDE.md")}`);var x=CQ();if(x.skillsRemoved.length)console.log(` ${j(`removed ~/.agents/skills: ${x.skillsRemoved.join(", ")}`)}`);if(x.hooksRemoved)console.log(` ${j(`removed ${x.hooksRemoved} hook${x.hooksRemoved===1?"":"s"} from ~/.codex/hooks.json`)}`);if(x.agentsMdBlockRemoved)console.log(` ${j("stripped Beacon block from ~/.codex/AGENTS.md")}`);if(x.mcpRemoved)console.log(` ${j("stripped [mcp_servers.beacon] from ~/.codex/config.toml")}`);if(x.mcpSkipped)console.log(` ${vZ("left [mcp_servers.beacon] in ~/.codex/config.toml \u2014 it wasn't written by Beacon (remove with: codex mcp remove beacon)")}`);for(let Q of A){if(!JQ(Q.path))continue;let Z=PQ(Q.path),$=[];if(Z.skillsRemoved.length)$.push(`skills(${Z.skillsRemoved.length})`);if(Z.mcpUnregistered)$.push(".mcp.json");if(Z.agentsBlockRemoved)$.push("AGENTS.md");if(Z.claudeImportRemoved)$.push("CLAUDE.md");if($.length)console.log(` ${j(`${Q.path} \u2192 ${$.join(", ")}`)}`)}var K0=u0(u,"server.json");try{let{pid:Q}=JSON.parse(N0(K0,"utf8"));if(Q)try{process.kill(Q),console.log(` ${j(`stopped daemon (pid ${Q})`)}`)}catch{}}catch{}if(JQ(u))G0(u,{recursive:!0,force:!0}),console.log(` ${j(`removed ${u}`)}`);console.log(K("Done."));console.log(` ${vZ("The `beacon` binary on your PATH is still there \u2014 run the matching uninstall step from your installer to remove it.")}
228
246
  `);