prjct-cli 3.88.0 → 3.89.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 (218) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/bin/hook-chunks/agent-identity-45BYQBU2.mjs +8 -0
  3. package/dist/bin/hook-chunks/agent-switch-FBQDHWAO.mjs +22 -0
  4. package/dist/bin/hook-chunks/analysis-NRRZYJ6G.mjs +42 -0
  5. package/dist/bin/hook-chunks/auth-config-WNUARXTJ.mjs +8 -0
  6. package/dist/bin/hook-chunks/auto-flush-D3X3U4CP.mjs +8 -0
  7. package/dist/bin/hook-chunks/auto-updater-EHRRMCYY.mjs +9 -0
  8. package/dist/bin/hook-chunks/capture-gate-BFOABO2Y.mjs +8 -0
  9. package/dist/bin/hook-chunks/chunk-2H57GV2T.mjs +38 -0
  10. package/dist/bin/hook-chunks/chunk-2NMSEZTQ.mjs +8 -0
  11. package/dist/bin/hook-chunks/chunk-2OU2MKNS.mjs +8 -0
  12. package/dist/bin/hook-chunks/chunk-2UC4DTDO.mjs +9 -0
  13. package/dist/bin/hook-chunks/chunk-3FBCOCPD.mjs +8 -0
  14. package/dist/bin/hook-chunks/chunk-3HDIQJ55.mjs +19 -0
  15. package/dist/bin/hook-chunks/chunk-3JUE6MNF.mjs +8 -0
  16. package/dist/bin/hook-chunks/chunk-3LG3ACQV.mjs +8 -0
  17. package/dist/bin/hook-chunks/chunk-45I2C2UB.mjs +25 -0
  18. package/dist/bin/hook-chunks/chunk-4DDCWMI6.mjs +8 -0
  19. package/dist/bin/hook-chunks/chunk-4KY2EHXS.mjs +9 -0
  20. package/dist/bin/hook-chunks/chunk-4WHS7CO7.mjs +8 -0
  21. package/dist/bin/hook-chunks/chunk-54LH63LM.mjs +7 -0
  22. package/dist/bin/hook-chunks/chunk-5T5PZKHW.mjs +16 -0
  23. package/dist/bin/hook-chunks/chunk-5TBQNW2G.mjs +17 -0
  24. package/dist/bin/hook-chunks/chunk-5WAONIPX.mjs +8 -0
  25. package/dist/bin/hook-chunks/chunk-6EWGHM32.mjs +9 -0
  26. package/dist/bin/hook-chunks/chunk-6IKHMK2U.mjs +10 -0
  27. package/dist/bin/hook-chunks/chunk-75UJIVMO.mjs +10 -0
  28. package/dist/bin/hook-chunks/chunk-7OZDWT6C.mjs +9 -0
  29. package/dist/bin/hook-chunks/chunk-7SI6X3Z7.mjs +8 -0
  30. package/dist/bin/hook-chunks/chunk-A4OFZ2SK.mjs +19 -0
  31. package/dist/bin/hook-chunks/chunk-A5RNWWTH.mjs +9 -0
  32. package/dist/bin/hook-chunks/chunk-AKIN5WSQ.mjs +9 -0
  33. package/dist/bin/hook-chunks/chunk-AOPJ4Z6O.mjs +8 -0
  34. package/dist/bin/hook-chunks/chunk-AUUWQH3S.mjs +14 -0
  35. package/dist/bin/hook-chunks/chunk-AW25AWN5.mjs +31 -0
  36. package/dist/bin/hook-chunks/chunk-BISPGBNN.mjs +35 -0
  37. package/dist/bin/hook-chunks/chunk-BUDZL4DW.mjs +8 -0
  38. package/dist/bin/hook-chunks/chunk-CE4RCNC7.mjs +8 -0
  39. package/dist/bin/hook-chunks/chunk-CQHPIYNM.mjs +8 -0
  40. package/dist/bin/hook-chunks/chunk-CREPUNOS.mjs +24 -0
  41. package/dist/bin/hook-chunks/chunk-CTWZQ7YI.mjs +8 -0
  42. package/dist/bin/hook-chunks/chunk-CULYIJJZ.mjs +16 -0
  43. package/dist/bin/hook-chunks/chunk-D7TRY3CO.mjs +8 -0
  44. package/dist/bin/hook-chunks/chunk-DAOC3T5G.mjs +43 -0
  45. package/dist/bin/hook-chunks/chunk-DMXFGLZE.mjs +21 -0
  46. package/dist/bin/hook-chunks/chunk-DXQMKW2B.mjs +10 -0
  47. package/dist/bin/hook-chunks/chunk-DYHYDHCW.mjs +8 -0
  48. package/dist/bin/hook-chunks/chunk-E66B27AL.mjs +8 -0
  49. package/dist/bin/hook-chunks/chunk-EM6ZDJAK.mjs +45 -0
  50. package/dist/bin/hook-chunks/chunk-F652GI4F.mjs +15 -0
  51. package/dist/bin/hook-chunks/chunk-FGQZ62ZP.mjs +47 -0
  52. package/dist/bin/hook-chunks/chunk-GAOQHD5S.mjs +8 -0
  53. package/dist/bin/hook-chunks/chunk-GCKILEXJ.mjs +8 -0
  54. package/dist/bin/hook-chunks/chunk-GHBGBP2M.mjs +31 -0
  55. package/dist/bin/hook-chunks/chunk-GJFWVCTS.mjs +19 -0
  56. package/dist/bin/hook-chunks/chunk-GSMDQ7VM.mjs +16 -0
  57. package/dist/bin/hook-chunks/chunk-GVJZPOG2.mjs +13 -0
  58. package/dist/bin/hook-chunks/chunk-GVNMXVVA.mjs +8 -0
  59. package/dist/bin/hook-chunks/chunk-H6KVNDQD.mjs +71 -0
  60. package/dist/bin/hook-chunks/chunk-HDHVBB6Q.mjs +1260 -0
  61. package/dist/bin/hook-chunks/chunk-HDSS6UB3.mjs +8 -0
  62. package/dist/bin/hook-chunks/chunk-HE5RSIHG.mjs +8 -0
  63. package/dist/bin/hook-chunks/chunk-HJ4HEI45.mjs +8 -0
  64. package/dist/bin/hook-chunks/chunk-HZIORCPO.mjs +16 -0
  65. package/dist/bin/hook-chunks/chunk-HZXDF2TQ.mjs +8 -0
  66. package/dist/bin/hook-chunks/chunk-J6JZ4PQA.mjs +18 -0
  67. package/dist/bin/hook-chunks/chunk-JQE2F2RK.mjs +8 -0
  68. package/dist/bin/hook-chunks/chunk-JQLJM4BK.mjs +9 -0
  69. package/dist/bin/hook-chunks/chunk-KEJ5RMAI.mjs +9 -0
  70. package/dist/bin/hook-chunks/chunk-L4COZ7ZH.mjs +13 -0
  71. package/dist/bin/hook-chunks/chunk-LLQUB6YR.mjs +11 -0
  72. package/dist/bin/hook-chunks/chunk-LT5WSSQO.mjs +8 -0
  73. package/dist/bin/hook-chunks/chunk-LWCHQIJ7.mjs +11 -0
  74. package/dist/bin/hook-chunks/chunk-MECJJJ7R.mjs +10 -0
  75. package/dist/bin/hook-chunks/chunk-MEQS4VPO.mjs +8 -0
  76. package/dist/bin/hook-chunks/chunk-MXHX44WF.mjs +9 -0
  77. package/dist/bin/hook-chunks/chunk-N5WOHG36.mjs +8 -0
  78. package/dist/bin/hook-chunks/chunk-NJAMZSHM.mjs +26 -0
  79. package/dist/bin/hook-chunks/chunk-NLG2EW6M.mjs +8 -0
  80. package/dist/bin/hook-chunks/chunk-NN65WGGN.mjs +8 -0
  81. package/dist/bin/hook-chunks/chunk-NWY5M34K.mjs +12 -0
  82. package/dist/bin/hook-chunks/chunk-ODWWIFSN.mjs +9 -0
  83. package/dist/bin/hook-chunks/chunk-OFVLGJ76.mjs +8 -0
  84. package/dist/bin/hook-chunks/chunk-OVR6RUUZ.mjs +13 -0
  85. package/dist/bin/hook-chunks/chunk-P43HDWI5.mjs +14 -0
  86. package/dist/bin/hook-chunks/chunk-PKDYFXMI.mjs +8 -0
  87. package/dist/bin/hook-chunks/chunk-PSSR7LSW.mjs +8 -0
  88. package/dist/bin/hook-chunks/chunk-PTVXWPQH.mjs +8 -0
  89. package/dist/bin/hook-chunks/chunk-PW3KYKVS.mjs +9 -0
  90. package/dist/bin/hook-chunks/chunk-Q5I2UPD6.mjs +9 -0
  91. package/dist/bin/hook-chunks/chunk-QDQ7DTDV.mjs +8 -0
  92. package/dist/bin/hook-chunks/chunk-QSAA6LZF.mjs +8 -0
  93. package/dist/bin/hook-chunks/chunk-R77TXXPP.mjs +53 -0
  94. package/dist/bin/hook-chunks/chunk-RNCLLUMK.mjs +18 -0
  95. package/dist/bin/hook-chunks/chunk-SJ75V4WG.mjs +9 -0
  96. package/dist/bin/hook-chunks/chunk-SN224ILI.mjs +9 -0
  97. package/dist/bin/hook-chunks/chunk-SNISJ7HR.mjs +15 -0
  98. package/dist/bin/hook-chunks/chunk-SOPRYWUY.mjs +11 -0
  99. package/dist/bin/hook-chunks/chunk-SVZHJZ5T.mjs +9 -0
  100. package/dist/bin/hook-chunks/chunk-SYHDEUVU.mjs +10 -0
  101. package/dist/bin/hook-chunks/chunk-TPESWBA7.mjs +8 -0
  102. package/dist/bin/hook-chunks/chunk-TRMBRDKH.mjs +8 -0
  103. package/dist/bin/hook-chunks/chunk-TXJT3G53.mjs +10 -0
  104. package/dist/bin/hook-chunks/chunk-UDUUEZD3.mjs +11 -0
  105. package/dist/bin/hook-chunks/chunk-UUULLTQV.mjs +8 -0
  106. package/dist/bin/hook-chunks/chunk-V37VTXDW.mjs +10 -0
  107. package/dist/bin/hook-chunks/chunk-VAXQ5IDD.mjs +8 -0
  108. package/dist/bin/hook-chunks/chunk-WDGDFXSB.mjs +10 -0
  109. package/dist/bin/hook-chunks/chunk-WUHGODSQ.mjs +8 -0
  110. package/dist/bin/hook-chunks/chunk-X5RDLFPM.mjs +8 -0
  111. package/dist/bin/hook-chunks/chunk-XGYCAVB2.mjs +8 -0
  112. package/dist/bin/hook-chunks/chunk-Y5NQV46G.mjs +9 -0
  113. package/dist/bin/hook-chunks/chunk-YGHIPTJN.mjs +13 -0
  114. package/dist/bin/hook-chunks/chunk-YJMWY4Y6.mjs +8 -0
  115. package/dist/bin/hook-chunks/chunk-YORSHLFH.mjs +11 -0
  116. package/dist/bin/hook-chunks/chunk-YUOTOCKK.mjs +103 -0
  117. package/dist/bin/hook-chunks/chunk-ZTZTVBAZ.mjs +12 -0
  118. package/dist/bin/hook-chunks/chunk-ZX2KFQV5.mjs +11 -0
  119. package/dist/bin/hook-chunks/chunk-ZZ65CN5F.mjs +20 -0
  120. package/dist/bin/hook-chunks/client-SKFMAUI5.mjs +10 -0
  121. package/dist/bin/hook-chunks/code-graph-cloud-65GCWNII.mjs +8 -0
  122. package/dist/bin/hook-chunks/codex-skill-MNY46575.mjs +8 -0
  123. package/dist/bin/hook-chunks/command-installer-ZOQQLRCI.mjs +8 -0
  124. package/dist/bin/hook-chunks/config-manager-KJCMN7PV.mjs +8 -0
  125. package/dist/bin/hook-chunks/content-bound-stamp-72EQVZLP.mjs +10 -0
  126. package/dist/bin/hook-chunks/context-pressure-OUN5PFMN.mjs +8 -0
  127. package/dist/bin/hook-chunks/context7-service-4C6VNJUS.mjs +8 -0
  128. package/dist/bin/hook-chunks/custom-workflow-storage-M77INP6Z.mjs +8 -0
  129. package/dist/bin/hook-chunks/cwd-changed-KXOCN55N.mjs +8 -0
  130. package/dist/bin/hook-chunks/cycle-budget-card-O5WAGNGC.mjs +9 -0
  131. package/dist/bin/hook-chunks/database-SLDTQXWG.mjs +8 -0
  132. package/dist/bin/hook-chunks/delivery-geometry-VHCURJ7E.mjs +8 -0
  133. package/dist/bin/hook-chunks/detect-changes-6N4DCWXQ.mjs +17 -0
  134. package/dist/bin/hook-chunks/detection-MEYHME4X.mjs +8 -0
  135. package/dist/bin/hook-chunks/developer-evolution-R5BXQH6G.mjs +12 -0
  136. package/dist/bin/hook-chunks/discuss-lock-55GER2LR.mjs +8 -0
  137. package/dist/bin/hook-chunks/distill-R477XZE3.mjs +8 -0
  138. package/dist/bin/hook-chunks/drift-refresh-TD3PYPJN.mjs +8 -0
  139. package/dist/bin/hook-chunks/editors-config-3N6VREZR.mjs +8 -0
  140. package/dist/bin/hook-chunks/enriched-recall-65X44HBM.mjs +8 -0
  141. package/dist/bin/hook-chunks/exec-I7XE7NMD.mjs +8 -0
  142. package/dist/bin/hook-chunks/format-UF2TLTKX.mjs +8 -0
  143. package/dist/bin/hook-chunks/git-helpers-6JLP2OJZ.mjs +8 -0
  144. package/dist/bin/hook-chunks/infer-memory-file-PIAZ542H.mjs +8 -0
  145. package/dist/bin/hook-chunks/judgment-ledger-storage-UKROWRVA.mjs +8 -0
  146. package/dist/bin/hook-chunks/judgment-orchestrator-UFGNBTEK.mjs +8 -0
  147. package/dist/bin/hook-chunks/judgment-receipt-NXL5Q4CE.mjs +8 -0
  148. package/dist/bin/hook-chunks/land-cue-SRIIDHMN.mjs +9 -0
  149. package/dist/bin/hook-chunks/land-synthesis-ANVOY7AM.mjs +8 -0
  150. package/dist/bin/hook-chunks/legacy-crew-sweep-PSJCO5UP.mjs +24 -0
  151. package/dist/bin/hook-chunks/memory-index-7LM2BMWZ.mjs +10 -0
  152. package/dist/bin/hook-chunks/notification-2TZO3WRM.mjs +8 -0
  153. package/dist/bin/hook-chunks/nyquist-lite-GE7OAFLC.mjs +10 -0
  154. package/dist/bin/hook-chunks/pack-integrity-6VKUAISJ.mjs +10 -0
  155. package/dist/bin/hook-chunks/pack-manager-KQBNP6XR.mjs +8 -0
  156. package/dist/bin/hook-chunks/package-legitimacy-HXC4L73B.mjs +8 -0
  157. package/dist/bin/hook-chunks/path-manager-F2HE2GGK.mjs +8 -0
  158. package/dist/bin/hook-chunks/planning-ZQNNDOEL.mjs +9 -0
  159. package/dist/bin/hook-chunks/post-edit-AEFFZFPO.mjs +8 -0
  160. package/dist/bin/hook-chunks/pr-convention-7UGI7TFA.mjs +8 -0
  161. package/dist/bin/hook-chunks/pre-bash-3FACZOB5.mjs +11 -0
  162. package/dist/bin/hook-chunks/pre-commit-MDFDQ5QZ.mjs +8 -0
  163. package/dist/bin/hook-chunks/pre-edit-ORX656T5.mjs +11 -0
  164. package/dist/bin/hook-chunks/pre-package-ITHMLNGN.mjs +8 -0
  165. package/dist/bin/hook-chunks/pre-search-UFS2Z5VJ.mjs +9 -0
  166. package/dist/bin/hook-chunks/pre-secrets-IE5NX5X5.mjs +8 -0
  167. package/dist/bin/hook-chunks/precision-classifier-IVVAXE26.mjs +8 -0
  168. package/dist/bin/hook-chunks/precision-judgment-WPTCNTGV.mjs +8 -0
  169. package/dist/bin/hook-chunks/prjct-md-IKUVPUGT.mjs +8 -0
  170. package/dist/bin/hook-chunks/project-agent-surfaces-VCOI4GHT.mjs +8 -0
  171. package/dist/bin/hook-chunks/project-file-inventory-ZAPKPKY6.mjs +8 -0
  172. package/dist/bin/hook-chunks/project-memory-KRA3BH7A.mjs +8 -0
  173. package/dist/bin/hook-chunks/project-style-evolution-363CLE32.mjs +8 -0
  174. package/dist/bin/hook-chunks/prompt-6L7B546V.mjs +22 -0
  175. package/dist/bin/hook-chunks/publish-helper-I37V4L7U.mjs +8 -0
  176. package/dist/bin/hook-chunks/purge-IPK4NJN6.mjs +8 -0
  177. package/dist/bin/hook-chunks/retention-S2GGTVY2.mjs +8 -0
  178. package/dist/bin/hook-chunks/sdd-JIPV7QJP.mjs +10 -0
  179. package/dist/bin/hook-chunks/session-continuity-DABISZYM.mjs +11 -0
  180. package/dist/bin/hook-chunks/session-start-GJPAQ3GL.mjs +8 -0
  181. package/dist/bin/hook-chunks/settings-installer-QDM3GB6J.mjs +9 -0
  182. package/dist/bin/hook-chunks/setup-TG5O5TKD.mjs +142 -0
  183. package/dist/bin/hook-chunks/shipping-VCLQS7GP.mjs +13 -0
  184. package/dist/bin/hook-chunks/skill-index-OOVAXHYJ.mjs +12 -0
  185. package/dist/bin/hook-chunks/spec-context-inference-MOOQL2VC.mjs +15 -0
  186. package/dist/bin/hook-chunks/spec-service-33UDKWXT.mjs +11 -0
  187. package/dist/bin/hook-chunks/spec-task-breakdown-FES465AB.mjs +8 -0
  188. package/dist/bin/hook-chunks/state-storage-KNGP2CQV.mjs +8 -0
  189. package/dist/bin/hook-chunks/stop-IWI5SQG6.mjs +17 -0
  190. package/dist/bin/hook-chunks/subagent-start-NJZOWV2P.mjs +8 -0
  191. package/dist/bin/hook-chunks/subagent-stop-R6HIIVWQ.mjs +8 -0
  192. package/dist/bin/hook-chunks/surface-attribution-JYE6VDZR.mjs +8 -0
  193. package/dist/bin/hook-chunks/symbol-graph-LZM4RZXZ.mjs +8 -0
  194. package/dist/bin/hook-chunks/sync-analyzer-FKC57RTV.mjs +8 -0
  195. package/dist/bin/hook-chunks/sync-client-DJWOG2ZQ.mjs +8 -0
  196. package/dist/bin/hook-chunks/sync-cursor-storage-2VKG757H.mjs +19 -0
  197. package/dist/bin/hook-chunks/task-orchestration-MLOCR7GA.mjs +8 -0
  198. package/dist/bin/hook-chunks/task-overview-6ZQKJGSH.mjs +8 -0
  199. package/dist/bin/hook-chunks/task-service-NSS5SVJE.mjs +8 -0
  200. package/dist/bin/hook-chunks/tdd-AKXWUK2Y.mjs +10 -0
  201. package/dist/bin/hook-chunks/template-loader-KLKEG7XM.mjs +8 -0
  202. package/dist/bin/hook-chunks/transcript-jsonl-6X4DDD6R.mjs +8 -0
  203. package/dist/bin/hook-chunks/trust-boundary-ERMDF2C5.mjs +8 -0
  204. package/dist/bin/hook-chunks/usefulness-253CZLNY.mjs +8 -0
  205. package/dist/bin/hook-chunks/vault-retire-notice-GRT3QRLZ.mjs +9 -0
  206. package/dist/bin/hook-chunks/velocity-storage-UPW6TLK6.mjs +8 -0
  207. package/dist/bin/hook-chunks/weak-model-mode-JQ23PTXN.mjs +8 -0
  208. package/dist/bin/hook-chunks/work-graph-QJGNBVIP.mjs +49 -0
  209. package/dist/bin/hook-chunks/work-scope-C7BJX6QE.mjs +8 -0
  210. package/dist/bin/hook-chunks/workspace-occupancy-UVIRHY5Z.mjs +8 -0
  211. package/dist/bin/hook-chunks/worktree-service-XGRN5TTE.mjs +12 -0
  212. package/dist/bin/hook-fast-linux-x64 +0 -0
  213. package/dist/bin/prjct-core.mjs +625 -624
  214. package/dist/bin/prjct-hooks.mjs +3 -2282
  215. package/dist/bin/prjct.mjs +17 -2
  216. package/dist/daemon/entry.mjs +545 -544
  217. package/dist/mcp/server.mjs +196 -195
  218. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a as x,b as h}from"./chunk-OVR6RUUZ.mjs";import{a as M,h as I}from"./chunk-DXQMKW2B.mjs";import{e as b}from"./chunk-3HDIQJ55.mjs";import{a as S}from"./chunk-DAOC3T5G.mjs";import{a as l,b as D}from"./chunk-HDHVBB6Q.mjs";import{b as R}from"./chunk-GCKILEXJ.mjs";import{a as c}from"./chunk-E66B27AL.mjs";D();var F=.92,v=.18;function d(e){let r=new Map,n=[];for(let s of e){r.set(l(s.content),s.id);let o=x(s.content);n.push(Float64Array.from(o))}return{entries:e,fingerprints:r,vectors:n}}c(d,"buildReferenceIndex");function g(e,r,n){if(!r||r.entries.length===0)return{excess:1,maxSim:0,nearestId:null,exactDup:!1,nearDup:!1};let s=l(e),o=r.fingerprints.get(s);if(o&&o!==n)return{excess:0,maxSim:1,nearestId:o,exactDup:!0,nearDup:!0};let f=x(e),a=r.entries.reduce((t,m,_)=>{if(n&&m.id===n)return t;let E=h(f,r.vectors[_]);return E>t.maxSim?{maxSim:E,nearestId:m.id}:t},{maxSim:0,nearestId:null}),i=Math.max(0,Math.min(1,a.maxSim)),u=a.nearestId,p=i>=F;return{excess:p?0:Math.max(0,Math.min(1,1-i)),maxSim:i,nearestId:u,exactDup:!1,nearDup:p}}c(g,"excessAgainstIndex");function L(e,r,n){return g(e,d(r),n)}c(L,"computeExcess");var $=new Set(["decision","gotcha","learning","fact","feedback","pattern","anti-pattern","identity","voice","glossary","framework","spec","context"]),k=150,N={declared:3,extracted:2,ambiguous:1,inferred:0};function T(e){return e.tags?.context_schema==="living-v2"||e.tags?.synthesis==="model-authored"||e.tags?.synthesis==="deterministic"||e.tags?.source==="land-auto"||e.tags?.capture==="land-v2"}c(T,"isLivingV2");function w(e){return!(!R(e)||e.content.trim().length<40||!$.has(e.type)||e.type==="context"&&!T(e)||e.type==="inbox"||e.type==="todo"||e.type==="idea")}c(w,"isReferenceEligible");function A(e){let r=N[e.provenance]??1,n=e.type==="decision"||e.type==="gotcha"?100:e.type==="learning"||e.type==="fact"?50:e.type==="context"?30:20,s=Date.parse(e.rememberedAt),o=Number.isFinite(s)?s/1e13:0;return n*10+r*3+o}c(A,"referenceRank");function C(e){let r=e.filter(w);return r.sort((n,s)=>A(s)-A(n)),r.slice(0,k)}c(C,"buildReferenceModel");var P=new Set(["decision","gotcha","red-herring","learning","fact","feedback","pattern","anti-pattern","identity","voice","glossary","framework","spec","shipped"]),j=.28;function Q(e,r,n,s){let o=n.trim();if(o.length===0)return{accept:!1,reason:"empty content"};let f=M(o,r);if(f.junk)return{accept:!1,reason:`junk capture: ${f.reason}`};let a=I(o,r,{force:s?.force==="true"||s?.["precision:force"]==="true"});if(a.action==="refuse")return{accept:!1,reason:`precision: ${a.reason}`};if(a.action==="demote")return{accept:!1,reason:`precision demote\u2192${a.demoteTo??"context"}: ${a.reason}`};let i=b(s?.source);if(P.has(r)&&!i)return{accept:!0,reason:"judgment type \u2014 always accept novel content"};let u=(()=>{try{return S.allEntriesForIndex(e)}catch{return null}})();if(!u)return{accept:!0,reason:"gate skipped (read failure)"};if(u.length===0)return{accept:!0,reason:"empty vault \u2014 seed accepted"};let p=C(u);if(p.length===0)return{accept:!0,reason:"empty reference \u2014 accept"};let y=d(p),t=g(o,y),m=i?j:v;return t.exactDup||t.nearDup||t.excess<m?{accept:!1,reason:t.exactDup?`redundant exact match of ${t.nearestId}`:i?`auto-source low excess ${t.excess.toFixed(2)} (floor ${m}) vs R nearest ${t.nearestId}`:`low excess ${t.excess.toFixed(2)} vs reference (nearest ${t.nearestId}, sim ${t.maxSim.toFixed(2)})`,excess:t.excess,nearestId:t.nearestId}:{accept:!0,reason:i?`auto-source excess ${t.excess.toFixed(2)} above floor`:`excess ${t.excess.toFixed(2)} above capture floor`,excess:t.excess,nearestId:t.nearestId}}c(Q,"captureGate");export{k as a,w as b,C as c,F as d,v as e,d as f,g,L as h,Q as i};
