MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / formatHelperClusters

Function formatHelperClusters

src/codegraph/helper-extract.ts:309–318  ·  view source on GitHub ↗
(clusters: HelperCluster[])

Source from the content-addressed store, hash-verified

307
308/** A concise, agent-readable report of extraction opportunities. PURE. */
309export function formatHelperClusters(clusters: HelperCluster[]): string {
310 if (!clusters.length) return 'No near-duplicate helper clusters found — nothing worth extracting.';
311 const lines = [`Found ${clusters.length} near-duplicate helper cluster(s) — candidates to extract into a shared helper:`, ''];
312 clusters.forEach((c, i) => {
313 lines.push(`${i + 1}. ~${Math.round(c.avgSimilarity * 100)}% similar${c.exact ? ' (EXACT — use consolidate-dupes)' : ''} · ${c.members.length} copies · ~${c.estLinesSaved} lines saved → helper \`${c.suggestedName}()\``);
314 for (const m of c.members) lines.push(` - ${m.name} (${m.file}:${m.startLine}-${m.endLine})`);
315 });
316 lines.push('', 'Detection only — extracting changes call sites. Review, then extract with a verified PR.');
317 return lines.join('\n');
318}

Callers 2

executeMethod · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected