MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / triggersForFile

Function triggersForFile

src/graph/branch-guards.ts:800–816  ·  view source on GitHub ↗
(
  absPath: string,
  language: Language,
  sites: readonly CallSite[]
)

Source from the content-addressed store, hash-verified

798const MAX_TRIGGER_CLIMB = 24;
799
800export async function triggersForFile(
801 absPath: string,
802 language: Language,
803 sites: readonly CallSite[]
804): Promise<Map<string, SiteTrigger>> {
805 const out = new Map<string, SiteTrigger>();
806 if (!JS_FAMILY.has(language) || sites.length === 0) return out;
807 const cached = await treeFor(absPath, language);
808 if (!cached) return out;
809 for (const site of sites) {
810 const key = siteKey(site);
811 if (out.has(key)) continue;
812 const t = triggerInTree(cached.tree.rootNode, cached.source, site.line, site.column ?? null);
813 if (t !== null) out.set(key, t);
814 }
815 return out;
816}
817
818/** {@link triggersForFile} over source text — the test surface. */
819export async function triggerInSource(

Callers 1

triggerFunction · 0.90

Calls 5

treeForFunction · 0.85
siteKeyFunction · 0.85
triggerInTreeFunction · 0.85
hasMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected