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

Method formatFilesByPackage

src/mcp/tools.ts:9307–9328  ·  view source on GitHub ↗

* Format files grouped by the package that owns them

(
    projectRoot: string,
    files: { path: string; language: string; nodeCount: number }[],
    includeMetadata: boolean
  )

Source from the content-addressed store, hash-verified

9305 * Format files grouped by the package that owns them
9306 */
9307 private formatFilesByPackage(
9308 projectRoot: string,
9309 files: { path: string; language: string; nodeCount: number }[],
9310 includeMetadata: boolean
9311 ): string {
9312 const groups = groupFilesByPackage(projectRoot, files);
9313 const lines: string[] = [`**${packageListingTitle(groups)}**`, ''];
9314
9315 for (const group of groups) {
9316 lines.push(`**${packageGroupTitle(group)}**`);
9317 for (const file of group.files) {
9318 if (includeMetadata) {
9319 lines.push(`- ${file.path} (${file.language}, ${file.nodeCount} symbols)`);
9320 } else {
9321 lines.push(`- ${file.path}`);
9322 }
9323 }
9324 lines.push('');
9325 }
9326
9327 return lines.join('\n');
9328 }
9329
9330 /**
9331 * Format files as a tree structure

Callers 1

handleFilesMethod · 0.95

Calls 5

groupFilesByPackageFunction · 0.90
packageListingTitleFunction · 0.90
packageGroupTitleFunction · 0.90
pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected