Files
codegraph/__tests__
Colby MchenryandClaude Opus 5.5 17d5426d63 feat(files): list a project's files by the package that owns them (#3090)
Nothing could answer "which package owns this file": manifests are not
source, so they have no row in the index, and `--format grouped` groups by
language.

`codegraph files --format package` and `codegraph_files` with
`format: "package"` now group files by the nearest package.json or
composer.json above them that names a package, so a monorepo splits into
its workspace members with no configuration. The answer is read from disk
when asked, so it stays current without a re-index. A manifest that names
nothing doesn't stop the walk, and files nothing claims get a section of
their own, last. Each directory is resolved once and shares its parent's
answer. Reads are bounded by the source size limit and stay inside the
project.

Opt-in only: the default tree output and the `--json` shape are unchanged,
and `--json` keeps ignoring `--format` as it always has.

Validation: 31 new tests, including the real CLI. On vuejs/core the default
listing and `--json` are byte-identical to main. The walk over babel/babel's
28,653 files in 13,484 directories takes a median 460 ms, on the query
worker pool for `codegraph_files`.

Reimplements PR 2863 by @LuisAlbertoMK.
Fixes #1871

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 17:59:30 +00:00
..