Repository navigation
feat(cli): files --json marks test files, with --tests and --no-tests filters - #3124
Merged
Merged
Conversation
… filters Tools built on CodeGraph need to know whether a file is a test, and nothing on the CLI said so. They kept their own naming rules, which drift from the one CodeGraph uses for search and `codegraph affected`. `codegraph files --json` now gives each file `isTest`, from that same predicate. `--tests` and `--no-tests` filter the list before any output format, `--format package` included. `codegraph node --file`, the same view as `codegraph_node` on a file, says "test file" in its header. Validation: 4 CLI cases fail on main and pass here. On express, flask, gin and excalidraw, `files --json` matches main row for row apart from the new field, and `--tests` and `--no-tests` split the list exactly by it. Of 20 source file views, 20 are byte-identical to main. Of 20 test file views, 19 differ only by the label; gin's binding_test.go is over the output cap, so the label moves the cut one line up and the range note says so. Explore doesn't use this view, and its budgets aren't touched. Fixes #1877 Original PR #1960 by @maxmilian. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
codegraph files --jsonnow gives each fileisTest,--testsand--no-testsfilter the list in any output format, andcodegraph node --file(the same view ascodegraph_nodeon a file) says "test file" in its header.Root cause
Nothing on the CLI told a tool whether a file is a test, so downstream tools kept their own naming rules, which drift from the
isTestPathpredicate CodeGraph uses itself.What came from the contributor, and what changed
The change is theirs: the field, the filters and the label, all on
isTestPath.Our changes:
files --format package(feat(files): list a project's files by the package that owns them #3090). The flags sit beside--format, and the keysowning-package.test.tspins now includeisTest.packageincluded, and a test for the "No files found" path.--testsin the README's CLI list, and the CHANGELOG bullet in house format.The CLI reference on the site waits for the release, so its text isn't in this PR.
Validation
cli-files-test-classification.test.ts, 4 cases, all fail on main and pass here.--tests+--no-testsisTestisTestisTestisTestbinding/binding_test.go, which is over the output cap: the 12-character label moves the cut one line up (lines 1–1164 of 1435, not 1–1165), and the range note says so..github/workflows/test.ymlcounts as a test file, as it does for search andcodegraph affected.owning-package.test.tspins thefiles --jsonkeys, andisTestis a new one. This commit updates that list, a one-line test change; no source line changed after that run, and no full suite has run since.owning-package.test.ts,cli-files-test-classification.test.tsandmcp-staleness-banner.test.ts, 73 passed, Vitest 4, kernel expected. The other files changed on the stack: 174 passed, 1 skipped, at the same tree.Fixes #1877
Lands #1960 by @maxmilian
🤖 Generated with Claude Code