MCPcopy
hub / github.com/colbymchenry/codegraph / resolveTargetFlag

Function resolveTargetFlag

src/installer/targets/registry.ts:66–91  ·  view source on GitHub ↗
(value: string, loc: Location)

Source from the content-addressed store, hash-verified

64 * - csv list — `'claude,cursor'` etc. Unknown ids throw.
65 */
66export function resolveTargetFlag(value: string, loc: Location): AgentTarget[] {
67 if (value === 'none') return [];
68 if (value === 'all') return [...ALL_TARGETS];
69 if (value === 'auto') {
70 const detected = detectAll(loc).filter(({ detection }) => detection.installed);
71 if (detected.length > 0) return detected.map(({ target }) => target);
72 const fallback = getTarget('claude');
73 return fallback ? [fallback] : [];
74 }
75
76 const ids = value.split(',').map((s) => s.trim()).filter(Boolean);
77 const resolved: AgentTarget[] = [];
78 const unknown: string[] = [];
79 for (const id of ids) {
80 const t = getTarget(id);
81 if (t) resolved.push(t);
82 else unknown.push(id);
83 }
84 if (unknown.length > 0) {
85 const known = listTargetIds().join(', ');
86 throw new Error(
87 `Unknown --target id(s): ${unknown.join(', ')}. Known: ${known}, plus 'auto' / 'all' / 'none'.`,
88 );
89 }
90 return resolved;
91}

Callers 3

runUninstallerFunction · 0.90
resolveTargetsFunction · 0.90

Calls 4

detectAllFunction · 0.85
getTargetFunction · 0.85
listTargetIdsFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected