prjct-cli 3.91.0 → 3.92.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 (92) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/bin/hook-chunks/{agent-switch-IQ5KSRKD.mjs → agent-switch-XMFUTNNV.mjs} +1 -1
  3. package/dist/bin/hook-chunks/{analysis-LBYZSJKT.mjs → analysis-PFGKPYWQ.mjs} +6 -6
  4. package/dist/bin/hook-chunks/auto-flush-QZ3YIQP6.mjs +8 -0
  5. package/dist/bin/hook-chunks/{capture-gate-BQCNMHUC.mjs → capture-gate-2FXYVHNF.mjs} +1 -1
  6. package/dist/bin/hook-chunks/{chunk-6AFM6WRB.mjs → chunk-2HTDCLZD.mjs} +2 -2
  7. package/dist/bin/hook-chunks/{chunk-LGJUQEAU.mjs → chunk-2WPR5GFT.mjs} +1 -1
  8. package/dist/bin/hook-chunks/{chunk-LPB3HUJ2.mjs → chunk-3X7TBM4A.mjs} +1 -1
  9. package/dist/bin/hook-chunks/{chunk-LJLUP4FF.mjs → chunk-5PEHJEFE.mjs} +1 -1
  10. package/dist/bin/hook-chunks/{chunk-B7GMU46T.mjs → chunk-7JE6VTLN.mjs} +3 -3
  11. package/dist/bin/hook-chunks/{chunk-EHBEHLYN.mjs → chunk-AWD2AQVJ.mjs} +1 -1
  12. package/dist/bin/hook-chunks/{chunk-IKUGYUAI.mjs → chunk-BZ5UR7G3.mjs} +1 -1
  13. package/dist/bin/hook-chunks/{chunk-HBLR7BVG.mjs → chunk-CDCCAU22.mjs} +1 -1
  14. package/dist/bin/hook-chunks/{chunk-YKMJI6TF.mjs → chunk-CPHUFXD2.mjs} +2 -2
  15. package/dist/bin/hook-chunks/{chunk-PSP56GGF.mjs → chunk-CQUG6SO2.mjs} +1 -1
  16. package/dist/bin/hook-chunks/{chunk-RRWPDRYR.mjs → chunk-DGBDMUBL.mjs} +2 -2
  17. package/dist/bin/hook-chunks/{chunk-UQVJQME2.mjs → chunk-DVBBB5BS.mjs} +1 -1
  18. package/dist/bin/hook-chunks/{chunk-XEFIIDHM.mjs → chunk-GELCZWKW.mjs} +1 -1
  19. package/dist/bin/hook-chunks/{chunk-AW25AWN5.mjs → chunk-HIFIDMH5.mjs} +1 -1
  20. package/dist/bin/hook-chunks/{chunk-UHW35BPE.mjs → chunk-HX42HFII.mjs} +4 -4
  21. package/dist/bin/hook-chunks/{chunk-QZSJSXJV.mjs → chunk-I5BDN25C.mjs} +1 -1
  22. package/dist/bin/hook-chunks/{chunk-RJ2BRRMH.mjs → chunk-KB3P6XTL.mjs} +2 -2
  23. package/dist/bin/hook-chunks/{chunk-TFGJVT6F.mjs → chunk-MAHTF6JG.mjs} +1 -1
  24. package/dist/bin/hook-chunks/{chunk-FEH4IPIC.mjs → chunk-MQVVNX63.mjs} +1 -1
  25. package/dist/bin/hook-chunks/{chunk-3WKDMAS7.mjs → chunk-NLDL3N6R.mjs} +1 -1
  26. package/dist/bin/hook-chunks/chunk-OGOCHZ3S.mjs +13 -0
  27. package/dist/bin/hook-chunks/{chunk-M3ZOJVPA.mjs → chunk-OL6ITIAZ.mjs} +2 -2
  28. package/dist/bin/hook-chunks/{chunk-W5OWBOLH.mjs → chunk-OLKNK2HB.mjs} +1 -1
  29. package/dist/bin/hook-chunks/{chunk-DGQYQSUK.mjs → chunk-OP467HW6.mjs} +2 -2
  30. package/dist/bin/hook-chunks/{chunk-PXJKXBTM.mjs → chunk-S4TB2OFJ.mjs} +1 -1
  31. package/dist/bin/hook-chunks/{chunk-AEYONUUY.mjs → chunk-SY2FRLJF.mjs} +1 -1
  32. package/dist/bin/hook-chunks/{chunk-RAHFKGM6.mjs → chunk-TBM7736J.mjs} +1 -1
  33. package/dist/bin/hook-chunks/{chunk-A5MUSARI.mjs → chunk-WSFHSXBZ.mjs} +1 -1
  34. package/dist/bin/hook-chunks/{chunk-D6KT763C.mjs → chunk-XHDNPEAN.mjs} +1 -1
  35. package/dist/bin/hook-chunks/{chunk-YG7KBQYJ.mjs → chunk-Y7CKMFNW.mjs} +1 -1
  36. package/dist/bin/hook-chunks/{chunk-OIEZAHLC.mjs → chunk-ZNQXFWSI.mjs} +1 -1
  37. package/dist/bin/hook-chunks/{chunk-D4S3IRD3.mjs → chunk-ZX6BC2EB.mjs} +1 -1
  38. package/dist/bin/hook-chunks/{codex-skill-7IURPY6B.mjs → codex-skill-2N6656SR.mjs} +1 -1
  39. package/dist/bin/hook-chunks/{command-installer-BVHQUSL4.mjs → command-installer-XSKQS3IS.mjs} +1 -1
  40. package/dist/bin/hook-chunks/{config-manager-KYC7WUOS.mjs → config-manager-YZANYLPV.mjs} +1 -1
  41. package/dist/bin/hook-chunks/{cwd-changed-56X7BNS6.mjs → cwd-changed-NJ6RYVOJ.mjs} +1 -1
  42. package/dist/bin/hook-chunks/{distill-6C6YIFOE.mjs → distill-IABVRW2U.mjs} +1 -1
  43. package/dist/bin/hook-chunks/{enriched-recall-6ZZNKAJZ.mjs → enriched-recall-NDASPZXZ.mjs} +1 -1
  44. package/dist/bin/hook-chunks/{format-YOYMJSLY.mjs → format-NIBVWBGR.mjs} +1 -1
  45. package/dist/bin/hook-chunks/{judgment-receipt-2U7D6HS4.mjs → judgment-receipt-HTNEOJLT.mjs} +1 -1
  46. package/dist/bin/hook-chunks/{land-cue-SS23JBAX.mjs → land-cue-FNLP4IAB.mjs} +1 -1
  47. package/dist/bin/hook-chunks/{land-synthesis-OATL5BNP.mjs → land-synthesis-HBPIXP5S.mjs} +1 -1
  48. package/dist/bin/hook-chunks/{legacy-crew-sweep-NH5EWEXF.mjs → legacy-crew-sweep-2MLYPNQR.mjs} +2 -2
  49. package/dist/bin/hook-chunks/{memory-index-677MUBCZ.mjs → memory-index-MQCHZFUE.mjs} +1 -1
  50. package/dist/bin/hook-chunks/{notification-S2IJJ6JW.mjs → notification-VQM2AMNS.mjs} +1 -1
  51. package/dist/bin/hook-chunks/{pack-integrity-L3BL7CGO.mjs → pack-integrity-BKLDNYE5.mjs} +1 -1
  52. package/dist/bin/hook-chunks/{pack-manager-SU53HCKK.mjs → pack-manager-ASWLKYGP.mjs} +1 -1
  53. package/dist/bin/hook-chunks/{planning-ZYFCFU7N.mjs → planning-QBSY272P.mjs} +2 -2
  54. package/dist/bin/hook-chunks/{post-edit-JD7YFEBZ.mjs → post-edit-VTLDHWI3.mjs} +1 -1
  55. package/dist/bin/hook-chunks/{pre-bash-VIABNO5E.mjs → pre-bash-JR6257XO.mjs} +1 -1
  56. package/dist/bin/hook-chunks/{pre-commit-NVQVXHZQ.mjs → pre-commit-BYUFDN2N.mjs} +1 -1
  57. package/dist/bin/hook-chunks/{pre-edit-V4RD45C4.mjs → pre-edit-MHROFDS3.mjs} +1 -1
  58. package/dist/bin/hook-chunks/{pre-package-KFJZXI5T.mjs → pre-package-P7CLTJJV.mjs} +1 -1
  59. package/dist/bin/hook-chunks/{pre-search-7KRU5D2O.mjs → pre-search-BCQHPE46.mjs} +1 -1
  60. package/dist/bin/hook-chunks/{prjct-md-FMCPUMQT.mjs → prjct-md-WE6WFVL3.mjs} +1 -1
  61. package/dist/bin/hook-chunks/{project-agent-surfaces-TD7BHI25.mjs → project-agent-surfaces-A6HGZPAL.mjs} +1 -1
  62. package/dist/bin/hook-chunks/{project-memory-ZVZSLPB5.mjs → project-memory-ON54KZEM.mjs} +1 -1
  63. package/dist/bin/hook-chunks/{project-style-evolution-7JS75AUP.mjs → project-style-evolution-T27I5N65.mjs} +1 -1
  64. package/dist/bin/hook-chunks/{prompt-S4MMIXH5.mjs → prompt-JIOMJCGV.mjs} +2 -2
  65. package/dist/bin/hook-chunks/{purge-BDREPWEE.mjs → purge-QQ6XILZD.mjs} +1 -1
  66. package/dist/bin/hook-chunks/{retention-D2MVQLOF.mjs → retention-E7WGFL47.mjs} +1 -1
  67. package/dist/bin/hook-chunks/{sdd-ZO4DP23G.mjs → sdd-PV6KWXE4.mjs} +1 -1
  68. package/dist/bin/hook-chunks/{session-continuity-FNNUMOXB.mjs → session-continuity-5CLT5YBL.mjs} +1 -1
  69. package/dist/bin/hook-chunks/{session-start-HA7IRBFX.mjs → session-start-ATYLOUKB.mjs} +1 -1
  70. package/dist/bin/hook-chunks/{setup-7L3NXNRH.mjs → setup-VL7YXVE5.mjs} +2 -2
  71. package/dist/bin/hook-chunks/{shipping-GX4HFYJ3.mjs → shipping-LVTFVSWJ.mjs} +4 -4
  72. package/dist/bin/hook-chunks/{spec-context-inference-KER2R3F3.mjs → spec-context-inference-U6BGGB2Q.mjs} +2 -2
  73. package/dist/bin/hook-chunks/spec-service-2DVDFOR7.mjs +11 -0
  74. package/dist/bin/hook-chunks/spec-task-breakdown-MPNRRTNZ.mjs +8 -0
  75. package/dist/bin/hook-chunks/{stop-HPZCLDPM.mjs → stop-GBUGB5OE.mjs} +2 -2
  76. package/dist/bin/hook-chunks/{subagent-start-7KZUTKV5.mjs → subagent-start-HURF2GI7.mjs} +1 -1
  77. package/dist/bin/hook-chunks/{subagent-stop-7C72RWGO.mjs → subagent-stop-WJECHEXI.mjs} +1 -1
  78. package/dist/bin/hook-chunks/{surface-attribution-PDYR6DVA.mjs → surface-attribution-BDKFYUOJ.mjs} +1 -1
  79. package/dist/bin/hook-chunks/{task-service-RRFG5P7N.mjs → task-service-BM2JQXMS.mjs} +1 -1
  80. package/dist/bin/hook-chunks/{tdd-XQUU4C23.mjs → tdd-UJDJUJ3E.mjs} +1 -1
  81. package/dist/bin/hook-chunks/{template-loader-4QMIMOBY.mjs → template-loader-BFTLPG2W.mjs} +1 -1
  82. package/dist/bin/hook-chunks/{weak-model-mode-M6D23IIM.mjs → weak-model-mode-GLXXHG32.mjs} +1 -1
  83. package/dist/bin/hook-chunks/{work-scope-6FG6PSAV.mjs → work-scope-VTF6SKLY.mjs} +1 -1
  84. package/dist/bin/prjct-core.mjs +686 -682
  85. package/dist/bin/prjct-hooks.mjs +1 -1
  86. package/dist/daemon/entry.mjs +589 -585
  87. package/dist/mcp/server.mjs +299 -296
  88. package/package.json +1 -1
  89. package/dist/bin/hook-chunks/auto-flush-GW3FP763.mjs +0 -8
  90. package/dist/bin/hook-chunks/chunk-LWCHQIJ7.mjs +0 -11
  91. package/dist/bin/hook-chunks/spec-service-G3RLCJ2G.mjs +0 -11
  92. package/dist/bin/hook-chunks/spec-task-breakdown-YPJ76OWR.mjs +0 -8
package/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [3.92.0] - 2026-08-15
6
+
7
+ ### Added
8
+ - spec delta validate markdown
9
+
5
10
  ## [3.91.0] - 2026-08-15
6
11
 
