prjct-cli 3.94.0 → 3.96.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 (190) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +27 -21
  3. package/dist/bin/hook-chunks/{agent-identity-45BYQBU2.mjs → agent-identity-DH6DX72X.mjs} +1 -1
  4. package/dist/bin/hook-chunks/{agent-switch-2U2LOBGR.mjs → agent-switch-I4MTVE56.mjs} +1 -1
  5. package/dist/bin/hook-chunks/{analysis-N4NYGIG3.mjs → analysis-VN7APBHR.mjs} +3 -3
  6. package/dist/bin/hook-chunks/{auth-config-SP4PBALR.mjs → auth-config-JIITQ6GY.mjs} +1 -1
  7. package/dist/bin/hook-chunks/{auto-flush-BN6L6QHO.mjs → auto-flush-DX3FVSQE.mjs} +1 -1
  8. package/dist/bin/hook-chunks/{capture-gate-FRF2G3IG.mjs → capture-gate-MEIQD7ZS.mjs} +1 -1
  9. package/dist/bin/hook-chunks/{chunk-OZJ6UKKP.mjs → chunk-22GFTUER.mjs} +1 -1
  10. package/dist/bin/hook-chunks/chunk-32RX4YGI.mjs +9 -0
  11. package/dist/bin/hook-chunks/{chunk-Q3EYM4GJ.mjs → chunk-33BHU4OM.mjs} +2 -2
  12. package/dist/bin/hook-chunks/{chunk-HNEKXKOI.mjs → chunk-3AHW4XQH.mjs} +1 -1
  13. package/dist/bin/hook-chunks/{chunk-JMCMTX6U.mjs → chunk-3CKNJ5RA.mjs} +1 -1
  14. package/dist/bin/hook-chunks/{chunk-6RLCUGGG.mjs → chunk-3FEXJUO2.mjs} +1 -1
  15. package/dist/bin/hook-chunks/{chunk-7GNWHWOO.mjs → chunk-3HGQPUKG.mjs} +1 -1
  16. package/dist/bin/hook-chunks/{chunk-D6IONKRA.mjs → chunk-3UB6SFRA.mjs} +1 -1
  17. package/dist/bin/hook-chunks/{chunk-AVRNHROK.mjs → chunk-64ZEBHDX.mjs} +1 -1
  18. package/dist/bin/hook-chunks/{chunk-MI3JEFON.mjs → chunk-7PBWIO4K.mjs} +3 -3
  19. package/dist/bin/hook-chunks/{chunk-UA4Z5TGG.mjs → chunk-7WO5CEH3.mjs} +1 -1
  20. package/dist/bin/hook-chunks/chunk-A6K4H3YT.mjs +9 -0
  21. package/dist/bin/hook-chunks/{chunk-3VWBNLBC.mjs → chunk-ADYTBOCZ.mjs} +1 -1
  22. package/dist/bin/hook-chunks/{chunk-TG5CQJD5.mjs → chunk-AORD3YDQ.mjs} +1 -1
  23. package/dist/bin/hook-chunks/{chunk-EHEQOF6Z.mjs → chunk-B36LC2JR.mjs} +1 -1
  24. package/dist/bin/hook-chunks/{chunk-FX6VHIKB.mjs → chunk-BKJHD5JI.mjs} +1 -1
  25. package/dist/bin/hook-chunks/{chunk-S7HQQILD.mjs → chunk-BVK7ZDLX.mjs} +1 -1
  26. package/dist/bin/hook-chunks/{chunk-HHIGNKDO.mjs → chunk-CPR4FPXG.mjs} +1 -1
  27. package/dist/bin/hook-chunks/{chunk-6UH244CC.mjs → chunk-D7DQABWO.mjs} +1 -1
  28. package/dist/bin/hook-chunks/{chunk-Y4DUB7UN.mjs → chunk-DB226JIV.mjs} +2 -2
  29. package/dist/bin/hook-chunks/{chunk-KOCROTRM.mjs → chunk-DCHIPMOG.mjs} +1 -1
  30. package/dist/bin/hook-chunks/{chunk-IKIB42F7.mjs → chunk-E7NA34VQ.mjs} +1 -1
  31. package/dist/bin/hook-chunks/{chunk-MHQTGU45.mjs → chunk-EGCYDLSO.mjs} +1 -1
  32. package/dist/bin/hook-chunks/{chunk-ZMKTR2IO.mjs → chunk-EI6VQZOX.mjs} +1 -1
  33. package/dist/bin/hook-chunks/{chunk-INXNK57E.mjs → chunk-ETTDRXQ6.mjs} +1 -1
  34. package/dist/bin/hook-chunks/{chunk-EQ5KNMLG.mjs → chunk-EXVL2OFE.mjs} +1 -1
  35. package/dist/bin/hook-chunks/{chunk-5EQLQ7GF.mjs → chunk-FZS3XGEA.mjs} +1 -1
  36. package/dist/bin/hook-chunks/{chunk-QYEASMFV.mjs → chunk-GSPDJSJ5.mjs} +1 -1
  37. package/dist/bin/hook-chunks/{chunk-TKWAFYF7.mjs → chunk-H2DGDAQP.mjs} +1 -1
  38. package/dist/bin/hook-chunks/chunk-H5AVBDCH.mjs +8 -0
  39. package/dist/bin/hook-chunks/{chunk-SDUS2AT7.mjs → chunk-HGZQWYBL.mjs} +1 -1
  40. package/dist/bin/hook-chunks/{chunk-EMTCZG5I.mjs → chunk-IJ523YO2.mjs} +1 -1
  41. package/dist/bin/hook-chunks/{chunk-NBKEOLDH.mjs → chunk-IWUF2LGO.mjs} +5 -5
  42. package/dist/bin/hook-chunks/chunk-JGZ3QGWX.mjs +11 -0
  43. package/dist/bin/hook-chunks/{chunk-66GE3IHX.mjs → chunk-JZDZH6IV.mjs} +1 -1
  44. package/dist/bin/hook-chunks/{chunk-PUHX3ECX.mjs → chunk-KDNUQPAK.mjs} +1 -1
  45. package/dist/bin/hook-chunks/chunk-KV4NXLPT.mjs +11 -0
  46. package/dist/bin/hook-chunks/{chunk-XE4MJNBQ.mjs → chunk-LF3S3MYE.mjs} +1 -1
  47. package/dist/bin/hook-chunks/chunk-LQLCYBFF.mjs +36 -0
  48. package/dist/bin/hook-chunks/{chunk-YUKGWWL7.mjs → chunk-LR24AIEW.mjs} +1 -1
  49. package/dist/bin/hook-chunks/{chunk-2HB2JHQE.mjs → chunk-M4YM7Z3F.mjs} +15 -15
  50. package/dist/bin/hook-chunks/{chunk-F4T7IAA7.mjs → chunk-MW54MTLB.mjs} +1 -1
  51. package/dist/bin/hook-chunks/{chunk-7O6OMD4X.mjs → chunk-NCLONKOT.mjs} +1 -1
  52. package/dist/bin/hook-chunks/{chunk-HRWXMF7P.mjs → chunk-NJ74RHNC.mjs} +1 -1
  53. package/dist/bin/hook-chunks/{chunk-JUZ5LNDI.mjs → chunk-NLL5AV2G.mjs} +2 -2
  54. package/dist/bin/hook-chunks/{chunk-OIU4Y5WL.mjs → chunk-OC4CYF7V.mjs} +1 -1
  55. package/dist/bin/hook-chunks/chunk-OLQAMCYV.mjs +18 -0
  56. package/dist/bin/hook-chunks/{chunk-C3W2HLJT.mjs → chunk-PPWPUEBH.mjs} +1 -1
  57. package/dist/bin/hook-chunks/chunk-PVCEWFHS.mjs +51 -0
  58. package/dist/bin/hook-chunks/{chunk-Y3J7UUMR.mjs → chunk-QOQZHR3E.mjs} +1 -1
  59. package/dist/bin/hook-chunks/{chunk-2UC4DTDO.mjs → chunk-QXCEBAIA.mjs} +1 -1
  60. package/dist/bin/hook-chunks/chunk-RT2DFIWF.mjs +19 -0
  61. package/dist/bin/hook-chunks/{chunk-NCOOKPXX.mjs → chunk-SQW2B7NW.mjs} +1 -1
  62. package/dist/bin/hook-chunks/{chunk-IHECXD2M.mjs → chunk-SWJ7TLBD.mjs} +1 -1
  63. package/dist/bin/hook-chunks/{chunk-X2AGNDGD.mjs → chunk-TB57OYGW.mjs} +1 -1
  64. package/dist/bin/hook-chunks/{chunk-QPRNRLG6.mjs → chunk-TF6PN7IB.mjs} +1 -1
  65. package/dist/bin/hook-chunks/{chunk-KG7Z6OMK.mjs → chunk-TKXOMN4K.mjs} +4 -4
  66. package/dist/bin/hook-chunks/chunk-UMJ5D5I6.mjs +9 -0
  67. package/dist/bin/hook-chunks/{chunk-NWIQNII6.mjs → chunk-UVATSTRF.mjs} +1 -1
  68. package/dist/bin/hook-chunks/{chunk-NHIWYDQD.mjs → chunk-WJV24WE6.mjs} +1 -1
  69. package/dist/bin/hook-chunks/{chunk-Q3Z53QTH.mjs → chunk-WL6PKX3U.mjs} +1 -1
  70. package/dist/bin/hook-chunks/chunk-WUOVBBPC.mjs +11 -0
  71. package/dist/bin/hook-chunks/{chunk-TYEAIX3X.mjs → chunk-XDBJSJOT.mjs} +1 -1
  72. package/dist/bin/hook-chunks/{chunk-JCYXFHQZ.mjs → chunk-XSJ7SPVR.mjs} +1 -1
  73. package/dist/bin/hook-chunks/{chunk-J6TAD3OZ.mjs → chunk-XV2LJVYB.mjs} +1 -1
  74. package/dist/bin/hook-chunks/{chunk-7JEKBJAP.mjs → chunk-XYKVWO23.mjs} +1 -1
  75. package/dist/bin/hook-chunks/{chunk-4O4D6DV7.mjs → chunk-Y3RHBU2R.mjs} +2 -2
  76. package/dist/bin/hook-chunks/{chunk-JPSJWCFD.mjs → chunk-Y7MZA2G4.mjs} +1 -1
  77. package/dist/bin/hook-chunks/{chunk-T2FCU3ZS.mjs → chunk-YHOZTAZH.mjs} +1 -1
  78. package/dist/bin/hook-chunks/chunk-YLOK4WRR.mjs +8 -0
  79. package/dist/bin/hook-chunks/{chunk-OENWCYLF.mjs → chunk-ZJW27EUC.mjs} +1 -1
  80. package/dist/bin/hook-chunks/{chunk-VWOIUTAX.mjs → chunk-ZQI4TJ5C.mjs} +3 -3
  81. package/dist/bin/hook-chunks/chunk-ZYCNW75E.mjs +9 -0
  82. package/dist/bin/hook-chunks/{chunk-AZHE4VOM.mjs → chunk-ZZBNFNMG.mjs} +1 -1
  83. package/dist/bin/hook-chunks/{client-ERZ5CM3D.mjs → client-K3ZA2BLB.mjs} +3 -3
  84. package/dist/bin/hook-chunks/{code-graph-cloud-4GRWQSUK.mjs → code-graph-cloud-XGQF7XYC.mjs} +1 -1
  85. package/dist/bin/hook-chunks/{codex-skill-6DYQMPDJ.mjs → codex-skill-6CRFUF3A.mjs} +1 -1
  86. package/dist/bin/hook-chunks/{command-installer-MF4KUM3X.mjs → command-installer-MUHZWDZA.mjs} +1 -1
  87. package/dist/bin/hook-chunks/{config-manager-2VZPHUDG.mjs → config-manager-2JJPCLKC.mjs} +1 -1
  88. package/dist/bin/hook-chunks/{context7-service-V7CIDF3Q.mjs → context7-service-NH4BMGSJ.mjs} +1 -1
  89. package/dist/bin/hook-chunks/{custom-workflow-storage-UOBQXY42.mjs → custom-workflow-storage-VBMWLKA7.mjs} +1 -1
  90. package/dist/bin/hook-chunks/cwd-changed-UTD6Y4MS.mjs +8 -0
  91. package/dist/bin/hook-chunks/{database-XYKQF3KR.mjs → database-ZCP76LMM.mjs} +1 -1
  92. package/dist/bin/hook-chunks/{detect-changes-DFRJOOB3.mjs → detect-changes-5W6EGEZG.mjs} +1 -1
  93. package/dist/bin/hook-chunks/{developer-evolution-SLC34HUU.mjs → developer-evolution-UTY3CWOK.mjs} +1 -1
  94. package/dist/bin/hook-chunks/{distill-U2LJGUG3.mjs → distill-5TNAM3LY.mjs} +1 -1
  95. package/dist/bin/hook-chunks/{editors-config-6XFYIOE6.mjs → editors-config-2CACBNS4.mjs} +1 -1
  96. package/dist/bin/hook-chunks/{enriched-recall-X6RDNNIE.mjs → enriched-recall-6VOIUNLN.mjs} +1 -1
  97. package/dist/bin/hook-chunks/{format-ALUX4QSI.mjs → format-IIOFTSBF.mjs} +1 -1
  98. package/dist/bin/hook-chunks/{judgment-ledger-storage-SCGU3URM.mjs → judgment-ledger-storage-7Q7AEEY6.mjs} +1 -1
  99. package/dist/bin/hook-chunks/{judgment-orchestrator-BYPG65RS.mjs → judgment-orchestrator-AAON4ZJ4.mjs} +1 -1
  100. package/dist/bin/hook-chunks/{judgment-receipt-GWSSCLAB.mjs → judgment-receipt-QLV3MYFT.mjs} +1 -1
  101. package/dist/bin/hook-chunks/{land-cue-MMISX2BI.mjs → land-cue-57B23PEL.mjs} +1 -1
  102. package/dist/bin/hook-chunks/{land-synthesis-WG5JAS7B.mjs → land-synthesis-ZVPFJERV.mjs} +1 -1
  103. package/dist/bin/hook-chunks/{legacy-crew-sweep-2WSO5KEB.mjs → legacy-crew-sweep-GR6HRSHX.mjs} +2 -2
  104. package/dist/bin/hook-chunks/{memory-index-QK5QJOFJ.mjs → memory-index-XE2MWKQS.mjs} +1 -1
  105. package/dist/bin/hook-chunks/{notification-MPVWVV52.mjs → notification-GU2ZJP5K.mjs} +1 -1
  106. package/dist/bin/hook-chunks/{pack-integrity-XRYOROK5.mjs → pack-integrity-WV5U3AFF.mjs} +1 -1
  107. package/dist/bin/hook-chunks/{pack-manager-WWGQNJDQ.mjs → pack-manager-QLFQKP24.mjs} +1 -1
  108. package/dist/bin/hook-chunks/{path-manager-ZR5RAKTK.mjs → path-manager-375HH6TB.mjs} +1 -1
  109. package/dist/bin/hook-chunks/{planning-S55KBPN2.mjs → planning-VPAX5DZL.mjs} +2 -2
  110. package/dist/bin/hook-chunks/{post-edit-QMHSZHDN.mjs → post-edit-UXCFSR3Y.mjs} +1 -1
  111. package/dist/bin/hook-chunks/{pre-bash-RAM6L3G4.mjs → pre-bash-MB4JNNYG.mjs} +1 -1
  112. package/dist/bin/hook-chunks/{pre-commit-736ZLMDL.mjs → pre-commit-U7TRFKWX.mjs} +1 -1
  113. package/dist/bin/hook-chunks/pre-edit-MDCQXI5F.mjs +11 -0
  114. package/dist/bin/hook-chunks/{pre-package-LCIAWWGK.mjs → pre-package-A6ZI5R64.mjs} +1 -1
  115. package/dist/bin/hook-chunks/{pre-search-J5EOFMYN.mjs → pre-search-ZZO3LGXJ.mjs} +1 -1
  116. package/dist/bin/hook-chunks/{pre-secrets-TSUMTXHH.mjs → pre-secrets-MWPPZPWK.mjs} +1 -1
  117. package/dist/bin/hook-chunks/{prjct-md-T2DG236Y.mjs → prjct-md-MS52YLI2.mjs} +1 -1
  118. package/dist/bin/hook-chunks/{project-agent-surfaces-VRY22I66.mjs → project-agent-surfaces-6AIW7KL6.mjs} +1 -1
  119. package/dist/bin/hook-chunks/{project-file-inventory-5DEN5VLF.mjs → project-file-inventory-HHURZTMH.mjs} +1 -1
  120. package/dist/bin/hook-chunks/project-memory-UDH56VFP.mjs +8 -0
  121. package/dist/bin/hook-chunks/{project-style-evolution-7MAUSED2.mjs → project-style-evolution-IJXT2MCP.mjs} +1 -1
  122. package/dist/bin/hook-chunks/prompt-7VZLYONO.mjs +24 -0
  123. package/dist/bin/hook-chunks/{publish-helper-G54XQV5K.mjs → publish-helper-ZSL27HSX.mjs} +1 -1
  124. package/dist/bin/hook-chunks/{purge-MC5LFSAO.mjs → purge-N2WN6NDB.mjs} +1 -1
  125. package/dist/bin/hook-chunks/retention-RET4P2RO.mjs +8 -0
  126. package/dist/bin/hook-chunks/{sdd-5UCVX43H.mjs → sdd-PB6WKSLE.mjs} +1 -1
  127. package/dist/bin/hook-chunks/{session-continuity-RKNAJJHR.mjs → session-continuity-BIJXMN44.mjs} +1 -1
  128. package/dist/bin/hook-chunks/session-start-R2VMKW2L.mjs +8 -0
  129. package/dist/bin/hook-chunks/settings-installer-CQKMGMRG.mjs +9 -0
  130. package/dist/bin/hook-chunks/{setup-WQRJ6TQL.mjs → setup-PPIZHVXS.mjs} +3 -3
  131. package/dist/bin/hook-chunks/{shipping-5D5LTJ3P.mjs → shipping-C637PCOF.mjs} +4 -4
  132. package/dist/bin/hook-chunks/{skill-index-RAVJMC4P.mjs → skill-index-55I3HLAI.mjs} +1 -1
  133. package/dist/bin/hook-chunks/{spec-context-inference-7DDSTRTV.mjs → spec-context-inference-RTTDOZZO.mjs} +1 -1
  134. package/dist/bin/hook-chunks/{spec-service-LAO5Z2M5.mjs → spec-service-ENLAAMVL.mjs} +2 -2
  135. package/dist/bin/hook-chunks/{spec-task-breakdown-K3GMQKGH.mjs → spec-task-breakdown-RUDEP3AY.mjs} +1 -1
  136. package/dist/bin/hook-chunks/{state-storage-EIFGUO7X.mjs → state-storage-AJUPG7J5.mjs} +1 -1
  137. package/dist/bin/hook-chunks/stop-DPXAWJFN.mjs +16 -0
  138. package/dist/bin/hook-chunks/subagent-start-AFHPXL2S.mjs +8 -0
  139. package/dist/bin/hook-chunks/{subagent-stop-RBD2OILE.mjs → subagent-stop-5BMV63ML.mjs} +1 -1
  140. package/dist/bin/hook-chunks/{surface-attribution-K37N2NK7.mjs → surface-attribution-EGIKCVMF.mjs} +1 -1
  141. package/dist/bin/hook-chunks/{symbol-graph-BKQIMFRG.mjs → symbol-graph-MH42JSPX.mjs} +1 -1
  142. package/dist/bin/hook-chunks/{sync-client-EGBMWF3J.mjs → sync-client-PIRHMHXL.mjs} +1 -1
  143. package/dist/bin/hook-chunks/{sync-cursor-storage-E3LMZISA.mjs → sync-cursor-storage-ZB7FGT6D.mjs} +1 -1
  144. package/dist/bin/hook-chunks/{task-orchestration-2ZYE5M6J.mjs → task-orchestration-7NGRIISS.mjs} +1 -1
  145. package/dist/bin/hook-chunks/{task-overview-ITY5OSHX.mjs → task-overview-F3GB77OA.mjs} +1 -1
  146. package/dist/bin/hook-chunks/task-service-FZABHPFV.mjs +8 -0
  147. package/dist/bin/hook-chunks/{tdd-7S55S5C3.mjs → tdd-TAMBOPN3.mjs} +1 -1
  148. package/dist/bin/hook-chunks/{template-loader-SCM4C2A3.mjs → template-loader-MXOMU4XH.mjs} +1 -1
  149. package/dist/bin/hook-chunks/{transcript-jsonl-6X4DDD6R.mjs → transcript-jsonl-7W2NOJPZ.mjs} +1 -1
  150. package/dist/bin/hook-chunks/{usefulness-SCH5ARGV.mjs → usefulness-TBD5EYAL.mjs} +1 -1
  151. package/dist/bin/hook-chunks/{vault-retire-notice-HT756AND.mjs → vault-retire-notice-7XHVNHU6.mjs} +1 -1
  152. package/dist/bin/hook-chunks/{velocity-storage-47CF3XWZ.mjs → velocity-storage-IOCVK2LU.mjs} +1 -1
  153. package/dist/bin/hook-chunks/{weak-model-mode-FLCEQ2BV.mjs → weak-model-mode-BMSPGEQY.mjs} +1 -1
  154. package/dist/bin/hook-chunks/{work-graph-JQHVVXIZ.mjs → work-graph-AVAOKY63.mjs} +1 -1
  155. package/dist/bin/hook-chunks/work-scope-YCS4GTXW.mjs +8 -0
  156. package/dist/bin/hook-chunks/{workspace-occupancy-UUW4UGGB.mjs → workspace-occupancy-JOBYNNXV.mjs} +1 -1
  157. package/dist/bin/hook-fast-darwin-arm64 +0 -0
  158. package/dist/bin/hook-fast-darwin-x64 +0 -0
  159. package/dist/bin/hook-fast-linux-x64 +0 -0
  160. package/dist/bin/prjct-core.mjs +739 -714
  161. package/dist/bin/prjct-hooks.mjs +3 -3
  162. package/dist/bin/prjct.mjs +22 -9
  163. package/dist/daemon/entry.mjs +620 -593
  164. package/dist/mcp/server.mjs +317 -303
  165. package/package.json +3 -5
  166. package/scripts/install.sh +28 -496
  167. package/dist/bin/hook-chunks/chunk-27XFSCOE.mjs +0 -43
  168. package/dist/bin/hook-chunks/chunk-4SKJWNKE.mjs +0 -11
  169. package/dist/bin/hook-chunks/chunk-AZYQFRPJ.mjs +0 -9
  170. package/dist/bin/hook-chunks/chunk-DRGI5UHQ.mjs +0 -10
  171. package/dist/bin/hook-chunks/chunk-GFY4GY3Z.mjs +0 -8
  172. package/dist/bin/hook-chunks/chunk-JAMSIKDE.mjs +0 -9
  173. package/dist/bin/hook-chunks/chunk-NUJASVHN.mjs +0 -18
  174. package/dist/bin/hook-chunks/chunk-NWZEBCTC.mjs +0 -19
  175. package/dist/bin/hook-chunks/chunk-PW3KYKVS.mjs +0 -9
  176. package/dist/bin/hook-chunks/chunk-TFCLMTJ5.mjs +0 -9
  177. package/dist/bin/hook-chunks/chunk-TRMBRDKH.mjs +0 -8
  178. package/dist/bin/hook-chunks/chunk-V2BSS7HW.mjs +0 -36
  179. package/dist/bin/hook-chunks/chunk-ZJXH76Q5.mjs +0 -11
  180. package/dist/bin/hook-chunks/cwd-changed-J6O46KS7.mjs +0 -8
  181. package/dist/bin/hook-chunks/pre-edit-GZ4QJ2MU.mjs +0 -11
  182. package/dist/bin/hook-chunks/project-memory-KKEMTEMP.mjs +0 -8
  183. package/dist/bin/hook-chunks/prompt-DVF6V2X2.mjs +0 -22
  184. package/dist/bin/hook-chunks/retention-LWETHQX3.mjs +0 -8
  185. package/dist/bin/hook-chunks/session-start-MFMFKUPK.mjs +0 -8
  186. package/dist/bin/hook-chunks/settings-installer-QDM3GB6J.mjs +0 -9
  187. package/dist/bin/hook-chunks/stop-RYLI4FGF.mjs +0 -16
  188. package/dist/bin/hook-chunks/subagent-start-CCUPSANT.mjs +0 -8
  189. package/dist/bin/hook-chunks/task-service-XREJLWEF.mjs +0 -8
  190. package/dist/bin/hook-chunks/work-scope-CDLSZ4U5.mjs +0 -8
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a,b,c,d,e,f,g}from"./chunk-Q3EYM4GJ.mjs";import"./chunk-AZYQFRPJ.mjs";import"./chunk-JR542RI2.mjs";import"./chunk-HHIGNKDO.mjs";import"./chunk-7GNWHWOO.mjs";import"./chunk-27XFSCOE.mjs";import"./chunk-YUKGWWL7.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-5EQLQ7GF.mjs";import"./chunk-UA4Z5TGG.mjs";import"./chunk-TG5CQJD5.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-AZHE4VOM.mjs";import"./chunk-6RLCUGGG.mjs";import"./chunk-KG7Z6OMK.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-JAMSIKDE.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-EMTCZG5I.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{f as bridgeStyleToMemory,g as formatProjectStyleForSync,a as getActiveProjectStyle,b as getProjectEvolution,d as persistProjectStyleSnapshot,e as recomputeProjectStyle,c as renderProjectEvolution};
8
+ import{a,b,c,d,e,f,g}from"./chunk-33BHU4OM.mjs";import"./chunk-ZYCNW75E.mjs";import"./chunk-JR542RI2.mjs";import"./chunk-CPR4FPXG.mjs";import"./chunk-3HGQPUKG.mjs";import"./chunk-PVCEWFHS.mjs";import"./chunk-LR24AIEW.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-FZS3XGEA.mjs";import"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-ZZBNFNMG.mjs";import"./chunk-3FEXJUO2.mjs";import"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-IJ523YO2.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{f as bridgeStyleToMemory,g as formatProjectStyleForSync,a as getActiveProjectStyle,b as getProjectEvolution,d as persistProjectStyleSnapshot,e as recomputeProjectStyle,c as renderProjectEvolution};
@@ -0,0 +1,24 @@
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 C,b as Z}from"./chunk-MXHX44WF.mjs";import{a as Q}from"./chunk-SQW2B7NW.mjs";import{a as W}from"./chunk-5WAONIPX.mjs";import{a as X,d as Y}from"./chunk-OLQAMCYV.mjs";import"./chunk-NJ74RHNC.mjs";import{a as J}from"./chunk-WUOVBBPC.mjs";import"./chunk-KDNUQPAK.mjs";import{a as K}from"./chunk-5TBQNW2G.mjs";import{a as z}from"./chunk-ADYTBOCZ.mjs";import{a as O}from"./chunk-XV2LJVYB.mjs";import{a as V}from"./chunk-3UB6SFRA.mjs";import{a as L}from"./chunk-YHOZTAZH.mjs";import{b as F}from"./chunk-LF3S3MYE.mjs";import"./chunk-XSJ7SPVR.mjs";import{b as q}from"./chunk-Y7MZA2G4.mjs";import"./chunk-TPESWBA7.mjs";import"./chunk-NLL5AV2G.mjs";import{a as U,g as B}from"./chunk-NCLONKOT.mjs";import"./chunk-22GFTUER.mjs";import"./chunk-YQ55MHKL.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-KOGZCFBC.mjs";import"./chunk-BKJHD5JI.mjs";import"./chunk-33BHU4OM.mjs";import"./chunk-ZYCNW75E.mjs";import"./chunk-JR542RI2.mjs";import"./chunk-CPR4FPXG.mjs";import"./chunk-3HGQPUKG.mjs";import"./chunk-KEJ5RMAI.mjs";import"./chunk-ZMLA5SKR.mjs";import"./chunk-3CKNJ5RA.mjs";import"./chunk-R4ILCXKE.mjs";import"./chunk-TF6PN7IB.mjs";import{d as T}from"./chunk-XYKVWO23.mjs";import"./chunk-7PBWIO4K.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import{b as v}from"./chunk-PVCEWFHS.mjs";import"./chunk-LR24AIEW.mjs";import"./chunk-UUULLTQV.mjs";import{b as x}from"./chunk-D7DQABWO.mjs";import"./chunk-OUAS3LZ3.mjs";import"./chunk-ETTDRXQ6.mjs";import"./chunk-FZS3XGEA.mjs";import"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GVNMXVVA.mjs";import{h as j,i as S}from"./chunk-JGZ3QGWX.mjs";import{c as w}from"./chunk-QXCEBAIA.mjs";import"./chunk-GAOQHD5S.mjs";import{b}from"./chunk-ZZBNFNMG.mjs";import"./chunk-3FEXJUO2.mjs";import{d as H,g as lt}from"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import{k as N,o as ut}from"./chunk-UH4MD3F3.mjs";import{b as M,p as at}from"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-IJ523YO2.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as u}from"./chunk-E66B27AL.mjs";import{createHash as A}from"node:crypto";import y from"node:fs/promises";import f from"node:path";var dt=15;function tt(e){let r=[],i=[];e.loop?.stopped&&e.loop.message&&(r.push("loop-hard-stop"),i.push(e.loop.message)),e.pressure?.level==="critical"&&e.pressure.cue?(r.push("context-pressure-critical"),i.push(e.pressure.cue)):e.pressure?.level==="warn"&&e.pressure.cue&&(r.push("context-pressure-warn"),i.push(e.pressure.cue)),e.qualityInject?.trim()&&(r.push("quality-ledger"),i.push(e.qualityInject.trim()));let t=e.turns??0,n=e.stuckThreshold??dt;if(!e.loop?.stopped&&t>=n&&(r.push("stuck-cycle"),i.push(`\u26A0 ${t} turns on this cycle and it is still open. If you are not nearly done, STOP looping: split it, ship the slice that works, or check in with the user \u2014 then \`prjct status done\`. A re-plan beats another grinding turn.`)),i.length===0)return{level:"ok",markdown:null,cues:[]};let s=r.some(g=>["loop-hard-stop","context-pressure-critical","context-pressure-warn"].includes(g)),a=r.some(g=>["quality-ledger","stuck-cycle"].includes(g)),c=s?"hard":a?"warn":"ok",m=c==="hard"?"# prjct: alignment (MUST \u2014 hard gate)":"# prjct: alignment (mid-cycle)",d=i.join(`
9
+
10
+ `),o=r.includes("quality-ledger")&&!d.includes("prjct ship")?`
11
+
12
+ _${U}_`:"";return{level:c,cues:r,markdown:`${m}
13
+
14
+ ${d}${o}`}}u(tt,"buildAlignmentCard");lt();at();ut();var P=1500,pt=P+2100,et=15,mt=10,R=8,nt=420,gt=2,ft=15e3;var ht=new Set(["address","apply","check","continue","create","current","description","feedback","handle","merge","monitor","please","review","should","title","watch","write"]),E=new WeakMap,$=new Map;async function rt(e,r,i={}){let t=r!==void 0?r:await b.readConfig(e);if(!t?.projectId)return null;let n=yt(t,e,i),s=["# prjct: project state"];try{let c=await V(t.projectId,e);if(c.current){let d=st(c.current.startedAt);s.push(`- Active work cycle: "${c.current.description}" (${d}) [${c.current.label}]`);let{turns:o,loopVerdict:g,currentTask:l}=(()=>{try{let p=c.mainTaskRaw;return{turns:p?.turnCount??0,currentTask:p,loopVerdict:W(t,p)}}catch{return{turns:0,currentTask:null,loopVerdict:null}}})();!g?.stopped&&o>0&&o%mt===0&&o<et&&s.push(` \u21B3 Turn ${o} on this cycle \u2014 still advancing the goal? If stuck, re-plan or split; do not loop.`);try{let p=t.maxTokensPerCycle??0;if(p>0&&l){let h=(l.tokensIn??0)+(l.tokensOut??0);h>=p?s.push(` \u26A0 Token budget: ${h.toLocaleString()} of ${p.toLocaleString()} spent on this cycle. STOP growing it \u2014 ship the working slice, split the remainder into a new cycle, or check in with the user.`):h>=p*.8&&s.push(` \u21B3 Token budget: ${h.toLocaleString()} of ${p.toLocaleString()} (${Math.round(h/p*100)}%). Plan the close: prefer finishing over expanding scope.`)}}catch{}try{let p=c.current.startedAt;if(p){let h=H.get(t.projectId,`SELECT COUNT(DISTINCT json_extract(data, '$.file')) AS c
15
+ FROM events WHERE type = 'memory.post_edit' AND timestamp >= ?`,p)?.c??0,I=q(h);I&&s.push(` ${I}`)}}catch{}try{let p=K(t,l),h=B(t.projectId),I=tt({loop:g,pressure:p,qualityInject:h,turns:o,stuckThreshold:et});I.markdown&&(s.push(""),s.push(I.markdown))}catch{}l?.ownerAgent&&s.push(`- Owner: ${l.ownerAgent}${l.ownerIdentity?`/${l.ownerIdentity}`:""}${l.yieldStatus==="yielded"?" (yielded \u2014 awaiting accept)":""}`)}let m=c.all.filter(d=>!d.isCurrent);m.length>0&&s.push(`- ${m.length} task(s) active in other workspace(s)`),!c.current&&m.length>0&&s.push("- This workspace idle but siblings busy \u2014 `prjct work` auto-isolates to a worktree when needed")}catch{}let a=await n;for(let c of a)c&&s.push(c);return s.length===1?null:s.join(`
16
+ `)}u(rt,"buildProjectState");function yt(e,r,i={}){return Promise.all([i.skipHandoff?Promise.resolve(null):(async()=>{try{let{formatPendingHandoffCue:t}=await import("./agent-switch-I4MTVE56.mjs"),n=t(e.projectId);return n?`- ${n.replace(/\n/g,`
17
+ - `)}`:null}catch{return null}})(),(async()=>{try{let t=await L.getActiveTasks(e.projectId);return t.length>0?`- Pending: ${t.length} \xB7 Next: "${t[0].description}"`:null}catch{return null}})(),(async()=>{try{if(!await N(f.join(r,".git")))return null;let t=await vt(r);if(!t.branch)return null;let n=[];t.modified>0&&n.push(`${t.modified} modified`),t.staged>0&&n.push(`${t.staged} staged`),t.untracked>0&&n.push(`${t.untracked} untracked`);let s=n.length>0?` \u2014 working tree ${n.join(", ")}`:"",a=t.ahead>0?`${s?",":" \u2014"} ${t.ahead} unpushed`:"";return`- Branch: ${t.branch}${s}${a}`}catch{return null}})(),(async()=>{try{let t=await O.getRecent(e.projectId,1);if(t.length===0)return null;let n=t[0],s=st(n.shippedAt??"");return`- Last ship: ${n.version?`v${n.version}`:n.name} (${s})`}catch{return null}})(),(async()=>{try{let t=v.countByType(e.projectId,"inbox");return t>0?`- Inbox: ${t} items pending`:null}catch{return null}})()])}u(yt,"collectSecondarySignals");function It(e){return e.type==="voice"||e.type==="glossary"?!0:e.type==="example"&&!!e.tags.domain&&(e.tags.polarity==="good"||e.tags.polarity==="bad")}u(It,"isValidGuidanceEntry");function kt(e,r){try{let i=C(r),t=j(r).filter(o=>o.length>=5&&!ht.has(o)),n=t.length>0?v.searchFts(e,t,R*2):[],s=i?v.recall(e,{types:["voice","glossary","example"],limit:R*2}).filter(o=>o.tags.domain==="delivery"||o.tags.domain===i):[],a=new Map([...n,...s].map(o=>[o.id,o])),c=new Map([["voice",0],["glossary",1],["example",2]]),m=[...a.values()].filter(It).sort((o,g)=>(c.get(o.type)??3)-(c.get(g.type)??3)).slice(0,gt);if(m.length===0)return null;let d=["# prjct: selective guidance"];for(let o of m){let g=o.type==="example"?` ${o.tags.polarity}/${o.tags.domain}`:o.tags.domain?` ${o.tags.domain}`:"",l=nt-d.join(`
18
+ `).length-g.length-8;if(l<24)break;let p=S(o.content.replace(/\s+/g," ").trim(),Math.min(150,l));d.push(`- ${o.type}${g}: ${p}`)}return d.length===1?null:{text:S(d.join(`
19
+ `),nt),memoryIds:m.slice(0,d.length-1).map(o=>o.id)}}catch{return null}}u(kt,"buildSelectiveGuidance");function wt(e,r,i=P){if(!r)return e;let t=e?`${e}
20
+
21
+ ${r}`:r;return t.length<=i?t:null}u(wt,"appendPromptSection");function it(e,r){try{let i=j(r);if(i.length===0)return null;let t=v.searchFts(e,i,R),n=t.find(s=>s.type==="decision"||s.type==="gotcha"||s.type==="fact")??t.find(s=>s.type==="anti-pattern"||s.type==="pattern")??t.find(s=>s.type==="gotcha"||s.type==="anti-pattern");return n?n.type==="decision"||n.type==="gotcha"||n.type==="fact"?{cue:`> Tip\u2192user (SoT): ${T(n)} \`${n.id}\` \u2014 say it briefly in chat; binding \u2014 do not contradict without superseding`,memoryId:n.id}:n.type==="anti-pattern"||n.type==="pattern"?{cue:`> Tip\u2192user (suggest): ${T(n)} \`${n.id}\` \u2014 propose the live change in chat, then apply when editing`,memoryId:n.id}:{cue:`> Tip\u2192user: ${T(n)} \`${n.id}\``,memoryId:n.id}:null}catch{return null}}u(it,"buildTopicalCueResult");function ie(e,r,i){return it(e,r)?.cue??null}u(ie,"buildTopicalCue");var k=new Map,D={skipDiskSnapshotOnce:!1};function se(){k.clear(),D.skipDiskSnapshotOnce=!0}u(se,"_resetGitSnapshotCacheForTests");async function vt(e){let r=await y.stat(f.join(e,".git","index")).then(a=>a.mtimeMs).catch(()=>0),i=k.get(e);if(i&&i.expiresAt>Date.now()&&i.indexMtimeMs===r)return i.snapshot;let t=St(e);if(!i&&!D.skipDiskSnapshotOnce){let a=await y.readFile(t,"utf-8").then(c=>JSON.parse(c)).catch(()=>null);if(a&&a.expiresAt>Date.now()&&a.indexMtimeMs===r)return k.set(e,a),a.snapshot}D.skipDiskSnapshotOnce=!1;let n=await Pt(e);k.size>32&&k.clear();let s={snapshot:n,expiresAt:Date.now()+ft,indexMtimeMs:r};return k.set(e,s),y.mkdir(f.dirname(t),{recursive:!0}).then(()=>y.writeFile(t,JSON.stringify(s))).catch(()=>{}),n}u(vt,"captureGit");function St(e){let r=A("sha1").update(f.resolve(e)).digest("hex").slice(0,16);return f.join(w.runDir(),`prompt-git-${r}.json`)}u(St,"gitSnapshotPath");function _(e,r){let i=A("sha1").update(f.resolve(r)).digest("hex").slice(0,12);return`${e.replace(/[^a-zA-Z0-9._-]/g,"_")}-${i}`}u(_,"promptHashKey");async function bt(e,r,i){let t=_(e,r),n=A("sha256").update(i).digest("hex");if($.get(t)===n)return null;$.size>64&&$.clear(),$.set(t,n);let s=f.join(w.runDir(),`prompt-state-${t}.hash`);return(await y.readFile(s,"utf-8").catch(()=>"")).trim()===n?null:(await y.mkdir(f.dirname(s),{recursive:!0}).then(()=>y.writeFile(s,n)).catch(()=>{}),i)}u(bt,"dedupePromptPayload");function Tt(e,r){return f.join(w.runDir(),`prompt-afteremit-${_(e,r)}.json`)}u(Tt,"promptAfterEmitStampPath");async function $t(e,r,i,t){let n=Tt(e,r),s=A("sha256").update(i).digest("hex");await y.mkdir(f.dirname(n),{recursive:!0}).then(()=>y.writeFile(n,JSON.stringify({hash:s,record:t}))).catch(()=>{})}u($t,"persistPromptAfterEmit");async function At(e,r){try{let i=_(e,r),t=w.runDir(),[n,s]=await Promise.all([y.readFile(f.join(t,`prompt-afteremit-${i}.json`),"utf-8"),y.readFile(f.join(t,`prompt-state-${i}.hash`),"utf-8")]),a=JSON.parse(n),c=a.record;return!c||a.hash!==s.trim()||c.projectId!==e||!Array.isArray(c.surfacedIds)?null:c}catch{return null}}u(At,"readPersistedPromptAfterEmit");async function Pt(e){let r={branch:"",modified:0,staged:0,untracked:0,ahead:0},i=u(async o=>{try{return(await M("git",o,{cwd:e,timeout:2e3})).stdout.trim()}catch{return""}},"safe"),[t,n,s]=await Promise.all([i(["branch","--show-current"]),i(["status","--porcelain"]),i(["rev-list","--count","@{u}..HEAD"])]);if(!t)return r;let{modified:a,staged:c,untracked:m}=n.split(`
22
+ `).filter(Boolean).reduce((o,g)=>{let l=g.slice(0,2);return l.startsWith("??")?o.untracked++:(l[0]!==" "&&l[0]!=="?"&&o.staged++,l[1]!==" "&&o.modified++),o},{modified:0,staged:0,untracked:0}),d=Number.parseInt(s,10)||0;return{branch:t,modified:a,staged:c,untracked:m,ahead:d}}u(Pt,"captureGitUncached");function st(e){if(!e)return"unknown";let r=Date.parse(e);if(Number.isNaN(r))return"unknown";let i=Math.max(0,Math.floor((Date.now()-r)/864e5));return i<1?"today":i<2?"yesterday":i<30?`${i}d ago`:`${Math.floor(i/30)}mo ago`}u(st,"formatRelative");function ot(e,r,i,t=P){let n=it(e,r),s=F(e,r),a=Z(r),c=kt(e,r),m=[n?.cue,a,c?.text,s].filter(l=>!!l).reduce((l,p)=>wt(l,p,t)??l,S(i,t)),d=!!(c?.text&&m.includes(c.text)),g=!!(a&&m.includes(a))?`delivery:${C(r)??"unknown"}`:d?c?.memoryIds[0]??null:null;return{prioritized:m,cueResult:n,guidance:c,guidanceIncluded:d,guidanceRuleId:g}}u(ot,"computePromptGuidance");function oe(e=process.cwd(),r){return J({event:"UserPromptSubmit",projectPath:e,build:u(async(i,t,n)=>{let s=(i.prompt??"").trim();if(!s)return null;let a=await b.readConfig(t);if(!a?.projectId)return null;let c=n==="kimi"?await Y(a.projectId,i.session_id,n).catch(()=>null):null,m=await rt(t,a,{skipHandoff:!!c}),d=c?await X(t,a,{digest:c==="digest"}).catch(()=>null):null;if(!m&&!d)return null;let o=[d,m].filter(Boolean).join(`
23
+
24
+ `),g=d?pt:P,{prioritized:l,cueResult:p,guidance:h,guidanceIncluded:I,guidanceRuleId:ct}=ot(a.projectId,s,o,g),G={projectId:a.projectId,projectPath:t,bumpTurn:!!m?.includes("Active work cycle:"),surfacedIds:[...p?[p.memoryId]:[],...I?h?.memoryIds??[]:[]],guidanceRuleId:ct};return E.set(i,G),await $t(a.projectId,t,l,G),bt(a.projectId,t,l)},"build"),afterEmit:u(async(i,t)=>{let n=E.get(i)??await jt(i,t);E.delete(i),n&&await Promise.all([n.bumpTurn?x.bumpTurnCount(n.projectId).then(()=>{}):Promise.resolve(),n.surfacedIds.length>0?z(n.projectId,n.projectPath,n.surfacedIds):Promise.resolve(),n.guidanceRuleId?Promise.resolve(Q.recordGuidanceActivation(n.projectId,{ruleId:n.guidanceRuleId})).then(()=>{}):Promise.resolve()])},"afterEmit")},r)}u(oe,"runPromptHook");async function jt(e,r){let i=(e.prompt??"").trim();if(!i)return null;let t=await b.readConfig(r).catch(()=>null);if(!t?.projectId)return null;let n=await At(t.projectId,r);if(n)return n;let[s,a]=await Promise.all([x.getCurrentTask(t.projectId).catch(()=>null),rt(r,t)]),{cueResult:c,guidance:m,guidanceIncluded:d,guidanceRuleId:o}=ot(t.projectId,i,a??"");return{projectId:t.projectId,projectPath:r,bumpTurn:!!s,surfacedIds:[...c?[c.memoryId]:[],...d?m?.memoryIds??[]:[]],guidanceRuleId:o}}u(jt,"rebuildPromptAfterEmit");export{se as _resetGitSnapshotCacheForTests,Z as buildDeliveryGuidance,rt as buildProjectState,kt as buildSelectiveGuidance,ie as buildTopicalCue,C as classifyDeliveryIntent,oe as runPromptHook};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a,b}from"./chunk-UA4Z5TGG.mjs";import"./chunk-TG5CQJD5.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-KG7Z6OMK.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-JAMSIKDE.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as publishCRUD,b as publishCRUDSync};
8
+ import{a,b}from"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as publishCRUD,b as publishCRUDSync};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a,b,c,d,e,f,g,h,i,j}from"./chunk-NWZEBCTC.mjs";import"./chunk-27XFSCOE.mjs";import"./chunk-YUKGWWL7.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-5EQLQ7GF.mjs";import"./chunk-UA4Z5TGG.mjs";import"./chunk-TG5CQJD5.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-AZHE4VOM.mjs";import"./chunk-6RLCUGGG.mjs";import"./chunk-KG7Z6OMK.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-JAMSIKDE.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-EMTCZG5I.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{d as AUTO_SOURCE_PREFIXES,b as DEFAULT_ARCHIVE_PRUNE_DAYS,c as DEFAULT_AUTO_SOURCE_MAX_LIVE,a as DEFAULT_SOFT_DELETED_PURGE_DAYS,e as isAutoSource,g as purgeOrphanRememberEvents,f as purgeSoftDeleted,j as runVaultPurge,h as trimAutoSourceCap,i as vaultHealth};
8
+ import{a,b,c,d,e,f,g,h,i,j}from"./chunk-RT2DFIWF.mjs";import"./chunk-PVCEWFHS.mjs";import"./chunk-LR24AIEW.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-FZS3XGEA.mjs";import"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-ZZBNFNMG.mjs";import"./chunk-3FEXJUO2.mjs";import"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-IJ523YO2.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{d as AUTO_SOURCE_PREFIXES,b as DEFAULT_ARCHIVE_PRUNE_DAYS,c as DEFAULT_AUTO_SOURCE_MAX_LIVE,a as DEFAULT_SOFT_DELETED_PURGE_DAYS,e as isAutoSource,g as purgeOrphanRememberEvents,f as purgeSoftDeleted,j as runVaultPurge,h as trimAutoSourceCap,i as vaultHealth};
@@ -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 k}from"./chunk-YLOK4WRR.mjs";import"./chunk-ZMLA5SKR.mjs";import"./chunk-SJ75V4WG.mjs";import{b as P}from"./chunk-3CKNJ5RA.mjs";import"./chunk-R4ILCXKE.mjs";import{b as O,c as U}from"./chunk-TF6PN7IB.mjs";import{a as Y}from"./chunk-H2DGDAQP.mjs";import"./chunk-XYKVWO23.mjs";import{a as ee,b as te,c as A,d as ne,e as re,f as T,g as C,h as se,i as oe}from"./chunk-EGCYDLSO.mjs";import"./chunk-7PBWIO4K.mjs";import"./chunk-Y5NQV46G.mjs";import{a as I,h as L}from"./chunk-DXQMKW2B.mjs";import{a as z,e as J,f as q,g as K,h as Q,i as Z,j}from"./chunk-RT2DFIWF.mjs";import{a as $,b as x}from"./chunk-PVCEWFHS.mjs";import"./chunk-LR24AIEW.mjs";import"./chunk-UUULLTQV.mjs";import{c as D}from"./chunk-FZS3XGEA.mjs";import"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-ZZBNFNMG.mjs";import"./chunk-3FEXJUO2.mjs";import{a as w,b as H,e as S,g as G}from"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import{b as M,g as F}from"./chunk-GCKILEXJ.mjs";import"./chunk-IJ523YO2.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as l}from"./chunk-E66B27AL.mjs";H();G();var X=new Set(["decision","gotcha","learning","feedback","fact","shipped","spec"]),ie=30,ce=50,ae=20,de=45,ue=25,le=15,pe=180,V=90,me=25,fe=.12,he=40,ge=40,xe=30,Ee=20,ye=35,Re=.12,ve=864e5,be=100,_e=50,Se=25,De=15,Ae=/\b[\w.-]+(?:\/[\w.-]+)+\.(?:ts|tsx|js|jsx|mjs|cjs|json|md|sh|toml|yml|yaml)\b/g;function Me(e,t){let s=x.allEntriesForIndex(e),r=new Set;for(let a of s)for(let p of O(a.tags))r.add(p);let n=(()=>{try{let a=P(e);return a?new Set(Object.keys(a.documents)):null}catch{return null}})(),i=A(s),c=T(i);return{entries:s,usefulness:U.decayedScores(e,t),supersededIds:F(s),correctedIds:r,indexedPaths:n,nowMs:t,refIndex:c}}l(Me,"collectRetentionInputs");function Ie(e){let t=new Map,s=new Set,r=[...e].sort((n,i)=>i.rememberedAt.localeCompare(n.rememberedAt));for(let n of r){let i=w(n.content);t.has(i)?s.add(n.id):t.set(i,n)}return s}l(Ie,"collectDuplicateIds");function Te(e,t){let s=e.content.match(Ae);return!s||s.length===0?!1:!s.some(r=>t.has(r))}l(Te,"isUngrounded");function Ce(e,t,s){let r=[],n=C(e.content,t.refIndex,e.id),i=s.has(e.id);i&&!n.exactDup&&r.push("duplicate of newer entry"),r.push(`excess ${n.excess.toFixed(2)} (sim ${n.maxSim.toFixed(2)})`);let c=n.exactDup||n.nearDup||n.excess<Re;c&&r.push(n.exactDup?`exact dup of ${n.nearestId}`:n.nearDup?`near-dup of ${n.nearestId}`:"low excess vs reference");let a=t.usefulness.get(e.id)??0,p=Math.min(ue,Math.max(0,a*8));a>0&&r.push(`used (+${Math.round(p)})`);let u=Math.max(0,(t.nowMs-Date.parse(e.rememberedAt))/ve),h=Number.isFinite(u)?Math.max(0,le*(1-u/pe)):0,o=a<=0&&Number.isFinite(u)&&u>V?Math.min(me,(u-V)*fe):0;o>0&&r.push(`idle ${Math.round(u)}d`);let f=t.supersededIds.has(e.id);f&&r.push("superseded");let m=t.correctedIds.has(e.id);m&&r.push("corrected");let b=!M(e)||k(e);b&&r.push("generated noise");let E=!!(t.indexedPaths&&Te(e,t.indexedPaths));E&&r.push("cites files missing at HEAD");let g=Math.max(0,Math.min(100,n.excess*de+p+h-(c?ye:0)-o-(f?he:0)-(m?ge:0)-(b?xe:0)-(E?Ee:0)-(i?20:0))),R=g>=ce?"active":g>=ae?"archive":"delete",_=i||n.exactDup||n.nearDup||f,y=R!=="active"&&u<ie&&!_?"active":R;y!==R&&r.push("grace period");let d=y==="delete"&&X.has(e.type)?"archive":y;return d!==y&&r.push("protected type"),{id:e.id,type:e.type,verdict:d,score:Math.round(g),reasons:r,excess:n.excess,maxSim:n.maxSim,nearestId:n.nearestId}}l(Ce,"scoreEntry");function Ne(e,t){let s=Me(e,t),r=Ie(s.entries),n={evaluated:s.entries.length,active:0,archive:0,delete:0,referenceSize:s.refIndex.entries.length,flagged:[],byId:new Map};for(let i of s.entries){let c=Ce(i,s,r);n[c.verdict]++,n.byId.set(c.id,c),c.verdict!=="active"&&n.flagged.push(c)}return n.flagged.sort((i,c)=>i.score-c.score),n}l(Ne,"evaluateRetention");var we=6e4,W=new Map;function B(e,t){let s=Math.floor(t/we),r=(()=>{try{return $(e)}catch{return null}})();if(r!==null){let i=W.get(e);if(i&&i.bucket===s&&i.stamp===r)return i.report}let n=Ne(e,t);return r!==null&&W.set(e,{bucket:s,stamp:r,report:n}),n}l(B,"evaluateRetentionShared");function Je(e,t){return!(!M(e)||e.content.trim().length===0||t&&t.verdict!=="active"||t&&t.excess!==void 0&&t.excess<.05)}l(Je,"shouldEmbedEntry");function v(e,t){if(t.startsWith("ship_"))return Fe(e,t);if(x.forget(e,t))return!0;try{return(S.run(e,"UPDATE memory_entries SET deleted_at = ? WHERE id = ? AND deleted_at IS NULL",Date.now(),t).changes??0)>0}catch{return!1}}l(v,"forgetEntry");function N(e){return e.startsWith("mem_")||e.startsWith("ship_")||/^\d+$/.test(e)}l(N,"isRetentionRemovableId");function Fe(e,t){let s=t.startsWith("ship_")?t.slice(5):t;if(!s)return!1;try{let r=S.get(e,"SELECT * FROM shipped_features WHERE id = ?",s);if(!r)return!1;try{D.archive(e,{entityType:"shipped",entityId:s,entityData:r,summary:`retention archive shipped [${r.name}]`,reason:"retention-archive"})}catch{}return(S.run(e,"DELETE FROM shipped_features WHERE id = ?",s).changes??0)>0}catch{return!1}}l(Fe,"forgetShippedFeature");function Le(e,t={}){let s=t.dryRun===!0,r=t.nowMs??Date.now(),n=t.maxArchive??be,i=t.maxDelete??_e,c=B(e,r),a=c.flagged.filter(o=>o.verdict==="archive"&&N(o.id)),p=c.flagged.filter(o=>o.verdict==="delete"&&N(o.id)),u=c.flagged.filter(o=>(o.verdict==="archive"||o.verdict==="delete")&&!N(o.id)).length,h=s?{archived:0,deleted:0,skipped:u}:(()=>{let o=a.slice(0,n),f=o.map(d=>{if(!d.id.startsWith("ship_"))try{D.archive(e,{entityType:"memory_entry",entityId:d.id,entityData:{id:d.id,type:d.type,score:d.score,excess:d.excess,reasons:d.reasons,verdict:d.verdict},summary:`retention archive [${d.type}] excess=${d.excess?.toFixed(2)??"?"} score=${d.score}`,reason:"retention-archive"})}catch{}return v(e,d.id)}),m=f.filter(Boolean).length,b=Math.max(0,a.length-o.length)+f.filter(d=>!d).length,E=p.slice(0,i),g=E.filter(d=>!X.has(d.type)).map(d=>d.id),R=E.length-g.length,_=g.length>0?Y(e,g):0,y=Math.max(0,p.length-E.length)+R+g.length-_;return{archived:m,deleted:_,skipped:u+b+y}})();return{evaluated:c.evaluated,active:c.active,wouldArchive:a.length,wouldDelete:p.length,archived:h.archived,deleted:h.deleted,skipped:h.skipped,dryRun:s,samples:c.flagged.slice(0,10),referenceSize:c.referenceSize}}l(Le,"applyRetention");function qe(e){return Le(e,{maxArchive:Se,maxDelete:De})}l(qe,"applyRetentionIncremental");function Ke(e,t={}){let s=t.max??50,r=t.types??["inbox","context","idea","todo","question","gotcha","spec"],n=[],i=[];try{let c=x.allEntriesForIndex(e);for(let a of c){if(n.length>=s)break;if(!r.includes(a.type))continue;let p=I(a.content,a.type),u=L(a.content,a.type);(p.junk||u.action==="refuse"||a.type==="gotcha"&&u.action==="demote")&&v(e,a.id)&&(n.push(a),i.length<8&&i.push(`${a.id}:${p.junk?p.reason:u.reasonCode}`))}}catch{return{forgotten:0,samples:[]}}return{forgotten:n.length,samples:i}}l(Ke,"forgetJunkCaptures");function Qe(e,t=Date.now()){let r=x.allEntriesForIndex(e).filter(o=>o.type==="inbox");if(r.length===0)return{merged:0,archived:0,junkForgotten:0};let n=r.filter(o=>I(o.content,o.type).junk&&v(e,o.id)).length,i=x.allEntriesForIndex(e).filter(o=>o.type==="inbox");if(i.length===0)return{merged:0,archived:0,junkForgotten:n};let c=A(x.allEntriesForIndex(e)),a=T(c),p=B(e,t),u=[],h=[];for(let o of i){let f=C(o.content,a);if(f.exactDup||f.nearDup||f.excess<.15){v(e,o.id)&&u.push(o.id);continue}let m=p.byId.get(o.id);if(m&&m.verdict!=="active"){try{D.archive(e,{entityType:"memory_entry",entityId:o.id,entityData:{id:o.id,type:"inbox",score:m.score,excess:m.excess,reasons:m.reasons},summary:`inbox triage excess=${m.excess?.toFixed(2)??"?"}`,reason:"retention-inbox"})}catch{}v(e,o.id)&&h.push(o.id)}}return{merged:u.length,archived:h.length,junkForgotten:n}}l(Qe,"triageInbox");export{re as CAPTURE_MIN_EXCESS,z as DEFAULT_SOFT_DELETED_PURGE_DAYS,ne as NEAR_DUP_SIM,X as PROTECTED_TYPES,ee as REFERENCE_CAP,Le as applyRetention,qe as applyRetentionIncremental,A as buildReferenceModel,oe as captureGate,Ie as collectDuplicateIds,Me as collectRetentionInputs,se as computeExcess,Ne as evaluateRetention,B as evaluateRetentionShared,Ke as forgetJunkCaptures,Fe as forgetShippedFeature,J as isAutoSource,te as isReferenceEligible,N as isRetentionRemovableId,K as purgeOrphanRememberEvents,q as purgeSoftDeleted,j as runVaultPurge,Ce as scoreEntry,Je as shouldEmbedEntry,Qe as triageInbox,Q as trimAutoSourceCap,Z as vaultHealth};
@@ -5,6 +5,6 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{h as S}from"./chunk-2HB2JHQE.mjs";import"./chunk-XE4MJNBQ.mjs";import"./chunk-C3W2HLJT.mjs";import{a as v,b as u}from"./chunk-NHIWYDQD.mjs";import{a as f}from"./chunk-X2AGNDGD.mjs";import{a as k,d as w}from"./chunk-F4T7IAA7.mjs";import"./chunk-H4CA3XZ6.mjs";import{a as l}from"./chunk-4O4D6DV7.mjs";import"./chunk-JCYXFHQZ.mjs";import"./chunk-JPSJWCFD.mjs";import"./chunk-TPESWBA7.mjs";import"./chunk-FEFP6JOL.mjs";import"./chunk-JUZ5LNDI.mjs";import"./chunk-7O6OMD4X.mjs";import"./chunk-OZJ6UKKP.mjs";import"./chunk-YQ55MHKL.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-KOGZCFBC.mjs";import"./chunk-FX6VHIKB.mjs";import"./chunk-HHIGNKDO.mjs";import"./chunk-7GNWHWOO.mjs";import"./chunk-OENWCYLF.mjs";import"./chunk-SJ75V4WG.mjs";import"./chunk-JMCMTX6U.mjs";import"./chunk-R4ILCXKE.mjs";import"./chunk-7JEKBJAP.mjs";import"./chunk-MI3JEFON.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-27XFSCOE.mjs";import"./chunk-YUKGWWL7.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import"./chunk-6UH244CC.mjs";import"./chunk-OUAS3LZ3.mjs";import"./chunk-INXNK57E.mjs";import"./chunk-5EQLQ7GF.mjs";import"./chunk-UA4Z5TGG.mjs";import"./chunk-TG5CQJD5.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-GAOQHD5S.mjs";import{b as g}from"./chunk-AZHE4VOM.mjs";import"./chunk-6RLCUGGG.mjs";import"./chunk-KG7Z6OMK.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-JAMSIKDE.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-EMTCZG5I.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as i}from"./chunk-E66B27AL.mjs";var a=["off","advisory","strict"],$=[{key:"spec drafted",reached:i(()=>!0,"reached")},{key:"audit-spec passed (reviewed)",reached:i(n=>n!=="draft","reached")},{key:"task linked",reached:i(n=>n==="in_progress"||n==="shipped","reached")},{key:"shipped",reached:i(n=>n==="shipped","reached")}],D=class extends w{static{i(this,"SddCommands")}async sdd(e=null,t=process.cwd(),o={}){let s=v(e,a);return s.kind==="status"?this.showStatus(t,o):s.kind==="mode"?this.setMode(s.mode,t,o):k(`Unknown sdd subcommand "${s.sub}". Use: ${a.join("|")}.`,o)}async showStatus(e,t){let o=await u(e,t);if(!o.ok)return o.result;let s=o.value,r=M(s),c=await(async()=>{try{let p=await S(s.projectId,e);if(p?.linkedSpecId){let{specService:h}=await import("./spec-service-LAO5Z2M5.mjs"),d=await h.get(e,p.linkedSpecId);if(d)return{specLine:`Active spec: \`${d.title}\` (${d.status})`,station:$.map(y=>`${y.reached(d.status)?"\u2713":"\u25CB"} ${y.key}`).join(" ")}}else if(p)return{specLine:"Active work cycle has NO linked spec",station:"no active work cycle"};return{specLine:"Active spec: none",station:"no active work cycle"}}catch{return{specLine:"Active spec: none",station:"no active work cycle"}}})(),m=[`Mode: ${r}${r==="off"?" (pipeline stays escalate-only)":""}`,c.specLine,`Pipeline: ${c.station}`,"Set: prjct sdd off|advisory|strict"];return t.md?console.log(f("## SDD",`> **Mode**: \`${r}\``,m.slice(1).join(`
8
+ import{h as S}from"./chunk-M4YM7Z3F.mjs";import"./chunk-LF3S3MYE.mjs";import"./chunk-PPWPUEBH.mjs";import{a as v,b as u}from"./chunk-WJV24WE6.mjs";import{a as f}from"./chunk-TB57OYGW.mjs";import{a as k,d as w}from"./chunk-MW54MTLB.mjs";import"./chunk-H4CA3XZ6.mjs";import{a as l}from"./chunk-Y3RHBU2R.mjs";import"./chunk-XSJ7SPVR.mjs";import"./chunk-Y7MZA2G4.mjs";import"./chunk-TPESWBA7.mjs";import"./chunk-FEFP6JOL.mjs";import"./chunk-NLL5AV2G.mjs";import"./chunk-NCLONKOT.mjs";import"./chunk-22GFTUER.mjs";import"./chunk-YQ55MHKL.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-KOGZCFBC.mjs";import"./chunk-BKJHD5JI.mjs";import"./chunk-CPR4FPXG.mjs";import"./chunk-3HGQPUKG.mjs";import"./chunk-ZJW27EUC.mjs";import"./chunk-SJ75V4WG.mjs";import"./chunk-3CKNJ5RA.mjs";import"./chunk-R4ILCXKE.mjs";import"./chunk-XYKVWO23.mjs";import"./chunk-7PBWIO4K.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-PVCEWFHS.mjs";import"./chunk-LR24AIEW.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import"./chunk-D7DQABWO.mjs";import"./chunk-OUAS3LZ3.mjs";import"./chunk-ETTDRXQ6.mjs";import"./chunk-FZS3XGEA.mjs";import"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-GAOQHD5S.mjs";import{b as g}from"./chunk-ZZBNFNMG.mjs";import"./chunk-3FEXJUO2.mjs";import"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-IJ523YO2.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as i}from"./chunk-E66B27AL.mjs";var a=["off","advisory","strict"],$=[{key:"spec drafted",reached:i(()=>!0,"reached")},{key:"audit-spec passed (reviewed)",reached:i(n=>n!=="draft","reached")},{key:"task linked",reached:i(n=>n==="in_progress"||n==="shipped","reached")},{key:"shipped",reached:i(n=>n==="shipped","reached")}],D=class extends w{static{i(this,"SddCommands")}async sdd(e=null,t=process.cwd(),o={}){let s=v(e,a);return s.kind==="status"?this.showStatus(t,o):s.kind==="mode"?this.setMode(s.mode,t,o):k(`Unknown sdd subcommand "${s.sub}". Use: ${a.join("|")}.`,o)}async showStatus(e,t){let o=await u(e,t);if(!o.ok)return o.result;let s=o.value,r=M(s),c=await(async()=>{try{let p=await S(s.projectId,e);if(p?.linkedSpecId){let{specService:h}=await import("./spec-service-ENLAAMVL.mjs"),d=await h.get(e,p.linkedSpecId);if(d)return{specLine:`Active spec: \`${d.title}\` (${d.status})`,station:$.map(y=>`${y.reached(d.status)?"\u2713":"\u25CB"} ${y.key}`).join(" ")}}else if(p)return{specLine:"Active work cycle has NO linked spec",station:"no active work cycle"};return{specLine:"Active spec: none",station:"no active work cycle"}}catch{return{specLine:"Active spec: none",station:"no active work cycle"}}})(),m=[`Mode: ${r}${r==="off"?" (pipeline stays escalate-only)":""}`,c.specLine,`Pipeline: ${c.station}`,"Set: prjct sdd off|advisory|strict"];return t.md?console.log(f("## SDD",`> **Mode**: \`${r}\``,m.slice(1).join(`
9
9
  `))):l.info(`SDD \u2014 ${m.join(`
10
10
  `)}`),{success:!0,mode:r}}async setMode(e,t,o){let s=await u(t,o);if(!s.ok)return s.result;let r=s.value;r.sdd={mode:e},await g.writeConfig(t,r);let c=e==="off"?"SDD mode off \u2014 the spec pipeline stays escalate-only (no gating).":e==="advisory"?"SDD mode \u2192 advisory. The skill nudges toward a spec for complex work; `ship` surfaces acceptance criteria.":"SDD mode \u2192 strict. Every `prjct work` cycle must link a REVIEWED intent/spec, and `ship` blocks unspecced work (override: `prjct ship --no-spec-gate`).";return o.md?console.log(f("## SDD",`> ${c}`)):l.done(c),{success:!0,mode:e}}};function M(n){let e=n?.sdd?.mode;if(e&&a.includes(e))return e;let t=process.env.PRJCT_SDD_MODE?.toLowerCase();return t&&a.includes(t)?t:"off"}i(M,"effectiveSddMode");var b={effectiveSddMode:M,SDD_MODES:a};export{D as SddCommands,b as _internal,M as effectiveSddMode};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as d}from"./chunk-5TBQNW2G.mjs";import"./chunk-TXJT3G53.mjs";import{a as u}from"./chunk-27XFSCOE.mjs";import"./chunk-YUKGWWL7.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-5EQLQ7GF.mjs";import"./chunk-UA4Z5TGG.mjs";import"./chunk-TG5CQJD5.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-AZHE4VOM.mjs";import"./chunk-6RLCUGGG.mjs";import{d as l,g as y}from"./chunk-KG7Z6OMK.mjs";import"./chunk-CE4RCNC7.mjs";import{b as p,h as g}from"./chunk-JAMSIKDE.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-EMTCZG5I.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as r}from"./chunk-E66B27AL.mjs";y();g();function c(){return"Context tiers: L0 always \xB7 L1 session/prime \xB7 L2 pull (search/guard/MCP) \xB7 L3 cold \u2014 never stuff L2 into L0."}r(c,"contextTiersOneLiner");var a="session:continuity",f="session-close",x=10080*60*1e3;function R(e){let t=d(e.config??null,{turnCount:e.turns??void 0,tokensIn:e.tokensIn??void 0,tokensOut:e.tokensOut??void 0,description:e.cycleDescription??void 0}),n=[];e.cycleId||e.cycleDescription?(n.push("Resume open cycle with `prjct prime` then continue work (or `prjct status done` if finished)."),n.push('Journal progress: `prjct log "what you tried"`.')):n.push('No open cycle \u2014 `prjct work "<intent>"` or `prjct next --md` for frontier.'),n.push("Pull L2 on demand: `prjct search` / `prjct guard` / MCP \u2014 never stuff into L0."),n.push("Audit gates: `prjct context artifacts --md`.");let o=e.handoffContent?.trim()?e.handoffContent.trim().slice(0,280):null,s={version:1,landedAt:p(),projectId:e.projectId,cycleId:e.cycleId??null,cycleDescription:e.cycleDescription??null,turns:e.turns??null,tokensIn:e.tokensIn??null,tokensOut:e.tokensOut??null,pressureLevel:t.level==="ok"?e.turns?"ok":null:t.level,handoffWrote:!!e.handoffWrote,receiptWrote:!!e.receiptWrote,nextActions:n,handoffPreview:o};return l.setDoc(e.projectId,a,s),s}r(R,"stampSessionContinuity");function E(e){try{let t=l.getDoc(e,a);return!t||t.version!==1||!t.landedAt?null:t}catch{return null}}r(E,"loadSessionContinuity");function m(e,t=Date.now()){if(!e?.landedAt)return!1;let n=Date.parse(e.landedAt);return Number.isFinite(n)?t-n<=x:!1}r(m,"isContinuityFresh");function B(e){try{let t=u.searchFts(e,["session","close","land-auto"],12);for(let o of t){if(o.type!=="context")continue;let s=o.tags??{};if(s.topic===f||s.source==="land-auto"||o.content.startsWith("Session close:"))return o.content}let n=u.recall(e,{types:["context"],limit:8});for(let o of n){let s=o.tags??{};if(s.topic===f||s.source==="land-auto"||o.content.startsWith("Session close:"))return o.content}}catch{}return null}r(B,"loadLastSessionCloseContent");function W(e){let t=["# Managed session resume","","_Local continuity (Claude Managed Agents pattern without hosting the model). Land stamps SoT; prime restores it._",""],n=e.stamp;if(n&&m(n)){let i=h(n.landedAt);t.push(`**Last land:** ${n.landedAt.slice(0,19)} (${i})`),t.push(`- Hand-off: ${n.handoffWrote?"written":"none"} \xB7 Receipt: ${n.receiptWrote?"written":"none"}`),n.turns!=null&&t.push(`- Last cycle budget signal: turns=${n.turns}`+(n.tokensIn!=null||n.tokensOut!=null?` \xB7 tokens in=${n.tokensIn??0} out=${n.tokensOut??0}`:"")+(n.pressureLevel?` \xB7 pressure=${n.pressureLevel}`:"")),t.push("")}else n?(t.push(`**Last land:** ${n.landedAt.slice(0,19)} (stale >7d) \u2014 treat as historical; re-land after work.`),t.push("")):(t.push("**No land stamp yet.** After meaningful work run `prjct land` so the next window resumes cleanly."),t.push(""));let o=e.liveCycleDescription??n?.cycleDescription;if(o){if(t.push(`**Active / last cycle:** ${o}`),e.liveCycleId&&t.push(`- id: \`${e.liveCycleId.slice(0,8)}\``),e.journal&&e.journal.length>0){t.push("**Journal (recent):**");for(let i of e.journal)t.push(`- ${i.slice(0,120)}`)}t.push("")}else t.push("**No open cycle** on this workspace."),t.push("");let s=e.sessionCloseContent??n?.handoffPreview;if(s){t.push("## Last session hand-off"),t.push("");let i=s.length>900?`${s.slice(0,897)}\u2026`:s;t.push(i),t.push(""),t.push("_Full entry: `prjct context memory session-close` / topic `session-close`._"),t.push("")}if(e.pendingHandoffCue&&(t.push("## Multi-agent handoff"),t.push(""),t.push(e.pendingHandoffCue),t.push("")),n?.nextActions?.length){t.push("## Next actions"),t.push("");for(let i of n.nextActions)t.push(`- ${i}`);t.push("")}return t.push("## Context diet"),t.push(""),t.push(c()),t.push(""),t.push("Default surface: `work` + `ship` (user text confirm). Deeper: `prjct brief` \xB7 `prjct search` \xB7 `prjct guard` \xB7 `prjct context artifacts --md`."),t.join(`
