scip-query 0.17.0 → 0.17.1

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 (103) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +19 -0
  3. package/dist/{chunk-A4KRWTXD.js → chunk-2DUWNJKE.js} +2 -2
  4. package/dist/{chunk-KTZACYL6.js → chunk-2TM23JYJ.js} +2 -2
  5. package/dist/{chunk-42YU6TEB.js → chunk-35DURZXI.js} +2 -2
  6. package/dist/{chunk-TCOWAGR2.js → chunk-3YEBIYXL.js} +2 -2
  7. package/dist/{chunk-H4SMB657.js → chunk-5QSMW5IO.js} +2 -2
  8. package/dist/{chunk-AQ34B63A.js → chunk-623AZLTE.js} +2 -2
  9. package/dist/{chunk-RZEVUYMG.js → chunk-6TJERPN3.js} +2 -2
  10. package/dist/{chunk-NJBARXRO.js → chunk-7H37Z4UO.js} +2 -2
  11. package/dist/{chunk-VT2KFEPG.js → chunk-BBTVIIOI.js} +2 -2
  12. package/dist/{chunk-CYDOV3AQ.js → chunk-BTYDBDX5.js} +2 -2
  13. package/dist/{chunk-3EBDPBBU.js → chunk-BW4VDICR.js} +2 -2
  14. package/dist/{chunk-JVTMRIKU.js → chunk-CKRVVBM6.js} +2 -2
  15. package/dist/{chunk-6G3GQWTK.js → chunk-CSMPXDYE.js} +2 -2
  16. package/dist/{chunk-KYUYAWKA.js → chunk-E5HPTSRD.js} +2 -2
  17. package/dist/chunk-E7BTIEAY.js +2 -0
  18. package/dist/{chunk-KLFCCRI7.js → chunk-EUMETOTD.js} +2 -2
  19. package/dist/{chunk-MVFNACWB.js → chunk-FY6RCFDH.js} +2 -2
  20. package/dist/{chunk-JYBF5CPE.js → chunk-FZXN37RN.js} +2 -2
  21. package/dist/{chunk-Y3DG4J6A.js → chunk-G4IUQW27.js} +2 -2
  22. package/dist/{chunk-WH65EY7U.js → chunk-HJYHSTCP.js} +2 -2
  23. package/dist/{chunk-PVXSHZLW.js → chunk-HYRSGWFX.js} +2 -2
  24. package/dist/{chunk-ZMD4O5UP.js → chunk-HZVG4KID.js} +2 -2
  25. package/dist/{chunk-HV4N3UBV.js → chunk-IHD2CHMX.js} +2 -2
  26. package/dist/{chunk-7CHIAMKS.js → chunk-IKAJI4SI.js} +2 -2
  27. package/dist/{chunk-TL2IXVGH.js → chunk-IZLWLO4X.js} +2 -2
  28. package/dist/{chunk-JJAH2VLD.js → chunk-JYBP5ZIR.js} +2 -2
  29. package/dist/{chunk-QNCVN5EH.js → chunk-KWMRY4RN.js} +2 -2
  30. package/dist/{chunk-KAOWSWEX.js → chunk-KWQKWY6M.js} +2 -2
  31. package/dist/{chunk-IK2NG76R.js → chunk-MBDBNQBW.js} +2 -2
  32. package/dist/chunk-MON5XXTG.js +7 -0
  33. package/dist/{chunk-BBBZB5WY.js → chunk-O27267B6.js} +2 -2
  34. package/dist/{chunk-34RCSYMZ.js → chunk-O56VBJKB.js} +2 -2
  35. package/dist/{chunk-J4HK7PQS.js → chunk-OBPR6E5Z.js} +2 -2
  36. package/dist/{chunk-YD7GGLGE.js → chunk-OC7XDK62.js} +2 -2
  37. package/dist/{chunk-ABRWGVC6.js → chunk-PPAT3XUL.js} +2 -2
  38. package/dist/{chunk-PYOZHG6A.js → chunk-QYBCGCY5.js} +2 -2
  39. package/dist/{chunk-EPDV3SQD.js → chunk-RPPV6Y4K.js} +2 -2
  40. package/dist/{chunk-OQRMCT2N.js → chunk-SQJ72PQW.js} +5 -5
  41. package/dist/{chunk-KO2TFDIP.js → chunk-SSH2NPYS.js} +2 -2
  42. package/dist/chunk-U267E6YN.js +120 -0
  43. package/dist/{chunk-JUADXGUH.js → chunk-UKUISUS6.js} +2 -2
  44. package/dist/{chunk-LC57FSPX.js → chunk-V7MX6YUF.js} +2 -2
  45. package/dist/{chunk-SREWDA7Q.js → chunk-W2I4QAW7.js} +2 -2
  46. package/dist/{chunk-5ODF4JGH.js → chunk-W3HSUCRG.js} +2 -2
  47. package/dist/{chunk-VCOAUTSI.js → chunk-WENI5ZDR.js} +2 -2
  48. package/dist/{chunk-VPVAQRHM.js → chunk-WGDIA2TU.js} +2 -2
  49. package/dist/{chunk-7MT6UM4D.js → chunk-WT34AUWL.js} +2 -2
  50. package/dist/{chunk-OP5RO2CF.js → chunk-Y4BBVPRK.js} +2 -2
  51. package/dist/cli.js +280 -280
  52. package/dist/index.js +1 -1
  53. package/dist/queries/affected.js +1 -1
  54. package/dist/queries/bottlenecks.js +1 -1
  55. package/dist/queries/call-graph.js +1 -1
  56. package/dist/queries/change-surface.js +1 -1
  57. package/dist/queries/cleanup-plan.js +1 -1
  58. package/dist/queries/complexity-hotspots.js +1 -1
  59. package/dist/queries/complexity.js +1 -1
  60. package/dist/queries/convergence.js +1 -1
  61. package/dist/queries/dataflow.js +1 -1
  62. package/dist/queries/dead.js +1 -1
  63. package/dist/queries/decorative-checkers.js +1 -1
  64. package/dist/queries/diff-gate.js +1 -1
  65. package/dist/queries/diff-impact.js +1 -1
  66. package/dist/queries/drift.js +1 -1
  67. package/dist/queries/extract-candidates.js +1 -1
  68. package/dist/queries/health.js +1 -1
  69. package/dist/queries/hotspots.js +1 -1
  70. package/dist/queries/imports.js +1 -1
  71. package/dist/queries/incomplete-migration.js +1 -1
  72. package/dist/queries/index.js +1 -1
  73. package/dist/queries/isolated.js +1 -1
  74. package/dist/queries/locality-candidates.js +1 -1
  75. package/dist/queries/members.js +1 -1
  76. package/dist/queries/methods.js +1 -1
  77. package/dist/queries/not-implemented.js +1 -1
  78. package/dist/queries/passthrough-candidates.js +1 -1
  79. package/dist/queries/plan-context.js +1 -1
  80. package/dist/queries/recent-duplicates.js +1 -1
  81. package/dist/queries/redundant-reexports.js +1 -1
  82. package/dist/queries/refs.js +1 -1
  83. package/dist/queries/self-audit.js +1 -1
  84. package/dist/queries/similar-signatures.js +1 -1
  85. package/dist/queries/similar.js +1 -1
  86. package/dist/queries/slice.js +1 -1
  87. package/dist/queries/stale-abstractions.js +1 -1
  88. package/dist/queries/surface.js +1 -1
  89. package/dist/queries/trace.js +1 -1
  90. package/dist/queries/twin-ab.js +1 -1
  91. package/dist/queries/unused-imports.js +1 -1
  92. package/dist/queries/unused-params.js +1 -1
  93. package/dist/queries/wrapper-candidates.js +1 -1
  94. package/dist/reindex-worker.js +22 -22
  95. package/dist/reindex.js +36 -36
  96. package/dist/runtime.d.ts +2 -0
  97. package/dist/runtime.js +1 -1
  98. package/dist/watch-server.js +4 -4
  99. package/package.json +2 -1
  100. package/skills/scip-tla-model-system/SKILL.md +10 -8
  101. package/dist/chunk-L7UITWFE.js +0 -120
  102. package/dist/chunk-QVZSWLLZ.js +0 -2
  103. package/dist/chunk-RSZ4KX4B.js +0 -7
