Skip to content

feat(cli): expose test-file classification - #1960

Closed
maxmilian wants to merge 1 commit into
colbymchenry:mainfrom
maxmilian:feat/1877-test-file-query
Closed

maxmilian wants to merge 1 commit into
colbymchenry:mainfrom
maxmilian:feat/1877-test-file-query

Conversation

@maxmilian

Copy link
Copy Markdown
Contributor

Closes #1877.

Changes

  • Expose the existing isTestPath classification as isTest in codegraph files --json.
  • Add --tests and --no-tests filters to codegraph files.
  • Mark test files in codegraph node --file output.
  • Add CLI coverage and a changelog entry.

Verification

  • bun x tsc --noEmit
  • bun x tsc
  • bun run copy-assets
  • bun x vitest run __tests__/cli-files-test-classification.test.ts
  • bun x vitest run __tests__/cli-node-command.test.ts __tests__/cli-affected-test-conventions.test.ts
  • git diff --check

@maxmilian
maxmilian marked this pull request as ready for review September 26, 2026 00:45
@maxmilian

Copy link
Copy Markdown
Contributor Author

This is ready for maintainer review. It reuses the existing isTestPath predicate for files --json, the --tests / --no-tests filters, and the node --file header. Local TypeScript compilation and the targeted CLI tests passed; GitHub currently reports no CI checks for this branch. Feedback on the output shape is welcome.

@maxmilian
maxmilian force-pushed the feat/1877-test-file-query branch from 9fb5e7b to 219a3a9 Compare September 28, 2026 22:12
@maxmilian

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (003305f); the only conflict was the src/mcp/tools.ts import block. Targeted CLI tests and tsc --noEmit pass. The three failures in bundle-launcher / cli-sync reproduce identically on unmodified main in my environment.

@maxmilian
maxmilian force-pushed the feat/1877-test-file-query branch from 219a3a9 to 38fffed Compare October 23, 2026 01:57
colbymchenry pushed a commit that referenced this pull request Oct 31, 2026
… 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>
@colbymchenry

Copy link
Copy Markdown
Owner

Thanks @maxmilian! This landed as #3124 with your authorship, which closes #1877. We rebased it over codegraph files --format package, added tests that the filter holds in every output format and that an empty result says so, and put --tests in the README's CLI list. The field, the filters and the label are yours as written.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose the test-file predicate (isTestPath) as a per-file query

2 participants