7
12
  ### Added
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as E,b as I}from"./chunk-X5RDLFPM.mjs";import{a as P}from"./chunk-YG7KBQYJ.mjs";import{a as O}from"./chunk-5WAONIPX.mjs";import{a as C}from"./chunk-5TBQNW2G.mjs";import{b as N,c as H,d as L}from"./chunk-TRMBRDKH.mjs";import{h as _}from"./chunk-B7GMU46T.mjs";import"./chunk-LJLUP4FF.mjs";import"./chunk-Q5I2UPD6.mjs";import"./chunk-PSSR7LSW.mjs";import"./chunk-6AFM6WRB.mjs";import{c as D,d as A}from"./chunk-CREPUNOS.mjs";import"./chunk-D7TRY3CO.mjs";import"./chunk-TPESWBA7.mjs";import"./chunk-ODWWIFSN.mjs";import"./chunk-YKMJI6TF.mjs";import"./chunk-LLQUB6YR.mjs";import"./chunk-NLG2EW6M.mjs";import"./chunk-6IKHMK2U.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-75UJIVMO.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-2OU2MKNS.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-6EWGHM32.mjs";import"./chunk-SJ75V4WG.mjs";import"./chunk-4DDCWMI6.mjs";import"./chunk-A5MUSARI.mjs";import"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import{b as y}from"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import{a as x}from"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import{b as h}from"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import{d as f,g as v}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b as m,e as V,i as S,k as Y,l as R,r as q}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a}from"./chunk-E66B27AL.mjs";q();import{spawn as X}from"node:child_process";v();V();v();function G(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}a(G,"parseEvidence");function $(t){return{id:t.id,projectId:t.project_id,taskId:t.task_id,taskDescription:t.task_description,fromAgent:t.from_agent,fromIdentity:t.from_identity,toAgent:t.to_agent,reason:t.reason,evidence:G(t.evidence),status:t.status,workspaceId:t.workspace_id,worktreePath:t.worktree_path,branch:t.branch,createdAt:t.created_at,acceptedAt:t.accepted_at,acceptedBy:t.accepted_by,expiresAt:t.expires_at}}a($,"toHandoff");function M(t){let e=new Date;return e.setTime(e.getTime()+Math.max(1,t)*36e5),e.toISOString()}a(M,"expiresAtIso");function W(t){let e=`hand_${x()}`,o=m(),n=t.ttlHours??24,r=t.evidence?JSON.stringify(t.evidence):null;return f.run(t.projectId,`INSERT INTO task_handoffs (
8
+ import{a as E,b as I}from"./chunk-X5RDLFPM.mjs";import{a as P}from"./chunk-Y7CKMFNW.mjs";import{a as O}from"./chunk-5WAONIPX.mjs";import{a as C}from"./chunk-5TBQNW2G.mjs";import{b as N,c as H,d as L}from"./chunk-TRMBRDKH.mjs";import{h as _}from"./chunk-7JE6VTLN.mjs";import"./chunk-5PEHJEFE.mjs";import"./chunk-Q5I2UPD6.mjs";import"./chunk-PSSR7LSW.mjs";import"./chunk-2HTDCLZD.mjs";import{c as D,d as A}from"./chunk-CREPUNOS.mjs";import"./chunk-D7TRY3CO.mjs";import"./chunk-TPESWBA7.mjs";import"./chunk-ODWWIFSN.mjs";import"./chunk-CPHUFXD2.mjs";import"./chunk-LLQUB6YR.mjs";import"./chunk-NLG2EW6M.mjs";import"./chunk-6IKHMK2U.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-75UJIVMO.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-2OU2MKNS.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-6EWGHM32.mjs";import"./chunk-SJ75V4WG.mjs";import"./chunk-4DDCWMI6.mjs";import"./chunk-WSFHSXBZ.mjs";import"./chunk-OL6ITIAZ.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-DGBDMUBL.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-DVBBB5BS.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import{b as y}from"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import{a as x}from"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import{b as h}from"./chunk-OLKNK2HB.mjs";import"./chunk-MEQS4VPO.mjs";import{d as f,g as v}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{b as m,e as V,i as S,k as Y,l as R,r as q}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-ZX6BC2EB.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import{a}from"./chunk-E66B27AL.mjs";q();import{spawn as X}from"node:child_process";v();V();v();function G(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}a(G,"parseEvidence");function $(t){return{id:t.id,projectId:t.project_id,taskId:t.task_id,taskDescription:t.task_description,fromAgent:t.from_agent,fromIdentity:t.from_identity,toAgent:t.to_agent,reason:t.reason,evidence:G(t.evidence),status:t.status,workspaceId:t.workspace_id,worktreePath:t.worktree_path,branch:t.branch,createdAt:t.created_at,acceptedAt:t.accepted_at,acceptedBy:t.accepted_by,expiresAt:t.expires_at}}a($,"toHandoff");function M(t){let e=new Date;return e.setTime(e.getTime()+Math.max(1,t)*36e5),e.toISOString()}a(M,"expiresAtIso");function W(t){let e=`hand_${x()}`,o=m(),n=t.ttlHours??24,r=t.evidence?JSON.stringify(t.evidence):null;return f.run(t.projectId,`INSERT INTO task_handoffs (
9
9
  id, project_id, task_id, task_description, from_agent, from_identity,
10
10
  to_agent, reason, evidence, status, workspace_id, worktree_path, branch,
11
11
  created_at, accepted_at, accepted_by, expires_at
@@ -5,13 +5,13 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as G,b as ye,c as b,d as U,e as q,f as H,g as we,h as ke,i as w}from"./chunk-RJ2BRRMH.mjs";import"./chunk-FGQZ62ZP.mjs";import"./chunk-TXJT3G53.mjs";import"./chunk-A5RNWWTH.mjs";import"./chunk-HZIORCPO.mjs";import"./chunk-WDGDFXSB.mjs";import"./chunk-NWY5M34K.mjs";import"./chunk-B7GMU46T.mjs";import"./chunk-LJLUP4FF.mjs";import"./chunk-Q5I2UPD6.mjs";import{a as y,b as L,c as N,d as ve,e as E,f as R,g as z}from"./chunk-3WKDMAS7.mjs";import{b as me,c as A,d as $e}from"./chunk-PXJKXBTM.mjs";import"./chunk-PSSR7LSW.mjs";import{a as g}from"./chunk-6AFM6WRB.mjs";import"./chunk-CREPUNOS.mjs";import"./chunk-D7TRY3CO.mjs";import"./chunk-TPESWBA7.mjs";import"./chunk-ODWWIFSN.mjs";import"./chunk-YKMJI6TF.mjs";import"./chunk-LLQUB6YR.mjs";import"./chunk-NLG2EW6M.mjs";import"./chunk-6IKHMK2U.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-75UJIVMO.mjs";import"./chunk-XEFIIDHM.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-ZTZTVBAZ.mjs";import{a as Se}from"./chunk-DYHYDHCW.mjs";import"./chunk-2OU2MKNS.mjs";import{a as D,b as he,c as K}from"./chunk-7OZDWT6C.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-FEH4IPIC.mjs";import"./chunk-EHBEHLYN.mjs";import"./chunk-KEJ5RMAI.mjs";import"./chunk-6EWGHM32.mjs";import"./chunk-J6JZ4PQA.mjs";import"./chunk-LGJUQEAU.mjs";import"./chunk-54LH63LM.mjs";import"./chunk-SJ75V4WG.mjs";import{e as de}from"./chunk-4DDCWMI6.mjs";import{d as pe}from"./chunk-A5MUSARI.mjs";import"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import{a as fe}from"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import{a as ge}from"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import{b as ue}from"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import{d as _,g as ce}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{d as le}from"./chunk-HBLR7BVG.mjs";import{b as I,d as oe,e as X,s as ie,t as Qe}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import{j as ae,n as Be}from"./chunk-SVZHJZ5T.mjs";import{a as M,b as ne,o as re}from"./chunk-CTWZQ7YI.mjs";import"./chunk-OIEZAHLC.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import{a as k,e as $,f as J}from"./chunk-BUDZL4DW.mjs";import{a as m}from"./chunk-E66B27AL.mjs";J();re();Be();import j from"node:fs/promises";import C from"node:path";var Y=class{static{m(this,"CodebaseAnalyzer")}projectPath=null;init(e=process.cwd()){this.projectPath=e}async readPackageJson(){try{let e=C.join(this.projectPath,"package.json"),t=await j.readFile(e,"utf-8");return JSON.parse(t)}catch(e){if(k(e)||e instanceof SyntaxError)return null;throw e}}async readCargoToml(){try{let e=C.join(this.projectPath,"Cargo.toml");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readRequirements(){try{let e=C.join(this.projectPath,"requirements.txt");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readGoMod(){try{let e=C.join(this.projectPath,"go.mod");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readGemfile(){try{let e=C.join(this.projectPath,"Gemfile");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readMixExs(){try{let e=C.join(this.projectPath,"mix.exs");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readPomXml(){try{let e=C.join(this.projectPath,"pom.xml");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readComposerJson(){try{let e=C.join(this.projectPath,"composer.json"),t=await j.readFile(e,"utf-8");return JSON.parse(t)}catch(e){if(k(e)||e instanceof SyntaxError)return null;throw e}}async readPyprojectToml(){try{let e=C.join(this.projectPath,"pyproject.toml");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async getFileExtensions(){try{let{stdout:e}=await M('find . -type f ! -path "*/node_modules/*" ! -path "*/.git/*" ! -path "*/dist/*" ! -path "*/.next/*" | sed "s/.*\\./\\./" | sort | uniq -c | sort -rn',{cwd:this.projectPath}),t={};return e.trim().split(`
8
+ import{a as G,b as Se,c as b,d as U,e as q,f as H,g as we,h as ke,i as w}from"./chunk-KB3P6XTL.mjs";import"./chunk-FGQZ62ZP.mjs";import"./chunk-TXJT3G53.mjs";import"./chunk-A5RNWWTH.mjs";import"./chunk-HZIORCPO.mjs";import"./chunk-WDGDFXSB.mjs";import"./chunk-NWY5M34K.mjs";import"./chunk-7JE6VTLN.mjs";import"./chunk-5PEHJEFE.mjs";import"./chunk-Q5I2UPD6.mjs";import{a as y,b as L,c as N,d as ve,e as E,f as R,g as z}from"./chunk-NLDL3N6R.mjs";import{b as ge,c as A,d as $e}from"./chunk-S4TB2OFJ.mjs";import"./chunk-PSSR7LSW.mjs";import{a as g}from"./chunk-2HTDCLZD.mjs";import"./chunk-CREPUNOS.mjs";import"./chunk-D7TRY3CO.mjs";import"./chunk-TPESWBA7.mjs";import"./chunk-ODWWIFSN.mjs";import"./chunk-CPHUFXD2.mjs";import"./chunk-LLQUB6YR.mjs";import"./chunk-NLG2EW6M.mjs";import"./chunk-6IKHMK2U.mjs";import"./chunk-QSAA6LZF.mjs";import"./chunk-75UJIVMO.mjs";import"./chunk-GELCZWKW.mjs";import"./chunk-QDQ7DTDV.mjs";import"./chunk-ZTZTVBAZ.mjs";import{a as ue}from"./chunk-DYHYDHCW.mjs";import"./chunk-2OU2MKNS.mjs";import{a as D,b as ye,c as K}from"./chunk-7OZDWT6C.mjs";import"./chunk-YJMWY4Y6.mjs";import"./chunk-NJAMZSHM.mjs";import"./chunk-MQVVNX63.mjs";import"./chunk-AWD2AQVJ.mjs";import"./chunk-KEJ5RMAI.mjs";import"./chunk-6EWGHM32.mjs";import"./chunk-J6JZ4PQA.mjs";import"./chunk-2WPR5GFT.mjs";import"./chunk-54LH63LM.mjs";import"./chunk-SJ75V4WG.mjs";import{e as pe}from"./chunk-4DDCWMI6.mjs";import{d as fe}from"./chunk-WSFHSXBZ.mjs";import"./chunk-OL6ITIAZ.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import{a as he}from"./chunk-DGBDMUBL.mjs";import"./chunk-GAOQHD5S.mjs";import{a as de}from"./chunk-DVBBB5BS.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3FBCOCPD.mjs";import{b as me}from"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-GVNMXVVA.mjs";import"./chunk-OLKNK2HB.mjs";import"./chunk-MEQS4VPO.mjs";import{d as _,g as ce}from"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import{d as le}from"./chunk-CDCCAU22.mjs";import{b as I,d as oe,e as X,s as ie,t as Qe}from"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import{j as ae,n as Be}from"./chunk-SVZHJZ5T.mjs";import{a as M,b as ne,o as re}from"./chunk-CTWZQ7YI.mjs";import"./chunk-ZNQXFWSI.mjs";import"./chunk-SYHDEUVU.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-ZX6BC2EB.mjs";import"./chunk-PKDYFXMI.mjs";import{a as k,e as $,f as J}from"./chunk-BUDZL4DW.mjs";import{a as m}from"./chunk-E66B27AL.mjs";J();re();Be();import j from"node:fs/promises";import C from"node:path";var Y=class{static{m(this,"CodebaseAnalyzer")}projectPath=null;init(e=process.cwd()){this.projectPath=e}async readPackageJson(){try{let e=C.join(this.projectPath,"package.json"),t=await j.readFile(e,"utf-8");return JSON.parse(t)}catch(e){if(k(e)||e instanceof SyntaxError)return null;throw e}}async readCargoToml(){try{let e=C.join(this.projectPath,"Cargo.toml");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readRequirements(){try{let e=C.join(this.projectPath,"requirements.txt");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readGoMod(){try{let e=C.join(this.projectPath,"go.mod");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readGemfile(){try{let e=C.join(this.projectPath,"Gemfile");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readMixExs(){try{let e=C.join(this.projectPath,"mix.exs");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readPomXml(){try{let e=C.join(this.projectPath,"pom.xml");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async readComposerJson(){try{let e=C.join(this.projectPath,"composer.json"),t=await j.readFile(e,"utf-8");return JSON.parse(t)}catch(e){if(k(e)||e instanceof SyntaxError)return null;throw e}}async readPyprojectToml(){try{let e=C.join(this.projectPath,"pyproject.toml");return await j.readFile(e,"utf-8")}catch(e){if(k(e))return null;throw e}}async getFileExtensions(){try{let{stdout:e}=await M('find . -type f ! -path "*/node_modules/*" ! -path "*/.git/*" ! -path "*/dist/*" ! -path "*/.next/*" | sed "s/.*\\./\\./" | sort | uniq -c | sort -rn',{cwd:this.projectPath}),t={};return e.trim().split(`
9
9
  `).filter(Boolean).forEach(o=>{let s=o.trim().match(/^\s*(\d+)\s+(\.\w+)$/);s&&(t[s[2]]=parseInt(s[1],10))}),t}catch{return{}}}async listConfigFiles(){try{let e=await j.readdir(this.projectPath),t=[/^package\.json$/,/^Cargo\.toml$/,/^go\.mod$/,/^requirements\.txt$/,/^Gemfile$/,/^mix\.exs$/,/^pom\.xml$/,/^composer\.json$/,/^pyproject\.toml$/,/^tsconfig.*\.json$/,/^\..*rc(\.json|\.js|\.cjs)?$/,/^Dockerfile$/,/^docker-compose.*\.ya?ml$/,/^\.env.*$/];return e.filter(o=>t.some(s=>s.test(o)))}catch(e){if(k(e))return[];throw e}}async listDirectories(){try{return(await j.readdir(this.projectPath,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name).filter(t=>!t.startsWith(".")&&t!=="node_modules")}catch(e){if(k(e))return[];throw e}}async getGitLog(e=50){try{let{stdout:t}=await M(`git log -n ${e} --pretty=format:"%h|%an|%ar|%s"`,{cwd:this.projectPath});return t}catch{return""}}async getGitStats(){try{let{stdout:e}=await M("git rev-list --count HEAD",{cwd:this.projectPath}),{stdout:t}=await M('git log --format="%an" | sort -u | wc -l',{cwd:this.projectPath}),{stdout:o}=await M('git log --reverse --pretty=format:"%ar" | head -1',{cwd:this.projectPath});return{totalCommits:parseInt(e.trim(),10)||0,contributors:parseInt(t.trim(),10)||0,age:o.trim()||"unknown"}}catch{return{totalCommits:0,contributors:0,age:"unknown"}}}async countFiles(){try{let{stdout:e}=await M('find . -type f ! -path "*/node_modules/*" ! -path "*/.git/*" ! -path "*/dist/*" | wc -l',{cwd:this.projectPath});return parseInt(e.trim(),10)||0}catch{return 0}}async fileExists(e){return ae(C.join(this.projectPath,e))}async readFile(e){try{let t=C.join(this.projectPath,e);return await j.readFile(t,"utf-8")}catch(t){if(k(t))return null;throw t}}async findFiles(e){try{let{stdout:t}=await M(`find . -type f -name "${e}" ! -path "*/node_modules/*" ! -path "*/.git/*"`,{cwd:this.projectPath});return t.trim().split(`
10
- `).filter(Boolean)}catch{return[]}}},We=new Y,S=We;Qe();import je from"node:fs/promises";import Pe from"node:path";var V=800,Z=6,Xe=8,Ke=5;async function ee(r,e,t,o){let[s,i,n,a]=await Promise.all([Ye(r,e,o),Ze(r),et(r),tt(r)]);return{project:{name:o.name,ecosystem:o.ecosystem,languages:o.languages,frameworks:o.frameworks,fileCount:o.fileCount,projectType:o.projectType},git:{branch:t.branch,recentCommits:t.recentCommits.slice(0,Xe).map(u=>({message:u.message,date:u.date})),hasChanges:t.hasChanges,weeklyCommits:t.weeklyCommits},codeSamples:s,existingPatterns:i,taskHistory:n,previousAnalysis:a??void 0}}m(ee,"buildAnalysisPayload");async function Ye(r,e,t){let o=[],s=[...t.frameworks.map(a=>a.toLowerCase()),"config","router","middleware","service","model","schema","database","api","auth"].join(" "),i=de(r,s,Z*2);for(let a of i){if(o.length>=Z)break;try{let u=Pe.join(e,a.path),l=await je.readFile(u,"utf-8");l.length>V*3?o.push({path:a.path,content:`${l.slice(0,V)}
11
- // ... truncated`,reason:`BM25 score: ${a.score.toFixed(2)} (truncated, ${l.length} chars)`}):o.push({path:a.path,content:l.slice(0,V),reason:`BM25 score: ${a.score.toFixed(2)}`})}catch{}}let n=["package.json","tsconfig.json","src/index.ts","src/main.ts","app.ts"];for(let a of n){if(o.length>=Z)break;if(!o.some(u=>u.path===a))try{let u=Pe.join(e,a),l=await je.readFile(u,"utf-8");o.push({path:a,content:l.slice(0,V),reason:"entry point"})}catch{}}return o}m(Ye,"selectCodeSamples");async function Ze(r){try{let e=await b.getActive(r);return e?{patterns:(e.patterns??[]).map(t=>({name:t.name,description:t.description})),antiPatterns:(e.antiPatterns??[]).map(t=>({issue:t.issue,file:t.file,suggestion:t.suggestion}))}:{patterns:[],antiPatterns:[]}}catch{return{patterns:[],antiPatterns:[]}}}m(Ze,"getExistingPatterns");async function et(r){try{return(await ue.getTaskHistory(r)).slice(0,Ke).map(t=>({description:t.title,status:t.classification,branch:t.branchName}))}catch{return[]}}m(et,"getTaskHistory");function tt(r){try{let e=D.getActiveSummary(r);return Promise.resolve(e)}catch(e){return Se.debug("Failed to get previous LLM analysis summary",{error:e}),Promise.resolve(null)}}m(tt,"getPreviousAnalysisSummary");J();X();ce();J();async function be(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return e.json&&console.log(JSON.stringify({success:!1,error:"No project ID found"})),t.result;let o=t.value,s=await b.seal(o);return e.json?(console.log(JSON.stringify({success:s.success,signature:s.signature,error:s.error})),{success:s.success,error:s.error}):s.success?(g.done("Analysis sealed"),console.log(` Signature: ${s.signature?.substring(0,16)}...`),console.log(""),{success:!0,data:{signature:s.signature}}):(g.fail(s.error||"Seal failed"),{success:!1,error:s.error})}catch(t){let o=$(t);return e.json?console.log(JSON.stringify({success:!1,error:o})):g.fail(o),{success:!1,error:o}}}m(be,"seal");async function Ce(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return e.json&&console.log(JSON.stringify({success:!1,error:"No project ID found"})),t.result;let o=t.value,s=await b.rollback(o);return e.json?(console.log(JSON.stringify({success:s.success,restoredSignature:s.restoredSignature,error:s.error})),{success:s.success,error:s.error}):e.md?s.success?(console.log(y(R("Analysis Rolled Back"),E({"Restored signature":`${s.restoredSignature?.substring(0,16)}...`,Note:"Previous sealed version is now active. Current version moved to draft."}))),{success:!0,data:{restoredSignature:s.restoredSignature}}):(console.log(y("## Rollback Failed",`> ${s.error}`)),{success:!1,error:s.error}):s.success?(g.done("Analysis rolled back to previous sealed version"),console.log(` Restored signature: ${s.restoredSignature?.substring(0,16)}...`),console.log(" Previous sealed version demoted to draft"),console.log(""),{success:!0,data:{restoredSignature:s.restoredSignature}}):(g.fail(s.error||"Rollback failed"),{success:!1,error:s.error})}catch(t){let o=$(t);return e.json?console.log(JSON.stringify({success:!1,error:o})):e.md?console.log(y("## Rollback Failed",`> ${o}`)):g.fail(o),{success:!1,error:o}}}m(Ce,"rollback");async function xe(r=process.cwd(),e={}){if(e.semantic)return te(r,e);try{let t=await w(r);if(!t.ok)return t.result;let o=t.value,s=await b.verify(o);return e.json?(console.log(JSON.stringify(s)),{success:s.valid}):(s.valid?g.done(s.message):g.fail(s.message),console.log(""),{success:s.valid,data:s})}catch(t){let o=$(t);return me(o)}}m(xe,"verify");async function te(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return e.json?console.log(JSON.stringify({success:!1,error:"No project ID found"})):g.fail("No project ID found"),t.result;let o=t.value,s=(()=>{try{return _.getDoc(o,"project")?.repoPath||r}catch{return r}})(),i=await b.semanticVerify(o,s);if(e.json)return console.log(JSON.stringify(i)),{success:i.passed,data:i};console.log(""),i.passed?(g.done("Semantic verification passed"),console.log(` ${i.passedCount}/${i.checks.length} checks passed (${i.totalMs}ms)`)):(g.fail("Semantic verification failed"),console.log(` ${i.failedCount}/${i.checks.length} checks failed`)),console.log(""),console.log("Check Results:");for(let n of i.checks){let a=n.passed?"\u2713":"\u2717",u=n.passed?`${n.output} (${n.durationMs}ms)`:n.error||"Failed";console.log(` ${a} ${n.name}: ${u}`)}return console.log(""),{success:i.passed,data:i}}catch(t){let o=$(t);return e.json?console.log(JSON.stringify({success:!1,error:o})):g.fail(o),{success:!1,error:o}}}m(te,"semanticVerifyCommand");import De from"node:fs/promises";import Re from"node:path";import{z as c}from"zod";var st=c.object({style:c.string(),insights:c.array(c.string()),domains:c.array(c.string())}),nt=c.object({name:c.string(),description:c.string(),locations:c.array(c.string()),confidence:c.number().min(0).max(1),category:c.string()}),rt=c.object({issue:c.string(),reasoning:c.string(),files:c.array(c.string()),suggestion:c.string(),severity:c.enum(["low","medium","high"]),confidence:c.number().min(0).max(1)}),ot=c.object({description:c.string(),area:c.string(),effort:c.enum(["small","medium","large"]),impact:c.string(),priority:c.enum(["low","medium","high"])}),at=c.object({path:c.string(),reason:c.string(),risk:c.string(),severity:c.enum(["low","medium","high"])}),it=c.object({description:c.string(),files:c.array(c.string()),benefit:c.string(),effort:c.enum(["small","medium","large"])}),ct=c.object({category:c.string(),rule:c.string(),example:c.string().optional()}),lt=c.object({build:c.string().optional(),test:c.string().optional(),lint:c.string().optional(),dev:c.string().optional(),format:c.string().optional(),install:c.string().optional()}),ut=c.object({languages:c.array(c.string()),frameworks:c.array(c.string()),packageManager:c.string().optional()}),mt=c.object({version:c.literal(1),commitHash:c.string().nullable(),analyzedAt:c.string(),architecture:st,patterns:c.array(nt),antiPatterns:c.array(rt),techDebt:c.array(ot),riskAreas:c.array(at),refactorSuggestions:c.array(it),projectInsights:c.array(c.string()),conventions:c.array(ct),commands:lt.optional(),stack:ut.optional()});function Ae(r){let e=mt.safeParse(r);return e.success?{ok:!0,value:e.data}:{ok:!1,error:e.error.issues.map(o=>`${o.path.length>0?o.path.join("."):"<root>"}: ${o.message}`).join("; ")}}m(Ae,"parseLlmAnalysis");X();re();async function Le(r,e=process.cwd(),t={}){try{let o=await w(e);if(!o.ok)return o.result;let s=o.value,i=await dt(r,e),n=await pt(i.content,e),a=D.getActive(s),u=!!(a&&he(a)&&K(n)),l=u?gt(a,n):n;D.save(s,l);try{let{recomputeProjectStyle:f}=await import("./project-style-evolution-7JS75AUP.mjs"),{gatherStats:h,detectStack:x,detectCommands:B}=await import("./sync-analyzer-FKC57RTV.mjs"),[T,P,Q]=await Promise.all([h(e),x(e),B(e)]);await f({projectId:s,projectPath:e,stats:T,stack:P,commands:Q,commitHash:l.commitHash,source:"analysis-save"})}catch{}let p=K(l)&&!u;if(t.md){let h=[R(u?"LLM Analysis Notes Merged (house style preserved)":p?"LLM Analysis Notes Saved (thin \u2014 not house style)":"LLM Analysis Saved"),E({Input:i.source,Architecture:l.architecture.style,Patterns:l.patterns.length,"Anti-patterns":l.antiPatterns?.length||0,"Tech debt items":l.techDebt?.length||0,"Risk areas":l.riskAreas?.length||0,Conventions:l.conventions?.length||0,...u?{Merge:"thin notes \u2192 existing rich analysis"}:{},...p?{Kind:"thin markdown/notes"}:{}})];p&&h.push(z("Prefer schema v1 JSON (architecture/patterns/conventions) via `prjct analysis-save-llm <file> --md`. Markdown alone leaves patterns empty and burns a retry loop.")),console.log(y(...h))}else console.log(JSON.stringify({success:!0,message:u?"LLM analysis notes merged into existing rich analysis":p?"LLM analysis thin notes saved (prefer schema v1 JSON for house style)":"LLM analysis saved",input:i.source,mergedNotes:u,thin:p,stats:{patterns:l.patterns.length,antiPatterns:l.antiPatterns?.length||0,techDebt:l.techDebt?.length||0},...p?{tip:"Prefer schema v1 JSON (architecture/patterns/conventions). Markdown alone is thin notes."}:{}}));return{success:!0}}catch(o){return A(o)}}m(Le,"saveLlmAnalysis");function gt(r,e){let t=m((o,s,i)=>{let n=[],a=new Set;for(let u of[...o,...s]){let l=u.toLowerCase();if(!(a.has(l)||!u.trim())&&(a.add(l),n.push(u),n.length>=i))break}return n},"mergeUnique");return{...r,analyzedAt:e.analyzedAt,commitHash:e.commitHash??r.commitHash,projectInsights:t(r.projectInsights??[],e.projectInsights??[],60),architecture:{...r.architecture,insights:t(r.architecture.insights??[],e.architecture.insights??[],24)}}}m(gt,"mergeThinNotesIntoRich");async function dt(r,e){let t=r.trim();if(!t)throw new Error("analysis-save-llm requires analysis text, JSON, or a file path");let o=Re.isAbsolute(t)?t:Re.resolve(e,t);try{if((await De.stat(o)).isFile())return{content:await De.readFile(o,"utf-8"),source:"file"}}catch{}return{content:r,source:"inline"}}m(dt,"resolveAnalysisInput");async function pt(r,e){let t=r.trim();if(!t)throw new Error("analysis-save-llm received an empty analysis");let o=ft(t);if(o.ok){let s=Ae(o.value);return s.ok?s.value:Me(`Structured analysis did not match the legacy schema; preserved as LLM notes.
10
+ `).filter(Boolean)}catch{return[]}}},We=new Y,S=We;Qe();import je from"node:fs/promises";import Pe from"node:path";var V=800,Z=6,Xe=8,Ke=5;async function ee(r,e,t,o){let[s,i,n,a]=await Promise.all([Ye(r,e,o),Ze(r),et(r),tt(r)]);return{project:{name:o.name,ecosystem:o.ecosystem,languages:o.languages,frameworks:o.frameworks,fileCount:o.fileCount,projectType:o.projectType},git:{branch:t.branch,recentCommits:t.recentCommits.slice(0,Xe).map(u=>({message:u.message,date:u.date})),hasChanges:t.hasChanges,weeklyCommits:t.weeklyCommits},codeSamples:s,existingPatterns:i,taskHistory:n,previousAnalysis:a??void 0}}m(ee,"buildAnalysisPayload");async function Ye(r,e,t){let o=[],s=[...t.frameworks.map(a=>a.toLowerCase()),"config","router","middleware","service","model","schema","database","api","auth"].join(" "),i=pe(r,s,Z*2);for(let a of i){if(o.length>=Z)break;try{let u=Pe.join(e,a.path),l=await je.readFile(u,"utf-8");l.length>V*3?o.push({path:a.path,content:`${l.slice(0,V)}
11
+ // ... truncated`,reason:`BM25 score: ${a.score.toFixed(2)} (truncated, ${l.length} chars)`}):o.push({path:a.path,content:l.slice(0,V),reason:`BM25 score: ${a.score.toFixed(2)}`})}catch{}}let n=["package.json","tsconfig.json","src/index.ts","src/main.ts","app.ts"];for(let a of n){if(o.length>=Z)break;if(!o.some(u=>u.path===a))try{let u=Pe.join(e,a),l=await je.readFile(u,"utf-8");o.push({path:a,content:l.slice(0,V),reason:"entry point"})}catch{}}return o}m(Ye,"selectCodeSamples");async function Ze(r){try{let e=await b.getActive(r);return e?{patterns:(e.patterns??[]).map(t=>({name:t.name,description:t.description})),antiPatterns:(e.antiPatterns??[]).map(t=>({issue:t.issue,file:t.file,suggestion:t.suggestion}))}:{patterns:[],antiPatterns:[]}}catch{return{patterns:[],antiPatterns:[]}}}m(Ze,"getExistingPatterns");async function et(r){try{return(await me.getTaskHistory(r)).slice(0,Ke).map(t=>({description:t.title,status:t.classification,branch:t.branchName}))}catch{return[]}}m(et,"getTaskHistory");function tt(r){try{let e=D.getActiveSummary(r);return Promise.resolve(e)}catch(e){return ue.debug("Failed to get previous LLM analysis summary",{error:e}),Promise.resolve(null)}}m(tt,"getPreviousAnalysisSummary");J();X();ce();J();async function be(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return e.json&&console.log(JSON.stringify({success:!1,error:"No project ID found"})),t.result;let o=t.value,s=await b.seal(o);return e.json?(console.log(JSON.stringify({success:s.success,signature:s.signature,error:s.error})),{success:s.success,error:s.error}):s.success?(g.done("Analysis sealed"),console.log(` Signature: ${s.signature?.substring(0,16)}...`),console.log(""),{success:!0,data:{signature:s.signature}}):(g.fail(s.error||"Seal failed"),{success:!1,error:s.error})}catch(t){let o=$(t);return e.json?console.log(JSON.stringify({success:!1,error:o})):g.fail(o),{success:!1,error:o}}}m(be,"seal");async function Ce(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return e.json&&console.log(JSON.stringify({success:!1,error:"No project ID found"})),t.result;let o=t.value,s=await b.rollback(o);return e.json?(console.log(JSON.stringify({success:s.success,restoredSignature:s.restoredSignature,error:s.error})),{success:s.success,error:s.error}):e.md?s.success?(console.log(y(R("Analysis Rolled Back"),E({"Restored signature":`${s.restoredSignature?.substring(0,16)}...`,Note:"Previous sealed version is now active. Current version moved to draft."}))),{success:!0,data:{restoredSignature:s.restoredSignature}}):(console.log(y("## Rollback Failed",`> ${s.error}`)),{success:!1,error:s.error}):s.success?(g.done("Analysis rolled back to previous sealed version"),console.log(` Restored signature: ${s.restoredSignature?.substring(0,16)}...`),console.log(" Previous sealed version demoted to draft"),console.log(""),{success:!0,data:{restoredSignature:s.restoredSignature}}):(g.fail(s.error||"Rollback failed"),{success:!1,error:s.error})}catch(t){let o=$(t);return e.json?console.log(JSON.stringify({success:!1,error:o})):e.md?console.log(y("## Rollback Failed",`> ${o}`)):g.fail(o),{success:!1,error:o}}}m(Ce,"rollback");async function xe(r=process.cwd(),e={}){if(e.semantic)return te(r,e);try{let t=await w(r);if(!t.ok)return t.result;let o=t.value,s=await b.verify(o);return e.json?(console.log(JSON.stringify(s)),{success:s.valid}):(s.valid?g.done(s.message):g.fail(s.message),console.log(""),{success:s.valid,data:s})}catch(t){let o=$(t);return ge(o)}}m(xe,"verify");async function te(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return e.json?console.log(JSON.stringify({success:!1,error:"No project ID found"})):g.fail("No project ID found"),t.result;let o=t.value,s=(()=>{try{return _.getDoc(o,"project")?.repoPath||r}catch{return r}})(),i=await b.semanticVerify(o,s);if(e.json)return console.log(JSON.stringify(i)),{success:i.passed,data:i};console.log(""),i.passed?(g.done("Semantic verification passed"),console.log(` ${i.passedCount}/${i.checks.length} checks passed (${i.totalMs}ms)`)):(g.fail("Semantic verification failed"),console.log(` ${i.failedCount}/${i.checks.length} checks failed`)),console.log(""),console.log("Check Results:");for(let n of i.checks){let a=n.passed?"\u2713":"\u2717",u=n.passed?`${n.output} (${n.durationMs}ms)`:n.error||"Failed";console.log(` ${a} ${n.name}: ${u}`)}return console.log(""),{success:i.passed,data:i}}catch(t){let o=$(t);return e.json?console.log(JSON.stringify({success:!1,error:o})):g.fail(o),{success:!1,error:o}}}m(te,"semanticVerifyCommand");import De from"node:fs/promises";import Re from"node:path";import{z as c}from"zod";var st=c.object({style:c.string(),insights:c.array(c.string()),domains:c.array(c.string())}),nt=c.object({name:c.string(),description:c.string(),locations:c.array(c.string()),confidence:c.number().min(0).max(1),category:c.string()}),rt=c.object({issue:c.string(),reasoning:c.string(),files:c.array(c.string()),suggestion:c.string(),severity:c.enum(["low","medium","high"]),confidence:c.number().min(0).max(1)}),ot=c.object({description:c.string(),area:c.string(),effort:c.enum(["small","medium","large"]),impact:c.string(),priority:c.enum(["low","medium","high"])}),at=c.object({path:c.string(),reason:c.string(),risk:c.string(),severity:c.enum(["low","medium","high"])}),it=c.object({description:c.string(),files:c.array(c.string()),benefit:c.string(),effort:c.enum(["small","medium","large"])}),ct=c.object({category:c.string(),rule:c.string(),example:c.string().optional()}),lt=c.object({build:c.string().optional(),test:c.string().optional(),lint:c.string().optional(),dev:c.string().optional(),format:c.string().optional(),install:c.string().optional()}),ut=c.object({languages:c.array(c.string()),frameworks:c.array(c.string()),packageManager:c.string().optional()}),mt=c.object({version:c.literal(1),commitHash:c.string().nullable(),analyzedAt:c.string(),architecture:st,patterns:c.array(nt),antiPatterns:c.array(rt),techDebt:c.array(ot),riskAreas:c.array(at),refactorSuggestions:c.array(it),projectInsights:c.array(c.string()),conventions:c.array(ct),commands:lt.optional(),stack:ut.optional()});function Ae(r){let e=mt.safeParse(r);return e.success?{ok:!0,value:e.data}:{ok:!1,error:e.error.issues.map(o=>`${o.path.length>0?o.path.join("."):"<root>"}: ${o.message}`).join("; ")}}m(Ae,"parseLlmAnalysis");X();re();async function Le(r,e=process.cwd(),t={}){try{let o=await w(e);if(!o.ok)return o.result;let s=o.value,i=await dt(r,e),n=await pt(i.content,e),a=D.getActive(s),u=!!(a&&ye(a)&&K(n)),l=u?gt(a,n):n;D.save(s,l);try{let{recomputeProjectStyle:f}=await import("./project-style-evolution-T27I5N65.mjs"),{gatherStats:h,detectStack:x,detectCommands:B}=await import("./sync-analyzer-FKC57RTV.mjs"),[T,P,Q]=await Promise.all([h(e),x(e),B(e)]);await f({projectId:s,projectPath:e,stats:T,stack:P,commands:Q,commitHash:l.commitHash,source:"analysis-save"})}catch{}let p=K(l)&&!u;if(t.md){let h=[R(u?"LLM Analysis Notes Merged (house style preserved)":p?"LLM Analysis Notes Saved (thin \u2014 not house style)":"LLM Analysis Saved"),E({Input:i.source,Architecture:l.architecture.style,Patterns:l.patterns.length,"Anti-patterns":l.antiPatterns?.length||0,"Tech debt items":l.techDebt?.length||0,"Risk areas":l.riskAreas?.length||0,Conventions:l.conventions?.length||0,...u?{Merge:"thin notes \u2192 existing rich analysis"}:{},...p?{Kind:"thin markdown/notes"}:{}})];p&&h.push(z("Prefer schema v1 JSON (architecture/patterns/conventions) via `prjct analysis-save-llm <file> --md`. Markdown alone leaves patterns empty and burns a retry loop.")),console.log(y(...h))}else console.log(JSON.stringify({success:!0,message:u?"LLM analysis notes merged into existing rich analysis":p?"LLM analysis thin notes saved (prefer schema v1 JSON for house style)":"LLM analysis saved",input:i.source,mergedNotes:u,thin:p,stats:{patterns:l.patterns.length,antiPatterns:l.antiPatterns?.length||0,techDebt:l.techDebt?.length||0},...p?{tip:"Prefer schema v1 JSON (architecture/patterns/conventions). Markdown alone is thin notes."}:{}}));return{success:!0}}catch(o){return A(o)}}m(Le,"saveLlmAnalysis");function gt(r,e){let t=m((o,s,i)=>{let n=[],a=new Set;for(let u of[...o,...s]){let l=u.toLowerCase();if(!(a.has(l)||!u.trim())&&(a.add(l),n.push(u),n.length>=i))break}return n},"mergeUnique");return{...r,analyzedAt:e.analyzedAt,commitHash:e.commitHash??r.commitHash,projectInsights:t(r.projectInsights??[],e.projectInsights??[],60),architecture:{...r.architecture,insights:t(r.architecture.insights??[],e.architecture.insights??[],24)}}}m(gt,"mergeThinNotesIntoRich");async function dt(r,e){let t=r.trim();if(!t)throw new Error("analysis-save-llm requires analysis text, JSON, or a file path");let o=Re.isAbsolute(t)?t:Re.resolve(e,t);try{if((await De.stat(o)).isFile())return{content:await De.readFile(o,"utf-8"),source:"file"}}catch{}return{content:r,source:"inline"}}m(dt,"resolveAnalysisInput");async function pt(r,e){let t=r.trim();if(!t)throw new Error("analysis-save-llm received an empty analysis");let o=ft(t);if(o.ok){let s=Ae(o.value);return s.ok?s.value:Me(`Structured analysis did not match the legacy schema; preserved as LLM notes.
12
12
 
13
13
  ${JSON.stringify(o.value,null,2)}`,e)}return Me(t,e)}m(pt,"normalizeAnalysis");function ft(r){try{return{ok:!0,value:JSON.parse(r)}}catch{return{ok:!1}}}m(ft,"tryParseJson");async function Me(r,e){let t=ht(r);return{version:1,commitHash:await St(e),analyzedAt:I(),architecture:{style:"unknown",insights:t.slice(0,8),domains:[]},patterns:[],antiPatterns:[],techDebt:[],riskAreas:[],refactorSuggestions:[],projectInsights:t,conventions:[]}}m(Me,"analysisFromText");function ht(r){let e=r.split(/\r?\n/).map(s=>s.replace(/^\s{0,3}#{1,6}\s+/,"").replace(/^\s*[-*]\s+\[[ xX]\]\s+/,"").replace(/^\s*[-*]\s+/,"").replace(/^\s*\d+[.)]\s+/,"").trim()).filter(yt),t=[],o=new Set;for(let s of e){let i=s.toLowerCase();if(!o.has(i)&&(o.add(i),t.push(s),t.length>=40))break}return t.length>0?t:[r.slice(0,2e3)]}m(ht,"textToInsights");function yt(r){if(!r||!/[\p{L}\p{N}]/u.test(r))return!1;let e=r.toLowerCase().replace(/\s+/g," ").trim();return!(["current work","wip","misc","todo","n/a","none","latest","unreleased","changelog"].includes(e)||/^[-=_]{3,}$/.test(e)||/^(added|changed|fixed|removed)$/i.test(e)||/^v?\d+\.\d+\.\d+(?:-[\w.-]+)?$/i.test(e))}m(yt,"isUsefulInsight");async function St(r){try{let{stdout:e}=await ne("git",["rev-parse","HEAD"],{cwd:r});return e.trim()||null}catch{return null}}m(St,"resolveCurrentCommit");async function Ne(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return t.result;let o=t.value,s=D.getActive(o);if(!s)return e.md?console.log(y("## No LLM Analysis","> Run `prjct sync` to generate.")):console.log(JSON.stringify({success:!1,message:"No LLM analysis found"})),{success:!1,message:"No LLM analysis found"};if(e.md){let i=[R(`LLM Analysis (${s.architecture.style})`),""];if(s.architecture.insights.length>0&&i.push(L("Architecture Insights",N(s.architecture.insights.slice(0,5)))),s.patterns.length>0){let n=s.patterns.slice(0,8);i.push(L(`Patterns (${s.patterns.length})`,N(n.map(a=>`**${a.name}** \u2014 ${a.description} (${a.category})`))))}if(s.antiPatterns.length>0){let n=s.antiPatterns.slice(0,5);i.push(L(`Anti-Patterns (${s.antiPatterns.length})`,N(n.map(a=>`[${a.severity}] ${a.issue} \u2014 ${a.suggestion}`))))}if(s.techDebt.length>0){let n=s.techDebt.slice(0,5);i.push(L(`Tech Debt (${s.techDebt.length})`,N(n.map(a=>`[${a.priority}/${a.effort}] ${a.description}`))))}s.conventions.length>0&&i.push(L("Conventions",N(s.conventions.slice(0,5).map(n=>`**${n.category}**: ${n.rule}`)))),console.log(y(...i))}else{let i={...s,patterns:s.patterns.slice(0,10),antiPatterns:s.antiPatterns.slice(0,6),techDebt:s.techDebt.slice(0,6),conventions:s.conventions.slice(0,6)};console.log(JSON.stringify({success:!0,analysis:i}))}return{success:!0,data:s}}catch(t){return A(t)}}m(Ne,"getLlmAnalysis");ce();J();import wt from"node:path";X();async function Te(r,e){let t=Date.now()-e;await le.installGlobalConfig(),g.done(`Synced ${r.stats.name||"project"} (${(t/1e3).toFixed(1)}s)`),console.log("");let o=r.stats.frameworks.length>0?` (${r.stats.frameworks[0]})`:"",s=r.syncMetrics?.indexes,i=[`${r.stats.fileCount} files indexed`,`Stack: ${r.stats.ecosystem}${o} | Branch: ${r.git.branch}`];if(s?.bm25Files){let a=s.bm25Files*(s.bm25AvgTokens||0);i.push(`Index: ${F(a)} tokens | ${s.bm25VocabSize||0} terms | ${s.importEdges||0} imports`)}g.box("Sync Summary",i.join(`
14
- `));let n=[];if(r.generatedSkills?.generated&&r.generatedSkills.generated.length>0){let a=r.generatedSkills.generated.length,u=a===1?"skill":"skills";n.push(`${a} ${u} generated`)}if(r.context7&&n.push(`Context7: ${r.context7.verified?"verified":`not ready${r.context7.message?` (${r.context7.message})`:""}`}`),r.analysisSummary&&n.push(`Analysis: ${r.analysisSummary.patterns} patterns | ${r.analysisSummary.antiPatterns} anti-patterns (${r.analysisSummary.criticalAntiPatterns} critical)`),r.contextQuality){let a=r.contextQuality,u=a.irrelevantRemoved>0||a.repairEntriesCreated>0?`, repaired ${a.repairEntriesCreated}, removed ${a.irrelevantRemoved}`:"";n.push(`Context quality: ${a.score}/${a.threshold}${a.passed?"":" (needs review)"}${u}`)}if(g.section("Generated"),g.list(n,{bullet:"\u2713"}),console.log(""),r.git.hasChanges&&(g.warn("Uncommitted changes detected"),console.log("")),r.verification){let a=r.verification;if(a.passed){let u=a.checks.map(l=>`${l.name} (${l.durationMs}ms)`);g.section("Verified"),g.list(u,{bullet:"\u2713"})}else{g.section("Verification");let u=a.checks.map(l=>l.passed?`\u2713 ${l.name}`:`\u2717 ${l.name}${l.error?` \u2014 ${l.error}`:""}`);g.list(u),a.skippedCount>0&&g.warn(`${a.skippedCount} check(s) skipped (fail-fast)`)}console.log("")}return we("sync"),{success:!0,data:r,metrics:{elapsed:t,fileCount:r.stats.fileCount}}}m(Te,"showSyncResult");async function Ee(r){try{let e=await ge.getRecentEvents(r,100),t=new Date().toISOString().split("T")[0],o=e.filter(l=>(l.timestamp||l.ts)?.startsWith(t)),s=(()=>{if(o.length<2)return null;let l=o.map(f=>new Date(f.timestamp||f.ts).getTime()).filter(f=>!Number.isNaN(f)).sort((f,h)=>f-h);if(l.length<2)return null;let p=l[l.length-1]-l[0];return oe(p)})(),i=o.filter(l=>l.action==="task_completed").length,n=o.filter(l=>l.action==="feature_shipped").length,a=new Map;for(let l of o)if(l.action==="sync"&&Array.isArray(l.subagents))for(let p of l.subagents)a.set(p,(a.get(p)||0)+1);let u=Array.from(a.entries()).map(([l,p])=>({name:l,count:p})).sort((l,p)=>p.count-l.count);return{sessionDuration:s,tasksCompleted:i,featuresShipped:n,agentsUsed:u}}catch{return{sessionDuration:null,tasksCompleted:0,featuresShipped:0,agentsUsed:[]}}}m(Ee,"getSessionActivity");function F(r){return r>=1e6?`${(r/1e6).toFixed(1)}M`:r>=1e3?`${(r/1e3).toFixed(1)}K`:r.toLocaleString()}m(F,"formatTokens");function se(r){return r<1e3?`${Math.round(r)}ms`:`${(r/1e3).toFixed(1)}s`}m(se,"formatDuration");function Fe(r){if(r.length===0)return"";let e="\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588",t=r.map(s=>s.tokensSaved),o=Math.max(...t,1);return t.map(s=>{let i=Math.min(Math.floor(s/o*(e.length-1)),e.length-1);return e[i]}).join("")}m(Fe,"generateSparkline");function Oe(r,e,t,o,s,i){let n=[];if(n.push(`# ${t} - Stats Dashboard`),n.push(""),n.push(`_Generated: ${new Date().toLocaleString()} | Tracking since: ${o}_`),n.push(""),s){if(n.push("## Today's Activity"),n.push(""),n.push("| Metric | Value |"),n.push("|--------|-------|"),s.sessionDuration&&n.push(`| Duration | ${s.sessionDuration} |`),n.push(`| Tasks completed | ${s.tasksCompleted} |`),n.push(`| Features shipped | ${s.featuresShipped} |`),s.agentsUsed.length>0){let a=s.agentsUsed.slice(0,3).map(u=>`${u.name} (${u.count}\xD7)`).join(", ");n.push(`| Agents used | ${a} |`)}n.push("")}if(i&&(i.decisions>0||i.preferences>0)&&(n.push("## Patterns Learned"),n.push(""),n.push("| Type | Count |"),n.push("|------|-------|"),n.push(`| Decisions | ${i.learnedDecisions} confirmed (${i.decisions} total) |`),n.push(`| Preferences | ${i.preferences} |`),n.push(`| Workflows | ${i.workflows} |`),n.push("")),n.push("## Context Efficiency"),n.push(""),n.push("| Metric | Value |"),n.push("|--------|-------|"),n.push(`| Tokens reduced | ${F(r.totalTokensSaved)} |`),n.push(`| Compression | ${(r.compressionRate*100).toFixed(0)}% |`),n.push(`| Est. cost saved | ${U(r.estimatedCostSaved)} |`),n.push(""),n.push("## Performance"),n.push(""),n.push("| Metric | Value |"),n.push("|--------|-------|"),n.push(`| Syncs | ${r.syncCount} |`),n.push(`| Avg time | ${se(r.avgSyncDuration)} |`),n.push(""),r.topAgents.length>0){n.push("## Agent Usage"),n.push(""),n.push("| Agent | Usage |"),n.push("|-------|-------|");let a=r.topAgents.reduce((u,l)=>u+l.usageCount,0);for(let u of r.topAgents){let l=a>0?(u.usageCount/a*100).toFixed(0):0;n.push(`| ${u.agentName} | ${l}% (${u.usageCount}) |`)}n.push("")}if(n.push("## 30-Day Trend"),n.push(""),n.push(`- Tokens saved: ${F(r.last30DaysTokens)}`),r.trend!==0){let a=r.trend>0?"+":"";n.push(`- Trend: ${a}${r.trend.toFixed(0)}% vs previous period`)}return n.push(""),n.push("---"),n.push(""),n.push("_Generated with [prjct-cli](https://prjct.app)_"),n.join(`
14
+ `));let n=[];if(r.generatedSkills?.generated&&r.generatedSkills.generated.length>0){let a=r.generatedSkills.generated.length,u=a===1?"skill":"skills";n.push(`${a} ${u} generated`)}if(r.context7&&n.push(`Context7: ${r.context7.verified?"verified":`not ready${r.context7.message?` (${r.context7.message})`:""}`}`),r.analysisSummary&&n.push(`Analysis: ${r.analysisSummary.patterns} patterns | ${r.analysisSummary.antiPatterns} anti-patterns (${r.analysisSummary.criticalAntiPatterns} critical)`),r.contextQuality){let a=r.contextQuality,u=a.irrelevantRemoved>0||a.repairEntriesCreated>0?`, repaired ${a.repairEntriesCreated}, removed ${a.irrelevantRemoved}`:"";n.push(`Context quality: ${a.score}/${a.threshold}${a.passed?"":" (needs review)"}${u}`)}if(g.section("Generated"),g.list(n,{bullet:"\u2713"}),console.log(""),r.git.hasChanges&&(g.warn("Uncommitted changes detected"),console.log("")),r.verification){let a=r.verification;if(a.passed){let u=a.checks.map(l=>`${l.name} (${l.durationMs}ms)`);g.section("Verified"),g.list(u,{bullet:"\u2713"})}else{g.section("Verification");let u=a.checks.map(l=>l.passed?`\u2713 ${l.name}`:`\u2717 ${l.name}${l.error?` \u2014 ${l.error}`:""}`);g.list(u),a.skippedCount>0&&g.warn(`${a.skippedCount} check(s) skipped (fail-fast)`)}console.log("")}return we("sync"),{success:!0,data:r,metrics:{elapsed:t,fileCount:r.stats.fileCount}}}m(Te,"showSyncResult");async function Ee(r){try{let e=await de.getRecentEvents(r,100),t=new Date().toISOString().split("T")[0],o=e.filter(l=>(l.timestamp||l.ts)?.startsWith(t)),s=(()=>{if(o.length<2)return null;let l=o.map(f=>new Date(f.timestamp||f.ts).getTime()).filter(f=>!Number.isNaN(f)).sort((f,h)=>f-h);if(l.length<2)return null;let p=l[l.length-1]-l[0];return oe(p)})(),i=o.filter(l=>l.action==="task_completed").length,n=o.filter(l=>l.action==="feature_shipped").length,a=new Map;for(let l of o)if(l.action==="sync"&&Array.isArray(l.subagents))for(let p of l.subagents)a.set(p,(a.get(p)||0)+1);let u=Array.from(a.entries()).map(([l,p])=>({name:l,count:p})).sort((l,p)=>p.count-l.count);return{sessionDuration:s,tasksCompleted:i,featuresShipped:n,agentsUsed:u}}catch{return{sessionDuration:null,tasksCompleted:0,featuresShipped:0,agentsUsed:[]}}}m(Ee,"getSessionActivity");function F(r){return r>=1e6?`${(r/1e6).toFixed(1)}M`:r>=1e3?`${(r/1e3).toFixed(1)}K`:r.toLocaleString()}m(F,"formatTokens");function se(r){return r<1e3?`${Math.round(r)}ms`:`${(r/1e3).toFixed(1)}s`}m(se,"formatDuration");function Fe(r){if(r.length===0)return"";let e="\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588",t=r.map(s=>s.tokensSaved),o=Math.max(...t,1);return t.map(s=>{let i=Math.min(Math.floor(s/o*(e.length-1)),e.length-1);return e[i]}).join("")}m(Fe,"generateSparkline");function Oe(r,e,t,o,s,i){let n=[];if(n.push(`# ${t} - Stats Dashboard`),n.push(""),n.push(`_Generated: ${new Date().toLocaleString()} | Tracking since: ${o}_`),n.push(""),s){if(n.push("## Today's Activity"),n.push(""),n.push("| Metric | Value |"),n.push("|--------|-------|"),s.sessionDuration&&n.push(`| Duration | ${s.sessionDuration} |`),n.push(`| Tasks completed | ${s.tasksCompleted} |`),n.push(`| Features shipped | ${s.featuresShipped} |`),s.agentsUsed.length>0){let a=s.agentsUsed.slice(0,3).map(u=>`${u.name} (${u.count}\xD7)`).join(", ");n.push(`| Agents used | ${a} |`)}n.push("")}if(i&&(i.decisions>0||i.preferences>0)&&(n.push("## Patterns Learned"),n.push(""),n.push("| Type | Count |"),n.push("|------|-------|"),n.push(`| Decisions | ${i.learnedDecisions} confirmed (${i.decisions} total) |`),n.push(`| Preferences | ${i.preferences} |`),n.push(`| Workflows | ${i.workflows} |`),n.push("")),n.push("## Context Efficiency"),n.push(""),n.push("| Metric | Value |"),n.push("|--------|-------|"),n.push(`| Tokens reduced | ${F(r.totalTokensSaved)} |`),n.push(`| Compression | ${(r.compressionRate*100).toFixed(0)}% |`),n.push(`| Est. cost saved | ${U(r.estimatedCostSaved)} |`),n.push(""),n.push("## Performance"),n.push(""),n.push("| Metric | Value |"),n.push("|--------|-------|"),n.push(`| Syncs | ${r.syncCount} |`),n.push(`| Avg time | ${se(r.avgSyncDuration)} |`),n.push(""),r.topAgents.length>0){n.push("## Agent Usage"),n.push(""),n.push("| Agent | Usage |"),n.push("|-------|-------|");let a=r.topAgents.reduce((u,l)=>u+l.usageCount,0);for(let u of r.topAgents){let l=a>0?(u.usageCount/a*100).toFixed(0):0;n.push(`| ${u.agentName} | ${l}% (${u.usageCount}) |`)}n.push("")}if(n.push("## 30-Day Trend"),n.push(""),n.push(`- Tokens saved: ${F(r.last30DaysTokens)}`),r.trend!==0){let a=r.trend>0?"+":"";n.push(`- Trend: ${a}${r.trend.toFixed(0)}% vs previous period`)}return n.push(""),n.push("---"),n.push(""),n.push("_Generated with [prjct-cli](https://prjct.app)_"),n.join(`
15
15
  `)}m(Oe,"generateStatsMarkdown");function Ie(r,e){let t=[];t.push(`# Repository Analysis
16
16
  `),t.push(`Generated: ${new Date().toLocaleString()}
17
17
  `);let o=wt.basename(e);if(t.push(`## Project: ${o}
@@ -30,12 +30,12 @@ ${JSON.stringify(o.value,null,2)}`,e)}return Me(t,e)}m(pt,"normalizeAnalysis");f
30
30
  `).slice(0,5).forEach(a=>{if(a.trim()){let[u,,l,p]=a.split("|");t.push(`- \`${u}\` ${p} (${l})`)}}),t.push("")),t.push(`## Recommendations
31
31
  `),t.push("Based on detected stack, consider generating specialized agents using `p. sync`.\n"),t.push(`---
32
32
  `),t.push("*This analysis was generated automatically. For updated information, run `p. analyze` again.*\n"),t.join(`
33
- `)}m(Ie,"generateAnalysisSummary");async function Je(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return t.result;let o=t.value,s=await q.getSummary(o),i=await q.getDailyStats(o,30),n=await Ee(o),a={decisions:0,preferences:0,workflows:0,learnedDecisions:0};if(e.json){let f={session:n,patterns:a,totalTokensSaved:s.totalTokensSaved,estimatedCostSaved:s.estimatedCostSaved,compressionRate:s.compressionRate,syncCount:s.syncCount,avgSyncDuration:s.avgSyncDuration,topAgents:s.topAgents.slice(0,5),last30DaysTokens:s.last30DaysTokens,trend:s.trend,dailyStats:i.slice(0,7)};return console.log(JSON.stringify(f)),{success:!0,data:f}}let u=(()=>{try{return _.getDoc(o,"project")?.name||"Unknown"}catch{return"Unknown"}})(),l=await q.getFirstSyncDate(o),p=l?new Date(l).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"N/A";if(console.log(""),console.log("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E"),console.log("\u2502 \u{1F4CA} prjct-cli Stats Dashboard \u2502"),console.log(`\u2502 Project: ${u.padEnd(20).slice(0,20)} | Since: ${p.padEnd(12).slice(0,12)} \u2502`),console.log("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"),console.log(""),console.log("\u{1F3AF} TODAY'S ACTIVITY"),n.sessionDuration&&console.log(` Duration: ${n.sessionDuration}`),console.log(` Tasks completed: ${n.tasksCompleted}`),console.log(` Features shipped: ${n.featuresShipped}`),n.agentsUsed.length>0){let f=n.agentsUsed.slice(0,3).map(h=>`${h.name} (${h.count}\xD7)`).join(", ");console.log(` Agents used: ${f}`)}if(console.log(""),(a.decisions>0||a.preferences>0)&&(console.log("\u{1F9E0} PATTERNS LEARNED"),console.log(` Decisions: ${a.learnedDecisions} confirmed (${a.decisions} total)`),console.log(` Preferences: ${a.preferences} saved`),console.log(` Workflows: ${a.workflows} tracked`),console.log("")),console.log("\u{1F4B0} TOKEN SAVINGS"),console.log(` Total saved: ${F(s.totalTokensSaved)} tokens`),console.log(` Compression: ${(s.compressionRate*100).toFixed(0)}% average reduction`),console.log(` Estimated cost: ${U(s.estimatedCostSaved)} saved`),console.log(""),console.log("\u26A1 PERFORMANCE"),console.log(` Syncs completed: ${s.syncCount.toLocaleString()}`),console.log(` Avg sync time: ${se(s.avgSyncDuration)}`),console.log(""),s.topAgents.length>0){console.log("\u{1F916} AGENT USAGE (all time)");let f=s.topAgents.reduce((h,x)=>h+x.usageCount,0);for(let h of s.topAgents){let x=f>0?(h.usageCount/f*100).toFixed(0):0;console.log(` ${h.agentName.padEnd(12)}: ${x}% (${h.usageCount} uses)`)}console.log("")}if(i.length>0){console.log("\u{1F4C8} TREND (last 30 days)");let f=Fe(i);if(console.log(` ${f} ${F(s.last30DaysTokens)} tokens saved`),s.trend!==0){let h=s.trend>0?"\u2191":"\u2193",x=s.trend>0?"+":"";console.log(` ${h} ${x}${s.trend.toFixed(0)}% vs previous 30 days`)}console.log("")}if(console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),console.log("Export: prjct stats --export > stats.md"),console.log(""),e.export){let f=Oe(s,i,u,p,n,a);return console.log(f),{success:!0,data:{markdown:f}}}return{success:!0,data:{...s,session:n,patterns:a}}}catch(t){return console.error("\u274C Error:",$(t)),A(t)}}m(Je,"stats");async function _e(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return e.json&&console.log(JSON.stringify({success:!1,error:"No project ID found"})),t.result;let o=t.value,s=await b.diff(o);if(!s){let i="Cannot compute diff: need both a sealed and a draft analysis. Run `p. sync` to create a draft.";return e.json?console.log(JSON.stringify({success:!1,error:i})):e.md?console.log(y("## Analysis Diff",`> ${i}`)):g.warn(i),{success:!1,error:i}}if(e.json)return console.log(JSON.stringify({success:!0,...s})),{success:!0,data:s};if(e.md)return console.log(y(G(s))),{success:!0,data:s};if(!s.hasChanges)g.done("No changes between draft and sealed analysis");else{g.section("Analysis Diff"),console.log(ye(s)),console.log("");let i=[];s.summary.added>0&&i.push(`${s.summary.added} added`),s.summary.removed>0&&i.push(`${s.summary.removed} removed`),s.summary.changed>0&&i.push(`${s.summary.changed} changed`),g.done(i.join(", "))}return console.log(""),{success:!0,data:s}}catch(t){let o=$(t);return e.json?console.log(JSON.stringify({success:!1,error:o})):e.md?console.log(y("## Diff Failed",`> ${o}`)):g.fail(o),{success:!1,error:o}}}m(_e,"diff");var Ge=["> Review this project data and save durable notes for future AI agents (architecture, conventions, risks, gotchas).","> **Prefer schema v1 JSON** with: architecture{style,insights,domains}, patterns[], antiPatterns[], techDebt[], riskAreas[], refactorSuggestions[], projectInsights[], conventions[], optional stack/commands. See core/schemas/llm-analysis.ts.","> Markdown alone saves style=unknown and empty patterns (thin notes) \u2014 agents then retry and burn tokens. Use markdown only to append insight bullets when a rich analysis already exists.","> Save path: write the JSON file, then `prjct analysis-save-llm <file> --md`."].join(`
33
+ `)}m(Ie,"generateAnalysisSummary");async function Je(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return t.result;let o=t.value,s=await q.getSummary(o),i=await q.getDailyStats(o,30),n=await Ee(o),a={decisions:0,preferences:0,workflows:0,learnedDecisions:0};if(e.json){let f={session:n,patterns:a,totalTokensSaved:s.totalTokensSaved,estimatedCostSaved:s.estimatedCostSaved,compressionRate:s.compressionRate,syncCount:s.syncCount,avgSyncDuration:s.avgSyncDuration,topAgents:s.topAgents.slice(0,5),last30DaysTokens:s.last30DaysTokens,trend:s.trend,dailyStats:i.slice(0,7)};return console.log(JSON.stringify(f)),{success:!0,data:f}}let u=(()=>{try{return _.getDoc(o,"project")?.name||"Unknown"}catch{return"Unknown"}})(),l=await q.getFirstSyncDate(o),p=l?new Date(l).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"N/A";if(console.log(""),console.log("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E"),console.log("\u2502 \u{1F4CA} prjct-cli Stats Dashboard \u2502"),console.log(`\u2502 Project: ${u.padEnd(20).slice(0,20)} | Since: ${p.padEnd(12).slice(0,12)} \u2502`),console.log("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"),console.log(""),console.log("\u{1F3AF} TODAY'S ACTIVITY"),n.sessionDuration&&console.log(` Duration: ${n.sessionDuration}`),console.log(` Tasks completed: ${n.tasksCompleted}`),console.log(` Features shipped: ${n.featuresShipped}`),n.agentsUsed.length>0){let f=n.agentsUsed.slice(0,3).map(h=>`${h.name} (${h.count}\xD7)`).join(", ");console.log(` Agents used: ${f}`)}if(console.log(""),(a.decisions>0||a.preferences>0)&&(console.log("\u{1F9E0} PATTERNS LEARNED"),console.log(` Decisions: ${a.learnedDecisions} confirmed (${a.decisions} total)`),console.log(` Preferences: ${a.preferences} saved`),console.log(` Workflows: ${a.workflows} tracked`),console.log("")),console.log("\u{1F4B0} TOKEN SAVINGS"),console.log(` Total saved: ${F(s.totalTokensSaved)} tokens`),console.log(` Compression: ${(s.compressionRate*100).toFixed(0)}% average reduction`),console.log(` Estimated cost: ${U(s.estimatedCostSaved)} saved`),console.log(""),console.log("\u26A1 PERFORMANCE"),console.log(` Syncs completed: ${s.syncCount.toLocaleString()}`),console.log(` Avg sync time: ${se(s.avgSyncDuration)}`),console.log(""),s.topAgents.length>0){console.log("\u{1F916} AGENT USAGE (all time)");let f=s.topAgents.reduce((h,x)=>h+x.usageCount,0);for(let h of s.topAgents){let x=f>0?(h.usageCount/f*100).toFixed(0):0;console.log(` ${h.agentName.padEnd(12)}: ${x}% (${h.usageCount} uses)`)}console.log("")}if(i.length>0){console.log("\u{1F4C8} TREND (last 30 days)");let f=Fe(i);if(console.log(` ${f} ${F(s.last30DaysTokens)} tokens saved`),s.trend!==0){let h=s.trend>0?"\u2191":"\u2193",x=s.trend>0?"+":"";console.log(` ${h} ${x}${s.trend.toFixed(0)}% vs previous 30 days`)}console.log("")}if(console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),console.log("Export: prjct stats --export > stats.md"),console.log(""),e.export){let f=Oe(s,i,u,p,n,a);return console.log(f),{success:!0,data:{markdown:f}}}return{success:!0,data:{...s,session:n,patterns:a}}}catch(t){return console.error("\u274C Error:",$(t)),A(t)}}m(Je,"stats");async function _e(r=process.cwd(),e={}){try{let t=await w(r);if(!t.ok)return e.json&&console.log(JSON.stringify({success:!1,error:"No project ID found"})),t.result;let o=t.value,s=await b.diff(o);if(!s){let i="Cannot compute diff: need both a sealed and a draft analysis. Run `p. sync` to create a draft.";return e.json?console.log(JSON.stringify({success:!1,error:i})):e.md?console.log(y("## Analysis Diff",`> ${i}`)):g.warn(i),{success:!1,error:i}}if(e.json)return console.log(JSON.stringify({success:!0,...s})),{success:!0,data:s};if(e.md)return console.log(y(G(s))),{success:!0,data:s};if(!s.hasChanges)g.done("No changes between draft and sealed analysis");else{g.section("Analysis Diff"),console.log(Se(s)),console.log("");let i=[];s.summary.added>0&&i.push(`${s.summary.added} added`),s.summary.removed>0&&i.push(`${s.summary.removed} removed`),s.summary.changed>0&&i.push(`${s.summary.changed} changed`),g.done(i.join(", "))}return console.log(""),{success:!0,data:s}}catch(t){let o=$(t);return e.json?console.log(JSON.stringify({success:!1,error:o})):e.md?console.log(y("## Diff Failed",`> ${o}`)):g.fail(o),{success:!1,error:o}}}m(_e,"diff");var Ge=["> Review this project data and save durable notes for future AI agents (architecture, conventions, risks, gotchas).","> **Prefer schema v1 JSON** with: architecture{style,insights,domains}, patterns[], antiPatterns[], techDebt[], riskAreas[], refactorSuggestions[], projectInsights[], conventions[], optional stack/commands. See core/schemas/llm-analysis.ts.","> Markdown alone saves style=unknown and empty patterns (thin notes) \u2014 agents then retry and burn tokens. Use markdown only to append insight bullets when a rich analysis already exists.","> Save path: write the JSON file, then `prjct analysis-save-llm <file> --md`."].join(`
34
34
  `),Ue=class extends $e{static{m(this,"AnalysisCommands")}async analyze(e={},t=process.cwd()){try{await this.initializeAgent(),console.log(`\u{1F50D} Analyzing repository...
35
35
  `),S.init(t);let o={packageJson:await S.readPackageJson(),cargoToml:await S.readCargoToml(),goMod:await S.readGoMod(),requirements:await S.readRequirements(),directories:await S.listDirectories(),fileCount:await S.countFiles(),gitStats:await S.getGitStats(),gitLog:await S.getGitLog(20),hasDockerfile:await S.fileExists("Dockerfile"),hasDockerCompose:await S.fileExists("docker-compose.yml"),hasReadme:await S.fileExists("README.md"),hasTsconfig:await S.fileExists("tsconfig.json"),hasViteConfig:await S.fileExists("vite.config.ts")||await S.fileExists("vite.config.js"),hasNextConfig:await S.fileExists("next.config.js")||await S.fileExists("next.config.mjs")},s=Ie(o,t);return await this.logToMemory(t,"repository_analyzed",{timestamp:I(),fileCount:o.fileCount,gitCommits:o.gitStats.totalCommits}),console.log(`\u2705 Analysis complete!
36
36
  `),console.log(s),console.log(`
37
37
  Next steps:`),console.log("\u2022 p. sync \u2192 Generate agents based on stack"),console.log('\u2022 p. work "<intent>" \u2192 Start a work cycle'),{success:!0,summary:s,data:o}}catch(o){return console.error("\u274C Error:",$(o)),A(o)}}async sync(e=process.cwd(),t={}){try{let o=await w(e);if(!o.ok)return o.result;let s=o.value,i=Date.now();if(t.package){let a=await ie.detectMonorepo(e);if(!a.isMonorepo)return{success:!1,error:"Not a monorepo. --package flag only works in monorepos."};let u=a.packages.find(p=>p.name===t.package||p.relativePath===t.package);if(!u){let p=a.packages.map(f=>f.name).join(", ");return{success:!1,error:`Package "${t.package}" not found. Available: ${p}`}}let l=await H.sync(e,{packagePath:u.path,packageName:u.name});return t.json?console.log(JSON.stringify({success:l.success,package:u.name,path:u.relativePath})):t.md?console.log(y(R(`Synced package: ${u.name}`))):g.done(`Synced package: ${u.name}`),{success:l.success}}t.md||g.spin("Syncing project...");let n=await H.sync(e,{full:t.full});if(!n.success)return t.md?console.log(y("## Sync Failed",`> ${n.error||"Unknown error"}`)):g.fail(n.error||"Sync failed"),{success:!1,error:n.error};if(t.md||g.stop(),t.md){let a=Date.now()-i,u=n.generatedSkills?.generated?.length??0,l=await b.diff(s).then(d=>d?.hasChanges?G(d):null).catch(()=>null),p=n.git.recentCommits[0]?.hash??null,h=p&&D.isCurrent(s,p)?null:await ee(s,e,n.git,n.stats).then(d=>["## Analysis Payload",Ge,"### Data","```json",JSON.stringify(d),"```"].join(`
38
- `)).catch(()=>"### Next: Run `prjct analysis-payload --md` to update project analysis"),x=ke("sync",!0),B=(()=>{try{let d=fe.recall(s,{types:["context"],limit:5}).map(O=>`- ${pe(O)} \`${O.id}\``);return d.length>0?["### Evaluate recent context","Task contexts captured recently \u2014 fold their decisions, patterns and","anti-patterns into the project analysis (and supersede anything now wrong):","",...d].join(`
38
+ `)).catch(()=>"### Next: Run `prjct analysis-payload --md` to update project analysis"),x=ke("sync",!0),B=(()=>{try{let d=he.recall(s,{types:["context"],limit:5}).map(O=>`- ${fe(O)} \`${O.id}\``);return d.length>0?["### Evaluate recent context","Task contexts captured recently \u2014 fold their decisions, patterns and","anti-patterns into the project analysis (and supersede anything now wrong):","",...d].join(`
39
39
  `):null}catch{return null}})(),T=n.syncMetrics?.indexes,P={Duration:`${(a/1e3).toFixed(1)}s`,Skills:`${u} generated`,"Files indexed":n.stats.fileCount};if(T?.bm25Files){let d=T.bm25Files*(T.bm25AvgTokens||0);P["Tokens indexed"]=`${Math.round(d/1e3)}K`,P["Import edges"]=T.importEdges||0,P["Co-change commits"]=T.cochangeCommits||0}n.contextQuality&&(P["Context quality"]=`${n.contextQuality.score}/${n.contextQuality.threshold}`+(n.contextQuality.passed?"":" needs review"),P["Context removed"]=n.contextQuality.irrelevantRemoved,P["Context repairs"]=n.contextQuality.repairEntriesCreated);let Q=(()=>{if(!n.retentionDryRun)return null;let d=n.retentionDryRun,O=d.dryRun===!1?"applied":"dry-run",Ve=d.dryRun===!1?` \xB7 acted: ${d.archived??0} archived, ${d.deleted??0} deleted`+(d.inboxMerged||d.inboxArchived?`, inbox ${d.inboxMerged??0} merged/${d.inboxArchived??0} archived`:""):"";if(P[`Retention (${O})`]=`${d.active} active \xB7 ${d.archive} archive \xB7 ${d.delete} delete${Ve}`,d.vault){let v=d.vault,W=d.dryRun===!1?` \xB7 purged: hard\u0394${v.softDeletedPurged??0} distill\u0394${v.distilledDiscarded??0} digests+${v.digestsWritten??0} arch\u0394${v.archivesPruned??0}`:"";P.Vault=`${v.live} live \xB7 soft-del ${v.softDeleted} \xB7 archives ${v.archives} \xB7 auto ${v.autoSourceLive}${W}`}return d.samples.length>0?L(d.dryRun===!1?"Retention (Rho) \u2014 worst excess/score (actions applied)":"Retention (Rho) dry-run \u2014 worst excess/score (nothing removed)",N(d.samples.map(v=>{let W="excess"in v&&typeof v.excess=="number"?` excess=${v.excess.toFixed(2)}`:"";return`\`${v.id}\` [${v.type}] ${v.verdict} (${v.score}${W}) \u2014 ${v.reasons.join(", ")}`}))):null})(),qe=n.projectStyle?.evolutionMd?n.projectStyle.evolutionMd:n.projectStyle?.summary?["## Project style","",n.projectStyle.summary,"",`Coverage: ${n.projectStyle.styleCoverage}/100 \xB7 ${n.projectStyle.patternCount} patterns \xB7 ${n.projectStyle.conventionCount} conventions \xB7 ${n.projectStyle.antiPatternCount} anti-patterns`].join(`
40
40
  `):null,He=n.developerSnapshotCaptured?await import("./developer-evolution-R5BXQH6G.mjs").then(({renderDeveloperEvolution:d})=>d(s,4)).catch(()=>`## Developer evolution
41
41
 
@@ -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 n}from"./chunk-HIFIDMH5.mjs";import"./chunk-HZIORCPO.mjs";import"./chunk-WDGDFXSB.mjs";import"./chunk-NWY5M34K.mjs";import"./chunk-OGOCHZ3S.mjs";import"./chunk-DYHYDHCW.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3JUE6MNF.mjs";import"./chunk-3FBCOCPD.mjs";import"./chunk-YUOTOCKK.mjs";import"./chunk-BISPGBNN.mjs";import"./chunk-LT5WSSQO.mjs";import"./chunk-HJ4HEI45.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./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-BUDZL4DW.mjs";import{a as t}from"./chunk-E66B27AL.mjs";async function c(u,o){try{let e=o??await import("./config-manager-YZANYLPV.mjs").then(({default:a})=>a.readConfig(u).catch(()=>null));if(!e?.projectId||!e.cloud?.enabled||e.cloud.paused)return{ran:!1};if(!await n.hasAuth())return{ran:!1};let r=await n.sync(e.projectId,{include:e.cloud.include??{}});return{ran:!0,pushed:r.pushed?.count??0,pulled:r.pulled?.count??0,error:r.success?void 0:r.error}}catch{return{ran:!1}}}t(c,"flushIfLinked");export{c as flushIfLinked};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{i as a}from"./chunk-IKUGYUAI.mjs";import"./chunk-M3ZOJVPA.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-DGQYQSUK.mjs";import"./chunk-RRWPDRYR.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-UQVJQME2.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-W5OWBOLH.mjs";import"./chunk-MEQS4VPO.mjs";import"./chunk-HDHVBB6Q.mjs";import"./chunk-CE4RCNC7.mjs";import"./chunk-AKIN5WSQ.mjs";import"./chunk-HDSS6UB3.mjs";import"./chunk-JQE2F2RK.mjs";import"./chunk-WUHGODSQ.mjs";import"./chunk-SVZHJZ5T.mjs";import"./chunk-CTWZQ7YI.mjs";import"./chunk-GCKILEXJ.mjs";import"./chunk-D4S3IRD3.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as captureGate};
8
+ import{i as a}from"./chunk-BZ5UR7G3.mjs";import"./chunk-OL6ITIAZ.mjs";import"./chunk-Y5NQV46G.mjs";import"./chunk-DXQMKW2B.mjs";import"./chunk-OP467HW6.mjs";import"./chunk-DGBDMUBL.mjs";import"./chunk-GAOQHD5S.mjs";import"./chunk-DVBBB5BS.mjs";import"./chunk-UUULLTQV.mjs";import"./chunk-3LG3ACQV.mjs";import"./chunk-AOPJ4Z6O.mjs";import"./chunk-AUUWQH3S.mjs";import"./chunk-OLKNK2HB.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-ZX6BC2EB.mjs";import"./chunk-PKDYFXMI.mjs";import"./chunk-BUDZL4DW.mjs";import"./chunk-E66B27AL.mjs";export{a as captureGate};
@@ -5,9 +5,9 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{b as u}from"./chunk-3FBCOCPD.mjs";import{a as N,b as f}from"./chunk-W5OWBOLH.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))}
8
+ import{b as u}from"./chunk-3FBCOCPD.mjs";import{a as N,b as f}from"./chunk-OLKNK2HB.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
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
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
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
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-ZYFCFU7N.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};
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-QBSY272P.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};
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{b as x}from"./chunk-SJ75V4WG.mjs";import{d as M}from"./chunk-A5MUSARI.mjs";import{a as f}from"./chunk-RRWPDRYR.mjs";import{b as C}from"./chunk-AOPJ4Z6O.mjs";import{a as o}from"./chunk-E66B27AL.mjs";var q=new Set(["pattern-detector-auto","pattern-detector-recurring","skill-miss-detector","friction-detector"]);function E(t){if(t.type==="improvement-signal")return!0;let e=t.tags?.source;return e!==void 0&&q.has(e)}o(E,"isSignalEntry");var R=85,S=2;async function K(t,e,n={}){let a=n.threshold??R,d=n.maxIterations??S,i=await import("./retention-D2MVQLOF.mjs").then(({evaluateRetention:s})=>s(e,Date.now()).byId).catch(()=>null),h=o(async(s,c,g,m)=>{if(s>=d||c.score>=a)return{...c,irrelevantRemoved:g,repairEntriesCreated:m};let r=f.allEntriesForIndex(e),p=r.filter(l=>{if(!w(l))return!1;let b=i?.get(l.id);return!(b&&b.verdict==="active"&&b.score>=70)}),u=I(r)?0:1;u>0&&await f.remember(t,{type:"context",content:_(r,c),tags:{context_schema:"living-v2",synthesis:"model-authored",feature:"context-quality-cleanup",key_data:`quality_score=${c.score}; threshold=${a}; irrelevant=${p.length}`,model:"prjct sync context-quality analyzer",token_usage:"0 deterministic sync tokens",source:"sync-context-quality"},provenance:"inferred",projectId:e});let y=[];for(let l of p)f.forget(e,l.id)&&(y.push(l.id),await C({projectId:e,entityType:"memories",entityId:l.id,eventType:"delete",data:{id:l.id,type:l.type,content:l.content,tags:l.tags,reason:"context-quality-cleanup"}}));let $={...k(e,a),iterations:s+1,irrelevantRemoved:g+y.length,repairEntriesCreated:m+u};return p.length===0&&u===0?$:h(s+1,$,g+y.length,m+u)},"repairIteration");return h(0,k(e,a),0,0)}o(K,"repairContextQuality");function k(t,e=R){let n=f.allEntriesForIndex(t),a=n.filter(r=>r.type==="context"),d=a.filter(v),i=a.filter(r=>!v(r)),h=n.filter(w),s=[],c=[];n.length>0&&d.length===0&&(c.push(35),s.push("missing living-v2 context synthesis")),h.length>0&&(c.push(Math.min(40,h.length*8)),s.push(`${h.length} irrelevant generated entries in active context`)),i.length>0&&(c.push(Math.min(20,i.length*5)),s.push(`${i.length} legacy context entries need cleanup`));let g=d[0];if(g){let r=x(g.content),u=[r.contextSynthesis,r.keyData,r.model,r.tokenUsage,r.nextImplication].filter(y=>!y).length;u>0&&(c.push(u*4),s.push("latest living context is missing structured UI/LLM fields"))}let m=Math.max(0,Math.min(100,100-c.reduce((r,p)=>r+p,0)));return{score:m,threshold:e,passed:m>=e,iterations:0,livingContextCount:d.length,legacyContextCount:i.length,irrelevantRemoved:0,repairEntriesCreated:0,issues:s}}o(k,"evaluateContextQuality");function w(t){return E(t)?!0:t.tags?.source==="sync-context-quality"||t.type!=="context"||v(t)?!1:L(t)}o(w,"isIrrelevantGeneratedContext");function v(t){if(t.tags?.context_schema==="living-v2")return!0;let e=x(t.content);return!!(e.contextSynthesis&&e.keyData)}o(v,"isLivingV2Context");function I(t){return t.some(e=>e.type==="context"&&v(e))}o(I,"hasUsableLivingContext");function L(t){let e=t.content.trim();if(e.length<260||/User pushback:|raw quote|transcript|hot file|skill-miss/i.test(e))return!0;let n=x(e);return[n.whatHappened,n.whyItMattered,n.pattern,n.antiPattern,n.outcome,n.nextImplication].filter(Boolean).length<3}o(L,"isLowValueLegacyContext");function _(t,e){let n=t.filter(i=>!w(i)).filter(i=>["decision","gotcha","learning","context","shipped"].includes(i.type)).slice(0,8),a=n.length>0?n.map(i=>`${i.type}:${M(i)}`).join("; "):"No high-quality prior context survived cleanup.";return["Context synthesis: Sync repaired historical low-quality project context by removing generated telemetry and preserving the useful project knowledge as a living-v2 synthesis. Future agents should trust this synthesized layer over old raw detector rows or legacy context snippets.",`Key data: ${[`quality_score=${e.score}`,`threshold=${e.threshold}`,`legacy_context=${e.legacyContextCount}`,`issues=${e.issues.join("|")||"none"}`].join("; ")}`,"What happened: prjct sync detected that active context quality was below the required threshold and generated a replacement synthesis before deleting irrelevant generated entries.","Why it mattered: Existing users had accumulated low-signal context over time; leaving it active makes the second brain noisy for both the UI and LLM retrieval.","Who/author: prjct sync","Model: prjct sync context-quality analyzer","Token usage: 0 deterministic sync tokens","Sentiment: cleanup required because raw generated context had become product debt","Related files: generated from existing project memory during sync","Feature/domain: context-quality-cleanup","Pattern: Keep structured key data for UI representation and synthesized context for humans/LLMs.","Anti-pattern: Surfacing raw detector rows, hot-file counters, or short legacy snippets as durable project knowledge.","Decision/trap: Generated garbage is hard-deleted from active recall/vault/search; user-authored decisions, gotchas, learnings, and facts are preserved.",`Outcome: Repair synthesis created from surviving highlights: ${a}`,"Next implication: If quality remains below threshold, run full sync/analysis and inspect remaining user-authored entries manually instead of deleting them blindly."].join(" \xB7 ")}o(_,"buildRepairContext");export{K as a,w as b};
8
+ import{b as x}from"./chunk-SJ75V4WG.mjs";import{d as M}from"./chunk-WSFHSXBZ.mjs";import{a as f}from"./chunk-DGBDMUBL.mjs";import{b as C}from"./chunk-AOPJ4Z6O.mjs";import{a as o}from"./chunk-E66B27AL.mjs";var q=new Set(["pattern-detector-auto","pattern-detector-recurring","skill-miss-detector","friction-detector"]);function E(t){if(t.type==="improvement-signal")return!0;let e=t.tags?.source;return e!==void 0&&q.has(e)}o(E,"isSignalEntry");var R=85,S=2;async function K(t,e,n={}){let a=n.threshold??R,d=n.maxIterations??S,i=await import("./retention-E7WGFL47.mjs").then(({evaluateRetention:s})=>s(e,Date.now()).byId).catch(()=>null),h=o(async(s,c,g,m)=>{if(s>=d||c.score>=a)return{...c,irrelevantRemoved:g,repairEntriesCreated:m};let r=f.allEntriesForIndex(e),p=r.filter(l=>{if(!w(l))return!1;let b=i?.get(l.id);return!(b&&b.verdict==="active"&&b.score>=70)}),u=I(r)?0:1;u>0&&await f.remember(t,{type:"context",content:_(r,c),tags:{context_schema:"living-v2",synthesis:"model-authored",feature:"context-quality-cleanup",key_data:`quality_score=${c.score}; threshold=${a}; irrelevant=${p.length}`,model:"prjct sync context-quality analyzer",token_usage:"0 deterministic sync tokens",source:"sync-context-quality"},provenance:"inferred",projectId:e});let y=[];for(let l of p)f.forget(e,l.id)&&(y.push(l.id),await C({projectId:e,entityType:"memories",entityId:l.id,eventType:"delete",data:{id:l.id,type:l.type,content:l.content,tags:l.tags,reason:"context-quality-cleanup"}}));let $={...k(e,a),iterations:s+1,irrelevantRemoved:g+y.length,repairEntriesCreated:m+u};return p.length===0&&u===0?$:h(s+1,$,g+y.length,m+u)},"repairIteration");return h(0,k(e,a),0,0)}o(K,"repairContextQuality");function k(t,e=R){let n=f.allEntriesForIndex(t),a=n.filter(r=>r.type==="context"),d=a.filter(v),i=a.filter(r=>!v(r)),h=n.filter(w),s=[],c=[];n.length>0&&d.length===0&&(c.push(35),s.push("missing living-v2 context synthesis")),h.length>0&&(c.push(Math.min(40,h.length*8)),s.push(`${h.length} irrelevant generated entries in active context`)),i.length>0&&(c.push(Math.min(20,i.length*5)),s.push(`${i.length} legacy context entries need cleanup`));let g=d[0];if(g){let r=x(g.content),u=[r.contextSynthesis,r.keyData,r.model,r.tokenUsage,r.nextImplication].filter(y=>!y).length;u>0&&(c.push(u*4),s.push("latest living context is missing structured UI/LLM fields"))}let m=Math.max(0,Math.min(100,100-c.reduce((r,p)=>r+p,0)));return{score:m,threshold:e,passed:m>=e,iterations:0,livingContextCount:d.length,legacyContextCount:i.length,irrelevantRemoved:0,repairEntriesCreated:0,issues:s}}o(k,"evaluateContextQuality");function w(t){return E(t)?!0:t.tags?.source==="sync-context-quality"||t.type!=="context"||v(t)?!1:L(t)}o(w,"isIrrelevantGeneratedContext");function v(t){if(t.tags?.context_schema==="living-v2")return!0;let e=x(t.content);return!!(e.contextSynthesis&&e.keyData)}o(v,"isLivingV2Context");function I(t){return t.some(e=>e.type==="context"&&v(e))}o(I,"hasUsableLivingContext");function L(t){let e=t.content.trim();if(e.length<260||/User pushback:|raw quote|transcript|hot file|skill-miss/i.test(e))return!0;let n=x(e);return[n.whatHappened,n.whyItMattered,n.pattern,n.antiPattern,n.outcome,n.nextImplication].filter(Boolean).length<3}o(L,"isLowValueLegacyContext");function _(t,e){let n=t.filter(i=>!w(i)).filter(i=>["decision","gotcha","learning","context","shipped"].includes(i.type)).slice(0,8),a=n.length>0?n.map(i=>`${i.type}:${M(i)}`).join("; "):"No high-quality prior context survived cleanup.";return["Context synthesis: Sync repaired historical low-quality project context by removing generated telemetry and preserving the useful project knowledge as a living-v2 synthesis. Future agents should trust this synthesized layer over old raw detector rows or legacy context snippets.",`Key data: ${[`quality_score=${e.score}`,`threshold=${e.threshold}`,`legacy_context=${e.legacyContextCount}`,`issues=${e.issues.join("|")||"none"}`].join("; ")}`,"What happened: prjct sync detected that active context quality was below the required threshold and generated a replacement synthesis before deleting irrelevant generated entries.","Why it mattered: Existing users had accumulated low-signal context over time; leaving it active makes the second brain noisy for both the UI and LLM retrieval.","Who/author: prjct sync","Model: prjct sync context-quality analyzer","Token usage: 0 deterministic sync tokens","Sentiment: cleanup required because raw generated context had become product debt","Related files: generated from existing project memory during sync","Feature/domain: context-quality-cleanup","Pattern: Keep structured key data for UI representation and synthesized context for humans/LLMs.","Anti-pattern: Surfacing raw detector rows, hot-file counters, or short legacy snippets as durable project knowledge.","Decision/trap: Generated garbage is hard-deleted from active recall/vault/search; user-authored decisions, gotchas, learnings, and facts are preserved.",`Outcome: Repair synthesis created from surviving highlights: ${a}`,"Next implication: If quality remains below threshold, run full sync/analysis and inspect remaining user-authored entries manually instead of deleting them blindly."].join(" \xB7 ")}o(_,"buildRepairContext");export{K as a,w as b};
@@ -5,7 +5,7 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{a as j,b as f,d as x,e as D}from"./chunk-7OZDWT6C.mjs";import{b as A}from"./chunk-YJMWY4Y6.mjs";import{e as C,f as M,g as w,h as E,m as R}from"./chunk-NJAMZSHM.mjs";import{a as b}from"./chunk-RRWPDRYR.mjs";import{a as S,b as J,d as m,g as K}from"./chunk-HDHVBB6Q.mjs";import{a as l}from"./chunk-E66B27AL.mjs";J();import g from"node:fs/promises";import d from"node:path";K();var U=/^(main|index|app|server|cli|handler|router|bootstrap|init|start|run|default)$/i;function I(t){let e=M(t);if(!C(t))return{ready:!1,builtAt:e?.builtAt??null,symbols:0,edges:0,files:0,languages:[],kinds:[],routes:[],hotspots:[],entryCandidates:[],packages:[],note:"No symbol index. Run `prjct sync` or `prjct code reindex`."};let r=w(t),s=new Map,a=new Map,o=new Map,p=[],c=[];for(let i of r){s.set(i.kind,(s.get(i.kind)??0)+1),a.set(i.file,(a.get(i.file)??0)+1);let u=i.file.includes(".")?i.file.slice(i.file.lastIndexOf(".")):"(none)";o.set(u,(o.get(u)??0)+1),i.kind==="route"&&p.push({name:i.name,file:i.file,line:i.startLine}),i.exported&&U.test(i.name)&&(i.kind==="function"||i.kind==="class")&&!/__tests__|\.test\.|\.spec\.|fixtures?\//i.test(i.file)&&c.push({name:i.name,file:i.file,kind:i.kind})}let y=[...a.keys()],h=[],W=R(t),Y=y.length>400?y.slice(0,400):y;for(let i of Y){let u=W.get(i)??0;u>0&&h.push({file:i,fanIn:u,symbolCount:a.get(i)??0})}h.sort((i,u)=>u.fanIn-i.fanIn);let k=new Set,v=A(t);if(v)for(let i of Object.keys(v.forward).slice(0,2e3)){let u=i.includes("/")?i.slice(0,i.indexOf("/")):i;u&&!u.startsWith(".")&&k.add(u)}for(let i of y.slice(0,2e3)){let u=i.includes("/")?i.slice(0,i.indexOf("/")):".";u&&u!=="."&&k.add(u)}if(c.length<8)for(let i of r){if(c.length>=12)break;i.exported&&i.kind==="class"&&!c.some(u=>u.file===i.file)&&c.push({name:i.name,file:i.file,kind:i.kind})}return{ready:!0,builtAt:e?.builtAt??null,symbols:e?.symbolCount??r.length,edges:e?.edgeCount??0,files:e?.fileCount??a.size,languages:[...o.entries()].map(([i,u])=>({ext:i,count:u})).sort((i,u)=>u.count-i.count).slice(0,12),kinds:[...s.entries()].map(([i,u])=>({kind:i,count:u})).sort((i,u)=>u.count-i.count),routes:p.slice(0,30),hotspots:h.slice(0,15),entryCandidates:c.slice(0,15),packages:[...k].sort().slice(0,40),note:"Structural only (symbol + import graphs). Narrative architecture lives in prjct analysis / memory decisions."}}l(I,"buildArchitectureSnapshot");function T(t,e){let n=[];if(!t)return{hasChanges:!0,items:[{field:"Project style",type:"added",after:e.summary}],summary:{added:1,removed:0,changed:0},beforeCommit:null,afterCommit:e.commitHash};let r=t.payload,s=e.payload;r.stack.ecosystem!==s.stack.ecosystem&&n.push({field:"Ecosystem",type:"changed",before:r.stack.ecosystem,after:s.stack.ecosystem}),(r.stack.packageManager??"")!==(s.stack.packageManager??"")&&n.push({field:"Package manager",type:"changed",before:r.stack.packageManager??"(none)",after:s.stack.packageManager??"(none)"}),P("Languages",r.stack.languages,s.stack.languages,n),P("Frameworks",r.stack.frameworks,s.stack.frameworks,n),P("Key libraries",r.stack.keyLibraries,s.stack.keyLibraries,n),r.stack.hasTests!==s.stack.hasTests&&n.push({field:"Has tests",type:"changed",before:String(r.stack.hasTests),after:String(s.stack.hasTests)}),_("Pattern",r.patterns.map(c=>[c.key,c.name]),s.patterns.map(c=>[c.key,c.name]),n),_("Anti-pattern",r.antiPatterns.map(c=>[c.key,c.issue]),s.antiPatterns.map(c=>[c.key,c.issue]),n),_("Convention",r.conventions.map(c=>[c.key,c.rule]),s.conventions.map(c=>[c.key,c.rule]),n),r.structural.symbols!==s.structural.symbols&&(r.structural.symbols>0||s.structural.symbols>0)&&n.push({field:"Symbols",type:"changed",before:String(r.structural.symbols),after:String(s.structural.symbols)}),r.structural.files!==s.structural.files&&n.push({field:"Files",type:"changed",before:String(r.structural.files),after:String(s.structural.files)});let a=n.filter(c=>c.type==="added").length,o=n.filter(c=>c.type==="removed").length,p=n.filter(c=>c.type==="changed").length;return{hasChanges:n.length>0,items:n,summary:{added:a,removed:o,changed:p},beforeCommit:t.commitHash,afterCommit:e.commitHash}}l(T,"generateProjectStyleDiff");function O(t){if(!t.hasChanges)return`## Project evolution
8
+ import{a as j,b as f,d as x,e as D}from"./chunk-7OZDWT6C.mjs";import{b as A}from"./chunk-YJMWY4Y6.mjs";import{e as C,f as M,g as w,h as E,m as R}from"./chunk-NJAMZSHM.mjs";import{a as b}from"./chunk-DGBDMUBL.mjs";import{a as S,b as J,d as m,g as K}from"./chunk-HDHVBB6Q.mjs";import{a as l}from"./chunk-E66B27AL.mjs";J();import g from"node:fs/promises";import d from"node:path";K();var U=/^(main|index|app|server|cli|handler|router|bootstrap|init|start|run|default)$/i;function I(t){let e=M(t);if(!C(t))return{ready:!1,builtAt:e?.builtAt??null,symbols:0,edges:0,files:0,languages:[],kinds:[],routes:[],hotspots:[],entryCandidates:[],packages:[],note:"No symbol index. Run `prjct sync` or `prjct code reindex`."};let r=w(t),s=new Map,a=new Map,o=new Map,p=[],c=[];for(let i of r){s.set(i.kind,(s.get(i.kind)??0)+1),a.set(i.file,(a.get(i.file)??0)+1);let u=i.file.includes(".")?i.file.slice(i.file.lastIndexOf(".")):"(none)";o.set(u,(o.get(u)??0)+1),i.kind==="route"&&p.push({name:i.name,file:i.file,line:i.startLine}),i.exported&&U.test(i.name)&&(i.kind==="function"||i.kind==="class")&&!/__tests__|\.test\.|\.spec\.|fixtures?\//i.test(i.file)&&c.push({name:i.name,file:i.file,kind:i.kind})}let y=[...a.keys()],h=[],W=R(t),Y=y.length>400?y.slice(0,400):y;for(let i of Y){let u=W.get(i)??0;u>0&&h.push({file:i,fanIn:u,symbolCount:a.get(i)??0})}h.sort((i,u)=>u.fanIn-i.fanIn);let k=new Set,v=A(t);if(v)for(let i of Object.keys(v.forward).slice(0,2e3)){let u=i.includes("/")?i.slice(0,i.indexOf("/")):i;u&&!u.startsWith(".")&&k.add(u)}for(let i of y.slice(0,2e3)){let u=i.includes("/")?i.slice(0,i.indexOf("/")):".";u&&u!=="."&&k.add(u)}if(c.length<8)for(let i of r){if(c.length>=12)break;i.exported&&i.kind==="class"&&!c.some(u=>u.file===i.file)&&c.push({name:i.name,file:i.file,kind:i.kind})}return{ready:!0,builtAt:e?.builtAt??null,symbols:e?.symbolCount??r.length,edges:e?.edgeCount??0,files:e?.fileCount??a.size,languages:[...o.entries()].map(([i,u])=>({ext:i,count:u})).sort((i,u)=>u.count-i.count).slice(0,12),kinds:[...s.entries()].map(([i,u])=>({kind:i,count:u})).sort((i,u)=>u.count-i.count),routes:p.slice(0,30),hotspots:h.slice(0,15),entryCandidates:c.slice(0,15),packages:[...k].sort().slice(0,40),note:"Structural only (symbol + import graphs). Narrative architecture lives in prjct analysis / memory decisions."}}l(I,"buildArchitectureSnapshot");function T(t,e){let n=[];if(!t)return{hasChanges:!0,items:[{field:"Project style",type:"added",after:e.summary}],summary:{added:1,removed:0,changed:0},beforeCommit:null,afterCommit:e.commitHash};let r=t.payload,s=e.payload;r.stack.ecosystem!==s.stack.ecosystem&&n.push({field:"Ecosystem",type:"changed",before:r.stack.ecosystem,after:s.stack.ecosystem}),(r.stack.packageManager??"")!==(s.stack.packageManager??"")&&n.push({field:"Package manager",type:"changed",before:r.stack.packageManager??"(none)",after:s.stack.packageManager??"(none)"}),P("Languages",r.stack.languages,s.stack.languages,n),P("Frameworks",r.stack.frameworks,s.stack.frameworks,n),P("Key libraries",r.stack.keyLibraries,s.stack.keyLibraries,n),r.stack.hasTests!==s.stack.hasTests&&n.push({field:"Has tests",type:"changed",before:String(r.stack.hasTests),after:String(s.stack.hasTests)}),_("Pattern",r.patterns.map(c=>[c.key,c.name]),s.patterns.map(c=>[c.key,c.name]),n),_("Anti-pattern",r.antiPatterns.map(c=>[c.key,c.issue]),s.antiPatterns.map(c=>[c.key,c.issue]),n),_("Convention",r.conventions.map(c=>[c.key,c.rule]),s.conventions.map(c=>[c.key,c.rule]),n),r.structural.symbols!==s.structural.symbols&&(r.structural.symbols>0||s.structural.symbols>0)&&n.push({field:"Symbols",type:"changed",before:String(r.structural.symbols),after:String(s.structural.symbols)}),r.structural.files!==s.structural.files&&n.push({field:"Files",type:"changed",before:String(r.structural.files),after:String(s.structural.files)});let a=n.filter(c=>c.type==="added").length,o=n.filter(c=>c.type==="removed").length,p=n.filter(c=>c.type==="changed").length;return{hasChanges:n.length>0,items:n,summary:{added:a,removed:o,changed:p},beforeCommit:t.commitHash,afterCommit:e.commitHash}}l(T,"generateProjectStyleDiff");function O(t){if(!t.hasChanges)return`## Project evolution
9
9
 
10
10
  No style changes since last sync.`;let e=["## Project evolution (this sync)"];(t.beforeCommit||t.afterCommit)&&e.push(`> \`${L(t.beforeCommit)}\` \u2192 \`${L(t.afterCommit)}\``),e.push(""),e.push(`+${t.summary.added} \xB7 \u2212${t.summary.removed} \xB7 ~${t.summary.changed}`),e.push("");for(let n of t.items.slice(0,20)){let r=n.type==="added"?"+":n.type==="removed"?"\u2212":"~";n.type==="changed"?e.push(`- ${r} **${n.field}**: ${n.before} \u2192 ${n.after}`):n.type==="added"?e.push(`- ${r} **${n.field}**: ${n.after}`):e.push(`- ${r} **${n.field}**: ${n.before}`)}return e.join(`
11
11
  `)}l(O,"formatProjectStyleDiffMd");function L(t){return t?t.length>7?t.slice(0,7):t:"(none)"}l(L,"short");function P(t,e,n,r){let s=new Set(e.map(o=>o.toLowerCase())),a=new Set(n.map(o=>o.toLowerCase()));for(let o of n)s.has(o.toLowerCase())||r.push({field:t,type:"added",after:o});for(let o of e)a.has(o.toLowerCase())||r.push({field:t,type:"removed",before:o})}l(P,"diffStringArray");function _(t,e,n,r){let s=new Map(e),a=new Map(n);for(let[o,p]of a)s.has(o)?s.get(o)!==p&&r.push({field:t,type:"changed",before:s.get(o),after:p}):r.push({field:t,type:"added",after:p});for(let[o,p]of s)a.has(o)||r.push({field:t,type:"removed",before:p})}l(_,"diffKeyed");var F=50;function B(t){let e=(()=>{try{return JSON.parse(t.payload_json)}catch{return q()}})();return{id:t.id,capturedAt:t.captured_at,commitHash:t.commit_hash,source:t.source||"sync-mechanical",patternCount:t.pattern_count,antiPatternCount:t.anti_pattern_count,conventionCount:t.convention_count,frameworkCount:t.framework_count,symbolCount:t.symbol_count,fileCount:t.file_count,summary:t.summary,payload:e}}l(B,"rowToSnapshot");function q(){return{payloadVersion:1,stack:{ecosystem:"unknown",languages:[],frameworks:[],keyLibraries:[],hasTests:!1,hasDocker:!1},commands:{},conventions:[],patterns:[],antiPatterns:[],structural:{symbols:0,files:0,packages:[]},metrics:{}}}l(q,"emptyPayload");function H(t){try{let e=m.get(t,"SELECT * FROM project_style_snapshots WHERE is_active = 1 ORDER BY captured_at DESC LIMIT 1");return e?B(e):null}catch{return null}}l(H,"getActiveProjectStyle");function G(t,e=12){try{return m.query(t,"SELECT * FROM project_style_snapshots ORDER BY captured_at DESC LIMIT ?",e).map(B)}catch{return[]}}l(G,"getProjectEvolution");function St(t,e=6){let n=G(t,e);if(n.length===0)return null;let r=["## Project evolution"];if(n.length>=2){let s=n[0],a=n[n.length-1],o=s.patternCount-a.patternCount,p=s.conventionCount-a.conventionCount,c=s.fileCount-a.fileCount;r.push(`Over ${n.length} snapshots: patterns ${$(o)}, conventions ${$(p)}, files ${$(c)}.`)}for(let s of n)r.push(`- ${s.capturedAt.slice(0,10)} \u2014 ${s.summary}`);return r.join(`
@@ -5,4 +5,4 @@ import { dirname as __pathDirname } from 'path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __pathDirname(__filename);
8
- import{c as r,g as o}from"./chunk-YKMJI6TF.mjs";import{a as i}from"./chunk-E66B27AL.mjs";var s=8;function g(t,e,n=s){return o(r(t,e,n).files)}i(g,"rankLikelyFiles");function u(t,e){let n=r(t,e,s);return n.files.length===0?null:n.agentBlock||null}i(u,"buildIndexedFileCue");export{g as a,u as b};
8
+ import{c as r,g as o}from"./chunk-CPHUFXD2.mjs";import{a as i}from"./chunk-E66B27AL.mjs";var s=8;function g(t,e,n=s){return o(r(t,e,n).files)}i(g,"rankLikelyFiles");function u(t,e){let n=r(t,e,s);return n.files.length===0?null:n.agentBlock||null}i(u,"buildIndexedFileCue");export{g as a,u as b};