prjct-cli 3.88.0 → 3.91.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/bin/hook-chunks/agent-identity-45BYQBU2.mjs +8 -0
  3. package/dist/bin/hook-chunks/agent-switch-IQ5KSRKD.mjs +22 -0
  4. package/dist/bin/hook-chunks/analysis-LBYZSJKT.mjs +42 -0
  5. package/dist/bin/hook-chunks/auth-config-WNUARXTJ.mjs +8 -0
  6. package/dist/bin/hook-chunks/auto-flush-GW3FP763.mjs +8 -0
  7. package/dist/bin/hook-chunks/auto-updater-EHRRMCYY.mjs +9 -0
  8. package/dist/bin/hook-chunks/capture-gate-BQCNMHUC.mjs +8 -0
  9. package/dist/bin/hook-chunks/chunk-2NMSEZTQ.mjs +8 -0
  10. package/dist/bin/hook-chunks/chunk-2OU2MKNS.mjs +8 -0
  11. package/dist/bin/hook-chunks/chunk-2UC4DTDO.mjs +9 -0
  12. package/dist/bin/hook-chunks/chunk-3FBCOCPD.mjs +8 -0
  13. package/dist/bin/hook-chunks/chunk-3JUE6MNF.mjs +8 -0
  14. package/dist/bin/hook-chunks/chunk-3LG3ACQV.mjs +8 -0
  15. package/dist/bin/hook-chunks/chunk-3WKDMAS7.mjs +16 -0
  16. package/dist/bin/hook-chunks/chunk-45I2C2UB.mjs +25 -0
  17. package/dist/bin/hook-chunks/chunk-4DDCWMI6.mjs +8 -0
  18. package/dist/bin/hook-chunks/chunk-4KY2EHXS.mjs +9 -0
  19. package/dist/bin/hook-chunks/chunk-4WHS7CO7.mjs +8 -0
  20. package/dist/bin/hook-chunks/chunk-54LH63LM.mjs +7 -0
  21. package/dist/bin/hook-chunks/chunk-5TBQNW2G.mjs +17 -0
  22. package/dist/bin/hook-chunks/chunk-5WAONIPX.mjs +8 -0
  23. package/dist/bin/hook-chunks/chunk-6AFM6WRB.mjs +13 -0
  24. package/dist/bin/hook-chunks/chunk-6EWGHM32.mjs +9 -0
  25. package/dist/bin/hook-chunks/chunk-6IKHMK2U.mjs +10 -0
  26. package/dist/bin/hook-chunks/chunk-75UJIVMO.mjs +10 -0
  27. package/dist/bin/hook-chunks/chunk-7OZDWT6C.mjs +9 -0
  28. package/dist/bin/hook-chunks/chunk-7SI6X3Z7.mjs +8 -0
  29. package/dist/bin/hook-chunks/chunk-A5MUSARI.mjs +9 -0
  30. package/dist/bin/hook-chunks/chunk-A5RNWWTH.mjs +9 -0
  31. package/dist/bin/hook-chunks/chunk-AEYONUUY.mjs +31 -0
  32. package/dist/bin/hook-chunks/chunk-AKIN5WSQ.mjs +9 -0
  33. package/dist/bin/hook-chunks/chunk-AOPJ4Z6O.mjs +8 -0
  34. package/dist/bin/hook-chunks/chunk-AUUWQH3S.mjs +14 -0
  35. package/dist/bin/hook-chunks/chunk-AW25AWN5.mjs +31 -0
  36. package/dist/bin/hook-chunks/chunk-B7GMU46T.mjs +71 -0
  37. package/dist/bin/hook-chunks/chunk-BISPGBNN.mjs +35 -0
  38. package/dist/bin/hook-chunks/chunk-BUDZL4DW.mjs +8 -0
  39. package/dist/bin/hook-chunks/chunk-CE4RCNC7.mjs +8 -0
  40. package/dist/bin/hook-chunks/chunk-CQHPIYNM.mjs +8 -0
  41. package/dist/bin/hook-chunks/chunk-CREPUNOS.mjs +24 -0
  42. package/dist/bin/hook-chunks/chunk-CTWZQ7YI.mjs +8 -0
  43. package/dist/bin/hook-chunks/chunk-D4S3IRD3.mjs +8 -0
  44. package/dist/bin/hook-chunks/chunk-D6KT763C.mjs +9 -0
  45. package/dist/bin/hook-chunks/chunk-D7TRY3CO.mjs +8 -0
  46. package/dist/bin/hook-chunks/chunk-DGQYQSUK.mjs +19 -0
  47. package/dist/bin/hook-chunks/chunk-DMXFGLZE.mjs +21 -0
  48. package/dist/bin/hook-chunks/chunk-DXQMKW2B.mjs +10 -0
  49. package/dist/bin/hook-chunks/chunk-DYHYDHCW.mjs +8 -0
  50. package/dist/bin/hook-chunks/chunk-E66B27AL.mjs +8 -0
  51. package/dist/bin/hook-chunks/chunk-EHBEHLYN.mjs +15 -0
  52. package/dist/bin/hook-chunks/chunk-EM6ZDJAK.mjs +45 -0
  53. package/dist/bin/hook-chunks/chunk-FEH4IPIC.mjs +15 -0
  54. package/dist/bin/hook-chunks/chunk-FGQZ62ZP.mjs +47 -0
  55. package/dist/bin/hook-chunks/chunk-GAOQHD5S.mjs +8 -0
  56. package/dist/bin/hook-chunks/chunk-GCKILEXJ.mjs +8 -0
  57. package/dist/bin/hook-chunks/chunk-GVNMXVVA.mjs +8 -0
  58. package/dist/bin/hook-chunks/chunk-HBLR7BVG.mjs +11 -0
  59. package/dist/bin/hook-chunks/chunk-HDHVBB6Q.mjs +1260 -0
  60. package/dist/bin/hook-chunks/chunk-HDSS6UB3.mjs +8 -0
  61. package/dist/bin/hook-chunks/chunk-HJ4HEI45.mjs +8 -0
  62. package/dist/bin/hook-chunks/chunk-HZIORCPO.mjs +16 -0
  63. package/dist/bin/hook-chunks/chunk-IKUGYUAI.mjs +8 -0
  64. package/dist/bin/hook-chunks/chunk-J6JZ4PQA.mjs +18 -0
  65. package/dist/bin/hook-chunks/chunk-JQE2F2RK.mjs +8 -0
  66. package/dist/bin/hook-chunks/chunk-KEJ5RMAI.mjs +9 -0
  67. package/dist/bin/hook-chunks/chunk-L4COZ7ZH.mjs +13 -0
  68. package/dist/bin/hook-chunks/chunk-LGJUQEAU.mjs +8 -0
  69. package/dist/bin/hook-chunks/chunk-LJLUP4FF.mjs +8 -0
  70. package/dist/bin/hook-chunks/chunk-LLQUB6YR.mjs +11 -0
  71. package/dist/bin/hook-chunks/chunk-LPB3HUJ2.mjs +19 -0
  72. package/dist/bin/hook-chunks/chunk-LT5WSSQO.mjs +8 -0
  73. package/dist/bin/hook-chunks/chunk-LWCHQIJ7.mjs +11 -0
  74. package/dist/bin/hook-chunks/chunk-M3ZOJVPA.mjs +13 -0
  75. package/dist/bin/hook-chunks/chunk-MEQS4VPO.mjs +8 -0
  76. package/dist/bin/hook-chunks/chunk-MXHX44WF.mjs +9 -0
  77. package/dist/bin/hook-chunks/chunk-N5WOHG36.mjs +8 -0
  78. package/dist/bin/hook-chunks/chunk-NJAMZSHM.mjs +26 -0
  79. package/dist/bin/hook-chunks/chunk-NLG2EW6M.mjs +8 -0
  80. package/dist/bin/hook-chunks/chunk-NWY5M34K.mjs +12 -0
  81. package/dist/bin/hook-chunks/chunk-ODWWIFSN.mjs +9 -0
  82. package/dist/bin/hook-chunks/chunk-OIEZAHLC.mjs +16 -0
  83. package/dist/bin/hook-chunks/chunk-PKDYFXMI.mjs +8 -0
  84. package/dist/bin/hook-chunks/chunk-PSP56GGF.mjs +13 -0
  85. package/dist/bin/hook-chunks/chunk-PSSR7LSW.mjs +8 -0
  86. package/dist/bin/hook-chunks/chunk-PW3KYKVS.mjs +9 -0
  87. package/dist/bin/hook-chunks/chunk-PXJKXBTM.mjs +53 -0
  88. package/dist/bin/hook-chunks/chunk-Q5I2UPD6.mjs +9 -0
  89. package/dist/bin/hook-chunks/chunk-QDQ7DTDV.mjs +8 -0
  90. package/dist/bin/hook-chunks/chunk-QSAA6LZF.mjs +8 -0
  91. package/dist/bin/hook-chunks/chunk-QZSJSXJV.mjs +10 -0
  92. package/dist/bin/hook-chunks/chunk-RAHFKGM6.mjs +19 -0
  93. package/dist/bin/hook-chunks/chunk-RJ2BRRMH.mjs +38 -0
  94. package/dist/bin/hook-chunks/chunk-RRWPDRYR.mjs +43 -0
  95. package/dist/bin/hook-chunks/chunk-SJ75V4WG.mjs +9 -0
  96. package/dist/bin/hook-chunks/chunk-SOPRYWUY.mjs +11 -0
  97. package/dist/bin/hook-chunks/chunk-SVZHJZ5T.mjs +9 -0
  98. package/dist/bin/hook-chunks/chunk-SYHDEUVU.mjs +10 -0
  99. package/dist/bin/hook-chunks/chunk-TFGJVT6F.mjs +8 -0
  100. package/dist/bin/hook-chunks/chunk-TPESWBA7.mjs +8 -0
  101. package/dist/bin/hook-chunks/chunk-TRMBRDKH.mjs +8 -0
  102. package/dist/bin/hook-chunks/chunk-TXJT3G53.mjs +10 -0
  103. package/dist/bin/hook-chunks/chunk-UHW35BPE.mjs +18 -0
  104. package/dist/bin/hook-chunks/chunk-UQVJQME2.mjs +8 -0
  105. package/dist/bin/hook-chunks/chunk-UUULLTQV.mjs +8 -0
  106. package/dist/bin/hook-chunks/chunk-V37VTXDW.mjs +10 -0
  107. package/dist/bin/hook-chunks/chunk-W5OWBOLH.mjs +8 -0
  108. package/dist/bin/hook-chunks/chunk-WDGDFXSB.mjs +10 -0
  109. package/dist/bin/hook-chunks/chunk-WUHGODSQ.mjs +8 -0
  110. package/dist/bin/hook-chunks/chunk-X5RDLFPM.mjs +8 -0
  111. package/dist/bin/hook-chunks/chunk-XEFIIDHM.mjs +11 -0
  112. package/dist/bin/hook-chunks/chunk-Y5NQV46G.mjs +9 -0
  113. package/dist/bin/hook-chunks/chunk-YG7KBQYJ.mjs +16 -0
  114. package/dist/bin/hook-chunks/chunk-YJMWY4Y6.mjs +8 -0
  115. package/dist/bin/hook-chunks/chunk-YKMJI6TF.mjs +14 -0
  116. package/dist/bin/hook-chunks/chunk-YUOTOCKK.mjs +103 -0
  117. package/dist/bin/hook-chunks/chunk-ZTZTVBAZ.mjs +12 -0
  118. package/dist/bin/hook-chunks/chunk-ZX2KFQV5.mjs +11 -0
  119. package/dist/bin/hook-chunks/chunk-ZZ65CN5F.mjs +20 -0
  120. package/dist/bin/hook-chunks/client-SKFMAUI5.mjs +10 -0
  121. package/dist/bin/hook-chunks/code-graph-cloud-65GCWNII.mjs +8 -0
  122. package/dist/bin/hook-chunks/codex-skill-7IURPY6B.mjs +8 -0
  123. package/dist/bin/hook-chunks/command-installer-BVHQUSL4.mjs +8 -0
  124. package/dist/bin/hook-chunks/config-manager-KYC7WUOS.mjs +8 -0
  125. package/dist/bin/hook-chunks/content-bound-stamp-72EQVZLP.mjs +10 -0
  126. package/dist/bin/hook-chunks/context-pressure-OUN5PFMN.mjs +8 -0
  127. package/dist/bin/hook-chunks/context7-service-4C6VNJUS.mjs +8 -0
  128. package/dist/bin/hook-chunks/custom-workflow-storage-M77INP6Z.mjs +8 -0
  129. package/dist/bin/hook-chunks/cwd-changed-56X7BNS6.mjs +8 -0
  130. package/dist/bin/hook-chunks/cycle-budget-card-O5WAGNGC.mjs +9 -0
  131. package/dist/bin/hook-chunks/database-SLDTQXWG.mjs +8 -0
  132. package/dist/bin/hook-chunks/delivery-geometry-VHCURJ7E.mjs +8 -0
  133. package/dist/bin/hook-chunks/detect-changes-6N4DCWXQ.mjs +17 -0
  134. package/dist/bin/hook-chunks/detection-MEYHME4X.mjs +8 -0
  135. package/dist/bin/hook-chunks/developer-evolution-R5BXQH6G.mjs +12 -0
  136. package/dist/bin/hook-chunks/discuss-lock-55GER2LR.mjs +8 -0
  137. package/dist/bin/hook-chunks/distill-6C6YIFOE.mjs +8 -0
  138. package/dist/bin/hook-chunks/drift-refresh-TD3PYPJN.mjs +8 -0
  139. package/dist/bin/hook-chunks/editors-config-3N6VREZR.mjs +8 -0
  140. package/dist/bin/hook-chunks/enriched-recall-6ZZNKAJZ.mjs +8 -0
  141. package/dist/bin/hook-chunks/exec-I7XE7NMD.mjs +8 -0
  142. package/dist/bin/hook-chunks/format-YOYMJSLY.mjs +8 -0
  143. package/dist/bin/hook-chunks/git-helpers-6JLP2OJZ.mjs +8 -0
  144. package/dist/bin/hook-chunks/infer-memory-file-PIAZ542H.mjs +8 -0
  145. package/dist/bin/hook-chunks/judgment-ledger-storage-UKROWRVA.mjs +8 -0
  146. package/dist/bin/hook-chunks/judgment-orchestrator-UFGNBTEK.mjs +8 -0
  147. package/dist/bin/hook-chunks/judgment-receipt-2U7D6HS4.mjs +8 -0
  148. package/dist/bin/hook-chunks/land-cue-SS23JBAX.mjs +9 -0
  149. package/dist/bin/hook-chunks/land-synthesis-OATL5BNP.mjs +8 -0
  150. package/dist/bin/hook-chunks/legacy-crew-sweep-NH5EWEXF.mjs +24 -0
  151. package/dist/bin/hook-chunks/memory-index-677MUBCZ.mjs +10 -0
  152. package/dist/bin/hook-chunks/notification-S2IJJ6JW.mjs +8 -0
  153. package/dist/bin/hook-chunks/nyquist-lite-GE7OAFLC.mjs +10 -0
  154. package/dist/bin/hook-chunks/pack-integrity-L3BL7CGO.mjs +10 -0
  155. package/dist/bin/hook-chunks/pack-manager-SU53HCKK.mjs +8 -0
  156. package/dist/bin/hook-chunks/package-legitimacy-HXC4L73B.mjs +8 -0
  157. package/dist/bin/hook-chunks/path-manager-F2HE2GGK.mjs +8 -0
  158. package/dist/bin/hook-chunks/planning-ZYFCFU7N.mjs +9 -0
  159. package/dist/bin/hook-chunks/post-edit-JD7YFEBZ.mjs +8 -0
  160. package/dist/bin/hook-chunks/pr-convention-7UGI7TFA.mjs +8 -0
  161. package/dist/bin/hook-chunks/pre-bash-VIABNO5E.mjs +11 -0
  162. package/dist/bin/hook-chunks/pre-commit-NVQVXHZQ.mjs +8 -0
  163. package/dist/bin/hook-chunks/pre-edit-V4RD45C4.mjs +11 -0
  164. package/dist/bin/hook-chunks/pre-package-KFJZXI5T.mjs +8 -0
  165. package/dist/bin/hook-chunks/pre-search-7KRU5D2O.mjs +9 -0
  166. package/dist/bin/hook-chunks/pre-secrets-IE5NX5X5.mjs +8 -0
  167. package/dist/bin/hook-chunks/precision-classifier-IVVAXE26.mjs +8 -0
  168. package/dist/bin/hook-chunks/precision-judgment-WPTCNTGV.mjs +8 -0
  169. package/dist/bin/hook-chunks/prjct-md-FMCPUMQT.mjs +8 -0
  170. package/dist/bin/hook-chunks/project-agent-surfaces-TD7BHI25.mjs +8 -0
  171. package/dist/bin/hook-chunks/project-file-inventory-ZAPKPKY6.mjs +8 -0
  172. package/dist/bin/hook-chunks/project-memory-ZVZSLPB5.mjs +8 -0
  173. package/dist/bin/hook-chunks/project-style-evolution-7JS75AUP.mjs +8 -0
  174. package/dist/bin/hook-chunks/prompt-S4MMIXH5.mjs +22 -0
  175. package/dist/bin/hook-chunks/publish-helper-I37V4L7U.mjs +8 -0
  176. package/dist/bin/hook-chunks/purge-BDREPWEE.mjs +8 -0
  177. package/dist/bin/hook-chunks/retention-D2MVQLOF.mjs +8 -0
  178. package/dist/bin/hook-chunks/sdd-ZO4DP23G.mjs +10 -0
  179. package/dist/bin/hook-chunks/session-continuity-FNNUMOXB.mjs +11 -0
  180. package/dist/bin/hook-chunks/session-start-HA7IRBFX.mjs +8 -0
  181. package/dist/bin/hook-chunks/settings-installer-QDM3GB6J.mjs +9 -0
  182. package/dist/bin/hook-chunks/setup-7L3NXNRH.mjs +142 -0
  183. package/dist/bin/hook-chunks/shipping-GX4HFYJ3.mjs +13 -0
  184. package/dist/bin/hook-chunks/skill-index-OOVAXHYJ.mjs +12 -0
  185. package/dist/bin/hook-chunks/spec-context-inference-KER2R3F3.mjs +15 -0
  186. package/dist/bin/hook-chunks/spec-service-G3RLCJ2G.mjs +11 -0
  187. package/dist/bin/hook-chunks/spec-task-breakdown-YPJ76OWR.mjs +8 -0
  188. package/dist/bin/hook-chunks/state-storage-KNGP2CQV.mjs +8 -0
  189. package/dist/bin/hook-chunks/stop-HPZCLDPM.mjs +17 -0
  190. package/dist/bin/hook-chunks/subagent-start-7KZUTKV5.mjs +8 -0
  191. package/dist/bin/hook-chunks/subagent-stop-7C72RWGO.mjs +8 -0
  192. package/dist/bin/hook-chunks/surface-attribution-PDYR6DVA.mjs +8 -0
  193. package/dist/bin/hook-chunks/symbol-graph-LZM4RZXZ.mjs +8 -0
  194. package/dist/bin/hook-chunks/sync-analyzer-FKC57RTV.mjs +8 -0
  195. package/dist/bin/hook-chunks/sync-client-DJWOG2ZQ.mjs +8 -0
  196. package/dist/bin/hook-chunks/sync-cursor-storage-2VKG757H.mjs +19 -0
  197. package/dist/bin/hook-chunks/task-orchestration-MLOCR7GA.mjs +8 -0
  198. package/dist/bin/hook-chunks/task-overview-6ZQKJGSH.mjs +8 -0
  199. package/dist/bin/hook-chunks/task-service-RRFG5P7N.mjs +8 -0
  200. package/dist/bin/hook-chunks/tdd-XQUU4C23.mjs +10 -0
  201. package/dist/bin/hook-chunks/template-loader-4QMIMOBY.mjs +8 -0
  202. package/dist/bin/hook-chunks/transcript-jsonl-6X4DDD6R.mjs +8 -0
  203. package/dist/bin/hook-chunks/trust-boundary-ERMDF2C5.mjs +8 -0
  204. package/dist/bin/hook-chunks/usefulness-253CZLNY.mjs +8 -0
  205. package/dist/bin/hook-chunks/vault-retire-notice-GRT3QRLZ.mjs +9 -0
  206. package/dist/bin/hook-chunks/velocity-storage-UPW6TLK6.mjs +8 -0
  207. package/dist/bin/hook-chunks/weak-model-mode-M6D23IIM.mjs +8 -0
  208. package/dist/bin/hook-chunks/work-graph-QJGNBVIP.mjs +49 -0
  209. package/dist/bin/hook-chunks/work-scope-6FG6PSAV.mjs +8 -0
  210. package/dist/bin/hook-chunks/workspace-occupancy-UVIRHY5Z.mjs +8 -0
  211. package/dist/bin/hook-chunks/worktree-service-XGRN5TTE.mjs +12 -0
  212. package/dist/bin/hook-fast-darwin-arm64 +0 -0
  213. package/dist/bin/hook-fast-darwin-x64 +0 -0
  214. package/dist/bin/hook-fast-linux-x64 +0 -0
  215. package/dist/bin/prjct-core.mjs +625 -624
  216. package/dist/bin/prjct-hooks.mjs +3 -2282
  217. package/dist/bin/prjct.mjs +17 -2
  218. package/dist/daemon/entry.mjs +545 -544
  219. package/dist/mcp/server.mjs +196 -195
  220. package/package.json +1 -1
@@ -0,0 +1,142 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a as H}from"./chunk-AW25AWN5.mjs";import{a as J}from"./chunk-A5RNWWTH.mjs";import"./chunk-HZIORCPO.mjs";import"./chunk-WDGDFXSB.mjs";import"./chunk-NWY5M34K.mjs";import"./chunk-LWCHQIJ7.mjs";import{c as z,d as G}from"./chunk-PXJKXBTM.mjs";import{a as i}from"./chunk-6AFM6WRB.mjs";import"./chunk-J6JZ4PQA.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import{c as B}from"./chunk-3JUE6MNF.mjs";import"./chunk-3FBCOCPD.mjs";import{a as K,b as F,c as g}from"./chunk-YUOTOCKK.mjs";import"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import{b as E}from"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{d as v}from"./chunk-HBLR7BVG.mjs";import{q as O,r as N,s as $,t as se}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import{f as D,g as U,j as T,n as ae}from"./chunk-SVZHJZ5T.mjs";import{a as _,o as oe}from"./chunk-CTWZQ7YI.mjs";import"./chunk-OIEZAHLC.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import{b as P,e as ie}from"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import{e as k,f as ne}from"./chunk-BUDZL4DW.mjs";import{a as m,e as M}from"./chunk-E66B27AL.mjs";import j from"node:fs/promises";import ce from"node:http";import R from"node:path";import a from"chalk";se();import{createHash as re,randomBytes as V}from"node:crypto";var q="pkce-v1",W=32;function L(r){return r.toString("base64url")}m(L,"base64Url");function Y(){let r=L(V(W)),e=L(V(W)),t=L(re("sha256").update(r,"ascii").digest());return{state:e,codeVerifier:r,codeChallenge:t,codeChallengeMethod:"S256"}}m(Y,"generatePkceMaterial");function Q(r){return new URLSearchParams({flow:q,port:String(r.port),device_id:r.deviceId,hostname:r.hostname,state:r.state,code_challenge:r.codeChallenge,code_challenge_method:"S256"})}m(Q,"buildCliLoginSearchParams");function X(r,e){if(r.get("key"))return{ok:!1,reason:"legacy-bearer",message:"This CLI requires PKCE login. Update the web app or set flow=pkce-v1; bearer tokens in the callback URL are no longer accepted."};let o=r.get("code"),n=r.get("state");return!o||!n?{ok:!1,reason:"missing",message:"Missing authorization code or state in callback"}:n!==e?{ok:!1,reason:"mismatch",message:"Login state mismatch \u2014 try `prjct login` again"}:{ok:!0,code:o,state:n}}m(X,"parsePkceCallback");function Z(r){return{flow:q,code:r.code,state:r.state,code_verifier:r.codeVerifier,device_id:r.deviceId,redirect_uri:`http://127.0.0.1:${r.port}/callback`}}m(Z,"buildExchangeBody");function ee(r){if(!r||typeof r!="object")return null;let e=r,t=e.apiKey??e.api_key,o=e.userId??e.user_id,n=e.email,s=e.deviceId??e.device_id;return!t||!o||!n||!s?null:{apiKey:t,userId:o,email:n,deviceId:s}}m(ee,"parseMintedKeyResponse");ne();oe();ae();ie();var te=class extends G{static{m(this,"SetupCommands")}async auth(e=null,t={}){switch(e?.split(" ")[0]||"status"){case"login":return t.md||i.fail("Manual token login is not supported. Run prjct login."),{success:!1,message:t.md?"## Error\nManual token login is not supported. Run `prjct login`.":""};case"logout":return await g.clearAuth(),await this.refreshDaemonAuth(),t.md||i.done("Logged out. Auth credentials cleared"),{success:!0,message:t.md?`## Auth
9
+ - **Status**: Logged out`:""};default:{let n=await g.getStatus();return t.md?{success:!0,message:n.authenticated?`## Auth Status
10
+ - **Authenticated**: Yes
11
+ - **Email**: ${n.email||"N/A"}
12
+ - **Token**: stored securely
13
+ - **Last auth**: ${n.lastAuth||"N/A"}`:"## Auth Status\n- **Authenticated**: No\n- Run `prjct login` to connect"}:(n.authenticated?i.box("Auth Status",`Email: ${n.email||"N/A"}
14
+ Token: stored securely
15
+ Since: ${n.lastAuth||"N/A"}`):(i.info("Not authenticated"),i.info(`Run ${a.cyan("prjct login")} to connect`)),{success:!0,message:""})}}}async login(e={}){let t=await g.getStatus();if(t.authenticated)return e.md||(i.box("Already Authenticated",`Email: ${t.email}
16
+ Token: stored securely`),i.info(`Run ${a.cyan("prjct logout")} first to re-authenticate`)),{success:!0,message:e.md?`## Already Authenticated
17
+ - **Email**: ${t.email}
18
+ - **Token**: stored securely
19
+
20
+ Run \`prjct logout\` first to re-authenticate.`:""};let o=process.env.PRJCT_WEB_URL||F,n=process.env.PRJCT_API_URL||K,s=Y(),l={settled:!1,listenPort:0};return new Promise(h=>{let c=m(p=>{l.settled||(l.settled=!0,h(p))},"finish"),d=ce.createServer(async(p,u)=>{let x=new URL(p.url||"/","http://127.0.0.1"),w={"Content-Type":"text/html","Cache-Control":"no-store","Referrer-Policy":"no-referrer"};if(x.pathname==="/callback"){let f=X(x.searchParams,s.state);if(!f.ok){let S=(f.reason==="legacy-bearer",400);u.writeHead(S,w),u.end(this.buildErrorPage(f.message)),f.reason==="legacy-bearer"&&(e.md||(i.warn(f.message),i.info("Update prjct-cli-app or open the login URL with flow=pkce-v1")));return}let{verified:y,failureMessage:b,email:A}=await(async()=>{try{let S=Z({code:f.code,state:f.state,codeVerifier:s.codeVerifier,deviceId:await g.getDeviceId(),port:l.listenPort}),I=await fetch(`${n}/auth/cli/exchange`,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(S)});if(!I.ok)return{verified:!1,failureMessage:`Exchange failed (${I.status})`,email:""};let C=ee(await I.json());return C?(await g.saveAuth(C.apiKey,C.userId,C.email),await g.write({apiUrl:n}),await B.testConnection()?{verified:!0,failureMessage:"",email:C.email}:(await g.clearAuth(),{verified:!1,failureMessage:"Could not verify credentials with prjct Cloud",email:C.email})):{verified:!1,failureMessage:"Malformed exchange response",email:""}}catch(S){return await g.clearAuth(),{verified:!1,failureMessage:S instanceof Error?S.message:"Could not store credentials securely",email:""}}})();y?(u.writeHead(200,w),u.end(this.buildSuccessPage(A))):(u.writeHead(401,w),u.end(this.buildErrorPage(b))),d.close(),y?(e.md||(i.step(3,3,"Connected"),i.stop(),i.box("Authentication Complete",`Email: ${A}
21
+ Token: stored securely
22
+ Status: Connected`)),await this.refreshDaemonAuth(),await this.autoSync(),c({success:!0,message:e.md?`## Authenticated
23
+ - **Email**: ${A}
24
+ - **Token**: stored securely`:""})):(e.md||i.fail(`Authentication failed: ${b}`),c({success:!1,message:e.md?`## Error
25
+ Authentication failed: ${b}`:""}));return}u.writeHead(404,w),u.end("Not found")});d.listen(0,"127.0.0.1",async()=>{let p=d.address();if(!p||typeof p=="string"){d.close(),e.md||i.fail("Failed to start callback server"),c({success:!1,message:e.md?`## Error
26
+ Failed to start callback server`:""});return}l.listenPort=p.port;let u=await g.getDeviceId(),x=await g.getHostname(),w=Q({port:l.listenPort,deviceId:u,hostname:x,state:s.state,codeChallenge:s.codeChallenge}),f=`${o}/auth/cli?flow=pkce-v1&port=${l.listenPort}`,y=`${o}/auth/cli?${w.toString()}`;i.step(1,3,"Opening browser..."),i.stop(),i.info(a.dim(f));let b=process.platform,A=b==="darwin"?`open "${y}"`:b==="win32"?`start "" "${y}"`:`xdg-open "${y}"`;try{await _(A)}catch{i.warn("Could not open browser automatically"),i.info("Visit the URL printed by your terminal session (full URL not echoed for safety)"),i.info(y)}i.step(2,3,"Waiting for authentication...")}),setTimeout(()=>{l.settled||(d.close(),i.stop(),e.md||(i.fail("Authentication timed out"),i.info(`Run ${a.cyan("prjct login")} to try again`)),c({success:!1,message:e.md?"## Error\nAuthentication timed out. Run `prjct login` to try again.":""}))},300*1e3)})}async logout(){return await g.clearAuth(),i.done("Logged out"),{success:!0,message:""}}async refreshDaemonAuth(){try{let{restartDaemon:e}=await import("./client-SKFMAUI5.mjs");await e()}catch{}}async autoSync(){try{let e=await E.readConfig(process.cwd()).catch(()=>null),t=e?.projectId;if(!t||!e.cloud?.enabled||e.cloud.paused)return;i.spin("Syncing project...");let o=await H.sync(t,{include:e.cloud.include??{}});if(i.stop(),o.success&&!o.skipped){let n=o.pushed?.count||0,s=o.pulled?.count||0;n>0||s>0?i.done(`Synced (${n} pushed, ${s} pulled)`):i.done("Synced \u2014 everything up to date")}}catch{i.stop()}}buildSuccessPage(e){return`<!DOCTYPE html>
27
+ <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
28
+ <title>prjct CLI Connected</title>
29
+ <style>
30
+ *{margin:0;padding:0;box-sizing:border-box}
31
+ body{font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',sans-serif;
32
+ background:#0a0a0a;color:#e5e5e5;display:flex;justify-content:center;align-items:center;min-height:100vh}
33
+ .card{text-align:center;max-width:420px;padding:2.5rem}
34
+ .logo{font-size:.875rem;letter-spacing:.05em;color:#a3a3a3;margin-bottom:2rem;font-family:ui-monospace,monospace}
35
+ .logo span{color:#e5e5e5}
36
+ .icon{width:64px;height:64px;border-radius:50%;background:rgba(34,211,238,.12);
37
+ display:flex;align-items:center;justify-content:center;margin:0 auto 1.5rem}
38
+ .icon svg{width:32px;height:32px;color:#22d3ee}
39
+ h1{font-size:1.5rem;font-weight:600;margin-bottom:.75rem}
40
+ .details{background:#141414;border:1px solid #262626;border-radius:8px;padding:1rem 1.25rem;
41
+ margin:1.25rem 0;text-align:left;font-size:.875rem;line-height:1.75}
42
+ .details .label{color:#888}
43
+ .details .value{color:#e5e5e5}
44
+ .hint{color:#666;font-size:.8125rem;margin-top:1rem}
45
+ </style></head>
46
+ <body><div class="card">
47
+ <div class="logo"><span>prjct</span>/cli</div>
48
+ <div class="icon"><svg fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5">
49
+ <path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"/></svg></div>
50
+ <h1>CLI Connected</h1>
51
+ <div class="details">
52
+ <span class="label">Account:</span> <span class="value">${e}</span><br>
53
+ <span class="label">Token:</span> <span class="value">stored securely</span>
54
+ </div>
55
+ <p class="hint">Return to your terminal to continue.</p>
56
+ </div></body></html>`}buildErrorPage(e){return`<!DOCTYPE html>
57
+ <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
58
+ <title>prjct CLI \u2014 Error</title>
59
+ <style>
60
+ *{margin:0;padding:0;box-sizing:border-box}
61
+ body{font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',sans-serif;
62
+ background:#0a0a0a;color:#e5e5e5;display:flex;justify-content:center;align-items:center;min-height:100vh}
63
+ .card{text-align:center;max-width:420px;padding:2.5rem}
64
+ .logo{font-size:.875rem;letter-spacing:.05em;color:#a3a3a3;margin-bottom:2rem;font-family:ui-monospace,monospace}
65
+ .logo span{color:#e5e5e5}
66
+ .icon{width:64px;height:64px;border-radius:50%;background:rgba(239,68,68,.12);
67
+ display:flex;align-items:center;justify-content:center;margin:0 auto 1.5rem}
68
+ .icon svg{width:32px;height:32px;color:#ef4444}
69
+ h1{font-size:1.5rem;font-weight:600;margin-bottom:.75rem}
70
+ .msg{background:#141414;border:1px solid #262626;border-radius:8px;padding:1rem 1.25rem;
71
+ margin:1.25rem 0;font-size:.875rem;color:#f87171}
72
+ .hint{color:#666;font-size:.8125rem;margin-top:1rem}
73
+ </style></head>
74
+ <body><div class="card">
75
+ <div class="logo"><span>prjct</span>/cli</div>
76
+ <div class="icon"><svg fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5">
77
+ <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/></svg></div>
78
+ <h1>Authentication Failed</h1>
79
+ <div class="msg">${e}</div>
80
+ <p class="hint">Return to your terminal and try again.</p>
81
+ </div></body></html>`}async start(){let e=await v.checkInstallation(),t=(N(),M(O)),o=await t.detectCodex(),n=await t.detectAntigravity(),s=e.providerDetected,l=s?await t.getActiveProvider():null,h=s?l.displayName:o.installed?"OpenAI Codex":"AI agents";if(console.log(`\u{1F680} Setting up prjct for ${h}...
82
+ `),!s&&!o.installed&&!n.installed&&(console.log("\u2139\uFE0F No local CLI runtime detected."),console.log(" prjct will still use AGENTS.md + MCP-compatible surfaces after init.")),s){console.log("\u{1F4E6} Installing p. command router...");let c=await v.installCommands();if(!c.success)return{success:!1,message:`\u274C Installation failed: ${c.error}`};if(console.log(`
83
+ \u2705 Installed ${c.installed?.length??0} commands to:
84
+ ${$.getDisplayPath(c.path||"")}`),(c.errors?.length??0)>0){console.log(`
85
+ \u26A0\uFE0F ${c.errors?.length??0} errors:`);for(let d of c.errors??[])console.log(` - ${d.file}: ${d.error}`)}}return await this.installCodexSurface(o.installed,"Installed Codex skill"),await this.installAntigravitySurface(n.installed),await this.setupMcpServers(),await this.installProjectAgentSurfacesIfConfigured(),await this.saveSetupStamp(l?.name??(o.installed?"codex":n.installed?"antigravity":"claude")),console.log(`
86
+ \u{1F389} Setup complete!`),console.log(`
87
+ Next steps:`),console.log(` 1. Open ${h}`),console.log(" 2. Navigate to your project"),console.log(" 3. Run: prjct init"),{success:!0,message:""}}async setup(e={}){console.log(`\u{1F527} Reconfiguring prjct...
88
+ `);let t=(N(),M(O)),o=await t.detectCodex(),n=await t.detectAntigravity(),l=(await v.checkInstallation()).providerDetected;if(e.force&&(console.log("\u{1F5D1}\uFE0F Removing existing installation..."),await v.uninstallCommands()),!l&&!o.installed&&!n.installed&&(console.log("\u2139\uFE0F No local CLI runtime detected."),console.log(" Continuing with universal AGENTS.md/MCP-compatible setup.")),l){console.log("\u{1F4E6} Installing p. command router...");let c=await v.installCommands();if(!c.success)return{success:!1,message:`\u274C Setup failed: ${c.error}`};if(console.log(`
89
+ \u2705 Installed ${c.installed?.length??0} commands`),(c.errors?.length??0)>0){console.log(`
90
+ \u26A0\uFE0F ${c.errors?.length??0} errors:`);for(let u of c.errors??[])console.log(` - ${u.file}: ${u.error}`)}console.log(`
91
+ \u{1F4DD} Installing global configuration...`);let d=await v.installGlobalConfig(),p=d.path?$.getDisplayPath(d.path):"global config";d.success?d.action==="created"?console.log(`\u2705 Created ${p}`):d.action==="updated"?console.log(`\u2705 Updated ${p}`):d.action==="appended"&&console.log(`\u2705 Added prjct config to ${p}`):console.log(`\u26A0\uFE0F ${d.error}`)}else console.log("\u2139\uFE0F No Claude/Gemini global command surface detected; skipping CLI router cleanup.");let h=l?await t.getActiveProvider():null;if(h?.name==="claude"){console.log(`
92
+ \u26A1 Installing status line...`);let c=await this.installStatusLine();c.success?console.log("\u2705 Status line configured"):console.log(`\u26A0\uFE0F ${c.error}`)}return await this.installCodexSurface(o.installed,"Codex skill installed"),await this.installAntigravitySurface(n.installed),await this.setupMcpServers(),await this.installProjectAgentSurfacesIfConfigured(),await this.saveSetupStamp(h?.name??(o.installed?"codex":n.installed?"antigravity":"claude")),console.log(`
93
+ \u{1F389} Setup complete!
94
+ `),this.showAsciiArt(),{success:!0,message:""}}async setupMcpServers(){await J()}async saveSetupStamp(e){try{let t=(await import("./editors-config-3N6VREZR.mjs")).default,o=R.join($.globalConfigDir,"runtime-surfaces");await t.saveConfig(P,o,e)}catch(t){console.log(`\u26A0\uFE0F Setup stamp failed (non-blocking): ${k(t)}`)}}async installProjectAgentSurfacesIfConfigured(){try{let e=process.cwd();if(!await E.isConfigured(e))return;let{writeProjectAgentSurfaces:o}=await import("./project-agent-surfaces-TD7BHI25.mjs"),{detectInstalledAgents:n}=await import("./detection-MEYHME4X.mjs"),s=await o(e,{agents:await n(e),explicit:!0});s.prjctMd.action!=="unchanged"&&console.log("\u2705 Project PRJCT.md ready"),s.agentsMd.action!=="unchanged"&&console.log("\u2705 Project AGENTS.md ready"),s.claudeMd&&s.claudeMd.action!=="unchanged"&&console.log("\u2705 Project CLAUDE.md ready"),s.ideRules.length>0&&console.log(`\u2705 Project IDE rules ready: ${s.ideRules.join(", ")}`)}catch(e){console.log(`\u26A0\uFE0F Project agent surface setup failed (non-blocking): ${k(e)}`)}}async installCodexSurface(e,t){if(e)try{let{installCodexSkill:o,verifyCodexPRouterReady:n}=await import("./codex-skill-7IURPY6B.mjs");await o();let s=await n({autoRepair:!0});s.verified?(console.log(`\u2705 ${t}`),console.log("\u2705 Codex p. router ready")):(console.log(`\u26A0\uFE0F Codex skill setup incomplete: ${s.message||"router verification failed"}`),console.log(" Run `prjct setup` to retry Codex configuration."))}catch(o){console.log(`\u26A0\uFE0F Codex skill setup failed (non-blocking): ${k(o)}`)}}async installAntigravitySurface(e){if(e)try{let t=await import("node:os"),{getTemplateContent:o}=await import("./template-loader-4QMIMOBY.mjs"),n=R.join(t.homedir(),".gemini","antigravity","skills","prjct"),s=R.join(n,"SKILL.md"),l=o("antigravity/SKILL.md");if(!l)throw new Error("Antigravity SKILL.md template not found");await j.mkdir(n,{recursive:!0}),await j.writeFile(s,l,"utf-8"),console.log("\u2705 Antigravity skill installed")}catch(t){console.log(`\u26A0\uFE0F Antigravity skill setup failed (non-blocking): ${k(t)}`)}}async installStatusLine(){try{let e=$.getClaudeDir(),t=$.getClaudeSettingsPath(),o=R.join(e,"prjct-statusline.sh");if(await T(o)&&(await j.readFile(o,"utf-8")).includes("build_statusline"))return{success:!0};let n=`#!/bin/bash
95
+ # prjct Status Line for Claude Code
96
+ # Shows version update notifications and current task
97
+
98
+ # Current CLI version (embedded at install time)
99
+ CLI_VERSION="${P}"
100
+
101
+ # Read JSON context from stdin (provided by Claude Code)
102
+ read -r json
103
+
104
+ # Extract cwd from JSON
105
+ CWD=$(echo "$json" | grep -o '"cwd"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*"cwd"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
106
+
107
+ # Check if this is a prjct project
108
+ CONFIG="$CWD/.prjct/prjct.config.json"
109
+ if [[ -f "$CONFIG" ]]; then
110
+ # Extract projectId
111
+ PROJECT_ID=$(grep -o '"projectId"[[:space:]]*:[[:space:]]*"[^"]*"' "$CONFIG" | sed 's/.*"projectId"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
112
+
113
+ if [[ -n "$PROJECT_ID" ]]; then
114
+ # Upgrade notice \u2014 the daemon checks npm and writes this GLOBAL flag.
115
+ # The statusline only READS it; it does no version comparison itself.
116
+ UPDATE_STATUS="$HOME/.prjct-cli/state/update-status.json"
117
+ if [[ -f "$UPDATE_STATUS" ]] && grep -q '"updateAvailable"[[:space:]]*:[[:space:]]*true' "$UPDATE_STATUS"; then
118
+ LATEST=$(grep -o '"latest"[[:space:]]*:[[:space:]]*"[^"]*"' "$UPDATE_STATUS" | sed 's/.*"latest"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
119
+ echo "\u26A0\uFE0F prjct v$LATEST available! Run p. upgrade"
120
+ exit 0
121
+ fi
122
+
123
+ # Show current task if exists
124
+ STATE="$HOME/.prjct-cli/projects/$PROJECT_ID/storage/state.json"
125
+ if [[ -f "$STATE" ]]; then
126
+ TASK=$(grep -o '"description"[[:space:]]*:[[:space:]]*"[^"]*"' "$STATE" | head -1 | sed 's/.*"description"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
127
+ STATUS=$(grep -o '"status"[[:space:]]*:[[:space:]]*"[^"]*"' "$STATE" | head -1 | sed 's/.*"status"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
128
+
129
+ if [[ -n "$TASK" ]] && [[ "$STATUS" == "active" ]]; then
130
+ # Truncate task to 40 chars
131
+ TASK_SHORT="\${TASK:0:40}"
132
+ [[ \${#TASK} -gt 40 ]] && TASK_SHORT="$TASK_SHORT..."
133
+ echo "\u{1F3AF} $TASK_SHORT"
134
+ exit 0
135
+ fi
136
+ fi
137
+ fi
138
+ fi
139
+
140
+ # Default: show prjct branding
141
+ echo "\u26A1 prjct"
142
+ `;await j.writeFile(o,n,{mode:493});let s=await T(t)?await D(t).catch(()=>null).then(l=>l??{}):{};return s.statusLine={type:"command",command:o},await U(t,s),{success:!0}}catch(e){return z(e)}}showAsciiArt(){console.log(a.cyan("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501")),console.log(""),console.log(a.bold.cyan(" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557")),console.log(a.bold.cyan(" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D")),console.log(a.bold.cyan(" \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551")),console.log(a.bold.cyan(" \u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551")),console.log(a.bold.cyan(" \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551")),console.log(a.bold.cyan(" \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D")),console.log(""),console.log(` ${a.bold.cyan("prjct")}${a.magenta("/")}${a.green("cli")} ${a.dim.white(`v${P} installed`)}`),console.log(""),console.log(` ${a.yellow("\u26A1")} Improve developer + agent performance`),console.log(` ${a.green("\u{1F9E0}")} Rich project context without context bloat`),console.log(` ${a.cyan("\u{1F916}")} Human-in-the-loop work cycles`),console.log(""),console.log(a.cyan("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501")),console.log(""),console.log(a.bold.cyan("\u{1F680} Quick Start")),console.log(a.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(""),console.log(` ${a.bold("1.")} Initialize your project:`),console.log(` ${a.green("cd your-project && prjct init")}`),console.log(""),console.log(` ${a.bold("2.")} Start your first work cycle:`),console.log(` ${a.green('prjct work "build auth"')}`),console.log(""),console.log(` ${a.bold("3.")} Ship & celebrate:`),console.log(` ${a.green('prjct ship "user login"')}`),console.log(""),console.log(a.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(""),console.log(` ${a.dim("Documentation:")} ${a.cyan("https://prjct.app")}`),console.log(` ${a.dim("Report issues:")} ${a.cyan("https://github.com/prjct-app/cli/issues")}`),console.log(""),console.log(a.bold.magenta("Ship with better context.")),console.log("")}};export{te as SetupCommands};
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{f as ie,g as le,h as ue,i as me}from"./chunk-RJ2BRRMH.mjs";import"./chunk-FGQZ62ZP.mjs";import"./chunk-TXJT3G53.mjs";import"./chunk-A5RNWWTH.mjs";import"./chunk-HZIORCPO.mjs";import{a as B}from"./chunk-WDGDFXSB.mjs";import{a as fe,b as ge}from"./chunk-CQHPIYNM.mjs";import"./chunk-NWY5M34K.mjs";import{a as U,h as Y,i as de}from"./chunk-B7GMU46T.mjs";import"./chunk-LJLUP4FF.mjs";import{a as y}from"./chunk-Q5I2UPD6.mjs";import{a as Q,b as $,c as A,d as ae,f as ce}from"./chunk-3WKDMAS7.mjs";import{c as re,d as he}from"./chunk-PXJKXBTM.mjs";import{a as K}from"./chunk-PSSR7LSW.mjs";import{a as V}from"./chunk-6AFM6WRB.mjs";import"./chunk-CREPUNOS.mjs";import"./chunk-D7TRY3CO.mjs";import"./chunk-TPESWBA7.mjs";import{a as pe}from"./chunk-ODWWIFSN.mjs";import"./chunk-YKMJI6TF.mjs";import"./chunk-LLQUB6YR.mjs";import"./chunk-NLG2EW6M.mjs";import"./chunk-6IKHMK2U.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-75UJIVMO.mjs";import"./chunk-XEFIIDHM.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-ZTZTVBAZ.mjs";import"./chunk-DYHYDHCW.mjs";import"./chunk-2OU2MKNS.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-FEH4IPIC.mjs";import"./chunk-EHBEHLYN.mjs";import"./chunk-KEJ5RMAI.mjs";import{a as x}from"./chunk-6EWGHM32.mjs";import"./chunk-J6JZ4PQA.mjs";import"./chunk-LGJUQEAU.mjs";import"./chunk-54LH63LM.mjs";import"./chunk-SJ75V4WG.mjs";import"./chunk-4DDCWMI6.mjs";import"./chunk-A5MUSARI.mjs";import"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import{b as W}from"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import{d as R,g as Ae}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-HBLR7BVG.mjs";import{b as I,e as Te}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import{i as M,o as De}from"./chunk-CTWZQ7YI.mjs";import"./chunk-OIEZAHLC.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import{e as z,f as Me}from"./chunk-BUDZL4DW.mjs";import{a as g}from"./chunk-E66B27AL.mjs";import{existsSync as ve}from"node:fs";import Se from"node:path";Ae();Me();Te();De();var L="ship:in_progress",we=class extends he{static{g(this,"ShippingCommands")}async ship(i,e=process.cwd(),n={}){try{let l=await me(e);if(!l.ok)return l.result;let o=l.value;try{if((await W.readConfig(e))?.delivery?.killSwitch==="on")return{success:!1,error:"Delivery kill-switch ON \u2014 mutation path removed. Lift only by setting `delivery.killSwitch` to `off` in `.prjct/prjct.config.json` (not via --no-judgment-gate / --no-spec-gate)."}}catch{}try{let t=R.getDoc(o,L);t?.version&&(await B.getByVersion(o,t.version)||(await B.addShipped(o,{name:t.feature,version:t.version}),console.log(`\u2139\uFE0F Reconciled an interrupted ship: ${t.feature} (v${t.version})`)),R.deleteDoc(o,L))}catch{}let a=await Y(o,e),d=a?.linkedSpecId,b=ye(i)??ye(a?.description??null),m=await W.readConfig(e).catch(()=>null);if(!n.noSpecGate&&!d)try{let{effectiveSddMode:t}=await import("./sdd-ZO4DP23G.mjs");if(t(m)==="strict")return{success:!1,error:"Strict SDD: this work has no linked intent/spec. Start it via `prjct intent` \u2192 `audit-spec` \u2192 `prjct work --spec <id>`, or override with `prjct ship --no-spec-gate`."}}catch{}try{let{checkPackageLegitimacy:t}=await import("./package-legitimacy-HXC4L73B.mjs"),c=await t(e);if(c.risky&&c.message){if((m?.sdd?.mode==="strict"||m?.tdd?.mode==="strict"||m?.deliveryGeometry?.mode==="strict")&&!n.allowNewDeps)return{success:!1,error:`${c.message}
9
+ Override only with explicit consent: verify packages, then \`prjct ship --allow-new-deps\`.`};console.log(`\u26A0\uFE0F ${c.message}`)}}catch{}try{let{contextPressureBlocksExpansion:t,contextPressureVerdict:c}=await import("./context-pressure-OUN5PFMN.mjs"),r=c(m,{turnCount:a?.turnCount,tokensIn:a?.tokensIn,tokensOut:a?.tokensOut,description:a?.description});if(t(r,m)&&!n.forcePressure)return{success:!1,error:r.cue??"Context density hard-block is enabled (contextPressure.hardBlockShip). Soften injection or pass --force-pressure with consent."};(r.level==="warn"||r.level==="critical")&&r.cue&&console.log(r.cue)}catch{}let u=m?.deliveryGeometry?.mode??"off";try{let{computeCommittedChangeset:t,shipGeometryVerdict:c}=await import("./delivery-geometry-VHCURJ7E.mjs"),r=await t(e),p=c({changeset:r,mode:u,explicitGeometry:n.geometry??null,locThreshold:m?.deliveryGeometry?.locThreshold});if(p.blocked)return{success:!1,error:p.message??"Delivery geometry gate blocked ship."};p.message&&console.log(p.message)}catch(t){if(u==="strict"&&t instanceof M)return{success:!1,error:`Delivery geometry gate unevaluable: ${t.message}. Re-run when git is healthy, or ship with explicit \`--geometry\`.`}}try{let{hasSymbolIndex:t}=await import("./symbol-graph-LZM4RZXZ.mjs");if(t(o)){let{detectChanges:c,shipStructuralRiskCue:r}=await import("./detect-changes-6N4DCWXQ.mjs"),p=await c(e,o,{source:"auto"}),h=r(p);if(h&&console.log(h),(m?.deliveryGeometry?.mode??"off")==="strict"&&p.summary.critical>0&&!n.geometry&&!n.allowNewDeps)return{success:!1,error:`Strict delivery geometry + structural CRITICAL risk (${p.summary.critical} file(s), blast ${p.affectedFiles.length}). Review \`prjct code impact --md\`, then re-ship with explicit \`--geometry single|split|direct\`.`}}}catch(t){t instanceof M&&console.log(`\u26A0\uFE0F Structural risk cue unavailable: ${t.message}`)}let J=(m?.persona?.packs??[]).includes("code-strict");try{let{intensityFromChangeset:t,judgmentShipVerdict:c}=await import("./precision-judgment-WPTCNTGV.mjs"),{shipRequiresQuality:r}=await import("./judgment-orchestrator-UFGNBTEK.mjs"),{computeCommittedChangeset:p}=await import("./delivery-geometry-VHCURJ7E.mjs"),{judgmentLedgerStorage:h}=await import("./judgment-ledger-storage-UKROWRVA.mjs"),f=await p(e),$e={harnessLevel:a?.harness?.level,harnessKind:a?.harness?.kind},Oe=t({files:f?.files??0,loc:f?.loc??0},$e).intensity,oe=J?"full":Oe,se=J||r(oe),O=h.get(o),D=c({codeStrict:se,intensity:oe,ledger:O,override:!!n.noJudgmentGate});if(D.blocked)return{success:!1,error:D.message};if(D.message&&console.log(D.message),se&&!n.noJudgmentGate&&D.reason==="approved")try{let{contentBoundDriftVerdict:C,currentTreeHashForStamp:P}=await import("./content-bound-stamp-72EQVZLP.mjs"),T=O?.contentBound,N=T?.treeHash?await P(e,T):null,H=C({stamp:T??null,currentTreeHash:N,hard:!0,override:!1});if(H.blocked)return{success:!1,error:H.message};H.message&&console.log(H.message)}catch(C){if(C instanceof M)return{success:!1,error:`Content-bound stamp unevaluable: ${C.message}. Re-run when git is healthy, or override with \`--no-judgment-gate\`.`}}else if(O?.contentBound?.treeHash&&!n.noJudgmentGate)try{let{contentBoundDriftVerdict:C,currentTreeHashForStamp:P}=await import("./content-bound-stamp-72EQVZLP.mjs"),T=await P(e,O.contentBound),N=C({stamp:O.contentBound,currentTreeHash:T,hard:!1,override:!1});N.message&&console.log(N.message)}catch{}}catch(t){if(J&&t instanceof M)return{success:!1,error:`Judgment ship gate unevaluable: ${t.message}. Re-run when git is healthy, or override with \`--no-judgment-gate\`.`}}if(a&&await de(o,e),d&&!n.noSpecGate)try{let{specService:t}=await import("./spec-service-G3RLCJ2G.mjs"),c=await t.get(e,d);if(c&&c.content.acceptance_criteria.length>0){let r=[];r.push(""),r.push(`## Spec acceptance gate \u2014 \`${c.title}\` (${c.id.slice(0,8)})`),r.push(""),r.push("Walk each criterion. STOP if any is unmet."),r.push("");for(let p of c.content.acceptance_criteria)r.push(`- [ ] ${p}`);r.push(""),r.push("Override (only with explicit user consent): `prjct ship --no-spec-gate`."),r.push(""),console.log(r.join(`
10
+ `))}}catch{}if(!n.noTestGate)try{let{effectiveTddMode:t}=await import("./tdd-XQUU4C23.mjs"),c=await W.readConfig(e).catch(()=>null),r=t(c);if(r!=="off"){let h=(await K(e).catch(()=>null))?.test?.command,f=[""];r==="strict"?(f.push("## TDD gate (strict) \u2014 tests must be green before ship"),f.push(""),f.push(h?`Run \`prjct tdd check\` (\`${h}\`). STOP and fix if RED.`:"No test command detected \u2014 add tests (strict TDD expects them)."),f.push("Override (only with explicit user consent): `prjct ship --no-test-gate`.")):(f.push("## TDD reminder (assist)"),f.push(""),f.push(h?`Did the change ship with tests? Verify green: \`prjct tdd check\` (\`${h}\`).`:"Consider adding a test for this change.")),f.push(""),console.log(f.join(`
11
+ `))}}catch{}let Ce=y.getRulesForCommand(o,"ship"),X=n.intent==="seed-code-workflow"?await ke(o,e):null;if(X===!1)return{success:!1,error:"seed-code-workflow requested but this project does not look like code (no package.json / Cargo.toml / pyproject.toml / VERSION). Add rules manually with `prjct workflow add`."};let Z=X===!0?y.getRulesForCommand(o,"ship"):Ce,ee=!Z.some(t=>t.type==="step"&&t.position==="before")&&n.intent!=="register-only"?await ke(o,e):!1;ee&&console.log("\u2139\uFE0F Auto-seeded code ship workflow (one-time migration)");let te=ee?y.getRulesForCommand(o,"ship"):Z,_=n.intent==="pr-convention-auto"?"auto":n.intent==="pr-convention-manual"?"manual":null;_&&Ee(o,_,te);let Re=_?y.getRulesForCommand(o,"ship"):te,q=await Ne(o,e,Re,n);if(q)return He(q,n.md===!0),{success:!1,clarification:q};let w=b??await Fe(e);if(!w)return{success:!1,error:'Ship needs a release description. Pass one explicitly, e.g. `prjct ship "add universal agent compatibility"`, or ship from a named feature branch.'};let F={feature:w},v=await U(o,"ship","before",{projectPath:e,skipRules:n.skipHooks,runContext:F});if(!v.success)return{success:!1,error:`Ship blocked: ${v.gatesFailed.length>0?v.gatesFailed.join(", "):"unknown step"}`};let S=typeof F.version=="string"?F.version:"unversioned";try{R.setDoc(o,L,{feature:w,version:S,startedAt:I()})}catch{}await B.addShipped(o,{name:w,version:S});try{R.deleteDoc(o,L)}catch{}if(a)try{R.run(o,"UPDATE tasks SET shipped_at = ? WHERE id = ?",I(),a.id)}catch{}await this.logToMemory(e,"feature_shipped",{feature:w,version:S,timestamp:I()});let G=await U(o,"ship","after",{projectPath:e,skipRules:n.skipHooks,runContext:F}),ne=[...v.instructions,...G.instructions];try{await ie.sync(e)}catch(t){console.warn("\u26A0\uFE0F Failed to sync AI context after shipping:",z(t))}let xe=v.stepsRun.length+G.stepsRun.length;if(a?.id)try{let{usefulnessService:t}=await import("./usefulness-253CZLNY.mjs");t.creditShippedTask(o,a.id)}catch{}let E=await(async()=>{try{let{synthesizeJudgmentReceipt:t}=await import("./judgment-receipt-2U7D6HS4.mjs"),c=await t({projectId:o,projectPath:e,cycleDescription:a?.description??w,cycleId:a?.id??null});return c.wrote?c.summary??"Judgment receipt written":null}catch{return null}})();if(n.md){let t=ue("ship",!0),c=Q(ce(`Shipped: ${w}`,`Version: ${S}`),$("Results",A([`Version: ${S}`,`Workflow steps run: ${xe>0?[...v.stepsRun,...G.stepsRun].join(", "):"none"}`,`Hooks failed (non-blocking): ${v.hooksFailed.length+G.hooksFailed.length}`,E?`Compound judgment: ${E}`:null].filter(r=>r!==null))),ne.length>0?$("Agent Instructions",A(ne)):null,ae([...t.map(r=>({label:r.desc,command:r.cmd})),{label:"Capture non-obvious learning (compounds next session)",command:'prjct remember learning "\u2026"'}]));console.log(c)}else V.done(`v${S} shipped`),E&&V.info(`Compound: ${E}`),le("ship");return(async()=>{try{let{flushIfLinked:t}=await import("./auto-flush-GW3FP763.mjs");await t(e)}catch{}})(),{success:!0,feature:w,version:S}}catch(l){return V.fail(z(l)),re(l)}}};function ye(s){let i=s?.trim();return i||null}g(ye,"normalizeShipFeature");async function Fe(s){let i=await pe(s);if(!i)return null;let e=i.replace(/^refs\/heads\//,"").trim();if(!e||/^(main|master|develop|development|dev|trunk)$/i.test(e))return null;let n=e.split("/").filter(Boolean).at(-1)??e;if(!n||/^\d+(?:\.\d+)*$/.test(n))return null;let l=n.replace(/^[a-z]+-\d+[-_]/i,"").replace(/[_-]+/g," ").replace(/[^\p{L}\p{N} ]+/gu," ").replace(/\s+/g," ").trim();return l.length>=3?l:null}g(Fe,"inferShipFeatureFromBranch");function be(s){return["package.json","Cargo.toml","pyproject.toml","go.mod","Gemfile","pom.xml","build.gradle","VERSION"].some(e=>ve(Se.join(s,e)))}g(be,"isCodeProject");function j(s){return ve(Se.join(s,".git"))}g(j,"isGitRepo");async function ke(s,i){if(!be(i))return!1;let e=new Date().toISOString(),n=y.getRulesForCommand(s,"ship"),l=new Set(n.map(u=>u.action)),o=n.reduce((u,k)=>Math.max(u,k.sortOrder??0),0),a=[];j(i)&&a.push({action:'git branch --show-current | grep -vE "^(main|master)$"',description:"Prevent shipping from main branch",timeoutMs:5e3});let d=await K(i).catch(()=>null);d?.test?.command&&a.push({action:`verify:${d.test.command}`,description:"Verify before shipping (Stop-Slop)",timeoutMs:3e5});let b=[{action:"version:bump",description:"Bump version (stack-aware)",timeoutMs:1e4},{action:"changelog:add",description:"Append CHANGELOG entry",timeoutMs:1e4}];j(i)&&(b.push({action:"git:commit",description:"Commit ship",timeoutMs:15e3}),b.push({action:"git:push",description:"Push to origin",timeoutMs:3e4}),await Ge(s,i)==="auto"&&b.push({action:"pr:ensure",description:"Open or confirm the PR",timeoutMs:3e4}));let m=[...a.map(u=>({...u,type:"gate"})),...b.map(u=>({...u,type:"step"}))].filter(u=>!l.has(u.action));for(let[u,k]of m.entries())y.addRule(s,{type:k.type,command:"ship",position:"before",action:k.action,description:k.description,enabled:!0,timeoutMs:k.timeoutMs,sortOrder:o+u+1,createdAt:e});return m.length>0}g(ke,"seedCodeShipRules");async function Ge(s,i){let e=x.getWorkflow(s,"ship"),n=e?.metadata?.prConvention;if(n==="auto"||n==="manual")return n;let l=await fe(i),o=ge(l);return x.updateWorkflow(s,"ship",{metadata:{...e?.metadata??{},prConvention:o}}),o}g(Ge,"resolvePrConvention");function Ee(s,i,e){let n=x.getWorkflow(s,"ship");if(x.updateWorkflow(s,"ship",{metadata:{...n?.metadata??{},prConvention:i}}),i==="auto"&&!e.some(l=>l.action==="pr:ensure")){let l=e.reduce((o,a)=>Math.max(o,a.sortOrder??0),0);y.addRule(s,{type:"step",command:"ship",position:"before",action:"pr:ensure",description:"Open or confirm the PR",enabled:!0,timeoutMs:3e4,sortOrder:l+1,createdAt:new Date().toISOString()})}}g(Ee,"applyPrConventionDecision");async function Ne(s,i,e,n){if(n.intent==="proceed"||n.intent==="register-only")return null;if(!e.some(d=>d.type==="step"&&d.position==="before"))return{question:"No `ship` workflow steps are configured for this project. What should ship do?",options:["register-only","seed-code-workflow","abort"],state:{rulesCount:e.length,looksLikeCode:be(i)}};if(await Y(s,i))return null;let a=await Ie(i);return a?{question:`No active work cycle, and PR #${a.number} ("${a.title}") is OPEN for this branch. Continue ship anyway?`,options:["proceed","abort"],state:{openPr:a.number,branch:a.branch}}:j(i)&&e.some(d=>d.action==="git:push")&&!e.some(d=>d.action==="pr:ensure")&&!x.getWorkflow(s,"ship")?.metadata?.prConvention?{question:"This project ships without opening/updating a PR. Want ship to handle that automatically (`gh pr create`), or do you manage PRs yourself?",options:["pr-convention-auto","pr-convention-manual"]}:null}g(Ne,"buildClarification");function He(s,i){if(i){let e=Q($("Clarification needed",s.question),$("Options",A(s.options.map(n=>`\`prjct ship --intent=${n}\``))),s.state?$("State",A(Object.entries(s.state).map(([n,l])=>`${n}: ${JSON.stringify(l)}`))):null);console.log(e);return}console.log(`
12
+ \u26A0\uFE0F ${s.question}`),console.log(`
13
+ Options:`);for(let e of s.options)console.log(` prjct ship --intent=${e}`)}g(He,"renderClarification");async function Ie(s){if(!j(s))return null;try{let{execFileAsync:i}=await import("./exec-I7XE7NMD.mjs"),{stdout:e}=await i("git",["branch","--show-current"],{cwd:s,timeout:3e3}),n=e.toString().trim();if(!n)return null;let{stdout:l}=await i("gh",["pr","list","--head",n,"--state","open","--json","number,title","--limit","1"],{cwd:s,timeout:5e3}),o=JSON.parse(l.toString());return o.length===0?null:{number:o[0].number,title:o[0].title,branch:n}}catch{return null}}g(Ie,"findOpenPrForBranch");export{we as ShippingCommands,ke as seedCodeShipRules};
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{d as m,g as S}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as o}from"./chunk-E66B27AL.mjs";S();import k from"node:fs/promises";import E from"node:os";import g from"node:path";function I(t){return[{dir:g.join(t,".claude","skills"),scope:"project"},{dir:g.join(t,"skills"),scope:"project"},{dir:g.join(E.homedir(),".claude","skills"),scope:"global"}]}o(I,"skillRoots");function y(t){let s=t.replace(/^\uFEFF/,"").replace(/\r\n/g,`
9
+ `).match(/^---\n([\s\S]*?)\n---/);if(!s)return{};let i={},n=s[1].split(`
10
+ `),p=o(e=>{if(e>=n.length)return;let c=n[e].match(/^(name|description):\s*(.*)$/);if(!c){p(e+1);return}let u=c[1],l=c[2].trim(),d=/^[>|][+-]?$/.test(l)?n.slice(e+1).findIndex(f=>!/^\s+\S/.test(f)):0,a=d===-1?n.length-e-1:d,h=/^[>|][+-]?$/.test(l)?n.slice(e+1,e+1+a).map(f=>f.trim()).join(" "):l;h&&(i[u]=h.replace(/^["']|["']$/g,"")),p(e+1+a)},"parseLine");return p(0),i}o(y,"parseFrontmatter");async function F(t,r){let s=new Map;for(let{dir:n,scope:p}of I(r)){let e=await k.readdir(n).catch(()=>null);if(e)for(let c of e){let u=g.join(n,c,"SKILL.md"),l=await k.readFile(u,"utf-8").catch(()=>null);if(l===null)continue;let d=y(l),a=d.name||c;s.has(a)||s.set(a,{name:a,description:d.description??"",path:u,scope:p})}}let i=[...s.values()];try{m.run(t,"DELETE FROM skill_registry");for(let n of i)m.run(t,"INSERT OR REPLACE INTO skill_registry (name, description, path, scope, indexed_at) VALUES (?, ?, ?, ?, ?)",n.name,n.description,n.path,n.scope,Date.now())}catch{}return i}o(F,"refreshSkillIndex");function L(t){try{return m.query(t,"SELECT name, description, path, scope FROM skill_registry ORDER BY scope ASC, name ASC").map(r=>({...r,scope:r.scope}))}catch{return[]}}o(L,"getSkillIndex");function b(t){let r=L(t);if(r.length===0)return null;let s=["## Skill index \u2014 pass EXACT paths to subagents (they read the original SKILL.md; never summarize a skill for them)",""];for(let i of r)s.push(`- **${i.name}** (${i.scope}) \u2014 ${i.description||"no description"}
11
+ \`${i.path}\``);return s.join(`
12
+ `)}o(b,"renderSkillIndex");export{L as getSkillIndex,F as refreshSkillIndex,b as renderSkillIndex};
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a as $}from"./chunk-DYHYDHCW.mjs";import{a as D}from"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import{a as M,o as B}from"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import{a as O,e as R,f as L}from"./chunk-BUDZL4DW.mjs";import{a as l}from"./chunk-E66B27AL.mjs";L();B();import z from"node:fs/promises";import S from"node:path";var j={frontend:["component","page","view","ui","layout","style","css","scss","sass","hook","context","store","redux","zustand","react","vue","svelte","angular","next","nuxt","app","client"],backend:["api","route","controller","service","middleware","handler","resolver","schema","model","entity","repository","server","socket","graphql","rest","trpc"],database:["migration","seed","schema","model","entity","repository","prisma","drizzle","sequelize","typeorm","mongoose","knex","sql","db"],auth:["auth","login","logout","session","token","jwt","oauth","passport","credential","permission","role","user","account"],testing:["test","spec","e2e","integration","unit","mock","fixture","stub","jest","vitest","cypress","playwright"],config:["config","env","setting","constant","option","tsconfig","eslint","prettier","vite","webpack","rollup"],infra:["docker","compose","kubernetes","k8s","ci","cd","github","gitlab","jenkins","terraform","ansible","deploy"],util:["util","helper","lib","common","shared","core","base","abstract"]},E=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".go",".rs",".java",".kt",".swift",".rb",".php",".c",".cpp",".h",".hpp",".cs",".vue",".svelte"]),A=new Set(["node_modules",".git","dist","build",".next",".nuxt",".output","coverage",".cache","__pycache__",".pytest_cache","vendor","target",".turbo",".vercel"]),I=new Set(["a","an","the","and","or","but","is","are","was","were","be","been","being","have","has","had","do","does","did","will","would","could","should","may","might","must","shall","can","need","to","of","in","for","on","with","at","by","from","as","into","through","during","before","after","above","below","between","under","again","further","then","once","here","there","when","where","why","how","all","each","few","more","most","other","some","such","no","nor","not","only","own","same","so","than","too","very","just","add","create","make","implement","fix","update","change","modify","remove","delete","new"]);async function N(n,e,o={}){let t=Date.now(),s=o.maxFiles??30,r=o.minScore??.1,i=o.includeTests??!1,u=H(n),c=await W(e),a=await q(e),m=[];for(let h of c){if(!i&&Y(h))continue;let p=G(h,u,a,o.historicalBoosts);p.score>=r&&m.push(p)}m.sort((h,p)=>p.score-h.score);let g=m.slice(0,s);return{files:g,metrics:{filesScanned:c.length,filesReturned:g.length,scanDuration:Date.now()-t}}}l(N,"findRelevantFiles");function H(n){return n.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).filter(o=>!I.has(o)&&o.length>2)}l(H,"extractKeywords");async function W(n){let e=[];async function o(t,s=""){try{let r=await z.readdir(t,{withFileTypes:!0});for(let i of r){let u=S.join(t,i.name),c=S.join(s,i.name);if(i.isDirectory()){if(A.has(i.name)||i.name.startsWith("."))continue;await o(u,c)}else if(i.isFile()){let a=S.extname(i.name).toLowerCase();E.has(a)&&e.push(c)}}}catch(r){O(r)||$.debug(`files-tool: skipped unreadable path during walk: ${R(r)}`)}}return l(o,"walk"),await o(n),e}l(W,"getAllCodeFiles");async function q(n){let e=new Map;try{let{stdout:o}=await M(`git log -30 --pretty=format:"%H %ct" --name-only | awk '
9
+ /^[a-f0-9]{40}/ { commit=$1; timestamp=$2; next }
10
+ NF { files[$0]++; if (!lastmod[$0]) lastmod[$0]=timestamp }
11
+ END { for (const f in files) print files[f], lastmod[f], f }
12
+ '`,{cwd:n,maxBuffer:10485760}),t=Math.floor(Date.now()/1e3),s=o.trim().split(`
13
+ `).filter(Boolean);for(let r of s){let i=r.match(/^(\d+)\s+(\d+)\s+(.+)$/);if(i){let u=parseInt(i[1],10),c=parseInt(i[2],10),a=i[3],m=Math.floor((t-c)/86400);e.set(a,{commits:u,daysAgo:m})}}}catch{}return e}l(q,"getGitRecency");function G(n,e,o,t){let s=[],r=n.toLowerCase(),i=r.split("/").join(" ").split(/[^a-z0-9]+/),u=Math.min(1,e.reduce((_,d)=>{let y=r.includes(d);y&&s.push(`keyword:${d}`);let x=i.some(b=>b.includes(d)||d.includes(b));return _+(y?.3:0)+(x?.15:0)},0)),c=Math.min(1,Object.entries(j).reduce((_,[d,y])=>{let x=y.some(w=>r.includes(w)),b=e.some(w=>y.includes(w)||w.includes(d)||d.includes(w));return x&&b&&s.push(`domain:${d}`),_+(x&&b?.4:0)},0)),a=o.get(n),m=a?a.daysAgo<=1?1:a.daysAgo<=3?.8:a.daysAgo<=7?.6:a.daysAgo<=30?.3:0:0,g=m===1?"recent:1d":m===.8?"recent:3d":m===.6?"recent:1w":m===.3?"recent:1m":null;g&&s.push(g);let h=Math.min(1,m+(a&&a.commits>=5?.2:0)),p=S.basename(n).toLowerCase(),v=p.includes("index")||p.includes("main")||p.includes("app")||p.includes("entry"),k=r.includes("/core/")||r.includes("/shared/")||r.includes("/lib/"),F=v?.5:k?.3:0;v?s.push("import:0"):k&&s.push("import:1");let f=t?.get(n),T=f===void 0?0:(f+1)/2;f!==void 0&&f>0?s.push("history:boosted"):f!==void 0&&f<0&&s.push("history:penalized");let P=t&&t.size>0?u*.54+c*.18+h*.13+F*.05+T*.1:u*.6+c*.2+h*.15+F*.05;return{path:n,score:Math.min(1,P),reasons:[...new Set(s)]}}l(G,"scoreFile");function Y(n){let e=n.toLowerCase();return e.includes(".test.")||e.includes(".spec.")||e.includes("__tests__")||e.includes("__mocks__")||e.includes("/tests/")||e.includes("/test/")||e.endsWith("_test.go")||e.endsWith("_test.py")}l(Y,"isTestFile");var C=5,K=8,X=.15;async function le(n,e,o){let[t,s]=await Promise.all([N(n,o,{maxFiles:C*4,minScore:X}).catch(()=>({files:[]})),Promise.resolve(D.recall(e,{topic:n,limit:K})).catch(()=>[])]),r=J(t.files.map(c=>c.path),C);return r.length===0&&s.length===0?{notesBlock:"",paths:[],memoryHits:0,empty:!0}:{notesBlock:V(n,r,s),paths:r,memoryHits:s.length,empty:!1}}l(le,"inferSpecContext");function J(n,e){let o=new Set,t=[];for(let s of n){let r=s.split("/").slice(0,2).join("/");if(!o.has(r)&&(o.add(r),t.push(s),t.length>=e))break}return t}l(J,"dedupeTopDirs");function V(n,e,o){let t=[];if(t.push("<!-- auto-context:tentative -->"),t.push("## Existing context (auto-inferred)"),t.push(""),t.push(`_Inferred from title "${n}". Validate before audit \u2014 entries tagged tentative._`),t.push(""),e.length>0){t.push("### Likely paths");for(let s of e)t.push(`- \`${s}\``);t.push("")}if(o.length>0){t.push("### Relevant prior memory");for(let s of o){let r=s.content.length>140?`${s.content.slice(0,137)}\u2026`:s.content,i=Object.entries(s.tags).map(([u,c])=>`${u}:${c}`).join(" ");t.push(`- **${s.type}**${i?` _(${i})_`:""} \u2014 ${r}`)}t.push("")}return t.push("<!-- /auto-context -->"),t.join(`
14
+ `)}l(V,"buildNotesBlock");function ue(n,e){let o={level:"warn",code:"no_context_match",message:`No codebase or memory context matched "${n}"`,suggestion:e??"Fill spec.notes manually or run with `--skip-context` next time."};process.stderr.write(`${JSON.stringify(o)}
15
+ `)}l(ue,"warnNoContextMatch");export{le as inferSpecContext,ue as warnNoContextMatch};
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a as R,b as a}from"./chunk-LWCHQIJ7.mjs";import"./chunk-7SI6X3Z7.mjs";import{a as v}from"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import{b as y}from"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import{e as S,g as T}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b as j,e as $}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import{b as C,o as P}from"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as g}from"./chunk-E66B27AL.mjs";$();P();T();import{createHash as x}from"node:crypto";function w(c){let t={goal:c.goal,eli10:c.eli10,stakes:c.stakes,acceptance_criteria:c.acceptance_criteria,scope:c.scope,out_of_scope:c.out_of_scope,risks:c.risks,test_plan:c.test_plan};return x("sha256").update(JSON.stringify(t)).digest("hex")}g(w,"computeAuditCandidateHash");function E(c,t){let e=S.get(c,"SELECT content FROM specs WHERE id = ?",t),n=(()=>{if(!e?.content)return null;try{return JSON.parse(e.content)}catch{return null}})(),r=S.query(c,"SELECT lens FROM spec_selected_reviewer WHERE spec_id = ?",t).map(o=>o.lens),s=new Set(S.query(c,"SELECT lens FROM spec_review WHERE spec_id = ? AND verdict = 'pass'",t).map(o=>o.lens));if(!(r.length>0?r.every(o=>s.has(o)):s.has("strategic")&&s.has("architecture")&&s.has("design")))return!1;let u=n?.audit_candidate_hash;if(!u)return!0;if(w(n)!==u)return!1;let p=n?.reviews??{};for(let o of r.length>0?r:Object.keys(p)){let d=p[o];if(!(!d||d.verdict!=="pass")&&d.candidateHash!==u)return!1}for(let o of r.length>0?r:["strategic","architecture","design"]){if(!s.has(o))continue;let d=p[o];if(!d||d.candidateHash!==u)return!1}return!0}g(E,"reviewsGatePassedRelational");async function A(c){try{let{stdout:t}=await C("git",["rev-parse","HEAD"],{cwd:c}),e=t.trim();return/^[0-9a-f]{7,40}$/.test(e)?e:null}catch{return null}}g(A,"readGitHead");var _=class{static{g(this,"SpecService")}async create(t,e){let n=await this.requireProjectId(t),{classifySpecCreate:r,shouldMirrorSpecToMemory:s}=await import("./precision-classifier-IVVAXE26.mjs"),l=r(e.title,e.content.goal);if(l.action==="refuse")throw new Error(`Cannot create empty spec (${l.reasonCode}): ${l.reason}`);let u=e.autoContext!==!1,p=e.content.notes??"",o=u&&!p.trim()?await import("./spec-context-inference-KER2R3F3.mjs").then(async({inferSpecContext:h,warnNoContextMatch:m})=>{let f=await h(e.title,n,t);return f.empty&&m(e.title),f.empty?p:f.notesBlock}):p,d=R.parse({goal:e.content.goal,eli10:e.content.eli10??"",stakes:e.content.stakes??"",acceptance_criteria:e.content.acceptance_criteria??[],scope:e.content.scope??[],out_of_scope:e.content.out_of_scope??[],risks:e.content.risks??[],test_plan:e.content.test_plan??[],reviews:e.content.reviews,linked_tasks:e.content.linked_tasks??[],notes:o}),i=a.create(n,{title:e.title,content:d,tags:e.tags});return s(i.title,i.content.goal)&&await v.remember(t,{type:"spec",content:`${i.title}
9
+
10
+ Goal: ${i.content.goal}`,tags:{...e.tags??{},spec_id:i.id,status:i.status},source:i.id,provenance:"declared"}),i}async get(t,e){let n=await this.requireProjectId(t);return a.get(n,e)}async list(t,e={}){let n=await this.requireProjectId(t);return a.list(n,e)}async setStatus(t,e,n){let r=await this.requireProjectId(t),s=a.setStatus(r,e,n);return s&&await v.remember(t,{type:"spec",content:`Spec status \u2192 ${n}: ${s.title}`,tags:{spec_id:e,status:n,event:"status_change"},source:e}),s}async update(t,e,n){let r=await this.requireProjectId(t),s=a.get(r,e);if(!s)return null;let l=w(s.content),u=w(n),p=l!==u,o=p?{...n,reviews:{},selected_reviewers:[],audit_candidate_hash:null}:n;return p&&(s.status==="reviewed"||s.status==="in_progress")&&a.setStatus(r,e,"draft"),a.updateContent(r,e,o)}async recordReview(t,e,n,r){let s=await this.requireProjectId(t),l=3,u=50,p=g(async d=>{let i=a.get(s,e);if(!i)return null;let h=i.content.audit_candidate_hash??w(i.content);if(i.content.audit_candidate_hash&&w(i.content)!==i.content.audit_candidate_hash)throw new Error(`SPEC_CANDIDATE_DRIFT: body no longer matches audit_candidate_hash. Re-run \`prjct spec audit ${e}\` then re-record reviews.`);let m={...r,ts:j(),candidateHash:h},f={...i.content,audit_candidate_hash:h,reviews:{...i.content.reviews??{},[n]:m}};if(a.casUpdate(s,e,f,i.updatedAt))return a.get(s,e);if(d+1>=l)throw new Error(`SPEC_RECORD_REVIEW_CONFLICT_RETRY_EXHAUSTED: ${l} retries failed for spec ${e}`);return await new Promise(k=>setTimeout(k,u)),p(d+1)},"attemptReview"),o=await p(0);if(o&&E(s,e)&&o.status==="draft"){let{assessAcceptanceCriteria:d}=await import("./nyquist-lite-GE7OAFLC.mjs"),i=d(o.content.acceptance_criteria??[]);if(!i.ok&&i.message){let m=await y.readConfig(t).catch(()=>null),f=m?.tdd?.mode==="strict",b=m?.sdd?.mode==="strict";if(f||b)throw new Error(`NYQUIST_LITE_BLOCK: ${i.message}
11
+ Rewrite acceptance criteria with verifiable signals, then re-record the last review.`);try{await v.remember(t,{type:"improvement-signal",content:i.message,tags:{source:"nyquist-lite",spec:e},provenance:"extracted",projectId:s})}catch{}}let h=a.setStatus(s,e,"reviewed");if(h){let{breakdownSpecToTasks:m}=await import("./spec-task-breakdown-YPJ76OWR.mjs");return await m(s,t,h),a.get(s,e)}return h}return o}async linkTask(t,e,n){let r=await this.requireProjectId(t);return a.linkTask(r,e,n)}async ship(t,e,n){let r=await this.requireProjectId(t);n!==void 0&&a.setShippedPr(r,e,n);let s=await A(t);return s&&a.setShippedSha(r,e,s),a.setStatus(r,e,"shipped")}unmetCriteria(t,e=new Set){return t.content.acceptance_criteria.filter(n=>!e.has(n))}async setSelectedReviewers(t,e,n){let r=await this.requireProjectId(t),s=a.get(r,e);if(!s)return null;let l=w(s.content);return a.updateContent(r,e,{...s.content,selected_reviewers:n,audit_candidate_hash:l,reviews:{}})}async requireProjectId(t){let e=await y.readConfig(t);if(!e?.projectId)throw new Error("not a prjct project (run `prjct init` first)");return e.projectId}},Q=new _;export{Q as specService};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{b as d}from"./chunk-NWY5M34K.mjs";import{b as a}from"./chunk-LWCHQIJ7.mjs";import{a as m}from"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b as l,e as u}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as s}from"./chunk-E66B27AL.mjs";u();async function y(r,n,t){let c=t.content.acceptance_criteria;if(c.length===0)return{taskIds:[],skippedReason:"no_acceptance_criteria"};if(t.content.tasks_created_at!==null)return{taskIds:[],skippedReason:"already_broken_down"};let o=t.content.linked_tasks.length>0;if(o){await d.deleteByFeatureId(r,t.id);let e={...t.content,linked_tasks:[]};a.updateContent(r,t.id,e)}let i=await d.addTasks(r,c.map(e=>({description:p(e),body:e,priority:"medium",type:"feature",section:"backlog",featureId:t.id,groupId:t.id,groupName:t.title})));for(let e of i)a.linkTask(r,t.id,e.id);let k=a.get(r,t.id);if(k){let e={...k.content,tasks_created_at:l()};a.updateContent(r,t.id,e)}return await m.remember(n,{type:"spec",content:`Auto-breakdown: ${i.length} tasks created from ${t.title}${o?" (recovered from partial)":""}`,tags:{spec_id:t.id,event:"auto_breakdown",task_count:String(i.length),...o?{recovered:"partial"}:{}},source:t.id}),{taskIds:i.map(e=>e.id),...o?{recoveredFromPartial:!0}:{}}}s(y,"breakdownSpecToTasks");function p(r){let n=r.replace(/\s+/g," ").trim();return n.length<=140?n:`${n.slice(0,137)}\u2026`}s(p,"truncateForDescription");export{y as breakdownSpecToTasks};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{b as a}from"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as stateStorage};
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a as se,b as v,d as G}from"./chunk-PW3KYKVS.mjs";import{b as re}from"./chunk-45I2C2UB.mjs";import{a as P}from"./chunk-EM6ZDJAK.mjs";import{c as ne}from"./chunk-L4COZ7ZH.mjs";import{b as te}from"./chunk-2UC4DTDO.mjs";import{a as B}from"./chunk-FGQZ62ZP.mjs";import{a as Z,b as ee}from"./chunk-TRMBRDKH.mjs";import"./chunk-TPESWBA7.mjs";import{b as Q}from"./chunk-ODWWIFSN.mjs";import{c as L}from"./chunk-ZZ65CN5F.mjs";import{c as V}from"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import{a as g}from"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import{g as Ve,h as Qe}from"./chunk-UUULLTQV.mjs";import{a as Y,c as U}from"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import{b as S}from"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import{a as K,b as Ye,e as b,f as I,g as R}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b as q,e as ze,s as z,t as Ke}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import{e as A,g as D,l as C,o as X}from"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as c,b as M,e as T}from"./chunk-E66B27AL.mjs";import k from"node:fs/promises";import We from"node:path";import Ze from"node:crypto";import et from"node:fs/promises";var ce="friction-detector",ie="friction-promote",oe=5,ae=400,ue=160,tt=[/^\s*no[,.!\s]/i,/^\s*nope\b/i,/^\s*stop\b/i,/^\s*wait\b/i,/^\s*cancel\b/i],rt=[/\bshould be\b/i,/\brather than\b/i,/\binstead\b/i],nt=[/\bdoesn'?t work\b/i,/\bbroken\b/i,/\bagain\b.*\bsame\b/i];async function le(r,e,t,s={}){let n=s.preloadedLines?s.preloadedLines:await et.readFile(e,"utf-8").then(st).catch(()=>null);if(!n)return{signalsRecorded:0,signalsSkipped:0,failures:[]};let i=it(n);if(i.length===0)return{signalsRecorded:0,signalsSkipped:0,failures:[]};let o=i.slice(0,oe).map(p=>({category:p.category,expectedBehavior:"Follow the user constraint without requiring correction.",observedBehavior:`The assistant response triggered user ${p.category}.`,relatedRuleId:null})),a=pt(r),u=fe(r)??void 0;return{...await i.slice(0,oe).reduce(async(p,m)=>{let d=await p,y=de(m.excerpt).slice(0,12);if(a.has(y))return await ut(r,u,m).catch(()=>{}),{...d,signalsSkipped:d.signalsSkipped+1};try{return await g.remember(r,{type:"improvement-signal",content:ct(m),tags:{source:ce,category:m.category,...s.runtime?{runtime:s.runtime}:{},...s.model?{model:s.model}:{},...t?{session:t}:{},key:y},provenance:"extracted",projectId:u}),a.add(y),{...d,signalsRecorded:d.signalsRecorded+1}}catch{return{...d,signalsSkipped:d.signalsSkipped+1}}},Promise.resolve({signalsRecorded:0,signalsSkipped:0})),failures:o}}c(le,"detectFriction");function st(r){return v(r)}c(st,"parseJsonl");function it(r){let e={signals:[],lastAssistantText:""};for(let t of r){let s=t.role??t.message?.role,n=at(t.content??t.message?.content);if(!n)continue;if(s==="assistant"){e.lastAssistantText=n;continue}if(s!=="user")continue;let i=ot(n.slice(0,300));i&&e.signals.push({excerpt:n.slice(0,ae).trim(),category:i,precedingAssistantPreview:e.lastAssistantText.slice(0,ae).trim()})}return e.signals}c(it,"extractSignals");function ot(r){return nt.some(e=>e.test(r))?"complaint":tt.some(e=>e.test(r))?"negation":rt.some(e=>e.test(r))?"correction":null}c(ot,"classify");function at(r){return typeof r=="string"?r:Array.isArray(r)?r.map(e=>{if(typeof e=="string")return e;if(e&&typeof e=="object"&&"text"in e){let t=e.text;return typeof t=="string"?t:""}return""}).join(`
9
+ `).trim():""}c(at,"textOf");function ct(r){let e=lt(r.category),t=pe(r.excerpt),s=t?`Obey developer constraint: ${t}`:e.lesson,n=t?`Always: ${t}`:e.nextAction;return[`[${r.category}] Lesson: ${s}`,"What happened: The user pushed back after the assistant response.",`Why it mattered: ${e.why}`,`Pattern: ${e.pattern}`,`Anti-pattern: ${e.antiPattern}`,`Next action: ${n}`].join(`
10
+ `)}c(ct,"formatSignal");function pe(r){let e=r.replace(/\s+/g," ").trim();if(!e)return null;let t=e.replace(/^\s*(?:nope|no|stop|wait|cancel)[,.!\s:—-]*/i,"").trim(),s=t.match(/\bshould be\b\s+(.+?)$/i);if(s?.[1])return E(`Prefer ${s[1]}`);let n=t.match(/^(.+?)\s+rather than\s+(.+?)$/i);if(n?.[1]&&n[2])return E(`Prefer ${n[1].trim()} rather than ${n[2].trim()}`);let i=t.match(/\b(?:use|prefer|do|run|ship|write|keep)\s+(.+?)\s+instead(?:\s+of\s+(.+))?$/i);if(i?.[1]){let l=i[2]?` instead of ${i[2].trim()}`:" instead";return E(`Use ${i[1].trim()}${l}`)}let o=t.match(/\binstead of\b\s+(.+?)$/i);if(o?.[1])return E(`Avoid ${o[1].trim()}`);let a=t.match(/\b(?:don'?t|do not|never)\s+(.+?)$/i);if(a?.[1])return E(`Never ${a[1].trim()}`);let u=t.match(/\balways\s+(.+?)$/i);if(u?.[1])return E(`Always ${u[1].trim()}`);if(t.length>=12&&t.length<=ue&&/^(?:run|use|do|ship|write|keep|add|fix|remove|prefer|test|check|verify|read|ask|stop|start)\b/i.test(t)){let l=t.charAt(0).toUpperCase()+t.slice(1);return E(l.replace(/[.!?]+$/,""))}return null}c(pe,"extractSpecificConstraint");function E(r){let e=r.replace(/\s+/g," ").trim().replace(/^[-*•]\s+/,"").replace(/[.!?]+$/,"").slice(0,ue);return e.length<12||/^(?:nope|no|stop|wait|cancel)\b/i.test(e)?null:e}c(E,"cleanConstraint");async function ut(r,e,t){if(!e)return;let s=pe(t.excerpt);if(!s)return;let n=`Always: ${s}`,i=`fp:${de(s).slice(0,12)}`;try{if(g.recall(e,{types:["feedback"],tags:{source:ie,key:i},limit:1,dedupeByKey:!1}).length>0)return;await g.remember(r,{type:"feedback",content:n,tags:{source:ie,key:i,category:t.category,from:"recurring-friction"},provenance:"extracted",projectId:e})}catch{}}c(ut,"maybePromoteStandingPreference");function lt(r){return r==="complaint"?{lesson:"Treat explicit failure complaints as evidence that the last result needs diagnosis, not repetition.",why:"The user reported that the delivered behavior or command did not work.",pattern:"User names a broken or non-working result after an assistant action.",antiPattern:"Retrying the same path or moving on without isolating the failure.",nextAction:"Stop, inspect the failing output or assumption, and propose the smallest verifiable fix."}:r==="correction"?{lesson:"Update the working assumption when the user corrects the intended direction.",why:"The assistant was using an assumption that did not match what the user wanted.",pattern:"User redirects the implementation or workflow with a correction.",antiPattern:"Continuing with the original plan after the user clarified a different target.",nextAction:"Restate the corrected target as an actionable rule before continuing."}:{lesson:"Recalibrate before continuing when the user rejects the assistant\u2019s last step.",why:"The assistant likely violated sequencing, scope, or approval expectations.",pattern:"User immediately rejects an assistant action or proposed next step.",antiPattern:"Treating the rejected action as acceptable and continuing without changing course.",nextAction:"Pause, convert the pushback into a workflow constraint, and adjust the next tool use."}}c(lt,"lessonTemplate");function de(r){let e=r.toLowerCase().replace(/\s+/g," ").trim();return Ze.createHash("sha256").update(e).digest("hex")}c(de,"hashSignal");function pt(r){try{let e=fe(r);if(!e)return new Set;let t=g.recall(e,{types:["improvement-signal"],tags:{source:ce},limit:100,dedupeByKey:!1}),s=new Set;for(let n of t){let i=n.tags.key;i&&s.add(i)}return s}catch{return new Set}}c(pt,"projectMemoryHashes");function fe(r){try{let e=M("node:fs"),s=M("node:path").join(r,".prjct","prjct.config.json"),n=e.readFileSync(s,"utf-8");return JSON.parse(n).projectId??null}catch{return null}}c(fe,"projectIdFromPath");var dt=32;function ge(r={}){let t=(r.hookHost===void 0?process.env.PRJCT_HOOK_HOST:r.hookHost)?.trim().toLowerCase().slice(0,dt);return t&&Z.has(t)?t:r.detectedRuntime??ee()}c(ge,"resolveInstructionRuntime");X();var he="lean-detector",ft="lean-debt-growth",gt=3,me=["off","lite","full","ultra"];function mt(r){let e=r?.lean?.mode;if(e&&me.includes(e))return e;let t=process.env.PRJCT_LEAN_MODE?.toLowerCase();return t&&me.includes(t)?t:"off"}c(mt,"effectiveMode");async function ye(r,e){let t={active:!1,total:0,previous:0,persisted:!1},s=e!==void 0?e:await S.readConfig(r).catch(()=>null);if(!s?.projectId||mt(s)==="off")return t;t.active=!0;try{let n=await ht(r);if(t.total=n,n===0)return t;let i=yt(s.projectId);t.previous=i;let o=n-i;i>0&&o>=gt&&(await g.remember(r,{type:"lean-debt",content:`Lean debt growing: \`lean:\` markers rose by ${o} (now ${n}, was ${i}). Deferred simplifications are accumulating \u2014 consider a leaning pass via \`prjct lean debt\`.`,tags:{source:he,pattern:ft,total:String(n),previous:String(i),delta:String(o)},provenance:"inferred",projectId:s.projectId}),t.persisted=!0)}catch{}return t}c(ye,"detectAndPersistLeanDebt");async function ht(r){let e=await A(["grep","-cI","-e","lean:"],{cwd:r,maxBuffer:16777216});if(!e.ok){if(D(e,1))return 0;C(e)}return e.stdout.split(`
11
+ `).reduce((t,s)=>{let n=s.lastIndexOf(":");if(n<=0)return t;let i=Number.parseInt(s.slice(n+1),10);return Number.isFinite(i)?t+i:t},0)}c(ht,"measureLeanMarkers");function yt(r){try{let{prjctDb:e}=(R(),T(I)),t=e.query(r,"SELECT data FROM events WHERE type = 'memory.remember.lean-debt' ORDER BY id DESC LIMIT 50");for(let s of t){let n=(()=>{try{return JSON.parse(s.data)}catch{return null}})();if(!n||typeof n!="object")continue;let i=n.tags;if(!i||i.source!==he)continue;let o=typeof i.total=="string"?Number.parseInt(i.total,10):0;if(Number.isFinite(o))return o}}catch{}return 0}c(yt,"collectPreviousSnapshot");import wt from"node:path";X();var bt="hot-file",we="pattern-detector-auto",kt="recurring-bug",be="pattern-detector-recurring",Rt="tech-debt-growth",ke="pattern-detector-debt",O=7,St=3,N=30,vt=2,Tt=5,Et=[/^package(-lock)?\.json$/,/^bun\.lock(b)?$/,/^pnpm-lock\.yaml$/,/^yarn\.lock$/,/^CHANGELOG\.md$/,/^\.gitignore$/,/\.snap$/,/^dist\//,/^node_modules\//];async function Re(r,e){let t={scanned:0,hotFiles:[],persisted:0,skipped:[],errors:[]},s=e!==void 0?e:await S.readConfig(r).catch(()=>null);if(!s?.projectId)return t.errors.push("no project config"),t;try{let n=await _t(r);if(t.scanned+=n.length,t.hotFiles=n,n.length>0){let i=Mt(s.projectId);for(let o of n){if(i.has(o.path)){t.skipped.push({reason:"already-marked-this-window",file:o.path});continue}try{await g.remember(r,{type:"learning",content:`Hot file: \`${o.path}\` \u2014 ${o.touches} touches in the last ${O} days. Worth a refactor pass or a deliberate decision about why it churns this often.`,tags:{source:we,pattern:bt,file:o.path,touches:String(o.touches),window_days:String(O)},provenance:"inferred"}),t.persisted+=1}catch(a){t.errors.push(`remember failed for ${o.path}: ${a.message}`)}}}}catch(n){t.errors.push(`hot-file detection failed: ${n.message}`)}try{let n=At(s.projectId);if(n.length>0){let i=Dt(s.projectId);for(let o of n){if(i.has(o.topic)){t.skipped.push({reason:"recurring-bug-already-marked",file:o.topic});continue}try{await g.remember(r,{type:"learning",content:`Recurring bug pattern: gotchas tagged \`topic:${o.topic}\` reported ${o.occurrences} times in the last ${N} days. Likely a real underlying issue \u2014 consider a focused investigation before patching the next instance.`,tags:{source:be,pattern:kt,topic:o.topic,occurrences:String(o.occurrences),window_days:String(N)},provenance:"inferred"}),t.persisted+=1}catch(a){t.errors.push(`remember failed for recurring ${o.topic}: ${a.message}`)}}}}catch(n){t.errors.push(`recurring-bug detection failed: ${n.message}`)}try{let n=await Ct(r);if(n.totalCount>0){let i=xt(s.projectId),o=n.totalCount-i;if(i>0&&o>=Tt)try{await g.remember(r,{type:"learning",content:`Tech debt growing: TODO/FIXME/XXX count rose by ${o} (now ${n.totalCount}, was ${i}). Consider a focused debt-reduction pass before adding more features.`,tags:{source:ke,pattern:Rt,total:String(n.totalCount),previous:String(i),delta:String(o)},provenance:"inferred"}),t.persisted+=1}catch(a){t.errors.push(`remember failed for tech-debt: ${a.message}`)}}}catch(n){t.errors.push(`tech-debt detection failed: ${n.message}`)}return t}c(Re,"detectAndPersistPatterns");async function _t(r){let e=await A(["log",`--since=${O}.days.ago`,"--name-only","--pretty=format:","-z"],{cwd:r,maxBuffer:16777216,timeoutMs:15e3});if(!e.ok){if(e.kind==="exit")return[];C(e)}let t=new Map;for(let n of e.stdout.split("\0")){let i=n.trim();i&&(It(i)||t.set(i,(t.get(i)??0)+1))}let s=[];for(let[n,i]of t)i<St||s.push({path:n,touches:i});return s.sort((n,i)=>i.touches-n.touches),s}c(_t,"detectHotFiles");function It(r){let e=wt.basename(r);for(let t of Et)if(t.test(r)||t.test(e))return!0;return!1}c(It,"isIgnored");function At(r){try{let{prjctDb:e}=(R(),T(I)),t=new Date(Date.now()-N*24*60*60*1e3).toISOString(),s=e.query(r,"SELECT data, timestamp FROM events WHERE type = 'memory.remember.gotcha' AND timestamp >= ? ORDER BY id DESC LIMIT 500",t),n=new Map;for(let o of s){let a=(()=>{try{return JSON.parse(o.data)}catch{return null}})();if(!a||typeof a!="object")continue;let u=a.tags;if(!u||u.source==="transcript-auto")continue;let l=typeof u.topic=="string"?u.topic:void 0,p=typeof u.area=="string"?u.area:void 0,m=l??p;m&&n.set(m,(n.get(m)??0)+1)}let i=[];for(let[o,a]of n)a<vt||i.push({topic:o,occurrences:a});return i.sort((o,a)=>a.occurrences-o.occurrences),i}catch{return[]}}c(At,"detectRecurringBugs");async function Ct(r){let e=await A(["grep","-cE","\\b(TODO|FIXME|XXX)\\b"],{cwd:r,maxBuffer:16777216});if(!e.ok){if(D(e,1))return{totalCount:0};C(e)}return{totalCount:e.stdout.split(`
12
+ `).reduce((s,n)=>{let i=n.lastIndexOf(":");if(i<=0)return s;let o=Number.parseInt(n.slice(i+1),10);return Number.isFinite(o)?s+o:s},0)}}c(Ct,"measureTechDebt");function xt(r){try{let{prjctDb:e}=(R(),T(I)),t=e.query(r,"SELECT data FROM events WHERE type = 'memory.remember.learning' ORDER BY id DESC LIMIT 50");for(let s of t){let n=(()=>{try{return JSON.parse(s.data)}catch{return null}})();if(!n||typeof n!="object")continue;let i=n.tags;if(!i||i.source!==ke)continue;let o=typeof i.total=="string"?Number.parseInt(i.total,10):0;if(Number.isFinite(o))return o}}catch{}return 0}c(xt,"collectPreviousDebtSnapshot");function Mt(r){let e=new Set;try{let{prjctDb:t}=(R(),T(I)),s=t.query(r,"SELECT data FROM events WHERE type = 'memory.remember.learning' ORDER BY id DESC LIMIT 200"),n=Date.now()-O*24*60*60*1e3;for(let i of s){let o=(()=>{try{return JSON.parse(i.data)}catch{return null}})();if(!o||typeof o!="object")continue;let a=o.tags;if(!a||a.source!==we)continue;let u=a.file,l=o.rememberedAt;if(typeof u=="string"){if(typeof l=="string"){let p=Date.parse(l);if(!Number.isNaN(p)&&p<n)continue}e.add(u)}}}catch{}return e}c(Mt,"collectAlreadyMarkedHotFiles");function Dt(r){let e=new Set;try{let{prjctDb:t}=(R(),T(I)),s=t.query(r,"SELECT data FROM events WHERE type = 'memory.remember.learning' ORDER BY id DESC LIMIT 200"),n=Date.now()-N*24*60*60*1e3;for(let i of s){let o=(()=>{try{return JSON.parse(i.data)}catch{return null}})();if(!o||typeof o!="object")continue;let a=o.tags;if(!a||a.source!==be)continue;let u=a.topic,l=o.rememberedAt;if(typeof u=="string"){if(typeof l=="string"){let p=Date.parse(l);if(!Number.isNaN(p)&&p<n)continue}e.add(u)}}}catch{}return e}c(Dt,"collectAlreadyMarkedRecurringBugs");Ke();Ye();import x from"node:fs/promises";import Se from"node:path";R();var Lt={conservative:{inboxDays:30,archivesDays:180,checkpointsDays:null},standard:{inboxDays:14,archivesDays:90,checkpointsDays:30},aggressive:{inboxDays:7,archivesDays:30,checkpointsDays:14}};function Pt(r=process.env){let e=(r.PRJCT_CLEANUP_AGGRESSIVENESS??"standard").toLowerCase();return Lt[e==="conservative"||e==="standard"||e==="aggressive"?e:"standard"]}c(Pt,"resolveProfile");async function Ot(r,e){let t=Date.now()-e*24*60*60*1e3,n=g.recall(r,{types:["inbox"],limit:200}).filter(o=>Date.parse(o.rememberedAt)<t);if(n.length===0)return 0;let i=[];for(let o of n)try{U.archive(r,{entityType:"memory_entry",entityId:o.id,entityData:{type:o.type,content:o.content,tags:o.tags,rememberedAt:o.rememberedAt},summary:o.content.slice(0,80),reason:`inbox-age-out (>${e}d)`});let a=o.id.startsWith("mem_")?o.id.slice(4):null;a&&b.run(r,"UPDATE events SET type = ? WHERE id = ?","memory.archived.inbox",Number(a)),b.run(r,"UPDATE memory_entries SET deleted_at = ? WHERE id = ?",Date.now(),o.id),i.push(o.id)}catch{}return i.length}c(Ot,"archiveAgedInbox");async function Nt(r,e){if(e===null)return 0;let t=Se.join(z.getGlobalProjectPath(r),"checkpoints"),s=await x.readdir(t).catch(()=>null);if(!s)return 0;let n=Date.now()-e*24*60*60*1e3,i=[];for(let o of s){if(!o.endsWith(".json"))continue;let a=Se.join(t,o);try{(await x.stat(a)).mtimeMs<n&&(await x.unlink(a),i.push(a))}catch{}}return i.length}c(Nt,"pruneOldCheckpoints");async function $t(){let{getVerifyCachePath:r}=await import("./context7-service-4C6VNJUS.mjs"),e=r();try{let t=await x.stat(e);if((Date.now()-t.mtimeMs)/(1440*60*1e3)>7)return await x.unlink(e),!0}catch{}return!1}c($t,"rotateContext7Cache");async function ve(r){let e=Pt(),t={inboxArchived:0,archivesPruned:0,checkpointsRemoved:0,context7CacheRotated:!1};try{t.inboxArchived=await Ot(r,e.inboxDays)}catch{}try{t.archivesPruned=U.pruneOldArchives(r,e.archivesDays)}catch{}try{t.checkpointsRemoved=await Nt(r,e.checkpointsDays)}catch{}try{t.context7CacheRotated=await $t()}catch{}return t}c(ve,"runSessionCleanup");async function Te(r,e){if(e.inboxArchived+e.archivesPruned+e.checkpointsRemoved+(e.context7CacheRotated?1:0)===0)return;let n=`Session cleanup: ${[e.inboxArchived>0?`${e.inboxArchived} inbox archived`:null,e.archivesPruned>0?`${e.archivesPruned} archives pruned`:null,e.checkpointsRemoved>0?`${e.checkpointsRemoved} checkpoints removed`:null,e.context7CacheRotated?"context7 cache rotated":null].filter(i=>!!i).join(", ")}`;b.appendEvent(r,"memory.remember.system-event",{content:n,tags:{source:"session-cleanup",key:"last-cleanup"},provenance:"extracted",content_hash:K(n),project_id:r})}c(Te,"recordCleanupReport");import jt from"node:crypto";import Ht from"node:fs/promises";import{z as w}from"zod";ze();R();var _e="crew-run:",Ee=w.object({id:w.string().min(1),spec_id:w.string().nullable().default(null),task_id:w.string().nullable().default(null),started_at:w.string().min(1),ended_at:w.string().min(1),implementer_summary:w.string().default(""),files_touched:w.array(w.string()).default([]),reviewer_verdict:w.enum(["APPROVED","CHANGES_REQUESTED"]),reviewer_notes:w.string().nullable().default(null)});function $(r){return`${_e}${r}`}c($,"keyFor");var J=class{static{c(this,"CrewRunStorage")}record(e,t){let s=t.runId??Y(),n=b.getDoc(e,$(s));if(n)return n;let i=q(),o=Ee.parse({id:s,spec_id:t.specId??null,task_id:t.taskId??null,started_at:t.startedAt??i,ended_at:t.endedAt??i,implementer_summary:t.implementerSummary,files_touched:t.filesTouched,reviewer_verdict:t.reviewerVerdict,reviewer_notes:t.reviewerNotes??null});return b.setDoc(e,$(s),o),o}get(e,t){return b.getDoc(e,$(t))}list(e){return b.listDocsByPrefix(e,_e).map(s=>Ee.parse(s.data))}delete(e,t){b.deleteDoc(e,$(t))}},Ie=new J;var Me="skill-miss-detector",Ae=3,Ft=280,Ut=["decision","gotcha","anti-pattern"],Bt=5400*1e3,Gt=360*60*1e3,Jt=2,De=5,Wt=8,Le=new Set(["should","because","project","prjct","instead","always","never","using","value","state","change","changes","update","updated","function","return","returns","error","errors","tests","testing","config","default","import","export","before","after","without"]);async function Pe(r,e,t,s={}){let n=s.preloadedLines?s.preloadedLines:await Ht.readFile(e,"utf-8").then(qt).catch(()=>null);if(!n)return{signalsRecorded:0,signalsSkipped:0,failures:[]};let i=tr(r);if(!i)return{signalsRecorded:0,signalsSkipped:0,failures:[]};let o=zt(n);if(!o)return{signalsRecorded:0,signalsSkipped:0,failures:[]};let a=(()=>{try{return Zt(i,t)}catch{return null}})();if(!a)return{signalsRecorded:0,signalsSkipped:0,failures:[]};if(a.length===0)return{signalsRecorded:0,signalsSkipped:0,failures:[]};let u=await Q(r).catch(()=>[]),l=(()=>{try{let h=Date.now()-Gt;return new Set(Ie.list(i).filter(f=>Date.parse(f.ended_at)>h).flatMap(f=>f.files_touched))}catch{return new Set}})(),p=Xt(o,u,a,l);if(p.length===0)return{signalsRecorded:0,signalsSkipped:0,failures:[]};let m=er(i),d=[];for(let h of p.slice(0,Ae)){let f=Qt(h.memId,h.excerpt).slice(0,12);if(m.has(f)){d.push("skipped");continue}try{await g.remember(r,{type:"improvement-signal",content:Vt(h),tags:{source:Me,kind:"skill-miss",category:"skill-miss",...s.runtime?{runtime:s.runtime}:{},...s.model?{model:s.model}:{},relates:h.memId,file:h.evidenceFile,key:f,...t?{session:t}:{}},provenance:"extracted",projectId:i}),L.penalizeSkillMiss(i,h.memId),d.push("recorded")}catch{d.push("skipped")}}let y=d.filter(h=>h==="recorded").length,W=d.filter(h=>h==="skipped").length;return{signalsRecorded:y,signalsSkipped:W,failures:p.slice(0,Ae).map(h=>({category:"skill-miss",expectedBehavior:`Apply relevant project rule ${h.memId}.`,observedBehavior:"Relevant project knowledge was not referenced in the session.",relatedRuleId:h.memId}))}}c(Pe,"detectSkillMisses");function Xt(r,e,t,s=new Set){let n=Ce(r);if(n.size===0)return[];let i=e.filter(u=>!s.has(u)),o=j(i),a=[];for(let u of t){let l=Ce(`${u.content} ${u.fileTag}`);if(l.size===0)continue;let p=u.fileTag!==""&&i.some(f=>xe(f,u.fileTag))||[...o].some(f=>l.has(f)),m=Yt(l),d=[...l].filter(f=>!m.has(f)&&n.has(f)).length;if(!(p||d>=Jt)||[...m].some(f=>n.has(f)))continue;let h=u.fileTag!==""&&i.some(f=>xe(f,u.fileTag))?u.fileTag:i.find(f=>[...j([f])].some(qe=>l.has(qe)))??"";a.push({miss:{memId:u.id,memType:u.type,excerpt:u.content.replace(/\s+/g," ").trim().slice(0,Ft),evidenceFile:h,reason:p?"path-overlap-unused":"topic-overlap-unused"},rank:p?2:1,overlap:d})}return a.sort((u,l)=>l.rank-u.rank||l.overlap-u.overlap),a.map(u=>u.miss)}c(Xt,"analyze");function qt(r){return v(r)}c(qt,"parseJsonl");function zt(r){let e=[];for(let t of r){let s=t.role??t.message?.role;if(s!=="user"&&s!=="assistant")continue;let n=Kt(t.content??t.message?.content);n&&e.push(n)}return e.join(`
13
+ `).toLowerCase()}c(zt,"transcriptTextOf");function Kt(r){return typeof r=="string"?r:Array.isArray(r)?r.map(e=>{if(typeof e=="string")return e;if(e&&typeof e=="object"&&"text"in e){let t=e.text;return typeof t=="string"?t:""}return""}).join(`
14
+ `).trim():""}c(Kt,"textOf");function Ce(r){let e=new Set;for(let t of r.toLowerCase().split(/[^a-z0-9]+/))t.length<De||Le.has(t)||e.add(t);return e}c(Ce,"tokenize");function Yt(r){let e=[...r].filter(s=>s.length>=Wt);if(e.length>0)return new Set(e);let t=[...r].sort((s,n)=>n.length-s.length||s.localeCompare(n))[0]??"";return t?new Set([t]):new Set}c(Yt,"signatureOf");function j(r){let e=new Set;for(let t of r)for(let s of t.split("/")){let n=s.replace(/\.[a-z0-9]+$/i,"").toLowerCase();n.length>=De&&!Le.has(n)&&e.add(n)}return e}c(j,"fileStems");function xe(r,e){let t=j([r]);for(let s of j([e]))if(t.has(s))return!0;return!1}c(xe,"sharesStem");function Vt(r){let e=r.evidenceFile!==""?`touched \`${r.evidenceFile}\``:"worked the same area";return[`[skill-miss] Unused project knowledge (${r.memType}, ${r.memId}): "${r.excerpt}"`,`This session ${e} but never referenced it. Apply it, or supersede it via: prjct remember decision "<resolution>" --tags resolves:skill-miss,relates:${r.memId}`].join(`
15
+ `)}c(Vt,"formatSkillMiss");function Qt(r,e){let t=`${r}::${e.toLowerCase().replace(/\s+/g," ").trim()}`;return jt.createHash("sha256").update(t).digest("hex")}c(Qt,"hashKey");function Zt(r,e){let t=g.recall(r,{types:[...Ut],limit:120}),s=Date.now()-Bt,n=[];for(let i of t)i.provenance!=="inferred"&&(Date.parse(i.rememberedAt)>s||e&&i.tags.session===e||n.push({id:i.id,type:i.type,content:i.content,fileTag:i.tags.file??"",rememberedAt:i.rememberedAt,provenance:i.provenance,session:i.tags.session??""}));return n}c(Zt,"recallCandidates");function er(r){try{let e=g.recall(r,{types:["improvement-signal"],tags:{source:Me},limit:100,dedupeByKey:!1}),t=new Set;for(let s of e)s.tags.key&&t.add(s.tags.key);return t}catch{return new Set}}c(er,"existingSkillMissKeys");function tr(r){try{let e=M("node:fs"),s=M("node:path").join(r,".prjct","prjct.config.json");return JSON.parse(e.readFileSync(s,"utf-8")).projectId??null}catch{return null}}c(tr,"projectIdFromPath");import rr from"node:crypto";import nr from"node:fs/promises";var $e="transcript-auto",sr="v2",je=80,He=20,H=1500,ir=12,Oe=4,or=[{phrase:"decided to",type:"decision"},{phrase:"we chose",type:"decision"},{phrase:"going with",type:"decision"},{phrase:"the right call",type:"decision"},{phrase:"best approach is",type:"decision"},{phrase:"we will use",type:"decision"},{phrase:"shipping with",type:"decision"},{phrase:"turns out that",type:"learning"},{phrase:"now i understand",type:"learning"},{phrase:"the key insight",type:"learning"},{phrase:"i learned that",type:"learning"},{phrase:"discovered that",type:"learning"},{phrase:"root cause is",type:"learning"},{phrase:"root cause was",type:"learning"},{phrase:"the fix is",type:"learning"},{phrase:"gotcha:",type:"gotcha"},{phrase:"bug:",type:"gotcha"},{phrase:"fails when",type:"gotcha"},{phrase:"breaks when",type:"gotcha"},{phrase:"be careful",type:"gotcha"},{phrase:"never do this",type:"gotcha"},{phrase:"trap:",type:"gotcha"},{phrase:"important:",type:"fact"},{phrase:"always use",type:"fact"},{phrase:"never write",type:"fact"},{phrase:"the pattern is",type:"pattern"},{phrase:"anti-pattern:",type:"anti-pattern"},{phrase:"antipattern:",type:"anti-pattern"}],Fe=[{re:/^(?:[-*•]\s+)?(?:\*\*)?decision(?:\*\*)?\s*[:—-]\s+/i,type:"decision",phrase:"label:decision"},{re:/^(?:[-*•]\s+)?(?:\*\*)?(learning|insight)(?:\*\*)?\s*[:—-]\s+/i,type:"learning",phrase:"label:learning"},{re:/^(?:[-*•]\s+)?(?:\*\*)?(gotcha|trap|warning)(?:\*\*)?\s*[:—-]\s+/i,type:"gotcha",phrase:"label:gotcha"},{re:/^(?:[-*•]\s+)?(?:\*\*)?(fact|note)(?:\*\*)?\s*[:—-]\s+/i,type:"fact",phrase:"label:fact"},{re:/^(?:[-*•]\s+)?(?:\*\*)?root\s*cause(?:\*\*)?\s*[:—-]\s+/i,type:"learning",phrase:"label:root-cause"},{re:/^(?:[-*•]\s+)?(?:\*\*)?pattern(?:\*\*)?\s*[:—-]\s+/i,type:"pattern",phrase:"label:pattern"},{re:/^(?:[-*•]\s+)?(?:\*\*)?anti[- ]?pattern(?:\*\*)?\s*[:—-]\s+/i,type:"anti-pattern",phrase:"label:anti-pattern"}];async function Ue(r,e,t,s={}){let n={scanned:0,ingested:0,skipped:[],errors:[]},i=s.preloadedConfig!==void 0?s.preloadedConfig:await S.readConfig(r).catch(()=>null);if(!i?.projectId)return n.errors.push("no project config"),n;let o=await(async()=>{if(s.preloadedLines)return s.preloadedLines;try{return v(await nr.readFile(e,"utf-8"))}catch(d){return n.errors.push(`transcript read failed: ${d.message}`),null}})();if(o===null)return n;let a=ar(o),u=cr(o);if(n.scanned=a.length+u.length,a.length===0&&u.length===0)return n;let l=[...dr(a),...lr(u)];if(l.length===0)return n;let p=gr(i.projectId),m=t?t.slice(0,12):"unknown";for(let d of l){if(p.has(d.hash)){n.skipped.push({reason:"duplicate",phrase:d.matchedPhrase});continue}try{await g.remember(r,{type:d.type,content:d.content,tags:{source:$e,capture:sr,session:m,hash:d.hash,phrase:d.matchedPhrase},provenance:"inferred",projectId:i.projectId}),n.ingested+=1}catch(y){n.errors.push(`remember failed: ${y.message}`)}}return n}c(Ue,"ingestTranscript");function ar(r){let e=[];for(let t of r){let s=Be(t);if(s!=="assistant")continue;let n=Ge(t);!n||n.length<je||e.push({role:s,text:n})}return e}c(ar,"projectMessages");function cr(r){let e=[];for(let t of r){let s=Be(t);if(s!=="user")continue;let n=Ge(t);!n||n.length<He||e.push({role:s,text:n})}return e}c(cr,"projectUserMessages");var ur=[{re:/^(?:please\s+)?always\b/i,phrase:"user:always"},{re:/^(?:please\s+)?never\b/i,phrase:"user:never"},{re:/\bi (?:always|never|prefer)\b/i,phrase:"user:i-prefer"},{re:/^(?:rule|preference)\s*[:—-]/i,phrase:"user:rule"},{re:/\bno more\s+(?:features?|feature\s+creep)\b/i,phrase:"user:no-more-features"},{re:/\bdon'?t add (?:more )?(?:features?|surface)\b/i,phrase:"user:dont-add-features"}];function lr(r){let e=[],t=new Set;for(let s of r){if(e.length>=Oe)break;let n=s.text.split(/\n/).map(o=>o.replace(/^[-*•]\s+/,"").trim()).filter(o=>o.length>=He),i=n.length>0?n:[s.text.trim()];for(let o of i){if(e.length>=Oe)break;let a=ur.find(p=>p.re.test(o));if(!a)continue;let u=o.length>H?`${o.slice(0,H)}\u2026`:o,l=Je(u);t.has(l)||(t.add(l),e.push({type:"feedback",content:u,hash:l,matchedPhrase:a.phrase}))}}return e}c(lr,"extractUserPreferenceCandidates");function Be(r){let e=r.role;if(typeof e=="string")return Ne(e);let t=r.message;if(t&&typeof t=="object"&&"role"in t){let n=t.role;if(typeof n=="string")return Ne(n)}let s=r.type;return s==="assistant"||s==="user"||s==="system"?s:null}c(Be,"inferRole");function Ne(r){let e=r.toLowerCase();return e==="assistant"||e==="user"||e==="system"?e:null}c(Ne,"normalizeRole");function Ge(r){let e=r.content===void 0&&r.message&&typeof r.message=="object"?r.message.content:r.content;if(typeof e=="string")return e.trim();if(Array.isArray(e)){let t=[];for(let s of e){if(!s||typeof s!="object")continue;let n=s;n.type==="text"&&typeof n.text=="string"&&t.push(n.text)}return t.join(`
16
+ `).trim()}return""}c(Ge,"extractText");function pr(r){let e=r.trim();if(e.length<je)return null;for(let n of Fe)if(n.re.test(e))return{type:n.type,matchedPhrase:n.phrase};let t=e.toLowerCase(),s=or.find(n=>t.includes(n.phrase));return s?{type:s.type,matchedPhrase:s.phrase}:null}c(pr,"classifyCaptureParagraph");function dr(r){let e=[],t=new Set;for(let s of r){let n=fr(s.text);for(let i of n){if(e.length>=ir)return e;let o=pr(i);if(!o)continue;let a=i.length>H?`${i.slice(0,H)}\u2026`:i,u=Je(a);t.has(u)||(t.add(u),e.push({type:o.type,content:a,hash:u,matchedPhrase:o.matchedPhrase}))}}return e}c(dr,"extractCandidates");function fr(r){let e=r.split(/\n\s*\n/).map(s=>s.trim()).filter(Boolean),t=[];for(let s of e){let n=s.split(`
17
+ `).map(o=>o.trim()).filter(Boolean);if(n.some(o=>Fe.some(a=>a.re.test(o)))&&n.length>1)for(let o of n)t.push(o);else t.push(s)}return t}c(fr,"splitParagraphs");function Je(r){return rr.createHash("sha256").update(r.toLowerCase().trim()).digest("hex").slice(0,16)}c(Je,"hashContent");function gr(r){let e=new Set;try{let{prjctDb:t}=(R(),T(I)),{REMEMBER_EVENT_RANGE:s}=(Qe(),T(Ve)),n=t.query(r,"SELECT data FROM events WHERE type >= ? AND type < ? ORDER BY id DESC LIMIT 500",...s);for(let i of n){let o=(()=>{try{return JSON.parse(i.data)}catch{return null}})();if(!o||typeof o!="object")continue;let a=o.tags;if(!a||a.source!==$e)continue;let u=a.hash;typeof u=="string"&&e.add(u)}}catch{}return e}c(gr,"collectExistingAutoHashes");var F=600*1e3,_=new Map;function mr(r){let e=r.replace(/[^a-zA-Z0-9._-]/g,"_");return We.join(te.runDir(),`stop-heavy-${e}.stamp`)}c(mr,"heavyStepStampPath");async function Xe(r,e,t=!0){if(await k.stat(r).then(i=>e-i.mtimeMs<F).catch(()=>!1))return!1;let n=`${r}.lock`;try{await k.mkdir(n)}catch(i){if(i.code!=="EEXIST")throw i;return!await k.stat(n).then(a=>e-a.mtimeMs>=F).catch(()=>!1)||!t?!1:(await k.rmdir(n).catch(()=>{}),Xe(r,e,!1))}try{return await k.stat(r).then(o=>e-o.mtimeMs<F).catch(()=>!1)?!1:(await k.writeFile(r,String(e)),!0)}finally{await k.rmdir(n).catch(()=>{})}}c(Xe,"claimHeavyStep");async function hr(r){let e=Date.now(),t=_.get(r)??0;if(e-t<F)return!1;try{let s=mr(r);await k.mkdir(We.dirname(s),{recursive:!0});let n=await Xe(s,e);return _.size>32&&_.clear(),_.set(r,e),n}catch{}return _.size>32&&_.clear(),_.set(r,e),!0}c(hr,"heavyStepsDue");function Ln(r=process.cwd(),e){return ne({event:"Stop",projectPath:r,afterEmit:c(async(t,s)=>{let n=await S.readConfig(s).catch(()=>null);if(!n?.projectId)return;let i=ge(),o=await hr(n.projectId),a={};if(o&&t.transcript_path){let l=await k.readFile(t.transcript_path,"utf-8").catch(()=>null);l!==null&&(a.transcriptLines=v(l))}let u=se(a.transcriptLines??[]);if(o)try{let{collectActiveTasks:l}=await import("./task-overview-6ZQKJGSH.mjs"),p=await l(n.projectId,s);a.activeTaskId=p.current?.id,a.activeTaskDescription=p.current?.description,a.activeTaskStartedAt=p.current?.startedAt}catch{}if(a.transcriptLines&&a.transcriptLines.length>0)try{if(a.transcriptUsage=G(a.transcriptLines),a.transcriptUsage.tokensIn+a.transcriptUsage.tokensOut>0){let l=a.activeTaskStartedAt?{sinceIso:a.activeTaskStartedAt}:void 0,p=G(a.transcriptLines,l);if(a.activeTaskId&&p.tokensIn+p.tokensOut>0){B(n.projectId,a.activeTaskId,p.tokensIn,p.tokensOut,{description:a.activeTaskDescription,agent:i,source:`${i}-transcript`});try{let{sumTranscriptUsageByModel:m}=await import("./transcript-jsonl-6X4DDD6R.mjs");for(let[d,y]of m(a.transcriptLines,l))y.tokensIn+y.tokensOut<=0||B(n.projectId,a.activeTaskId,y.tokensIn,y.tokensOut,{model:d,agent:i,source:`${i}-transcript:${d}`})}catch{}}}}catch{}if(re({projectId:n.projectId,sessionId:t.session_id,directory:s,taskId:a.activeTaskId,goal:a.activeTaskDescription,tokensIn:a.transcriptUsage?.tokensIn,tokensOut:a.transcriptUsage?.tokensOut,agent:i,model:u}),o&&t.transcript_path)try{await Ue(s,t.transcript_path,t.session_id??null,{preloadedConfig:n,preloadedLines:a.transcriptLines})}catch{}if(o){try{await Re(s,n)}catch{}try{await ye(s,n)}catch{}try{let l=await ve(n.projectId);await Te(n.projectId,l),P.pruneRetained(n.projectId)}catch{}}if(o&&t.transcript_path)try{let l=await le(s,t.transcript_path,t.session_id??null,{preloadedLines:a.transcriptLines,runtime:i,model:u});for(let p of l.failures)try{P.record(n.projectId,{source:"friction-detector",runtime:i,model:u,sessionId:t.session_id??null,taskId:a.activeTaskId??null,...p})}catch{}l.signalsRecorded>0&&a.activeTaskId&&L.penalizeSurfaced(n.projectId,a.activeTaskId)}catch{}if(o&&t.transcript_path)try{let l=await Pe(s,t.transcript_path,t.session_id??null,{preloadedLines:a.transcriptLines,runtime:i,model:u});for(let p of l.failures)try{P.record(n.projectId,{source:"skill-miss-detector",runtime:i,model:u,sessionId:t.session_id??null,taskId:a.activeTaskId??null,...p})}catch{}}catch{}if(o)try{await V.backfill(n.projectId,n,new Date().toISOString())}catch{}if(o&&a.activeTaskId){try{let{synthesizeLandHandoff:l}=await import("./land-synthesis-OATL5BNP.mjs");await l({projectId:n.projectId,projectPath:s,cycleDescription:a.activeTaskDescription??null,cycleId:a.activeTaskId,tokensIn:a.transcriptUsage?.tokensIn,tokensOut:a.transcriptUsage?.tokensOut,model:u})}catch{}try{let{synthesizeJudgmentReceipt:l}=await import("./judgment-receipt-2U7D6HS4.mjs");await l({projectId:n.projectId,projectPath:s,cycleDescription:a.activeTaskDescription??null,cycleId:a.activeTaskId,tokensIn:a.transcriptUsage?.tokensIn,tokensOut:a.transcriptUsage?.tokensOut,model:u})}catch{}}try{let{flushIfLinked:l}=await import("./auto-flush-GW3FP763.mjs");await l(s,n)}catch{}},"afterEmit")},e)}c(Ln,"runStopHook");export{mr as heavyStepStampPath,hr as heavyStepsDue,Ln as runStopHook};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{b as a}from"./chunk-UHW35BPE.mjs";import"./chunk-45I2C2UB.mjs";import{c as i}from"./chunk-L4COZ7ZH.mjs";import"./chunk-4KY2EHXS.mjs";import"./chunk-LPB3HUJ2.mjs";import"./chunk-7OZDWT6C.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-54LH63LM.mjs";import"./chunk-ZZ65CN5F.mjs";import"./chunk-A5MUSARI.mjs";import"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import{b as n}from"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import{d as e,g as m}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as o}from"./chunk-E66B27AL.mjs";m();function l(c=process.cwd(),p){return i({event:"SubagentStart",projectPath:c,build:o((u,t)=>a(t),"build"),afterEmit:o(async(u,t)=>{try{let r=await n.readConfig(t);if(!r?.projectId)return;let{collectActiveTasks:s}=await import("./task-overview-6ZQKJGSH.mjs"),d=await s(r.projectId,t);e.appendEvent(r.projectId,"subagent.spawned",{taskId:d.current?.id??null})}catch{}},"afterEmit")},p)}o(l,"runSubagentStartHook");export{l as runSubagentStartHook};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a as f,b as p}from"./chunk-X5RDLFPM.mjs";import{c as s}from"./chunk-L4COZ7ZH.mjs";import{a}from"./chunk-ZX2KFQV5.mjs";import{b as c}from"./chunk-NWY5M34K.mjs";import"./chunk-CREPUNOS.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import{b as r}from"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as i}from"./chunk-E66B27AL.mjs";function w(u=process.cwd(),g){return s({event:"SubagentStop",projectPath:u,afterEmit:i(async(d,n)=>{let o=await r.readConfig(n).catch(()=>null);if(!o?.projectId||f(o)==="off")return;let e=[];try{let t=await a(o.projectId,n);t.current&&e.push(`active: ${t.current.description}`)}catch{}try{let t=await c.getActiveTasks(o.projectId);t.length>0&&e.push(`pending: ${t.length}`)}catch{}await p("prjct \u2014 subagent finished",e.join(" \xB7 ")||"A subagent finished")},"afterEmit")},g)}i(w,"runSubagentStopHook");export{w as runSubagentStopHook};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a}from"./chunk-TFGJVT6F.mjs";import"./chunk-ZZ65CN5F.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as recordSurfacedForActiveTask};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"./chunk-NJAMZSHM.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{b as extractFile,l as fileFanIn,m as fileFanInByFile,n as filesCallingInto,e as hasSymbolIndex,c as indexSymbols,g as listAllSymbols,f as loadMeta,i as scoreFilesFromQuery,h as searchSymbols,a as stripNoise,j as symbolsInFile,k as tracePath,d as updateSymbols};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a,b,c,d}from"./chunk-ZTZTVBAZ.mjs";import"./chunk-DYHYDHCW.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as analyzeGit,c as detectCommands,d as detectStack,b as gatherStats};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{c as a,d as b}from"./chunk-3JUE6MNF.mjs";import"./chunk-3FBCOCPD.mjs";import"./chunk-YUOTOCKK.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{b as default,a as syncClient};
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{e as s,g as a}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b as i,e as o}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as l}from"./chunk-E66B27AL.mjs";o();a();var d=class{static{l(this,"SyncCursorStorage")}get(t,r=null,e=null){if(!e)return null;let n=s.get(t,`SELECT * FROM sync_cursors
9
+ WHERE project_id = ?
10
+ AND device_id = ?
11
+ AND ${r===null?"user_id IS NULL":"user_id = ?"}`,...r===null?[t,e]:[t,e,r]);return n?this.rowToCursor(n):null}touch(t,r=null,e=null){if(!e)return;let n=i();this.upsert({userId:r,deviceId:e,projectId:t,lastEventId:this.getLastEventId(t,r,e),updatedAt:n})}advance(t,r,e={}){let n=e.userId??null,u=e.deviceId??null;if(!u)return;let _=this.getLastEventId(t,n,u);r<=_||this.upsert({userId:n,deviceId:u,projectId:t,lastEventId:r,updatedAt:i()})}getLastEventId(t,r,e){return s.get(t,`SELECT last_event_id FROM sync_cursors
12
+ WHERE project_id = ?
13
+ AND device_id = ?
14
+ AND ${r===null?"user_id IS NULL":"user_id = ?"}`,...r===null?[t,e]:[t,e,r])?.last_event_id??0}backfillUser(t,r,e){s.run(t,`UPDATE sync_cursors
15
+ SET user_id = ?, updated_at = ?
16
+ WHERE project_id = ? AND device_id = ? AND user_id IS NULL`,e,i(),t,r)}upsert(t){s.run(t.projectId,`INSERT INTO sync_cursors (user_id, device_id, project_id, last_event_id, updated_at)
17
+ VALUES (?, ?, ?, ?, ?)
18
+ ON CONFLICT(user_id, device_id, project_id)
19
+ DO UPDATE SET last_event_id = excluded.last_event_id, updated_at = excluded.updated_at`,t.userId,t.deviceId,t.projectId,t.lastEventId,t.updatedAt)}rowToCursor(t){return{userId:t.user_id,deviceId:t.device_id,projectId:t.project_id,lastEventId:t.last_event_id,updatedAt:t.updated_at}}},p=new d;export{p as syncCursorStorage};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a,b,c}from"./chunk-D7TRY3CO.mjs";import"./chunk-TPESWBA7.mjs";import"./chunk-LLQUB6YR.mjs";import"./chunk-NLG2EW6M.mjs";import"./chunk-6IKHMK2U.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-75UJIVMO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{c as orchestrationFor,a as pointsFromDiffLines,b as renderDelegationTrigger};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a,b,c}from"./chunk-ZX2KFQV5.mjs";import"./chunk-CREPUNOS.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as collectActiveTasks,b as formatActiveTaskLine,c as formatActiveTaskList};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i}from"./chunk-B7GMU46T.mjs";import"./chunk-LJLUP4FF.mjs";import"./chunk-Q5I2UPD6.mjs";import"./chunk-PSSR7LSW.mjs";import"./chunk-6AFM6WRB.mjs";import"./chunk-CREPUNOS.mjs";import"./chunk-D7TRY3CO.mjs";import"./chunk-TPESWBA7.mjs";import"./chunk-ODWWIFSN.mjs";import"./chunk-YKMJI6TF.mjs";import"./chunk-LLQUB6YR.mjs";import"./chunk-NLG2EW6M.mjs";import"./chunk-6IKHMK2U.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-75UJIVMO.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-2OU2MKNS.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-6EWGHM32.mjs";import"./chunk-SJ75V4WG.mjs";import"./chunk-4DDCWMI6.mjs";import"./chunk-A5MUSARI.mjs";import"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{e as TASK_CONTEXT_PROMPT,h as completeActiveTask,a as formatRelatedContextForAgent,b as formatRiskForAgent,i as readLastStatus,d as recallRisksForFiles,g as resolveActiveTask,f as setTaskStatus,c as startTask};