trybeacon 0.1.15 → 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 +8 -7
  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 +8 -7
  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-3fe31101c63d9668.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-51bc3f04374541b9.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/{ct96P0zTV3e7YqJ2NLI_X → 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 +50 -34
  220. package/dist/bin/hook.js +49 -32
  221. package/dist/bin/mcp.js +57 -41
  222. package/dist/bin/plan.js +52 -36
  223. package/dist/bin/prompt.js +1 -1
  224. package/dist/bin/stop-hook.js +2 -2
  225. package/dist/bin/uninstall.js +50 -34
  226. package/dist/lib/assets.js +23 -20
  227. package/dist/lib/global-install.js +48 -32
  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/9159.js +0 -1
  239. package/.next/static/chunks/5354-31b73f8e3dfd92b7.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/{ct96P0zTV3e7YqJ2NLI_X → fnj-duECSYw_AlTFP7r7a}/_ssgManifest.js +0 -0
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var EQ=Object.defineProperty;var FQ=(Q)=>Q;function IQ(Q,X){this[Q]=FQ.bind(null,X)}var e=(Q,X)=>{for(var Z in X)EQ(Q,Z,{get:X[Z],enumerable:!0,configurable:!0,set:IQ.bind(X,Z)})};var QQ=(Q,X)=>()=>(Q&&(X=Q(Q=0)),X);var YQ={};e(YQ,{removeRepoAssets:()=>AQ,installRefreshSkill:()=>DQ,installPlanSkill:()=>wQ,installInitSkill:()=>uQ,ensureWorkflowDoc:()=>RQ,ensureMcp:()=>_Q,auditRepo:()=>h,REFRESH_SKILL:()=>$Q,PLAN_SKILL:()=>JQ,INIT_SKILL:()=>ZQ});import{existsSync as y,mkdirSync as b,readFileSync as G,rmSync as L,writeFileSync as U}from"fs";import{join as q}from"path";function uQ(Q){let X=q(Q,".claude","skills","beacon-init");b(X,{recursive:!0});let Z=q(X,"SKILL.md");return U(Z,ZQ),Z}function DQ(Q){let X=q(Q,".claude","skills","beacon-refresh");b(X,{recursive:!0});let Z=q(X,"SKILL.md");return U(Z,$Q),Z}function wQ(Q){let X=q(Q,".claude","skills","beacon-plan");b(X,{recursive:!0});let Z=q(X,"SKILL.md");return U(Z,JQ),Z}function RQ(Q){let X=q(Q,"AGENTS.md"),Z="";try{Z=G(X,"utf8")}catch{}let $=new RegExp(`${F}[\\s\\S]*?${S}`);Z=$.test(Z)?Z.replace($,XQ):`${Z.trim()}
3
+ var jZ=Object.defineProperty;var BZ=(Q)=>Q;function vZ(Q,Z){this[Q]=BZ.bind(null,Z)}var zQ=(Q,Z)=>{for(var $ in Z)jZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:vZ.bind(Z,$)})};var f=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var PQ={};zQ(PQ,{removeRepoAssets:()=>wZ,installRefreshSkill:()=>GZ,installPlanSkill:()=>xZ,installInitSkill:()=>NZ,installCodexRepoSkills:()=>CZ,ensureWorkflowDoc:()=>MZ,ensureMcp:()=>fZ,auditRepo:()=>WQ,REFRESH_SKILL:()=>XQ,PLAN_SKILL:()=>_Q,INIT_SKILL:()=>qQ});import{existsSync as w,mkdirSync as _,readFileSync as G,rmSync as b,writeFileSync as N}from"fs";import{join as q}from"path";function NZ(Q){let Z=q(Q,".claude","skills","beacon-init");_(Z,{recursive:!0});let $=q(Z,"SKILL.md");return N($,qQ),$}function GZ(Q){let Z=q(Q,".claude","skills","beacon-refresh");_(Z,{recursive:!0});let $=q(Z,"SKILL.md");return N($,XQ),$}function xZ(Q){let Z=q(Q,".claude","skills","beacon-plan");_(Z,{recursive:!0});let $=q(Z,"SKILL.md");return N($,_Q),$}function CZ(Q){let Z=[];for(let $ of KZ){let J=q(Q,".agents","skills",$.name);_(J,{recursive:!0});let Y=q(J,"SKILL.md");N(Y,$.body()),Z.push(Y)}return Z}function MZ(Q){let Z=q(Q,"AGENTS.md"),$="";try{$=G(Z,"utf8")}catch{}let J=new RegExp(`${k}[\\s\\S]*?${UQ}`);$=J.test($)?$.replace(J,bQ):`${$.trim()}
4
4
 
5
- ${XQ}
6
- `.trimStart(),U(X,Z.endsWith(`
7
- `)?Z:`${Z}
8
- `);let J=q(Q,"CLAUDE.md"),Y="";try{Y=G(J,"utf8")}catch{}if(!/@AGENTS\.md/.test(Y))U(J,`${Y?`${Y.trim()}
5
+ ${bQ}
6
+ `.trimStart(),N(Z,$.endsWith(`
7
+ `)?$:`${$}
8
+ `);let Y=q(Q,"CLAUDE.md"),V="";try{V=G(Y,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))N(Y,`${V?`${V.trim()}
9
9
 
10
10
  `:""}@AGENTS.md
11
- `)}function _Q(Q){let X=q(Q,".mcp.json"),Z={};try{Z=JSON.parse(G(X,"utf8"))}catch{}if(Z.mcpServers=Z.mcpServers??{},Z.mcpServers.beacon)return{path:X,added:!1};return Z.mcpServers.beacon={command:"beacon",args:["mcp"]},U(X,JSON.stringify(Z,null,2)+`
12
- `),{path:X,added:!0}}function h(Q){let X=q(Q,".mcp.json"),Z=!1;try{Z=!!JSON.parse(G(X,"utf8")).mcpServers?.beacon}catch{}let $=!1;try{$=G(q(Q,"AGENTS.md"),"utf8").includes(F)}catch{}let J=!1;try{J=/@AGENTS\.md/.test(G(q(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:Z,agentsMdBlock:$,claudeMdImport:J,skills:{"beacon-init":y(q(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":y(q(Q,".claude","skills","beacon-refresh","SKILL.md"))}}}function AQ(Q){let X=[];for(let V of["beacon-init","beacon-refresh","beacon-db-design"]){let v=q(Q,".claude","skills",V);if(y(v))L(v,{recursive:!0,force:!0}),X.push(V)}let Z=!1,$=q(Q,".mcp.json");try{let V=JSON.parse(G($,"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 U($,JSON.stringify(V,null,2)+`
13
- `)}}catch{}let J=!1,Y=q(Q,"AGENTS.md");try{let V=G(Y,"utf8"),v=new RegExp(`\\n?${F}[\\s\\S]*?${S}\\n?`);if(v.test(V)){let g=V.replace(v,`
11
+ `)}function fZ(Q){let Z=q(Q,".mcp.json"),$={};try{$=JSON.parse(G(Z,"utf8"))}catch{}if($.mcpServers=$.mcpServers??{},$.mcpServers.beacon)return{path:Z,added:!1};return $.mcpServers.beacon={command:"beacon",args:["mcp"]},N(Z,JSON.stringify($,null,2)+`
12
+ `),{path:Z,added:!0}}function WQ(Q){let Z=q(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(G(Z,"utf8")).mcpServers?.beacon}catch{}let J=!1;try{J=G(q(Q,"AGENTS.md"),"utf8").includes(k)}catch{}let Y=!1;try{Y=/@AGENTS\.md/.test(G(q(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:J,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"))},codexSkills:{"beacon-init":w(q(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":w(q(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function wZ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let j=q(Q,".claude","skills",z);if(w(j))b(j,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let j=q(Q,".agents","skills",z);if(w(j))b(j,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,J=q(Q,".mcp.json");try{let z=JSON.parse(G(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)b(J,{force:!0});else N(J,JSON.stringify(z,null,2)+`
13
+ `)}}catch{}let Y=!1,V=q(Q,"AGENTS.md");try{let z=G(V,"utf8"),j=new RegExp(`\\n?${k}[\\s\\S]*?${UQ}\\n?`);if(j.test(z)){let VQ=z.replace(j,`
14
14
  `).replace(/\n{3,}/g,`
15
15
 
16
- `).trimStart();U(Y,g.endsWith(`
17
- `)?g:`${g}
18
- `),J=!0}}catch{}let B=!1,z=q(Q,"CLAUDE.md");try{let V=G(z,"utf8"),v=V.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(v!==V){if(!v.trim())L(z,{force:!0});else U(z,v);B=!0}}catch{}return{skillsRemoved:X,mcpUnregistered:Z,agentsBlockRemoved:J,claudeImportRemoved:B}}var ZQ=`---
16
+ `).trimStart();N(V,VQ.endsWith(`
17
+ `)?VQ:`${VQ}
18
+ `),Y=!0}}catch{}let X=!1,U=q(Q,"CLAUDE.md");try{let z=G(U,"utf8"),j=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(j!==z){if(!j.trim())b(U,{force:!0});else N(U,j);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
- `,$Q=`---
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
- `,JQ=`---
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 -->",XQ;var m=QQ(()=>{XQ=`${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
+ `,KZ,k="<!-- beacon:workflow:start -->",UQ="<!-- beacon:workflow:end -->",bQ;var L=f(()=>{KZ=[{name:"beacon-init",body:()=>qQ},{name:"beacon-refresh",body:()=>XQ}];bQ=`${k}
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
@@ -183,7 +186,7 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
183
186
 
184
187
  ### 3. At the end, register the work \u2014 in ONE call
185
188
 
186
- 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** and keeps \`beacon_context_for_feature\` accurate for the next session.
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.
187
190
 
188
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.
189
192
 
@@ -192,7 +195,31 @@ Register them all in that single batched call. If a plan added five features, th
192
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.
193
196
 
194
197
  Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
195
- ${S}`});var BQ={};e(BQ,{provisionDb:()=>$X});import{createClient as tQ}from"@libsql/client";import{drizzle as sQ}from"drizzle-orm/libsql";import{migrate as dQ}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as aQ}from"drizzle-orm/migrator";import{dirname as s,join as rQ}from"path";import{fileURLToPath as oQ}from"url";async function w(Q,X){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[X]})).rows.length>0}async function XX(Q,X){let Z=await Q.execute(`PRAGMA table_info("${X}")`);return new Set(Z.rows.map(($)=>String($.name)))}async function xQ(Q){if(!await w(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 ZX(Q){for(let[X,Z]of Object.entries(QX)){if(!await w(Q,X))continue;let $=await XX(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 $X(Q,X=eQ){let Z=tQ({url:Q});try{await Z.execute("PRAGMA journal_mode = WAL;"),await Z.execute("PRAGMA foreign_keys = ON;");let $=await w(Z,"__drizzle_migrations"),J=await w(Z,"Node"),Y=!1;if(J&&!$){let z=aQ({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 B=await xQ(Z);if(await dQ(sQ(Z),{migrationsFolder:X}),await xQ(Z)>B)Y=!0;return await ZX(Z),{migrated:Y}}finally{Z.close()}}var iQ,eQ,QX;var vQ=QQ(async()=>{iQ=s(s(s(oQ(import.meta.url)))),eQ=process.env.BEACON_MIGRATIONS_DIR||rQ(iQ,"drizzle"),QX={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 c,mkdirSync as l,readFileSync as u,rmSync as kQ,writeFileSync as D}from"fs";import{homedir as gQ}from"os";import{join as P}from"path";function LQ(){return process.env.HOME||process.env.USERPROFILE||gQ()}var C=()=>P(LQ(),".claude"),n=()=>P(C(),"skills"),VQ=()=>P(C(),"settings.json"),O=()=>P(C(),"CLAUDE.md"),I="<!-- beacon:global:start -->",p="<!-- beacon:global:end -->",M=["beacon-init","beacon-refresh","beacon-plan"],T=[{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."}],yQ=`## Beacon (visual planning panel)
198
+ ${UQ}`});import{existsSync as kQ,mkdirSync as HQ,readFileSync as S,rmSync as TZ,writeFileSync as m}from"fs";import{dirname as LQ,join as h}from"path";function jQ(Q){try{return JSON.parse(S(Q,"utf8"))}catch{return{}}}function hQ(Q,Z){HQ(LQ(Q),{recursive:!0}),m(Q,JSON.stringify(Z,null,2)+`
199
+ `)}function p(Q,Z){let $=jQ(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}]}),hQ(Q,$),!0}function c(Q,Z){return(jQ(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>V.command===Z.command))}function l(Q,Z){let $=jQ(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((j)=>j.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 hQ(Q,$),!0}function n(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(LQ(Q),{recursive:!0}),m(Q,V.endsWith(`
206
+ `)?V:`${V}
207
+ `)}function R(Q,Z){try{return S(Q,"utf8").includes(Z)}catch{return!1}}function t(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 m(Q,V),!0}function s(Q,Z,$){let J=h(Q,Z);HQ(J,{recursive:!0});let Y=h(J,"SKILL.md");return m(Y,$),Y}function E(Q,Z){return kQ(h(Q,Z,"SKILL.md"))}function a(Q,Z){let $=h(Q,Z);if(!kQ($))return!1;return TZ($,{recursive:!0,force:!0}),!0}var BQ=()=>{};import{mkdirSync as uZ,renameSync as FZ,rmSync as gZ,writeFileSync as RZ}from"fs";import{dirname as EZ}from"path";function vQ(Q,Z){uZ(EZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{RZ($,Z),FZ($,Q)}catch(J){throw gZ($,{force:!0}),J}}var SQ=()=>{};var sQ={};zQ(sQ,{setupCodexAssets:()=>OZ,removeCodexMcp:()=>tQ,removeCodexArtifacts:()=>AZ,hasCodexMcp:()=>KQ,ensureCodexMcp:()=>nQ,codexMcpProblem:()=>CQ,codexDetected:()=>e,auditCodex:()=>MQ,CODEX_HOOKS:()=>K});import{readFileSync as o}from"fs";import{homedir as IZ}from"os";import{join as O}from"path";function mQ(){return process.env.HOME||process.env.USERPROFILE||IZ()}function e(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(NQ===void 0)NQ=Bun.which("codex")!==null;return NQ}function D(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function KQ(){try{return Boolean(D(o(T(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function CQ(){let Q="";try{Q=o(T(),"utf8")}catch{return null}let Z=D(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${I}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${I}`;return null}function nQ(){let Q="",Z=!1;try{Q=o(T(),"utf8"),Z=!0}catch{}if(Z){let V=D(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${I}`};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 ${I}`}}let $=!Q?"":Q.endsWith(`
210
+ `)?`
211
+ `:`
212
+
213
+ `,J=Q+$+DZ;if(D(J)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${I}`};return vQ(T(),J),{added:!0}}function tQ(){let Q="";try{Q=o(T(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
214
+ `),$=Z.indexOf(cQ);if($===-1)return{removed:!1,skipped:KQ()};let J=Z.indexOf(lQ,$);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(D(Y)===null)return{removed:!1,skipped:!0};return vQ(T(),Y),{removed:!0}}async function OZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (L(),PQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},Y=[];for(let z of B){if(!E(r(),z))Y.push(z);s(r(),z,J[z])}let V=0;for(let z of K)if(p(xQ(),{event:z.event,matcher:z.matcher,command:z.command}))V++;let X=R(d(),i);n(d(),i,pQ,wQ);let U=nQ();return{skillsAdded:Y,hooksAdded:V,agentsMdBlockTouched:!X,mcp:U}}function MQ(){let Q={};for(let $ of B)Q[$]=E(r(),$);let Z={};for(let $ of K)Z[$.event]=c(xQ(),{event:$.event,command:$.command});return{detected:e(),skills:Q,hooks:Z,agentsMdBlock:R(d(),i),mcp:KQ()}}function AZ(){let Q=[];for(let Y of B)if(a(r(),Y))Q.push(Y);let Z=0;for(let Y of K)if(l(xQ(),{event:Y.event,command:Y.command}))Z++;let $=t(d(),i,pQ),J=tQ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:J.removed,mcpSkipped:J.skipped}}var GQ=()=>O(mQ(),".codex"),xQ=()=>O(GQ(),"hooks.json"),T=()=>O(GQ(),"config.toml"),d=()=>O(GQ(),"AGENTS.md"),r=()=>O(mQ(),".agents","skills"),i="<!-- beacon:global:start -->",pQ="<!-- beacon:global:end -->",K,NQ,cQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",lQ="# beacon:end",DZ,I="add it manually: codex mcp add beacon -- beacon mcp";var fQ=f(()=>{BQ();SQ();TQ();K=[{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."}];DZ=`${cQ}
218
+ [mcp_servers.beacon]
219
+ command = "beacon"
220
+ args = ["mcp"]
221
+ ${lQ}
222
+ `});import{existsSync as yZ}from"fs";import{homedir as bZ}from"os";import{join as QQ}from"path";function _Z(){return process.env.HOME||process.env.USERPROFILE||bZ()}function kZ(Q,Z){return s(uQ(),Q,Z)}function dQ(Q){return E(uQ(),Q)}function LZ(Q){return a(uQ(),Q)}function hZ(Q){return p(FQ(),Q)}function SZ(Q){return c(FQ(),Q)}function mZ(Q){return l(FQ(),Q)}function pZ(Q){n(gQ(),RQ,aQ,Q)}function rQ(){return R(gQ(),RQ)}function cZ(){return t(gQ(),RQ,aQ)}function iQ(){let Q={};for(let $ of B)Q[$]=dQ($);let Z={};for(let $ of u)Z[$.event]=SZ({event:$.event,command:$.command});return{homeExists:yZ(ZQ()),skills:Q,hooks:Z,claudeMdBlock:rQ()}}async function lZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (L(),PQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},Y=[];for(let U of B){if(!dQ(U))Y.push(U);kZ(U,J[U])}let V=0;for(let U of u)if(hZ({event:U.event,matcher:U.matcher,command:U.command}))V++;let X=rQ();return pZ(wQ),{skillsAdded:Y,hooksAdded:V,claudeMdBlockTouched:!X}}async function p0(){let Q;try{Q={ok:!0,...await lZ()}}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(() => (fQ(),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 c0(){let Q=[];for(let J of B)if(LZ(J))Q.push(J);let Z=0;for(let J of u)if(mZ(J))Z++;let $=cZ();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}var ZQ=()=>QQ(_Z(),".claude"),uQ=()=>QQ(ZQ(),"skills"),FQ=()=>QQ(ZQ(),"settings.json"),gQ=()=>QQ(ZQ(),"CLAUDE.md"),RQ="<!-- beacon:global:start -->",aQ="<!-- beacon:global:end -->",B,u,wQ=`## Beacon (visual planning panel)
196
223
 
197
224
  This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
198
225
  agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
@@ -213,17 +240,6 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
213
240
  Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
214
241
  on the /map and /db boards (added features, attached subtasks, edited columns, new
215
242
  endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
216
- verbatim. Do NOT implement until the tool returns approval.`;function bQ(Q,X){let Z=P(n(),Q);l(Z,{recursive:!0});let $=P(Z,"SKILL.md");return D($,X),$}function zQ(Q){return c(P(n(),Q,"SKILL.md"))}function SQ(Q){let X=P(n(),Q);if(!c(X))return!1;return kQ(X,{recursive:!0,force:!0}),!0}function t(){try{return JSON.parse(u(VQ(),"utf8"))}catch{return{}}}function qQ(Q){l(C(),{recursive:!0}),D(VQ(),JSON.stringify(Q,null,2)+`
217
- `)}function hQ(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}]}),qQ(X),!0}function mQ(Q){return(t().hooks?.[Q.event]??[]).some(($)=>$.hooks?.some((J)=>J.command===Q.command))}function pQ(Q){let X=t(),Z=X.hooks?.[Q.event];if(!Z)return!1;let $=!1,J=Z.map((Y)=>{let B=Y.hooks?.length??0,z=(Y.hooks??[]).filter((V)=>V.command!==Q.command);if(z.length!==B)$=!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 qQ(X),!0}function cQ(Q){let X=`${I}
218
- ${Q.trim()}
219
- ${p}`,Z="";try{Z=u(O(),"utf8")}catch{}let $=new RegExp(`${I}[\\s\\S]*?${p}`);Z=$.test(Z)?Z.replace($,X):Z.trim()?`${Z.trim()}
220
-
221
- ${X}
222
- `:`${X}
223
- `,l(C(),{recursive:!0}),D(O(),Z.endsWith(`
224
- `)?Z:`${Z}
225
- `)}function NQ(){try{return u(O(),"utf8").includes(I)}catch{return!1}}function lQ(){let Q="";try{Q=u(O(),"utf8")}catch{return!1}let X=new RegExp(`${I}[\\s\\S]*?${p}\\n?`);if(!X.test(Q))return!1;let Z=Q.replace(X,"").replace(/\n{3,}/g,`
226
-
227
- `).trimStart();return D(O(),Z),!0}function HQ(){let Q={};for(let Z of M)Q[Z]=zQ(Z);let X={};for(let Z of T)X[Z.event]=mQ({event:Z.event,command:Z.command});return{homeExists:c(C()),skills:Q,hooks:X,claudeMdBlock:NQ()}}async function nQ(){let{INIT_SKILL:Q,REFRESH_SKILL:X,PLAN_SKILL:Z}=await Promise.resolve().then(() => (m(),YQ)),$={"beacon-init":Q,"beacon-refresh":X,"beacon-plan":Z},J=[];for(let z of M){if(!zQ(z))J.push(z);bQ(z,$[z])}let Y=0;for(let z of T)if(hQ({event:z.event,matcher:z.matcher,command:z.command}))Y++;let B=NQ();return cQ(yQ),{skillsAdded:J,hooksAdded:Y,claudeMdBlockTouched:!B}}async function RX(){try{return{ok:!0,...await nQ()}}catch(Q){return{ok:!1,error:Q instanceof Error?Q.message:String(Q),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}}function _X(){let Q=[];for(let $ of M)if(SQ($))Q.push($);let X=0;for(let $ of T)if(pQ($))X++;let Z=lQ();return{skillsRemoved:Q,hooksRemoved:X,claudeMdBlockRemoved:Z}}import{AsyncLocalStorage as JX}from"async_hooks";import{spawnSync as YX}from"child_process";import{createHash as VX}from"crypto";import{existsSync as UQ,mkdirSync as R,readFileSync as PQ,writeFileSync as WQ}from"fs";import{homedir as zX}from"os";import{basename as qX,join as K}from"path";function W(){return process.env.BEACON_HOME||K(zX(),".beacon")}function d(){return K(W(),"workspaces.json")}function jQ(Q){return VX("sha256").update(Q).digest("hex").slice(0,12)}function tX(Q=process.cwd()){let X=YX("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 a(Q){return K(W(),Q)}function NX(Q){return`file:${K(a(Q),"db.sqlite")}`}function E(){try{let Q=JSON.parse(PQ(d(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function r(Q){R(W(),{recursive:!0}),WQ(d(),JSON.stringify(Q,null,2))}function o(){return E().sort((Q,X)=>X.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function j(Q){return E().find((X)=>X.id===Q)??null}function HX(Q,X,Z=new Date().toISOString()){let $=jQ(Q),J=E(),Y=J.find((V)=>V.id===$),B={id:$,path:Q,name:X||Y?.name||qX(Q),lastOpenedAt:Z},z=[B,...J.filter((V)=>V.id!==$)];return R(a($),{recursive:!0}),r(z),B}function sX(Q,X=new Date().toISOString()){let Z=E(),$=Z.find((J)=>J.id===Q);if(!$)return;$.lastOpenedAt=X,r(Z)}function dX(Q){if(r(E().filter((X)=>X.id!==Q)),i()===Q)xX(o()[0]?.id??null)}function CQ(){return K(W(),"active")}function i(){try{return PQ(CQ(),"utf8").trim()||null}catch{return null}}function xX(Q){R(W(),{recursive:!0}),WQ(CQ(),Q??"")}function aX(){let Q=i();return Q?j(Q):null}function rX(){let Q=vX()??i();return Q?j(Q):null}function oX(Q){return j(Q)?.path??null}function iX(){return UQ(d())}var MQ="beacon_ws";function TQ(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 eX(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&j(X))return X;let Z=TQ(Q,MQ);if(Z&&j(Z))return Z;return null}var BX="x-beacon-workspace-path";async function QZ(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&j(X))return X;let Z=Q.headers.get(BX);if(Z&&(!X||jQ(Z)===X)){let J=HX(Z);return await GX(J.id),J.id}let $=TQ(Q,MQ);if($&&j($))return $;return null}var KQ=new JX;function XZ(Q,X){return Q?KQ.run(Q,X):X()}function vX(){return KQ.getStore()??null}var GQ=new Set;async function GX(Q){let X=a(Q),Z=K(X,"db.sqlite"),$=UQ(Z);if($&&GQ.has(Z))return{ok:!0,created:!1,migrated:!1};try{R(X,{recursive:!0});let{provisionDb:J}=await vQ().then(() => BQ),Y=await J(NX(Q));return GQ.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{execSync as UX,spawnSync as PX}from"child_process";import{existsSync as WX,readFileSync as jX}from"fs";import{join as fQ}from"path";var H=(Q)=>`\x1B[32m\u2713\x1B[0m ${Q}`,x=(Q)=>`\x1B[31m\u2717\x1B[0m ${Q}`,_=(Q)=>`\x1B[2m${Q}\x1B[0m`,k=(Q)=>`
228
- \x1B[1m${Q}\x1B[0m`;function CX(){try{return UX("git rev-parse --show-toplevel",{cwd:process.cwd(),stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return""}}function MX(){let Q=fQ(W(),"server.json");try{let X=JSON.parse(jX(Q,"utf8"));if(!X.pid)return x("daemon: no server.json yet");try{return process.kill(X.pid,0),H(`daemon running (pid ${X.pid}, port ${X.port??"?"})`)}catch{return x(`daemon NOT running (server.json stale: pid ${X.pid})`)}}catch{return x("daemon: no server.json (never started)")}}function TX(){let Q=PX("bun",["--version"],{stdio:["ignore","pipe","ignore"]});if(Q.status===0)return H(`bun ${Q.stdout.toString().trim()}`);return x("bun NOT found on PATH (required to run Beacon)")}function KX(){return CX()||process.cwd()}var A=KX(),f=HQ(),OQ=o(),fX=OQ.some((Q)=>Q.path===A),N=fX||WX(fQ(A,".mcp.json"))?h(A):null;console.log(k("Beacon \xB7 doctor"));console.log(k("Runtime"));console.log(` ${TX()}`);console.log(` ${MX()}`);console.log(` ${H(`home: ${W()}`)}`);console.log(` ${H(`workspaces registered: ${OQ.length}`)}`);console.log(k("Global (~/.claude/)"));for(let Q of M)console.log(` ${f.skills[Q]?H(`skill ${Q}`):x(`skill ${Q} \u2014 missing`)}`);for(let Q of T)console.log(` ${f.hooks[Q.event]?H(`hook ${Q.event} \u2192 ${Q.command}`):x(`hook ${Q.event} \u2192 ${Q.command} \u2014 missing`)} ${_(Q.description)}`);console.log(` ${f.claudeMdBlock?H("global CLAUDE.md block"):x("global CLAUDE.md block \u2014 missing (every Claude session won't auto-discover Beacon)")}`);console.log(k(`Current repo (${A})`));if(!N)console.log(` ${_("not registered with Beacon and no .mcp.json \u2014 run `beacon` here to wire it.")}`);else console.log(` ${N.mcpRegistered?H(".mcp.json has beacon entry"):x(".mcp.json missing beacon entry")}`),console.log(` ${N.agentsMdBlock?H("AGENTS.md has Beacon workflow block"):x("AGENTS.md missing Beacon workflow block")}`),console.log(` ${N.claudeMdImport?H("CLAUDE.md @-imports AGENTS.md"):x("CLAUDE.md does NOT @-import AGENTS.md")}`),console.log(` ${N.skills["beacon-init"]?H("skill beacon-init (repo)"):x("skill beacon-init (repo) \u2014 missing")}`),console.log(` ${N.skills["beacon-refresh"]?H("skill beacon-refresh (repo)"):x("skill beacon-refresh (repo) \u2014 missing")}`);var OX=M.some((Q)=>!f.skills[Q])||T.some((Q)=>!f.hooks[Q.event])||!f.claudeMdBlock||(N?!N.mcpRegistered||!N.agentsMdBlock||!N.claudeMdImport||!N.skills["beacon-init"]||!N.skills["beacon-refresh"]:!1);if(OX)console.log(`
229
- ${_("Fix everything marked \u2717 by running")} \x1B[1mbeacon\x1B[0m ${_("in this repo.")}`);console.log();
243
+ verbatim. Do NOT implement until the tool returns approval.`;var TQ=f(()=>{BQ();B=["beacon-init","beacon-refresh","beacon-plan"],u=[{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 eQ={};zQ(eQ,{provisionDb:()=>$0});import{createClient as nZ}from"@libsql/client";import{drizzle as tZ}from"drizzle-orm/libsql";import{migrate as sZ}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as aZ}from"drizzle-orm/migrator";import{dirname as EQ,join as dZ}from"path";import{fileURLToPath as rZ}from"url";async function $Q(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function Q0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((J)=>String(J.name)))}async function oQ(Q){if(!await $Q(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 Z0(Q){for(let[Z,$]of Object.entries(eZ)){if(!await $Q(Q,Z))continue;let J=await Q0(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 $0(Q,Z=oZ){let $=nZ({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;");let J=await $Q($,"__drizzle_migrations"),Y=await $Q($,"Node"),V=!1;if(Y&&!J){let U=aZ({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 oQ($);if(await sZ(tZ($),{migrationsFolder:Z}),await oQ($)>X)V=!0;return await Z0($),{migrated:V}}finally{$.close()}}var iZ,oZ,eZ;var QZ=f(async()=>{iZ=EQ(EQ(EQ(rZ(import.meta.url)))),oZ=process.env.BEACON_MIGRATIONS_DIR||dZ(iZ,"drizzle"),eZ={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 J0}from"async_hooks";import{spawnSync as Y0}from"child_process";import{createHash as V0}from"crypto";import{existsSync as $Z,mkdirSync as JQ,readFileSync as JZ,writeFileSync as YZ}from"fs";import{homedir as z0}from"os";import{basename as q0,join as F}from"path";function x(){return process.env.BEACON_HOME||F(z0(),".beacon")}function IQ(){return F(x(),"workspaces.json")}function VZ(Q){return V0("sha256").update(Q).digest("hex").slice(0,12)}function J1(Q=process.cwd()){let Z=Y0("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 DQ(Q){return F(x(),Q)}function X0(Q){return`file:${F(DQ(Q),"db.sqlite")}`}function A(){try{let Q=JSON.parse(JZ(IQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function OQ(Q){JQ(x(),{recursive:!0}),YZ(IQ(),JSON.stringify(Q,null,2))}function AQ(){return A().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function C(Q){return A().find((Z)=>Z.id===Q)??null}function U0(Q,Z,$=new Date().toISOString()){let J=VZ(Q),Y=A(),V=Y.find((z)=>z.id===J),X={id:J,path:Q,name:Z||V?.name||q0(Q),lastOpenedAt:$},U=[X,...Y.filter((z)=>z.id!==J)];return JQ(DQ(J),{recursive:!0}),OQ(U),X}function Y1(Q,Z=new Date().toISOString()){let $=A(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,OQ($)}function V1(Q){if(OQ(A().filter((Z)=>Z.id!==Q)),yQ()===Q)W0(AQ()[0]?.id??null)}function zZ(){return F(x(),"active")}function yQ(){try{return JZ(zZ(),"utf8").trim()||null}catch{return null}}function W0(Q){JQ(x(),{recursive:!0}),YZ(zZ(),Q??"")}function z1(){let Q=yQ();return Q?C(Q):null}function q1(){let Q=H0()??yQ();return Q?C(Q):null}function X1(Q){return C(Q)?.path??null}function U1(){return $Z(IQ())}var qZ="beacon_ws";function XZ(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 W1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&C(Z))return Z;let $=XZ(Q,qZ);if($&&C($))return $;return null}var P0="x-beacon-workspace-path";async function P1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&C(Z))return Z;let $=Q.headers.get(P0);if($&&(!Z||VZ($)===Z)){let Y=U0($);return await j0(Y.id),Y.id}let J=XZ(Q,qZ);if(J&&C(J))return J;return null}var UZ=new J0;function H1(Q,Z){return Q?UZ.run(Q,Z):Z()}function H0(){return UZ.getStore()??null}var ZZ=new Set;async function j0(Q){let Z=DQ(Q),$=F(Z,"db.sqlite"),J=$Z($);if(J&&ZZ.has($))return{ok:!0,created:!1,migrated:!1};try{JQ(Z,{recursive:!0});let{provisionDb:Y}=await QZ().then(() => eQ),V=await Y(X0(Q));return ZZ.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)}}}L();fQ();TQ();import{execSync as B0,spawnSync as WZ}from"child_process";import{existsSync as v0,readFileSync as N0}from"fs";import{join as PZ}from"path";var W=(Q)=>`\x1B[32m\u2713\x1B[0m ${Q}`,P=(Q)=>`\x1B[31m\u2717\x1B[0m ${Q}`,M=(Q)=>`\x1B[2m${Q}\x1B[0m`,y=(Q)=>`
244
+ \x1B[1m${Q}\x1B[0m`;function G0(){try{return B0("git rev-parse --show-toplevel",{cwd:process.cwd(),stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return""}}function x0(){let Q=PZ(x(),"server.json");try{let Z=JSON.parse(N0(Q,"utf8"));if(!Z.pid)return P("daemon: no server.json yet");try{return process.kill(Z.pid,0),W(`daemon running (pid ${Z.pid}, port ${Z.port??"?"})`)}catch{return P(`daemon NOT running (server.json stale: pid ${Z.pid})`)}}catch{return P("daemon: no server.json (never started)")}}function K0(){let Q=WZ("bun",["--version"],{stdio:["ignore","pipe","ignore"]});if(Q.status===0)return W(`bun ${Q.stdout.toString().trim()}`);return P("bun NOT found on PATH (required to run Beacon)")}function C0(){return G0()||process.cwd()}var YQ=C0(),g=iQ(),HZ=AQ(),M0=HZ.some((Q)=>Q.path===YQ),H=M0||v0(PZ(YQ,".mcp.json"))?WQ(YQ):null;console.log(y("Beacon \xB7 doctor"));console.log(y("Runtime"));console.log(` ${K0()}`);console.log(` ${x0()}`);console.log(` ${W(`home: ${x()}`)}`);console.log(` ${W(`workspaces registered: ${HZ.length}`)}`);console.log(y("Global (~/.claude/)"));for(let Q of B)console.log(` ${g.skills[Q]?W(`skill ${Q}`):P(`skill ${Q} \u2014 missing`)}`);for(let Q of u)console.log(` ${g.hooks[Q.event]?W(`hook ${Q.event} \u2192 ${Q.command}`):P(`hook ${Q.event} \u2192 ${Q.command} \u2014 missing`)} ${M(Q.description)}`);console.log(` ${g.claudeMdBlock?W("global CLAUDE.md block"):P("global CLAUDE.md block \u2014 missing (every Claude session won't auto-discover Beacon)")}`);console.log(y("Codex (~/.codex/ + ~/.agents/)"));var v=e()?MQ():null;if(!v)console.log(` ${M("codex not on PATH \u2014 Codex integration inactive (wires automatically once codex is installed)")}`);else{let Q=WZ("codex",["--version"],{stdio:["ignore","pipe","ignore"]});console.log(` ${Q.status===0?W(`codex ${Q.stdout.toString().trim()}`):M("codex version unavailable (BEACON_CODEX override?)")}`);for(let $ of B)console.log(` ${v.skills[$]?W(`skill ${$} (~/.agents/skills)`):P(`skill ${$} (~/.agents/skills) \u2014 missing`)}`);for(let $ of K)console.log(` ${v.hooks[$.event]?W(`hook ${$.event} \u2192 ${$.command}`):P(`hook ${$.event} \u2192 ${$.command} \u2014 missing`)} ${M($.description)}`);console.log(` ${v.agentsMdBlock?W("global ~/.codex/AGENTS.md block"):P("global ~/.codex/AGENTS.md block \u2014 missing")}`);let Z=CQ();console.log(` ${v.mcp?W("config.toml has [mcp_servers.beacon]"):P(`config.toml missing [mcp_servers.beacon]${Z?` \u2014 ${Z}`:""}`)}`)}console.log(y(`Current repo (${YQ})`));if(!H)console.log(` ${M("not registered with Beacon and no .mcp.json \u2014 run `beacon` here to wire it.")}`);else if(console.log(` ${H.mcpRegistered?W(".mcp.json has beacon entry"):P(".mcp.json missing beacon entry")}`),console.log(` ${H.agentsMdBlock?W("AGENTS.md has Beacon workflow block"):P("AGENTS.md missing Beacon workflow block")}`),console.log(` ${H.claudeMdImport?W("CLAUDE.md @-imports AGENTS.md"):P("CLAUDE.md does NOT @-import AGENTS.md")}`),console.log(` ${H.skills["beacon-init"]?W("skill beacon-init (repo)"):P("skill beacon-init (repo) \u2014 missing")}`),console.log(` ${H.skills["beacon-refresh"]?W("skill beacon-refresh (repo)"):P("skill beacon-refresh (repo) \u2014 missing")}`),v)console.log(` ${H.codexSkills["beacon-init"]?W("skill beacon-init (.agents/skills)"):P("skill beacon-init (.agents/skills) \u2014 missing")}`),console.log(` ${H.codexSkills["beacon-refresh"]?W("skill beacon-refresh (.agents/skills)"):P("skill beacon-refresh (.agents/skills) \u2014 missing")}`);var f0=B.some((Q)=>!g.skills[Q])||u.some((Q)=>!g.hooks[Q.event])||!g.claudeMdBlock||(v?B.some((Q)=>!v.skills[Q])||K.some((Q)=>!v.hooks[Q.event])||!v.agentsMdBlock||!v.mcp:!1)||(H?!H.mcpRegistered||!H.agentsMdBlock||!H.claudeMdImport||!H.skills["beacon-init"]||!H.skills["beacon-refresh"]||(v?!H.codexSkills["beacon-init"]||!H.codexSkills["beacon-refresh"]:!1):!1);if(f0)console.log(`
245
+ ${M("Fix everything marked \u2717 by running")} \x1B[1mbeacon\x1B[0m ${M("in this repo.")}`);console.log();
package/dist/bin/hook.js CHANGED
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var vQ=Object.defineProperty;var jQ=(Q)=>Q;function TQ(Q,X){this[Q]=jQ.bind(null,X)}var l=(Q,X)=>{for(var Z in X)vQ(Q,Z,{get:X[Z],enumerable:!0,configurable:!0,set:TQ.bind(X,Z)})};var n=(Q,X)=>()=>(Q&&(X=Q(Q=0)),X);var o={};l(o,{removeRepoAssets:()=>OQ,installRefreshSkill:()=>MQ,installPlanSkill:()=>CQ,installInitSkill:()=>WQ,ensureWorkflowDoc:()=>KQ,ensureMcp:()=>uQ,auditRepo:()=>fQ,REFRESH_SKILL:()=>d,PLAN_SKILL:()=>a,INIT_SKILL:()=>s});import{existsSync as F,mkdirSync as D,readFileSync as x,rmSync as w,writeFileSync as B}from"fs";import{join as q}from"path";function WQ(Q){let X=q(Q,".claude","skills","beacon-init");D(X,{recursive:!0});let Z=q(X,"SKILL.md");return B(Z,s),Z}function MQ(Q){let X=q(Q,".claude","skills","beacon-refresh");D(X,{recursive:!0});let Z=q(X,"SKILL.md");return B(Z,d),Z}function CQ(Q){let X=q(Q,".claude","skills","beacon-plan");D(X,{recursive:!0});let Z=q(X,"SKILL.md");return B(Z,a),Z}function KQ(Q){let X=q(Q,"AGENTS.md"),Z="";try{Z=x(X,"utf8")}catch{}let $=new RegExp(`${M}[\\s\\S]*?${A}`);Z=$.test(Z)?Z.replace($,t):`${Z.trim()}
3
+ var ZZ=Object.defineProperty;var $Z=(Q)=>Q;function JZ(Q,Z){this[Q]=$Z.bind(null,Z)}var r=(Q,Z)=>{for(var $ in Z)ZZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:JZ.bind(Z,$)})};var j=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var QQ={};r(QQ,{removeRepoAssets:()=>xZ,installRefreshSkill:()=>VZ,installPlanSkill:()=>zZ,installInitSkill:()=>YZ,installCodexRepoSkills:()=>XZ,ensureWorkflowDoc:()=>UZ,ensureMcp:()=>WZ,auditRepo:()=>PZ,REFRESH_SKILL:()=>i,PLAN_SKILL:()=>wQ,INIT_SKILL:()=>o});import{existsSync as G,mkdirSync as f,readFileSync as x,rmSync as F,writeFileSync as P}from"fs";import{join as X}from"path";function YZ(Q){let Z=X(Q,".claude","skills","beacon-init");f(Z,{recursive:!0});let $=X(Z,"SKILL.md");return P($,o),$}function VZ(Q){let Z=X(Q,".claude","skills","beacon-refresh");f(Z,{recursive:!0});let $=X(Z,"SKILL.md");return P($,i),$}function zZ(Q){let Z=X(Q,".claude","skills","beacon-plan");f(Z,{recursive:!0});let $=X(Z,"SKILL.md");return P($,wQ),$}function XZ(Q){let Z=[];for(let $ of qZ){let J=X(Q,".agents","skills",$.name);f(J,{recursive:!0});let Y=X(J,"SKILL.md");P(Y,$.body()),Z.push(Y)}return Z}function UZ(Q){let Z=X(Q,"AGENTS.md"),$="";try{$=x(Z,"utf8")}catch{}let J=new RegExp(`${R}[\\s\\S]*?${e}`);$=J.test($)?$.replace(J,MQ):`${$.trim()}
4
4
 
5
- ${t}
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
+ ${MQ}
6
+ `.trimStart(),P(Z,$.endsWith(`
7
+ `)?$:`${$}
8
+ `);let Y=X(Q,"CLAUDE.md"),V="";try{V=x(Y,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))P(Y,`${V?`${V.trim()}
9
9
 
10
10
  `:""}@AGENTS.md
11
- `)}function uQ(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 fQ(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(M)}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":F(q(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":F(q(Q,".claude","skills","beacon-refresh","SKILL.md"))}}}function OQ(Q){let X=[];for(let V of["beacon-init","beacon-refresh","beacon-db-design"]){let N=q(Q,".claude","skills",V);if(F(N))w(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)w($,{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?${M}[\\s\\S]*?${A}\\n?`);if(N.test(V)){let I=V.replace(N,`
11
+ `)}function WZ(Q){let Z=X(Q,".mcp.json"),$={};try{$=JSON.parse(x(Z,"utf8"))}catch{}if($.mcpServers=$.mcpServers??{},$.mcpServers.beacon)return{path:Z,added:!1};return $.mcpServers.beacon={command:"beacon",args:["mcp"]},P(Z,JSON.stringify($,null,2)+`
12
+ `),{path:Z,added:!0}}function PZ(Q){let Z=X(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(x(Z,"utf8")).mcpServers?.beacon}catch{}let J=!1;try{J=x(X(Q,"AGENTS.md"),"utf8").includes(R)}catch{}let Y=!1;try{Y=/@AGENTS\.md/.test(x(X(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:J,claudeMdImport:Y,skills:{"beacon-init":G(X(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":G(X(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":G(X(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":G(X(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function xZ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let W=X(Q,".claude","skills",z);if(G(W))F(W,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let W=X(Q,".agents","skills",z);if(G(W))F(W,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,J=X(Q,".mcp.json");try{let z=JSON.parse(x(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)F(J,{force:!0});else P(J,JSON.stringify(z,null,2)+`
13
+ `)}}catch{}let Y=!1,V=X(Q,"AGENTS.md");try{let z=x(V,"utf8"),W=new RegExp(`\\n?${R}[\\s\\S]*?${e}\\n?`);if(W.test(z)){let l=z.replace(W,`
14
14
  `).replace(/\n{3,}/g,`
15
15
 
16
- `).trimStart();B(Y,I.endsWith(`
17
- `)?I:`${I}
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())w(z,{force:!0});else B(z,N);H=!0}}catch{}return{skillsRemoved:X,mcpUnregistered:Z,agentsBlockRemoved:J,claudeImportRemoved:H}}var s=`---
16
+ `).trimStart();P(V,l.endsWith(`
17
+ `)?l:`${l}
18
+ `),Y=!0}}catch{}let q=!1,U=X(Q,"CLAUDE.md");try{let z=x(U,"utf8"),W=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(W!==z){if(!W.trim())F(U,{force:!0});else P(U,W);q=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:Y,claudeImportRemoved:q}}var o=`---
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
- `,d=`---
55
+ `,i=`---
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
- `,a=`---
102
+ `,wQ=`---
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
- `,M="<!-- beacon:workflow:start -->",A="<!-- beacon:workflow:end -->",t;var r=n(()=>{t=`${M}
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
+ `,qZ,R="<!-- beacon:workflow:start -->",e="<!-- beacon:workflow:end -->",MQ;var ZQ=j(()=>{qZ=[{name:"beacon-init",body:()=>o},{name:"beacon-refresh",body:()=>i}];MQ=`${R}
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
@@ -183,7 +186,7 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
183
186
 
184
187
  ### 3. At the end, register the work \u2014 in ONE call
185
188
 
186
- 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** and keeps \`beacon_context_for_feature\` accurate for the next session.
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.
187
190
 
188
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.
189
192
 
@@ -192,7 +195,31 @@ Register them all in that single batched call. If a plan added five features, th
192
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.
193
196
 
194
197
  Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
195
- ${A}`});var JQ={};l(JQ,{provisionDb:()=>aQ});import{createClient as yQ}from"@libsql/client";import{drizzle as hQ}from"drizzle-orm/libsql";import{migrate as SQ}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as mQ}from"drizzle-orm/migrator";import{dirname as h,join as pQ}from"path";import{fileURLToPath as cQ}from"url";async function f(Q,X){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[X]})).rows.length>0}async function sQ(Q,X){let Z=await Q.execute(`PRAGMA table_info("${X}")`);return new Set(Z.rows.map(($)=>String($.name)))}async function $Q(Q){if(!await f(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 dQ(Q){for(let[X,Z]of Object.entries(tQ)){if(!await f(Q,X))continue;let $=await sQ(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 aQ(Q,X=nQ){let Z=yQ({url:Q});try{await Z.execute("PRAGMA journal_mode = WAL;"),await Z.execute("PRAGMA foreign_keys = ON;");let $=await f(Z,"__drizzle_migrations"),J=await f(Z,"Node"),Y=!1;if(J&&!$){let z=mQ({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 $Q(Z);if(await SQ(hQ(Z),{migrationsFolder:X}),await $Q(Z)>H)Y=!0;return await dQ(Z),{migrated:Y}}finally{Z.close()}}var lQ,nQ,tQ;var YQ=n(async()=>{lQ=h(h(h(cQ(import.meta.url)))),nQ=process.env.BEACON_MIGRATIONS_DIR||pQ(lQ,"drizzle"),tQ={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 k,mkdirSync as _,readFileSync as K,rmSync as EQ,writeFileSync as u}from"fs";import{homedir as IQ}from"os";import{join as G}from"path";function wQ(){return process.env.HOME||process.env.USERPROFILE||IQ()}var P=()=>G(wQ(),".claude"),g=()=>G(P(),"skills"),i=()=>G(P(),"settings.json"),j=()=>G(P(),"CLAUDE.md"),C="<!-- beacon:global:start -->",R="<!-- beacon:global:end -->",b=["beacon-init","beacon-refresh","beacon-plan"],L=[{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."}],FQ=`## Beacon (visual planning panel)
198
+ ${e}`});import{existsSync as gQ,mkdirSync as $Q,readFileSync as O,rmSync as BZ,writeFileSync as I}from"fs";import{dirname as TQ,join as b}from"path";function JQ(Q){try{return JSON.parse(O(Q,"utf8"))}catch{return{}}}function FQ(Q,Z){$Q(TQ(Q),{recursive:!0}),I(Q,JSON.stringify(Z,null,2)+`
199
+ `)}function A(Q,Z){let $=JQ(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((q)=>q.command===Z.command)))return!1;return J.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),FQ(Q,$),!0}function D(Q,Z){return(JQ(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>V.command===Z.command))}function E(Q,Z){let $=JQ(Q),J=$.hooks?.[Z.event];if(!J)return!1;let Y=!1,V=J.map((q)=>{let U=q.hooks?.length??0,z=(q.hooks??[]).filter((W)=>W.command!==Z.command);if(z.length!==U)Y=!0;return{...q,hooks:z}}).filter((q)=>(q.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 FQ(Q,$),!0}function y(Q,Z,$,J){let Y=`${Z}
200
+ ${J.trim()}
201
+ ${$}`,V="";try{V=O(Q,"utf8")}catch{}let q=new RegExp(`${Z}[\\s\\S]*?${$}`);V=q.test(V)?V.replace(q,Y):V.trim()?`${V.trim()}
202
+
203
+ ${Y}
204
+ `:`${Y}
205
+ `,$Q(TQ(Q),{recursive:!0}),I(Q,V.endsWith(`
206
+ `)?V:`${V}
207
+ `)}function u(Q,Z){try{return O(Q,"utf8").includes(Z)}catch{return!1}}function k(Q,Z,$){let J="";try{J=O(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 I(Q,V),!0}function L(Q,Z,$){let J=b(Q,Z);$Q(J,{recursive:!0});let Y=b(J,"SKILL.md");return I(Y,$),Y}function v(Q,Z){return gQ(b(Q,Z,"SKILL.md"))}function _(Q,Z){let $=b(Q,Z);if(!gQ($))return!1;return BZ($,{recursive:!0,force:!0}),!0}var YQ=()=>{};import{mkdirSync as HZ,renameSync as jZ,rmSync as GZ,writeFileSync as NZ}from"fs";import{dirname as KZ}from"path";function VQ(Q,Z){HZ(KZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{NZ($,Z),jZ($,Q)}catch(J){throw GZ($,{force:!0}),J}}var fQ=()=>{};var yQ={};r(yQ,{setupCodexAssets:()=>MZ,removeCodexMcp:()=>EQ,removeCodexArtifacts:()=>gZ,hasCodexMcp:()=>UQ,ensureCodexMcp:()=>DQ,codexMcpProblem:()=>CZ,codexDetected:()=>OQ,auditCodex:()=>wZ,CODEX_HOOKS:()=>c});import{readFileSync as p}from"fs";import{homedir as uZ}from"os";import{join as w}from"path";function RQ(){return process.env.HOME||process.env.USERPROFILE||uZ()}function OQ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(zQ===void 0)zQ=Bun.which("codex")!==null;return zQ}function M(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function UQ(){try{return Boolean(M(p(N(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function CZ(){let Q="";try{Q=p(N(),"utf8")}catch{return null}let Z=M(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${C}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${C}`;return null}function DQ(){let Q="",Z=!1;try{Q=p(N(),"utf8"),Z=!0}catch{}if(Z){let V=M(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${C}`};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 ${C}`}}let $=!Q?"":Q.endsWith(`
210
+ `)?`
211
+ `:`
212
+
213
+ `,J=Q+$+vZ;if(M(J)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${C}`};return VQ(N(),J),{added:!0}}function EQ(){let Q="";try{Q=p(N(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
214
+ `),$=Z.indexOf(IQ);if($===-1)return{removed:!1,skipped:UQ()};let J=Z.indexOf(AQ,$);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(M(Y)===null)return{removed:!1,skipped:!0};return VQ(N(),Y),{removed:!0}}async function MZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (ZQ(),QQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},Y=[];for(let z of B){if(!v(S(),z))Y.push(z);L(S(),z,J[z])}let V=0;for(let z of c)if(A(XQ(),{event:z.event,matcher:z.matcher,command:z.command}))V++;let q=u(h(),m);y(h(),m,bQ,WQ);let U=DQ();return{skillsAdded:Y,hooksAdded:V,agentsMdBlockTouched:!q,mcp:U}}function wZ(){let Q={};for(let $ of B)Q[$]=v(S(),$);let Z={};for(let $ of c)Z[$.event]=D(XQ(),{event:$.event,command:$.command});return{detected:OQ(),skills:Q,hooks:Z,agentsMdBlock:u(h(),m),mcp:UQ()}}function gZ(){let Q=[];for(let Y of B)if(_(S(),Y))Q.push(Y);let Z=0;for(let Y of c)if(E(XQ(),{event:Y.event,command:Y.command}))Z++;let $=k(h(),m,bQ),J=EQ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:J.removed,mcpSkipped:J.skipped}}var qQ=()=>w(RQ(),".codex"),XQ=()=>w(qQ(),"hooks.json"),N=()=>w(qQ(),"config.toml"),h=()=>w(qQ(),"AGENTS.md"),S=()=>w(RQ(),".agents","skills"),m="<!-- beacon:global:start -->",bQ="<!-- beacon:global:end -->",c,zQ,IQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",AQ="# beacon:end",vZ,C="add it manually: codex mcp add beacon -- beacon mcp";var kQ=j(()=>{YQ();fQ();PQ();c=[{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."}];vZ=`${IQ}
218
+ [mcp_servers.beacon]
219
+ command = "beacon"
220
+ args = ["mcp"]
221
+ ${AQ}
222
+ `});import{existsSync as TZ}from"fs";import{homedir as FZ}from"os";import{join as d}from"path";function fZ(){return process.env.HOME||process.env.USERPROFILE||FZ()}function RZ(Q,Z){return L(xQ(),Q,Z)}function _Q(Q){return v(xQ(),Q)}function bZ(Q){return _(xQ(),Q)}function OZ(Q){return A(BQ(),Q)}function IZ(Q){return D(BQ(),Q)}function AZ(Q){return E(BQ(),Q)}function DZ(Q){y(HQ(),jQ,LQ,Q)}function hQ(){return u(HQ(),jQ)}function EZ(){return k(HQ(),jQ,LQ)}function O0(){let Q={};for(let $ of B)Q[$]=_Q($);let Z={};for(let $ of GQ)Z[$.event]=IZ({event:$.event,command:$.command});return{homeExists:TZ(n()),skills:Q,hooks:Z,claudeMdBlock:hQ()}}async function yZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (ZQ(),QQ)),J={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},Y=[];for(let U of B){if(!_Q(U))Y.push(U);RZ(U,J[U])}let V=0;for(let U of GQ)if(OZ({event:U.event,matcher:U.matcher,command:U.command}))V++;let q=hQ();return DZ(WQ),{skillsAdded:Y,hooksAdded:V,claudeMdBlockTouched:!q}}async function SQ(){let Q;try{Q={ok:!0,...await yZ()}}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(() => (kQ(),yQ));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 I0(){let Q=[];for(let J of B)if(bZ(J))Q.push(J);let Z=0;for(let J of GQ)if(AZ(J))Z++;let $=EZ();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}var n=()=>d(fZ(),".claude"),xQ=()=>d(n(),"skills"),BQ=()=>d(n(),"settings.json"),HQ=()=>d(n(),"CLAUDE.md"),jQ="<!-- beacon:global:start -->",LQ="<!-- beacon:global:end -->",B,GQ,WQ=`## Beacon (visual planning panel)
196
223
 
197
224
  This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
198
225
  agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
@@ -213,15 +240,5 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
213
240
  Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
214
241
  on the /map and /db boards (added features, attached subtasks, edited columns, new
215
242
  endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
216
- verbatim. Do NOT implement until the tool returns approval.`;function DQ(Q,X){let Z=G(g(),Q);_(Z,{recursive:!0});let $=G(Z,"SKILL.md");return u($,X),$}function e(Q){return k(G(g(),Q,"SKILL.md"))}function AQ(Q){let X=G(g(),Q);if(!k(X))return!1;return EQ(X,{recursive:!0,force:!0}),!0}function y(){try{return JSON.parse(K(i(),"utf8"))}catch{return{}}}function QQ(Q){_(P(),{recursive:!0}),u(i(),JSON.stringify(Q,null,2)+`
217
- `)}function RQ(Q){let X=y();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}]}),QQ(X),!0}function kQ(Q){return(y().hooks?.[Q.event]??[]).some(($)=>$.hooks?.some((J)=>J.command===Q.command))}function _Q(Q){let X=y(),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 QQ(X),!0}function gQ(Q){let X=`${C}
218
- ${Q.trim()}
219
- ${R}`,Z="";try{Z=K(j(),"utf8")}catch{}let $=new RegExp(`${C}[\\s\\S]*?${R}`);Z=$.test(Z)?Z.replace($,X):Z.trim()?`${Z.trim()}
220
-
221
- ${X}
222
- `:`${X}
223
- `,_(P(),{recursive:!0}),u(j(),Z.endsWith(`
224
- `)?Z:`${Z}
225
- `)}function XQ(){try{return K(j(),"utf8").includes(C)}catch{return!1}}function bQ(){let Q="";try{Q=K(j(),"utf8")}catch{return!1}let X=new RegExp(`${C}[\\s\\S]*?${R}\\n?`);if(!X.test(Q))return!1;let Z=Q.replace(X,"").replace(/\n{3,}/g,`
226
-
227
- `).trimStart();return u(j(),Z),!0}function PX(){let Q={};for(let Z of b)Q[Z]=e(Z);let X={};for(let Z of L)X[Z.event]=kQ({event:Z.event,command:Z.command});return{homeExists:k(P()),skills:Q,hooks:X,claudeMdBlock:XQ()}}async function LQ(){let{INIT_SKILL:Q,REFRESH_SKILL:X,PLAN_SKILL:Z}=await Promise.resolve().then(() => (r(),o)),$={"beacon-init":Q,"beacon-refresh":X,"beacon-plan":Z},J=[];for(let z of b){if(!e(z))J.push(z);DQ(z,$[z])}let Y=0;for(let z of L)if(RQ({event:z.event,matcher:z.matcher,command:z.command}))Y++;let H=XQ();return gQ(FQ),{skillsAdded:J,hooksAdded:Y,claudeMdBlockTouched:!H}}async function ZQ(){try{return{ok:!0,...await LQ()}}catch(Q){return{ok:!1,error:Q instanceof Error?Q.message:String(Q),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}}function vX(){let Q=[];for(let $ of b)if(AQ($))Q.push($);let X=0;for(let $ of L)if(_Q($))X++;let Z=bQ();return{skillsRemoved:Q,hooksRemoved:X,claudeMdBlockRemoved:Z}}import{AsyncLocalStorage as oQ}from"async_hooks";import{spawnSync as rQ}from"child_process";import{createHash as iQ}from"crypto";import{existsSync as zQ,mkdirSync as O,readFileSync as qQ,writeFileSync as HQ}from"fs";import{homedir as eQ}from"os";import{basename as QX,join as v}from"path";function T(){return process.env.BEACON_HOME||v(eQ(),".beacon")}function S(){return v(T(),"workspaces.json")}function E(Q){return iQ("sha256").update(Q).digest("hex").slice(0,12)}function NQ(Q=process.cwd()){let X=rQ("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 m(Q){return v(T(),Q)}function XX(Q){return`file:${v(m(Q),"db.sqlite")}`}function W(){try{let Q=JSON.parse(qQ(S(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function p(Q){O(T(),{recursive:!0}),HQ(S(),JSON.stringify(Q,null,2))}function ZX(){return W().sort((Q,X)=>X.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function U(Q){return W().find((X)=>X.id===Q)??null}function $X(Q,X,Z=new Date().toISOString()){let $=E(Q),J=W(),Y=J.find((V)=>V.id===$),H={id:$,path:Q,name:X||Y?.name||QX(Q),lastOpenedAt:Z},z=[H,...J.filter((V)=>V.id!==$)];return O(m($),{recursive:!0}),p(z),H}function DX(Q,X=new Date().toISOString()){let Z=W(),$=Z.find((J)=>J.id===Q);if(!$)return;$.lastOpenedAt=X,p(Z)}function AX(Q){if(p(W().filter((X)=>X.id!==Q)),c()===Q)JX(ZX()[0]?.id??null)}function xQ(){return v(T(),"active")}function c(){try{return qQ(xQ(),"utf8").trim()||null}catch{return null}}function JX(Q){O(T(),{recursive:!0}),HQ(xQ(),Q??"")}function RX(){let Q=c();return Q?U(Q):null}function kX(){let Q=VX()??c();return Q?U(Q):null}function _X(Q){return U(Q)?.path??null}function gX(){return zQ(S())}var BQ="beacon_ws";function GQ(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 bX(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&U(X))return X;let Z=GQ(Q,BQ);if(Z&&U(Z))return Z;return null}var YX="x-beacon-workspace-path";async function LX(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&U(X))return X;let Z=Q.headers.get(YX);if(Z&&(!X||E(Z)===X)){let J=$X(Z);return await zX(J.id),J.id}let $=GQ(Q,BQ);if($&&U($))return $;return null}var UQ=new oQ;function yX(Q,X){return Q?UQ.run(Q,X):X()}function VX(){return UQ.getStore()??null}var VQ=new Set;async function zX(Q){let X=m(Q),Z=v(X,"db.sqlite"),$=zQ(Z);if($&&VQ.has(Z))return{ok:!0,created:!1,migrated:!1};try{O(X,{recursive:!0});let{provisionDb:J}=await YQ().then(() => JQ),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)}}}var qX=process.env.BEACON_URL||`http://localhost:${process.env.PORT||4319}`;await ZQ();var PQ="";for await(let Q of process.stdin)PQ+=Q;try{let Q=JSON.parse(PQ||"{}"),X=Q.tool_input??{},Z=[];if(typeof X.file_path==="string")Z.push(X.file_path);if(typeof X.path==="string")Z.push(X.path);if(Array.isArray(X.files)){for(let $ of X.files)if(typeof $?.file_path==="string")Z.push($.file_path)}if(Z.length){let $=E(NQ(typeof Q.cwd==="string"?Q.cwd:void 0));await fetch(`${qX}/api/map/touch-active`,{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":$},body:JSON.stringify({files:Z})}).catch(()=>{})}}catch{}process.exit(0);
243
+ verbatim. Do NOT implement until the tool returns approval.`;var PQ=j(()=>{YQ();B=["beacon-init","beacon-refresh","beacon-plan"],GQ=[{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 pQ={};r(pQ,{provisionDb:()=>sZ});import{createClient as kZ}from"@libsql/client";import{drizzle as LZ}from"drizzle-orm/libsql";import{migrate as _Z}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as hZ}from"drizzle-orm/migrator";import{dirname as NQ,join as SZ}from"path";import{fileURLToPath as mZ}from"url";async function a(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function nZ(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((J)=>String(J.name)))}async function mQ(Q){if(!await a(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 aZ(Q){for(let[Z,$]of Object.entries(dZ)){if(!await a(Q,Z))continue;let J=await nZ(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 sZ(Q,Z=cZ){let $=kZ({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;");let J=await a($,"__drizzle_migrations"),Y=await a($,"Node"),V=!1;if(Y&&!J){let U=hZ({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 q=await mQ($);if(await _Z(LZ($),{migrationsFolder:Z}),await mQ($)>q)V=!0;return await aZ($),{migrated:V}}finally{$.close()}}var pZ,cZ,dZ;var cQ=j(async()=>{pZ=NQ(NQ(NQ(mZ(import.meta.url)))),cZ=process.env.BEACON_MIGRATIONS_DIR||SZ(pZ,"drizzle"),dZ={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 tZ}from"async_hooks";import{spawnSync as lZ}from"child_process";import{createHash as rZ}from"crypto";import{existsSync as nQ,mkdirSync as s,readFileSync as aQ,writeFileSync as sQ}from"fs";import{homedir as oZ}from"os";import{basename as iZ,join as K}from"path";function g(){return process.env.BEACON_HOME||K(oZ(),".beacon")}function KQ(){return K(g(),"workspaces.json")}function t(Q){return rZ("sha256").update(Q).digest("hex").slice(0,12)}function tQ(Q=process.cwd()){let Z=lZ("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 uQ(Q){return K(g(),Q)}function eZ(Q){return`file:${K(uQ(Q),"db.sqlite")}`}function T(){try{let Q=JSON.parse(aQ(KQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function vQ(Q){s(g(),{recursive:!0}),sQ(KQ(),JSON.stringify(Q,null,2))}function Q0(){return T().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function H(Q){return T().find((Z)=>Z.id===Q)??null}function Z0(Q,Z,$=new Date().toISOString()){let J=t(Q),Y=T(),V=Y.find((z)=>z.id===J),q={id:J,path:Q,name:Z||V?.name||iZ(Q),lastOpenedAt:$},U=[q,...Y.filter((z)=>z.id!==J)];return s(uQ(J),{recursive:!0}),vQ(U),q}function n0(Q,Z=new Date().toISOString()){let $=T(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,vQ($)}function a0(Q){if(vQ(T().filter((Z)=>Z.id!==Q)),CQ()===Q)$0(Q0()[0]?.id??null)}function lQ(){return K(g(),"active")}function CQ(){try{return aQ(lQ(),"utf8").trim()||null}catch{return null}}function $0(Q){s(g(),{recursive:!0}),sQ(lQ(),Q??"")}function s0(){let Q=CQ();return Q?H(Q):null}function t0(){let Q=Y0()??CQ();return Q?H(Q):null}function l0(Q){return H(Q)?.path??null}function r0(){return nQ(KQ())}var rQ="beacon_ws";function oQ(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 o0(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&H(Z))return Z;let $=oQ(Q,rQ);if($&&H($))return $;return null}var J0="x-beacon-workspace-path";async function i0(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&H(Z))return Z;let $=Q.headers.get(J0);if($&&(!Z||t($)===Z)){let Y=Z0($);return await V0(Y.id),Y.id}let J=oQ(Q,rQ);if(J&&H(J))return J;return null}var iQ=new tZ;function e0(Q,Z){return Q?iQ.run(Q,Z):Z()}function Y0(){return iQ.getStore()??null}var dQ=new Set;async function V0(Q){let Z=uQ(Q),$=K(Z,"db.sqlite"),J=nQ($);if(J&&dQ.has($))return{ok:!0,created:!1,migrated:!1};try{s(Z,{recursive:!0});let{provisionDb:Y}=await cQ().then(() => pQ),V=await Y(eZ(Q));return dQ.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)}}}PQ();import{resolve as z0}from"path";var q0="*** Begin Patch",X0=/^\*\*\* (Update File|Add File|Move to): (.+)$/;function U0(Q){let Z=[];for(let $ of Q.split(`
244
+ `)){let J=X0.exec($.trim());if(!J)continue;let Y=J[2].trim();if(J[1]==="Move to")Z.pop();Z.push(Y)}return Z}function eQ(Q){let Z=Q.tool_input;if(Z===null||typeof Z!=="object")return[];let $=Z,J=[];if(typeof $.file_path==="string")J.push($.file_path);if(typeof $.path==="string")J.push($.path);if(Array.isArray($.files))for(let V of $.files){let q=V?.file_path;if(typeof q==="string")J.push(q)}if(J.length)return J;let Y=typeof Q.cwd==="string"?Q.cwd:process.cwd();for(let V of Object.values($)){if(typeof V!=="string"||!V.includes(q0))continue;return U0(V).map((q)=>z0(Y,q))}return[]}var W0=process.env.BEACON_URL||`http://localhost:${process.env.PORT||4319}`;await SQ();var QZ="";for await(let Q of process.stdin)QZ+=Q;try{let Q=JSON.parse(QZ||"{}"),Z=eQ(Q);if(Z.length){let $=t(tQ(typeof Q.cwd==="string"?Q.cwd:void 0));await fetch(`${W0}/api/map/touch-active`,{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":$},body:JSON.stringify({files:Z})}).catch(()=>{})}}catch{}process.exit(0);