@@ -1,2 +1,2 @@
1
- import{j as I}from"./chunk-QNCVN5EH.js";import{a as y,e as g}from"./chunk-7XP7ZRSI.js";import{B as v}from"./chunk-TLTLJ4SW.js";import{c as b,h as D,i as _,q as F,s as p,v as E,x}from"./chunk-M2TRDR25.js";import{spawnSync as O}from"child_process";import{createHash as U}from"crypto";import{existsSync as k}from"fs";import{dirname as L,join as T}from"path";import{fileURLToPath as j}from"url";var N=b("definition-consumer-file-usage",{clearGroups:["whole-project","source-file"]}),M=E({kind:"consumer-file-usage",invalidation:x("consumer-file-usage"),serialize:Q,deserialize:W});function Le(e,n){return{forDefinitions(r,i){return V(e,n,r,i)}}}function Me(e){let n=new Map;for(let[r,i]of e)n.set(r,new Set(i.files.map(t=>t.file)));return n}function Re(e,n,r){return w(e,n,r).partition}function V(e,n,r,i){let t=h(r.length),s=F()?_(e):null,a=s?B(r,i,s):void 0,o=a?{workIdentity:a,workOutcome:"computed"}:{};return p("consumer-evidence.product",()=>{let l=p("consumer-evidence.provenance",()=>z(e,n,r,i),()=>({...o,definitions:r.length,semantic:i.semantic,sourceFallback:i.sourceFallback!==!1})),u=new Map;t={...t,...l.counters};let c=Y(r,l.sources);return p("consumer-evidence.classify",()=>{let f=q(e,r,l.sources,c);for(let d of r){let m=f.get(d.symbolId)??H();t.realFiles+=m.partition.realConsumers.length,t.reexportOnlyFiles+=m.partition.barrelConsumers,t.importOnlyFiles+=m.partition.importOnlyConsumers,u.set(d.symbolId,{definition:d,files:m.files,...m.partition})}},()=>({...o,...c,realFiles:t.realFiles,reexportOnlyFiles:t.reexportOnlyFiles,importOnlyFiles:t.importOnlyFiles})),u},()=>({...o,...t}))}function B(e,n,r){let i=U("sha256").update("consumer-evidence-v1\0").update(r).update("\0").update(n.semantic?"semantic\0":"indexed\0").update(n.sourceFallback===!1?"no-source-fallback":"source-fallback");for(let t of e.map(s=>s.symbol).sort())i.update("\0").update(t);return i.digest("hex").slice(0,24)}function h(e){return{definitions:e,indexedFiles:0,semanticFiles:0,fallbackFiles:0,totalFiles:0,realFiles:0,reexportOnlyFiles:0,importOnlyFiles:0}}function z(e,n,r,i){let t=h(r.length),s=new Map;return S(s,t,"indexed",n.crossFileCallerMap(r,{semantic:!1})),i.semantic&&S(s,t,"semantic",I(e,r)),i.sourceFallback!==!1&&S(s,t,"source-fallback",n.sourceFallbackCallerFiles(r)),t.totalFiles=[...s.values()].reduce((a,o)=>a+o.size,0),{sources:s,counters:t}}function Y(e,n){return{definitions:e.length,consumerFiles:[...n.values()].reduce((r,i)=>r+i.size,0),nativeAttempted:!1,nativeUsed:!1,nativeReason:"not-attempted"}}function S(e,n,r,i){let t=0;for(let[s,a]of i){let o=e.get(s);o||(o=new Map,e.set(s,o));for(let l of a){t++;let u=o.get(l)??new Set;u.add(r),o.set(l,u)}}r==="indexed"?n.indexedFiles+=t:r==="semantic"?n.semanticFiles+=t:n.fallbackFiles+=t}function q(e,n,r,i){let t=re(e,n,r,i);return t||$(e,n,r)}function $(e,n,r){let i=new Map;for(let t of n){let s=r.get(t.symbolId)??new Map;i.set(t.symbolId,w(e,t,[...s.keys()],s))}return i}function w(e,n,r,i=new Map){let t=[],s=0,a=0,o=g(n.symbol),l=[];for(let u of r){let c;X(e,u,n.relativePath,o)?(s++,c="reexport-only"):J(e,u,o)?(a++,c="import-only"):(t.push(u),c="real"),l.push({file:u,sources:[...i.get(u)??[]],classification:c})}return{partition:{realConsumers:t,barrelConsumers:s,importOnlyConsumers:a},files:l}}function H(){return{partition:{realConsumers:[],barrelConsumers:0,importOnlyConsumers:0},files:[]}}function J(e,n,r){if(!r)return!1;let i=v(n);if(!i)return!1;let t=N.get(e,n,()=>A(e,n,i));return t.importedLeaves.has(r)&&!t.usedLeaves.has(r)}function A(e,n,r){let i=y(e).forFile(n,{text:!0,ast:!0}),t=i.text;if(!t)return G();let s=D(e,n,t),a=M.read(e,n,s);if(a)return a;let o=K(i.ast,r);return M.write(e,n,s,o),o}function K(e,n){let r=new Set,i=new Set;if(!e)return{importedLeaves:r,usedLeaves:i};let t=n==="rust"?new Set(["use_declaration"]):n==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),s=(a,o)=>{let l=o||t.has(a.type);(a.type==="identifier"||a.type==="type_identifier"||a.type==="property_identifier"||a.type==="field_identifier")&&(l?r.add(a.text):i.add(a.text));for(let u of a.children)s(u,l)};return s(e.rootNode,!1),{importedLeaves:r,usedLeaves:i}}function G(){return{importedLeaves:new Set,usedLeaves:new Set}}function Q(e){return JSON.stringify({importedLeaves:[...e.importedLeaves],usedLeaves:[...e.usedLeaves]})}function W(e){try{let n=JSON.parse(e);return!Array.isArray(n.importedLeaves)||!Array.isArray(n.usedLeaves)?null:{importedLeaves:new Set(n.importedLeaves.filter(r=>typeof r=="string")),usedLeaves:new Set(n.usedLeaves.filter(r=>typeof r=="string"))}}catch{return null}}function X(e,n,r,i){if(!i)return!1;let t=y(e).forFile(n,{lines:!0,reexports:!0}),s=t.lines??[];if(s.length===0)return!1;let a=t.reexports??[];return P(s,a,i)}function P(e,n,r){if(e.length===0||n.length===0)return!1;let i=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t=new RegExp(`\\b${i}\\b`),s=0;for(let a=0;a<e.length;a++){if(!t.test(e[a]??""))continue;if(s++,!n.find(l=>l.startLine<=a&&a<=l.endLine))return!1}return s>0}var Z="SCIP_QUERY_NATIVE_CONSUMER_CLASSIFY",ee="SCIP_QUERY_NATIVE_KERNELS_BIN",ne="SCIP_QUERY_NATIVE_CONSUMER_CLASSIFY_MIN_FILES",R=1e3,ie=5e3,te=64*1024*1024,C;function re(e,n,r,i){let t=process.env[Z]?.toLowerCase();if(t!=="1"&&t!=="true")return i.nativeReason=t==="0"||t==="false"?"disabled":"opt-in-required",null;if(i.consumerFiles<fe())return i.nativeReason="below-threshold",null;let s=me();if(!s)return i.nativeReason="binary-missing",null;i.nativeAttempted=!0;let a=se(e,n,r),o=O(s,["consumer-classify"],{input:JSON.stringify(a),encoding:"utf8",timeout:ie,maxBuffer:te});if(o.status!==0||o.error)return i.nativeReason=o.error?`spawn-error:${o.error.message}`:`exit-${o.status??"null"}`,null;try{let l=JSON.parse(o.stdout),u=ae(l,n);return u?(i.nativeUsed=!0,i.nativeReason="used",u):(i.nativeReason="invalid-response",null)}catch{return i.nativeReason="invalid-json",null}}function se(e,n,r){let i=new Map,t=[];for(let o of n){let l=g(o.symbol),c=[...(r.get(o.symbolId)??new Map).entries()].map(([f,d])=>{let m=i.get(f)??new Set;return l&&m.add(l),i.set(f,m),{file:f,sources:[...d]}});t.push({symbol_id:o.symbolId,leaf:l,consumer_files:c})}let s={},a={};for(let[o,l]of i){let u=v(o);if(u){let f=N.get(e,o,()=>A(e,o,u));s[o]={imported_leaves:[...f.importedLeaves],used_leaves:[...f.usedLeaves]}}let c=oe(e,o,l);c.length>0&&(a[o]=c)}return{definitions:t,file_usages:s,reexport_only_leaves:a}}function oe(e,n,r){if(r.size===0)return[];let i=y(e).forFile(n,{lines:!0,reexports:!0}),t=i.lines??[],s=i.reexports??[];return t.length===0||s.length===0?[]:[...r].filter(a=>P(t,s,a))}function ae(e,n){if(!Array.isArray(e.entries)||e.entries.length!==n.length)return null;let r=new Set(n.map(t=>t.symbolId)),i=new Map;for(let t of e.entries){let s=le(t);if(!s||!r.has(s.symbol_id))return null;i.set(s.symbol_id,{partition:{realConsumers:s.real_consumers,barrelConsumers:s.barrel_consumers,importOnlyConsumers:s.import_only_consumers},files:s.files})}for(let t of r)if(!i.has(t))return null;return i}function le(e){if(!e||typeof e!="object")return null;let n=e;if(typeof n.symbol_id!="number"||!Array.isArray(n.real_consumers)||typeof n.barrel_consumers!="number"||typeof n.import_only_consumers!="number"||!Array.isArray(n.files)||!n.real_consumers.every(i=>typeof i=="string"))return null;let r=[];for(let i of n.files){if(!i||typeof i!="object")return null;let t=i;if(typeof t.file!="string"||!Array.isArray(t.sources)||!t.sources.every(ue)||!ce(t.classification))return null;r.push({file:t.file,sources:t.sources,classification:t.classification})}return{symbol_id:n.symbol_id,real_consumers:n.real_consumers,barrel_consumers:n.barrel_consumers,import_only_consumers:n.import_only_consumers,files:r}}function ue(e){return e==="indexed"||e==="semantic"||e==="source-fallback"}function ce(e){return e==="real"||e==="reexport-only"||e==="import-only"}function fe(){let e=process.env[ne];if(!e)return R;let n=Number(e);return Number.isFinite(n)&&n>=0?n:R}function me(){if(C!==void 0)return C;let e=process.env[ee],n=process.platform==="win32"?"scip-query-kernels.exe":"scip-query-kernels";return C=[...e?[e]:[],...de().map(i=>T(i,"target","release",n))].find(i=>k(i))??null,C}function de(){let e=new Set,n=L(j(import.meta.url));for(let r=0;r<5;r++)e.add(n),n=L(n);return[...e]}export{Le as a,Me as b,Re as c,J as d};
2
- //# sourceMappingURL=chunk-LC57FSPX.js.map
1
+ import{j as I}from"./chunk-KWMRY4RN.js";import{a as y,e as g}from"./chunk-7XP7ZRSI.js";import{B as v}from"./chunk-TLTLJ4SW.js";import{c as b,h as D,i as _,q as F,s as p,v as E,x}from"./chunk-M2TRDR25.js";import{spawnSync as O}from"child_process";import{createHash as U}from"crypto";import{existsSync as k}from"fs";import{dirname as L,join as T}from"path";import{fileURLToPath as j}from"url";var N=b("definition-consumer-file-usage",{clearGroups:["whole-project","source-file"]}),M=E({kind:"consumer-file-usage",invalidation:x("consumer-file-usage"),serialize:Q,deserialize:W});function Le(e,n){return{forDefinitions(r,i){return V(e,n,r,i)}}}function Me(e){let n=new Map;for(let[r,i]of e)n.set(r,new Set(i.files.map(t=>t.file)));return n}function Re(e,n,r){return w(e,n,r).partition}function V(e,n,r,i){let t=h(r.length),s=F()?_(e):null,a=s?B(r,i,s):void 0,o=a?{workIdentity:a,workOutcome:"computed"}:{};return p("consumer-evidence.product",()=>{let l=p("consumer-evidence.provenance",()=>z(e,n,r,i),()=>({...o,definitions:r.length,semantic:i.semantic,sourceFallback:i.sourceFallback!==!1})),u=new Map;t={...t,...l.counters};let c=Y(r,l.sources);return p("consumer-evidence.classify",()=>{let f=q(e,r,l.sources,c);for(let d of r){let m=f.get(d.symbolId)??H();t.realFiles+=m.partition.realConsumers.length,t.reexportOnlyFiles+=m.partition.barrelConsumers,t.importOnlyFiles+=m.partition.importOnlyConsumers,u.set(d.symbolId,{definition:d,files:m.files,...m.partition})}},()=>({...o,...c,realFiles:t.realFiles,reexportOnlyFiles:t.reexportOnlyFiles,importOnlyFiles:t.importOnlyFiles})),u},()=>({...o,...t}))}function B(e,n,r){let i=U("sha256").update("consumer-evidence-v1\0").update(r).update("\0").update(n.semantic?"semantic\0":"indexed\0").update(n.sourceFallback===!1?"no-source-fallback":"source-fallback");for(let t of e.map(s=>s.symbol).sort())i.update("\0").update(t);return i.digest("hex").slice(0,24)}function h(e){return{definitions:e,indexedFiles:0,semanticFiles:0,fallbackFiles:0,totalFiles:0,realFiles:0,reexportOnlyFiles:0,importOnlyFiles:0}}function z(e,n,r,i){let t=h(r.length),s=new Map;return S(s,t,"indexed",n.crossFileCallerMap(r,{semantic:!1})),i.semantic&&S(s,t,"semantic",I(e,r)),i.sourceFallback!==!1&&S(s,t,"source-fallback",n.sourceFallbackCallerFiles(r)),t.totalFiles=[...s.values()].reduce((a,o)=>a+o.size,0),{sources:s,counters:t}}function Y(e,n){return{definitions:e.length,consumerFiles:[...n.values()].reduce((r,i)=>r+i.size,0),nativeAttempted:!1,nativeUsed:!1,nativeReason:"not-attempted"}}function S(e,n,r,i){let t=0;for(let[s,a]of i){let o=e.get(s);o||(o=new Map,e.set(s,o));for(let l of a){t++;let u=o.get(l)??new Set;u.add(r),o.set(l,u)}}r==="indexed"?n.indexedFiles+=t:r==="semantic"?n.semanticFiles+=t:n.fallbackFiles+=t}function q(e,n,r,i){let t=re(e,n,r,i);return t||$(e,n,r)}function $(e,n,r){let i=new Map;for(let t of n){let s=r.get(t.symbolId)??new Map;i.set(t.symbolId,w(e,t,[...s.keys()],s))}return i}function w(e,n,r,i=new Map){let t=[],s=0,a=0,o=g(n.symbol),l=[];for(let u of r){let c;X(e,u,n.relativePath,o)?(s++,c="reexport-only"):J(e,u,o)?(a++,c="import-only"):(t.push(u),c="real"),l.push({file:u,sources:[...i.get(u)??[]],classification:c})}return{partition:{realConsumers:t,barrelConsumers:s,importOnlyConsumers:a},files:l}}function H(){return{partition:{realConsumers:[],barrelConsumers:0,importOnlyConsumers:0},files:[]}}function J(e,n,r){if(!r)return!1;let i=v(n);if(!i)return!1;let t=N.get(e,n,()=>A(e,n,i));return t.importedLeaves.has(r)&&!t.usedLeaves.has(r)}function A(e,n,r){let i=y(e).forFile(n,{text:!0,ast:!0}),t=i.text;if(!t)return G();let s=D(e,n,t),a=M.read(e,n,s);if(a)return a;let o=K(i.ast,r);return M.write(e,n,s,o),o}function K(e,n){let r=new Set,i=new Set;if(!e)return{importedLeaves:r,usedLeaves:i};let t=n==="rust"?new Set(["use_declaration"]):n==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),s=(a,o)=>{let l=o||t.has(a.type);(a.type==="identifier"||a.type==="type_identifier"||a.type==="property_identifier"||a.type==="field_identifier")&&(l?r.add(a.text):i.add(a.text));for(let u of a.children)s(u,l)};return s(e.rootNode,!1),{importedLeaves:r,usedLeaves:i}}function G(){return{importedLeaves:new Set,usedLeaves:new Set}}function Q(e){return JSON.stringify({importedLeaves:[...e.importedLeaves],usedLeaves:[...e.usedLeaves]})}function W(e){try{let n=JSON.parse(e);return!Array.isArray(n.importedLeaves)||!Array.isArray(n.usedLeaves)?null:{importedLeaves:new Set(n.importedLeaves.filter(r=>typeof r=="string")),usedLeaves:new Set(n.usedLeaves.filter(r=>typeof r=="string"))}}catch{return null}}function X(e,n,r,i){if(!i)return!1;let t=y(e).forFile(n,{lines:!0,reexports:!0}),s=t.lines??[];if(s.length===0)return!1;let a=t.reexports??[];return P(s,a,i)}function P(e,n,r){if(e.length===0||n.length===0)return!1;let i=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t=new RegExp(`\\b${i}\\b`),s=0;for(let a=0;a<e.length;a++){if(!t.test(e[a]??""))continue;if(s++,!n.find(l=>l.startLine<=a&&a<=l.endLine))return!1}return s>0}var Z="SCIP_QUERY_NATIVE_CONSUMER_CLASSIFY",ee="SCIP_QUERY_NATIVE_KERNELS_BIN",ne="SCIP_QUERY_NATIVE_CONSUMER_CLASSIFY_MIN_FILES",R=1e3,ie=5e3,te=64*1024*1024,C;function re(e,n,r,i){let t=process.env[Z]?.toLowerCase();if(t!=="1"&&t!=="true")return i.nativeReason=t==="0"||t==="false"?"disabled":"opt-in-required",null;if(i.consumerFiles<fe())return i.nativeReason="below-threshold",null;let s=me();if(!s)return i.nativeReason="binary-missing",null;i.nativeAttempted=!0;let a=se(e,n,r),o=O(s,["consumer-classify"],{input:JSON.stringify(a),encoding:"utf8",timeout:ie,maxBuffer:te});if(o.status!==0||o.error)return i.nativeReason=o.error?`spawn-error:${o.error.message}`:`exit-${o.status??"null"}`,null;try{let l=JSON.parse(o.stdout),u=ae(l,n);return u?(i.nativeUsed=!0,i.nativeReason="used",u):(i.nativeReason="invalid-response",null)}catch{return i.nativeReason="invalid-json",null}}function se(e,n,r){let i=new Map,t=[];for(let o of n){let l=g(o.symbol),c=[...(r.get(o.symbolId)??new Map).entries()].map(([f,d])=>{let m=i.get(f)??new Set;return l&&m.add(l),i.set(f,m),{file:f,sources:[...d]}});t.push({symbol_id:o.symbolId,leaf:l,consumer_files:c})}let s={},a={};for(let[o,l]of i){let u=v(o);if(u){let f=N.get(e,o,()=>A(e,o,u));s[o]={imported_leaves:[...f.importedLeaves],used_leaves:[...f.usedLeaves]}}let c=oe(e,o,l);c.length>0&&(a[o]=c)}return{definitions:t,file_usages:s,reexport_only_leaves:a}}function oe(e,n,r){if(r.size===0)return[];let i=y(e).forFile(n,{lines:!0,reexports:!0}),t=i.lines??[],s=i.reexports??[];return t.length===0||s.length===0?[]:[...r].filter(a=>P(t,s,a))}function ae(e,n){if(!Array.isArray(e.entries)||e.entries.length!==n.length)return null;let r=new Set(n.map(t=>t.symbolId)),i=new Map;for(let t of e.entries){let s=le(t);if(!s||!r.has(s.symbol_id))return null;i.set(s.symbol_id,{partition:{realConsumers:s.real_consumers,barrelConsumers:s.barrel_consumers,importOnlyConsumers:s.import_only_consumers},files:s.files})}for(let t of r)if(!i.has(t))return null;return i}function le(e){if(!e||typeof e!="object")return null;let n=e;if(typeof n.symbol_id!="number"||!Array.isArray(n.real_consumers)||typeof n.barrel_consumers!="number"||typeof n.import_only_consumers!="number"||!Array.isArray(n.files)||!n.real_consumers.every(i=>typeof i=="string"))return null;let r=[];for(let i of n.files){if(!i||typeof i!="object")return null;let t=i;if(typeof t.file!="string"||!Array.isArray(t.sources)||!t.sources.every(ue)||!ce(t.classification))return null;r.push({file:t.file,sources:t.sources,classification:t.classification})}return{symbol_id:n.symbol_id,real_consumers:n.real_consumers,barrel_consumers:n.barrel_consumers,import_only_consumers:n.import_only_consumers,files:r}}function ue(e){return e==="indexed"||e==="semantic"||e==="source-fallback"}function ce(e){return e==="real"||e==="reexport-only"||e==="import-only"}function fe(){let e=process.env[ne];if(!e)return R;let n=Number(e);return Number.isFinite(n)&&n>=0?n:R}function me(){if(C!==void 0)return C;let e=process.env[ee],n=process.platform==="win32"?"scip-query-kernels.exe":"scip-query-kernels";return C=[...e?[e]:[],...de().map(i=>T(i,"target","release",n))].find(i=>k(i))??null,C}function de(){let e=new Set,n=L(j(import.meta.url));for(let r=0;r<5;r++)e.add(n),n=L(n);return[...e]}export{Le as a,Me as b,Re as c,J as d};
2
+ //# sourceMappingURL=chunk-V7MX6YUF.js.map
@@ -1,3 +1,3 @@
1
- import{a as $e}from"./chunk-JJAH2VLD.js";import{a as Se}from"./chunk-42YU6TEB.js";import{a as se,c as ae,d as ce,e as D}from"./chunk-2DBY4MO7.js";import{a as Ce}from"./chunk-34RCSYMZ.js";import{a as ye}from"./chunk-VCOAUTSI.js";import{a as be}from"./chunk-C2QSK7E7.js";import{a as ge}from"./chunk-3EBDPBBU.js";import{a as he}from"./chunk-J4HK7PQS.js";import{a as fe}from"./chunk-WH65EY7U.js";import{a as ue}from"./chunk-PYOZHG6A.js";import{b as re}from"./chunk-HGO3D2JD.js";import{a as ne,b as oe}from"./chunk-VDHEX6YO.js";import{a as Q,b as X,c as ee,g as M,h as K}from"./chunk-KLFCCRI7.js";import{a as ie,b as F,e as te}from"./chunk-OP5JXGDV.js";import{b as de}from"./chunk-JUADXGUH.js";import{a as B,c as J,d as Y,e as Z}from"./chunk-GRHA5NGF.js";import{a as V}from"./chunk-X566NT42.js";import{a as me,e as pe}from"./chunk-A4KRWTXD.js";import{a as le}from"./chunk-27YDE22N.js";import{a as W}from"./chunk-CYDOV3AQ.js";import{f as T,g as A}from"./chunk-5CJ6AQN7.js";import{e as q}from"./chunk-MVFNACWB.js";import{e as R,f as U,g as N}from"./chunk-7XP7ZRSI.js";import{a as O}from"./chunk-JLZUM476.js";import{e as H}from"./chunk-TLTLJ4SW.js";import{s as z}from"./chunk-M2TRDR25.js";import{createHash as ei}from"crypto";import{existsSync as _}from"fs";function we(e){let[i,t]=j(e,":"),o=i||"unknown",n=(a={})=>{let s=a.actionTier??Me(o);return{sourceAnalyzer:o,actionTier:s,rootCauseKey:a.rootCauseKey??(t||e),label:a.label??`${o} finding`,relatedFiles:a.relatedFiles??[],why:a.why??[],remediation:a.remediation??Ke(s,o),file:a.file}};if(!t)return n({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(o)){let[a,s]=j(t,":");return n({file:a,relatedFiles:a?[a]:[],rootCauseKey:s?`${a}:${s}`:t,label:`${o} finding`,why:s?[`Baseline subject: ${s}.`]:[]})}if(o==="cycle"){let a=t.split(">").filter(Boolean);return n({relatedFiles:a,rootCauseKey:t,label:"cycle finding",why:a.length>0?[`Cycle path: ${a.join(" > ")}.`]:[]})}if(o==="similar"){let a=t.split("|").filter(Boolean);return n({relatedFiles:[],rootCauseKey:t,label:"similarity finding",why:a.length>0?[`Similar symbols: ${a.join(" | ")}.`]:[]})}if(o==="drift"){let[a,s]=j(t,":"),[c,d]=j(s,":");return n({actionTier:a==="unused-import"?"direct":"signal",file:c,relatedFiles:[...new Set([c,d].filter(Boolean))],rootCauseKey:t,label:`${a||"drift"} finding`,why:[...a?[`Drift kind: ${a}.`]:[],...d?[`Related dependency: ${d}.`]:[]]})}return n({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function Me(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function Ke(e,i){return e==="direct"?`Fix the new ${i} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${i} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function j(e,i){let t=e.indexOf(i);return t<0?[e,""]:[e.slice(0,t),e.slice(t+i.length)]}import{existsSync as Le,readFileSync as Pe,writeFileSync as _e}from"fs";import{isAbsolute as He,join as ze}from"path";var Oe=25e3,Ue=2500,qe=2500;function We(e){let i=be(e);return i.symbols>=Oe||i.documents>=Ue?qe:void 0}var Ve=".scipquery-baseline.json";function E(e,i){return i&&He(i)?i:ze(e.config.projectRoot,i??Ve)}function De(e,i={}){let{scope:t}=i,o=We(e),n=[],a=de(e,{scope:t,...D.dead,scanLimit:o});for(let s of a.symbols)T(e,s.relativePath)||A(e,s.symbol,s.relativePath)||s.kind==="dead-code"&&n.push(`dead:${s.relativePath}:${s.shortName}`);for(let s of he(e,{scope:t,...D.isolated,scanLimit:o}))T(e,s.relativePath)||A(e,s.symbol,s.relativePath)||n.push(`isolated:${s.relativePath}:${s.shortName}`);for(let s of le(e,{scope:t}))s.kind==="real"&&n.push(`cycle:${Je(s.path)}`);for(let s of pe(e,{scope:t,...D.similar,scanLimit:o}))n.push(`similar:${[s.symbolA,s.symbolB].sort().join("|")}`);for(let s of ne(e,{scope:t,...D.duplicateBodies,scanLimit:o}))n.push(`duplicate-bodies:${s.hash}:${s.functions.map(c=>c.symbol).sort().join("|")}`);for(let s of ue(e,{scope:t,...D.extract,scanLimit:o}))n.push(`extract:${s.relativePath}:${s.shortName}`);for(let s of Ce(e,{scope:t,...D.wrappers,scanLimit:o}))n.push(`wrapper:${s.file}:${s.shortName}`);for(let s of ge(e,{scope:t,...D.passthroughs,scanLimit:o}))n.push(`passthrough:${s.file}:${s.shortName}`);for(let s of ye(e,{scope:t,...D.stale,scanLimit:o}))n.push(`stale:${s.file}:${s.shortName}`);for(let s of fe(e,{scope:t,...D.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY}).results)n.push(`drift:${s.kind}:${s.file}:${s.dep}`);return[...new Set(n)].sort()}function Je(e){if(e.length===0)return"";let i=0;for(let t=1;t<e.length;t++)e[t]<e[i]&&(i=t);return[...e.slice(i),...e.slice(0,i)].join(">")}function qi(e,i={}){let t=De(e,{scope:i.scope}),o=E(e,i.path);return _e(o,JSON.stringify({version:1,findings:t},null,2)+`
1
+ import{a as $e}from"./chunk-JYBP5ZIR.js";import{a as Se}from"./chunk-35DURZXI.js";import{a as se,c as ae,d as ce,e as D}from"./chunk-2DBY4MO7.js";import{a as Ce}from"./chunk-O56VBJKB.js";import{a as ye}from"./chunk-WENI5ZDR.js";import{a as be}from"./chunk-C2QSK7E7.js";import{a as ge}from"./chunk-BW4VDICR.js";import{a as he}from"./chunk-OBPR6E5Z.js";import{a as fe}from"./chunk-HJYHSTCP.js";import{a as ue}from"./chunk-QYBCGCY5.js";import{b as re}from"./chunk-HGO3D2JD.js";import{a as ne,b as oe}from"./chunk-VDHEX6YO.js";import{a as Q,b as X,c as ee,g as M,h as K}from"./chunk-EUMETOTD.js";import{a as ie,b as F,e as te}from"./chunk-OP5JXGDV.js";import{b as de}from"./chunk-UKUISUS6.js";import{a as B,c as J,d as Y,e as Z}from"./chunk-GRHA5NGF.js";import{a as V}from"./chunk-X566NT42.js";import{a as me,e as pe}from"./chunk-2DUWNJKE.js";import{a as le}from"./chunk-27YDE22N.js";import{a as W}from"./chunk-BTYDBDX5.js";import{f as T,g as A}from"./chunk-5CJ6AQN7.js";import{e as q}from"./chunk-FY6RCFDH.js";import{e as R,f as U,g as N}from"./chunk-7XP7ZRSI.js";import{a as O}from"./chunk-JLZUM476.js";import{e as H}from"./chunk-TLTLJ4SW.js";import{s as z}from"./chunk-M2TRDR25.js";import{createHash as ei}from"crypto";import{existsSync as _}from"fs";function we(e){let[i,t]=j(e,":"),o=i||"unknown",n=(a={})=>{let s=a.actionTier??Me(o);return{sourceAnalyzer:o,actionTier:s,rootCauseKey:a.rootCauseKey??(t||e),label:a.label??`${o} finding`,relatedFiles:a.relatedFiles??[],why:a.why??[],remediation:a.remediation??Ke(s,o),file:a.file}};if(!t)return n({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(o)){let[a,s]=j(t,":");return n({file:a,relatedFiles:a?[a]:[],rootCauseKey:s?`${a}:${s}`:t,label:`${o} finding`,why:s?[`Baseline subject: ${s}.`]:[]})}if(o==="cycle"){let a=t.split(">").filter(Boolean);return n({relatedFiles:a,rootCauseKey:t,label:"cycle finding",why:a.length>0?[`Cycle path: ${a.join(" > ")}.`]:[]})}if(o==="similar"){let a=t.split("|").filter(Boolean);return n({relatedFiles:[],rootCauseKey:t,label:"similarity finding",why:a.length>0?[`Similar symbols: ${a.join(" | ")}.`]:[]})}if(o==="drift"){let[a,s]=j(t,":"),[c,d]=j(s,":");return n({actionTier:a==="unused-import"?"direct":"signal",file:c,relatedFiles:[...new Set([c,d].filter(Boolean))],rootCauseKey:t,label:`${a||"drift"} finding`,why:[...a?[`Drift kind: ${a}.`]:[],...d?[`Related dependency: ${d}.`]:[]]})}return n({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function Me(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function Ke(e,i){return e==="direct"?`Fix the new ${i} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${i} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function j(e,i){let t=e.indexOf(i);return t<0?[e,""]:[e.slice(0,t),e.slice(t+i.length)]}import{existsSync as Le,readFileSync as Pe,writeFileSync as _e}from"fs";import{isAbsolute as He,join as ze}from"path";var Oe=25e3,Ue=2500,qe=2500;function We(e){let i=be(e);return i.symbols>=Oe||i.documents>=Ue?qe:void 0}var Ve=".scipquery-baseline.json";function E(e,i){return i&&He(i)?i:ze(e.config.projectRoot,i??Ve)}function De(e,i={}){let{scope:t}=i,o=We(e),n=[],a=de(e,{scope:t,...D.dead,scanLimit:o});for(let s of a.symbols)T(e,s.relativePath)||A(e,s.symbol,s.relativePath)||s.kind==="dead-code"&&n.push(`dead:${s.relativePath}:${s.shortName}`);for(let s of he(e,{scope:t,...D.isolated,scanLimit:o}))T(e,s.relativePath)||A(e,s.symbol,s.relativePath)||n.push(`isolated:${s.relativePath}:${s.shortName}`);for(let s of le(e,{scope:t}))s.kind==="real"&&n.push(`cycle:${Je(s.path)}`);for(let s of pe(e,{scope:t,...D.similar,scanLimit:o}))n.push(`similar:${[s.symbolA,s.symbolB].sort().join("|")}`);for(let s of ne(e,{scope:t,...D.duplicateBodies,scanLimit:o}))n.push(`duplicate-bodies:${s.hash}:${s.functions.map(c=>c.symbol).sort().join("|")}`);for(let s of ue(e,{scope:t,...D.extract,scanLimit:o}))n.push(`extract:${s.relativePath}:${s.shortName}`);for(let s of Ce(e,{scope:t,...D.wrappers,scanLimit:o}))n.push(`wrapper:${s.file}:${s.shortName}`);for(let s of ge(e,{scope:t,...D.passthroughs,scanLimit:o}))n.push(`passthrough:${s.file}:${s.shortName}`);for(let s of ye(e,{scope:t,...D.stale,scanLimit:o}))n.push(`stale:${s.file}:${s.shortName}`);for(let s of fe(e,{scope:t,...D.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY}).results)n.push(`drift:${s.kind}:${s.file}:${s.dep}`);return[...new Set(n)].sort()}function Je(e){if(e.length===0)return"";let i=0;for(let t=1;t<e.length;t++)e[t]<e[i]&&(i=t);return[...e.slice(i),...e.slice(0,i)].join(">")}function qi(e,i={}){let t=De(e,{scope:i.scope}),o=E(e,i.path);return _e(o,JSON.stringify({version:1,findings:t},null,2)+`
2
2
  `),{path:o,findingCount:t.length}}function ke(e,i={}){let t=E(e,i.path);if(!Le(t))throw new Error(`No baseline found at ${t}. Create one with: scip-query health --write-baseline`);let o=JSON.parse(Pe(t,"utf-8")),n=new Set(o.findings??[]),a=De(e,{scope:i.scope}),s=new Set(a);return{baselinePath:t,baselineCount:n.size,current:a,newFindings:a.filter(c=>!n.has(c)),fixedFindings:[...n].filter(c=>!s.has(c))}}import{existsSync as Ye,mkdirSync as Ji,readdirSync as Ze,readFileSync as Qe,writeFileSync as Yi}from"fs";import{createHash as Qi}from"crypto";import{join as L}from"path";var x=L(".scipquery","suppressions");function Xe(e){return L(e,x)}function ve(e){let i=Xe(e);if(!Ye(i))return{suppressions:[],warnings:[]};let t=[],o=[];for(let n of Ze(i).sort()){if(!n.endsWith(".json"))continue;let a=L(i,n),s;try{s=JSON.parse(Qe(a,"utf-8"))}catch{o.push(`${x}/${n}: malformed JSON \u2014 ignored`);continue}if(typeof s!="object"||s===null||Array.isArray(s)){o.push(`${x}/${n}: not a suppression object \u2014 ignored`);continue}let c=s;if(typeof c.reason!="string"||c.reason.trim()===""){o.push(`${x}/${n}: missing reason \u2014 ignored`);continue}if(!c.id&&!c.check){o.push(`${x}/${n}: needs an id or a check \u2014 ignored`);continue}t.push(c)}return{suppressions:t,warnings:o}}var kt=["echo","incomplete-migration","co-change-partner","twin-partner","coverage-contract","doc-reference","unused-params","new-dead","baseline"];function vt(e,i={}){let t=i.base??"HEAD",{minTogether:o=6,minConfidence:n=.6,maxEchoChecks:a=Number.POSITIVE_INFINITY,maxHelpers:s=Number.POSITIVE_INFINITY,minSimilarity:c=.8,includeBaseline:d=!1,scanLimit:r}=i,f=i.semantic!==!1,m=i.historyMode??"bounded",u=new Set(i.skip??[]),h=ee(e,{base:t}),p=X(e,{base:t,plan:h}),y=p.changedFiles,S=new Set(y),l=new Set(h.changedFileLines),w=new Set([...S,...l]),$=M(e.config.projectRoot,t,K(h,y)),C=Ri(e.config.projectRoot,t,h,$),g={base:t,changedFiles:y,changedSymbols:p.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],attributionNotes:p.attributionNotes,rootCauseGroups:[],note:p.summary.note};if(y.length===0)return g;let k=(G,Ee)=>{if(u.has(G)){g.skipped.push({check:G,reason:"skipped via --skip"});return}let Ie=g.findings.length,Ne=g.skipped.length,Be=g.checksRun.length;z(`diff-gate.check.${G}`,Ee,()=>({check:G,changedFiles:y.length,changedSymbols:p.changedSymbols.length,findingsAdded:g.findings.length-Ie,skippedAdded:g.skipped.length-Ne,checksRunAdded:g.checksRun.length-Be}))};return k("echo",()=>oi(e,p.changedSymbols,S,C,a,c,r,f,g)),k("incomplete-migration",()=>di(e,t,h,s,r,f,$,g)),k("co-change-partner",()=>fi(e,w,o,n,m,g)),k("twin-partner",()=>ui(e,p.changedSymbols,S,r,g)),k("coverage-contract",()=>hi(e,w,g)),k("doc-reference",()=>bi(e,S,l,h.changedRanges,h.renamedFiles,g)),k("unused-params",()=>wi(e,y,g)),k("new-dead",()=>Di(e,p.changedSymbols,C,g)),d&&k("baseline",()=>Ai(e,g)),ti(g,[...e.config.suppressions??[],...ve(e.config.projectRoot).suppressions]),g.rootCauseGroups=ii(g.findings),g}function Ft(e){return e.checksRun.length===0&&e.note===Q}function Rt(e){return e.filter(i=>!i.advisory)}function ii(e){let i=new Map;for(let t of e){let o=t.groupKey??`${t.check}:${t.id}`,n=i.get(o);n||(n={groupKey:o,check:t.check,severity:t.severity,actionTier:t.actionTier,sourceAnalyzer:t.sourceAnalyzer,rootCauseKey:t.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:t.message,remediation:t.remediation},i.set(o,n)),n.count+=1,n.findingIds.push(t.id),n.severity=Ge(n.severity,t.severity),n.actionTier=je(n.actionTier,t.actionTier),t.file&&n.files.add(t.file);for(let a of t.relatedFiles??[])n.relatedFiles.add(a)}return[...i.values()].map(t=>({...t,files:[...t.files].sort(),relatedFiles:[...t.relatedFiles].sort()})).sort((t,o)=>o.count-t.count||I(o.severity)-I(t.severity)||t.groupKey.localeCompare(o.groupKey))}function Ge(e,i){return I(i)>I(e)?i:e}function I(e){return e==="error"?2:e==="warning"?1:0}function je(e,i){return e?i&&Fe(i)>Fe(e)?i:e:i}function Fe(e){return e==="direct"?2:e==="signal"?1:0}function ti(e,i){if(i.length===0||e.findings.length===0)return;let t=[];for(let o of e.findings){let n=i.find(a=>ni(a,o));n?e.suppressed.push({finding:o,suppression:n}):t.push(o)}e.findings=t}function ni(e,i){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==i.id&&!i.legacySuppressionIds?.includes(e.id)||e.check&&e.check!==i.check||e.file&&e.file!==i.file?!1:!!(e.id||e.check)}function v(e,i){e.findings.push({...i,suppressionHint:`scip-query: ignore ${i.check} ${i.id} -- <reason>`})}function oi(e,i,t,o,n,a,s,c,d){d.checksRun.push("echo");for(let r of i.slice(0,n)){if(!N(r.symbol)||o(r))continue;let f=oe(e,r.symbol,{maxLoc:15,scanLimit:s}).filter(l=>!t.has(l.file)).slice(0,5).map(l=>({otherFile:l.file,otherShort:l.shortName,otherSymbol:l.symbol,similarity:1,similarityBasis:"exact-body",sharedEvidence:[`exact normalized body (${l.loc} LOC)`]}));if(f.length>0){let l=b("echo",r.symbol,r.file),w=b("echo",r.symbol,r.file,...f.map(C=>`${C.otherSymbol}|${C.otherFile}`).sort()),$=f[0];v(d,{id:l,legacySuppressionIds:w===l?void 0:[w],groupKey:l,actionTier:"direct",check:"echo",severity:"warning",evidence:"heuristic",confidence:1,file:r.file,symbol:r.symbol,relatedFiles:[...new Set(f.map(C=>C.otherFile))].sort(),sourceAnalyzer:"duplicate-bodies",rootCauseKey:`${r.symbol}:${$.otherSymbol}`,message:Te(r,f),why:Ae(r,f),remediation:xe("direct",r.shortName,$.otherShort)});continue}let m=me(e,r.symbol,{minSimilarity:a,limit:5,scanLimit:s,semantic:c,sourceCandidateMode:"target-pruned"}),u=[];for(let l of m){let w=l.fileA===r.file?l.fileB:l.fileA,$=l.fileA===r.file?l.shortNameB:l.shortNameA,C=l.fileA===r.file?l.symbolB:l.symbolA;t.has(w)||u.push({otherFile:w,otherShort:$,otherSymbol:C,similarity:l.similarity,similarityBasis:l.similarityBasis??"callees",sharedEvidence:l.sharedCallees})}if(u.length===0)continue;let h=u[0],p=b("echo",r.symbol,r.file,...u.map(l=>`${l.otherSymbol}|${l.otherFile}`).sort()),y=b("echo",r.symbol,r.file),S=ri(r,u);v(d,{id:y,legacySuppressionIds:p===y?void 0:[p],groupKey:y,actionTier:S,check:"echo",severity:"warning",evidence:"heuristic",confidence:h.similarity,file:r.file,symbol:r.symbol,relatedFiles:[...new Set(u.map(l=>l.otherFile))].sort(),message:Te(r,u),why:Ae(r,u),remediation:xe(S,r.shortName,h.otherShort)})}i.length>n&&d.skipped.push({check:"echo",reason:`echo check capped at ${n} of ${i.length} changed symbols`})}function ri(e,i){return i.some(o=>si(e.symbol,o))?"direct":"signal"}function si(e,i){if(i.similarityBasis==="exact-body")return!0;if(i.similarityBasis!=="source-tokens"||i.similarity<.98||i.sharedEvidence.length>8)return!1;let t=R(e),o=R(i.otherSymbol);return!t||!o?!1:t===o?!0:li(i.sharedEvidence)?!1:ai(t,o)}function ai(e,i){let t=Re(e),o=Re(i);if(t.length===0||o.length===0)return!1;let n=new Set(o),a=t.filter(s=>n.has(s)).length;return a>=2&&a/Math.min(t.length,o.length)>=.5}function Re(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(i=>i.toLowerCase()).filter(i=>i.length>=2)}var ci=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function li(e){return e.length>=3&&e.every(i=>ci.has(i.toLowerCase()))}function Te(e,i){let t=i[0],o=Math.round(t.similarity*100);return i.length===1?`${e.shortName} (${e.file}) is ${o}% similar to established ${t.otherShort} (${t.otherFile})`:`${e.shortName} (${e.file}) resembles ${i.length} established symbol(s); strongest is ${o}% similar to ${t.otherShort} (${t.otherFile})`}function Ae(e,i){let t=[`${e.shortName} was changed in this diff.`];for(let o of i.slice(0,3))t.push(`${o.otherShort} is outside this diff and scored ${Math.round(o.similarity*100)}% similar by ${o.similarityBasis} evidence.`),t.push(`Shared evidence: ${o.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return i.length>3&&t.push(`${i.length-3} additional similar match(es) grouped into this finding.`),t}function xe(e,i,t){return e==="direct"?`Extract or reuse the shared behavior with ${t}, or keep the duplicate with a suppression reason.`:`Review whether ${i} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function di(e,i,t,o,n,a,s,c){let d=Se(e,{base:i,maxHelpers:o,diffPlan:t,scanLimit:n,semantic:a,baseContentAt:s});if(!d.available){c.skipped.push({check:"incomplete-migration",reason:"no git history"});return}c.checksRun.push("incomplete-migration"),d.note&&c.skipped.push({check:"incomplete-migration",reason:d.note});for(let r of d.findings){let f=r.leftovers.map(l=>`${l.shortName} (${l.file}, ${Math.round(l.containment*100)}% helper / ${Math.round(l.siteCoverage*100)}% site, ${l.migrationScope})`).join(", "),m=r.leftovers.map(l=>`${l.shortName}: ${l.migrationScope} (${l.migrationScopeReasons[0]})`).join("; "),u=[...r.migratedFiles,...r.leftovers.map(l=>l.file)],h=r.leftovers.length===0?void 0:Math.max(...r.leftovers.map(l=>Math.min(l.containment,l.siteCoverage))),p=r.leftovers.some(l=>l.migrationScope==="possible-subtype"),y=b("incomplete-migration",r.helperSymbol,r.helperFile,u.join("|")),S=b("incomplete-migration",r.helperSymbol,r.helperFile);v(c,{id:S,legacySuppressionIds:y===S?void 0:[y],check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:h,file:r.helperFile,symbol:r.helperSymbol,relatedFiles:u,message:`new helper ${r.helperShortName} (${r.helperFile}) is wired into ${r.migratedFiles.length} file(s), but ${r.leftovers.length} similar un-migrated site(s) remain: ${f}`,why:[`${r.helperShortName} is new in this diff and already referenced by ${r.migratedFiles.join(", ")}.`,`Helper shape: ${r.helperShape}; ${r.specificHelperCalleeCount}/${r.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${f}.`,`Migration scope hints: ${m}.`],remediation:p?`Migrate same-scope sites to ${r.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${r.helperShortName}, or confirm they are intentionally different.`})}}function fi(e,i,t,o,n,a){let s=V(e,{historyMode:n}).directionalCoChangePairsForFiles(i,{minTogether:t,minConfidence:0,maxFilesPerCommit:20});if(!s){a.skipped.push({check:"co-change-partner",reason:"no git history"});return}a.checksRun.push("co-change-partner");let c=new Set,d;for(let r of s){let f=i.has(r.fileA),m=i.has(r.fileB);if(f===m)continue;let u=f?r.fileA:r.fileB,h=f?r.fileB:r.fileA,p=f?r.changesA:r.changesB,y=p>0?r.together/p:0;if(y<o||B(h)||B(u)||!_(`${e.config.projectRoot}/${h}`))continue;let S=`${u}|${h}`;if(c.has(S))continue;c.add(S);let l=b("co-change-partner",u,h,String(r.together)),w=b("co-change-partner",u,h),$=J(u,h),C=Y({fileA:u,fileB:h,together:r.together,confidence:y,commitScope:r.commitScope,recency:r.recency,subjectContext:r.subjectContext},$,(d??=Z(e))(u,h)),g=[u,h].sort().join("|");a.findings.push({id:w,legacySuppressionIds:l===w?void 0:[l],check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${g}`,confidence:y,file:u,relatedFiles:[h],sourceAnalyzer:"co-change",rootCauseKey:g,partnerClass:$.partnerClass,partnerClassReasons:$.reasons,commitScope:r.commitScope,recency:r.recency,focusedTogether:r.focusedTogether,broadTogether:r.broadTogether,broadCommitRatio:r.broadCommitRatio,lastTogetherAt:r.lastTogetherAt,recentTogether:r.recentTogether,subjectContext:r.subjectContext,...C?{declaredCouplingSuggestion:C}:{},message:`${u} changed, but ${h} did not \u2014 they change together ${r.together}x (${Math.round(y*100)}% of the time)`,why:[`${u} is in this diff and ${h} is not.`,`Git history shows ${r.together} co-change(s), which is ${Math.round(y*100)}% of changes to the edited side.`,`History context: ${gi(r)}.`,`Subject context: ${mi(r.subjectContext)}.`,...pi(r),`Partner class: ${$.partnerClass} (${$.reasons.join("; ")}).`],remediation:C?`Update ${h} alongside this change, declare the coupling "${C.name}", or confirm the coupling no longer holds.`:`Update ${h} alongside this change, or confirm the coupling no longer holds.`})}}function ui(e,i,t,o,n){n.checksRun.push("twin-partner");let a=re(e,{scanLimit:o}).filter(d=>d.relationship==="divergent"||d.relationship==="identical");if(a.length===0)return;let s=new Map;for(let d of a)for(let r of d.members)s.set(r.symbol,d);let c=new Set;for(let d of i){if(!N(d.symbol))continue;let r=s.get(d.symbol);if(!r)continue;let f=r.members.filter(p=>p.symbol!==d.symbol&&!t.has(p.file));if(f.length===0)continue;let m=[d.symbol,...f.map(p=>p.symbol)].sort().join("|");if(c.has(m))continue;c.add(m);let u=f[0],h=b("twin-partner",d.symbol,d.file,u.symbol);v(n,{id:h,groupKey:`twin-partner:${m}`,check:"twin-partner",severity:"warning",evidence:"heuristic",actionTier:"signal",advisory:!0,confidence:r.relationship==="identical"?1:Math.max(0,1-r.maxDivergence),file:d.file,symbol:d.symbol,relatedFiles:f.map(p=>p.file).sort(),sourceAnalyzer:"twin-drift",rootCauseKey:m,message:`${d.shortName} (${d.file}) changed but its same-name twin ${u.shortName} (${u.file}) did not \u2014 verify the change shouldn't apply to both, or consolidate them.`,why:[`${d.symbol} is in this diff.`,`${u.symbol} shares its (near-)name and is classified '${r.relationship}' with it, but ${u.file} is not in this diff.`,r.relationship==="divergent"?`The two bodies already diverge (~${Math.round(r.maxDivergence*100)}% token difference) \u2014 this diff may widen or narrow that drift.`:"The two bodies were byte-identical before this diff.","Advisory: twin-partner never fails the gate by itself \u2014 see the twin-partner entry in the diff-gate checks table."],remediation:`Update ${u.file} alongside this change, consolidate ${d.shortName}/${u.shortName} into one helper, or confirm the twin should diverge on purpose.`})}}function hi(e,i,t){t.checksRun.push("coverage-contract");let o=e.config.coverageContracts??[];for(let n of o){if(!ae(n,i))continue;let a=se(e,n);if(a.status==="ok")continue;let s=b("coverage-contract",n.name,n.file);v(t,{id:s,groupKey:`coverage-contract:${n.name}`,check:"coverage-contract",severity:a.status==="unavailable"?"warning":"error",evidence:"graph-fact",actionTier:"direct",file:n.file,sourceAnalyzer:"coverage-contracts",rootCauseKey:n.name,message:ce(a),why:[`Contract "${n.name}" declares that ${n.file} (${n.keys.type}) must track ${n.mustEqual.type}.`,a.status==="unavailable"?`The declared side could not be evaluated: ${a.unavailableReason}.`:`Missing: ${a.missing.join(", ")||"none"}. Extra: ${a.extra.join(", ")||"none"}.`,"Either side of this contract changed in this diff."],remediation:a.status==="unavailable"?"Investigate why the declared key set could not be parsed (see the reason above) \u2014 do not treat this as a pass.":`Update ${n.file} so its ${n.keys.type==="object-literal-keys"||n.keys.type==="string-array"?n.keys.identifier:n.keys.marker} matches ${n.mustEqual.type}, or fix the ground-truth source if the declared set is right.`})}}function gi(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${yi(e.lastTogetherAt)}`}function mi(e){let i=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",t=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",o=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(n=>`"${n}"`).join("; "):"none";return`labels ${i}; refs ${t}; samples ${o}; external issue/PR labels ${e.externalIssueLabelStatus}`}function pi(e){let i=[];return e.commitScope==="broad-sweep"&&i.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&i.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),i}function yi(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}var P=3;function bi(e,i,t,o,n,a){a.checksRun.push("doc-reference");let s=F.referenceTargets(e,i,o);if(s.size===0)return;let c=new Set(n.map(r=>r.from)),d=[];for(let r of te(e,s))t.has(r.doc)||ie(e,r.doc)||d.push(Ci(e,r,c));for(let r of Si(d))v(a,r)}function Ci(e,i,t){let o=i.citedClaims.length>0?i.citedClaims:F.citationContexts(e,i.doc,i.cited),n=F.classifyCitation(o),a=F.hasLineAnchoredCitation(i.citations),s=i.cited.some(m=>t.has(m)||!_(`${e.config.projectRoot}/${m}`)),c=!(a||s),d=i.cited[0]??"",r=b("doc-reference",i.doc,i.cited.join("|")),f=b("doc-reference",i.doc,d);return{id:f,legacySuppressionIds:r===f?void 0:[r],check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:n.actionTier,groupKey:`doc-reference:${d}`,rootCauseKey:d,confidence:1,file:i.doc,relatedFiles:i.cited,citationKind:n.citationKind,citationKindReasons:n.reasons,citedClaims:o,...c?{advisory:!0}:{},message:`${i.doc} cites ${i.cited.join(", ")} as ${F.citationKindLabel(n.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${i.cited.join(", ")} changed in this diff.`,`${i.doc} cites the changed file(s) but was not updated in the same diff.`,...n.reasons.map(m=>`Citation kind evidence: ${m}`),c?"Advisory: bare file-mention citation (no line anchor, cited file still present under the same path) \u2014 21.2 calibration found this citation shape low-precision; verify at your leisure.":a?"Blocking: citation includes a line anchor that may now point at the wrong lines.":"Blocking: the cited file was deleted or renamed in this diff \u2014 the citation almost certainly needs an update."],remediation:F.citationRemediation(n.citationKind,i.doc)}}function Si(e){let i=new Map;for(let o of e){let n=o.rootCauseKey??"",a=i.get(n);a?a.push(o):i.set(n,[o])}let t=[];for(let[o,n]of i)n.length<=P?t.push(...n):t.push($i(o,n));return t}function $i(e,i){let t=[...i].sort((f,m)=>(f.file??"").localeCompare(m.file??"")),o=t.slice(0,P).map(f=>({doc:f.file??"",citedClaims:f.citedClaims??[]})),n=t.length-o.length,a=t.every(f=>f.advisory===!0),s=t.reduce((f,m)=>Ge(f,m.severity),"info"),c=t.reduce((f,m)=>je(f,m.actionTier),void 0),d=t.map(f=>f.file??"").filter(f=>f.length>0),r=[...new Set(t.flatMap(f=>[f.id,...f.legacySuppressionIds??[]]))];return{id:b("doc-reference","hub-cluster",e),memberFindingIds:r,check:"doc-reference",severity:s,evidence:"change-graph",actionTier:c,groupKey:`doc-reference:${e}`,rootCauseKey:e,confidence:1,file:o[0]?.doc,relatedFiles:[e],citationCount:t.length,citationExemplars:o,suppressedCount:n,...a?{advisory:!0}:{},message:`${e} is cited by ${t.length} doc(s) changed in this diff, doc(s) untouched \u2014 showing ${o.length} example(s), ${n} more damped`,why:[`${e} changed in this diff.`,`${t.length} doc(s) cite it but were not updated in the same diff: ${d.join(", ")}.`,...o.map(f=>`Example \u2014 ${f.doc}: ${f.citedClaims[0]??"(no captured citation text)"}`),`${n} additional doc(s) also cite this file, past the per-hub-file cascade cap (${P}) \u2014 not silently dropped: counted in citationCount/suppressedCount and individually addressable via memberFindingIds.`,a?"Advisory: every citation in this cluster is a bare file-mention (no line anchor, cited file still present).":"Blocking: at least one citation in this cluster is line-anchored or cites a deleted/renamed file."],remediation:`Review the ${o.length} example doc(s) above; ${t.length} total doc(s) cite ${e} the same way \u2014 see citationExemplars and memberFindingIds in --json for the complete list.`}}function wi(e,i,t){t.checksRun.push("unused-params");for(let o of $e(e,{files:i,limit:50})){let n=b("unused-params",o.symbol,o.file,o.unusedTrailing.join("|")),a=b("unused-params",o.symbol,o.file);v(t,{id:a,legacySuppressionIds:n===a?void 0:[n],check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:o.file,startLine:o.startLine,endLine:o.endLine,symbol:o.symbol,message:`${o.shortName} (${o.file}) has trailing unused parameter(s): ${o.unusedTrailing.join(", ")}`,why:[`${o.shortName} is in a changed file.`,`The trailing parameter(s) ${o.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function Di(e,i,t,o){o.checksRun.push("new-dead");let n=new W(e),a=H(e.config.projectRoot),s=a.length>1;for(let c of i){if(t(c)||c.fanIn>0||n.fileKind(c.file)==="test"||T(e,c.file)||A(e,c.symbol,c.file)||Fi(c.symbol))continue;let d=b("new-dead",c.symbol,c.file),r=s&&ki(a,c.file)&&vi(e,c.symbol);v(o,{id:d,check:"new-dead",severity:"warning",evidence:r?"heuristic":"graph-fact",confidence:r?.4:.9,file:c.file,symbol:c.symbol,message:r?`${c.shortName} (${c.file}) unconfirmed (cross-package ambiguous-name resolution gap): zero indexed consumers found, but this name is ambiguous project-wide and lives in a workspace package \u2014 verify manually before treating as dead`:`${c.shortName} (${c.file}) was changed but has zero indexed consumers`,why:r?[`${c.shortName} is a changed production symbol in a workspace package.`,"The index, semantic, and source-fallback layers all report zero consumers for this symbol.","Its leaf name is ambiguous project-wide (a same-named definition exists elsewhere), and cross-package consumers reached only through a re-exporting barrel are a known unresolvable shape for this tool \u2014 see docs/plans/2026-07-02-followups.md item 2."]:[`${c.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:r?"Verify with a direct code search before deleting; this tool cannot confidently resolve this symbol.":"Wire it up, or remove it before it becomes permanent dead code."})}}function ki(e,i){return e.some(t=>i===t.relativeDir||i.startsWith(`${t.relativeDir}/`))}function vi(e,i){let t=R(i);return t?(q(e).get(t)?.length??0)>1:!1}function Fi(e){if(U(e)!=="type")return!1;let i=R(e);return i.startsWith("_Assert")||i.startsWith("Assert")}function Ri(e,i,t,o){let n=new Map(t.renamedFiles.map(s=>[s.to,s.from])),a=o??M(e,i,K(t));return s=>{let c=n.get(s.file)??s.file,d=R(s.symbol);if(!d)return!1;let r=a(c);return r!==null&&Ti(r,d)}}function Ti(e,i){return new RegExp(`\\b${O(i)}\\b`).test(e)}function Ai(e,i){if(!_(E(e))){i.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("baseline");let t=ke(e);for(let o of t.newFindings){let n=we(o),a=b("baseline",o);v(i,{id:a,groupKey:`baseline:${n.sourceAnalyzer}:${n.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:n.actionTier,confidence:1,file:n.file,relatedFiles:n.relatedFiles.length>0?n.relatedFiles:void 0,sourceAnalyzer:n.sourceAnalyzer,rootCauseKey:n.rootCauseKey,message:`new ${n.label} vs committed baseline: ${o}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${n.sourceAnalyzer}.`,`Inherited action tier: ${n.actionTier}.`,`Root cause key: ${n.rootCauseKey}.`,...n.why],remediation:n.remediation})}}function b(e,...i){return`SQ${ei("sha256").update([e,...i].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{De as a,qi as b,ke as c,kt as d,vt as e,Ft as f,Rt as g,Ri as h};
3
- //# sourceMappingURL=chunk-SREWDA7Q.js.map
3
+ //# sourceMappingURL=chunk-W2I4QAW7.js.map
@@ -1,2 +1,2 @@
1
- import{b as d}from"./chunk-B75HZHUP.js";import{a as u}from"./chunk-CYDOV3AQ.js";import{a as y,c as p}from"./chunk-TCOWAGR2.js";import{d as f}from"./chunk-7XP7ZRSI.js";function F(s,o={}){let{limit:l=20,scope:a,minFanIn:i=2,minFanOut:m=2,scanLimit:t}=o,r=new u(s);return d(r.productionCallableDefinitions({scope:a,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof t=="number"&&t>0}),t).map(e=>g(s,e,o.semantic!==!1)).filter(e=>e.fanIn>=i&&e.fanOut>=m).sort((e,b)=>b.score-e.score||b.fanIn-e.fanIn).slice(0,l)}function g(s,o,l){let a=[...new Set(p(s,o,{limit:500,semantic:l}).map(n=>n.file))].sort(),i=new Map;for(let n of y(s,o,{limit:500,semantic:l})){if(n.file===o.relativePath)continue;let e=`${n.symbol}|${n.file}`;i.has(e)||i.set(e,{symbol:n.symbol,shortName:f(n.symbol),file:n.file})}let m=[...i.values()].sort((n,e)=>n.file.localeCompare(e.file)||n.symbol.localeCompare(e.symbol)),t=a.length,r=m.length,c=t*r;return{symbol:o.symbol,shortName:f(o.symbol),fanIn:t,fanOut:r,callerFiles:a,externalCallees:m,score:c,definedIn:o.relativePath,actionTier:"signal",riskKind:"coordination-hotspot",evidenceReasons:[`${t} incoming file(s) reference this symbol`,`${r} distinct cross-file callee symbol(s) are reached from it`,`centrality score is ${c} (fan-in * fan-out)`],recommendation:"Review ownership, API stability, and caller groups before changing this central symbol; do not refactor solely from graph centrality."}}export{F as a};
2
- //# sourceMappingURL=chunk-5ODF4JGH.js.map
1
+ import{b as d}from"./chunk-B75HZHUP.js";import{a as u}from"./chunk-BTYDBDX5.js";import{a as y,c as p}from"./chunk-3YEBIYXL.js";import{d as f}from"./chunk-7XP7ZRSI.js";function F(s,o={}){let{limit:l=20,scope:a,minFanIn:i=2,minFanOut:m=2,scanLimit:t}=o,r=new u(s);return d(r.productionCallableDefinitions({scope:a,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof t=="number"&&t>0}),t).map(e=>g(s,e,o.semantic!==!1)).filter(e=>e.fanIn>=i&&e.fanOut>=m).sort((e,b)=>b.score-e.score||b.fanIn-e.fanIn).slice(0,l)}function g(s,o,l){let a=[...new Set(p(s,o,{limit:500,semantic:l}).map(n=>n.file))].sort(),i=new Map;for(let n of y(s,o,{limit:500,semantic:l})){if(n.file===o.relativePath)continue;let e=`${n.symbol}|${n.file}`;i.has(e)||i.set(e,{symbol:n.symbol,shortName:f(n.symbol),file:n.file})}let m=[...i.values()].sort((n,e)=>n.file.localeCompare(e.file)||n.symbol.localeCompare(e.symbol)),t=a.length,r=m.length,c=t*r;return{symbol:o.symbol,shortName:f(o.symbol),fanIn:t,fanOut:r,callerFiles:a,externalCallees:m,score:c,definedIn:o.relativePath,actionTier:"signal",riskKind:"coordination-hotspot",evidenceReasons:[`${t} incoming file(s) reference this symbol`,`${r} distinct cross-file callee symbol(s) are reached from it`,`centrality score is ${c} (fan-in * fan-out)`],recommendation:"Review ownership, API stability, and caller groups before changing this central symbol; do not refactor solely from graph centrality."}}export{F as a};
2
+ //# sourceMappingURL=chunk-W3HSUCRG.js.map
@@ -1,4 +1,4 @@
1
- import{a as D,b as v,c as $,d as B}from"./chunk-LC57FSPX.js";import{a as K}from"./chunk-BGUYAA3Q.js";import{a as A}from"./chunk-CYDOV3AQ.js";import{b as M,g as R}from"./chunk-5CJ6AQN7.js";import{a as g}from"./chunk-BGBBVSH4.js";import{g as I}from"./chunk-TCOWAGR2.js";import{b as k,d as F,e as b}from"./chunk-7XP7ZRSI.js";import{l as w}from"./chunk-JLZUM476.js";import{y as C}from"./chunk-M2TRDR25.js";function de(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:l=!1,scanLimit:o}=e??{},d=e?.semantic!==!1,a=new A(t),m=a.scopedDefinitions(n),y=Q(a,n),p={high:0,medium:1,low:2};return K({candidates:()=>O(t,a,m,{minLoc:i,maxLoc:s}),orderCandidates:(u,c)=>g(c)-g(u)||u.relativePath.localeCompare(c.relativePath),scanLimit:o,profile:{name:"stale-abstractions"},prepare:u=>{let c=U(u),f=W(t,a,u,c,{semantic:d}),h=u.filter(P=>{let x=S(t,P,f,c);return x.realConsumers.length<=1&&!x.transitivelyReachable&&j(P,x.realConsumers.length,y)});return{consumerFileMap:f,singletonBackedClassIds:H(t,a,m,h,{semantic:d}),candidateIndex:c}},evaluate:(u,c)=>{if(c.singletonBackedClassIds.has(u.symbolId))return null;let f=S(t,u,c.consumerFileMap,c.candidateIndex);if(f.transitivelyReachable||f.realConsumers.length>1||f.realConsumers.length===0&&f.barrelConsumers>0||!j(f.definition,f.realConsumers.length,y))return null;let h=V(t,f);return!l&&h.confidence==="low"?null:h},orderResults:(u,c)=>p[u.confidence]-p[c.confidence]||c.loc-u.loc||u.file.localeCompare(c.file)||u.startLine-c.startLine,limit:r})}function O(t,e,n,i){return n.filter(s=>s.isTypeLike&&g(s)>=i.minLoc).filter(s=>g(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>!s.relativePath.endsWith(".d.ts")).filter(s=>M(s.relativePath)!=="test").filter(s=>!R(t,s.symbol,s.relativePath)).filter(s=>!X(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function L(t,e,n,i){return v(D(t,e).forDefinitions(n,{semantic:i.semantic,sourceFallback:i.sourceFallback}))}function W(t,e,n,i,s){let r=L(t,e,n,{semantic:!1,sourceFallback:!1}),l=n.filter(a=>{let m=S(t,a,r,i);return m.realConsumers.length<=1&&!(m.realConsumers.length>0&&T(a.relativePath))}),o=s.semantic&&l.length>0?I(r,L(t,e,l,{semantic:!0,sourceFallback:!1})):r,d=l.filter(a=>S(t,a,o,i).realConsumers.length<=1);return I(o,L(t,e,d,{semantic:!1,sourceFallback:!0}))}function U(t){let e=new Map;for(let n of t){let i=e.get(n.relativePath);i||(i=new Map,e.set(n.relativePath,i));let s=b(n.symbol);s&&i.set(s,n)}return e}function S(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(m=>m!==e.relativePath&&!t.isIgnored(m)),{realConsumers:l,barrelConsumers:o,importOnlyConsumers:d}=$(t,e,r),a=Y(t,e,n,i);return{definition:e,realConsumers:l,barrelConsumers:o+d,transitivelyReachable:a}}function V(t,e){let n=E(t,e.definition.relativePath,e.definition.startLine),i=T(e.definition.relativePath)?!0:ee(t,e.definition),{confidence:s,reason:r}=ne(e.realConsumers.length,n,i),l=z(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:F(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:g(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:r,actionTier:l.actionTier,stalenessKind:l.stalenessKind,recommendation:l.recommendation}}function z(t,e,n){return t===0?{actionTier:"direct",stalenessKind:"unused-abstraction",recommendation:"Delete the abstraction or wire the missing consumer after checking public/package surfaces."}:e==="class"?{actionTier:"signal",stalenessKind:"one-to-one-class-encapsulation",recommendation:"Treat as weak signal: a one-consumer class may be intentional encapsulation, so inline only after reviewing ownership and state boundaries."}:n?{actionTier:"signal",stalenessKind:"single-consumer-abstraction",recommendation:"Review whether this single-consumer abstraction earns its name or should be folded into the owning feature."}:{actionTier:"signal",stalenessKind:"misplaced-single-consumer-type",recommendation:"Review moving or co-locating the type with its only real consumer; keep it here only if this file owns the public contract."}}function H(t,e,n,i,s){let r=_(t,Z(n),i),l=r.map(a=>a.singleton);if(r.length===0)return new Set;let o=v(D(t,e).forDefinitions(l,{semantic:s.semantic,sourceFallback:!0})),d=new Set;for(let{singleton:a,classId:m}of r)G(t,a,o)&&d.add(m);return d}function Z(t){let e=new Map;for(let n of t){let i=b(n.symbol);i&&e.set(N(n.relativePath,i),n)}return e}function _(t,e,n){let i=[];for(let s of n){let r=q(t,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function q(t,e,n){if(E(t,n.relativePath,n.startLine)!=="class")return null;let i=b(n.symbol);if(!i)return null;let s=J(t,n.relativePath,i);return s?e.get(N(n.relativePath,s))??null:null}function G(t,e,n){let i=b(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!B(t,r,i))}function N(t,e){return`${t}\0${e}`}function J(t,e,n){let i=C(t,e);if(!i)return null;let s=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function Q(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function X(t){let e=k(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function T(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function j(t,e,n){return!(T(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function Y(t,e,n,i){let s=w(t,e.relativePath),r=b(e.symbol);if(!r)return!1;let l=i.get(e.relativePath);if(!l)return!1;let o=[...s.get(r)??[]],d=new Set;for(;o.length>0;){let a=o.pop();if(d.has(a))continue;d.add(a);let m=l.get(a);if(!m)continue;let y=n.get(m.symbolId);if(y){for(let p of y)if(p!==e.relativePath&&!t.isIgnored(p))return!0}for(let p of s.get(a)??[])o.push(p)}return!1}function E(t,e,n){let i=C(t,e);if(!i)return"other";let s=i.split(`
1
+ import{a as D,b as v,c as $,d as B}from"./chunk-V7MX6YUF.js";import{a as K}from"./chunk-BGUYAA3Q.js";import{a as A}from"./chunk-BTYDBDX5.js";import{b as M,g as R}from"./chunk-5CJ6AQN7.js";import{a as g}from"./chunk-BGBBVSH4.js";import{g as I}from"./chunk-3YEBIYXL.js";import{b as k,d as F,e as b}from"./chunk-7XP7ZRSI.js";import{l as w}from"./chunk-JLZUM476.js";import{y as C}from"./chunk-M2TRDR25.js";function de(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:l=!1,scanLimit:o}=e??{},d=e?.semantic!==!1,a=new A(t),m=a.scopedDefinitions(n),y=Q(a,n),p={high:0,medium:1,low:2};return K({candidates:()=>O(t,a,m,{minLoc:i,maxLoc:s}),orderCandidates:(u,c)=>g(c)-g(u)||u.relativePath.localeCompare(c.relativePath),scanLimit:o,profile:{name:"stale-abstractions"},prepare:u=>{let c=U(u),f=W(t,a,u,c,{semantic:d}),h=u.filter(P=>{let x=S(t,P,f,c);return x.realConsumers.length<=1&&!x.transitivelyReachable&&j(P,x.realConsumers.length,y)});return{consumerFileMap:f,singletonBackedClassIds:H(t,a,m,h,{semantic:d}),candidateIndex:c}},evaluate:(u,c)=>{if(c.singletonBackedClassIds.has(u.symbolId))return null;let f=S(t,u,c.consumerFileMap,c.candidateIndex);if(f.transitivelyReachable||f.realConsumers.length>1||f.realConsumers.length===0&&f.barrelConsumers>0||!j(f.definition,f.realConsumers.length,y))return null;let h=V(t,f);return!l&&h.confidence==="low"?null:h},orderResults:(u,c)=>p[u.confidence]-p[c.confidence]||c.loc-u.loc||u.file.localeCompare(c.file)||u.startLine-c.startLine,limit:r})}function O(t,e,n,i){return n.filter(s=>s.isTypeLike&&g(s)>=i.minLoc).filter(s=>g(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>!s.relativePath.endsWith(".d.ts")).filter(s=>M(s.relativePath)!=="test").filter(s=>!R(t,s.symbol,s.relativePath)).filter(s=>!X(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function L(t,e,n,i){return v(D(t,e).forDefinitions(n,{semantic:i.semantic,sourceFallback:i.sourceFallback}))}function W(t,e,n,i,s){let r=L(t,e,n,{semantic:!1,sourceFallback:!1}),l=n.filter(a=>{let m=S(t,a,r,i);return m.realConsumers.length<=1&&!(m.realConsumers.length>0&&T(a.relativePath))}),o=s.semantic&&l.length>0?I(r,L(t,e,l,{semantic:!0,sourceFallback:!1})):r,d=l.filter(a=>S(t,a,o,i).realConsumers.length<=1);return I(o,L(t,e,d,{semantic:!1,sourceFallback:!0}))}function U(t){let e=new Map;for(let n of t){let i=e.get(n.relativePath);i||(i=new Map,e.set(n.relativePath,i));let s=b(n.symbol);s&&i.set(s,n)}return e}function S(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(m=>m!==e.relativePath&&!t.isIgnored(m)),{realConsumers:l,barrelConsumers:o,importOnlyConsumers:d}=$(t,e,r),a=Y(t,e,n,i);return{definition:e,realConsumers:l,barrelConsumers:o+d,transitivelyReachable:a}}function V(t,e){let n=E(t,e.definition.relativePath,e.definition.startLine),i=T(e.definition.relativePath)?!0:ee(t,e.definition),{confidence:s,reason:r}=ne(e.realConsumers.length,n,i),l=z(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:F(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:g(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:r,actionTier:l.actionTier,stalenessKind:l.stalenessKind,recommendation:l.recommendation}}function z(t,e,n){return t===0?{actionTier:"direct",stalenessKind:"unused-abstraction",recommendation:"Delete the abstraction or wire the missing consumer after checking public/package surfaces."}:e==="class"?{actionTier:"signal",stalenessKind:"one-to-one-class-encapsulation",recommendation:"Treat as weak signal: a one-consumer class may be intentional encapsulation, so inline only after reviewing ownership and state boundaries."}:n?{actionTier:"signal",stalenessKind:"single-consumer-abstraction",recommendation:"Review whether this single-consumer abstraction earns its name or should be folded into the owning feature."}:{actionTier:"signal",stalenessKind:"misplaced-single-consumer-type",recommendation:"Review moving or co-locating the type with its only real consumer; keep it here only if this file owns the public contract."}}function H(t,e,n,i,s){let r=_(t,Z(n),i),l=r.map(a=>a.singleton);if(r.length===0)return new Set;let o=v(D(t,e).forDefinitions(l,{semantic:s.semantic,sourceFallback:!0})),d=new Set;for(let{singleton:a,classId:m}of r)G(t,a,o)&&d.add(m);return d}function Z(t){let e=new Map;for(let n of t){let i=b(n.symbol);i&&e.set(N(n.relativePath,i),n)}return e}function _(t,e,n){let i=[];for(let s of n){let r=q(t,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function q(t,e,n){if(E(t,n.relativePath,n.startLine)!=="class")return null;let i=b(n.symbol);if(!i)return null;let s=J(t,n.relativePath,i);return s?e.get(N(n.relativePath,s))??null:null}function G(t,e,n){let i=b(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!B(t,r,i))}function N(t,e){return`${t}\0${e}`}function J(t,e,n){let i=C(t,e);if(!i)return null;let s=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function Q(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function X(t){let e=k(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function T(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function j(t,e,n){return!(T(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function Y(t,e,n,i){let s=w(t,e.relativePath),r=b(e.symbol);if(!r)return!1;let l=i.get(e.relativePath);if(!l)return!1;let o=[...s.get(r)??[]],d=new Set;for(;o.length>0;){let a=o.pop();if(d.has(a))continue;d.add(a);let m=l.get(a);if(!m)continue;let y=n.get(m.symbolId);if(y){for(let p of y)if(p!==e.relativePath&&!t.isIgnored(p))return!0}for(let p of s.get(a)??[])o.push(p)}return!1}function E(t,e,n){let i=C(t,e);if(!i)return"other";let s=i.split(`
2
2
  `),r=Math.max(0,n-2),l=Math.min(s.length-1,n+2);for(let o=r;o<=l;o++){let a=(s[o]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(a))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(a))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(a))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(a))return"enum"}return"other"}function ee(t,e){let n=C(t,e.relativePath);if(!n)return!1;let i=b(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),l=n.split(`
3
3
  `);for(let o=0;o<l.length;o++)if(!(o>=e.startLine&&o<=e.endLine)&&r.test(l[o]??""))return!0;return!1}function ne(t,e,n){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!n?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}export{de as a};
4
- //# sourceMappingURL=chunk-VCOAUTSI.js.map
4
+ //# sourceMappingURL=chunk-WENI5ZDR.js.map
@@ -1,4 +1,4 @@
1
- import{a as M}from"./chunk-BGUYAA3Q.js";import{c as C}from"./chunk-ABRWGVC6.js";import{a as I}from"./chunk-CYDOV3AQ.js";import{g as d}from"./chunk-TCOWAGR2.js";import{f as h}from"./chunk-QNCVN5EH.js";import{d as f}from"./chunk-MTDBHTSF.js";import{d as g}from"./chunk-7XP7ZRSI.js";import{f as y}from"./chunk-JLZUM476.js";var x=new Set(f());function N(e,n){let{scope:o,minLoc:r=10,limit:i=30,scanLimit:t}=n??{},s=new I(e);return M({candidates:()=>s.productionCallableDefinitions({scope:o,minLoc:r,requireFunctionLikeSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof t=="number"&&t>0}),scanLimit:t,filterCandidate:S,profile:{name:"complexity-hotspots"},prepare:a=>{let l=B(e,a),m=n?.semantic!==!1,c=m?h(e):null;c?.materializeReferences(a,{prefetchCallees:!0});let u=s.crossFileCallerMap(a,{semantic:!1});return{callerMap:c?d(u,c.callerMap(a)):u,calleeMap:s.calleeMap(a,{semantic:m}),languageByFile:l,clojureCallableIds:D(e,a,l),branchEstimates:C(e,a)}},evaluate:(a,l)=>L(a,l,r),orderResults:(a,l)=>l.score-a.score||l.loc-a.loc,limit:i})}function S(e){return e.symbol.startsWith("rust-analyzer ")?typeof e.kind=="number"&&x.has(e.kind):!0}function L(e,n,o){if(n.languageByFile.get(e.relativePath)==="clojure"&&!n.clojureCallableIds.has(e.symbolId))return null;let r=e.endLine-e.startLine+1;if(r<o)return null;let i=n.callerMap.get(e.symbolId)?.size??0,t=n.calleeMap.get(e.symbolId)??[],s=new Set,a=new Set;for(let p of t){let b=`${p.symbol}|${p.file}`;s.add(b),p.file!==e.relativePath&&a.add(b)}let l=a.size,m=s.size,c=n.branchEstimates.get(e.symbolId)??{branches:0,estimateBasis:"regex-fallback"},u=c.branches+1;return{symbol:e.symbol,shortName:g(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:r,fanIn:i,fanOut:l,calleeCount:m,branches:c.branches,estimateBasis:c.estimateBasis,score:Math.round(r/50*(i/5)*Math.max(l/5,1)*Math.max(u/5,1)*100)/100}}function B(e,n){let o=[...new Set(n.map(t=>t.relativePath))];if(o.length===0)return new Map;let r=o.map(()=>"?").join(", "),i=e.all(`SELECT relative_path, language
1
+ import{a as M}from"./chunk-BGUYAA3Q.js";import{c as C}from"./chunk-PPAT3XUL.js";import{a as I}from"./chunk-BTYDBDX5.js";import{g as d}from"./chunk-3YEBIYXL.js";import{f as h}from"./chunk-KWMRY4RN.js";import{d as f}from"./chunk-MTDBHTSF.js";import{d as g}from"./chunk-7XP7ZRSI.js";import{f as y}from"./chunk-JLZUM476.js";var x=new Set(f());function N(e,n){let{scope:o,minLoc:r=10,limit:i=30,scanLimit:t}=n??{},s=new I(e);return M({candidates:()=>s.productionCallableDefinitions({scope:o,minLoc:r,requireFunctionLikeSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof t=="number"&&t>0}),scanLimit:t,filterCandidate:S,profile:{name:"complexity-hotspots"},prepare:a=>{let l=B(e,a),m=n?.semantic!==!1,c=m?h(e):null;c?.materializeReferences(a,{prefetchCallees:!0});let u=s.crossFileCallerMap(a,{semantic:!1});return{callerMap:c?d(u,c.callerMap(a)):u,calleeMap:s.calleeMap(a,{semantic:m}),languageByFile:l,clojureCallableIds:D(e,a,l),branchEstimates:C(e,a)}},evaluate:(a,l)=>L(a,l,r),orderResults:(a,l)=>l.score-a.score||l.loc-a.loc,limit:i})}function S(e){return e.symbol.startsWith("rust-analyzer ")?typeof e.kind=="number"&&x.has(e.kind):!0}function L(e,n,o){if(n.languageByFile.get(e.relativePath)==="clojure"&&!n.clojureCallableIds.has(e.symbolId))return null;let r=e.endLine-e.startLine+1;if(r<o)return null;let i=n.callerMap.get(e.symbolId)?.size??0,t=n.calleeMap.get(e.symbolId)??[],s=new Set,a=new Set;for(let p of t){let b=`${p.symbol}|${p.file}`;s.add(b),p.file!==e.relativePath&&a.add(b)}let l=a.size,m=s.size,c=n.branchEstimates.get(e.symbolId)??{branches:0,estimateBasis:"regex-fallback"},u=c.branches+1;return{symbol:e.symbol,shortName:g(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:r,fanIn:i,fanOut:l,calleeCount:m,branches:c.branches,estimateBasis:c.estimateBasis,score:Math.round(r/50*(i/5)*Math.max(l/5,1)*Math.max(u/5,1)*100)/100}}function B(e,n){let o=[...new Set(n.map(t=>t.relativePath))];if(o.length===0)return new Map;let r=o.map(()=>"?").join(", "),i=e.all(`SELECT relative_path, language
2
2
  FROM documents
3
3
  WHERE relative_path IN (${r})`,...o);return new Map(i.map(t=>[t.relative_path,t.language?.toLowerCase()??null]))}function D(e,n,o){let r=new Set,i=new Map;for(let t of n){if(o.get(t.relativePath)!=="clojure")continue;let s=i.get(t.relativePath);s||(s=new Set((y(e,t.relativePath)?.callables??[]).map(a=>`${a.name}:${a.startLine}`)),i.set(t.relativePath,s)),s.has(`${t.leaf}:${t.startLine}`)&&r.add(t.symbolId)}return r}export{N as a};
4
- //# sourceMappingURL=chunk-VPVAQRHM.js.map
4
+ //# sourceMappingURL=chunk-WGDIA2TU.js.map
@@ -1,2 +1,2 @@
1
- import{a as f}from"./chunk-CYDOV3AQ.js";import{a as h}from"./chunk-2HCWAL42.js";import{e as s,g as u}from"./chunk-7XP7ZRSI.js";import{f as d}from"./chunk-JLZUM476.js";import{B as c}from"./chunk-TLTLJ4SW.js";import{basename as p}from"path";function N(r,o){let t=h(r,o);if(!t)return[];let e=s(t.symbol),a=new f(r).definitionsForFile(t.relativePath).filter(n=>u(n.symbol)),l=a.filter(n=>n.parentTypeName===e||n.symbol.includes(e)),m=(l.length>0?l:L(p(t.relativePath))===e?a.filter(n=>n.symbol.includes("<invalid-global-code>")):[]).map(n=>({startLine:n.startLine,endLine:n.endLine,name:s(n.symbol)}));return c(t.relativePath)!=="clojure"?m:b(m,M(r,t))}function L(r){return r.replace(/\.[^.]+$/,"")}function M(r,o){let t=s(o.symbol);return t?(d(r,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function b(r,o){let t=new Map;for(let e of[...r,...o])t.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...t.values()].sort((e,i)=>e.startLine-i.startLine||e.endLine-i.endLine)}export{N as a};
2
- //# sourceMappingURL=chunk-7MT6UM4D.js.map
1
+ import{a as f}from"./chunk-BTYDBDX5.js";import{a as h}from"./chunk-2HCWAL42.js";import{e as s,g as u}from"./chunk-7XP7ZRSI.js";import{f as d}from"./chunk-JLZUM476.js";import{B as c}from"./chunk-TLTLJ4SW.js";import{basename as p}from"path";function N(r,o){let t=h(r,o);if(!t)return[];let e=s(t.symbol),a=new f(r).definitionsForFile(t.relativePath).filter(n=>u(n.symbol)),l=a.filter(n=>n.parentTypeName===e||n.symbol.includes(e)),m=(l.length>0?l:L(p(t.relativePath))===e?a.filter(n=>n.symbol.includes("<invalid-global-code>")):[]).map(n=>({startLine:n.startLine,endLine:n.endLine,name:s(n.symbol)}));return c(t.relativePath)!=="clojure"?m:b(m,M(r,t))}function L(r){return r.replace(/\.[^.]+$/,"")}function M(r,o){let t=s(o.symbol);return t?(d(r,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function b(r,o){let t=new Map;for(let e of[...r,...o])t.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...t.values()].sort((e,i)=>e.startLine-i.startLine||e.endLine-i.endLine)}export{N as a};
2
+ //# sourceMappingURL=chunk-WT34AUWL.js.map
@@ -1,2 +1,2 @@
1
- import{b as i}from"./chunk-A4KRWTXD.js";function l(n,o,s,t={}){let e=i(n,o,s,t);return e?{symbolA:e.symbolA,symbolB:e.symbolB,similarity:e.similarity,sharedCallees:e.sharedEvidence,uniqueToA:e.uniqueToA,uniqueToB:e.uniqueToB,consolidationStrategy:e.consolidationStrategy}:null}export{l as a};
2
- //# sourceMappingURL=chunk-OP5RO2CF.js.map
1
+ import{b as i}from"./chunk-2DUWNJKE.js";function l(n,o,s,t={}){let e=i(n,o,s,t);return e?{symbolA:e.symbolA,symbolB:e.symbolB,similarity:e.similarity,sharedCallees:e.sharedEvidence,uniqueToA:e.uniqueToA,uniqueToB:e.uniqueToB,consolidationStrategy:e.consolidationStrategy}:null}export{l as a};
2
+ //# sourceMappingURL=chunk-Y4BBVPRK.js.map