scip-query 0.11.0 → 0.12.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 (117) hide show
  1. package/README.md +23 -0
  2. package/dist/{chunk-3KDUITBE.js → chunk-2LQWMYG4.js} +2 -2
  3. package/dist/{chunk-KKMOB3OJ.js → chunk-2QGE5AEP.js} +2 -2
  4. package/dist/{chunk-HINMXZ6J.js → chunk-4D54JIU3.js} +2 -2
  5. package/dist/{chunk-CMHYBXJB.js → chunk-52Q4JFDW.js} +2 -2
  6. package/dist/{chunk-UIKLA3F5.js → chunk-64PRNLKP.js} +2 -2
  7. package/dist/{chunk-QJ3FK4TB.js → chunk-72MFTCU5.js} +2 -2
  8. package/dist/{chunk-7HB3CZFD.js → chunk-7ITCOJGD.js} +2 -2
  9. package/dist/{chunk-ZEKBR4OK.js → chunk-AZLKLZ5S.js} +2 -2
  10. package/dist/{chunk-ODVITBYU.js → chunk-B4VYXRCQ.js} +2 -2
  11. package/dist/{chunk-STBXCPKY.js → chunk-BCNT6ODA.js} +2 -2
  12. package/dist/{chunk-WPSS37EW.js → chunk-BP2NAIAZ.js} +2 -2
  13. package/dist/{chunk-LWOOTRHC.js → chunk-BVNO67DB.js} +2 -2
  14. package/dist/{chunk-NBXK32I6.js → chunk-CW3KZ7UF.js} +2 -2
  15. package/dist/{chunk-UMPNL7T6.js → chunk-D64L53WX.js} +2 -2
  16. package/dist/{chunk-IFSX6YVU.js → chunk-D7J6GZAG.js} +2 -2
  17. package/dist/{chunk-WQHWIVA7.js → chunk-ECVXWZ4Q.js} +2 -2
  18. package/dist/{chunk-H4LUPLEJ.js → chunk-EDB7Y442.js} +2 -2
  19. package/dist/{chunk-QXGTGE2C.js → chunk-ETU2I5JM.js} +2 -2
  20. package/dist/{chunk-VXTNADIW.js → chunk-EXKLAEB4.js} +2 -2
  21. package/dist/{chunk-MNEJYEHW.js → chunk-EZ5WDZ2Q.js} +2 -2
  22. package/dist/{chunk-DRPAQAFM.js → chunk-F5BJSNU5.js} +2 -2
  23. package/dist/{chunk-343O6EVV.js → chunk-FBCOFKEC.js} +2 -2
  24. package/dist/{chunk-H56MGERE.js → chunk-G2UBOONK.js} +2 -2
  25. package/dist/{chunk-GCN2P4EJ.js → chunk-H2NMIZFD.js} +2 -2
  26. package/dist/{chunk-GHXRVCIY.js → chunk-HSU3M25J.js} +2 -2
  27. package/dist/{chunk-PYZZBIEU.js → chunk-IRJDYTNZ.js} +2 -2
  28. package/dist/{chunk-PZS6J5YG.js → chunk-KSUZS77X.js} +2 -2
  29. package/dist/{chunk-HZKMEXA3.js → chunk-L2CX5GHZ.js} +2 -2
  30. package/dist/{chunk-X6OGDTQH.js → chunk-LFM3O5KX.js} +2 -2
  31. package/dist/{chunk-TTS75UF2.js → chunk-M72ZFN6E.js} +2 -2
  32. package/dist/chunk-MBKJ7GHT.js +102 -0
  33. package/dist/{chunk-3T2FNHIU.js → chunk-MJKJMWIM.js} +2 -2
  34. package/dist/{chunk-WFGOH2UI.js → chunk-MKM7NBZK.js} +2 -2
  35. package/dist/{chunk-3V6JQQM5.js → chunk-NKT5EMEX.js} +2 -2
  36. package/dist/{chunk-BN5SXXQS.js → chunk-NQ75OVUU.js} +2 -2
  37. package/dist/{chunk-BDRBPG7Y.js → chunk-O3WDE26W.js} +2 -2
  38. package/dist/{chunk-N2Z3CU7X.js → chunk-OPE5YXFE.js} +2 -2
  39. package/dist/{chunk-XHWLNQVZ.js → chunk-OSWF3HSF.js} +2 -2
  40. package/dist/{chunk-Y6L4LXPG.js → chunk-OVMUVXKQ.js} +2 -2
  41. package/dist/{chunk-P36UR5II.js → chunk-PH7ZFK6L.js} +2 -2
  42. package/dist/chunk-PXHPCWX5.js +2 -0
  43. package/dist/{chunk-K2HYR5A7.js → chunk-Q3B3FNCU.js} +2 -2
  44. package/dist/{chunk-7XL7J7PT.js → chunk-Q7S2DADC.js} +2 -2
  45. package/dist/{chunk-FLJJLSGB.js → chunk-RA5MTIOO.js} +2 -2
  46. package/dist/{chunk-WZLPXFZU.js → chunk-RIQED5OU.js} +2 -2
  47. package/dist/{chunk-VGMUFW3J.js → chunk-T6NGEV5I.js} +2 -2
  48. package/dist/{chunk-XMR747CP.js → chunk-T7VQG55Q.js} +2 -2
  49. package/dist/{chunk-LZNLRE4X.js → chunk-TTMKELT7.js} +2 -2
  50. package/dist/{chunk-X4O6K47U.js → chunk-UAHZ57BR.js} +2 -2
  51. package/dist/{chunk-RJMXSHKM.js → chunk-V3Z3IOWO.js} +2 -2
  52. package/dist/{chunk-M2YXL62V.js → chunk-V7CVBPWX.js} +2 -2
  53. package/dist/{chunk-C4ICAIJ4.js → chunk-YDDGCJJG.js} +2 -2
  54. package/dist/{chunk-N7PNFLGY.js → chunk-YPKBZ77R.js} +2 -2
  55. package/dist/{chunk-WGA5BBTA.js → chunk-Z3IPJKJP.js} +2 -2
  56. package/dist/{chunk-ALHNAPS2.js → chunk-ZOIPAYRP.js} +2 -2
  57. package/dist/{chunk-6Q6OFLFQ.js → chunk-ZRIOGL7F.js} +2 -2
  58. package/dist/cli.js +243 -243
  59. package/dist/index.js +1 -1
  60. package/dist/queries/affected.js +1 -1
  61. package/dist/queries/bottlenecks.js +1 -1
  62. package/dist/queries/by-kind.js +1 -1
  63. package/dist/queries/call-graph.js +1 -1
  64. package/dist/queries/change-surface.js +1 -1
  65. package/dist/queries/cleanup-plan.js +1 -1
  66. package/dist/queries/code.js +1 -1
  67. package/dist/queries/complexity-hotspots.js +1 -1
  68. package/dist/queries/complexity.js +1 -1
  69. package/dist/queries/convergence.js +1 -1
  70. package/dist/queries/coupling.js +1 -1
  71. package/dist/queries/dataflow.js +1 -1
  72. package/dist/queries/dead.js +1 -1
  73. package/dist/queries/deps.js +1 -1
  74. package/dist/queries/diff-gate.js +1 -1
  75. package/dist/queries/diff-impact.js +1 -1
  76. package/dist/queries/drift.js +1 -1
  77. package/dist/queries/duplicate-bodies.js +1 -1
  78. package/dist/queries/extract-candidates.js +1 -1
  79. package/dist/queries/fan.js +1 -1
  80. package/dist/queries/health.js +1 -1
  81. package/dist/queries/hierarchy.js +1 -1
  82. package/dist/queries/hotspots.js +1 -1
  83. package/dist/queries/imports.js +1 -1
  84. package/dist/queries/incomplete-migration.js +1 -1
  85. package/dist/queries/index.js +1 -1
  86. package/dist/queries/isolated.js +1 -1
  87. package/dist/queries/locality-candidates.js +1 -1
  88. package/dist/queries/members.js +1 -1
  89. package/dist/queries/methods.js +1 -1
  90. package/dist/queries/outline.js +1 -1
  91. package/dist/queries/passthrough-candidates.js +1 -1
  92. package/dist/queries/plan-context.js +1 -1
  93. package/dist/queries/recent-duplicates.js +1 -1
  94. package/dist/queries/redundant-reexports.js +1 -1
  95. package/dist/queries/refs.js +1 -1
  96. package/dist/queries/self-audit.js +1 -1
  97. package/dist/queries/similar-signatures.js +1 -1
  98. package/dist/queries/similar.js +1 -1
  99. package/dist/queries/slice.js +1 -1
  100. package/dist/queries/stale-abstractions.js +1 -1
  101. package/dist/queries/surface.js +1 -1
  102. package/dist/queries/symbols.js +1 -1
  103. package/dist/queries/system.js +1 -1
  104. package/dist/queries/trace.js +1 -1
  105. package/dist/queries/twin-ab.js +1 -1
  106. package/dist/queries/twin-drift.js +1 -1
  107. package/dist/queries/unused-imports.js +1 -1
  108. package/dist/queries/unused-params.js +1 -1
  109. package/dist/queries/wrapper-candidates.js +1 -1
  110. package/dist/reindex-worker.js +9 -9
  111. package/dist/reindex.d.ts +20 -1
  112. package/dist/reindex.js +19 -19
  113. package/docs/COMMAND_REFERENCE.md +2 -2
  114. package/package.json +20 -2
  115. package/skills/scip-tla-model-system/SKILL.md +17 -5
  116. package/dist/chunk-2VSDXOG5.js +0 -2
  117. package/dist/chunk-R3JY4EZ4.js +0 -102
@@ -1,2 +1,2 @@
1
- import{a as F}from"./chunk-TG7QSYCJ.js";import{a as D}from"./chunk-URSSPS5H.js";import{a as f}from"./chunk-5AAAEZ2Z.js";import{a as g}from"./chunk-J5WVNZ6O.js";import{a as h}from"./chunk-FXG3PHVW.js";import{e as y}from"./chunk-STBXCPKY.js";import{h as p}from"./chunk-GNG622H3.js";var v=.7,R=.62,S=.45;function Y(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:o}=t,s=h(i).fileAddRecords();if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let l=I(s,e);if(l.size===0)return{available:!0,windowCommits:e,findings:[]};let d=A(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:o,scope:a,semantic:t.semantic,focusFiles:Number.isFinite(n)?void 0:l}).map(r=>w(r,s,e)).filter(r=>r!==null);d.sort((r,c)=>(r.kind===c.kind?0:r.kind==="echo"?-1:1)||c.similarity-r.similarity||r.echoFile.localeCompare(c.echoFile)||r.echoSymbol.localeCompare(c.echoSymbol)||r.domain.localeCompare(c.domain));let b=d.slice(0,n).map(T);return{available:!0,windowCommits:e,findings:b,rootCauseGroups:N(b)}}function A(i,t){let e=P(t.limit),n=[...B(i,{scope:t.scope,minSimilarity:t.minSimilarity??v,limit:e,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles})],a=p(i,{scope:t.scope});return a.react&&n.push(...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),a.vue&&n.push(...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...x(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),n}function B(i,t){return y(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles}).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function k(i,t){return u(i,t,{query:f,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:K(...e.evidenceBuckets(n)),sharedCallees:[]}))}function E(i,t){return u(i,t,{query:g,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}function L(i,t){return u(i,t,{query:F,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function x(i,t){return u(i,t,{query:D,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function I(i,t){let e=new Set;for(let[n,a]of i)a.commitsAgo<=t&&e.add(n);return e}function w(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,o=n!==null&&n<=e,s=a!==null&&a<=e;if(!o&&!s)return null;if(o&&s){let l=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:l?i.symbolA:i.symbolB,echoFile:l?i.fileA:i.fileB,echoAgeCommits:(l?n:a)??0,establishedSymbol:l?i.symbolB:i.symbolA,establishedFile:l?i.fileB:i.fileA,establishedAgeCommits:l?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:o?i.symbolA:i.symbolB,echoFile:o?i.fileA:i.fileB,echoAgeCommits:(o?n:a)??0,establishedSymbol:o?i.symbolB:i.symbolA,establishedFile:o?i.fileB:i.fileA,establishedAgeCommits:o?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function T(i){let t=C(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function C(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function N(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??C(n),o=n.groupKey??`recent-duplicate:${a}`,s=t.get(o);s||(s={groupKey:o,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:O(n)},t.set(o,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let l of n.sharedEvidence)s.sharedEvidence.add(l)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function O(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function P(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function K(...i){let t=[],e=new Set;for(let[n,a]of i)for(let o of a){let s=`${n}:${o}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{Y as a};
2
- //# sourceMappingURL=chunk-N7PNFLGY.js.map
1
+ import{a as F}from"./chunk-TG7QSYCJ.js";import{a as D}from"./chunk-URSSPS5H.js";import{a as f}from"./chunk-5AAAEZ2Z.js";import{a as g}from"./chunk-J5WVNZ6O.js";import{a as h}from"./chunk-FXG3PHVW.js";import{e as y}from"./chunk-BCNT6ODA.js";import{h as p}from"./chunk-GNG622H3.js";var v=.7,R=.62,S=.45;function Y(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:o}=t,s=h(i).fileAddRecords();if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let l=I(s,e);if(l.size===0)return{available:!0,windowCommits:e,findings:[]};let d=A(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:o,scope:a,semantic:t.semantic,focusFiles:Number.isFinite(n)?void 0:l}).map(r=>w(r,s,e)).filter(r=>r!==null);d.sort((r,c)=>(r.kind===c.kind?0:r.kind==="echo"?-1:1)||c.similarity-r.similarity||r.echoFile.localeCompare(c.echoFile)||r.echoSymbol.localeCompare(c.echoSymbol)||r.domain.localeCompare(c.domain));let b=d.slice(0,n).map(T);return{available:!0,windowCommits:e,findings:b,rootCauseGroups:N(b)}}function A(i,t){let e=P(t.limit),n=[...B(i,{scope:t.scope,minSimilarity:t.minSimilarity??v,limit:e,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles})],a=p(i,{scope:t.scope});return a.react&&n.push(...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),a.vue&&n.push(...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...x(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),n}function B(i,t){return y(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles}).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function k(i,t){return u(i,t,{query:f,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:K(...e.evidenceBuckets(n)),sharedCallees:[]}))}function E(i,t){return u(i,t,{query:g,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}function L(i,t){return u(i,t,{query:F,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function x(i,t){return u(i,t,{query:D,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function I(i,t){let e=new Set;for(let[n,a]of i)a.commitsAgo<=t&&e.add(n);return e}function w(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,o=n!==null&&n<=e,s=a!==null&&a<=e;if(!o&&!s)return null;if(o&&s){let l=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:l?i.symbolA:i.symbolB,echoFile:l?i.fileA:i.fileB,echoAgeCommits:(l?n:a)??0,establishedSymbol:l?i.symbolB:i.symbolA,establishedFile:l?i.fileB:i.fileA,establishedAgeCommits:l?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:o?i.symbolA:i.symbolB,echoFile:o?i.fileA:i.fileB,echoAgeCommits:(o?n:a)??0,establishedSymbol:o?i.symbolB:i.symbolA,establishedFile:o?i.fileB:i.fileA,establishedAgeCommits:o?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function T(i){let t=C(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function C(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function N(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??C(n),o=n.groupKey??`recent-duplicate:${a}`,s=t.get(o);s||(s={groupKey:o,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:O(n)},t.set(o,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let l of n.sharedEvidence)s.sharedEvidence.add(l)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function O(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function P(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function K(...i){let t=[],e=new Set;for(let[n,a]of i)for(let o of a){let s=`${n}:${o}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{Y as a};
2
+ //# sourceMappingURL=chunk-YPKBZ77R.js.map
@@ -1,4 +1,4 @@
1
- import{a as g}from"./chunk-K6UI6EBZ.js";import{b as h}from"./chunk-PZS6J5YG.js";import{a as y}from"./chunk-X4O6K47U.js";import{d as b}from"./chunk-HXXMPYEF.js";import{d as p}from"./chunk-T2FQ4GHD.js";function v(e,n){let{scope:s,minLoc:r=10,limit:o=30,scanLimit:a}=n??{},l=new y(e);return g({candidates:()=>l.productionCallableDefinitions({scope:s,minLoc:r,requireFunctionLikeSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,profile:{name:"complexity-hotspots"},prepare:t=>{let i=B(e,t);return{callerMap:l.crossFileCallerMap(t,{semantic:n?.semantic!==!1}),calleeMap:l.calleeMap(t,{semantic:n?.semantic!==!1}),languageByFile:i,clojureCallableIds:I(e,t,i),branchEstimates:x(e,t)}},evaluate:(t,i)=>M(t,i,r),orderResults:(t,i)=>i.score-t.score||i.loc-t.loc,limit:o})}function M(e,n,s){if(n.languageByFile.get(e.relativePath)==="clojure"&&!n.clojureCallableIds.has(e.symbolId))return null;let r=e.endLine-e.startLine+1;if(r<s)return null;let o=n.callerMap.get(e.symbolId)?.size??0,a=n.calleeMap.get(e.symbolId)??[],l=new Set,t=new Set;for(let m of a){let u=`${m.symbol}|${m.file}`;l.add(u),m.file!==e.relativePath&&t.add(u)}let i=t.size,d=l.size,c=n.branchEstimates.get(e.symbolId)??{branches:0,estimateBasis:"regex-fallback"},f=c.branches+1;return{symbol:e.symbol,shortName:b(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:r,fanIn:o,fanOut:i,calleeCount:d,branches:c.branches,estimateBasis:c.estimateBasis,score:Math.round(r/50*(o/5)*Math.max(i/5,1)*Math.max(f/5,1)*100)/100}}function x(e,n){return new Map(n.map(s=>[s.symbolId,h(e,s)]))}function B(e,n){let s=[...new Set(n.map(a=>a.relativePath))];if(s.length===0)return new Map;let r=s.map(()=>"?").join(", "),o=e.all(`SELECT relative_path, language
1
+ import{a as g}from"./chunk-K6UI6EBZ.js";import{b as h}from"./chunk-KSUZS77X.js";import{a as y}from"./chunk-UAHZ57BR.js";import{d as b}from"./chunk-HXXMPYEF.js";import{d as p}from"./chunk-T2FQ4GHD.js";function v(e,n){let{scope:s,minLoc:r=10,limit:o=30,scanLimit:a}=n??{},l=new y(e);return g({candidates:()=>l.productionCallableDefinitions({scope:s,minLoc:r,requireFunctionLikeSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,profile:{name:"complexity-hotspots"},prepare:t=>{let i=B(e,t);return{callerMap:l.crossFileCallerMap(t,{semantic:n?.semantic!==!1}),calleeMap:l.calleeMap(t,{semantic:n?.semantic!==!1}),languageByFile:i,clojureCallableIds:I(e,t,i),branchEstimates:x(e,t)}},evaluate:(t,i)=>M(t,i,r),orderResults:(t,i)=>i.score-t.score||i.loc-t.loc,limit:o})}function M(e,n,s){if(n.languageByFile.get(e.relativePath)==="clojure"&&!n.clojureCallableIds.has(e.symbolId))return null;let r=e.endLine-e.startLine+1;if(r<s)return null;let o=n.callerMap.get(e.symbolId)?.size??0,a=n.calleeMap.get(e.symbolId)??[],l=new Set,t=new Set;for(let m of a){let u=`${m.symbol}|${m.file}`;l.add(u),m.file!==e.relativePath&&t.add(u)}let i=t.size,d=l.size,c=n.branchEstimates.get(e.symbolId)??{branches:0,estimateBasis:"regex-fallback"},f=c.branches+1;return{symbol:e.symbol,shortName:b(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:r,fanIn:o,fanOut:i,calleeCount:d,branches:c.branches,estimateBasis:c.estimateBasis,score:Math.round(r/50*(o/5)*Math.max(i/5,1)*Math.max(f/5,1)*100)/100}}function x(e,n){return new Map(n.map(s=>[s.symbolId,h(e,s)]))}function B(e,n){let s=[...new Set(n.map(a=>a.relativePath))];if(s.length===0)return new Map;let r=s.map(()=>"?").join(", "),o=e.all(`SELECT relative_path, language
2
2
  FROM documents
3
3
  WHERE relative_path IN (${r})`,...s);return new Map(o.map(a=>[a.relative_path,a.language?.toLowerCase()??null]))}function I(e,n,s){let r=new Set,o=new Map;for(let a of n){if(s.get(a.relativePath)!=="clojure")continue;let l=o.get(a.relativePath);l||(l=new Set((p(e,a.relativePath)?.callables??[]).map(t=>`${t.name}:${t.startLine}`)),o.set(a.relativePath,l)),l.has(`${a.leaf}:${a.startLine}`)&&r.add(a.symbolId)}return r}export{v as a};
4
- //# sourceMappingURL=chunk-WGA5BBTA.js.map
4
+ //# sourceMappingURL=chunk-Z3IPJKJP.js.map
@@ -1,2 +1,2 @@
1
- import{a as g}from"./chunk-K6UI6EBZ.js";import{a as m}from"./chunk-X4O6K47U.js";import{a as d}from"./chunk-BGBBVSH4.js";import{d as u}from"./chunk-HXXMPYEF.js";function k(n,c={}){let{scope:e,minLoc:t=10,minCallees:a=6,limit:r=20,scanLimit:i}=c,o=new m(n);return g({candidates:()=>o.productionCallableDefinitions({scope:e,minLoc:t,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,profile:{name:"extract-candidates"},prepare:s=>o.calleeMap(s,{semantic:c.semantic!==!1}),evaluate:(s,l)=>h(s,l.get(s.symbolId)??[],a),orderResults:(s,l)=>l.clusters.length-s.clusters.length||l.loc-s.loc,limit:r})}function h(n,c,e){let t=new Set(c.map(l=>l.symbol));if(t.size<e)return null;let a=S(t,c),r=y(t,a);if(r.length<2)return null;let i=C(r,a);if(i.length===0)return null;let o=u(n.symbol),s=p(o,t.size,r.length,i);return{symbol:n.symbol,shortName:o,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:d(n),totalCallees:t.size,extractionKind:s.extractionKind,actionTier:"signal",evidenceReasons:s.evidenceReasons,recommendation:s.recommendation,clusters:i}}function p(n,c,e,t){let a=Math.max(...t.map(s=>s.callees.length)),r=Math.max(...t.map(s=>s.isolation)),i=[`${c} distinct callees across ${e} co-occurrence cluster(s)`,`${t.length} extractable cluster(s) passed size and isolation thresholds`,`largest extractable cluster has ${a} callees at ${Math.round(r*100)}% isolation`],o=f(n,c,e);return o!==null?{extractionKind:"workflow-orchestration",evidenceReasons:[...i,o],recommendation:"Review the isolated helper group as a possible private or feature-local helper, but keep the orchestration sequence together when it preserves the workflow."}:a>=6?{extractionKind:"broad-helper-cluster",evidenceReasons:[...i,"one isolated helper group is broad enough to deserve a named review"],recommendation:"Review whether the broad helper cluster has a stable concept name before extracting it; avoid creating a bag-of-helpers abstraction."}:{extractionKind:"cohesive-helper-cluster",evidenceReasons:i,recommendation:"Review the isolated callee group as a possible same-file or feature-local helper; extract only if the new name preserves the current behavior."}}function f(n,c,e){if(c>=10)return`callee breadth suggests orchestration: ${c} callees`;if(e>=4)return`multiple disconnected callee groups suggest orchestration: ${e} groups`;let t=b(n);return x.has(t)?`caller verb suggests orchestration: ${t}`:null}function b(n){return n.split(":").pop()?.replace(/\(\)$/,"").replace(/[^A-Za-z0-9_]/g,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[_\s-]+/).filter(Boolean)[0]?.toLowerCase()??""}var x=new Set(["apply","build","check","collect","create","diff","execute","find","handle","load","prepare","process","render","resolve","run","select","sync","update","validate","verify","write"]);function S(n,c){let e=new Map;for(let a of n)e.set(a,new Set);let t=new Map;for(let a of c){let r=t.get(a.chunkId);r||(r=new Set,t.set(a.chunkId,r)),r.add(a.symbol)}for(let a of t.values()){let r=[...a];for(let i=0;i<r.length;i++)for(let o=i+1;o<r.length;o++)e.get(r[i]).add(r[o]),e.get(r[o]).add(r[i])}return e}function y(n,c){let e=new Set,t=[];for(let a of n){if(e.has(a))continue;let r=new Set,i=[a];for(;i.length>0;){let o=i.pop();if(!e.has(o)){e.add(o),r.add(o);for(let s of c.get(o)??[])e.has(s)||i.push(s)}}t.push(r)}return t}function C(n,c){return n.filter(e=>e.size>=3).map(e=>v(e,n,c)).filter(e=>e.isolation>.5).sort((e,t)=>t.isolation-e.isolation)}function v(n,c,e){let t=new Set;for(let o of c)if(o!==n)for(let s of o)t.add(s);let a=0;for(let o of n)for(let s of e.get(o)??[])t.has(s)&&a++;let r=n.size*t.size,i=r>0?1-a/r:1;return{callees:[...n].map(u),isolation:i}}export{k as a};
2
- //# sourceMappingURL=chunk-ALHNAPS2.js.map
1
+ import{a as g}from"./chunk-K6UI6EBZ.js";import{a as m}from"./chunk-UAHZ57BR.js";import{a as d}from"./chunk-BGBBVSH4.js";import{d as u}from"./chunk-HXXMPYEF.js";function k(n,c={}){let{scope:e,minLoc:t=10,minCallees:a=6,limit:r=20,scanLimit:i}=c,o=new m(n);return g({candidates:()=>o.productionCallableDefinitions({scope:e,minLoc:t,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,profile:{name:"extract-candidates"},prepare:s=>o.calleeMap(s,{semantic:c.semantic!==!1}),evaluate:(s,l)=>h(s,l.get(s.symbolId)??[],a),orderResults:(s,l)=>l.clusters.length-s.clusters.length||l.loc-s.loc,limit:r})}function h(n,c,e){let t=new Set(c.map(l=>l.symbol));if(t.size<e)return null;let a=S(t,c),r=y(t,a);if(r.length<2)return null;let i=C(r,a);if(i.length===0)return null;let o=u(n.symbol),s=p(o,t.size,r.length,i);return{symbol:n.symbol,shortName:o,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:d(n),totalCallees:t.size,extractionKind:s.extractionKind,actionTier:"signal",evidenceReasons:s.evidenceReasons,recommendation:s.recommendation,clusters:i}}function p(n,c,e,t){let a=Math.max(...t.map(s=>s.callees.length)),r=Math.max(...t.map(s=>s.isolation)),i=[`${c} distinct callees across ${e} co-occurrence cluster(s)`,`${t.length} extractable cluster(s) passed size and isolation thresholds`,`largest extractable cluster has ${a} callees at ${Math.round(r*100)}% isolation`],o=f(n,c,e);return o!==null?{extractionKind:"workflow-orchestration",evidenceReasons:[...i,o],recommendation:"Review the isolated helper group as a possible private or feature-local helper, but keep the orchestration sequence together when it preserves the workflow."}:a>=6?{extractionKind:"broad-helper-cluster",evidenceReasons:[...i,"one isolated helper group is broad enough to deserve a named review"],recommendation:"Review whether the broad helper cluster has a stable concept name before extracting it; avoid creating a bag-of-helpers abstraction."}:{extractionKind:"cohesive-helper-cluster",evidenceReasons:i,recommendation:"Review the isolated callee group as a possible same-file or feature-local helper; extract only if the new name preserves the current behavior."}}function f(n,c,e){if(c>=10)return`callee breadth suggests orchestration: ${c} callees`;if(e>=4)return`multiple disconnected callee groups suggest orchestration: ${e} groups`;let t=b(n);return x.has(t)?`caller verb suggests orchestration: ${t}`:null}function b(n){return n.split(":").pop()?.replace(/\(\)$/,"").replace(/[^A-Za-z0-9_]/g,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[_\s-]+/).filter(Boolean)[0]?.toLowerCase()??""}var x=new Set(["apply","build","check","collect","create","diff","execute","find","handle","load","prepare","process","render","resolve","run","select","sync","update","validate","verify","write"]);function S(n,c){let e=new Map;for(let a of n)e.set(a,new Set);let t=new Map;for(let a of c){let r=t.get(a.chunkId);r||(r=new Set,t.set(a.chunkId,r)),r.add(a.symbol)}for(let a of t.values()){let r=[...a];for(let i=0;i<r.length;i++)for(let o=i+1;o<r.length;o++)e.get(r[i]).add(r[o]),e.get(r[o]).add(r[i])}return e}function y(n,c){let e=new Set,t=[];for(let a of n){if(e.has(a))continue;let r=new Set,i=[a];for(;i.length>0;){let o=i.pop();if(!e.has(o)){e.add(o),r.add(o);for(let s of c.get(o)??[])e.has(s)||i.push(s)}}t.push(r)}return t}function C(n,c){return n.filter(e=>e.size>=3).map(e=>v(e,n,c)).filter(e=>e.isolation>.5).sort((e,t)=>t.isolation-e.isolation)}function v(n,c,e){let t=new Set;for(let o of c)if(o!==n)for(let s of o)t.add(s);let a=0;for(let o of n)for(let s of e.get(o)??[])t.has(s)&&a++;let r=n.size*t.size,i=r>0?1-a/r:1;return{callees:[...n].map(u),isolation:i}}export{k as a};
2
+ //# sourceMappingURL=chunk-ZOIPAYRP.js.map
@@ -1,8 +1,8 @@
1
- import{a as T,c as E,g as L,h as D}from"./chunk-GHXRVCIY.js";import{j as O,o as A}from"./chunk-STBXCPKY.js";import{d as H}from"./chunk-KMVGRIO2.js";import{a as _}from"./chunk-X4O6K47U.js";import{d as C,e as F}from"./chunk-HXXMPYEF.js";import{a as w}from"./chunk-T2FQ4GHD.js";var J=5;function ae(e,t={}){let{base:a="HEAD",minContainment:o=.7,minCallees:r=3,minSiteCoverage:n=.4,maxHelpers:c=Number.POSITIVE_INFINITY,limit:m=20,scanLimit:g}=t,f=t.semantic!==!1,s=t.diffPlan??E(e,{base:a}),l={available:s.note!==T,base:a,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!l.available||s.changedFiles.length===0)return l;let x=new _(e),k=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from])),j=t.baseContentAt??L(e.config.projectRoot,a,D(s)),h=Z(x,k,$,j);if(h.length===0)return l;let R=h.slice(0,c);h.length>c&&(l.note=`helper scoring capped at ${c} of ${h.length} new symbols`);let q=x.calleeMap(R,{semantic:f}),B=R.map(i=>({def:i,callees:A((q.get(i.symbolId)??[]).map(p=>p.symbol))})),V=O(e),M,G=()=>(M??=V.calleeIndex({minCallees:Math.min(3,r),scanLimit:g,semantic:f}),M);for(let{def:i,callees:p}of B){let d=C(i.symbol);if(p.size<r){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:`fewer than ${r} meaningful callees \u2014 too small to score`});continue}let P=G(),N=Y(p,P);if(N===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let b=Q(e,i.symbolId);if(b.length===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}l.helpersChecked+=1;let I=K({candidateIndex:P,changed:k,helperCallees:p,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:o,minSiteCoverage:n,migratedFiles:b});I.length!==0&&(I.sort((u,S)=>z(S.migrationScope)-z(u.migrationScope)||S.containment-u.containment||S.siteCoverage-u.siteCoverage||u.file.localeCompare(S.file)),l.findings.push({helperSymbol:i.symbol,helperShortName:d,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:p.size,specificHelperCalleeCount:N,migratedFiles:b.sort(),leftovers:I.slice(0,J)}))}return l.findings.sort((i,p)=>(p.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(p.helperFile)),l.findings=l.findings.slice(0,m),l}function K(e){let t=[],a=U(e.helperSymbol,e.helperFile,e.migratedFiles),o=new Set;for(let r of e.helperCallees)for(let n of e.candidateIndex.candidateIndexesByCallee.get(r)??[])o.add(n);for(let r of o){let n=e.candidateIndex.corpus[r];if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let c=H(e.helperCallees,n.callees);if(c<e.minContainment)continue;let m=[...e.helperCallees].filter(s=>n.callees.has(s)),g=n.callees.size===0?0:m.length/n.callees.size;if(g<e.minSiteCoverage||!m.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let f=W(a,n.symbol,n.file);t.push({symbol:n.symbol,shortName:C(n.symbol),file:n.file,...f,containment:c,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-m.length),sharedCallees:m.map(C).sort()})}return t}function z(e){return e==="same-scope"?2:e==="unknown"?1:0}function U(e,t,a){let o=new Set([...y(t),...v(F(e))]);for(let r of a)for(let n of y(r))o.add(n);return o}function W(e,t,a){let o=new Set([...y(a),...v(F(t))]);if(e.size===0||o.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let r=[...o].filter(n=>e.has(n)).sort();return r.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${r.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var X=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function y(e){return v(e.replace(/\.[^.]+$/,""))}function v(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!X.has(t))}function Y(e,t){let a=0;for(let o of e)(t.docFreq.get(o)??0)<=t.ubiquityThreshold&&(a+=1);return a}function Z(e,t,a,o){return e.productionCallableDefinitions({files:[...t],requireFunctionLikeSymbol:!0}).filter(r=>{if(!t.has(r.relativePath))return!1;let n=a.get(r.relativePath)??r.relativePath,c=o(n);return c===null||!new RegExp(`\\b${w(r.leaf)}\\b`).test(c)})}function Q(e,t){return e.all(`SELECT DISTINCT ref_d.relative_path
1
+ import{a as T,c as E,g as L,h as D}from"./chunk-HSU3M25J.js";import{j as O,o as A}from"./chunk-BCNT6ODA.js";import{d as H}from"./chunk-KMVGRIO2.js";import{a as _}from"./chunk-UAHZ57BR.js";import{d as C,e as F}from"./chunk-HXXMPYEF.js";import{a as w}from"./chunk-T2FQ4GHD.js";var J=5;function ae(e,t={}){let{base:a="HEAD",minContainment:o=.7,minCallees:r=3,minSiteCoverage:n=.4,maxHelpers:c=Number.POSITIVE_INFINITY,limit:m=20,scanLimit:g}=t,f=t.semantic!==!1,s=t.diffPlan??E(e,{base:a}),l={available:s.note!==T,base:a,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!l.available||s.changedFiles.length===0)return l;let x=new _(e),k=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from])),j=t.baseContentAt??L(e.config.projectRoot,a,D(s)),h=Z(x,k,$,j);if(h.length===0)return l;let R=h.slice(0,c);h.length>c&&(l.note=`helper scoring capped at ${c} of ${h.length} new symbols`);let q=x.calleeMap(R,{semantic:f}),B=R.map(i=>({def:i,callees:A((q.get(i.symbolId)??[]).map(p=>p.symbol))})),V=O(e),M,G=()=>(M??=V.calleeIndex({minCallees:Math.min(3,r),scanLimit:g,semantic:f}),M);for(let{def:i,callees:p}of B){let d=C(i.symbol);if(p.size<r){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:`fewer than ${r} meaningful callees \u2014 too small to score`});continue}let P=G(),N=Y(p,P);if(N===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let b=Q(e,i.symbolId);if(b.length===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}l.helpersChecked+=1;let I=K({candidateIndex:P,changed:k,helperCallees:p,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:o,minSiteCoverage:n,migratedFiles:b});I.length!==0&&(I.sort((u,S)=>z(S.migrationScope)-z(u.migrationScope)||S.containment-u.containment||S.siteCoverage-u.siteCoverage||u.file.localeCompare(S.file)),l.findings.push({helperSymbol:i.symbol,helperShortName:d,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:p.size,specificHelperCalleeCount:N,migratedFiles:b.sort(),leftovers:I.slice(0,J)}))}return l.findings.sort((i,p)=>(p.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(p.helperFile)),l.findings=l.findings.slice(0,m),l}function K(e){let t=[],a=U(e.helperSymbol,e.helperFile,e.migratedFiles),o=new Set;for(let r of e.helperCallees)for(let n of e.candidateIndex.candidateIndexesByCallee.get(r)??[])o.add(n);for(let r of o){let n=e.candidateIndex.corpus[r];if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let c=H(e.helperCallees,n.callees);if(c<e.minContainment)continue;let m=[...e.helperCallees].filter(s=>n.callees.has(s)),g=n.callees.size===0?0:m.length/n.callees.size;if(g<e.minSiteCoverage||!m.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let f=W(a,n.symbol,n.file);t.push({symbol:n.symbol,shortName:C(n.symbol),file:n.file,...f,containment:c,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-m.length),sharedCallees:m.map(C).sort()})}return t}function z(e){return e==="same-scope"?2:e==="unknown"?1:0}function U(e,t,a){let o=new Set([...y(t),...v(F(e))]);for(let r of a)for(let n of y(r))o.add(n);return o}function W(e,t,a){let o=new Set([...y(a),...v(F(t))]);if(e.size===0||o.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let r=[...o].filter(n=>e.has(n)).sort();return r.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${r.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var X=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function y(e){return v(e.replace(/\.[^.]+$/,""))}function v(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!X.has(t))}function Y(e,t){let a=0;for(let o of e)(t.docFreq.get(o)??0)<=t.ubiquityThreshold&&(a+=1);return a}function Z(e,t,a,o){return e.productionCallableDefinitions({files:[...t],requireFunctionLikeSymbol:!0}).filter(r=>{if(!t.has(r.relativePath))return!1;let n=a.get(r.relativePath)??r.relativePath,c=o(n);return c===null||!new RegExp(`\\b${w(r.leaf)}\\b`).test(c)})}function Q(e,t){return e.all(`SELECT DISTINCT ref_d.relative_path
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents ref_d ON c.document_id = ref_d.id
5
5
  WHERE m.symbol_id = ?
6
6
  AND m.role != 1
7
7
  ${e.pathExclusionsFor("ref_d")}`,t).map(o=>o.relative_path)}export{ae as a};
8
- //# sourceMappingURL=chunk-6Q6OFLFQ.js.map
8
+ //# sourceMappingURL=chunk-ZRIOGL7F.js.map