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

Method formatFilesByPackage

src/mcp/tools.ts:9270–9291  ·  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

9268 * Format files grouped by the package that owns them
9269 */
9270 private formatFilesByPackage(
9271 projectRoot: string,
9272 files: { path: string; language: string; nodeCount: number }[],
9273 includeMetadata: boolean
9274 ): string {
9275 const groups = groupFilesByPackage(projectRoot, files);
9276 const lines: string[] = [`**${packageListingTitle(groups)}**`, ''];
9277
9278 for (const group of groups) {
9279 lines.push(`**${packageGroupTitle(group)}**`);
9280 for (const file of group.files) {
9281 if (includeMetadata) {
9282 lines.push(`- ${file.path} (${file.language}, ${file.nodeCount} symbols)`);
9283 } else {
9284 lines.push(`- ${file.path}`);
9285 }
9286 }
9287 lines.push('');
9288 }
9289
9290 return lines.join('\n');
9291 }
9292
9293 /**
9294 * 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