8
+ import{a as d}from"./chunk-5TBQNW2G.mjs";import"./chunk-TXJT3G53.mjs";import{b as u}from"./chunk-PVCEWFHS.mjs";import"./chunk-LR24AIEW.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-FZS3XGEA.mjs";import"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-ZZBNFNMG.mjs";import"./chunk-3FEXJUO2.mjs";import{d as l,g as y}from"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import{b as p,h as g}from"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-IJ523YO2.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as r}from"./chunk-E66B27AL.mjs";y();g();function c(){return"Context tiers: L0 always \xB7 L1 session/prime \xB7 L2 pull (search/guard/MCP) \xB7 L3 cold \u2014 never stuff L2 into L0."}r(c,"contextTiersOneLiner");var a="session:continuity",f="session-close",x=10080*60*1e3;function R(e){let t=d(e.config??null,{turnCount:e.turns??void 0,tokensIn:e.tokensIn??void 0,tokensOut:e.tokensOut??void 0,description:e.cycleDescription??void 0}),n=[];e.cycleId||e.cycleDescription?(n.push("Resume open cycle with `prjct prime` then continue work (or `prjct status done` if finished)."),n.push('Journal progress: `prjct log "what you tried"`.')):n.push('No open cycle \u2014 `prjct work "<intent>"` or `prjct next --md` for frontier.'),n.push("Pull L2 on demand: `prjct search` / `prjct guard` / MCP \u2014 never stuff into L0."),n.push("Audit gates: `prjct context artifacts --md`.");let o=e.handoffContent?.trim()?e.handoffContent.trim().slice(0,280):null,s={version:1,landedAt:p(),projectId:e.projectId,cycleId:e.cycleId??null,cycleDescription:e.cycleDescription??null,turns:e.turns??null,tokensIn:e.tokensIn??null,tokensOut:e.tokensOut??null,pressureLevel:t.level==="ok"?e.turns?"ok":null:t.level,handoffWrote:!!e.handoffWrote,receiptWrote:!!e.receiptWrote,nextActions:n,handoffPreview:o};return l.setDoc(e.projectId,a,s),s}r(R,"stampSessionContinuity");function E(e){try{let t=l.getDoc(e,a);return!t||t.version!==1||!t.landedAt?null:t}catch{return null}}r(E,"loadSessionContinuity");function m(e,t=Date.now()){if(!e?.landedAt)return!1;let n=Date.parse(e.landedAt);return Number.isFinite(n)?t-n<=x:!1}r(m,"isContinuityFresh");function B(e){try{let t=u.searchFts(e,["session","close","land-auto"],12);for(let o of t){if(o.type!=="context")continue;let s=o.tags??{};if(s.topic===f||s.source==="land-auto"||o.content.startsWith("Session close:"))return o.content}let n=u.recall(e,{types:["context"],limit:8});for(let o of n){let s=o.tags??{};if(s.topic===f||s.source==="land-auto"||o.content.startsWith("Session close:"))return o.content}}catch{}return null}r(B,"loadLastSessionCloseContent");function W(e){let t=["# Managed session resume","","_Local continuity (Claude Managed Agents pattern without hosting the model). Land stamps SoT; prime restores it._",""],n=e.stamp;if(n&&m(n)){let i=h(n.landedAt);t.push(`**Last land:** ${n.landedAt.slice(0,19)} (${i})`),t.push(`- Hand-off: ${n.handoffWrote?"written":"none"} \xB7 Receipt: ${n.receiptWrote?"written":"none"}`),n.turns!=null&&t.push(`- Last cycle budget signal: turns=${n.turns}`+(n.tokensIn!=null||n.tokensOut!=null?` \xB7 tokens in=${n.tokensIn??0} out=${n.tokensOut??0}`:"")+(n.pressureLevel?` \xB7 pressure=${n.pressureLevel}`:"")),t.push("")}else n?(t.push(`**Last land:** ${n.landedAt.slice(0,19)} (stale >7d) \u2014 treat as historical; re-land after work.`),t.push("")):(t.push("**No land stamp yet.** After meaningful work run `prjct land` so the next window resumes cleanly."),t.push(""));let o=e.liveCycleDescription??n?.cycleDescription;if(o){if(t.push(`**Active / last cycle:** ${o}`),e.liveCycleId&&t.push(`- id: \`${e.liveCycleId.slice(0,8)}\``),e.journal&&e.journal.length>0){t.push("**Journal (recent):**");for(let i of e.journal)t.push(`- ${i.slice(0,120)}`)}t.push("")}else t.push("**No open cycle** on this workspace."),t.push("");let s=e.sessionCloseContent??n?.handoffPreview;if(s){t.push("## Last session hand-off"),t.push("");let i=s.length>900?`${s.slice(0,897)}\u2026`:s;t.push(i),t.push(""),t.push("_Full entry: `prjct context memory session-close` / topic `session-close`._"),t.push("")}if(e.pendingHandoffCue&&(t.push("## Multi-agent handoff"),t.push(""),t.push(e.pendingHandoffCue),t.push("")),n?.nextActions?.length){t.push("## Next actions"),t.push("");for(let i of n.nextActions)t.push(`- ${i}`);t.push("")}return t.push("## Context diet"),t.push(""),t.push(c()),t.push(""),t.push("Default surface: `work` + `ship` (user text confirm). Deeper: `prjct brief` \xB7 `prjct search` \xB7 `prjct guard` \xB7 `prjct context artifacts --md`."),t.join(`
9
9
  `)}r(W,"formatSessionResumeCard");function F(e){if(!e||!m(e))return null;let t=h(e.landedAt),n=e.cycleDescription?` \xB7 cycle "${e.cycleDescription.slice(0,50)}${e.cycleDescription.length>50?"\u2026":""}"`:"";return["# prjct: managed session continuity",`Last land ${t}${n}. Restore full state: \`prjct prime --md\` (work graph + hand-off + next actions).`,e.handoffWrote?"Hand-off is in SQLite (`topic:session-close`) \u2014 do not re-discover from chat history.":"No hand-off body last land \u2014 prime still restores cycle/frontier if open."].join(`
10
10
  `)}r(F,"formatContinuitySessionCue");function H(e){return["","## Managed session continuity","",`- Stamped at \`${e.landedAt.slice(0,19)}\` (SoT key \`${a}\`).`,"- **Next window / machine:** `prjct prime --md` restores cycle + last hand-off + next actions.","- Cross-device: same project DB / cloud sync of memory \u2014 no hosted model session required.",`- Context diet: ${c()}`].join(`
11
11
  `)}r(H,"formatLandContinuityFooter");function h(e){let t=Date.parse(e);if(!Number.isFinite(t))return e;let n=Math.max(0,Math.floor((Date.now()-t)/1e3));return n<60?"just now":n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}r(h,"formatRelativeIso");export{x as CONTINUITY_FRESH_MS,f as SESSION_CLOSE_TOPIC,a as SESSION_CONTINUITY_KEY,F as formatContinuitySessionCue,H as formatLandContinuityFooter,W as formatSessionResumeCard,m as isContinuityFresh,B as loadLastSessionCloseContent,E as loadSessionContinuity,R as stampSessionContinuity};
@@ -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}from"./chunk-OLQAMCYV.mjs";import"./chunk-NJ74RHNC.mjs";import"./chunk-WUOVBBPC.mjs";import"./chunk-KDNUQPAK.mjs";import"./chunk-33BHU4OM.mjs";import"./chunk-ZYCNW75E.mjs";import"./chunk-JR542RI2.mjs";import"./chunk-CPR4FPXG.mjs";import"./chunk-3HGQPUKG.mjs";import"./chunk-ZMLA5SKR.mjs";import"./chunk-TF6PN7IB.mjs";import"./chunk-XYKVWO23.mjs";import"./chunk-7PBWIO4K.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-PVCEWFHS.mjs";import"./chunk-LR24AIEW.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-FZS3XGEA.mjs";import"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-JGZ3QGWX.mjs";import"./chunk-QXCEBAIA.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-ZZBNFNMG.mjs";import"./chunk-3FEXJUO2.mjs";import"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-IJ523YO2.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{c as buildProjectIdentityLine,a as buildSessionContext,b as buildSubagentDigest,d as consumeKimiSessionInjection,e as runSessionStartHook};
@@ -0,0 +1,9 @@
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}from"./chunk-E66B27AL.mjs";import k from"node:fs/promises";import w from"node:os";import P from"node:path";import{existsSync as v}from"node:fs";import h from"node:path";function x(){if(process.platform==="win32")return null;let t=process.execPath;if(!t)return null;let e=__dirname,o=[h.join(e,"prjct.mjs"),h.resolve(e,"..","prjct.mjs"),h.resolve(e,"..","..","dist","bin","prjct.mjs")].find(c=>v(c));return o?`${h.basename(t).includes("bun")?"":'NODE_OPTIONS="--experimental-sqlite${NODE_OPTIONS:+ $NODE_OPTIONS}" '}"${t}" "${o}"`:null}r(x,"directHookPrefix");function j(){if(process.platform==="win32")return null;let t=__dirname,e=`hook-fast-${process.platform}-${process.arch}`;return[h.join(t,e),h.resolve(t,"..",e),h.resolve(t,"..","..","dist","bin",e)].find(o=>v(o))??null}r(j,"nativeHookFastBinary");function S(t,e){let o=process.env.PRJCT_BIN??"prjct",s=e?`${e} `:"",c=`command -v ${o} >/dev/null 2>&1 && ${s}${o} hook ${t} || exit 0`;if(process.env.PRJCT_BIN)return c;let n=x();if(!n)return c;let i=`${s}${n} hook ${t}`,m=j();return`${m?`${s}"${m}" ${t} || ${i}`:i} || { ${c.replace(" || exit 0","")}; } || exit 0`}r(S,"hookCommandChain");function f(){let t=process.env.HOME||w.homedir();return P.join(t,".claude","settings.json")}r(f,"settingsPath");var p="_prjctManaged",R=10,g=[{event:"SessionStart",matcher:"",subcommand:"session-start"},{event:"UserPromptSubmit",matcher:"",subcommand:"prompt"},{event:"PreToolUse",matcher:"Bash",subcommand:"pre-bash"},{event:"PreToolUse",matcher:"Edit|Write",subcommand:"pre-edit"},{event:"PreToolUse",matcher:"Grep|Glob",subcommand:"pre-search"},{event:"PostToolUse",matcher:"Edit|Write",subcommand:"post-edit"},{event:"Stop",matcher:"",subcommand:"stop"},{event:"SubagentStart",matcher:"",subcommand:"subagent-start"},{event:"SubagentStop",matcher:"",subcommand:"subagent-stop"},{event:"Notification",matcher:"",subcommand:"notification"},{event:"CwdChanged",matcher:"",subcommand:"cwd-changed"}];function H(t){let e=t.command?.match(/\bhook\s+(\S+)/);return e?e[1]:null}r(H,"subcommandOf");function N(t){let e=new Set(g.map(s=>s.subcommand)),o=[];for(let s of Object.keys(t)){let c=t[s],n=[];for(let i of c)i.hooks=i.hooks.filter(m=>{if(!d(m))return!0;let u=H(m);return u&&!e.has(u)?(o.push(m),!1):!0}),i.hooks.length>0&&n.push(i);n.length>0?t[s]=n:delete t[s]}return o.length}r(N,"pruneOrphanedManagedHooks");async function b(){try{let t=await k.readFile(f(),"utf-8"),e=JSON.parse(t);return e&&typeof e=="object"?e:{}}catch(t){if(t.code==="ENOENT")return{};throw t}}r(b,"readSettings");async function O(t){await k.mkdir(P.dirname(f()),{recursive:!0}),await k.writeFile(f(),`${JSON.stringify(t,null,2)}
9
+ `,"utf-8")}r(O,"writeSettings");function M(t){return S(t)}r(M,"hookCommand");function d(t){return t[p]===!0}r(d,"isPrjctHook");function _(t){if(t[p]===!0)return!1;let e=t.command?.trim()??"";return/(^|\/|\s)prjct\s+hook\s+\S+/.test(e)}r(_,"isLegacyPrjctHook");function y(t){let e={type:"command",command:M(t.subcommand),timeout:R,[p]:!0},o="ifClause"in t?t.ifClause:void 0;return typeof o=="string"&&o&&(e.if=o),e}r(y,"hookEntryFor");async function D(){let t=await b(),e=t.hooks??{},o=[],s=[];for(let n of g){let i=e[n.event]??[],m=i.find(a=>(a.matcher??"")===n.matcher),u=m??{matcher:n.matcher,hooks:[]};m||i.push(u);let E=u.hooks.length;u.hooks=u.hooks.filter(a=>!_(a));let $=E-u.hooks.length,l=u.hooks.find(a=>d(a)&&H(a)===n.subcommand);if(l){let a=y(n);l.command===a.command&&l.if===a.if&&l.timeout===a.timeout&&$===0?s.push(n):(l.command=a.command,l.if=a.if,l.timeout=a.timeout,o.push(n))}else u.hooks.push(y(n)),o.push(n);e[n.event]=i}let c=N(e);return t.hooks=e,await O(t),{settingsPath:f(),hooksWritten:o.length,alreadyPresent:s.length,hooksPruned:c}}r(D,"install");async function K(){let t=await b();if(!t.hooks)return{settingsPath:f(),hooksRemoved:0};let e=[];for(let[o,s]of Object.entries(t.hooks)){let c=[];for(let n of s){let i=n.hooks.filter(m=>d(m)?(e.push(m),!1):!0);i.length>0&&c.push({...n,hooks:i})}c.length>0?t.hooks[o]=c:delete t.hooks[o]}return Object.keys(t.hooks).length===0&&delete t.hooks,await O(t),{settingsPath:f(),hooksRemoved:e.length}}r(K,"uninstall");async function G(){let e=(await b()).hooks??{};return{installed:Object.values(e).flat().flatMap(s=>s.hooks).filter(d).length,expected:g.length}}r(G,"status");export{R as HOOK_TIMEOUT_SECONDS,g as PRJCT_HOOKS,D as install,G as status,K as uninstall};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as H}from"./chunk-Y4DUB7UN.mjs";import{a as J}from"./chunk-TFCLMTJ5.mjs";import"./chunk-66GE3IHX.mjs";import"./chunk-J6TAD3OZ.mjs";import"./chunk-T2FCU3ZS.mjs";import"./chunk-KOCROTRM.mjs";import{c as z,d as G}from"./chunk-F4T7IAA7.mjs";import{a as i}from"./chunk-4O4D6DV7.mjs";import"./chunk-DYHYDHCW.mjs";import"./chunk-NBKEOLDH.mjs";import"./chunk-R4ILCXKE.mjs";import"./chunk-YUKGWWL7.mjs";import"./chunk-UUULLTQV.mjs";import{c as B}from"./chunk-OIU4Y5WL.mjs";import"./chunk-3FBCOCPD.mjs";import{a as K,b as F,c as u}from"./chunk-TYEAIX3X.mjs";import"./chunk-6UH244CC.mjs";import"./chunk-OUAS3LZ3.mjs";import"./chunk-INXNK57E.mjs";import"./chunk-5EQLQ7GF.mjs";import"./chunk-UA4Z5TGG.mjs";import"./chunk-TG5CQJD5.mjs";import"./chunk-M5E2YOZ4.mjs";import{b as E}from"./chunk-AZHE4VOM.mjs";import"./chunk-6RLCUGGG.mjs";import"./chunk-KG7Z6OMK.mjs";import"./chunk-CE4RCNC7.mjs";import{d as v}from"./chunk-4SKJWNKE.mjs";import{t as O,u as N,v as A,w as ae}from"./chunk-JAMSIKDE.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import{f as _,g as U,k as T,o as se}from"./chunk-UH4MD3F3.mjs";import{a as D,p as oe}from"./chunk-QWQFF2UG.mjs";import"./chunk-EQ5KNMLG.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import{b as x,e as ie}from"./chunk-EMTCZG5I.mjs";import"./chunk-PKDYFXMI.mjs";import{e as P,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 I from"node:path";import s from"chalk";ae();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,a=e.deviceId??e.device_id;return!t||!o||!n||!a?null:{apiKey:t,userId:o,email:n,deviceId:a}}m(ee,"parseMintedKeyResponse");ne();oe();se();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 u.clearAuth(),await this.refreshDaemonAuth(),t.md||i.done("Logged out. Auth credentials cleared"),{success:!0,message:t.md?`## Auth
8
+ import{a as H}from"./chunk-DB226JIV.mjs";import{a as J}from"./chunk-UMJ5D5I6.mjs";import"./chunk-JZDZH6IV.mjs";import"./chunk-XV2LJVYB.mjs";import"./chunk-YHOZTAZH.mjs";import"./chunk-DCHIPMOG.mjs";import{c as z,d as G}from"./chunk-MW54MTLB.mjs";import{a as i}from"./chunk-Y3RHBU2R.mjs";import"./chunk-DYHYDHCW.mjs";import"./chunk-IWUF2LGO.mjs";import"./chunk-R4ILCXKE.mjs";import"./chunk-LR24AIEW.mjs";import"./chunk-UUULLTQV.mjs";import{c as B}from"./chunk-OC4CYF7V.mjs";import"./chunk-3FBCOCPD.mjs";import{a as K,b as F,c as u}from"./chunk-XDBJSJOT.mjs";import"./chunk-D7DQABWO.mjs";import"./chunk-OUAS3LZ3.mjs";import"./chunk-ETTDRXQ6.mjs";import"./chunk-FZS3XGEA.mjs";import"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import{b as E}from"./chunk-ZZBNFNMG.mjs";import"./chunk-3FEXJUO2.mjs";import"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import{d as v}from"./chunk-KV4NXLPT.mjs";import{t as O,u as N,v as A,w as ae}from"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import{f as _,g as U,k as T,o as se}from"./chunk-UH4MD3F3.mjs";import{a as D,p as oe}from"./chunk-QWQFF2UG.mjs";import"./chunk-EXVL2OFE.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import{b as x,e as ie}from"./chunk-IJ523YO2.mjs";import"./chunk-PKDYFXMI.mjs";import{e as P,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 I from"node:path";import s from"chalk";ae();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,a=e.deviceId??e.device_id;return!t||!o||!n||!a?null:{apiKey:t,userId:o,email:n,deviceId:a}}m(ee,"parseMintedKeyResponse");ne();oe();se();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 u.clearAuth(),await this.refreshDaemonAuth(),t.md||i.done("Logged out. Auth credentials cleared"),{success:!0,message:t.md?`## Auth
9
9
  - **Status**: Logged out`:""};default:{let n=await u.getStatus();return t.md?{success:!0,message:n.authenticated?`## Auth Status
10
10
  - **Authenticated**: Yes
11
11
  - **Email**: ${n.email||"N/A"}
@@ -23,7 +23,7 @@ Status: Connected`)),await this.refreshDaemonAuth(),await this.autoSync(),l({suc
23
23
  - **Email**: ${$}
24
24
  - **Token**: stored securely`:""})):(e.md||i.fail(`Authentication failed: ${b}`),l({success:!1,message:e.md?`## Error
25
25
  Authentication failed: ${b}`:""}));return}p.writeHead(404,w),p.end("Not found")});d.listen(0,"127.0.0.1",async()=>{let g=d.address();if(!g||typeof g=="string"){d.close(),e.md||i.fail("Failed to start callback server"),l({success:!1,message:e.md?`## Error
26
- Failed to start callback server`:""});return}c.listenPort=g.port;let p=await u.getDeviceId(),k=await u.getHostname(),w=Q({port:c.listenPort,deviceId:p,hostname:k,state:a.state,codeChallenge:a.codeChallenge}),f=`${o}/auth/cli?flow=pkce-v1&port=${c.listenPort}`,y=`${o}/auth/cli?${w.toString()}`;i.step(1,3,"Opening browser..."),i.stop(),i.info(s.dim(f));let b=process.platform,$=b==="darwin"?`open "${y}"`:b==="win32"?`start "" "${y}"`:`xdg-open "${y}"`;try{await D($)}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(()=>{c.settled||(d.close(),i.stop(),e.md||(i.fail("Authentication timed out"),i.info(`Run ${s.cyan("prjct login")} to try again`)),l({success:!1,message:e.md?"## Error\nAuthentication timed out. Run `prjct login` to try again.":""}))},300*1e3)})}async logout(){return await u.clearAuth(),i.done("Logged out"),{success:!0,message:""}}async refreshDaemonAuth(){try{let{restartDaemon:e}=await import("./client-ERZ5CM3D.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,a=o.pulled?.count||0;n>0||a>0?i.done(`Synced (${n} pushed, ${a} pulled)`):i.done("Synced \u2014 everything up to date")}}catch{i.stop()}}buildSuccessPage(e){return`<!DOCTYPE html>
26
+ Failed to start callback server`:""});return}c.listenPort=g.port;let p=await u.getDeviceId(),k=await u.getHostname(),w=Q({port:c.listenPort,deviceId:p,hostname:k,state:a.state,codeChallenge:a.codeChallenge}),f=`${o}/auth/cli?flow=pkce-v1&port=${c.listenPort}`,y=`${o}/auth/cli?${w.toString()}`;i.step(1,3,"Opening browser..."),i.stop(),i.info(s.dim(f));let b=process.platform,$=b==="darwin"?`open "${y}"`:b==="win32"?`start "" "${y}"`:`xdg-open "${y}"`;try{await D($)}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(()=>{c.settled||(d.close(),i.stop(),e.md||(i.fail("Authentication timed out"),i.info(`Run ${s.cyan("prjct login")} to try again`)),l({success:!1,message:e.md?"## Error\nAuthentication timed out. Run `prjct login` to try again.":""}))},300*1e3)})}async logout(){return await u.clearAuth(),i.done("Logged out"),{success:!0,message:""}}async refreshDaemonAuth(){try{let{restartDaemon:e}=await import("./client-K3ZA2BLB.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,a=o.pulled?.count||0;n>0||a>0?i.done(`Synced (${n} pushed, ${a} pulled)`):i.done("Synced \u2014 everything up to date")}}catch{i.stop()}}buildSuccessPage(e){return`<!DOCTYPE html>
27
27
  <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
28
28
  <title>prjct CLI Connected</title>
29
29
  <style>
@@ -90,7 +90,7 @@ Next steps:`),console.log(` 1. Open ${h}`),console.log(" 2. Navigate to your p
90
90
  \u26A1 Installing status line...`);let l=await this.installStatusLine();l.success?console.log("\u2705 Status line configured"):console.log(`\u26A0\uFE0F ${l.error}`)}return await this.finishProviderInstall(o,n,h,"Codex skill installed"),console.log(`
91
91
  \u{1F389} Setup complete!
92
92
  `),this.showAsciiArt(),{success:!0,message:""}}async setupMcpServers(){await J()}printInstallErrors(e){if((e?.length??0)>0){console.log(`
93
- \u26A0\uFE0F ${e?.length??0} errors:`);for(let t of e??[])console.log(` - ${t.file}: ${t.error}`)}}async finishProviderInstall(e,t,o,n){await this.installCodexSurface(e.installed,n),await this.installAntigravitySurface(t.installed),await this.setupMcpServers(),await this.installProjectAgentSurfacesIfConfigured(),await this.saveSetupStamp(o?.name??(e.installed?"codex":t.installed?"antigravity":"claude"))}async saveSetupStamp(e){try{let t=(await import("./editors-config-6XFYIOE6.mjs")).default,o=I.join(A.globalConfigDir,"runtime-surfaces");await t.saveConfig(x,o,e)}catch(t){console.log(`\u26A0\uFE0F Setup stamp failed (non-blocking): ${P(t)}`)}}async installProjectAgentSurfacesIfConfigured(){try{let e=process.cwd();if(!await E.isConfigured(e))return;let{writeProjectAgentSurfaces:o}=await import("./project-agent-surfaces-VRY22I66.mjs"),{detectInstalledAgents:n}=await import("./detection-QRVSNMKL.mjs"),a=await o(e,{agents:await n(e),explicit:!0});a.prjctMd.action!=="unchanged"&&console.log("\u2705 Project PRJCT.md ready"),a.agentsMd.action!=="unchanged"&&console.log("\u2705 Project AGENTS.md ready"),a.claudeMd&&a.claudeMd.action!=="unchanged"&&console.log("\u2705 Project CLAUDE.md ready"),a.ideRules.length>0&&console.log(`\u2705 Project IDE rules ready: ${a.ideRules.join(", ")}`)}catch(e){console.log(`\u26A0\uFE0F Project agent surface setup failed (non-blocking): ${P(e)}`)}}async installCodexSurface(e,t){if(e)try{let{installCodexSkill:o,verifyCodexPRouterReady:n}=await import("./codex-skill-6DYQMPDJ.mjs");await o();let a=await n({autoRepair:!0});a.verified?(console.log(`\u2705 ${t}`),console.log("\u2705 Codex p. router ready")):(console.log(`\u26A0\uFE0F Codex skill setup incomplete: ${a.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): ${P(o)}`)}}async installAntigravitySurface(e){if(e)try{let t=await import("node:os"),{getTemplateContent:o}=await import("./template-loader-SCM4C2A3.mjs"),n=I.join(t.homedir(),".gemini","antigravity","skills","prjct"),a=I.join(n,"SKILL.md"),c=o("antigravity/SKILL.md");if(!c)throw new Error("Antigravity SKILL.md template not found");await j.mkdir(n,{recursive:!0}),await j.writeFile(a,c,"utf-8"),console.log("\u2705 Antigravity skill installed")}catch(t){console.log(`\u26A0\uFE0F Antigravity skill setup failed (non-blocking): ${P(t)}`)}}async installStatusLine(){try{let e=A.getClaudeDir(),t=A.getClaudeSettingsPath(),o=I.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
93
+ \u26A0\uFE0F ${e?.length??0} errors:`);for(let t of e??[])console.log(` - ${t.file}: ${t.error}`)}}async finishProviderInstall(e,t,o,n){await this.installCodexSurface(e.installed,n),await this.installAntigravitySurface(t.installed),await this.setupMcpServers(),await this.installProjectAgentSurfacesIfConfigured(),await this.saveSetupStamp(o?.name??(e.installed?"codex":t.installed?"antigravity":"claude"))}async saveSetupStamp(e){try{let t=(await import("./editors-config-2CACBNS4.mjs")).default,o=I.join(A.globalConfigDir,"runtime-surfaces");await t.saveConfig(x,o,e)}catch(t){console.log(`\u26A0\uFE0F Setup stamp failed (non-blocking): ${P(t)}`)}}async installProjectAgentSurfacesIfConfigured(){try{let e=process.cwd();if(!await E.isConfigured(e))return;let{writeProjectAgentSurfaces:o}=await import("./project-agent-surfaces-6AIW7KL6.mjs"),{detectInstalledAgents:n}=await import("./detection-QRVSNMKL.mjs"),a=await o(e,{agents:await n(e),explicit:!0});a.prjctMd.action!=="unchanged"&&console.log("\u2705 Project PRJCT.md ready"),a.agentsMd.action!=="unchanged"&&console.log("\u2705 Project AGENTS.md ready"),a.claudeMd&&a.claudeMd.action!=="unchanged"&&console.log("\u2705 Project CLAUDE.md ready"),a.ideRules.length>0&&console.log(`\u2705 Project IDE rules ready: ${a.ideRules.join(", ")}`)}catch(e){console.log(`\u26A0\uFE0F Project agent surface setup failed (non-blocking): ${P(e)}`)}}async installCodexSurface(e,t){if(e)try{let{installCodexSkill:o,verifyCodexPRouterReady:n}=await import("./codex-skill-6CRFUF3A.mjs");await o();let a=await n({autoRepair:!0});a.verified?(console.log(`\u2705 ${t}`),console.log("\u2705 Codex p. router ready")):(console.log(`\u26A0\uFE0F Codex skill setup incomplete: ${a.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): ${P(o)}`)}}async installAntigravitySurface(e){if(e)try{let t=await import("node:os"),{getTemplateContent:o}=await import("./template-loader-MXOMU4XH.mjs"),n=I.join(t.homedir(),".gemini","antigravity","skills","prjct"),a=I.join(n,"SKILL.md"),c=o("antigravity/SKILL.md");if(!c)throw new Error("Antigravity SKILL.md template not found");await j.mkdir(n,{recursive:!0}),await j.writeFile(a,c,"utf-8"),console.log("\u2705 Antigravity skill installed")}catch(t){console.log(`\u26A0\uFE0F Antigravity skill setup failed (non-blocking): ${P(t)}`)}}async installStatusLine(){try{let e=A.getClaudeDir(),t=A.getClaudeSettingsPath(),o=I.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
94
94
  # prjct Status Line for Claude Code
95
95
  # Shows version update notifications and current task
96
96
 
@@ -5,9 +5,9 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{f as ie,g as le,h as ue,i as me}from"./chunk-V2BSS7HW.mjs";import"./chunk-Y3J7UUMR.mjs";import"./chunk-TXJT3G53.mjs";import"./chunk-TFCLMTJ5.mjs";import"./chunk-66GE3IHX.mjs";import{a as B}from"./chunk-J6TAD3OZ.mjs";import{a as fe,b as ge}from"./chunk-BCAHWZH7.mjs";import"./chunk-T2FCU3ZS.mjs";import{a as U,h as Y,i as de}from"./chunk-2HB2JHQE.mjs";import"./chunk-XE4MJNBQ.mjs";import{a as y}from"./chunk-C3W2HLJT.mjs";import{a as Q,b as $,c as A,d as ae,f as ce}from"./chunk-X2AGNDGD.mjs";import{c as re,d as he}from"./chunk-F4T7IAA7.mjs";import{a as K}from"./chunk-H4CA3XZ6.mjs";import{a as V}from"./chunk-4O4D6DV7.mjs";import"./chunk-JCYXFHQZ.mjs";import"./chunk-JPSJWCFD.mjs";import"./chunk-TPESWBA7.mjs";import{a as pe}from"./chunk-FEFP6JOL.mjs";import"./chunk-JUZ5LNDI.mjs";import"./chunk-7O6OMD4X.mjs";import"./chunk-OZJ6UKKP.mjs";import"./chunk-YQ55MHKL.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-KOGZCFBC.mjs";import"./chunk-NWIQNII6.mjs";import"./chunk-LNB2GLYI.mjs";import"./chunk-DYHYDHCW.mjs";import"./chunk-FX6VHIKB.mjs";import"./chunk-JR542RI2.mjs";import"./chunk-HHIGNKDO.mjs";import"./chunk-7GNWHWOO.mjs";import"./chunk-VWOIUTAX.mjs";import"./chunk-IHECXD2M.mjs";import"./chunk-KEJ5RMAI.mjs";import{a as x}from"./chunk-OENWCYLF.mjs";import"./chunk-NBKEOLDH.mjs";import"./chunk-GFY4GY3Z.mjs";import"./chunk-ZMLA5SKR.mjs";import"./chunk-SJ75V4WG.mjs";import"./chunk-JMCMTX6U.mjs";import"./chunk-R4ILCXKE.mjs";import"./chunk-7JEKBJAP.mjs";import"./chunk-MI3JEFON.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-27XFSCOE.mjs";import"./chunk-YUKGWWL7.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import"./chunk-6UH244CC.mjs";import"./chunk-OUAS3LZ3.mjs";import"./chunk-INXNK57E.mjs";import"./chunk-5EQLQ7GF.mjs";import"./chunk-UA4Z5TGG.mjs";import"./chunk-TG5CQJD5.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-XS45K7ZQ.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-4KVPAHFV.mjs";import"./chunk-GAOQHD5S.mjs";import{b as W}from"./chunk-AZHE4VOM.mjs";import"./chunk-6RLCUGGG.mjs";import{d as R,g as Ae}from"./chunk-KG7Z6OMK.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-4SKJWNKE.mjs";import{b as I,h as Te}from"./chunk-JAMSIKDE.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import{i as M,p as De}from"./chunk-QWQFF2UG.mjs";import"./chunk-EQ5KNMLG.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-EMTCZG5I.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-5UCVX43H.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-MIR3VZSF.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-WYOEMKMO.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-BKQIMFRG.mjs");if(t(o)){let{detectChanges:c,shipStructuralRiskCue:r}=await import("./detect-changes-DFRJOOB3.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-TT3DRNAX.mjs"),{shipRequiresQuality:r}=await import("./judgment-orchestrator-BYPG65RS.mjs"),{computeCommittedChangeset:p}=await import("./delivery-geometry-WYOEMKMO.mjs"),{judgmentLedgerStorage:h}=await import("./judgment-ledger-storage-SCGU3URM.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-OG2KKN3L.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-OG2KKN3L.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-LAO5Z2M5.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-7S55S5C3.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-SCH5ARGV.mjs");t.creditShippedTask(o,a.id)}catch{}let E=await(async()=>{try{let{synthesizeJudgmentReceipt:t}=await import("./judgment-receipt-GWSSCLAB.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-BN6L6QHO.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(`
8
+ import{f as ie,g as le,h as ue,i as me}from"./chunk-LQLCYBFF.mjs";import"./chunk-QOQZHR3E.mjs";import"./chunk-TXJT3G53.mjs";import"./chunk-UMJ5D5I6.mjs";import"./chunk-JZDZH6IV.mjs";import{a as B}from"./chunk-XV2LJVYB.mjs";import{a as fe,b as ge}from"./chunk-BCAHWZH7.mjs";import"./chunk-YHOZTAZH.mjs";import{a as U,h as Y,i as de}from"./chunk-M4YM7Z3F.mjs";import"./chunk-LF3S3MYE.mjs";import{a as y}from"./chunk-PPWPUEBH.mjs";import{a as Q,b as $,c as A,d as ae,f as ce}from"./chunk-TB57OYGW.mjs";import{c as re,d as he}from"./chunk-MW54MTLB.mjs";import{a as K}from"./chunk-H4CA3XZ6.mjs";import{a as V}from"./chunk-Y3RHBU2R.mjs";import"./chunk-XSJ7SPVR.mjs";import"./chunk-Y7MZA2G4.mjs";import"./chunk-TPESWBA7.mjs";import{a as pe}from"./chunk-FEFP6JOL.mjs";import"./chunk-NLL5AV2G.mjs";import"./chunk-NCLONKOT.mjs";import"./chunk-22GFTUER.mjs";import"./chunk-YQ55MHKL.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-KOGZCFBC.mjs";import"./chunk-UVATSTRF.mjs";import"./chunk-LNB2GLYI.mjs";import"./chunk-DYHYDHCW.mjs";import"./chunk-BKJHD5JI.mjs";import"./chunk-JR542RI2.mjs";import"./chunk-CPR4FPXG.mjs";import"./chunk-3HGQPUKG.mjs";import"./chunk-ZQI4TJ5C.mjs";import"./chunk-SWJ7TLBD.mjs";import"./chunk-KEJ5RMAI.mjs";import{a as x}from"./chunk-ZJW27EUC.mjs";import"./chunk-IWUF2LGO.mjs";import"./chunk-YLOK4WRR.mjs";import"./chunk-ZMLA5SKR.mjs";import"./chunk-SJ75V4WG.mjs";import"./chunk-3CKNJ5RA.mjs";import"./chunk-R4ILCXKE.mjs";import"./chunk-XYKVWO23.mjs";import"./chunk-7PBWIO4K.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-PVCEWFHS.mjs";import"./chunk-LR24AIEW.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import"./chunk-D7DQABWO.mjs";import"./chunk-OUAS3LZ3.mjs";import"./chunk-ETTDRXQ6.mjs";import"./chunk-FZS3XGEA.mjs";import"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-XS45K7ZQ.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-4KVPAHFV.mjs";import"./chunk-GAOQHD5S.mjs";import{b as W}from"./chunk-ZZBNFNMG.mjs";import"./chunk-3FEXJUO2.mjs";import{d as R,g as Ae}from"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-KV4NXLPT.mjs";import{b as I,h as Te}from"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import{i as M,p as De}from"./chunk-QWQFF2UG.mjs";import"./chunk-EXVL2OFE.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-IJ523YO2.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-PB6WKSLE.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-MIR3VZSF.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-WYOEMKMO.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-MH42JSPX.mjs");if(t(o)){let{detectChanges:c,shipStructuralRiskCue:r}=await import("./detect-changes-5W6EGEZG.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-TT3DRNAX.mjs"),{shipRequiresQuality:r}=await import("./judgment-orchestrator-AAON4ZJ4.mjs"),{computeCommittedChangeset:p}=await import("./delivery-geometry-WYOEMKMO.mjs"),{judgmentLedgerStorage:h}=await import("./judgment-ledger-storage-7Q7AEEY6.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-OG2KKN3L.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-OG2KKN3L.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-ENLAAMVL.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-TAMBOPN3.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-TBD5EYAL.mjs");t.creditShippedTask(o,a.id)}catch{}let E=await(async()=>{try{let{synthesizeJudgmentReceipt:t}=await import("./judgment-receipt-QLV3MYFT.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-DX3FVSQE.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
12
  \u26A0\uFE0F ${s.question}`),console.log(`
13
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-2P5VOBHM.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};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{d as m,g as S}from"./chunk-KG7Z6OMK.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-JAMSIKDE.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.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,`
8
+ import{d as m,g as S}from"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.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
9
  `).match(/^---\n([\s\S]*?)\n---/);if(!s)return{};let i={},n=s[1].split(`
10
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
11
  \`${i.path}\``);return s.join(`
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as D}from"./chunk-DYHYDHCW.mjs";import{a as $}from"./chunk-27XFSCOE.mjs";import"./chunk-YUKGWWL7.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-5EQLQ7GF.mjs";import"./chunk-UA4Z5TGG.mjs";import"./chunk-TG5CQJD5.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-AZHE4VOM.mjs";import"./chunk-6RLCUGGG.mjs";import"./chunk-KG7Z6OMK.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-JAMSIKDE.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import{a as M,p as B}from"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-EMTCZG5I.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)||D.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 '
8
+ import{a as D}from"./chunk-DYHYDHCW.mjs";import{b as $}from"./chunk-PVCEWFHS.mjs";import"./chunk-LR24AIEW.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-FZS3XGEA.mjs";import"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-ZZBNFNMG.mjs";import"./chunk-3FEXJUO2.mjs";import"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import{a as M,p as B}from"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-IJ523YO2.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)||D.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
9
  /^[a-f0-9]{40}/ { commit=$1; timestamp=$2; next }
10
10
  NF { files[$0]++; if (!lastmod[$0]) lastmod[$0]=timestamp }
11
11
  END { for (const f in files) print files[f], lastmod[f], f }
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as _,b as R,c as o}from"./chunk-KOCROTRM.mjs";import"./chunk-EHEQOF6Z.mjs";import"./chunk-DYHYDHCW.mjs";import{a as v}from"./chunk-27XFSCOE.mjs";import"./chunk-YUKGWWL7.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-5EQLQ7GF.mjs";import"./chunk-UA4Z5TGG.mjs";import"./chunk-TG5CQJD5.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GAOQHD5S.mjs";import{b as y}from"./chunk-AZHE4VOM.mjs";import"./chunk-6RLCUGGG.mjs";import{e as w,g as k}from"./chunk-KG7Z6OMK.mjs";import"./chunk-CE4RCNC7.mjs";import{b as P,h as A}from"./chunk-JAMSIKDE.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import{b as E,p as x}from"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-EMTCZG5I.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as m}from"./chunk-E66B27AL.mjs";A();x();k();import{createHash as I}from"node:crypto";function S(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,scenarios:c.scenarios};return I("sha256").update(JSON.stringify(t)).digest("hex")}m(S,"computeAuditCandidateHash");function j(c,t){let e=w.get(c,"SELECT content FROM specs WHERE id = ?",t),s=(()=>{if(!e?.content)return null;try{return JSON.parse(e.content)}catch{return null}})(),r=w.query(c,"SELECT lens FROM spec_selected_reviewer WHERE spec_id = ?",t).map(a=>a.lens),n=new Set(w.query(c,"SELECT lens FROM spec_review WHERE spec_id = ? AND verdict = 'pass'",t).map(a=>a.lens));if(!(r.length>0?r.every(a=>n.has(a)):n.has("strategic")&&n.has("architecture")&&n.has("design")))return!1;let u=s?.audit_candidate_hash;if(!u)return!0;if(S(s)!==u)return!1;let l=s?.reviews??{};for(let a of r.length>0?r:Object.keys(l)){let d=l[a];if(!(!d||d.verdict!=="pass")&&d.candidateHash!==u)return!1}for(let a of r.length>0?r:["strategic","architecture","design"]){if(!n.has(a))continue;let d=l[a];if(!d||d.candidateHash!==u)return!1}return!0}m(j,"reviewsGatePassedRelational");async function D(c){try{let{stdout:t}=await E("git",["rev-parse","HEAD"],{cwd:c}),e=t.trim();return/^[0-9a-f]{7,40}$/.test(e)?e:null}catch{return null}}m(D,"readGitHead");var C=class{static{m(this,"SpecService")}async create(t,e){let s=await this.requireProjectId(t),{classifySpecCreate:r,shouldMirrorSpecToMemory:n}=await import("./precision-classifier-IVVAXE26.mjs"),p=r(e.title,e.content.goal);if(p.action==="refuse")throw new Error(`Cannot create empty spec (${p.reasonCode}): ${p.reason}`);let u=e.autoContext!==!1,l=e.content.notes??"",a=u&&!l.trim()?await import("./spec-context-inference-7DDSTRTV.mjs").then(async({inferSpecContext:h,warnNoContextMatch:f})=>{let g=await h(e.title,s,t);return g.empty&&f(e.title),g.empty?l:g.notesBlock}):l,d=_.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:a}),i=o.create(s,{title:e.title,content:d,tags:e.tags});return n(i.title,i.content.goal)&&await v.remember(t,{type:"spec",content:`${i.title}
8
+ import{a as _,b as R,c as o}from"./chunk-DCHIPMOG.mjs";import"./chunk-B36LC2JR.mjs";import"./chunk-DYHYDHCW.mjs";import{b as v}from"./chunk-PVCEWFHS.mjs";import"./chunk-LR24AIEW.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-FZS3XGEA.mjs";import"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GAOQHD5S.mjs";import{b as y}from"./chunk-ZZBNFNMG.mjs";import"./chunk-3FEXJUO2.mjs";import{e as w,g as k}from"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import{b as P,h as A}from"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import{b as E,p as x}from"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-IJ523YO2.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as m}from"./chunk-E66B27AL.mjs";A();x();k();import{createHash as I}from"node:crypto";function S(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,scenarios:c.scenarios};return I("sha256").update(JSON.stringify(t)).digest("hex")}m(S,"computeAuditCandidateHash");function j(c,t){let e=w.get(c,"SELECT content FROM specs WHERE id = ?",t),s=(()=>{if(!e?.content)return null;try{return JSON.parse(e.content)}catch{return null}})(),r=w.query(c,"SELECT lens FROM spec_selected_reviewer WHERE spec_id = ?",t).map(a=>a.lens),n=new Set(w.query(c,"SELECT lens FROM spec_review WHERE spec_id = ? AND verdict = 'pass'",t).map(a=>a.lens));if(!(r.length>0?r.every(a=>n.has(a)):n.has("strategic")&&n.has("architecture")&&n.has("design")))return!1;let u=s?.audit_candidate_hash;if(!u)return!0;if(S(s)!==u)return!1;let l=s?.reviews??{};for(let a of r.length>0?r:Object.keys(l)){let d=l[a];if(!(!d||d.verdict!=="pass")&&d.candidateHash!==u)return!1}for(let a of r.length>0?r:["strategic","architecture","design"]){if(!n.has(a))continue;let d=l[a];if(!d||d.candidateHash!==u)return!1}return!0}m(j,"reviewsGatePassedRelational");async function D(c){try{let{stdout:t}=await E("git",["rev-parse","HEAD"],{cwd:c}),e=t.trim();return/^[0-9a-f]{7,40}$/.test(e)?e:null}catch{return null}}m(D,"readGitHead");var C=class{static{m(this,"SpecService")}async create(t,e){let s=await this.requireProjectId(t),{classifySpecCreate:r,shouldMirrorSpecToMemory:n}=await import("./precision-classifier-IVVAXE26.mjs"),p=r(e.title,e.content.goal);if(p.action==="refuse")throw new Error(`Cannot create empty spec (${p.reasonCode}): ${p.reason}`);let u=e.autoContext!==!1,l=e.content.notes??"",a=u&&!l.trim()?await import("./spec-context-inference-RTTDOZZO.mjs").then(async({inferSpecContext:h,warnNoContextMatch:f})=>{let g=await h(e.title,s,t);return g.empty&&f(e.title),g.empty?l:g.notesBlock}):l,d=_.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:a}),i=o.create(s,{title:e.title,content:d,tags:e.tags});return n(i.title,i.content.goal)&&await v.remember(t,{type:"spec",content:`${i.title}
9
9
 
10
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 s=await this.requireProjectId(t);return o.get(s,e)}async list(t,e={}){let s=await this.requireProjectId(t);return o.list(s,e)}async setStatus(t,e,s){let r=await this.requireProjectId(t),n=o.setStatus(r,e,s);return n&&await v.remember(t,{type:"spec",content:`Spec status \u2192 ${s}: ${n.title}`,tags:{spec_id:e,status:s,event:"status_change"},source:e}),n}async patch(t,e,s){let r=await this.requireProjectId(t),n=o.get(r,e);if(!n)return null;let p=_.parse({...n.content,...s});return this.update(t,e,p)}async applyDelta(t,e,s){let r=await this.requireProjectId(t),n=o.get(r,e);if(!n)return null;let p=R(n.content,s);return p===n.content?n:this.update(t,e,p)}async update(t,e,s){let r=await this.requireProjectId(t),n=o.get(r,e);if(!n)return null;let p=S(n.content),u=S(s),l=p!==u,a=l?{...s,reviews:{},selected_reviewers:[],audit_candidate_hash:null}:s;return l&&(n.status==="reviewed"||n.status==="in_progress")&&o.setStatus(r,e,"draft"),o.updateContent(r,e,a)}async recordReview(t,e,s,r){let n=await this.requireProjectId(t),p=3,u=50,l=m(async d=>{let i=o.get(n,e);if(!i)return null;let h=i.content.audit_candidate_hash??S(i.content);if(i.content.audit_candidate_hash&&S(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 f={...r,ts:P(),candidateHash:h},g={...i.content,audit_candidate_hash:h,reviews:{...i.content.reviews??{},[s]:f}};if(o.casUpdate(n,e,g,i.updatedAt))return o.get(n,e);if(d+1>=p)throw new Error(`SPEC_RECORD_REVIEW_CONFLICT_RETRY_EXHAUSTED: ${p} retries failed for spec ${e}`);return await new Promise($=>setTimeout($,u)),l(d+1)},"attemptReview"),a=await l(0);if(a&&j(n,e)&&a.status==="draft"){let{assessAcceptanceCriteria:d}=await import("./nyquist-lite-GE7OAFLC.mjs"),i=d(a.content.acceptance_criteria??[]);if(!i.ok&&i.message){let f=await y.readConfig(t).catch(()=>null),g=f?.tdd?.mode==="strict",b=f?.sdd?.mode==="strict";if(g||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:n})}catch{}}let h=o.setStatus(n,e,"reviewed");if(h){let{breakdownSpecToTasks:f}=await import("./spec-task-breakdown-K3GMQKGH.mjs");return await f(n,t,h),o.get(n,e)}return h}return a}async linkTask(t,e,s){let r=await this.requireProjectId(t);return o.linkTask(r,e,s)}async ship(t,e,s){let r=await this.requireProjectId(t);s!==void 0&&o.setShippedPr(r,e,s);let n=await D(t);return n&&o.setShippedSha(r,e,n),o.setStatus(r,e,"shipped")}unmetCriteria(t,e=new Set){return t.content.acceptance_criteria.filter(s=>!e.has(s))}async setSelectedReviewers(t,e,s){let r=await this.requireProjectId(t),n=o.get(r,e);if(!n)return null;let p=S(n.content);return o.updateContent(r,e,{...n.content,selected_reviewers:s,audit_candidate_hash:p,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}},oe=new C;export{oe as specService};
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:n})}catch{}}let h=o.setStatus(n,e,"reviewed");if(h){let{breakdownSpecToTasks:f}=await import("./spec-task-breakdown-RUDEP3AY.mjs");return await f(n,t,h),o.get(n,e)}return h}return a}async linkTask(t,e,s){let r=await this.requireProjectId(t);return o.linkTask(r,e,s)}async ship(t,e,s){let r=await this.requireProjectId(t);s!==void 0&&o.setShippedPr(r,e,s);let n=await D(t);return n&&o.setShippedSha(r,e,n),o.setStatus(r,e,"shipped")}unmetCriteria(t,e=new Set){return t.content.acceptance_criteria.filter(s=>!e.has(s))}async setSelectedReviewers(t,e,s){let r=await this.requireProjectId(t),n=o.get(r,e);if(!n)return null;let p=S(n.content);return o.updateContent(r,e,{...n.content,selected_reviewers:s,audit_candidate_hash:p,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}},oe=new C;export{oe as specService};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as m}from"./chunk-T2FCU3ZS.mjs";import{c as s}from"./chunk-KOCROTRM.mjs";import"./chunk-DYHYDHCW.mjs";import"./chunk-R4ILCXKE.mjs";import{a as w}from"./chunk-27XFSCOE.mjs";import"./chunk-YUKGWWL7.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-OUAS3LZ3.mjs";import"./chunk-INXNK57E.mjs";import"./chunk-5EQLQ7GF.mjs";import"./chunk-UA4Z5TGG.mjs";import"./chunk-TG5CQJD5.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-AZHE4VOM.mjs";import"./chunk-6RLCUGGG.mjs";import"./chunk-KG7Z6OMK.mjs";import"./chunk-CE4RCNC7.mjs";import{b as h,h as S}from"./chunk-JAMSIKDE.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-EMTCZG5I.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as p}from"./chunk-E66B27AL.mjs";S();async function x(r,a,e){let o=e.content.acceptance_criteria;if(o.length===0)return{taskIds:[],skippedReason:"no_acceptance_criteria"};if(e.content.tasks_created_at!==null)return{taskIds:[],skippedReason:"already_broken_down"};let d=e.content.linked_tasks.length>0,y=(await m.getTasks(r)).filter(t=>t.featureId===e.id),g=new Set,u=o.map(t=>{let n=y.find(_=>_.body===t&&!g.has(_.id));return n&&g.add(n.id),n??null}),c=o.map((t,n)=>({ac:t,i:n})).filter(({i:t})=>u[t]===null),l=c.length>0?await m.addTasks(r,c.map(({ac:t})=>({description:I(t),body:t,priority:"medium",type:"feature",section:"backlog",featureId:e.id,groupId:e.id,groupName:e.title}))):[],b=new Map(c.map(({i:t},n)=>[t,l[n].id])),i=o.map((t,n)=>u[n]?.id??b.get(n));for(let t of i)s.linkTask(r,e.id,t);let k=s.get(r,e.id);if(k){let t={...k.content,tasks_created_at:h()};s.updateContent(r,e.id,t)}let f=i.length-l.length;return await w.remember(a,{type:"spec",content:`Auto-breakdown: ${l.length} tasks created${f>0?`, ${f} adopted`:""} from ${e.title}${d?" (recovered from partial)":""}`,tags:{spec_id:e.id,event:"auto_breakdown",task_count:String(i.length),...d?{recovered:"partial"}:{}},source:e.id}),{taskIds:i,...d?{recoveredFromPartial:!0}:{}}}p(x,"breakdownSpecToTasks");function I(r){let a=r.replace(/\s+/g," ").trim();return a.length<=140?a:`${a.slice(0,137)}\u2026`}p(I,"truncateForDescription");export{x as breakdownSpecToTasks};
8
+ import{a as m}from"./chunk-YHOZTAZH.mjs";import{c as s}from"./chunk-DCHIPMOG.mjs";import"./chunk-DYHYDHCW.mjs";import"./chunk-R4ILCXKE.mjs";import{b as w}from"./chunk-PVCEWFHS.mjs";import"./chunk-LR24AIEW.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-OUAS3LZ3.mjs";import"./chunk-ETTDRXQ6.mjs";import"./chunk-FZS3XGEA.mjs";import"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-ZZBNFNMG.mjs";import"./chunk-3FEXJUO2.mjs";import"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import{b as h,h as S}from"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-IJ523YO2.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as p}from"./chunk-E66B27AL.mjs";S();async function x(r,a,e){let o=e.content.acceptance_criteria;if(o.length===0)return{taskIds:[],skippedReason:"no_acceptance_criteria"};if(e.content.tasks_created_at!==null)return{taskIds:[],skippedReason:"already_broken_down"};let d=e.content.linked_tasks.length>0,y=(await m.getTasks(r)).filter(t=>t.featureId===e.id),g=new Set,u=o.map(t=>{let n=y.find(_=>_.body===t&&!g.has(_.id));return n&&g.add(n.id),n??null}),c=o.map((t,n)=>({ac:t,i:n})).filter(({i:t})=>u[t]===null),l=c.length>0?await m.addTasks(r,c.map(({ac:t})=>({description:I(t),body:t,priority:"medium",type:"feature",section:"backlog",featureId:e.id,groupId:e.id,groupName:e.title}))):[],b=new Map(c.map(({i:t},n)=>[t,l[n].id])),i=o.map((t,n)=>u[n]?.id??b.get(n));for(let t of i)s.linkTask(r,e.id,t);let k=s.get(r,e.id);if(k){let t={...k.content,tasks_created_at:h()};s.updateContent(r,e.id,t)}let f=i.length-l.length;return await w.remember(a,{type:"spec",content:`Auto-breakdown: ${l.length} tasks created${f>0?`, ${f} adopted`:""} from ${e.title}${d?" (recovered from partial)":""}`,tags:{spec_id:e.id,event:"auto_breakdown",task_count:String(i.length),...d?{recovered:"partial"}:{}},source:e.id}),{taskIds:i,...d?{recoveredFromPartial:!0}:{}}}p(x,"breakdownSpecToTasks");function I(r){let a=r.replace(/\s+/g," ").trim();return a.length<=140?a:`${a.slice(0,137)}\u2026`}p(I,"truncateForDescription");export{x as breakdownSpecToTasks};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{b as a}from"./chunk-6UH244CC.mjs";import"./chunk-OUAS3LZ3.mjs";import"./chunk-INXNK57E.mjs";import"./chunk-5EQLQ7GF.mjs";import"./chunk-UA4Z5TGG.mjs";import"./chunk-TG5CQJD5.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-KG7Z6OMK.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-JAMSIKDE.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as stateStorage};
8
+ import{b as a}from"./chunk-D7DQABWO.mjs";import"./chunk-OUAS3LZ3.mjs";import"./chunk-ETTDRXQ6.mjs";import"./chunk-FZS3XGEA.mjs";import"./chunk-7WO5CEH3.mjs";import"./chunk-AORD3YDQ.mjs";import"./chunk-M5E2YOZ4.mjs";import"./chunk-TKXOMN4K.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-A6K4H3YT.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-UH4MD3F3.mjs";import"./chunk-QWQFF2UG.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as stateStorage};