Skip to content

feat(cli): srcly findings lists findings by rule with a count - #485

Merged
byronwall merged 4 commits into
claude/duplicate-typefrom
claude/findings-cli
Nov 28, 2026
Merged

byronwall merged 4 commits into
claude/duplicate-typefrom
claude/findings-cli

Conversation

@byronwall

@byronwall byronwall commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

srcly findings [path] --rule duplicate-type now prints each hit as path:line rule message and a count. An agent can count one rule before and after a cleanup batch without importing a checker in Python. A count reads N/A, with the reason, when the checker did not run.

What you'll see

  • --rule may be repeated; without it, every finding is listed with a count per rule and a total. --format json gives count, found, reason, rules, findings and not_checked.
  • It runs the same checks as srcly report and shares their cache. --refresh reruns them.
  • A count is N/A (JSON null) when a checker for the rule failed, timed out, was configured but not run, or checked no file.
  • A ruff or eslint rule with no finding is also N/A, because srcly cannot tell whether the project switches the rule on.

Why a new command, not a flag. report writes artifacts, and its findings.json is a different list (ranked files). explain drills into one scope. fix --rule covers only the rules that have fixes. A read-only list over one dataset matches refs.

Proof

All runs are on this head (7796689a), on Visual Notes app at origin/main (d59937fe), in a temporary worktree that borrows the main checkout's node_modules.

srcly findings <visual-notes>/app --rule duplicate-type --refresh (messages cut after the field count):

src/components/DocumentSidePanel.tsx:25 duplicate-type `DocDetail` copies the exported `DocDetail` in src/services/docs.queries.ts:10 (8 of its 8 fields have the same name and type). …
src/components/editor/ui/PromptsManagerModal.tsx:15 duplicate-type `Prompt` copies the exported `Prompt` in src/services/prompts/prompts.queries.ts:4 (6 of its 7 fields have the same name and type). …
src/routes/docs/[id].tsx:28 duplicate-type `DocDetail` copies the exported `DocDetail` in src/services/docs.queries.ts:10 (11 of its 11 fields have the same name and type). …
src/routes/embeddings/[id].tsx:68 duplicate-type `UmapRunSummary` copies the exported `UmapRunSummary` in src/services/umap/umap.queries.ts:7 (4 of its 4 fields have the same name and type). …
src/services/research/research.activity.ts:15 duplicate-type `Topic` copies the exported `Topic` in src/server/mcp/research-shared.ts:23 (3 of its 3 fields have the same name and type). …

duplicate-type: 5

The same run with --format json (1 of 5 findings shown, known_rules left out):

{
  "root": "<visual-notes>/app",
  "filter": ["duplicate-type"],
  "count": 5,
  "found": 5,
  "reason": "",
  "rules": [{ "rule": "duplicate-type", "count": 5, "found": 5, "reason": "" }],
  "unknown_rules": [],
  "findings": [
    {
      "path": "src/components/DocumentSidePanel.tsx",
      "line": 25,
      "column": 1,
      "rule": "duplicate-type",
      "severity": "warning",
      "tool": "srcly-dup-types",
      "message": "`DocDetail` copies the exported `DocDetail` in src/services/docs.queries.ts:10 (8 of its 8 fields have the same name and type). Import that type, or derive this one from it (Pick, Omit), so a change to it reaches this file."
    }
  ],
  "not_checked": []
}

The done check for a batch: on the DocDetail cleanup commit (3b320b53) the same command prints duplicate-type: 3.

A checker that did not run is never 0 (SRCLY_FINDINGS_TIMEOUT=0.01):

duplicate-type: N/A (srcly duplicate types timed out after 0.01s; 0 found by the checkers that ran)

Several rules at once (--rule TS2322 --rule F401 --rule no-debugger --rule await-in-loop):

TS2322: 505
F401: N/A (no finding, and srcly cannot tell whether ruff has this rule switched on; 0 found by the checkers that ran)
no-debugger: N/A (no eslint run checked a file; 0 found by the checkers that ran)
await-in-loop: 101