@@ -0,0 +1,10 @@
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 S}from"./chunk-HJ4HEI45.mjs";import{a as m,b as c,c as g}from"./chunk-3LG3ACQV.mjs";import{d as p,g as D}from"./chunk-HDHVBB6Q.mjs";import{b as d,c as l,e as b}from"./chunk-AKIN5WSQ.mjs";import{a as o}from"./chunk-E66B27AL.mjs";import{z as e}from"zod";var F=e.enum(["feature","fix","improvement","refactor"]),E=e.enum(["pass","warning","fail","skipped"]),_=e.enum(["added","changed","fixed","removed"]),v=e.object({hours:e.number(),minutes:e.number(),totalMinutes:e.number()}),O=e.object({filesChanged:e.number().nullable().optional(),linesAdded:e.number().nullable().optional(),linesRemoved:e.number().nullable().optional(),commits:e.number().nullable().optional()}),A=e.object({description:e.string(),type:_.optional()}),C=e.object({lintStatus:E.nullable().optional(),lintDetails:e.string().optional(),testStatus:E.nullable().optional(),testDetails:e.string().optional()}),T=e.object({hash:e.string().optional(),message:e.string().optional(),branch:e.string().optional()}),I=e.object({id:e.string(),name:e.string(),version:e.string().nullable().optional(),type:F,agent:e.string().optional(),description:e.string().optional(),changes:e.array(A).optional(),codeSnippets:e.array(e.string()).optional(),commit:T.optional(),codeMetrics:O.optional(),qualityMetrics:C.optional(),quantitativeImpact:e.string().optional(),duration:v.optional(),tasksCompleted:e.number().nullable().optional(),shippedAt:e.string(),featureId:e.string().optional()}),y=e.object({shipped:e.array(I),lastUpdated:e.string()});b();D();var f="shipped:backfilled:v1";function r(a){let s={...(()=>{if(!a.data)return{};try{return JSON.parse(a.data)}catch{return{}}})(),id:a.id,name:a.name,shippedAt:a.shipped_at,version:a.version};return a.description!=null&&(s.description=a.description),a.type!=null&&(s.type=a.type),a.duration!=null&&(s.duration=a.duration),s}o(r,"rowToFeature");var u=class extends S{static{o(this,"ShippedStorage")}constructor(){super("shipped.json",y)}getDefault(){return{shipped:[],lastUpdated:""}}getEventType(t){return`shipped.${t}d`}async getAll(t){return p.query(t,"SELECT * FROM shipped_features ORDER BY shipped_at DESC").map(r)}async republishShips(t){if(p.getDoc(t,f))return 0;let s=await this.getAll(t);for(let i of s)await this.publishEvent(t,"shipped_item.created",{id:i.id,shipId:i.id,name:i.name,version:i.version,shippedAt:i.shippedAt});return p.setDoc(t,f,{at:d(),count:s.length}),s.length}async getRecent(t,s=5){return p.query(t,"SELECT * FROM shipped_features ORDER BY shipped_at DESC LIMIT ?",s).map(r)}async addShipped(t,s,i){let n={...s,id:m(),shippedAt:i||d()};if(p.run(t,`INSERT OR IGNORE INTO shipped_features
9
+ (id, name, shipped_at, version, description, type, duration, data)
10
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,n.id,n.name,n.shippedAt,n.version??"",n.description??null,n.type??null,n.duration??null,JSON.stringify(n)).changes===0){let h=p.get(t,"SELECT * FROM shipped_features WHERE name = ? AND version = ? AND shipped_at = ?",n.name,n.version??"",n.shippedAt);return h?r(h):n}return await this.publishEvent(t,"shipped_item.created",{id:n.id,shipId:n.id,name:n.name,version:n.version,shippedAt:n.shippedAt}),n}async getByVersion(t,s){let i=p.get(t,"SELECT * FROM shipped_features WHERE version = ? ORDER BY shipped_at DESC LIMIT 1",s);return i?r(i):void 0}async getCount(t){return p.get(t,"SELECT COUNT(*) AS c FROM shipped_features")?.c??0}async getByDateRange(t,s,i){return p.query(t,"SELECT * FROM shipped_features WHERE shipped_at >= ? AND shipped_at <= ? ORDER BY shipped_at DESC",s.toISOString(),i.toISOString()).map(r)}async getStats(t,s="month"){let i=new Date,n=s==="week"?new Date(i.getTime()-10080*60*1e3):s==="month"?new Date(i.getFullYear(),i.getMonth(),1):new Date(i.getFullYear(),0,1);return{count:(await this.getByDateRange(t,n,i)).length,period:s}}async archiveOldShipped(t){let s=l(c.SHIPPED_RETENTION_DAYS).toISOString(),i=p.query(t,"SELECT * FROM shipped_features WHERE shipped_at < ? ORDER BY shipped_at DESC",s).map(r);return i.length===0?0:(g.archiveMany(t,i.map(n=>({entityType:"shipped",entityId:n.id,entityData:n,summary:`${n.name} v${n.version}`,reason:"age"}))),p.run(t,"DELETE FROM shipped_features WHERE shipped_at < ?",s),await this.publishEvent(t,"shipped.archived",{count:i.length,oldestShippedAt:i[i.length-1]?.shippedAt}),i.length)}},Y=new u;export{Y as a};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a as o,c as i}from"./chunk-E66B27AL.mjs";import t from"node:os";import e from"node:path";function p(){let r=process.env.PRJCT_CLI_HOME?.trim();return r?e.resolve(r):e.join(t.homedir(),".prjct-cli")}var m=i(()=>{"use strict";o(p,"resolveCliHome")});export{p as a,m as b};
@@ -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 e,o as s}from"./chunk-CTWZQ7YI.mjs";import{a as i}from"./chunk-E66B27AL.mjs";s();function p(t){let n=t?.notify?.mode;if(n==="on"||n==="off")return n;let o=process.env.PRJCT_NOTIFY_MODE?.toLowerCase();return o==="on"||o==="off"?o:"on"}i(p,"effectiveNotifyMode");function f(t){return t.replace(/["\\]/g,"").replace(/[\r\n]+/g," ").trim().slice(0,180)}i(f,"sanitize");async function a(t,n){try{let o=f(t)||"prjct",r=f(n);process.platform==="darwin"?await e("osascript",["-e",`display notification "${r}" with title "${o}"`]):process.platform==="linux"&&await e("notify-send",[o,r])}catch{}}i(a,"notifyDesktop");export{p as a,a as b};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{c as t}from"./chunk-ZZ65CN5F.mjs";import{a as e}from"./chunk-E66B27AL.mjs";async function f(r,o,i){if(i.length!==0)try{let{resolveActiveTask:s}=await import("./task-service-NSS5SVJE.mjs"),c=await s(r,o);c?.id&&t.recordSurfaced(r,i,c.id);for(let n of i)t.recordFetch(r,n)}catch{}}e(f,"recordSurfacedForActiveTask");export{f as a};
@@ -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,b as p}from"./chunk-WUHGODSQ.mjs";import{a as t}from"./chunk-E66B27AL.mjs";p();import f from"node:fs";import s from"node:path";function g(){return s.join(a(),"config")}t(g,"configDir");function l(){return s.join(g(),"global.json")}t(l,"configFilePath");var i={config:null,stamp:""};function c(n){try{let o=f.statSync(n);return`${n}|${o.mtimeMs}|${o.size}`}catch{return`${n}|absent`}}t(c,"fileStamp");function u(){let n=l(),o=c(n);if(i.config!==null&&o===i.stamp)return i.config;let e=(()=>{try{let r=JSON.parse(f.readFileSync(n,"utf-8"));return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch{return{}}})();return i.config=e,i.stamp=o,e}t(u,"readRaw");function b(n){f.mkdirSync(g(),{recursive:!0}),f.writeFileSync(l(),`${JSON.stringify(n,null,2)}
9
+ `,"utf-8"),i.config=n,i.stamp=c(l())}t(b,"writeRaw");function y(n){return u()[n]}t(y,"getConfig");function G(n,o){let e=u();o===void 0?delete e[n]:e[n]=o,b(e)}t(G,"setConfig");export{y as a,G as b};
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{b as u}from"./chunk-3FBCOCPD.mjs";import{a as N,b as f}from"./chunk-HZXDF2TQ.mjs";import{n as E,r as _,s as T,t as S}from"./chunk-AKIN5WSQ.mjs";import{m as I,n as P}from"./chunk-SVZHJZ5T.mjs";import{a as A}from"./chunk-PKDYFXMI.mjs";import{a as y,e as $,f as O}from"./chunk-BUDZL4DW.mjs";import{a as c}from"./chunk-E66B27AL.mjs";import i from"chalk";_();import m from"chalk";var j=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],x=80,v={name:"prjct",icon:"\u26A1",signature:"\u26A1 prjct",spinner:{frames:j,speed:x},cli:{header:c(()=>`${m.cyan.bold("\u26A1")} ${m.cyan("prjct")}`,"header"),footer:c(()=>m.dim("\u26A1 prjct"),"footer"),spin:c((e,t)=>`${m.cyan("\u26A1")} ${m.cyan("prjct")} ${m.cyan(j[e%10])} ${m.dim(t||"")}`,"spin")},template:{header:"\u26A1 prjct",footer:"\u26A1 prjct"},commitFooter:"Generated with [p/](https://www.prjct.app/)",urls:{website:"https://prjct.app",docs:"https://prjct.app/docs"},getCommitFooter:c((e="claude")=>E(e).commitFooter,"getCommitFooter"),getSignature:c((e="claude")=>E(e).signature,"getSignature")},l=v;var w={NO_PROJECT:{message:"No prjct project found in this directory",hint:"Run 'prjct init' to set up a new project",file:".prjct/prjct.config.json"},NO_PROJECT_ID:{message:"Project ID not found",hint:"Run 'prjct init' or check .prjct/prjct.config.json",file:".prjct/prjct.config.json"},CONFIG_NOT_FOUND:{message:"Configuration file not found",hint:"Run 'prjct init' to create project configuration",file:".prjct/prjct.config.json"},CONFIG_INVALID:{message:"Invalid configuration file",hint:"Check JSON syntax or delete .prjct/ and run init again",file:".prjct/prjct.config.json"},GIT_NOT_FOUND:{message:"Git repository not detected",hint:"Run 'git init' first, then 'prjct init'"},GIT_NO_COMMITS:{message:"No commits in repository",hint:"Make an initial commit before using prjct"},GIT_DIRTY:{message:"Working directory has uncommitted changes",hint:"Commit or stash changes, or use '--force' to override"},GIT_ON_MAIN:{message:"Cannot ship from main/master branch",hint:"Create a feature branch first: git checkout -b feature/your-feature"},GIT_OPERATION_FAILED:{message:"Git operation failed",hint:"Check git status and resolve any conflicts"},GH_NOT_AUTHENTICATED:{message:"GitHub CLI not authenticated",hint:"Run 'gh auth login' to authenticate",docs:"https://cli.github.com/manual/gh_auth_login"},LINEAR_NOT_CONFIGURED:{message:"Linear integration not configured",hint:"Configure the Linear MCP server in your AI client"},LINEAR_API_ERROR:{message:"Linear API error",hint:"Check your API key or network connection"},NO_ACTIVE_TASK:{message:"No active work cycle",hint:`Start work with 'p. work "intent"'`},TASK_ALREADY_ACTIVE:{message:"A work cycle is already in progress",hint:"Use 'p. work' to inspect it or ship when complete"},SYNC_FAILED:{message:"Project sync failed",hint:"Check file permissions and try again"},NOTHING_TO_SHIP:{message:"Nothing to ship",hint:"Make some changes first, then run ship"},PR_CREATE_FAILED:{message:"Failed to create pull request",hint:"Check GitHub auth and remote configuration"},NO_AI_PROVIDER:{message:"No AI provider detected",hint:"Install Claude Code or Gemini CLI, then run 'prjct start'",docs:"https://prjct.app/docs"},PROVIDER_NOT_CONFIGURED:{message:"AI provider not configured for prjct",hint:"Run 'prjct start' to configure your provider"},UNKNOWN_COMMAND:{message:"Unknown command",hint:"Run 'prjct --help' to see available commands"},MISSING_PARAM:{message:"Missing required parameter",hint:"Check command usage below"},UNKNOWN:{message:"An unexpected error occurred",hint:"Check the error details and try again"}};function R(e,t){return{...w[e],...t}}c(R,"getError");var b=l.spinner.speed,L={silent:{maxLines:0,maxCharsPerLine:0,showMetrics:!1},minimal:{maxLines:1,maxCharsPerLine:65,showMetrics:!1},compact:{maxLines:4,maxCharsPerLine:80,showMetrics:!0},verbose:{maxLines:1/0,maxCharsPerLine:1/0,showMetrics:!0}},s={currentTier:"compact",interval:null,frame:0,quietMode:!1};function k(){return L[s.currentTier]}c(k,"getTierConfig");var h={success:i.green("\u2713"),fail:i.red("\u2717"),warn:i.yellow("\u26A0"),info:i.blue("\u2139"),debug:i.dim("\u{1F527}"),bullet:i.dim("\u2022"),arrow:i.dim("\u2192"),check:i.green("\u2713"),cross:i.red("\u2717"),spinner:i.cyan("\u25D0")};var g=c((e,t)=>{if(!process.stdout.isTTY&&!process.stderr.isTTY)return e||"";let r=t??(k().maxCharsPerLine||u.FALLBACK_TRUNCATE);return e&&e.length>r?`${e.slice(0,r-1)}\u2026`:e||""},"truncate");var G=c(()=>process.stdout.isTTY?process.stdout.write(`\r${" ".repeat(u.CLEAR_WIDTH)}\r`):!0,"clear"),D={start(){return s.quietMode||console.log(l.cli.header()),this},end(){return s.quietMode||console.log(l.cli.footer()),this},spin(e){return s.quietMode?this:(this.stop(),process.stdout.isTTY?(s.interval=setInterval(()=>{process.stdout.write(`\r${l.cli.spin(s.frame++,g(e,u.SPINNER_MSG))}`)},b),this):(process.stdout.write(`${l.cli.spin(0,g(e,u.SPINNER_MSG))}
9
+ `),this))},done(e,t){if(this.stop(),!s.quietMode){let r=[];t?.agents!==void 0&&r.push(`${t.agents}a`),t?.reduction!==void 0&&r.push(`${t.reduction}%`),t?.tokens!==void 0&&r.push(`${Math.round(t.tokens)}K`);let o=r.length>0?i.dim(` [${r.join(" | ")}]`):"";console.log(`${h.success} ${g(e,u.DONE_MSG)}${o}`)}return this},fail(e){return this.stop(),console.error(`${h.fail} ${g(e,u.FAIL_MSG)}`),this},failWithHint(e){this.stop();let t=typeof e=="string"?R(e):e;return console.error(),console.error(`${h.fail} ${t.message}`),t.file&&console.error(i.dim(` File: ${t.file}`)),t.hint&&console.error(i.yellow(` \u{1F4A1} ${t.hint}`)),t.docs&&console.error(i.dim(` Docs: ${t.docs}`)),console.error(),this},warn(e){return this.stop(),s.quietMode||console.log(`${h.warn} ${g(e,u.WARN_MSG)}`),this},info(e){return this.stop(),s.quietMode||console.log(`${h.info} ${e}`),this},debug(e){this.stop();let t=process.env.DEBUG==="1"||process.env.DEBUG==="true";return!s.quietMode&&t&&console.log(`${h.debug} ${i.dim(e)}`),this},success(e,t){return this.done(e,t)},list(e,t={}){if(this.stop(),s.quietMode)return this;let r=t.bullet||h.bullet,o=" ".repeat(t.indent||0);for(let n of e)console.log(`${o}${r} ${n}`);return this},table(e,t={}){if(this.stop(),s.quietMode||e.length===0)return this;let r=Object.keys(e[0]),o={};for(let n of r){o[n]=n.length;for(let a of e){let p=String(a[n]??"");p.length>o[n]&&(o[n]=p.length)}}if(t.header!==!1){let n=r.map(a=>a.padEnd(o[a])).join(" ");console.log(i.dim(n)),console.log(i.dim("\u2500".repeat(n.length)))}for(let n of e){let a=r.map(p=>String(n[p]??"").padEnd(o[p])).join(" ");console.log(a)}return this},box(e,t){if(this.stop(),s.quietMode)return this;let r=t.split(`
10
+ `),o=Math.max(e.length,...r.map(a=>a.length)),n="\u2500".repeat(o+2);console.log(i.dim(`\u250C${n}\u2510`)),console.log(`${i.dim("\u2502")} ${i.bold(e.padEnd(o))} ${i.dim("\u2502")}`),console.log(i.dim(`\u251C${n}\u2524`));for(let a of r)console.log(`${i.dim("\u2502")} ${a.padEnd(o)} ${i.dim("\u2502")}`);return console.log(i.dim(`\u2514${n}\u2518`)),this},section(e){return this.stop(),s.quietMode?this:(console.log(`
11
+ ${i.bold(e)}`),console.log(i.dim("\u2500".repeat(e.length))),this)},stop(){return s.interval&&(clearInterval(s.interval),s.interval=null,G()),this},step(e,t,r){if(s.quietMode)return this;this.stop();let o=i.dim(`[${e}/${t}]`);return process.stdout.isTTY?(s.interval=setInterval(()=>{process.stdout.write(`\r${l.cli.spin(s.frame++,`${o} ${g(r,u.STEP_MSG)}`)}`)},b),this):(process.stdout.write(`${l.cli.spin(0,`${o} ${g(r,u.STEP_MSG)}`)}
12
+ `),this)},progress(e,t,r){if(s.quietMode)return this;this.stop();let o=Math.round(e/t*100),n=Math.round(o/10),a=10-n,p=i.cyan("\u2588".repeat(n))+i.dim("\u2591".repeat(a)),d=r?` ${g(r,u.PROGRESS_TEXT)}`:"";return process.stdout.isTTY?(s.interval=setInterval(()=>{process.stdout.write(`\r${l.cli.spin(s.frame++,`[${p}] ${o}%${d}`)}`)},b),this):(process.stdout.write(`${l.cli.spin(0,`[${p}] ${o}%${d}`)}
13
+ `),this)}},M=D;S();O();P();var C=class{static{c(this,"ProjectService")}currentAuthor=null;async ensureInit(t){if(await f.isConfigured(t))return{success:!0};try{let{worktreeService:a}=await import("./worktree-service-XGRN5TTE.mjs");if(await a.detect(t)){let d=await a.getMainWorktree(t);if(d&&d!==t&&await f.isConfigured(d))return await a.setup(t,d),{success:!0}}}catch{}M.spin("initializing project...");let{PlanningCommands:r}=await import("./planning-ZQNNDOEL.mjs"),n=await new r().init(null,t);return n.success?{success:!0}:n}async getProjectId(t){let r=await f.getProjectId(t);if(!r)throw A.notInitialized();return r}async getGlobalPath(t){let r=await this.getProjectId(t);return await T.ensureProjectStructure(r),T.getGlobalProjectPath(r)}async ensureAuthor(){if(this.currentAuthor)return this.currentAuthor;let t=await N();return this.currentAuthor={name:t.name??void 0,email:t.email??void 0,github:t.github??void 0},this.currentAuthor}getCurrentAuthor(){return this.currentAuthor}clearAuthorCache(){this.currentAuthor=null}async isEmptyDirectory(t){try{return(await I(t)).filter(n=>!n.startsWith(".")&&n!=="node_modules"&&n!=="package.json"&&n!=="package-lock.json"&&n!=="README.md").length===0}catch(r){return y(r)||console.error(`Directory check error: ${$(r)}`),!0}}async hasExistingCode(t){try{let r=["src","lib","app","components","pages","api","main.go","main.rs","main.py"];return(await I(t)).some(n=>r.includes(n))}catch(r){return y(r)||console.error(`Code check error: ${$(r)}`),!1}}async isConfigured(t){return await f.isConfigured(t)}async needsMigration(t){return await f.needsMigration(t)}},F=new C,ct=F;export{M as a,F as b,ct as c};
@@ -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{e as m,g as O}from"./chunk-HDHVBB6Q.mjs";import{a as E,b as _,c as b,d as I,e as v,n as C}from"./chunk-SVZHJZ5T.mjs";import{a as f}from"./chunk-E66B27AL.mjs";b();O();C();import w from"node:fs/promises";import d from"node:path";function G(t){let r=new RegExp(_.source,"g");return[...t.matchAll(r)].map(e=>e[1]).filter(e=>e.startsWith(".")||e.startsWith("@/"))}f(G,"extractImportSources");async function y(t,r,e){let n=t.startsWith("@/")?d.join(e,"src",t.slice(2)):d.resolve(d.dirname(d.join(e,r)),t);for(let o of E){let s=n+o;try{if((await w.stat(s)).isFile())return d.relative(e,s)}catch{}}return null}f(y,"resolveImport");async function R(t){let r=await I(t),e={},n={},o=await v(r,50,async s=>{try{let i=await w.readFile(d.join(t,s),"utf-8"),c=G(i),a=[];for(let u of c){let p=await y(u,s,t);p&&p!==s&&a.push(p)}return a.length>0?{filePath:s,imports:a}:null}catch{return null}});for(let{filePath:s,imports:i}of o){e[s]=i;for(let c of i)n[c]||(n[c]=[]),n[c].push(s)}return{forward:e,reverse:n,fileCount:r.length,edgeCount:o.reduce((s,i)=>s+i.imports.length,0),builtAt:new Date().toISOString()}}f(R,"buildGraph");function B(t,r,e=2){let n=new Set(t),o=new Map,s=[];for(let i of t){let c=r.forward[i]||[],a=r.reverse[i]||[];for(let u of[...c,...a])n.has(u)||s.push({file:u,depth:1})}for(let{file:i,depth:c}of s){if(c>e)continue;let a=1/(c+1),u=o.get(i);if(u){a>u.score&&o.set(i,{score:a,depth:c});continue}if(o.set(i,{score:a,depth:c}),c<e){let p=r.forward[i]||[],A=r.reverse[i]||[];for(let h of[...p,...A])!n.has(h)&&!o.has(h)&&s.push({file:h,depth:c+1})}}return Array.from(o.entries()).map(([i,{score:c,depth:a}])=>({path:i,score:c,depth:a})).sort((i,c)=>c.score-i.score)}f(B,"scoreFromSeeds");var l="import-graph",g=new Map;function x(t){return Object.values(t).reduce((r,e)=>r+e.length,0)}f(x,"countEdges");function D(t,r){let e=t.forward[r]||[];delete t.forward[r];for(let n of e){let o=(t.reverse[n]||[]).filter(s=>s!==r);o.length===0?delete t.reverse[n]:t.reverse[n]=o}}f(D,"removeOutgoingEdges");function T(t,r){let e=t.reverse[r]||[];delete t.reverse[r];let n=[];for(let o of e){let s=(t.forward[o]||[]).filter(i=>i!==r);s.length===0?delete t.forward[o]:t.forward[o]=s,n.push(o)}return n}f(T,"removeIncomingEdges");function F(t,r,e){if(e.length===0)return;let n=Array.from(new Set(e));t.forward[r]=n;for(let o of n)t.reverse[o]||(t.reverse[o]=[]),t.reverse[o].includes(r)||t.reverse[o].push(r)}f(F,"addEdges");async function M(t,r){try{let e=await w.readFile(d.join(t,r),"utf-8"),n=G(e),o=[];for(let s of n){let i=await y(s,r,t);i&&i!==r&&o.push(i)}return{filePath:r,imports:o}}catch{return null}}f(M,"importsForFile");function S(t){return{schemaVersion:2,fileCount:t.fileCount,edgeCount:t.edgeCount,builtAt:t.builtAt}}f(S,"graphMetadata");function L(t,r){try{m.transaction(t,e=>{e.prepare("DELETE FROM import_graph_edges").run();let n=e.prepare("INSERT INTO import_graph_edges (from_path, to_path, sort_order) VALUES (?, ?, ?)");for(let[o,s]of Object.entries(r.forward))for(let[i,c]of s.entries())n.run(o,c,i)})}catch{}}f(L,"replacePerFileEdges");function N(t,r,e,n){try{m.transaction(t,o=>{let s=o.prepare("DELETE FROM import_graph_edges WHERE from_path = ?"),i=o.prepare("INSERT INTO import_graph_edges (from_path, to_path, sort_order) VALUES (?, ?, ?)");for(let c of new Set([...e,...n]))s.run(c);for(let c of e){let a=r.forward[c]||[];for(let[u,p]of a.entries())i.run(c,p,u)}})}catch{}}f(N,"updatePerFileEdges");function P(t,r,e){try{let n=m.query(t,"SELECT from_path, to_path FROM import_graph_edges ORDER BY from_path, sort_order, to_path");if(n.length===0){if(e?.edgeCount===0){let a={forward:{},reverse:{},fileCount:e.fileCount,edgeCount:0,builtAt:e.builtAt};return g.set(t,{graph:a,updatedAt:r}),a}return null}let o={},s={};for(let a of n)o[a.from_path]||(o[a.from_path]=[]),o[a.from_path].push(a.to_path),s[a.to_path]||(s[a.to_path]=[]),s[a.to_path].push(a.from_path);let i=new Set;for(let[a,u]of Object.entries(o)){i.add(a);for(let p of u)i.add(p)}let c={forward:o,reverse:s,fileCount:e?.fileCount??i.size,edgeCount:n.length,builtAt:e?.builtAt??r};return g.set(t,{graph:c,updatedAt:r}),c}catch{return null}}f(P,"loadGraphFromPerFileEdges");function V(t,r){m.setDoc(t,l,S(r)),L(t,r),g.delete(t)}f(V,"saveGraph");function W(t,r,e,n){m.setDoc(t,l,S(r)),N(t,r,e,n),g.delete(t)}f(W,"saveGraphUpdate");function k(t){let r=m.get(t,"SELECT updated_at FROM kv_store WHERE key = ?",l);if(!r)return g.delete(t),null;let e=g.get(t);if(e&&e.updatedAt===r.updated_at)return e.graph;let n=m.getDoc(t,l),o=P(t,r.updated_at,n);if(o)return o;if(!n?.forward||!n?.reverse)return null;let s={forward:n.forward,reverse:n.reverse,fileCount:n.fileCount,edgeCount:n.edgeCount,builtAt:n.builtAt};return g.set(t,{graph:s,updatedAt:r.updated_at}),s}f(k,"loadGraph");async function q(t,r){let e=await R(t);return V(r,e),e}f(q,"indexImports");async function K(t,r,e,n=[]){let o=k(r);if(!o)return q(t,r);let s=new Set([...e,...n]);for(let a of s)D(o,a);let i=new Set;for(let a of n)for(let u of T(o,a))i.add(u);let c=await v(e,50,a=>M(t,a));for(let a of c)F(o,a.filePath,a.imports);return o.edgeCount=x(o.forward),o.builtAt=new Date().toISOString(),W(r,o,[...e,...i],n),o}f(K,"updateImportGraph");export{B as a,k as b,q as c,K as d};
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{m as j,q as L,r as M}from"./chunk-AKIN5WSQ.mjs";import{a as E,b as a,c as S}from"./chunk-JQE2F2RK.mjs";import{j as C,n as I}from"./chunk-SVZHJZ5T.mjs";import{c as x}from"./chunk-GSMDQ7VM.mjs";import{a as O}from"./chunk-SYHDEUVU.mjs";import{d as N,e as G}from"./chunk-HE5RSIHG.mjs";import{a as R,e as l,f as k}from"./chunk-BUDZL4DW.mjs";import{a as c,e as b}from"./chunk-E66B27AL.mjs";k();I();M();import i from"node:fs/promises";import n from"node:path";import u from"node:fs/promises";import A from"node:path";k();var y='<!-- prjct:start - DO NOT REMOVE THIS MARKER -->\n# p/ \u2014 Project knowledge layer\n\nprjct stores project memory (decisions, learnings, gotchas, patterns, ships, analyses) per project in SQLite and serves it to you through tools. **Query it \u2014 don\'t re-read source from scratch.**\n\nprjct remembers and shows the path; it does not own execution. Treat prjct output as durable signals (task state, memories, specs, workflows, risks, recent learnings). Claude, GPT, and other agents decide the concrete HOW with their own native tools and judgment, then persist meaningful outcomes back to prjct.\n\nYou are in a prjct project when `.prjct/` is in cwd OR `~/.prjct-cli/projects/` has an entry for the current path.\n\n## Lookup FIRST, source LAST\n\nBefore reading source code or running broad searches for ANY question about the project (architecture, conventions, decisions, recent ships, bugs, patterns, tech debt, past analyses), QUERY prjct first \u2014 bounded, ranked answers from SQLite, no markdown trees to wade through:\n\n- `prjct context memory <topic>` / `prjct search "<q>"` \u2014 captured decisions, gotchas, learnings, facts\n- `prjct context --md` \u2014 current state: active cycle, ships, recent learnings\n- architecture / conventions / patterns / anti-patterns / tech-debt / insights \u2192 MCP `prjct_analysis` (add `mode:archive` for history)\n- developer preferences \u2192 MCP `prjct_developer`; machine signals \u2192 MCP `prjct_signals`\n- specs \u2192 MCP `prjct_spec_list` / `prjct_spec_get`; per-file traps before editing \u2192 `prjct guard <file>`\n\nOnly fall through to source/repo reading when prjct does not contain the answer.\n\n**Skill \u2260 project identity.** The prjct skill is a portable multi-LLM contract (L0). Live name/stack/branch come from SessionStart + `prjct context --md` for **this cwd**. If skill text and the tree disagree, trust the cwd and the tree.\n\n## Capture analyses BACK to prjct\n\nWhen you complete substantive work \u2014 analysis, decision, learning, gotcha \u2014 persist it: `prjct remember <decision|learning|gotcha|fact> "..."` or `prjct capture "<text>" --tags k:v`. **Author every entry in ENGLISH**, whatever language the user speaks. **Default to capturing \u2014 under-capture is the failure mode that makes prjct useless.** The full verb map and task workflow live in the `prjct` skill.\n\n## Where things live\n\n- Source of truth: SQLite at `~/.prjct-cli/projects/<id>/` (don\'t read directly \u2014 use `prjct` CLI / MCP tools)\n- Project config: `.prjct/prjct.config.json` in repo root\n\n**Auto-managed by prjct-cli** | https://prjct.app\n<!-- prjct:end - DO NOT REMOVE THIS MARKER -->\n';async function P(){let m=(M(),b(L)),t=await m.getActiveProvider(),e=t.name;if(!(await m.detectProvider(e)).installed&&!t.configDir)return{success:!1,error:`${t.displayName} not detected`,action:"skipped"};try{await u.mkdir(t.configDir,{recursive:!0});let s=A.join(t.configDir,t.contextFile),p=await(async()=>{if(e==="claude")return y;let o=x(`global/${t.contextFile}`);if(o)return o;let{PACKAGE_ROOT:g}=(G(),b(N)),T=A.join(g,"templates","global",t.contextFile);return u.readFile(T,"utf-8").catch(()=>e==="gemini"?y.replace(/Claude/g,"Gemini"):y)})(),r=await u.readFile(s,"utf-8").then(o=>({content:o,exists:!0})).catch(o=>{if(R(o))return{content:"",exists:!1};throw o}),h="<!-- prjct-project:start - DO NOT REMOVE THIS MARKER -->",f="<!-- prjct-project:end - DO NOT REMOVE THIS MARKER -->",D=(()=>{if(!r.content.includes(h)||!r.content.includes(f))return r.content;let o=r.content.substring(0,r.content.indexOf(h)),g=r.content.substring(r.content.indexOf(f)+f.length);return`${(o+g).replace(/\n{3,}/g,`
9
+
10
+ `).trim()}
11
+ `})(),w=O(r.exists?D:"",p,"<!-- prjct:start - DO NOT REMOVE THIS MARKER -->","<!-- prjct:end - DO NOT REMOVE THIS MARKER -->");return await u.writeFile(s,w.content,"utf-8"),{success:!0,action:w.action,path:s}}catch(s){return{success:!1,error:l(s),action:"failed"}}}c(P,"installGlobalConfig");S();async function et(){return P()}c(et,"installGlobalConfig");var v=class{static{c(this,"CommandInstaller")}commandsPath="";configPath="";_initialized=!1;async ensureInit(){if(this._initialized)return;let t=await j();this.configPath=t.configDir??"",this.commandsPath=this.configPath?n.join(this.configPath,"commands"):"",this._initialized=!0}async detectActiveProvider(){return await this.ensureInit(),C(this.configPath)}async installCommands(){let t=await this.detectActiveProvider(),e=await j();return t?(await this.cleanupRouter(),{success:!0,installed:[],path:this.commandsPath}):{success:!1,error:`${e.displayName} not detected. Please install it first.`}}async uninstallCommands(){try{let t=[];await this.ensureInit();for(let e of["p.md","p.toml"]){let d=n.join(this.commandsPath,e);try{await i.unlink(d),t.push(e)}catch(s){if(s.code!=="ENOENT")return{success:!1,error:l(s)}}}return{success:!0,uninstalled:t}}catch(t){return{success:!1,error:l(t)}}}async checkInstallation(){return await this.detectActiveProvider()?{installed:!0,providerDetected:!0,commands:[],path:this.commandsPath}:{installed:!1,providerDetected:!1}}async getInstallPath(){return await this.ensureInit(),this.commandsPath}async syncCommands(){if(!await this.detectActiveProvider())return{success:!1,error:"AI agent not detected",added:0,updated:0,removed:0};try{return{success:!0,added:0,updated:0,removed:await this.cleanupRouter()?1:0}}catch(e){return{success:!1,error:l(e),added:0,updated:0,removed:0}}}async cleanupRouter(){return await this.ensureInit(),(await Promise.all(["p.md","p.toml"].map(async e=>{try{return await i.unlink(n.join(this.commandsPath,e)),!0}catch{return!1}}))).some(Boolean)}async cleanupLegacyCommands(){await this.ensureInit();let t=n.join(this.commandsPath,"p");try{if((await i.stat(t).catch(()=>null))?.isDirectory())return await i.rm(t,{recursive:!0,force:!0}),!0}catch{}return!1}async installGlobalConfig(){return P()}async cleanupAllLegacy(){let t=E(),e=[],d=[n.join(t,".claude","commands","p.md"),n.join(t,".claude","commands","p.toml"),n.join(t,".gemini","commands","p.md"),n.join(t,".gemini","commands","p.toml")];for(let r of d)try{await i.unlink(r),e.push(r)}catch{}let s=[n.join(t,".claude","commands","p"),n.join(t,".gemini","commands","p")];for(let r of s)try{(await i.stat(r).catch(()=>null))?.isDirectory()&&(await i.rm(r,{recursive:!0,force:!0}),e.push(r))}catch{}let p=[n.join(t,".prjct-cli","config","homebrew-migrated")];for(let r of p)try{await i.unlink(r),e.push(r)}catch{}return{cleaned:e}}};function rt(){return{claude:{commands:a(".claude","commands"),config:a(".claude"),router:a(".claude","commands","p.md")},gemini:{commands:a(".gemini","commands"),config:a(".gemini"),router:a(".gemini","commands","p.toml")}}}c(rt,"getProviderPaths");var _=new v,nt=_;export{et as a,v as b,rt as c,nt as d};
@@ -0,0 +1,103 @@
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{j as _,k as z,s as M,t as J}from"./chunk-AKIN5WSQ.mjs";import{f as y,g as m,l as C,n as F}from"./chunk-SVZHJZ5T.mjs";import{b as o,o as $}from"./chunk-CTWZQ7YI.mjs";import{a as e}from"./chunk-E66B27AL.mjs";J();F();import ot from"node:crypto";import b from"node:fs/promises";import R from"node:os";import H from"node:path";$();z();import{spawn as Y}from"node:child_process";var P="prjct-cli-auth",c="prjct-cloud",A="app.prjct.cli.auth",E="prjct-cli-auth",u={cached:void 0,testStore:null};function d(){return process.platform==="darwin"}e(d,"isDarwin");function h(){return process.platform==="linux"}e(h,"isLinux");function p(){return process.platform==="win32"}e(p,"isWindows");function B(r,t,a){return new Promise((n,i)=>{let s=Y(r,t,{stdio:["pipe","pipe","pipe"]}),f=[],U=[];s.stdout.setEncoding("utf8"),s.stderr.setEncoding("utf8"),s.stdout.on("data",l=>{f.push(String(l))}),s.stderr.on("data",l=>{U.push(String(l))}),s.on("error",i),s.on("close",l=>{if(l===0){n(f.join(""));return}i(new Error(U.join("").trim()||`${r} exited with code ${l}`))}),s.stdin.end(a)})}e(B,"runWithStdin");async function K(){try{let{stdout:r}=await o("security",["find-generic-password","-a",c,"-s",P,"-w"]);return r.trim()||null}catch{return null}}e(K,"readMacosKeychain");async function q(r){await o("security",["add-generic-password","-U","-a",c,"-s",P,"-w",r])}e(q,"writeMacosKeychain");async function V(){try{await o("security",["delete-generic-password","-a",c,"-s",P])}catch{}}e(V,"clearMacosKeychain");async function W(){try{let{stdout:r}=await o("secret-tool",["lookup","service",A,"account",c]);return r.trim()||null}catch{return null}}e(W,"readLinuxSecretService");async function X(r){await B("secret-tool",["store","--label","prjct Cloud token","service",A,"account",c],r)}e(X,"writeLinuxSecretService");async function Z(){try{await o("secret-tool",["clear","service",A,"account",c])}catch{}}e(Z,"clearLinuxSecretService");var w=`
9
+ using System;
10
+ using System.Runtime.InteropServices;
11
+ using System.Text;
12
+
13
+ public static class PrjctCredentialManager {
14
+ private const uint CRED_TYPE_GENERIC = 1;
15
+ private const uint CRED_PERSIST_LOCAL_MACHINE = 2;
16
+
17
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
18
+ private struct CREDENTIAL {
19
+ public uint Flags;
20
+ public uint Type;
21
+ public string TargetName;
22
+ public string Comment;
23
+ public System.Runtime.InteropServices.ComTypes.FILETIME LastWritten;
24
+ public uint CredentialBlobSize;
25
+ public IntPtr CredentialBlob;
26
+ public uint Persist;
27
+ public uint AttributeCount;
28
+ public IntPtr Attributes;
29
+ public string TargetAlias;
30
+ public string UserName;
31
+ }
32
+
33
+ [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
34
+ private static extern bool CredRead(string target, uint type, uint reservedFlag, out IntPtr credentialPtr);
35
+
36
+ [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
37
+ private static extern bool CredWrite(ref CREDENTIAL userCredential, uint flags);
38
+
39
+ [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
40
+ private static extern bool CredDelete(string target, uint type, uint flags);
41
+
42
+ [DllImport("advapi32.dll", SetLastError = true)]
43
+ private static extern void CredFree(IntPtr buffer);
44
+
45
+ public static string Read(string target) {
46
+ IntPtr credentialPtr;
47
+ if (!CredRead(target, CRED_TYPE_GENERIC, 0, out credentialPtr)) {
48
+ return "";
49
+ }
50
+
51
+ try {
52
+ CREDENTIAL credential = (CREDENTIAL)Marshal.PtrToStructure(credentialPtr, typeof(CREDENTIAL));
53
+ if (credential.CredentialBlobSize == 0 || credential.CredentialBlob == IntPtr.Zero) {
54
+ return "";
55
+ }
56
+
57
+ byte[] secretBytes = new byte[credential.CredentialBlobSize];
58
+ Marshal.Copy(credential.CredentialBlob, secretBytes, 0, secretBytes.Length);
59
+ return Encoding.Unicode.GetString(secretBytes);
60
+ } finally {
61
+ CredFree(credentialPtr);
62
+ }
63
+ }
64
+
65
+ public static void Write(string target, string account, string secret) {
66
+ byte[] secretBytes = Encoding.Unicode.GetBytes(secret);
67
+ if (secretBytes.Length > 5120) {
68
+ throw new InvalidOperationException("Credential is too large for Windows Credential Manager.");
69
+ }
70
+
71
+ IntPtr secretPtr = Marshal.AllocHGlobal(secretBytes.Length);
72
+ try {
73
+ Marshal.Copy(secretBytes, 0, secretPtr, secretBytes.Length);
74
+ CREDENTIAL credential = new CREDENTIAL();
75
+ credential.Type = CRED_TYPE_GENERIC;
76
+ credential.TargetName = target;
77
+ credential.UserName = account;
78
+ credential.CredentialBlob = secretPtr;
79
+ credential.CredentialBlobSize = (uint)secretBytes.Length;
80
+ credential.Persist = CRED_PERSIST_LOCAL_MACHINE;
81
+
82
+ if (!CredWrite(ref credential, 0)) {
83
+ throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error());
84
+ }
85
+ } finally {
86
+ byte[] zeros = new byte[secretBytes.Length];
87
+ Marshal.Copy(zeros, 0, secretPtr, zeros.Length);
88
+ Marshal.FreeHGlobal(secretPtr);
89
+ }
90
+ }
91
+
92
+ public static void Delete(string target) {
93
+ CredDelete(target, CRED_TYPE_GENERIC, 0);
94
+ }
95
+ }
96
+ `;function S(r){return["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",r]}e(S,"powershellArgs");function v(r){return`${w}
97
+ Add-Type -TypeDefinition $code -Language CSharp
98
+ ${r}`.replace(w,`$code = @'
99
+ ${w}
100
+ '@`)}e(v,"windowsCommand");async function j(){try{let{stdout:r}=await o("powershell.exe",S(v(`[PrjctCredentialManager]::Read('${E}')`)));return r.trim()||null}catch{return null}}e(j,"readWindowsCredentialManager");async function Q(r){let t=v(`
101
+ $secret = [Console]::In.ReadToEnd()
102
+ [PrjctCredentialManager]::Write('${E}', '${c}', $secret)
103
+ `);await B("powershell.exe",S(t),r)}e(Q,"writeWindowsCredentialManager");async function tt(){try{await o("powershell.exe",S(v(`[PrjctCredentialManager]::Delete('${E}')`)))}catch{}}e(tt,"clearWindowsCredentialManager");async function et(){return d()?K():p()?j():h()?W():null}e(et,"platformGet");async function rt(){if(d())try{return await o("security",["help"]),!0}catch{return!1}if(p())try{return await o("powershell.exe",["-NoProfile","-NonInteractive","-Command","exit 0"]),!0}catch{return!1}return h()?_("secret-tool"):!1}e(rt,"hasSecureCredentialStore");async function it(r){let t=r.trim();if(!t)throw new Error("Refusing to store an empty Cloud API token.");if(d())return await q(t),"keychain";if(p())return await Q(t),"credential-manager";if(h()){if(!await rt())throw new Error("No secure credential store available (install libsecret / secret-tool). Refusing to store the Cloud API token in plaintext on Linux/WSL.");return await X(t),"secret-service"}throw new Error("No secure credential store is available for this platform. Refusing to store the Cloud API token in plaintext.")}e(it,"platformSet");async function nt(){d()&&await V(),p()&&await tt(),h()&&await Z()}e(nt,"platformClear");async function at(){return d()&&await K()?"keychain":p()&&await j()?"credential-manager":h()&&await W()?"secret-service":"none"}e(at,"platformLocation");function I(){return u.testStore??{get:et,set:it,clear:nt,location:at}}e(I,"activeStore");async function g(){return u.cached=await I().get(),u.cached}e(g,"getAuthToken");async function T(r){let t=r.trim();if(!t)throw new Error("Refusing to store an empty Cloud API token.");let a=await I().set(t);return u.cached=t,a}e(T,"setAuthToken");async function L(){u.cached=null,await I().clear()}e(L,"clearAuthToken");var k="https://api.prjct.app",Pt="https://prjct.app",G=new Set(["https://cli-api.prjct.app"]),O={apiKey:null,apiUrl:k,userId:null,email:null,lastAuth:null};function x(){return ot.randomUUID()}e(x,"freshDeviceId");function D(r){return{...r,apiKey:null}}e(D,"metadataOnly");var N=class{static{e(this,"AuthConfigManager")}configPath;cachedConfig=null;constructor(){this.configPath=M.getAuthConfigPath()}getConfigPath(){return this.configPath}async read(){if(this.cachedConfig)return this.cachedConfig={...this.cachedConfig,apiKey:await g()},this.cachedConfig;let t=await y(this.configPath),a=await g(),n=a?void 0:t?.apiKey;n&&await T(n);let i=t??O,s={...i,apiKey:a??n??null,deviceId:i.deviceId||x(),hostname:i.hostname||R.hostname(),apiUrl:i.apiUrl&&G.has(i.apiUrl)?k:i.apiUrl},f=!!(n||!i.deviceId||!i.hostname||i.apiUrl&&G.has(i.apiUrl));if(this.cachedConfig=s,f&&t)try{await m(this.configPath,D(this.cachedConfig)),await b.chmod(this.configPath,384)}catch{}return this.cachedConfig}async getDeviceId(){return(await this.read()).deviceId??x()}async getHostname(){return(await this.read()).hostname??R.hostname()}async write(t){let a=await this.read();Object.hasOwn(t,"apiKey")&&(t.apiKey?await T(t.apiKey):await L());let n={...a,...t,apiKey:await g(),lastAuth:new Date().toISOString()};await C(H.dirname(this.configPath)),await m(this.configPath,D(n)),await b.chmod(this.configPath,384),this.cachedConfig=n}async hasAuth(){let t=await this.getApiKey();return t!==null&&t.length>0}async getApiKey(){return(await this.read()).apiKey||await g()}async getApiUrl(){return(await this.read()).apiUrl||k}async saveAuth(t,a,n){await this.write({apiKey:t,userId:a,email:n})}async clearAuth(){await L();let t=this.cachedConfig??await y(this.configPath);this.cachedConfig={...O,deviceId:t?.deviceId??x(),hostname:t?.hostname??R.hostname()},await C(H.dirname(this.configPath)),await m(this.configPath,D(this.cachedConfig)),await b.chmod(this.configPath,384)}async getStatus(){let t=await this.read();return{authenticated:t.apiKey!==null,email:t.email,apiKeyPrefix:null,lastAuth:t.lastAuth}}clearCache(){this.cachedConfig=null}},st=new N,At=st;export{k as a,Pt as b,At as c};
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a as f}from"./chunk-DYHYDHCW.mjs";import{d as x,f as D,j as g,n as S}from"./chunk-SVZHJZ5T.mjs";import{a as l,o as P}from"./chunk-CTWZQ7YI.mjs";import{d as k}from"./chunk-PKDYFXMI.mjs";import{a}from"./chunk-E66B27AL.mjs";import y from"node:path";P();S();S();import j from"node:fs/promises";import F from"node:path";var d=class{static{a(this,"StackDetector")}projectPath;constructor(t){this.projectPath=t}async detect(){let t={hasFrontend:!1,hasBackend:!1,hasDatabase:!1,hasDocker:!1,hasTesting:!1,frontendType:null,frameworks:[]},e=await this.readPackageJson();if(e){let s={...e.dependencies,...e.devDependencies};this.detectFrontend(s,t),this.detectBackend(s,t),this.detectDatabase(s,t),this.detectTesting(s,e,t),this.collectFrameworks(s,t)}return t.hasDocker=await this.detectDocker(),t}detectFrontend(t,e){(t.react||t.vue||t.svelte||t["@angular/core"])&&(e.hasFrontend=!0,e.frontendType="web"),(t["react-native"]||t.expo)&&(e.hasFrontend=!0,e.frontendType=e.frontendType==="web"?"both":"mobile")}detectBackend(t,e){["express","fastify","hono","koa","@nestjs/core","nest","@hapi/hapi","restify","polka"].some(o=>t[o])&&(e.hasBackend=!0)}detectDatabase(t,e){["prisma","@prisma/client","mongoose","pg","mysql2","sequelize","typeorm","drizzle-orm","knex","better-sqlite3","mongodb","redis","ioredis"].some(o=>t[o])&&(e.hasDatabase=!0)}detectTesting(t,e,s){["jest","vitest","mocha","@testing-library/react","@testing-library/vue","cypress","playwright","@playwright/test","ava","tap","bun-types"].some(c=>t[c]||e.devDependencies?.[c])&&(s.hasTesting=!0)}async detectDocker(){let t=["Dockerfile","docker-compose.yml","docker-compose.yaml",".dockerignore"];for(let e of t)if(await this.fileExistsInProject(e))return!0;return!1}collectFrameworks(t,e){t.react&&e.frameworks.push("React"),t.next&&e.frameworks.push("Next.js"),t.vue&&e.frameworks.push("Vue"),t.nuxt&&e.frameworks.push("Nuxt"),t.svelte&&e.frameworks.push("Svelte"),t["@angular/core"]&&e.frameworks.push("Angular"),t["react-native"]&&e.frameworks.push("React Native"),t.expo&&e.frameworks.push("Expo"),t.express&&e.frameworks.push("Express"),t.fastify&&e.frameworks.push("Fastify"),t.hono&&e.frameworks.push("Hono"),t.koa&&e.frameworks.push("Koa"),(t["@nestjs/core"]||t.nest)&&e.frameworks.push("NestJS"),t.astro&&e.frameworks.push("Astro"),t.remix&&e.frameworks.push("Remix"),t.gatsby&&e.frameworks.push("Gatsby")}async readPackageJson(){try{let t=F.join(this.projectPath,"package.json"),e=await j.readFile(t,"utf-8");return JSON.parse(e)}catch{return null}}async fileExistsInProject(t){return g(F.join(this.projectPath,t))}};async function I(r){let t={branch:"main",commits:0,contributors:0,hasChanges:!1,stagedFiles:[],modifiedFiles:[],untrackedFiles:[],recentCommits:[],weeklyCommits:0},e={cwd:r},s=a(i=>i.catch(()=>null),"safe"),[o,c,w,h,b,v]=await Promise.all([s(l("git branch --show-current",e)),s(l("git rev-list --count HEAD",e)),s(l("git shortlog -sn --all",e)),s(l("git status --porcelain",e)),s(l('git log --oneline -20 --pretty=format:"%h|%s|%ad" --date=short',e)),s(l('git log --oneline --since="1 week ago"',e))]);if(o&&(t.branch=o.stdout.trim()||"main"),c&&(t.commits=parseInt(c.stdout.trim(),10)||0),w&&(t.contributors=w.stdout.split(`
9
+ `).filter(i=>i.trim()).length),h){let i=h.stdout.trim().split(`
10
+ `).filter(Boolean);t.hasChanges=i.length>0;for(let p of i){let m=p.substring(0,2),u=p.substring(3);m.startsWith("A")||m.startsWith("M ")?t.stagedFiles.push(u):m.includes("M")?t.modifiedFiles.push(u):m.startsWith("??")&&t.untrackedFiles.push(u)}}return b&&(t.recentCommits=b.stdout.split(`
11
+ `).filter(Boolean).map(i=>{let[p,m,u]=i.split("|");return{hash:p,message:m,date:u}})),v&&(t.weeklyCommits=v.stdout.split(`
12
+ `).filter(i=>i.trim()).length),!o&&!c&&!h&&f.debug("Git analysis failed (not a git repo?)"),t}a(I,"analyzeGit");async function n(r,t){let e=await g(y.join(r,t));return e||f.debug("File not found",{filename:t}),e}a(n,"fileExistsInProject");async function W(r){let t={fileCount:0,version:"0.0.0",name:y.basename(r),ecosystem:"unknown",projectType:"simple",languages:[],frameworks:[]};try{let e=[".js",".ts",".tsx",".py",".go",".rs"],s=await x(r,{skipDotfiles:!0});t.fileCount=s.filter(o=>e.some(c=>o.endsWith(c))).length}catch(e){f.debug("File count failed",{path:r,error:k(e)}),t.fileCount=0}try{let e=y.join(r,"package.json"),s=await D(e);if(!s)throw new Error("No package.json found");t.version=s.version||"0.0.0",t.name=s.name||t.name,t.ecosystem="JavaScript",s.devDependencies?.typescript||await n(r,"tsconfig.json")?t.languages.push("TypeScript"):t.languages.push("JavaScript")}catch(e){f.debug("No package.json found",{path:r,error:k(e)})}return await n(r,"Cargo.toml")?(t.ecosystem="Rust",t.languages.push("Rust")):await n(r,"go.mod")?(t.ecosystem="Go",t.languages.push("Go")):(await n(r,"requirements.txt")||await n(r,"pyproject.toml"))&&(t.ecosystem="Python",t.languages.push("Python")),t.fileCount>300||t.frameworks.length>=3?t.projectType="enterprise":(t.fileCount>50||t.frameworks.length>=2)&&(t.projectType="complex"),t}a(W,"gatherStats");async function L(r){let t={install:"npm install",run:"npm run",test:"npm test",build:"npm run build",dev:"npm run dev",lint:"npm run lint",format:"npm run format"};return await n(r,"bun.lockb")||await n(r,"bun.lock")?(t.install="bun install",t.run="bun run",t.test="bun test",t.build="bun run build",t.dev="bun run dev",t.lint="bun run lint",t.format="bun run format"):await n(r,"pnpm-lock.yaml")?(t.install="pnpm install",t.run="pnpm run",t.test="pnpm test",t.build="pnpm run build",t.dev="pnpm run dev",t.lint="pnpm run lint",t.format="pnpm run format"):await n(r,"yarn.lock")&&(t.install="yarn",t.run="yarn",t.test="yarn test",t.build="yarn build",t.dev="yarn dev",t.lint="yarn lint",t.format="yarn format"),await n(r,"Cargo.toml")&&(t.install="cargo build",t.run="cargo run",t.test="cargo test",t.build="cargo build --release",t.dev="cargo run",t.lint="cargo clippy",t.format="cargo fmt"),await n(r,"go.mod")&&(t.install="go mod download",t.run="go run .",t.test="go test ./...",t.build="go build",t.dev="go run .",t.lint="golangci-lint run",t.format="go fmt ./..."),t}a(L,"detectCommands");async function M(r){return new d(r).detect()}a(M,"detectStack");export{I as a,W as b,L as c,M as d};
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{b as l,c as i,d as k}from"./chunk-CREPUNOS.mjs";import{b as d}from"./chunk-BISPGBNN.mjs";import{a as o}from"./chunk-E66B27AL.mjs";function u(t,n){let r=t===i?i:t.slice(0,6);return{shortId:r,label:`${r} \xB7 ${n??"(detached)"}`}}o(u,"labelFor");async function b(t,n){let r=await k(n),a=[],p=await d.getTaskSnapshot(t),s=p.currentTask;if(s){let{shortId:e,label:c}=u(i,s.branch);a.push({id:s.id,description:s.description,workspaceId:i,shortId:e,label:c,branch:s.branch,linearId:s.linearId,harness:s.harness,startedAt:s.startedAt,isCurrent:r.workspaceId===i,pipeline:l(t,s.id,i)??void 0})}for(let e of p.activeTasks){if(e.workspaceId===i)continue;let{shortId:c,label:h}=u(e.workspaceId,e.branch);a.push({id:e.id,description:e.description,workspaceId:e.workspaceId,shortId:c,label:h,branch:e.branch,linearId:e.linearId,harness:e.harness,startedAt:e.startedAt,isCurrent:r.workspaceId===e.workspaceId,pipeline:l(t,e.id,e.workspaceId)??void 0})}return a.sort((e,c)=>Number(c.isCurrent)-Number(e.isCurrent)),{current:a.find(e=>e.isCurrent)??null,all:a,mainTaskRaw:s}}o(b,"collectActiveTasks");function T(t){let n=t.isCurrent?"\u2192":" ",r=t.isCurrent?" (this worktree)":"";return`${n} ${t.label} ${t.description}${r}`}o(T,"formatActiveTaskLine");function m(t){if(t.all.length===0)return"No active work cycle.";if(t.all.length===1&&t.current){let r=t.current,a=r.pipeline?`
9
+ Pipeline: ${r.pipeline.station}`:"";return`Active: ${r.description}
10
+ Workspace: ${r.label}${a}`}let n=[`Active work cycles (${t.all.length})`];for(let r of t.all)n.push(T(r));return n.join(`
11
+ `)}o(m,"formatActiveTaskList");export{b as a,T as b,m as c};
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{e as c,g as S}from"./chunk-HDHVBB6Q.mjs";import{a as m}from"./chunk-E66B27AL.mjs";S();var E=45,O=1,T=.4,R=2.5,h=-2.5,x=-.5,I=-1.3,p=864e5,N=["resolves","relates","supersedes","superseded-by","duplicates","spec"],C=["corrects","contradicts"],d=/\bmem[_-](\d+)\b/g;function w(n,r){let e=new Set;for(let t of N){let s=r[t];if(s)for(let o of String(s).matchAll(d))e.add(`mem_${o[1]}`)}for(let t of n.matchAll(d))e.add(`mem_${t[1]}`);for(let t of l(r))e.delete(t);return[...e]}m(w,"extractRefIds");function l(n){let r=new Set;for(let e of C){let t=n[e];if(t)for(let s of String(t).matchAll(d))r.add(`mem_${s[1]}`)}return[...r]}m(l,"extractCorrectionIds");function g(n,r,e,t,s){c.run(n,`INSERT INTO memory_usefulness (memory_id, score, ${t}, last_used_at)
9
+ VALUES (?, ?, 1, ?)
10
+ ON CONFLICT(memory_id) DO UPDATE SET
11
+ score = score + ?, ${t} = ${t} + 1, last_used_at = excluded.last_used_at`,r,e,s,e)}m(g,"bump");function f(n,r,e,t){c.run(n,`INSERT INTO memory_usefulness (memory_id, score, last_used_at)
12
+ VALUES (?, ?, ?)
13
+ ON CONFLICT(memory_id) DO UPDATE SET
14
+ score = score + ?, last_used_at = excluded.last_used_at`,r,e,t,e)}m(f,"addScore");var L={recordReferences(n,r,e,t=new Date().toISOString()){try{for(let s of w(r,e))g(n,s,O,"ref_count",t)}catch{}},recordCorrection(n,r,e=new Date().toISOString()){try{for(let t of l(r))f(n,t,h,e)}catch{}},recordFetch(n,r,e=new Date().toISOString()){try{g(n,r,T,"fetch_count",e)}catch{}},recordSurfaced(n,r,e,t=new Date().toISOString(),s={}){if(!(!e||r.length===0))try{let o=s.queryText?.trim()||null,u=s.surface?.trim()||null;for(let a of r)c.run(n,`INSERT INTO memory_surface_log (memory_id, task_id, created_at, query_text, surface)
15
+ VALUES (?, ?, ?, ?, ?)
16
+ ON CONFLICT(memory_id, task_id) DO UPDATE SET
17
+ query_text = COALESCE(memory_surface_log.query_text, excluded.query_text),
18
+ surface = COALESCE(memory_surface_log.surface, excluded.surface)`,a,e,t,o,u)}catch{}},penalizeSurfaced(n,r,e=new Date().toISOString()){if(!r)return 0;try{let t=c.query(n,"SELECT memory_id FROM memory_surface_log WHERE task_id = ?",r);for(let s of t)f(n,s.memory_id,x,e);return t.length}catch{return 0}},penalizeSkillMiss(n,r,e=new Date().toISOString()){try{f(n,r,I,e)}catch{}},creditShippedTask(n,r,e=new Date().toISOString()){if(!r)return 0;try{let t=c.query(n,"SELECT memory_id, query_text, surface FROM memory_surface_log WHERE task_id = ?",r);for(let s of t){f(n,s.memory_id,R,e);let o=s.query_text?.trim();o&&c.run(n,`INSERT OR IGNORE INTO retrieval_eval_labels
19
+ (query_text, positive_id, source, source_task_id, created_at, metadata)
20
+ VALUES (?, ?, ?, ?, ?, ?)`,o,s.memory_id,"ship-surfaced",r,e,JSON.stringify({surface:s.surface??"unknown"}))}return c.run(n,"DELETE FROM memory_surface_log WHERE task_id = ?",r),t.length}catch{return 0}},decayedScores(n,r=Date.now(),e){let t=new Map,s=(()=>{try{if(e&&e.length>0){let o=[...new Set(e)].slice(0,200),u=o.map(()=>"?").join(",");return c.query(n,`SELECT memory_id, score, last_used_at FROM memory_usefulness WHERE memory_id IN (${u})`,...o)}else return e&&e.length===0?[]:c.query(n,"SELECT memory_id, score, last_used_at FROM memory_usefulness")}catch{return null}})();if(!s)return t;for(let o of s){let u=Date.parse(o.last_used_at),a=Number.isNaN(u)?1:.5**(Math.max(0,r-u)/p/E);t.set(o.memory_id,o.score*a)}return t},rerank(n,r,e=Date.now()){if(r.length<2)return r;let t=(()=>{try{return this.decayedScores(n,e,r.map(i=>i.id))}catch{return null}})();if(!t||t.size===0)return r;let s=Math.max(1,...t.values()),o=4,u=r.length,a=r.map((i,_)=>{let y=(t.get(i.id)??0)/s;return{entry:i,i:_,rankScore:u-_+o*y}});return a.sort((i,_)=>_.rankScore-i.rankScore||i.i-_.i),a.map(i=>i.entry)}};export{w as a,l as b,L as c};
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a as h,b as c,c as _,d as j}from"./chunk-2UC4DTDO.mjs";import{b as M,c as F}from"./chunk-CE4RCNC7.mjs";import"./chunk-WUHGODSQ.mjs";import{a as o}from"./chunk-E66B27AL.mjs";F();import b from"node:crypto";import i from"node:fs";import{connect as A}from"node:net";import P from"node:path";import l from"node:fs";import O from"node:path";var V=1024*1024;function C(n){try{return process.kill(n,0),!0}catch{return!1}}o(C,"isProcessRunning");function I(n=c.runDir()){return O.join(n,"daemon.spawn.lock")}o(I,"spawnLockPath");function N(n=c.runDir(),e=process.pid){l.mkdirSync(n,{recursive:!0});let t=I(n);for(let s of[0,1])try{let r=l.openSync(t,"wx");try{l.writeFileSync(r,`${e}
9
+ `)}catch{try{l.closeSync(r)}catch{}try{l.unlinkSync(t)}catch{}return null}return{fd:r,path:t}}catch{let r=(()=>{try{return parseInt(l.readFileSync(t,"utf-8").trim(),10)}catch{return null}})();if(r&&!Number.isNaN(r)&&C(r))return null;try{l.unlinkSync(t)}catch{return null}}return null}o(N,"tryAcquireSpawnLock");function E(n){if(n){try{l.closeSync(n.fd)}catch{}try{if(l.existsSync(n.path)){let e=l.readFileSync(n.path,"utf-8").trim();(e===String(process.pid)||e===`${process.pid}`)&&l.unlinkSync(n.path)}}catch{}}}o(E,"releaseSpawnLock");function v(n){if(!n||typeof n!="object"||!("code"in n))return null;let e=n.code;return typeof e=="string"?e:null}o(v,"systemErrorCode");function L(n){let e=v(n);return e==="ENOENT"||e==="ECONNREFUSED"}o(L,"shouldUnlinkDaemonSocket");async function S(){let n=c.socket(),e=h(n);if(!e&&!i.existsSync(n))return!1;try{return(await k({id:b.randomUUID(),command:"__ping",args:[],options:{},cwd:process.cwd()},{timeoutMs:1e3})).success}catch(t){if(!e&&L(t))try{i.unlinkSync(n)}catch{}return!1}}o(S,"isDaemonRunning");async function sn(){let n=c.socket(),e=c.pid();if(!h(n)&&!i.existsSync(n))return{running:!1};try{let s=await k({id:b.randomUUID(),command:"daemon",args:["status"],options:{},cwd:process.cwd()});if(s.success&&s.result)return s.result}catch{}return i.existsSync(e)?{running:!1,pid:parseInt(i.readFileSync(e,"utf-8").trim(),10),socketPath:n}:{running:!1}}o(sn,"getDaemonStatus");function k(n,e={}){let t=e.timeoutMs??_(n.command);return new Promise((s,r)=>{let f=c.socket(),a=A(f),p=[],u=new AbortController,d=setTimeout(()=>{u.signal.aborted||(u.abort(),a.destroy(),r(new Error("Daemon request timed out")))},t);a.on("connect",()=>{a.write(j(n))}),a.on("data",y=>{p.push(y.toString());let m=p.join("");if(m.length>8*1024*1024){u.signal.aborted||(u.abort(),clearTimeout(d),a.destroy(),r(new Error("Daemon response too large")));return}let w=m.indexOf(`
10
+ `);if(w!==-1){let T=m.slice(0,w);p.splice(0,p.length,m.slice(w+1));try{let D=JSON.parse(T);u.abort(),clearTimeout(d),a.end(),s(D)}catch(D){u.abort(),clearTimeout(d),a.end(),r(new Error(`Invalid daemon response: ${D.message}`))}}}),a.on("error",y=>{u.signal.aborted||(u.abort(),clearTimeout(d),r(y))}),a.on("close",()=>{u.signal.aborted||(u.abort(),clearTimeout(d),r(new Error("Connection closed before response")))})})}o(k,"sendRequest");async function an(n,e,t,s,r,f=!0){let a=c.socket();if(!h(a)&&!i.existsSync(a))return f&&x().catch(()=>{}),null;try{return await k({id:b.randomUUID(),command:n,args:e,options:t,cwd:s,perfStartNs:r})}catch{return f&&x().catch(()=>{}),null}}o(an,"executeViaDaemon");async function U(){try{return(await k({id:b.randomUUID(),command:"daemon",args:["stop"],options:{},cwd:process.cwd()})).success}catch{return!1}}o(U,"stopDaemon");function H(){let n=c.pid(),e=c.socket(),t=(()=>{if(!i.existsSync(n))return{killed:!1,safeToCleanOwnership:!0};let s=parseInt(i.readFileSync(n,"utf-8").trim(),10);if(Number.isNaN(s))return{killed:!1,safeToCleanOwnership:!0};try{return process.kill(s,"SIGKILL"),{killed:!0,safeToCleanOwnership:!0}}catch(r){return{killed:!1,safeToCleanOwnership:v(r)==="ESRCH"}}})();if(!t.safeToCleanOwnership)return!1;try{i.existsSync(n)&&i.unlinkSync(n)}catch{}if(!h(e))try{i.existsSync(e)&&i.unlinkSync(e)}catch{}return t.killed}o(H,"forceKillDaemon");var g={inFlight:null};async function x(){return g.inFlight||(g.inFlight=$().finally(()=>{g.inFlight=null})),g.inFlight}o(x,"spawnDaemon");async function $(){if(await S())return!0;let n=N();if(!n)return await R(3e3);try{if(await S())return!0;let{spawn:e}=await import("node:child_process"),t=P.join(__dirname,"entry.ts"),s=P.join(__dirname,"..","daemon","entry.mjs"),r=P.join(__dirname,"..","dist","daemon","entry.mjs"),f=process.platform!=="win32"&&M(),a=i.existsSync(t)?{entryPath:t,runtime:"bun"}:i.existsSync(s)?{entryPath:s,runtime:f?"bun":"node"}:i.existsSync(r)?{entryPath:r,runtime:f?"bun":"node"}:null;if(!a)return!1;let{entryPath:p,runtime:u}=a,d=c.runDir();i.mkdirSync(d,{recursive:!0});let y=c.log(),m=i.openSync(y,"a");return e(u,[p],{detached:!0,stdio:["ignore",m,m],env:process.env}).unref(),i.closeSync(m),await R(3e3)}finally{E(n)}}o($,"spawnDaemonExclusive");async function R(n){let e=Date.now()+n,t=o(async s=>Date.now()>=e?S():await S()?!0:(await new Promise(r=>setTimeout(r,s)),t(Math.min(s*2,250))),"poll");return t(40)}o(R,"waitUntilDaemonRunning");async function cn(){try{return await S()?(await U()||H(),await new Promise(e=>setTimeout(e,300)),await x()):!1}catch{return!1}}o(cn,"restartDaemon");export{an as executeViaDaemon,H as forceKillDaemon,sn as getDaemonStatus,S as isDaemonRunning,cn as restartDaemon,k as sendRequest,L as shouldUnlinkDaemonSocket,x as spawnDaemon,U as stopDaemon};
@@ -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{e as k,f as x,g as N}from"./chunk-NJAMZSHM.mjs";import{e as S,g as w}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as s}from"./chunk-E66B27AL.mjs";w();var M={function:"Function",method:"Method",class:"Class",interface:"Interface",type:"Type",enum:"Enum",const:"Const",route:"Route",file:"File"},E={CALLS:5,IMPORTS:4,DEFINES:3,HANDLES:2,TESTS:1};function R(n){return M[n.toLowerCase()]??"Symbol"}s(R,"mapKind");function _(n){try{return S.query(n,"SELECT src, dst, edge_type, confidence FROM code_symbol_edges").map(o=>({src:o.src,dst:o.dst,edgeType:o.edge_type,confidence:o.confidence}))}catch{return[]}}s(_,"loadEdges");function G(n){return typeof n=="number"&&Number.isFinite(n)&&n>=0}s(G,"hasFiniteCap");function $(n,o={}){if(!k(n))return null;let a=N(n);if(a.length===0)return null;let u=_(n),l=x(n),r=new Map;for(let e of u){let t=E[e.edgeType]??1;r.set(e.src,(r.get(e.src)??0)+t),r.set(e.dst,(r.get(e.dst)??0)+t)}let T=s(e=>{switch(e){case"class":return 8;case"function":case"method":return 6;case"interface":case"type":return 4;case"route":return 5;default:return 2}},"kindWeight"),h=a.map(e=>{let t=r.get(e.id)??0,F=e.exported?4:0;return{s:e,score:t+F+T(e.kind)}}).sort((e,t)=>t.score-e.score||e.s.name.localeCompare(t.s.name)),d=G(o.maxNodes)?h.slice(0,o.maxNodes).map(e=>e.s):h.map(e=>e.s),p=new Set(d.map(e=>e.id)),f=new Map;for(let e of d)f.set(e.file,(f.get(e.file)??0)+1);let y=[...f.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e])=>e),g=s(e=>`file:${e}`,"fileNodeId"),m=[];for(let e of y){let t=e.split("/").pop()||e;m.push({id:g(e),name:t,kind:"File",file:e,exported:!1}),p.add(g(e))}for(let e of d)m.push({id:e.id,name:e.name,kind:R(e.kind),file:e.file,exported:e.exported});let C=[],I=new Set(y);for(let e of d)I.has(e.file)&&C.push({source:g(e.file),target:e.id,type:"DEFINES"});let L=u.filter(e=>p.has(e.src)&&p.has(e.dst)&&e.src!==e.dst).map(e=>({source:e.src,target:e.dst,type:e.edgeType,prio:E[e.edgeType]??0,conf:e.confidence})).sort((e,t)=>t.prio-e.prio||t.conf-e.conf),c=new Set,i=[],b=G(o.maxLinks)?o.maxLinks:Number.POSITIVE_INFINITY;for(let e of C){if(i.length>=b)break;let t=`${e.source}->${e.target}:${e.type}`;c.has(t)||(c.add(t),i.push({source:e.source,target:e.target,type:e.type}))}for(let e of L){if(i.length>=b)break;let t=`${e.source}->${e.target}:${e.type}`;c.has(t)||(c.add(t),i.push({source:e.source,target:e.target,type:e.type}))}return{version:1,builtAt:l?.builtAt??new Date().toISOString(),symbolCount:l?.symbolCount??a.length,edgeCount:l?.edgeCount??u.length,nodes:m,links:i}}s($,"buildCloudCodeGraphSnapshot");function K(n){return!!n&&n.nodes.length>0}s(K,"isUploadableGraph");export{$ as buildCloudCodeGraphSnapshot,K as isUploadableGraph};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a,b,c,d}from"./chunk-UDUUEZD3.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-DYHYDHCW.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GSMDQ7VM.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as CODEX_SKILL_MAX_BYTES,b as buildCodexSkillContent,c as installCodexSkill,d as verifyCodexPRouterReady};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a,b,c,d}from"./chunk-YORSHLFH.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GSMDQ7VM.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{b as CommandInstaller,d as default,c as getProviderPaths,a as installGlobalConfig};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{b as a}from"./chunk-HZXDF2TQ.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as default};
@@ -0,0 +1,10 @@
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{i as c,n as f,o as S}from"./chunk-CTWZQ7YI.mjs";import{a as n}from"./chunk-E66B27AL.mjs";S();import{createHash as C}from"node:crypto";import B from"node:fs/promises";import g from"node:path";var x="missing",T=1,u=200;function H(t){return C("sha256").update(t).digest("hex")}n(H,"sha256Hex");function v(t){return t===null?x:H(typeof t=="string"?Buffer.from(t,"utf8"):t)}n(v,"hashBlobContent");function w(t){let e=[...t].map(r=>({path:h(r.path),blobHash:r.blobHash})).filter(r=>r.path.length>0).sort((r,s)=>r.path<s.path?-1:r.path>s.path?1:0).map(r=>`${r.path}\0${r.blobHash}`);return H(e.join(`
9
+ `))}n(w,"buildTreeHash");function h(t){return t.replace(/\\/g,"/").replace(/^\.\//,"").trim()}n(h,"normalizeStampPath");function A(t,e){let r=e.maxPaths??u,s=t.map(o=>({path:h(o.path),blobHash:v(o.content)})).filter(o=>o.path.length>0),i=new Map;for(let o of s)i.set(o.path,o.blobHash);let a=[...i.entries()].map(([o,m])=>({path:o,blobHash:m})).sort((o,m)=>o.path<m.path?-1:o.path>m.path?1:0),p=w(a);return{version:T,treeHash:p,pathCount:a.length,paths:a.slice(0,r),stampedAt:e.stampedAt,headSha:e.headSha}}n(A,"stampFromContents");function _(t){if(t.override)return{blocked:!1,reason:"override",message:""};if(!t.stamp?.treeHash)return t.hard?{blocked:!0,reason:"no-stamp",message:"Content-bound stamp missing: re-run `prjct judgment approve` so ship binds to the reviewed tree. Override only with consent: `prjct ship --no-judgment-gate`."}:{blocked:!1,reason:"no-stamp",message:""};if(t.stamp.pathCount===0)return{blocked:!1,reason:"empty-scope",message:"Content-bound stamp empty (no scoped paths) \u2014 advisory only.",stampedTreeHash:t.stamp.treeHash};if(t.currentTreeHash===null)return{blocked:!1,reason:"unverified",message:`\u2696\uFE0F Content-bound stamp ${d(t.stamp.treeHash)} not re-verified (IO).`,stampedTreeHash:t.stamp.treeHash};if(t.currentTreeHash===t.stamp.treeHash)return{blocked:!1,reason:"match",message:`\u2696\uFE0F Content-bound match tree=${d(t.stamp.treeHash)} (${t.stamp.pathCount} paths)`,stampedTreeHash:t.stamp.treeHash,currentTreeHash:t.currentTreeHash};let e=`Content-bound drift: approved tree=${d(t.stamp.treeHash)} now=${d(t.currentTreeHash)} (${t.stamp.pathCount} paths). Re-run \`prjct judgment approve\` after re-review. Override only with consent: \`prjct ship --no-judgment-gate\`.`;return{blocked:t.hard,reason:"drift",message:t.hard?e:`\u2696\uFE0F ${e}`,stampedTreeHash:t.stamp.treeHash,currentTreeHash:t.currentTreeHash}}n(_,"contentBoundDriftVerdict");function d(t){return t.slice(0,12)}n(d,"shortHash");async function l(t,e){return f(t,e,{timeoutMs:5e3})}n(l,"safeGit");async function b(t,e){if(e&&e.length>0)return[...new Set(e.map(h).filter(a=>a.length>0&&!a.endsWith("/")))].slice(0,u);let r=await l(t,["diff","--name-only","HEAD"])??await l(t,["diff","--name-only","--cached"])??"",s=await l(t,["diff","--name-only","HEAD~1..HEAD"])??"",i=r.trim()||s.trim();return i?[...new Set(i.split(`
10
+ `).map(h).filter(a=>a.length>0))].slice(0,u):[]}n(b,"resolveStampPaths");async function N(t){try{return await B.readFile(t)}catch{return null}}n(N,"readFileOrNull");async function y(t,e,r){let s=[];for(let i of e){let a=h(i);if(!a||a.includes(".."))continue;let p=g.join(t,a);p.startsWith(g.resolve(t))&&s.push({path:a,content:await N(p)})}return A(s,r)}n(y,"stampProjectPaths");async function $(t,e,r){let s=await b(t,e),i=await l(t,["rev-parse","HEAD"])??void 0;return y(t,s,{stampedAt:r,headSha:i})}n($,"stampForApprove");async function k(t,e){try{let r=e.paths.length>0?e.paths.map(i=>i.path):await b(t,null);return(await y(t,r,{stampedAt:e.stampedAt,headSha:e.headSha})).treeHash}catch(r){if(r instanceof c)throw r;return null}}n(k,"currentTreeHashForStamp");export{x as BLOB_MISSING,u as CONTENT_BOUND_MAX_PATHS,T as CONTENT_BOUND_VERSION,w as buildTreeHash,_ as contentBoundDriftVerdict,k as currentTreeHashForStamp,v as hashBlobContent,h as normalizeStampPath,b as resolveStampPaths,d as shortHash,$ as stampForApprove,A as stampFromContents,y as stampProjectPaths};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a,b,c,d}from"./chunk-5TBQNW2G.mjs";import"./chunk-E66B27AL.mjs";export{b as contextPressureBlocksExpansion,d as contextPressureRequiresCompactPath,c as contextPressureStatusLine,a as contextPressureVerdict};
@@ -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{g as a,h as b,i as c}from"./chunk-J6JZ4PQA.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{b as buildContext7SmokePath,c as default,a as getVerifyCachePath};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a}from"./chunk-6EWGHM32.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as customWorkflowStorage};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a as t}from"./chunk-RNCLLUMK.mjs";import"./chunk-45I2C2UB.mjs";import{c as n}from"./chunk-L4COZ7ZH.mjs";import"./chunk-4KY2EHXS.mjs";import"./chunk-GJFWVCTS.mjs";import"./chunk-7OZDWT6C.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-54LH63LM.mjs";import"./chunk-ZZ65CN5F.mjs";import"./chunk-JQLJM4BK.mjs";import"./chunk-OVR6RUUZ.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-DAOC3T5G.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-OFVLGJ76.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-HZXDF2TQ.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-HE5RSIHG.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as o}from"./chunk-E66B27AL.mjs";function p(r=process.cwd(),e){return n({event:"CwdChanged",projectPath:r,build:o(async(d,i)=>{let c=d.cwd||i;return t(c)},"build")},e)}o(p,"runCwdChangedHook");export{p as runCwdChangedHook};
@@ -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 d}from"./chunk-E66B27AL.mjs";function m(e){let r=Math.max(1,e.turnLimit||15),s=Math.max(0,e.turns),u=s/r,t=e.tokenBudget!=null&&e.tokenBudget>0?e.tokenBudget:null,n=Math.max(0,e.tokensSpent),c=t?n/t:0,o=e.pressureLevel??"ok",i=`turns ${s}/${r}`,l=t!=null?`tokens ${n}/${t}`:n>0?`tokens spent\u2248${n} (no cycle budget set)`:"tokens \u2014 (set maxTokensPerCycle to track)",a=o==="critical"?"keep working \xB7 high-signal tools only (no thrash)":o==="warn"?"prefer compact recall \xB7 avoid junk injection":"session continues \xB7 protect signal density",k=`Cycle budget: ${i} \xB7 ${l} \xB7 pressure=${o} \xB7 ${a}`,g=["## Cycle budget (once per work cycle)","",`- ${i} (${Math.round(u*100)}%)`,`- ${l}${t?` (${Math.round(c*100)}%)`:""}`,`- pressure: **${o}**`,`- density: \`${a}\``,"","_Sessions may run long. Do not kill the chat for a turn proxy \u2014 starve junk injection instead._"].join(`
9
+ `);return{line:k,md:g,turnRatio:u,tokenRatio:c}}d(m,"buildCycleBudgetCard");export{m as buildCycleBudgetCard};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{c as a,d as b,e as c,g as d}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";d();export{a as PrjctDatabase,c as default,b as prjctDb};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-75UJIVMO.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-E66B27AL.mjs";export{c as NORMAL_MAX_FILES,d as NORMAL_MAX_LOC,a as TRIVIAL_MAX_FILES,b as TRIVIAL_MAX_LOC,g as computeCommittedChangeset,h as computeWorkingTreeChangeset,i as geometryBlockMessage,f as geometryOf,j as intentGeometryVerdict,k as shipGeometryVerdict,e as tierOf};
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'module';
3
+ import { fileURLToPath as __fileURLToPath } from 'url';
4
+ import { dirname as __pathDirname } from 'path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import{b as F}from"./chunk-YJMWY4Y6.mjs";import{e as R,j as b,l as D,n as C}from"./chunk-NJAMZSHM.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import{n as k,o as A}from"./chunk-CTWZQ7YI.mjs";import"./chunk-BUDZL4DW.mjs";import{a as o}from"./chunk-E66B27AL.mjs";A();async function f(e,n){return k(e,n)}o(f,"safeGit");async function x(e){let n=await f(e,["diff","--name-only","HEAD"])??"",t=await f(e,["diff","--name-only","--cached"])??"",i=await f(e,["ls-files","--others","--exclude-standard"])??"",a=new Set;for(let s of[n,t,i])for(let c of s.split(`
9
+ `))c.trim()&&a.add(c.trim());return[...a]}o(x,"listWorkingTreeFiles");async function v(e){let n=await H(e);if(!n)return[];let t=await f(e,["merge-base",n,"HEAD"]);return t?(await f(e,["diff","--name-only",`${t}..HEAD`])??"").split(`
10
+ `).filter(Boolean):[]}o(v,"listCommittedFiles");async function H(e){let n=await f(e,["rev-parse","--abbrev-ref","origin/HEAD"]);return n&&n!=="origin/HEAD"?n:(await Promise.all(["main","master"].map(async i=>({candidate:i,exists:await f(e,["rev-parse","--verify","--quiet",i])!==null})))).find(({exists:i})=>i)?.candidate??""}o(H,"resolveDefaultRef");async function E(e,n){if(n==="working-tree"||n==="explicit")return"HEAD";let t=await H(e);return t?await f(e,["merge-base",t,"HEAD"])??"HEAD":"HEAD"}o(E,"resolveDiffBase");function _(e){let n=new Map,t={currentFile:null,newLine:0};for(let i of e.split(`
11
+ `)){if(i.startsWith("+++ ")){let s=i.slice(4).trim();if(s==="/dev/null"){t.currentFile=null;continue}t.currentFile=s.replace(/^b\//,""),n.has(t.currentFile)||n.set(t.currentFile,new Set);continue}if(!t.currentFile)continue;let a=i.match(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/);if(a){t.newLine=Number.parseInt(a[1],10);continue}i.startsWith("\\")||(i.startsWith("+")&&!i.startsWith("+++")?(n.get(t.currentFile)?.add(t.newLine),t.newLine++):i.startsWith("-")&&!i.startsWith("---")||(i.startsWith(" ")||i==="")&&t.newLine++)}return n}o(_,"parseChangedLinesFromUnifiedDiff");async function L(e,n,t){if(t.length===0)return new Map;let i=await E(e,n);if(!i)return new Map;let a=n==="committed"?["diff","-U0",`${i}..HEAD`,"--",...t]:["diff","-U0","HEAD","--",...t],s=await f(e,a)??"",c=n!=="committed"?await f(e,["diff","-U0","--cached","--",...t])??"":"";return _(`${s}
12
+ ${c}`)}o(L,"loadHunkLines");function M(e,n,t){let i=b(e,n);if(i.length===0)return[];if(!t||t.size===0)return i.slice(0,12).map(c=>c.name);let a=[...t].sort((c,l)=>c-l),s=new Set;for(let c of a){let l=i.reduce((m,g)=>g.startLine<=c?g:m,i[0]);s.add(l.name);for(let m of i)t.has(m.startLine)&&s.add(m.name)}return[...s].slice(0,12)}o(M,"symbolsTouchedByHunks");var W=/(?:^|\/)(?:auth|security|crypto|billing|payment|migrate|schema|migrations?)(?:\/|$)/i,T=/(?:^|\/)(?:storage|database|db|sync|daemon|mcp|hooks?|session)(?:\/|$)/i;function U(e,n,t,i,a){let s=[],c=W.test(e)?"critical":T.test(e)?"high":"low";c==="critical"?s.push("touches auth/security/billing/schema path"):c==="high"&&s.push("touches storage/sync/hooks/mcp path");let l=n>=15?"critical":n>=5?"high":n>0?"medium":"low";n>=15?s.push(`high call fan-in (${n} callers)`):n>=5?s.push(`moderate call fan-in (${n} callers)`):n>0&&s.push(`${n} caller(s) via symbol graph`);let m=t>=10?"high":t>=3?"medium":"low";t>=10?s.push(`${t} importers`):t>=3&&s.push(`${t} importers`),a>0&&s.push(`${a} symbol(s) in changed hunks`),!i&&t===0&&n===0&&s.push("leaf change (no graph neighbors)");let g={low:0,medium:1,high:2,critical:3},u=[c,l,m].reduce((d,p)=>g[p]>g[d]?p:d);return s.length===0&&s.push("isolated or low connectivity"),{risk:u,reasons:s}}o(U,"classifyRisk");async function N(e,n,t={}){let i=await(async()=>{if(t.files&&t.files.length>0)return{changedFiles:t.files,source:"explicit"};let r=t.source??"auto";if(r==="working-tree"||r==="auto"){let h=await x(e);if(h.length>0||r==="working-tree")return{changedFiles:h,source:"working-tree"}}return r==="committed"||r==="auto"?{changedFiles:await v(e),source:"committed"}:{changedFiles:[],source:"explicit"}})(),{changedFiles:a,source:s}=i,c=F(n),l=R(n),m=l?await L(e,s,a.slice(0,80)):new Map,g=new Set(a);for(let r of a){let h=c?.reverse[r]??[];for(let y of h)g.add(y)}if(l)for(let r of C(n,a,2))g.add(r);let u=[],d={critical:0,high:0,medium:0,low:0};for(let r of a){let h=c?.reverse[r]??[],y=l?D(n,r):0,w=l?M(n,r,m.get(r)):[],{risk:$,reasons:S}=U(r,y,h.length,w.length>0||l&&b(n,r).length>0,w.length);d[$]++,u.push({file:r,risk:$,touchedSymbols:w,fanIn:y,reasons:S})}let p={critical:0,high:1,medium:2,low:3};return u.sort((r,h)=>p[r.risk]-p[h.risk]||r.file.localeCompare(h.file)),{changedFiles:a,affectedFiles:[...g].sort(),changes:u,summary:d,source:s}}o(N,"detectChanges");function q(e){if(e.changedFiles.length===0)return`## Detect changes
13
+
14
+ _No changes detected (clean tree / no base range)._
15
+ `;let n=["## Detect changes","",`- **Source**: ${e.source}`,`- **Changed**: ${e.changedFiles.length} file(s)`,`- **Blast radius**: ${e.affectedFiles.length} file(s) (imports + call-graph)`,`- **Risk**: critical ${e.summary.critical} \xB7 high ${e.summary.high} \xB7 medium ${e.summary.medium} \xB7 low ${e.summary.low}`,"","### Per-file risk",""];for(let t of e.changes){let i=t.touchedSymbols.length>0?` \xB7 symbols: ${t.touchedSymbols.slice(0,6).join(", ")}`:"";n.push(`- **${t.risk.toUpperCase()}** \`${t.file}\`${i}`,` - ${t.reasons.join("; ")}`)}if(e.affectedFiles.length>e.changedFiles.length){n.push("","### Affected beyond diff","");let t=e.affectedFiles.filter(i=>!e.changedFiles.includes(i)).slice(0,25);for(let i of t)n.push(`- \`${i}\``);e.affectedFiles.length-e.changedFiles.length>25&&n.push(`- _\u2026+${e.affectedFiles.length-e.changedFiles.length-25} more_`)}return n.push("","_Advisory. Expand with `prjct code trace <symbol>` or MCP `prjct_trace_path`._"),n.join(`
16
+ `)}o(q,"formatDetectChangesMd");function z(e){if(e.changedFiles.length===0)return"detect-changes: no changes detected";let n=[`Detect changes (${e.source}): ${e.changedFiles.length} changed \u2192 blast ${e.affectedFiles.length}`,`Risk: critical=${e.summary.critical} high=${e.summary.high} medium=${e.summary.medium} low=${e.summary.low}`];for(let t of e.changes.slice(0,30)){let i=t.touchedSymbols.length?` [${t.touchedSymbols.slice(0,4).join(",")}]`:"";n.push(` [${t.risk.toUpperCase()}] ${t.file}${i} \u2014 ${t.reasons[0]??""}`)}return n.join(`
17
+ `)}o(z,"formatDetectChangesText");function J(e){return e.changedFiles.length===0?null:e.summary.critical>0?`\u26A0\uFE0F Structural risk CRITICAL (${e.summary.critical} file(s), blast ${e.affectedFiles.length}). Review: \`prjct code impact --md\`.`:e.summary.high>0?`\u26A0\uFE0F Structural risk HIGH (${e.summary.high} file(s), blast ${e.affectedFiles.length}). Consider \`prjct code impact --md\`.`:null}o(J,"shipStructuralRiskCue");export{N as detectChanges,q as formatDetectChangesMd,z as formatDetectChangesText,_ as parseChangedLinesFromUnifiedDiff,J as shipStructuralRiskCue,M as symbolsTouchedByHunks};
@@ -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-2NMSEZTQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{b as AI_AGENTS,a as PROJECT_TYPES,d as detectInstalledAgents,c as detectProjectType,e as detectStack};