#!/usr/bin/env node
import{a as u}from"./chunk-JBABAK44.js";import{a as f,b as l}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var m={name:"ag-references",summary:"find all references to a symbol",usage:"ag-references <symbol_name>",options:["    --help        display this help and exit"]},h={name:"ag-references",async execute(i,a){if(l(i))return f(m);let s=u("ag-references",i,Object.create(null));if(!s.ok)return s.error;let{positional:d}=s.result,n=d[0];if(!n)return{stdout:"",stderr:`ag-references: missing symbol name
`,exitCode:2};if(!a.bash)return{stdout:"",stderr:`ag-references: no bash host available
`,exitCode:1};let r=a.bash.semanticEngine.getOccurrences(n);if(r.length===0)return{stdout:`No references found for '${n}'.
`,stderr:"",exitCode:0};let c=r.filter(e=>!e.isDefinition).map(e=>`  - ${e.path}: line ${e.line} (in ${e.scope})`).join(`
`),t=r.find(e=>e.isDefinition),o=`Found ${r.length} occurrences of '${n}':
`;return t&&(o+=`Definition: ${t.path}: line ${t.line}
`),c&&(o+=`References:
${c}
`),{stdout:o,stderr:"",exitCode:0}}};export{h as agReferencesCommand};