Without --rule the total is Total: 3538, the sum of the per-checker counts that srcly report prints on the same files: tsc 2853, reachability 579, await-in-loop 101, duplicate types 5. The tsc errors are mostly from the borrowed node_modules.

scripts/check.sh server: 647 passed. One new test, tests/test_findings_listing.py.

Survey moves: pnpm survey-gate (base 54bf3bba → head 7796689a, so it includes the two layers below) moved only server: traces +5, outcome partial +4, outcome assumed +1 (astgrep.py#rule_ids), stop boundary: filesystem +3, stop frontier: external-code +81. No analysis code changed. The moves come from new exported functions in the server/ corpus (findings/listing.py, findings/astgrep.py, findings/typescript.py, and symbols/refs.py and findings/duplicate_types.py from the layers below).

Review

Codex review (gpt-6.2-sol), 3 rounds, no P0. Round 1: FAIL, 2 P1 and 2 P2; fixed (configured but unrun checkers, zero files checked, shared rule ids, missing text total). Round 2: FAIL, 2 P1 and 2 P2; fixed (switched-off lint rules, ast-grep file coverage, ids with comments). Round 3: FAIL, 3 P1 and 2 P2, listed below. The close step added assertions to the one test for the fixed cases; open cases have no test yet.

Limits

  • Trust the count for srcly's own rules and for tsc codes. For ruff, eslint and ast-grep rules, see the open findings.
  • The exit code is 0 either way. This is a list, not a gate.
  • The first run takes as long as all checks, also with --rule.
  • The open findings are tracked in the backlog task "Checkers record which rules ran on which files" (pgm/data). The fix is a coverage record per rule from each checker.

Open findings

  • P1 · diff · server/app/services/findings/astgrep.py:131 — A rule in a mixed-language or filtered ast-grep pack gets credit for files another rule checked, so it can read 0. Open: needs per-rule coverage records.
  • P1 · diff · server/app/services/findings/listing.py:54 — The total can be a number when one checker listed no file in the target but another did. Open: needs per-rule coverage records.
  • P1 · diff · server/app/services/findings/listing.py:56 — A clean, enabled ruff or eslint rule reads N/A, so it cannot prove zero. Open: chosen over a false 0; needs the linter's effective settings.
  • P2 · diff · server/app/services/findings/listing.py:47 — An ast-grep id equal to a ruff or tsc code hides that tool's failure. Open: contrived id choice.
  • P2 · diff · server/app/services/findings/astgrep.py:37 — A quoted YAML "id": key is not read as a rule id. Open: unusual spelling.
  • P1 · base · server/app/services/findings/typescript.py:184 — Nested flat ESLint configs are dropped without a reason. Pre-existing.
  • P1 · base · server/app/services/findings/typescript.py:202 — A parse error leaves skipped ruff or eslint rules looking clean. Pre-existing.
  • P1 · base · server/app/services/findings/typescript.py:154 — A tsc project error is dropped when tsc also lists files. Pre-existing.
  • P1 · base · server/app/services/findings/runner.py:167 — The cache misses checker inputs outside the scan fingerprint, so a count can be stale; --refresh avoids it. Pre-existing.
  • P2 · base · server/app/services/findings/duplicate_types.py:211 — An unreadable file can hide a duplicate type. Pre-existing.

Stack: cleanup-loop helpers, layer 3 of 3

This slice: srcly findings.
Why it is its own layer: It is a new command over the findings that the layer below extends, with its own review.
Full story: #482

🤖 Generated with Claude Code

@byronwall
byronwall added this pull request to stack #484 November 28, 2026 04:36
@byronwall byronwall changed the title claude/findings cli feat(cli): srcly findings lists findings by rule with a count Nov 28, 2026
byronwall and others added 4 commits November 28, 2026 00:05
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@byronwall
byronwall removed this pull request from stack #484 November 28, 2026 05:05
@byronwall
byronwall added this pull request to stack #480 November 28, 2026 05:05
@byronwall
byronwall merged commit 4346716 into main Nov 28, 2026
13 of 14 checks passed
@byronwall
byronwall deleted the claude/findings-cli branch November 28, 2026 05:12
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.

1 participant