Expose the test-file predicate (isTestPath) as a per-file query
Tooling that consumes CodeGraph often needs "is this file a test suite" as a graph fact rather than a hand-rolled naming regex: routing a reviewed test file to a different prompt, deciding whether a changed file needs a test-coverage check at all, or filtering a file list to non-test code.
Since #1803 (issue #1507) codegraph affected shares one notion of a test file, isTestPath in src/search/query-utils.ts, with search and the MCP tools. That predicate already covers the cross-ecosystem conventions (test_foo.py, foo_test.go, foo.test.ts, FooTest.kt, root-level tests/ and spec/ dirs). But it is internal. Nothing on the CLI or MCP surface lets a caller ask it about one path, so downstream tools keep a diverging copy, the same divergence #1507 fixed inside the CLI.
Checked against 1.6.0 and current main:
codegraph files --jsonreports language and symbol count per file, no test flag.codegraph node --file <path> --symbols-onlyreports symbols and dependents, no test flag.- No subcommand answers the question for a single path.
Proposed shape:
- Add an
isTest: booleanfield to each entry ofcodegraph files --json, and a--tests/--no-testsfilter onfiles. - Print the same fact in
codegraph node --fileheader output (e.g. "test file") so agents reading it see it. - Optionally a tiny
codegraph is-test <path>...that exits 0/1 per path for shell use, or a--jsonlist.
Reusing isTestPath directly keeps a single definition; downstream tools can then delete their own regexes instead of maintaining a copy that drifts.
Source: colbymchenry/codegraph