Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

feat(distill): lint filter, missed-savings discovery, per-surface ledger tagging (#390)

Raghav Chamadiya63db8c79ef86
diff --git a/docs/CONFIG.md b/docs/CONFIG.md
index 0419b6828..5a8426169 100644
--- a/docs/CONFIG.md
+++ b/docs/CONFIG.md
@@ -82,8 +82,8 @@ distill:
- `permission: ask` (the default) means the agent's rewritten command is shown
for approval; `allow` auto-approves rewrites; `off` disables rewrites here.
- `families` keys are filter names (`test_output`, `build_output`,
- `git_status`, `git_log`, `git_diff`, `search_results`, `file_listing`,
- `logs`) and accept `ask | allow | off | deny`.
+ `lint_output`, `git_status`, `git_log`, `git_diff`, `search_results`,
+ `file_listing`, `logs`) and accept `ask | allow | off | deny`.
- Declining the `repowise init` opt-in prompt writes
`commands.enabled: false`, so a rewrite hook installed globally from another
repo stays inert in this one.
diff --git a/docs/DISTILL.md b/docs/DISTILL.md
index e9504ecff..9c6e21aa8 100644
--- a/docs/DISTILL.md
+++ b/docs/DISTILL.md
@@ -37,12 +37,13 @@ repowise saved # tokens & dollars saved so far
Runs the command (shell semantics preserved), captures stdout+stderr, picks a
filter by command shape (then by content sniff), and prints the compact
-rendering. Eight filters ship:
+rendering. Nine filters ship:
| Filter | Commands | What it keeps |
|---|---|---|
| `test_output` | pytest, jest, vitest, cargo test, go test | failures + assertion details + summary; collapses pass parades |
| `build_output` | npm/tsc/cargo/go builds | errors and warnings grouped; strips progress/boilerplate |
+| `lint_output` | eslint/biome, ruff/flake8/mypy, clippy, golangci-lint | errors verbatim; warnings grouped by rule id with counts + file:line anchors; fixable totals |
| `git_status` | `git status` | porcelain-style compact status |
| `git_log` | `git log` | recent subjects + counts |
| `git_diff` | `git diff`/`show` | stat + the most relevant hunks |
@@ -202,9 +203,11 @@ inside a repowise repo.
```bash
repowise saved # per-filter rollup + totals + est. dollars
repowise saved --by day # daily rollup
-repowise saved --by source # cli vs hook
+repowise saved --by source # cli vs hook-bash vs hook-powershell
repowise saved --since 2026-06-01
repowise saved --model claude-opus-4-6 # price the estimate differently
+repowise saved --missed # savings raw commands left on the table
+repowise saved --missed --missed-days 30
```
Dollar estimates price saved tokens at the chosen model's *input* rate (saved
@@ -214,8 +217,29 @@ tokens are input the agent never had to read) using the same pricing table as
The report covers the **distill command/hook path only** — MCP response
truncation is intentionally not in the ledger (see above).
+### Missed savings — `repowise saved --missed`
+
+The adoption feedback loop: how many tokens did raw commands waste that a
+filter would have caught? `--missed` scans your local Claude Code transcripts
+for Bash/PowerShell tool calls in this repo that were **not** routed through
+`repowise distill`, classifies each with the same router the engine uses, and
+estimates the foregone savings using each filter's *conservative* fixture
+floor (the per-filter minimums asserted in CI, not the medians — the estimate
+undersells on purpose). The scan covers the last 7 days by default
+(`--missed-days N` for more); plain `repowise saved` appends a one-line
+summary when there is anything to report.
+
+The scan is read-only and best-effort: malformed or absent transcripts mean
+an empty report, never an error.
+
+> **Privacy:** the scan stays entirely local. Commands and outputs are read
+> from your own transcript directory (`~/.claude/projects/…`) on this
+> machine; nothing is uploaded, recorded, or sent anywhere. Codex transcripts
+> are not yet scanned.
+
The local dashboard mirrors this: the Costs page's *Cache & savings* tab shows
-a Distill savings card with the same rollup.
+a Distill savings card with the same rollup, plus a missed-savings secondary
+stat sourced from the same local scan.
---
@@ -237,8 +261,8 @@ output. In an end-to-end agent spot-check on the same repo (a seeded
11-failure bug), the agent diagnosed the exact root-cause line and fix from
the distilled test output — identical conclusion to the raw-output run.
-Fixture-suite medians across the seven core filters: ≥60% reduction on
-test/build output with zero error-line loss (asserted in CI).
+Fixture-suite medians across the core filters: ≥60% reduction on
+test/build/lint output with zero error-line loss (asserted in CI).
---
diff --git a/packages/cli/src/repowise/cli/commands/distill_cmd.py b/packages/cli/src/repowise/cli/commands/distill_cmd.py
index c87e5690d..981793613 100644
--- a/packages/cli/src/repowise/cli/commands/distill_cmd.py
+++ b/packages/cli/src/repowise/cli/commands/distill_cmd.py
@@ -20,11 +20,19 @@ from repowise.cli.helpers import find_repowise_repo_root
@click.command(
"distill",
- context_settings={"ignore_unknown_options": True},
+ # allow_interspersed_args=False keeps option parsing strictly *before* the
+ # wrapped command — a command that itself takes --source is never touched.
+ context_settings={"ignore_unknown_options": True, "allow_interspersed_args": False},
short_help="Run a command and print a compact, reversible rendering of its output.",
)
+ "--source",
+ default="cli",
+ hidden=True,
+ help="Ledger surface label (the rewrite hook tags hook-bash / hook-powershell).",
+)
@click.argument("command", nargs=-1, required=True, type=click.UNPROCESSED)
-def distill_command(command: tuple[str, ...]) -> None:
+def distill_command(source: str, command: tuple[str, ...]) -> None:
"""Run COMMAND and print a distilled rendering of its output.
Examples:
@@ -56,7 +64,7 @@ def distill_command(command: tuple[str, ...]) -> None:
if proc.stderr:
output = output + ("\n" if output and not output.endswith("\n") else "") + proc.stderr
- text = _distill_or_raw(output, command_str, proc.returncode)
+ text = _distill_or_raw(output, command_str, proc.returncode, source)
_echo_safely(text)
sys.exit(proc.returncode)
@@ -72,7 +80,7 @@ def _render_command(tokens: tuple[str, ...]) -> str:
return shlex.join(tokens)
-def _distill_or_raw(output: str, command_str: str, exit_code: int) -> str:
+def _distill_or_raw(output: str, command_str: str, exit_code: int, source: str = "cli") -> str:
"""Distill *output*, honoring the repo's ``distill:`` config block."""
try:
repo_root = find_repowise_repo_root()
@@ -92,7 +100,7 @@ def _distill_or_raw(output: str, command_str: str, exit_code: int) -> str:
output,
command=command_str,
exit_code=exit_code,
- source="cli",
+ source=source,
store=store,
disabled_filters=disabled,
).text
diff --git a/packages/cli/src/repowise/cli/commands/saved_cmd.py b/packages/cli/src/repowise/cli/commands/saved_cmd.py
index 833b71c71..ea7ba2edd 100644
--- a/packages/cli/src/repowise/cli/commands/saved_cmd.py
+++ b/packages/cli/src/repowise/cli/commands/saved_cmd.py
@@ -51,11 +51,27 @@ DEFAULT_PRICING_MODEL = "claude-sonnet-4-6"
metavar="MODEL",
help="Pricing model for the dollar estimate (input-token rate).",
)
+ "--missed",
+ "show_missed",
+ is_flag=True,
+ help="Report savings foregone by raw (non-distilled) agent commands.",
+)
+ "--missed-days",
+ type=click.FloatRange(min=0.1),
+ default=7.0,
+ show_default=True,
+ metavar="DAYS",
+ help="Transcript window for the missed-savings scan.",
+)
def saved_command(
path: str | None,
group_by: str,
since: str | None,
pricing_model: str,
+ show_missed: bool,
+ missed_days: float,
) -> None:
"""Show tokens (and estimated dollars) saved by ``repowise distill``.
@@ -69,6 +85,11 @@ def saved_command(
since_ts = _parse_since(since)
start = Path(path).resolve() if path else Path.cwd()
+
+ if show_missed:
+ _print_missed_report(start, missed_days, pricing_model)
+ return
+
db_path = default_store_path(start)
if not db_path.exists():
console.print(
@@ -132,6 +153,82 @@ def saved_command(
f"tokens are chars/4 estimates)[/dim]"
)
console.print(f" [dim]Ledger: {db_path}[/dim]")
+ _print_missed_summary_line(start, missed_days)
+ console.print()
+
+
+def _missed_report(start: Path, days: float) -> dict | None:
+ """Best-effort missed-savings scan rooted at the enclosing repowise repo."""
+ try:
+ from repowise.cli.helpers import find_repowise_repo_root
+ from repowise.core.distill.missed import scan_missed_savings
+
+ repo_root = find_repowise_repo_root(start) or start
+ return scan_missed_savings(repo_root, days=days)
+ except Exception:
+ return None
+
+
+def _print_missed_summary_line(start: Path, days: float) -> None:
+ """One foregone-savings line under the main report; silent when empty."""
+ report = _missed_report(start, days)
+ if not report or not report["events"]:
+ return
+ console.print(
+ f" Missed: [yellow]~{report['est_saved_tokens']:,} tokens[/yellow] across "
+ f"{report['events']} raw command runs in the last {days:g} days "
+ f"[dim](repowise saved --missed)[/dim]"
+ )
+
+
+def _print_missed_report(start: Path, days: float, pricing_model: str) -> None:
+ report = _missed_report(start, days)
+ if not report or not report["events"]:
+ console.print(
+ f"[yellow]No missed savings found in the last {days:g} days.[/yellow] "
+ "Either every distillable command already ran through 'repowise distill', "
+ "or no agent transcripts cover this repo."
+ )
+ return
+
+ usd, rate = _estimate_usd(report["est_saved_tokens"], pricing_model)
+ table = Table(
+ title=f"Missed distill savings - last {days:g} days",
+ border_style="dim",
+ show_footer=True,
+ caption=(
+ "Raw agent commands a filter would have caught; estimates use each "
+ "filter's conservative fixture floor. Scanned from local Claude Code "
+ "transcripts - nothing leaves this machine."
+ ),
+ )
+ table.add_column("Family", style="cyan", footer="[bold]TOTAL[/bold]")
+ table.add_column("Events", justify="right", footer=str(report["events"]))
+ table.add_column("Raw Tokens", justify="right", footer=f"{report['raw_tokens']:,}")
+ table.add_column(
+ "Est. Foregone",
+ justify="right",
+ footer=f"[bold yellow]{report['est_saved_tokens']:,}[/bold yellow]",
+ )
+ for family, stats in report["per_filter"].items():
+ table.add_row(
+ family,
+ str(stats["events"]),
+ f"{stats['raw_tokens']:,}",
+ f"[yellow]{stats['est_saved_tokens']:,}[/yellow]",
+ )
+
+ console.print()
+ console.print(table)
+ console.print(
+ f" Estimated foregone: [bold yellow]${usd:.4f}[/bold yellow] "
+ f"[dim](at ${rate:.2f}/M input tokens, {pricing_model}; "
+ f"tokens are chars/4 estimates)[/dim]"
+ )
+ console.print(
+ " [dim]Tip: install the rewrite hook ('repowise hook rewrite install') "
+ "to catch these automatically.[/dim]"
+ )
console.print()
diff --git a/packages/cli/src/repowise/cli/rewrite_hook.py b/packages/cli/src/repowise/cli/rewrite_hook.py
index a8f8520f8..e6fb70faf 100644
--- a/packages/cli/src/repowise/cli/rewrite_hook.py
+++ b/packages/cli/src/repowise/cli/rewrite_hook.py
@@ -85,13 +85,21 @@ FAMILY_PATTERNS: tuple[tuple[str, re.Pattern[str]], ...] = (
r"yarn (?:test|run test)\b)"
),
),
+ (
+ "lint_output",
+ re.compile(
+ r"^(eslint\b|biome (?:check|lint)\b|ruff\b(?!\s+format)|flake8\b|pylint\b|mypy\b|"
+ r"cargo clippy\b|golangci-lint\b|npm run lint\b|pnpm (?:run )?lint\b|"
+ r"yarn (?:run )?lint\b|next lint\b)"
+ ),
+ ),
(
"build_output",
re.compile(
r"^(npm run b|npm run-script b|pnpm (?:run )?b|yarn (?:run )?b|"
- r"tsc\b|cargo (?:build|check|clippy)\b|go (?:build|vet)\b|"
+ r"tsc\b|cargo (?:build|check)\b|go (?:build|vet)\b|"
r"make\b|vite build|webpack\b|next build|dotnet build\b|"
- r"npm run (?:type-check|typecheck|lint|compile)\b|gradle|mvn\b)"
+ r"npm run (?:type-check|typecheck|compile)\b|gradle|mvn\b)"
),
),
("git_status", re.compile(r"^git status\b(?!.*--porcelain)")),
@@ -168,10 +176,11 @@ _SHELL_SYNTAX_RE = re.compile(r"[|&;<>`\n]|\$\(")
_WATCH_RE = re.compile(r"--watch(?:all)?\b|--looponfail\b|(?:^|\s)-f\b.*\.log\b|--follow\b")
# PowerShell cmdlets all follow the Verb-Noun shape (Get-ChildItem,
-# Select-Object, ForEach-Object, …). None of the distill families start
-# with a dashed token, so a Verb-Noun first token is a safe fast bail —
-# PS-native pipelines and object output don't survive wrapping anyway.
+# Select-Object, ForEach-Object, …), so a Verb-Noun first token is a safe
+# fast bail — PS-native pipelines and object output don't survive wrapping
+# anyway. The only dashed token among the distill families is exempted.
_PS_CMDLET_RE = re.compile(r"^[a-z]+-[a-z]")
+_DASHED_TOOL_TOKENS = frozenset({"golangci-lint"})
def classify(command: str) -> str | None:
@@ -182,7 +191,9 @@ def classify(command: str) -> str | None:
if not normalized or normalized.startswith("repowise"):
return None
first = normalized.split(None, 1)[0]
- if first in IGNORED_FIRST_TOKENS or _PS_CMDLET_RE.match(first):
+ if first in IGNORED_FIRST_TOKENS or (
+ _PS_CMDLET_RE.match(first) and first not in _DASHED_TOOL_TOKENS
+ ):
return None
if _WATCH_RE.search(normalized):
return None
@@ -296,8 +307,11 @@ def decide(command: str, cwd: str, shell: str = "posix") -> RewriteResult | None
if family_setting in _VALID_PERMISSIONS:
permission = family_setting
+ # The --source tag lands in the savings ledger so `repowise saved
+ # --by source` can tell hook surfaces apart from direct CLI use.
+ source = "hook-powershell" if shell == "powershell" else "hook-bash"
return RewriteResult(
- command=f"repowise distill {command.strip()}",
+ command=f"repowise distill --source {source} {command.strip()}",
permission=permission,
reason=(
f"repowise distill: compact {family} rendering; full output stays "
diff --git a/packages/core/src/repowise/core/distill/filters/__init__.py b/packages/core/src/repowise/core/distill/filters/__init__.py
index b47592412..ef102cb67 100644
--- a/packages/core/src/repowise/core/distill/filters/__init__.py
+++ b/packages/core/src/repowise/core/distill/filters/__init__.py
@@ -13,6 +13,7 @@ from repowise.core.distill.filters import ( # noqa: F401 (registration side ef
git_diff,
git_log,
git_status,
+ lint_output,
logs,
search_results,
test_output,
diff --git a/packages/core/src/repowise/core/distill/filters/build_output.py b/packages/core/src/repowise/core/distill/filters/build_output.py
index 9f7a07fbf..cae6023cf 100644
--- a/packages/core/src/repowise/core/distill/filters/build_output.py
+++ b/packages/core/src/repowise/core/distill/filters/build_output.py
@@ -16,9 +16,9 @@ from repowise.core.distill.registry import filter_registry
_COMMAND_RE = re.compile(
r"^(npm(?:\.cmd)? run b|npm(?:\.cmd)? run-script b|pnpm (?:run )?b|yarn (?:run )?b|"
- r"tsc\b|cargo(?:\.exe)? (?:build|check|clippy)\b|go(?:\.exe)? (?:build|vet)\b|"
+ r"tsc\b|cargo(?:\.exe)? (?:build|check)\b|go(?:\.exe)? (?:build|vet)\b|"
r"make\b|vite build|webpack\b|next(?:\.cmd)? build|dotnet(?:\.exe)? build\b|"
- r"npm(?:\.cmd)? run (?:type-check|typecheck|lint|compile)\b|gradle|mvn\b)"
+ r"npm(?:\.cmd)? run (?:type-check|typecheck|compile)\b|gradle|mvn\b)"
)
# Progress verbs collapsed to "<verb> ... (xN)".
diff --git a/packages/core/src/repowise/core/distill/filters/lint_output.py b/packages/core/src/repowise/core/distill/filters/lint_output.py
new file mode 100644
index 000000000..c52a3948c
--- /dev/null
+++ b/packages/core/src/repowise/core/distill/filters/lint_output.py
@@ -0,0 +1,387 @@
+"""Rule-grouped compaction of linter output.
+
+Handles eslint (stylish), ruff (full and concise), flake8/pylint-style
+single-line diagnostics, mypy, cargo clippy, and golangci-lint. Lint output
+is dominated by near-identical violations, so the rendering groups by rule
+id — count, a sample message, and file:line anchors — with errors before
+warnings. The errors-first invariant holds: every error-severity diagnostic
+is kept verbatim; only warning-severity findings collapse into groups. The
+tool's own summary lines (problem totals, fixable counts) always survive.
+"""
+
+from __future__ import annotations
+
+import re
+from dataclasses import dataclass, field
+from typing import ClassVar
+
+from repowise.core.distill.filters.base import OutputFilter, is_error_line
+from repowise.core.distill.registry import filter_registry
+
+_COMMAND_RE = re.compile(
+ r"^(eslint\b|biome (?:check|lint)\b|ruff\b(?!\s+format)|flake8\b|pylint\b|mypy\b|"
+ r"cargo(?:\.exe)? clippy\b|golangci-lint\b|"
+ r"npm(?:\.cmd)? run lint\b|pnpm (?:run )?lint\b|yarn (?:run )?lint\b|next(?:\.cmd)? lint\b)"
+)
+
+# eslint stylish: indented "line:col severity message rule" rows under a
+# file-path header line. Message and rule are separated by 2+ spaces.
+_ESLINT_ROW_RE = re.compile(
+ r"^\s+(?P<line>\d+):(?P<col>\d+)\s+(?P<sev>error|warning)\s+(?P<msg>.+?)\s{2,}(?P<rule>\S+)$"
+)
+_ESLINT_SUMMARY_RE = re.compile(r"^[✖✗x] \d+ problems?|potentially fixable")
+
+# ruff/flake8/pylint concise: path:line:col: CODE [*] message
+_CONCISE_RE = re.compile(
+ r"^(?P<file>.+?):(?P<line>\d+):(?P<col>\d+):\s"
+ r"(?P<rule>[A-Z]{1,4}\d{2,5})(?P<fix> \[\*\])?\s(?P<msg>.+)$"
+)
+
+# ruff full (rustc-style): "CODE [*] message" head + "--> path:line:col" frame.
+_RUFF_BLOCK_RE = re.compile(r"^(?P<rule>[A-Z]{1,4}\d{2,5})(?P<fix> \[\*\])? (?P<msg>.+)$")
+
+# clippy / rustc: "warning: message" or "error[E0308]: message" head + frame.
+_CLIPPY_BLOCK_RE = re.compile(r"^(?P<sev>warning|error)(?:\[(?P<code>E\d{4})\])?: (?P<msg>.+)$")
+_CLIPPY_RULE_RE = re.compile(r"clippy::[a-z_]+|#\[warn\(([a-z_:]+)\)\]")
+_CLIPPY_SUMMARY_RE = re.compile(
+ r"^(warning|error): .* generated \d+ warnings?|^error: could not compile"
+)
+
+_ARROW_RE = re.compile(r"^\s*-->\s(?P<file>.+?):(?P<line>\d+)(?::\d+)?\s*$")
+
+# mypy: path:line: severity: message [rule]
+_MYPY_RE = re.compile(
+ r"^(?P<file>.+?):(?P<line>\d+)(?::\d+)?:\s(?P<sev>error|warning|note):\s"
+ r"(?P<msg>.+?)(?:\s+\[(?P<rule>[\w.-]+)\])?$"
+)
+
+# golangci-lint: path:line:col: message (linter)
+_GOLANGCI_RE = re.compile(
+ r"^(?P<file>.+?):(?P<line>\d+):(?P<col>\d+):\s(?P<msg>.+)\s\((?P<rule>[\w-]+)\)$"
+)
+
+_SUMMARY_RE = re.compile(r"^Found \d+ error|^\[\*\] \d+ fixable|^No errors found|^\d+ issues?[:.]")
+
+#: Anchors shown per rule group before "+N more".
+_MAX_ANCHORS = 5
+#: Sample-message cap on group lines (anchors carry the location detail).
+_MAX_GROUP_MSG = 140
+
+
+@dataclass
+class _Diag:
+ rule: str
+ anchor: str # file:line
+ severity: str # "error" | "warning"
+ message: str
+ lines: list[str] = field(default_factory=list)
+ fixable: bool = False
+ file_header: str | None = None # eslint: path line giving the rows context
+
+ @property
+ def is_error(self) -> bool:
+ """Tool-declared error severity.
+
+ Deliberately NOT ``is_error_line``-based: linter messages incidentally
+ containing words like "Exception" would drag whole warning blocks into
+ the verbatim section. Incidental matches are preserved line-by-line by
+ the rescue tail in :func:`_render` instead.
+ """
+ return self.severity == "error"
+
+
+@filter_registry.register
+class LintOutputFilter(OutputFilter):
+ name: ClassVar[str] = "lint_output"
+ priority: ClassVar[int] = 25
+ min_lines: ClassVar[int] = 10
+
+ def matches_command(self, command: str) -> bool:
+ return bool(_COMMAND_RE.match(command))
+
+ def matches_content(self, output: str) -> bool:
+ return _detect_format(output) is not None
+
+ def distill(self, output: str, *, command: str = "", exit_code: int = 0) -> str:
+ fmt = _detect_format(output)
+ if fmt is None:
+ raise ValueError("unrecognized lint output")
+ lines = output.splitlines()
+ diags, trailing = _PARSERS[fmt](lines)
+ if not diags:
+ raise ValueError(f"no diagnostics parsed from {fmt} output")
+ return _render(lines, diags, trailing)
+
+
+def _detect_format(output: str) -> str | None:
+ lines = output.splitlines()[:400]
+
+ def count(pattern: re.Pattern[str]) -> int:
+ return sum(1 for ln in lines if pattern.match(ln))
+
+ if count(_ESLINT_ROW_RE) >= 2:
+ return "eslint"
+ has_arrows = any(_ARROW_RE.match(ln) for ln in lines)
+ if has_arrows and count(_CLIPPY_BLOCK_RE) >= 2:
+ return "clippy"
+ if has_arrows and count(_RUFF_BLOCK_RE) >= 2:
+ return "ruff_full"
+ if count(_MYPY_RE) >= 2:
+ return "mypy"
+ if count(_CONCISE_RE) >= 2:
+ return "concise"
+ if count(_GOLANGCI_RE) >= 2:
+ return "golangci"
+ return None
+
+
+# -- parsers: each returns (diags, trailing summary lines) --------------------
+
+
+def _parse_eslint(lines: list[str]) -> tuple[list[_Diag], list[str]]:
+ diags: list[_Diag] = []
+ trailing: list[str] = []
+ current_file = ""
+ for line in lines:
+ row = _ESLINT_ROW_RE.match(line)
+ if row:
+ diags.append(
+ _Diag(
+ rule=row.group("rule"),
+ anchor=f"{current_file}:{row.group('line')}",
+ severity=row.group("sev"),
+ message=row.group("msg"),
+ lines=[line],
+ file_header=current_file,
+ )
+ )
+ elif _ESLINT_SUMMARY_RE.search(line.strip()):
+ trailing.append(line)
+ elif line.strip() and not line.startswith((" ", "\t")):
+ current_file = line.strip()
+ return diags, trailing
+
+
+def _parse_concise(lines: list[str]) -> tuple[list[_Diag], list[str]]:
+ """ruff --output-format=concise, flake8, pylint-parseable single lines."""
+ diags: list[_Diag] = []
+ trailing: list[str] = []
+ for line in lines:
+ m = _CONCISE_RE.match(line)
+ if m:
+ diags.append(
+ _Diag(
+ rule=m.group("rule"),
+ anchor=f"{m.group('file')}:{m.group('line')}",
+ severity="warning",
+ message=m.group("msg"),
+ lines=[line],
+ fixable=bool(m.group("fix")),
+ )
+ )
+ elif _SUMMARY_RE.match(line.strip()):
+ trailing.append(line)
+ return diags, trailing
+
+
+def _parse_golangci(lines: list[str]) -> tuple[list[_Diag], list[str]]:
+ """golangci-lint text format: diagnostic line + source echo + caret."""
+ diags: list[_Diag] = []
+ trailing: list[str] = []
+ for line in lines:
+ m = _GOLANGCI_RE.match(line)
+ if m:
+ diags.append(
+ _Diag(
+ rule=m.group("rule"),
+ anchor=f"{m.group('file')}:{m.group('line')}",
+ severity="warning",
+ message=m.group("msg"),
+ lines=[line],
+ )
+ )
+ elif _SUMMARY_RE.match(line.strip()):
+ trailing.append(line)
+ elif diags and line.strip() and not _GOLANGCI_RE.match(line):
+ # source echo / caret lines attach to the open diagnostic
+ diags[-1].lines.append(line)
+ return diags, trailing
+
+
+def _parse_mypy(lines: list[str]) -> tuple[list[_Diag], list[str]]:
+ diags: list[_Diag] = []
+ trailing: list[str] = []
+ for line in lines:
+ m = _MYPY_RE.match(line)
+ if m:
+ sev = m.group("sev")
+ if sev == "note" and diags:
+ # notes elaborate on the previous diagnostic
+ diags[-1].lines.append(line)
+ continue
+ diags.append(
+ _Diag(
+ rule=m.group("rule") or "(uncoded)",
+ anchor=f"{m.group('file')}:{m.group('line')}",
+ severity="error" if sev == "error" else "warning",
+ message=m.group("msg"),
+ lines=[line],
+ )
+ )
+ elif _SUMMARY_RE.match(line.strip()):
+ trailing.append(line)
+ return diags, trailing
+
+
+def _parse_blocks(
+ lines: list[str], head_re: re.Pattern[str], *, clippy: bool
+) -> tuple[list[_Diag], list[str]]:
+ """rustc-style blocks: head line, --> location, code frame, notes/help."""
+ diags: list[_Diag] = []
+ trailing: list[str] = []
+ open_diag: _Diag | None = None
+ for line in lines:
+ if _SUMMARY_RE.match(line.strip()) or (clippy and _CLIPPY_SUMMARY_RE.match(line)):
+ open_diag = None
+ trailing.append(line)
+ continue
+ head = head_re.match(line)
+ if head:
+ groups = head.groupdict()
+ open_diag = _Diag(
+ rule=groups.get("code") or groups.get("rule") or "",
+ anchor="",
+ severity=groups.get("sev") or "warning",
+ message=groups["msg"],
+ lines=[line],
+ fixable=bool(groups.get("fix")),
+ )
+ diags.append(open_diag)
+ continue
+ if open_diag is None:
+ continue
+ arrow = _ARROW_RE.match(line)
+ if arrow and not open_diag.anchor:
+ open_diag.anchor = f"{arrow.group('file')}:{arrow.group('line')}"
+ if clippy and not open_diag.rule.startswith("clippy::"):
+ rule_m = _CLIPPY_RULE_RE.search(line)
+ if rule_m:
+ open_diag.rule = (
+ rule_m.group(0)
+ if rule_m.group(0).startswith("clippy")
+ else (rule_m.group(1) or open_diag.rule)
+ )
+ if line.strip():
+ open_diag.lines.append(line)
+ else:
+ open_diag = None # blank line closes the block
+ for d in diags:
+ if not d.rule:
+ d.rule = "(uncoded)"
+ return diags, trailing
+
+
+_PARSERS = {
+ "eslint": _parse_eslint,
+ "concise": _parse_concise,
+ "golangci": _parse_golangci,
+ "mypy": _parse_mypy,
+ "ruff_full": lambda lines: _parse_blocks(lines, _RUFF_BLOCK_RE, clippy=False),
+ "clippy": lambda lines: _parse_blocks(lines, _CLIPPY_BLOCK_RE, clippy=True),
+}
+
+
+# -- rendering -----------------------------------------------------------------
+
+
+def _render(raw_lines: list[str], diags: list[_Diag], trailing: list[str]) -> str:
+ errors, incidental, grouped = [], [], []
+ for d in diags:
+ if d.is_error:
+ errors.append(d)
+ elif any(is_error_line(ln) for ln in d.lines):
+ # Warning-severity diags that *incidentally* contain
+ # error-classified lines (an errcheck message, a rule about
+ # exceptions) surface those lines verbatim instead of being
+ # grouped — grouping them would emit the sample message AND the
+ # rescued raw lines, a net loss.
+ incidental.append(d)
+ else:
+ grouped.append(d)
+
+ groups: dict[str, list[_Diag]] = {}
+ for d in grouped:
+ groups.setdefault(d.rule, []).append(d)
+
+ out: list[str] = []
+ summary = f"lint: {len(diags)} findings"
+ parts = []
+ if errors or incidental:
+ parts.append(f"{len(errors) + len(incidental)} kept verbatim")
+ if grouped:
+ parts.append(f"{len(grouped)} collapsed into {len(groups)} rules")
+ if parts:
+ summary += " — " + ", ".join(parts)
+ out.append(summary)
+ out.append("")
+
+ # Errors first, verbatim (identical repeats collapse to one annotated
+ # copy — the original line survives as the prefix), with their eslint
+ # file-header context.
+ last_header: str | None = None
+ seen: dict[str, int] = {} # error line -> index in out
+ repeats: dict[int, int] = {} # index in out -> extra occurrences
+ for d in errors:
+ if d.file_header and d.file_header != last_header:
+ out.append(d.file_header)
+ last_header = d.file_header
+ for ln in d.lines:
+ if len(d.lines) == 1 and ln in seen:
+ repeats[seen[ln]] = repeats.get(seen[ln], 0) + 1
+ else:
+ seen[ln] = len(out)
+ out.append(ln)
+ # Incidental error-classified lines: only the tripping lines, deduped.
+ for d in incidental:
+ for ln in d.lines:
+ if not is_error_line(ln):
+ continue
+ if ln in seen:
+ repeats[seen[ln]] = repeats.get(seen[ln], 0) + 1
+ else:
+ seen[ln] = len(out)
+ out.append(ln)
+ for idx, extra in repeats.items():
+ out[idx] = f"{out[idx]} (×{extra + 1})" # noqa: RUF001
+ if errors or incidental:
+ out.append("")
+
+ # Warning-severity findings grouped by rule, most frequent first.
+ for rule, ds in sorted(groups.items(), key=lambda kv: -len(kv[1])):
+ fixable = sum(1 for d in ds if d.fixable)
+ fix_note = f", {fixable} fixable" if fixable else ""
+ msg = ds[0].message
+ if len(msg) > _MAX_GROUP_MSG:
+ msg = msg[: _MAX_GROUP_MSG - 1] + "…"
+ anchors = [d.anchor for d in ds if d.anchor]
+ shown = anchors[:_MAX_ANCHORS]
+ more = f", +{len(anchors) - len(shown)} more" if len(anchors) > len(shown) else ""
+ loc = f" [{', '.join(shown)}{more}]" if shown else ""
+ out.append(f" {rule} ×{len(ds)}{fix_note} — {msg}{loc}") # noqa: RUF001
+
+ if trailing:
+ out.append("")
+ out.extend(trailing)
+
+ # Belt-and-braces for the cardinal invariant: any raw error-classified
+ # line that did not survive the grouping is appended verbatim (identical
+ # repeats collapse to one annotated copy).
+ rendered = "\n".join(out)
+ rescued: dict[str, int] = {}
+ for ln in raw_lines:
+ if ln.strip() and is_error_line(ln) and ln not in rendered:
+ rescued[ln] = rescued.get(ln, 0) + 1
+ if rescued:
+ out.append("")
+ out.extend(ln if n == 1 else f"{ln} (×{n})" for ln, n in rescued.items()) # noqa: RUF001
+ return "\n".join(out)
diff --git a/packages/core/src/repowise/core/distill/missed.py b/packages/core/src/repowise/core/distill/missed.py
new file mode 100644
index 000000000..fd1b66c7c
--- /dev/null
+++ b/packages/core/src/repowise/core/distill/missed.py
@@ -0,0 +1,231 @@
+"""Missed-savings discovery — what did raw agent commands waste?
+
+Scans Claude Code transcript JSONL (``~/.claude/projects/<munged-cwd>/*.jsonl``)
+for Bash/PowerShell tool calls inside this repo that were **not** routed
+through ``repowise distill``, classifies each command with the same router the
+engine uses, and estimates the tokens a filter would have saved using that
+filter's conservative measured floor (the per-fixture savings floors asserted
+in CI, not the medians).
+
+Read-only and best-effort by contract: malformed lines, unreadable files, or
+an absent transcript directory produce an empty report, never an error — this
+runs inside ``repowise saved`` and a dashboard endpoint, neither of which may
+break because a transcript changed shape.
+
+Privacy: everything stays local. Commands and outputs are read from the
+user's own transcript directory on this machine; nothing leaves it.
+"""
+
+from __future__ import annotations
+
+import json
+import re
+import time
+from datetime import datetime
+from pathlib import Path
+from typing import Any
+
+from repowise.core.distill.budget import estimate_tokens
+from repowise.core.distill.router import normalize_command, select_filter
+
+#: Default scan window, in days.
+DEFAULT_WINDOW_DAYS = 7.0
+
+#: Conservative per-filter savings ratios — the *floor* each filter's fixture
+#: suite asserts in CI (see tests/unit/distill/test_filters.py and
+#: test_search_results.py), not the measured medians. Estimates built on
+#: these undersell rather than oversell.
+RATIO_FLOOR: dict[str, float] = {
+ "test_output": 0.40,
+ "build_output": 0.40,
+ "lint_output": 0.30,
+ "git_status": 0.15,
+ "git_log": 0.80,
+ "git_diff": 0.50,
+ "search_results": 0.40,
+ "file_listing": 0.60,
+ "logs": 0.50,
+}
+
+#: Mirrors the engine's net-positive floor (``MIN_SAVED_TOKENS``): events whose
+#: estimated savings fall under it would not have produced a marker anyway.
+_MIN_EST_TOKENS = 40
+
+_SHELL_TOOLS = ("Bash", "PowerShell")
+
+_NON_SLUG_RE = re.compile(r"[^A-Za-z0-9-]")
+
+
+def transcript_dir_for(repo_root: Path, projects_root: Path | None = None) -> Path:
+ """The Claude Code transcript directory for sessions started at *repo_root*.
+
+ Claude Code munges the session cwd into a directory name by replacing
+ every non ``[A-Za-z0-9-]`` character with ``-`` (``C:\\Users\\x\\repo`` →
+ ``C--Users-x-repo``).
+ """
+ root = projects_root if projects_root is not None else Path.home() / ".claude" / "projects"
+ return root / _NON_SLUG_RE.sub("-", str(repo_root))
+
+
+def empty_report(days: float = DEFAULT_WINDOW_DAYS) -> dict[str, Any]:
+ return {
+ "events": 0,
+ "raw_tokens": 0,
+ "est_saved_tokens": 0,
+ "per_filter": {},
+ "window_days": days,
+ }
+
+
+def scan_missed_savings(
+ repo_root: Path,
+ *,
+ days: float = DEFAULT_WINDOW_DAYS,
+ now: float | None = None,
+ projects_root: Path | None = None,
+) -> dict[str, Any]:
+ """Aggregate foregone savings from raw shell commands in recent transcripts.
+
+ Counts Bash/PowerShell tool calls whose cwd lies inside *repo_root*, that
+ were not already ``repowise``-prefixed, that classify to a known filter,
+ and whose output was big enough to clear the filter's ``min_lines`` and
+ the net-positive floor. Returns totals plus a per-filter breakdown; any
+ failure degrades to an empty report.
+ """
+ try:
+ return _scan(Path(repo_root).resolve(), days, now, projects_root)
+ except Exception:
+ return empty_report(days)
+
+
+def _scan(
+ repo_root: Path, days: float, now: float | None, projects_root: Path | None
+) -> dict[str, Any]:
+ transcripts = transcript_dir_for(repo_root, projects_root)
+ report = empty_report(days)
+ if not transcripts.is_dir():
+ return report
+
+ cutoff = (now if now is not None else time.time()) - days * 86400.0
+ repo_prefix = str(repo_root).lower().rstrip("\\/")
+ per_filter: dict[str, dict[str, int]] = {}
+
+ for path in sorted(transcripts.glob("*.jsonl")):
+ try:
+ if path.stat().st_mtime < cutoff:
+ continue # untouched since the window opened
+ _scan_file(path, cutoff, repo_prefix, per_filter)
+ except OSError:
+ continue
+
+ for stats in per_filter.values():
+ report["events"] += stats["events"]
+ report["raw_tokens"] += stats["raw_tokens"]
+ report["est_saved_tokens"] += stats["est_saved_tokens"]
+ report["per_filter"] = dict(
+ sorted(per_filter.items(), key=lambda kv: -kv[1]["est_saved_tokens"])
+ )
+ return report
+
+
+def _scan_file(
+ path: Path, cutoff: float, repo_prefix: str, per_filter: dict[str, dict[str, int]]
+) -> None:
+ #: tool_use id -> command, for shell calls that passed every command gate.
+ pending: dict[str, str] = {}
+ with path.open(encoding="utf-8", errors="replace") as fh:
+ for raw in fh:
+ # Cheap substring gates before paying for json.loads on huge lines.
+ if '"tool_use"' in raw and '"command"' in raw:
+ _collect_tool_use(raw, cutoff, repo_prefix, pending)
+ elif pending and '"toolUseResult"' in raw:
+ _collect_result(raw, pending, per_filter)
+
+
+def _collect_tool_use(raw: str, cutoff: float, repo_prefix: str, pending: dict[str, str]) -> None:
+ try:
+ entry = json.loads(raw)
+ except ValueError:
+ return
+ if entry.get("type") != "assistant":
+ return
+ ts = _parse_ts(entry.get("timestamp"))
+ if ts is not None and ts < cutoff:
+ return
+ cwd = str(entry.get("cwd") or "").lower().rstrip("\\/")
+ if not cwd.startswith(repo_prefix):
+ return
+ content = (entry.get("message") or {}).get("content")
+ if not isinstance(content, list):
+ return
+ for block in content:
+ if not isinstance(block, dict) or block.get("type") != "tool_use":
+ continue
+ if block.get("name") not in _SHELL_TOOLS:
+ continue
+ command = str((block.get("input") or {}).get("command") or "")
+ if not command or normalize_command(command).startswith("repowise"):
+ continue # already distilled (or another repowise invocation)
+ block_id = block.get("id")
+ if isinstance(block_id, str):
+ pending[block_id] = command
+
+
+def _collect_result(
+ raw: str, pending: dict[str, str], per_filter: dict[str, dict[str, int]]
+) -> None:
+ try:
+ entry = json.loads(raw)
+ except ValueError:
+ return
+ content = (entry.get("message") or {}).get("content")
+ if not isinstance(content, list):
+ return
+ block_id = next(
+ (
+ b.get("tool_use_id")
+ for b in content
+ if isinstance(b, dict) and b.get("type") == "tool_result"
+ ),
+ None,
+ )
+ command = pending.pop(block_id, None) if isinstance(block_id, str) else None
+ if command is None:
+ return
+
+ output = _result_text(entry.get("toolUseResult"))
+ if not output:
+ return
+ chosen = select_filter(command, output)
+ if chosen is None:
+ return
+ raw_tokens = estimate_tokens(output)
+ est = int(raw_tokens * RATIO_FLOOR.get(chosen.name, 0.0))
+ if len(output.splitlines()) < chosen.min_lines or est < _MIN_EST_TOKENS:
+ return
+
+ stats = per_filter.setdefault(
+ chosen.name, {"events": 0, "raw_tokens": 0, "est_saved_tokens": 0}
+ )
+ stats["events"] += 1
+ stats["raw_tokens"] += raw_tokens
+ stats["est_saved_tokens"] += est
+
+
+def _result_text(result: Any) -> str:
+ """stdout+stderr from a shell ``toolUseResult``, tolerating shape drift."""
+ if isinstance(result, str):
+ return result
+ if isinstance(result, dict):
+ parts = [str(result.get(key) or "") for key in ("stdout", "stderr")]
+ return "\n".join(p for p in parts if p)
+ return ""
+
+
+def _parse_ts(value: Any) -> float | None:
+ if not isinstance(value, str):
+ return None
+ try:
+ return datetime.fromisoformat(value.replace("Z", "+00:00")).timestamp()
+ except ValueError:
+ return None
diff --git a/packages/server/src/repowise/server/routers/costs.py b/packages/server/src/repowise/server/routers/costs.py
index 88fea7a32..7516b58cf 100644
--- a/packages/server/src/repowise/server/routers/costs.py
+++ b/packages/server/src/repowise/server/routers/costs.py
@@ -166,6 +166,12 @@ async def get_distill_savings(
finally:
conn.close()
+ # Missed savings: best-effort scan of local agent transcripts; the module
+ # degrades to an empty report on any failure, never raises.
+ from repowise.core.distill.missed import scan_missed_savings
+
+ missed = scan_missed_savings(Path(repo.local_path))
+
rate = get_model_pricing(_SAVINGS_PRICING_MODEL)["input"]
return DistillSavingsResponse(
available=True,
@@ -177,4 +183,7 @@ async def get_distill_savings(
pricing_model=_SAVINGS_PRICING_MODEL,
per_filter=[DistillSavingsGroup(**row) for row in per_filter],
per_day=[DistillSavingsGroup(**row) for row in per_day],
+ missed_events=missed["events"],
+ missed_tokens_est=missed["est_saved_tokens"],
+ missed_window_days=missed["window_days"],
)
diff --git a/packages/server/src/repowise/server/schemas/ui_helpers.py b/packages/server/src/repowise/server/schemas/ui_helpers.py
index 047d95a14..676c38d57 100644
--- a/packages/server/src/repowise/server/schemas/ui_helpers.py
+++ b/packages/server/src/repowise/server/schemas/ui_helpers.py
@@ -60,3 +60,8 @@ class DistillSavingsResponse(BaseModel):
pricing_model: str = ""
per_filter: list[DistillSavingsGroup] = []
per_day: list[DistillSavingsGroup] = []
+ # Missed savings — raw (non-distilled) agent commands a filter would have
+ # caught, scanned best-effort from local Claude Code transcripts.
+ missed_events: int = 0
+ missed_tokens_est: int = 0
+ missed_window_days: float = 0.0
diff --git a/packages/ui/src/costs/distill-savings-card.tsx b/packages/ui/src/costs/distill-savings-card.tsx
index 21d674771..38b590a1f 100644
--- a/packages/ui/src/costs/distill-savings-card.tsx
+++ b/packages/ui/src/costs/distill-savings-card.tsx
@@ -22,6 +22,10 @@ export interface DistillSavingsData {
pricing_model: string;
per_filter: DistillSavingsGroup[];
per_day: DistillSavingsGroup[];
+ /** Raw (non-distilled) agent commands a filter would have caught. */
+ missed_events?: number;
+ missed_tokens_est?: number;
+ missed_window_days?: number;
}
export interface DistillSavingsCardProps {
@@ -41,6 +45,7 @@ export function DistillSavingsCard({ data }: DistillSavingsCardProps) {
? Math.round((data.saved_tokens / data.raw_tokens) * 100)
: 0;
const topFilters = hasData ? data.per_filter.slice(0, 3) : [];
+ const missed = data?.available && (data.missed_events ?? 0) > 0;
return (
<Card>
@@ -89,10 +94,29 @@ export function DistillSavingsCard({ data }: DistillSavingsCardProps) {
);
})}
</div>
+ {missed && (
+ <div className="flex items-baseline gap-2 border-t border-[var(--color-border-secondary)] pt-2">
+ <span className="text-sm font-medium text-amber-500 tabular-nums">
+ ~{formatTokens(data.missed_tokens_est ?? 0)}
+ </span>
+ <span className="text-xs text-[var(--color-text-secondary)]">
+ missed — {(data.missed_events ?? 0).toLocaleString()} raw command
+ {(data.missed_events ?? 0) === 1 ? "" : "s"} bypassed distill in the last{" "}
+ {data.missed_window_days ?? 7} days
+ </span>
+ </div>
+ )}
<p className="text-[10px] text-[var(--color-text-tertiary)] leading-snug">
{data.events.toLocaleString()} distillation{data.events === 1 ? "" : "s"} via the{" "}
<code>repowise distill</code> command/hook path. MCP response truncation is not
counted. Estimate at {data.pricing_model} input rate.
+ {missed && (
+ <>
+ {" "}
+ Missed savings are scanned from local agent transcripts (nothing leaves this
+ machine) — see <code>repowise saved --missed</code>.
+ </>
+ )}
</p>
</div>
) : (
diff --git a/packages/web/src/lib/api/costs.ts b/packages/web/src/lib/api/costs.ts
index 2b8284cf6..c2399b58c 100644
--- a/packages/web/src/lib/api/costs.ts
+++ b/packages/web/src/lib/api/costs.ts
@@ -38,6 +38,10 @@ export interface DistillSavings {
pricing_model: string;
per_filter: DistillSavingsGroup[];
per_day: DistillSavingsGroup[];
+ /** Raw (non-distilled) agent commands a filter would have caught. */
+ missed_events: number;
+ missed_tokens_est: number;
+ missed_window_days: number;
}
// ---------------------------------------------------------------------------
diff --git a/tests/fixtures/distill/clippy_warnings.txt b/tests/fixtures/distill/clippy_warnings.txt
new file mode 100644
index 000000000..a3b80656a
--- /dev/null
+++ b/tests/fixtures/distill/clippy_warnings.txt
@@ -0,0 +1,125 @@
+ Checking gitscan v0.4.2 (C:\src\gitscan)
+warning: unused variable: `depth`
+ --> src/walker.rs:42:9
+ |
+42 | let depth = opts.depth.unwrap_or(1);
+ | ^^^^^ help: if this is intentional, prefix it with an underscore: `_depth`
+ |
+ = note: `#[warn(unused_variables)]` on by default
+
+warning: this expression creates a reference which is immediately dereferenced by the compiler
+ --> src/repo.rs:118:30
+ |
+118 | let head = resolve(&path);
+ | ^^^^ help: change this to: `path`
+ |
+ = note: `#[warn(clippy::needless_borrow)]` on by default
+
+warning: this expression creates a reference which is immediately dereferenced by the compiler
+ --> src/repo.rs:131:22
+ |
+131 | let tip = peel(&target);
+ | ^^^^^^ help: change this to: `target`
+ |
+ = note: `#[warn(clippy::needless_borrow)]` on by default
+
+warning: redundant clone
+ --> src/output.rs:55:31
+ |
+55 | render(rows.clone(), &opts.clone());
+ | ^^^^^^^^ help: remove this
+ |
+ = note: `#[warn(clippy::redundant_clone)]` on by default
+
+warning: redundant clone
+ --> src/output.rs:61:18
+ |
+61 | emit(header.clone());
+ | ^^^^^^^^ help: remove this
+ |
+ = note: `#[warn(clippy::redundant_clone)]` on by default
+
+warning: redundant clone
+ --> src/output.rs:74:25
+ |
+74 | summarize(totals.clone());
+ | ^^^^^^^^ help: remove this
+ |
+ = note: `#[warn(clippy::redundant_clone)]` on by default
+
+warning: useless conversion to the same type: `std::string::String`
+ --> src/walker.rs:88:20
+ |
+88 | let name = String::from(stem.to_string());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing
+ |
+ = note: `#[warn(clippy::useless_conversion)]` on by default
+
+warning: length comparison to zero
+ --> src/repo.rs:140:8
+ |
+140 | if entries.len() == 0 {
+ | ^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `entries.is_empty()`
+ |
+ = note: `#[warn(clippy::len_zero)]` on by default
+
+warning: length comparison to zero
+ --> src/walker.rs:103:12
+ |
+103 | if rows.len() == 0 {
+ | ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `rows.is_empty()`
+ |
+ = note: `#[warn(clippy::len_zero)]` on by default
+
+warning: this expression creates a reference which is immediately dereferenced by the compiler
+ --> src/walker.rs:117:25
+ |
+117 | let rel = strip(&base);
+ | ^^^^^ help: change this to: `base`
+ |
+ = note: `#[warn(clippy::needless_borrow)]` on by default
+
+warning: this expression creates a reference which is immediately dereferenced by the compiler
+ --> src/output.rs:101:14
+ |
+101 | format(&style);
+ | ^^^^^^ help: change this to: `style`
+ |
+ = note: `#[warn(clippy::needless_borrow)]` on by default
+
+warning: redundant clone
+ --> src/walker.rs:122:20
+ |
+122 | queue(entry.clone());
+ | ^^^^^^^^ help: remove this
+ |
+ = note: `#[warn(clippy::redundant_clone)]` on by default
+
+warning: redundant clone
+ --> src/repo.rs:155:14
+ |
+155 | push(tag.clone());
+ | ^^^^^^^^ help: remove this
+ |
+ = note: `#[warn(clippy::redundant_clone)]` on by default
+
+warning: useless conversion to the same type: `std::string::String`
+ --> src/repo.rs:162:16
+ |
+162 | let id = String::from(oid.to_string());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing
+ |
+ = note: `#[warn(clippy::useless_conversion)]` on by default
+
+error[E0308]: mismatched types
+ --> src/output.rs:93:24
+ |
+93 | let width: usize = opts.width;
+ | ----- ^^^^^^^^^^ expected `usize`, found `Option<usize>`
+ | |
+ | expected due to this
+ |
+help: consider using `Option::unwrap_or_default` to handle the `None` case
+
+warning: `gitscan` (lib) generated 14 warnings (run `cargo clippy --fix --lib -p gitscan` to apply 11 suggestions)
+error: could not compile `gitscan` (lib) due to 1 previous error; 14 warnings emitted
diff --git a/tests/fixtures/distill/eslint_fail.txt b/tests/fixtures/distill/eslint_fail.txt
new file mode 100644
index 000000000..3656faadd
--- /dev/null
+++ b/tests/fixtures/distill/eslint_fail.txt
@@ -0,0 +1,24 @@
+
+C:\Users\ragha\Desktop\repowise\packages\web\src\components\__distill_tmp__.tsx
+ 9:5 error React Hook "useEffect" is called conditionally. React Hooks must be called in the exact same order in every component render react-hooks/rules-of-hooks
+ 11:8 warning React Hook useEffect has a missing dependency: 'refresh'. Either include it or remove the dependency array. If 'refresh' changes too often, find the parent component that defines it and wrap that definition in useCallback react-hooks/exhaustive-deps
+ 15:6 warning React Hook useEffect has a missing dependency: 'items.length'. Either include it or remove the dependency array. If 'setCount' needs the current value of 'items.length', you can also switch to useReducer instead of useState and read 'items.length' in the reducer react-hooks/exhaustive-deps
+ 19:7 warning Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
+ 19:7 warning img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text
+ 20:7 error Do not use an `<a>` element to navigate to `/repos/`. Use `<Link />` from `next/link` instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages @next/next/no-html-link-for-pages
+ 20:7 error Do not use an `<a>` element to navigate to `/repos/`. Use `<Link />` from `next/link` instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages @next/next/no-html-link-for-pages
+ 20:7 error Do not use an `<a>` element to navigate to `/repos/`. Use `<Link />` from `next/link` instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages @next/next/no-html-link-for-pages
+ 20:7 error Do not use an `<a>` element to navigate to `/repos/`. Use `<Link />` from `next/link` instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages @next/next/no-html-link-for-pages
+ 20:7 error Do not use an `<a>` element to navigate to `/repos/`. Use `<Link />` from `next/link` instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages @next/next/no-html-link-for-pages
+ 21:12 error `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;` react/no-unescaped-entities
+ 21:17 error `"` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;` react/no-unescaped-entities
+ 21:24 error `"` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;` react/no-unescaped-entities
+ 31:6 warning React Hook useEffect has a missing dependency: 'data'. Either include it or remove the dependency array. If 'setValue' needs the current value of 'data', you can also switch to useReducer instead of useState and read 'data' in the reducer react-hooks/exhaustive-deps
+ 34:7 warning Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
+ 35:7 warning Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
+ 35:7 warning img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text
+ 36:7 warning Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
+ 36:7 warning img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text
+
+✖ 19 problems (9 errors, 10 warnings)
+
diff --git a/tests/fixtures/distill/golangci_lint.txt b/tests/fixtures/distill/golangci_lint.txt
new file mode 100644
index 000000000..61174ac53
--- /dev/null
+++ b/tests/fixtures/distill/golangci_lint.txt
@@ -0,0 +1,81 @@
+internal/scan/walker.go:42:2: ineffectual assignment to depth (ineffassign)
+ depth := opts.Depth
+ ^
+internal/scan/walker.go:88:15: Error return value of `f.Close` is not checked (errcheck)
+ defer f.Close()
+ ^
+internal/repo/head.go:118:9: Error return value of `w.Flush` is not checked (errcheck)
+ w.Flush()
+ ^
+internal/repo/head.go:131:6: func `peelTag` is unused (unused)
+func peelTag(ref *plumbing.Reference) string {
+ ^
+internal/output/render.go:55:2: S1000: should use a simple channel send/receive instead of `select` with a single case (gosimple)
+ select {
+ ^
+internal/output/render.go:61:12: G104: Errors unhandled. (gosec)
+ io.Copy(dst, src)
+ ^
+internal/output/render.go:74:2: declarations should never be cuddled (wsl)
+ var totals Summary
+ ^
+internal/output/render.go:75:2: assignments should only be cuddled with other assignments (wsl)
+ rows := collect(totals)
+ ^
+internal/scan/match.go:23:10: G304: Potential file inclusion via variable (gosec)
+ f, err := os.Open(path)
+ ^
+internal/scan/match.go:51:2: `if` block ends with a `return` statement, so drop this `else` and outdent its block (indent-error-flow) (revive)
+ } else {
+ ^
+internal/scan/match.go:67:14: Error return value of `scanner.Err` is not checked (errcheck)
+ scanner.Err()
+ ^
+internal/config/load.go:18:2: import 'github.com/pkg/errors' is not allowed from list 'main' (depguard)
+ "github.com/pkg/errors"
+ ^
+internal/config/load.go:34:2: declarations should never be cuddled (wsl)
+ var path string
+ ^
+internal/config/load.go:35:2: assignments should only be cuddled with other assignments (wsl)
+ base := filepath.Dir(path)
+ ^
+internal/config/load.go:52:2: declarations should never be cuddled (wsl)
+ var merged Config
+ ^
+internal/config/load.go:61:2: declarations should never be cuddled (wsl)
+ var overrides []Override
+ ^
+internal/scan/match.go:84:2: declarations should never be cuddled (wsl)
+ var hits []Match
+ ^
+internal/scan/walker.go:120:2: declarations should never be cuddled (wsl)
+ var pending []string
+ ^
+internal/output/render.go:92:9: Error return value of `enc.Encode` is not checked (errcheck)
+ enc.Encode(rows)
+ ^
+internal/output/render.go:108:11: Error return value of `tw.Flush` is not checked (errcheck)
+ tw.Flush()
+ ^
+internal/repo/head.go:144:13: Error return value of `it.ForEach` is not checked (errcheck)
+ it.ForEach(visit)
+ ^
+internal/scan/match.go:92:7: G304: Potential file inclusion via variable (gosec)
+ g, err := os.Open(rel)
+ ^
+internal/scan/walker.go:133:10: G104: Errors unhandled. (gosec)
+ filepath.Walk(root, visit)
+ ^
+internal/repo/head.go:152:6: func `resolveSymbolic` is unused (unused)
+func resolveSymbolic(r *Repo) string {
+ ^
+24 issues:
+* wsl: 8
+* errcheck: 6
+* gosec: 4
+* ineffassign: 1
+* unused: 2
+* gosimple: 1
+* revive: 1
+* depguard: 1
diff --git a/tests/fixtures/distill/mypy_errors.txt b/tests/fixtures/distill/mypy_errors.txt
new file mode 100644
index 000000000..1a93cb7c0
--- /dev/null
+++ b/tests/fixtures/distill/mypy_errors.txt
@@ -0,0 +1,11 @@
+packages/core/src/repowise/core/distill/markers.py:31: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]
+packages/core/src/repowise/core/distill/markers.py:48: error: Argument 1 to "render_marker" has incompatible type "Optional[str]"; expected "str" [arg-type]
+packages/core/src/repowise/core/distill/markers.py:48: note: "render_marker" is defined here
+packages/core/src/repowise/core/distill/budget.py:12: error: Function is missing a return type annotation [no-untyped-def]
+packages/core/src/repowise/core/distill/budget.py:12: note: Use "-> None" if function does not return a value
+packages/core/src/repowise/core/distill/budget.py:27: warning: Returning Any from function declared to return "int" [no-any-return]
+packages/core/src/repowise/core/distill/budget.py:33: error: Unsupported operand types for + ("int" and "str") [operator]
+packages/core/src/repowise/core/distill/store.py:102: error: Item "None" of "Optional[Connection]" has no attribute "execute" [union-attr]
+packages/core/src/repowise/core/distill/store.py:140: warning: Returning Any from function declared to return "str" [no-any-return]
+packages/core/src/repowise/core/distill/store.py:171: error: Missing positional argument "source" in call to "put" [call-arg]
+Found 7 errors in 3 files (checked 11 source files)
diff --git a/tests/fixtures/distill/ruff_check_concise.txt b/tests/fixtures/distill/ruff_check_concise.txt
new file mode 100644
index 000000000..3d9a932f0
--- /dev/null
+++ b/tests/fixtures/distill/ruff_check_concise.txt
@@ -0,0 +1,673 @@
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:14:22: TC003 Move standard library import `datetime.datetime` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:17:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:17:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:17:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:17:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:17:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:17:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:17:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:18:5: TC001 Move application import `..models.CoverageFile` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:19:5: TC001 Move application import `..models.DeadCodeFinding` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:20:5: TC001 Move application import `..models.DecisionRecord` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:21:5: TC001 Move application import `..models.GitMetadata` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:22:5: TC001 Move application import `..models.HealthFileMetric` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:23:5: TC001 Move application import `..models.HealthFinding` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:24:5: TC001 Move application import `..models.HealthSnapshot` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:37:70: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:42:49: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:47:56: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:52:33: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:57:60: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:69:55: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:84:68: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:95:47: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:99:56: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:106:15: PLR0913 Too many arguments in function definition (8 > 5)
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:139:43: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**fields`
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:139:46: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:147:64: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:152:57: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:164:54: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:169:53: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:183:53: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:199:73: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:207:43: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:211:15: PLR0913 Too many arguments in function definition (7 > 5)
+packages\core\src\repowise\core\persistence\_interfaces\_analysis.py:225:62: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:16:22: TC001 Move application import `..models.ExternalSystem` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:16:38: TC001 Move application import `..models.GraphEdge` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:16:49: TC001 Move application import `..models.GraphNode` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:28:52: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:33:52: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:38:47: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:54:54: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:72:52: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:77:77: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:82:47: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:91:54: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:96:61: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:101:33: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_graph_records.py:110:48: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:18:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:18:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:18:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:18:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:18:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:18:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:18:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:19:5: TC001 Move application import `..models.ChatMessage` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:20:5: TC001 Move application import `..models.Conversation` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:21:5: TC001 Move application import `..models.GenerationJob` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:22:5: TC001 Move application import `..models.Page` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:23:5: TC001 Move application import `..models.PageVersion` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:24:5: TC001 Move application import `..models.Repository` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:25:5: TC001 Move application import `..models.WebhookEvent` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:64:15: PLR0913 Too many arguments in function definition (7 > 5)
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:80:15: PLR0913 Too many arguments in function definition (7 > 5)
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:97:43: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:101:57: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:108:15: PLR0913 Too many arguments in function definition (6 > 5)
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:121:47: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:147:58: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:156:69: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:161:35: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:166:53: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:171:47: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:182:64: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\_meta.py:187:35: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\graph_store.py:40:47: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**attrs`
+packages\core\src\repowise\core\persistence\_interfaces\graph_store.py:44:59: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**attrs`
+packages\core\src\repowise\core\persistence\_interfaces\graph_store.py:65:9: D205 1 blank line required between summary line and description
+packages\core\src\repowise\core\persistence\_interfaces\graph_store.py:65:9: D209 [*] Multi-line docstring closing quotes should be on a separate line
+packages\core\src\repowise\core\persistence\_interfaces\job_store.py:23:22: TC003 Move standard library import `datetime.datetime` into a type-checking block
+packages\core\src\repowise\core\persistence\_interfaces\job_store.py:82:9: D205 1 blank line required between summary line and description
+packages\core\src\repowise\core\persistence\_interfaces\job_store.py:82:9: D209 [*] Multi-line docstring closing quotes should be on a separate line
+packages\core\src\repowise\core\persistence\_interfaces\job_store.py:96:50: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\_interfaces\job_store.py:98:9: D205 1 blank line required between summary line and description
+packages\core\src\repowise\core\persistence\coordinator.py:33:1: I001 [*] Import block is un-sorted or un-formatted
+packages\core\src\repowise\core\persistence\coordinator.py:38:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator`
+packages\core\src\repowise\core\persistence\coordinator.py:51:28: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `obj`
+packages\core\src\repowise\core\persistence\coordinator.py:69:7: D101 Missing docstring in public class
+packages\core\src\repowise\core\persistence\coordinator.py:70:9: D107 Missing docstring in `__init__`
+packages\core\src\repowise\core\persistence\coordinator.py:70:24: ANN001 Missing type annotation for function argument `session`
+packages\core\src\repowise\core\persistence\coordinator.py:70:33: ANN001 Missing type annotation for function argument `graph_builder`
+packages\core\src\repowise\core\persistence\coordinator.py:70:53: ANN001 Missing type annotation for function argument `vector_store`
+packages\core\src\repowise\core\persistence\coordinator.py:77:15: C901 `transaction` is too complex (21 > 10)
+packages\core\src\repowise\core\persistence\coordinator.py:77:15: PLR0912 Too many branches (20 > 12)
+packages\core\src\repowise\core\persistence\coordinator.py:77:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\coordinator.py:126:24: BLE001 Do not catch blind exception: `Exception`
+packages\core\src\repowise\core\persistence\coordinator.py:127:21: TRY400 Use `logging.exception` instead of `logging.error`
+packages\core\src\repowise\core\persistence\coordinator.py:143:32: BLE001 Do not catch blind exception: `Exception`
+packages\core\src\repowise\core\persistence\coordinator.py:144:29: TRY400 Use `logging.exception` instead of `logging.error`
+packages\core\src\repowise\core\persistence\coordinator.py:149:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\coordinator.py:154:16: BLE001 Do not catch blind exception: `Exception`
+packages\core\src\repowise\core\persistence\coordinator.py:164:20: BLE001 Do not catch blind exception: `Exception`
+packages\core\src\repowise\core\persistence\coordinator.py:169:20: BLE001 Do not catch blind exception: `Exception`
+packages\core\src\repowise\core\persistence\coordinator.py:188:26: ANN001 Missing type annotation for function argument `store`
+packages\core\src\repowise\core\persistence\coordinator.py:196:15: TRY003 Avoid specifying long messages outside the exception class
+packages\core\src\repowise\core\persistence\coordinator.py:197:13: EM102 Exception must not use an f-string literal, assign to variable first
+packages\core\src\repowise\core\persistence\coordinator.py:198:51: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\coordinator.py:204:26: ANN001 Missing type annotation for function argument `store`
+packages\core\src\repowise\core\persistence\coordinator.py:209:25: ANN001 Missing type annotation for function argument `store`
+packages\core\src\repowise\core\persistence\crud\_shared.py:11:29: TC003 Move standard library import `collections.abc.Callable` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\_shared.py:11:39: TC003 Move standard library import `collections.abc.Iterable` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\_shared.py:16:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\_shared.py:32:11: PLR0913 Too many arguments in function definition (9 > 5)
+packages\core\src\repowise\core\persistence\crud\_shared.py:44:5: D401 First line of docstring should be in imperative mood: "Generic batch upsert with ONE existence query for the whole batch."
+packages\core\src\repowise\core\persistence\crud\analysis.py:10:22: TC003 Move standard library import `datetime.datetime` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\analysis.py:14:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\analysis.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\analysis.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\analysis.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\analysis.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\analysis.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\analysis.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\analysis.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\analysis.py:32:33: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `finding`
+packages\core\src\repowise\core\persistence\crud\analysis.py:39:36: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `finding`
+packages\core\src\repowise\core\persistence\crud\analysis.py:40:5: D205 1 blank line required between summary line and description
+packages\core\src\repowise\core\persistence\crud\analysis.py:40:5: D209 [*] Multi-line docstring closing quotes should be on a separate line
+packages\core\src\repowise\core\persistence\crud\analysis.py:57:73: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:90:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:125:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:184:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:193:28: PLR2004 Magic value used in comparison, consider replacing `0.7` with a constant variable
+packages\core\src\repowise\core\persistence\crud\analysis.py:195:30: PLR2004 Magic value used in comparison, consider replacing `0.4` with a constant variable
+packages\core\src\repowise\core\persistence\crud\analysis.py:230:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:266:18: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:272:73: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:308:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:348:18: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:366:88: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:400:18: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:405:11: PLR0913 Too many arguments in function definition (6 > 5)
+packages\core\src\repowise\core\persistence\crud\analysis.py:405:11: D103 Missing docstring in public function
+packages\core\src\repowise\core\persistence\crud\analysis.py:433:11: D103 Missing docstring in public function
+packages\core\src\repowise\core\persistence\crud\analysis.py:470:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:481:11: D103 Missing docstring in public function
+packages\core\src\repowise\core\persistence\crud\analysis.py:500:11: PLR0913 Too many arguments in function definition (8 > 5)
+packages\core\src\repowise\core\persistence\crud\analysis.py:537:76: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:553:5: D205 1 blank line required between summary line and description
+packages\core\src\repowise\core\persistence\crud\analysis.py:553:5: D209 [*] Multi-line docstring closing quotes should be on a separate line
+packages\core\src\repowise\core\persistence\crud\analysis.py:587:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:624:18: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:647:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:684:18: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:709:80: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:751:18: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\analysis.py:756:11: D103 Missing docstring in public function
+packages\core\src\repowise\core\persistence\crud\chat.py:12:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\chat.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\chat.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\chat.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\chat.py:25:11: D103 Missing docstring in public function
+packages\core\src\repowise\core\persistence\crud\chat.py:37:11: D103 Missing docstring in public function
+packages\core\src\repowise\core\persistence\crud\chat.py:41:11: D103 Missing docstring in public function
+packages\core\src\repowise\core\persistence\crud\chat.py:42:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\chat.py:48:22: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\chat.py:53:11: D103 Missing docstring in public function
+packages\core\src\repowise\core\persistence\crud\chat.py:54:60: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\chat.py:64:11: D103 Missing docstring in public function
+packages\core\src\repowise\core\persistence\crud\chat.py:86:11: D103 Missing docstring in public function
+packages\core\src\repowise\core\persistence\crud\chat.py:103:11: D103 Missing docstring in public function
+packages\core\src\repowise\core\persistence\crud\chat.py:107:48: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\chat.py:112:11: D103 Missing docstring in public function
+packages\core\src\repowise\core\persistence\crud\chat.py:116:63: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\decisions.py:10:22: TC003 Move standard library import `datetime.datetime` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\decisions.py:14:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\decisions.py:18:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\decisions.py:19:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\decisions.py:19:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\decisions.py:19:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\decisions.py:19:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\decisions.py:19:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\decisions.py:34:11: PLR0913 Too many arguments in function definition (22 > 5)
+packages\core\src\repowise\core\persistence\crud\decisions.py:136:11: PLR0913 Too many arguments in function definition (9 > 5)
+packages\core\src\repowise\core\persistence\crud\decisions.py:204:15: TRY003 Avoid specifying long messages outside the exception class
+packages\core\src\repowise\core\persistence\crud\decisions.py:205:13: EM102 Exception must not use an f-string literal, assign to variable first
+packages\core\src\repowise\core\persistence\crud\decisions.py:205:100: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\decisions.py:221:15: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**fields`
+packages\core\src\repowise\core\persistence\crud\decisions.py:279:5: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\crud\decisions.py:284:12: RET504 Unnecessary assignment to `t` before `return` statement
+packages\core\src\repowise\core\persistence\crud\decisions.py:296:11: PLR0913 Too many arguments in function definition (10 > 5)
+packages\core\src\repowise\core\persistence\crud\decisions.py:351:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\decisions.py:372:90: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\decisions.py:382:11: C901 `bulk_upsert_decisions` is too complex (15 > 10)
+packages\core\src\repowise\core\persistence\crud\decisions.py:382:11: PLR0912 Too many branches (14 > 12)
+packages\core\src\repowise\core\persistence\crud\decisions.py:382:11: PLR0915 Too many statements (60 > 50)
+packages\core\src\repowise\core\persistence\crud\decisions.py:387:19: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `vector_store`
+packages\core\src\repowise\core\persistence\crud\decisions.py:430:84: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\decisions.py:445:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\crud\decisions.py:580:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\decisions.py:591:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\crud\decisions.py:600:51: PLR2004 Magic value used in comparison, consider replacing `0.01` with a constant variable
+packages\core\src\repowise\core\persistence\crud\decisions.py:621:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\decisions.py:634:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\decisions.py:647:37: PLR2004 Magic value used in comparison, consider replacing `0.5` with a constant variable
+packages\core\src\repowise\core\persistence\crud\decisions.py:660:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\decisions.py:666:5: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\crud\decisions.py:666:5: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\decisions.py:681:14: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\external_systems.py:12:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\external_systems.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\external_systems.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\external_systems.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\external_systems.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\external_systems.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\external_systems.py:53:14: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\external_systems.py:93:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\external_systems.py:117:39: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\external_systems.py:127:21: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `sym`
+packages\core\src\repowise\core\persistence\crud\external_systems.py:131:52: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `sym`
+packages\core\src\repowise\core\persistence\crud\git.py:10:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\git.py:12:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\git.py:12:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\git.py:12:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\git.py:12:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\git.py:12:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\git.py:38:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:61:62: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:68:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:74:69: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:83:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:91:78: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:134:5: D205 1 blank line required between summary line and description
+packages\core\src\repowise\core\persistence\crud\git.py:150:5: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\crud\git.py:159:78: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:251:100: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:256:11: ANN201 Missing return type annotation for public function `get_latest_commit_committed_at`
+packages\core\src\repowise\core\persistence\crud\git.py:263:97: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:274:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:291:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:315:24: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:363:88: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:373:64: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:379:62: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\git.py:386:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\graph.py:12:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\graph.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\graph.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\graph.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\graph.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\graph.py:155:78: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\graph.py:182:74: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\graph.py:218:74: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\graph.py:233:14: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\graph.py:253:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\graph.py:258:11: PLR0913 Too many arguments in function definition (6 > 5)
+packages\core\src\repowise\core\persistence\crud\graph.py:258:11: D417 Missing argument descriptions in the docstring for `get_graph_edges_for_node`: `node_id`, `repository_id`, `session`
+packages\core\src\repowise\core\persistence\crud\graph.py:269:5: D413 [*] Missing blank line after last section ("Parameters")
+packages\core\src\repowise\core\persistence\crud\graph.py:323:14: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\graph.py:347:22: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\graph.py:361:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\graph.py:430:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\graph.py:460:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\graph.py:468:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\knowledge_graph.py:12:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\knowledge_graph.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\knowledge_graph.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\knowledge_graph.py:27:88: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\knowledge_graph.py:38:14: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\knowledge_graph.py:48:53: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\knowledge_graph.py:56:94: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\knowledge_graph.py:66:14: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\knowledge_graph.py:76:53: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\pages.py:10:22: TC003 Move standard library import `datetime.datetime` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\pages.py:14:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\pages.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\pages.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\pages.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\pages.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\pages.py:29:11: PLR0913 Too many arguments in function definition (20 > 5)
+packages\core\src\repowise\core\persistence\crud\pages.py:124:5: RET505 [*] Unnecessary `else` after `return` statement
+packages\core\src\repowise\core\persistence\crud\pages.py:165:5: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\crud\pages.py:186:5: D401 First line of docstring should be in imperative mood: "Convenience wrapper that unpacks a GeneratedPage dataclass."
+packages\core\src\repowise\core\persistence\crud\pages.py:222:11: PLR0913 Too many arguments in function definition (7 > 5)
+packages\core\src\repowise\core\persistence\crud\pages.py:259:22: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\pages.py:273:10: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\repository.py:12:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\crud\repository.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\repository.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\repository.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\repository.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\repository.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\repository.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\crud\repository.py:29:11: PLR0913 Too many arguments in function definition (6 > 5)
+packages\core\src\repowise\core\persistence\crud\repository.py:105:11: PLR0913 Too many arguments in function definition (8 > 5)
+packages\core\src\repowise\core\persistence\crud\repository.py:136:11: PLR0913 Too many arguments in function definition (8 > 5)
+packages\core\src\repowise\core\persistence\crud\repository.py:149:5: D413 [*] Missing blank line after last section ("Raises")
+packages\core\src\repowise\core\persistence\crud\repository.py:154:15: TRY003 Avoid specifying long messages outside the exception class
+packages\core\src\repowise\core\persistence\crud\repository.py:155:13: EM102 Exception must not use an f-string literal, assign to variable first
+packages\core\src\repowise\core\persistence\crud\repository.py:155:90: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\repository.py:160:15: TRY003 Avoid specifying long messages outside the exception class
+packages\core\src\repowise\core\persistence\crud\repository.py:160:27: EM102 Exception must not use an f-string literal, assign to variable first
+packages\core\src\repowise\core\persistence\crud\repository.py:190:11: PLR0913 Too many arguments in function definition (6 > 5)
+packages\core\src\repowise\core\persistence\crud\repository.py:215:71: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\crud\repository.py:220:15: TRY003 Avoid specifying long messages outside the exception class
+packages\core\src\repowise\core\persistence\crud\repository.py:220:27: EM102 Exception must not use an f-string literal, assign to variable first
+packages\core\src\repowise\core\persistence\database.py:15:29: TC003 Move standard library import `collections.abc.AsyncGenerator` into a type-checking block
+packages\core\src\repowise\core\persistence\database.py:54:5: ANN202 Missing return type annotation for private function `_make_pragma_listener`
+packages\core\src\repowise\core\persistence\database.py:141:8: PIE810 Call `startswith` once with a `tuple`
+packages\core\src\repowise\core\persistence\database.py:182:5: D413 [*] Missing blank line after last section ("Args")
+packages\core\src\repowise\core\persistence\database.py:349:76: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\database.py:384:68: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\database.py:385:18: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:22:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\decision_graph.py:52:11: PLR0913 Too many arguments in function definition (7 > 5)
+packages\core\src\repowise\core\persistence\decision_graph.py:80:14: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:125:60: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:141:18: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:145:15: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:169:84: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:183:14: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:196:14: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:214:14: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:228:92: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:232:15: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:302:14: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:325:88: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:329:15: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:345:96: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\decision_graph.py:349:15: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:39:7: D101 Missing docstring in public class
+packages\core\src\repowise\core\persistence\models.py:43:7: D101 Missing docstring in public class
+packages\core\src\repowise\core\persistence\models.py:54:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:57:85: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:61:7: D101 Missing docstring in public class
+packages\core\src\repowise\core\persistence\models.py:66:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:78:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:81:85: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:99:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:147:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:151:7: D101 Missing docstring in public class
+packages\core\src\repowise\core\persistence\models.py:156:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:183:99: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:186:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:193:5: D205 1 blank line required between summary line and description
+packages\core\src\repowise\core\persistence\models.py:205:98: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:215:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:223:7: D101 Missing docstring in public class
+packages\core\src\repowise\core\persistence\models.py:228:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:236:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:263:98: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:272:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:278:7: D101 Missing docstring in public class
+packages\core\src\repowise\core\persistence\models.py:283:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:291:89: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:294:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:309:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:327:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:330:85: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:344:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:417:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:420:85: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:444:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:487:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:490:85: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:495:5: D205 1 blank line required between summary line and description
+packages\core\src\repowise\core\persistence\models.py:520:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:544:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:547:85: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:552:5: D205 1 blank line required between summary line and description
+packages\core\src\repowise\core\persistence\models.py:552:5: D209 [*] Multi-line docstring closing quotes should be on a separate line
+packages\core\src\repowise\core\persistence\models.py:568:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:574:55: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:590:50: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:601:57: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:606:47: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:612:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:615:85: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:660:57: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:664:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:704:90: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:707:90: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:710:35: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:715:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:754:51: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:757:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:768:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:772:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:775:85: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:786:87: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:791:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:802:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:820:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:828:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:839:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:842:35: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:858:51: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:862:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:873:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:886:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:889:85: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:900:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:913:85: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:928:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:931:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:947:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:956:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:979:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:993:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:999:7: D101 Missing docstring in public class
+packages\core\src\repowise\core\persistence\models.py:1004:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:1012:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:1018:7: D101 Missing docstring in public class
+packages\core\src\repowise\core\persistence\models.py:1023:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:1030:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:1055:86: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:1061:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\models.py:1064:85: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\search.py:22:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncEngine` into a type-checking block
+packages\core\src\repowise\core\persistence\search.py:127:6: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\search.py:139:5: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\search.py:162:9: D107 Missing docstring in `__init__`
+packages\core\src\repowise\core\persistence\search.py:178:72: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\search.py:179:22: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\search.py:187:101: E501 Line too long (103 > 100)
+packages\core\src\repowise\core\persistence\search.py:188:28: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\search.py:189:22: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\search.py:204:58: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\search.py:233:30: S608 Possible SQL injection vector through string-based query construction
+packages\core\src\repowise\core\persistence\search.py:261:9: D413 [*] Missing blank line after last section ("Returns")
+packages\core\src\repowise\core\persistence\search.py:282:33: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\search.py:302:21: S608 Possible SQL injection vector through string-based query construction
+packages\core\src\repowise\core\persistence\search.py:303:52: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\search.py:322:18: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\search.py:333:101: E501 Line too long (101 > 100)
+packages\core\src\repowise\core\persistence\search.py:337:101: E501 Line too long (102 > 100)
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:9:22: TC003 Move standard library import `datetime.datetime` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:12:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:15:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:17:5: TC001 Move application import `..models.CoverageFile` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:18:5: TC001 Move application import `..models.DeadCodeFinding` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:19:5: TC001 Move application import `..models.DecisionRecord` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:20:5: TC001 Move application import `..models.GitMetadata` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:21:5: TC001 Move application import `..models.HealthFileMetric` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:22:5: TC001 Move application import `..models.HealthFinding` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:23:5: TC001 Move application import `..models.HealthSnapshot` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:33:70: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:43:49: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:48:56: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:51:53: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:55:33: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:60:60: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:63:56: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:70:55: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:91:68: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:94:52: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:100:47: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:104:56: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:111:15: PLR0913 Too many arguments in function definition (8 > 5)
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:157:76: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:161:43: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**fields`
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:161:46: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:169:64: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:172:55: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:176:57: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:179:52: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:186:54: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:191:53: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:203:74: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:207:53: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:230:73: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:233:64: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:240:43: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:243:46: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:246:15: PLR0913 Too many arguments in function definition (7 > 5)
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:269:62: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:272:54: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_analysis.py:298:64: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:9:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:11:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:12:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:13:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:13:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:13:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:13:22: TC001 Move application import `..models.ExternalSystem` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:13:38: TC001 Move application import `..models.GraphEdge` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:13:49: TC001 Move application import `..models.GraphNode` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:22:52: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:27:52: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:32:47: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:55:54: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:58:51: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:81:52: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:84:55: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:95:75: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:99:47: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:102:50: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:106:54: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:109:50: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:113:61: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:116:53: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:120:33: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_graph_records.py:125:48: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:11:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:13:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:15:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:15:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:15:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:15:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:15:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:15:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:15:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:16:5: TC001 Move application import `..models.ChatMessage` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:17:5: TC001 Move application import `..models.Conversation` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:18:5: TC001 Move application import `..models.GenerationJob` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:19:5: TC001 Move application import `..models.Page` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:20:5: TC001 Move application import `..models.PageVersion` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:21:5: TC001 Move application import `..models.Repository` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:22:5: TC001 Move application import `..models.WebhookEvent` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:61:15: PLR0913 Too many arguments in function definition (7 > 5)
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:86:15: PLR0913 Too many arguments in function definition (7 > 5)
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:108:43: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:112:57: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:115:57: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:121:15: PLR0913 Too many arguments in function definition (6 > 5)
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:142:47: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:171:58: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:176:69: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:179:68: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:186:53: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:191:47: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:194:50: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\_sql_meta.py:204:64: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:28:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:34:9: D107 Missing docstring in `__init__`
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:55:9: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:55:47: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**attrs`
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:59:9: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:59:59: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**attrs`
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:63:9: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:66:9: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:69:9: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:74:9: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:83:9: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:91:9: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:94:9: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:97:9: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:102:9: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:112:57: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:114:15: TRY003 Avoid specifying long messages outside the exception class
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:114:26: EM102 Exception must not use an f-string literal, assign to variable first
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:120:9: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:129:9: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:138:9: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:145:17: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\stores\in_process_graph_store.py:148:65: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\sql_index_store.py:17:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\sql_index_store.py:19:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\sql_index_store.py:33:9: D107 Missing docstring in `__init__`
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:14:36: TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:16:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:17:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:17:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:42:9: D107 Missing docstring in `__init__`
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:45:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:65:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:69:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:79:19: TRY003 Avoid specifying long messages outside the exception class
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:79:31: EM102 Exception must not use an f-string literal, assign to variable first
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:89:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:92:19: TRY003 Avoid specifying long messages outside the exception class
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:92:31: EM102 Exception must not use an f-string literal, assign to variable first
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:98:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:99:50: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:103:65: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:104:14: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\stores\sql_job_store.py:112:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\_base.py:14:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\vector_store\_base.py:14:22: TC001 Move application import `..search.SearchResult` into a type-checking block
+packages\core\src\repowise\core\persistence\vector_store\_base.py:56:50: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\_base.py:58:9: D205 1 blank line required between summary line and description
+packages\core\src\repowise\core\persistence\vector_store\_base.py:68:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\vector_store\_base.py:73:84: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\_base.py:95:46: ARG002 Unused method argument: `path`
+packages\core\src\repowise\core\persistence\vector_store\_base.py:113:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\vector_store\_base.py:122:17: PERF403 Use a dictionary comprehension instead of a for-loop
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:5:52: TC001 Move application import `repowise.core.providers.embedding.base.Embedder` into a type-checking block
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:7:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:20:9: D107 Missing docstring in `__init__`
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:25:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:29:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:57:18: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:61:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:68:50: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:78:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:81:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:84:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:94:32: PERF102 When using only the values of a dict use the `values()` method
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:102:9: D205 1 blank line required between summary line and description
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:109:32: PERF102 When using only the values of a dict use the `values()` method
+packages\core\src\repowise\core\persistence\vector_store\in_memory.py:121:9: D105 Missing docstring in magic method
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:5:52: TC001 Move application import `repowise.core.providers.embedding.base.Embedder` into a type-checking block
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:7:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:37:9: D107 Missing docstring in `__init__`
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:48:13: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:50:19: TRY003 Avoid specifying long messages outside the exception class
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:51:17: EM101 Exception must not use a string literal, assign to variable first
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:51:95: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:62:30: ANN001 Missing type annotation for function argument `schema`
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:88:13: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:90:19: TRY003 Avoid specifying long messages outside the exception class
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:91:17: EM101 Exception must not use a string literal, assign to variable first
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:92:62: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:113:14: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:116:59: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:147:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:155:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:192:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:201:50: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:214:20: BLE001 Do not catch blind exception: `Exception`
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:218:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:224:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:228:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:255:16: BLE001 Do not catch blind exception: `Exception`
+packages\core\src\repowise\core\persistence\vector_store\lancedb_store.py:283:16: BLE001 Do not catch blind exception: `Exception`
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:7:52: TC001 Move application import `repowise.core.providers.embedding.base.Embedder` into a type-checking block
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:9:1: TID252 Prefer absolute imports over relative imports from parent modules
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:29:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:52:9: D107 Missing docstring in `__init__`
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:60:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:60:63: ARG002 Unused method argument: `metadata`
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:64:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:69:93: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:75:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:85:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:88:85: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:96:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:100:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:110:33: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:130:50: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:137:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:145:25: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:152:66: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:155:24: BLE001 Do not catch blind exception: `Exception`
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:170:22: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:174:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:175:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:184:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:187:15: D102 Missing docstring in public method
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:188:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:192:81: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:203:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:210:30: COM812 [*] Trailing comma missing
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:231:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:232:9: PLC0415 `import` should be at the top-level of a file
+packages\core\src\repowise\core\persistence\vector_store\pgvector_store.py:236:42: COM812 [*] Trailing comma missing
+Found 671 errors.
+[*] 305 fixable with the `--fix` option (174 hidden fixes can be enabled with the `--unsafe-fixes` option).
diff --git a/tests/fixtures/distill/ruff_check_full.txt b/tests/fixtures/distill/ruff_check_full.txt
new file mode 100644
index 000000000..b5e1b4e4a
--- /dev/null
+++ b/tests/fixtures/distill/ruff_check_full.txt
@@ -0,0 +1,756 @@
+I001 [*] Import block is un-sorted or un-formatted
+ --> packages\core\src\repowise\core\persistence\coordinator.py:33:1
+ |
+31 | to avoid triggering a full ``build()`` call.
+32 | """
+33 | / from __future__ import annotations
+34 | |
+35 | | import asyncio
+36 | | from contextlib import asynccontextmanager
+37 | | from dataclasses import dataclass, field
+38 | | from typing import Any, AsyncIterator
+39 | | import structlog
+ | |________________^
+40 |
+41 | log = structlog.get_logger(__name__)
+ |
+help: Organize imports
+
+UP035 [*] Import from `collections.abc` instead: `AsyncIterator`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:38:1
+ |
+36 | from contextlib import asynccontextmanager
+37 | from dataclasses import dataclass, field
+38 | from typing import Any, AsyncIterator
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+39 | import structlog
+ |
+help: Import from `collections.abc`
+
+ANN401 Dynamically typed expressions (typing.Any) are disallowed in `obj`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:51:28
+ |
+49 | pending_vectors: list[tuple[str, dict]] = field(default_factory=list) # (id, record)
+50 |
+51 | def add_sql(self, obj: Any) -> None:
+ | ^^^
+52 | self.pending_sql_objects.append(obj)
+ |
+
+D101 Missing docstring in public class
+ --> packages\core\src\repowise\core\persistence\coordinator.py:69:7
+ |
+69 | class AtomicStorageCoordinator:
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+70 | def __init__(self, session, graph_builder=None, vector_store=None) -> None:
+71 | self._session = session
+ |
+
+D107 Missing docstring in `__init__`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:70:9
+ |
+69 | class AtomicStorageCoordinator:
+70 | def __init__(self, session, graph_builder=None, vector_store=None) -> None:
+ | ^^^^^^^^
+71 | self._session = session
+72 | self._graph_builder = graph_builder
+ |
+
+ANN001 Missing type annotation for function argument `session`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:70:24
+ |
+69 | class AtomicStorageCoordinator:
+70 | def __init__(self, session, graph_builder=None, vector_store=None) -> None:
+ | ^^^^^^^
+71 | self._session = session
+72 | self._graph_builder = graph_builder
+ |
+
+ANN001 Missing type annotation for function argument `graph_builder`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:70:33
+ |
+69 | class AtomicStorageCoordinator:
+70 | def __init__(self, session, graph_builder=None, vector_store=None) -> None:
+ | ^^^^^^^^^^^^^
+71 | self._session = session
+72 | self._graph_builder = graph_builder
+ |
+
+ANN001 Missing type annotation for function argument `vector_store`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:70:53
+ |
+69 | class AtomicStorageCoordinator:
+70 | def __init__(self, session, graph_builder=None, vector_store=None) -> None:
+ | ^^^^^^^^^^^^
+71 | self._session = session
+72 | self._graph_builder = graph_builder
+ |
+
+C901 `transaction` is too complex (21 > 10)
+ --> packages\core\src\repowise\core\persistence\coordinator.py:77:15
+ |
+76 | @asynccontextmanager
+77 | async def transaction(self) -> AsyncIterator[_PendingTransaction]:
+ | ^^^^^^^^^^^
+78 | txn = _PendingTransaction()
+79 | applied_nodes: list[str] = []
+ |
+
+PLR0912 Too many branches (20 > 12)
+ --> packages\core\src\repowise\core\persistence\coordinator.py:77:15
+ |
+76 | @asynccontextmanager
+77 | async def transaction(self) -> AsyncIterator[_PendingTransaction]:
+ | ^^^^^^^^^^^
+78 | txn = _PendingTransaction()
+79 | applied_nodes: list[str] = []
+ |
+
+D102 Missing docstring in public method
+ --> packages\core\src\repowise\core\persistence\coordinator.py:77:15
+ |
+76 | @asynccontextmanager
+77 | async def transaction(self) -> AsyncIterator[_PendingTransaction]:
+ | ^^^^^^^^^^^
+78 | txn = _PendingTransaction()
+79 | applied_nodes: list[str] = []
+ |
+
+BLE001 Do not catch blind exception: `Exception`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:126:24
+ |
+124 | try:
+125 | await self._session.rollback()
+126 | except Exception as e2:
+ | ^^^^^^^^^
+127 | log.error("sql_rollback_failed", error=str(e2))
+128 | # Graph rollback
+ |
+
+TRY400 Use `logging.exception` instead of `logging.error`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:127:21
+ |
+125 | await self._session.rollback()
+126 | except Exception as e2:
+127 | log.error("sql_rollback_failed", error=str(e2))
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+128 | # Graph rollback
+129 | if self._graph_builder is not None:
+ |
+help: Replace with `exception`
+
+BLE001 Do not catch blind exception: `Exception`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:143:32
+ |
+141 | try:
+142 | await _vector_delete(self._vector_store, vid)
+143 | except Exception as e2:
+ | ^^^^^^^^^
+144 | log.error("vector_rollback_failed", id=vid, error=str(e2))
+145 | raise
+ |
+
+TRY400 Use `logging.exception` instead of `logging.error`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:144:29
+ |
+142 | await _vector_delete(self._vector_store, vid)
+143 | except Exception as e2:
+144 | log.error("vector_rollback_failed", id=vid, error=str(e2))
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+145 | raise
+ |
+help: Replace with `exception`
+
+PLC0415 `import` should be at the top-level of a file
+ --> packages\core\src\repowise\core\persistence\coordinator.py:149:9
+ |
+147 | async def health_check(self) -> dict:
+148 | """Compare counts across stores. Returns drift report."""
+149 | from sqlalchemy import text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+150 | report: dict = {"sql_pages": None, "vector_count": None, "graph_nodes": None, "drift": None}
+151 | try:
+ |
+
+BLE001 Do not catch blind exception: `Exception`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:154:16
+ |
+152 | res = await self._session.execute(text("SELECT COUNT(*) FROM wiki_pages"))
+153 | report["sql_pages"] = int(res.scalar() or 0)
+154 | except Exception as e:
+ | ^^^^^^^^^
+155 | report["sql_pages_error"] = str(e)
+156 | if self._graph_builder is not None:
+ |
+
+BLE001 Do not catch blind exception: `Exception`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:164:20
+ |
+162 | res = await self._session.execute(text("SELECT COUNT(*) FROM graph_nodes"))
+163 | report["graph_nodes"] = int(res.scalar() or 0)
+164 | except Exception as e:
+ | ^^^^^^^^^
+165 | report["graph_nodes_error"] = str(e)
+166 | if self._vector_store is not None:
+ |
+
+BLE001 Do not catch blind exception: `Exception`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:169:20
+ |
+167 | try:
+168 | report["vector_count"] = await _vector_count(self._vector_store)
+169 | except Exception as e:
+ | ^^^^^^^^^
+170 | report["vector_count_error"] = str(e)
+171 | # Compute drift between SQL and vector if both available
+ |
+
+ANN001 Missing type annotation for function argument `store`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:188:26
+ |
+186 | # ---------------------------------------------------------------------------
+187 |
+188 | async def _vector_upsert(store, vid: str, record: dict) -> None:
+ | ^^^^^
+189 | """Call embed_and_upsert on the store.
+ |
+
+TRY003 Avoid specifying long messages outside the exception class
+ --> packages\core\src\repowise\core\persistence\coordinator.py:196:15
+ |
+194 | text = record.get("text")
+195 | if text is None:
+196 | raise ValueError(
+ | _______________^
+197 | | f"_vector_upsert: record for '{vid}' is missing required 'text' key. "
+198 | | f"Keys present: {list(record.keys())}"
+199 | | )
+ | |_________^
+200 | metadata = {k: v for k, v in record.items() if k != "text"}
+201 | await store.embed_and_upsert(vid, text, metadata)
+ |
+
+EM102 Exception must not use an f-string literal, assign to variable first
+ --> packages\core\src\repowise\core\persistence\coordinator.py:197:13
+ |
+195 | if text is None:
+196 | raise ValueError(
+197 | / f"_vector_upsert: record for '{vid}' is missing required 'text' key. "
+198 | | f"Keys present: {list(record.keys())}"
+ | |__________________________________________________^
+199 | )
+200 | metadata = {k: v for k, v in record.items() if k != "text"}
+ |
+help: Assign to variable; remove f-string literal
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\coordinator.py:198:51
+ |
+196 | raise ValueError(
+197 | f"_vector_upsert: record for '{vid}' is missing required 'text' key. "
+198 | f"Keys present: {list(record.keys())}"
+ | ^
+199 | )
+200 | metadata = {k: v for k, v in record.items() if k != "text"}
+ |
+help: Add trailing comma
+
+ANN001 Missing type annotation for function argument `store`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:204:26
+ |
+204 | async def _vector_delete(store, vid: str) -> None:
+ | ^^^^^
+205 | """Call delete(page_id) on the store."""
+206 | await store.delete(vid)
+ |
+
+ANN001 Missing type annotation for function argument `store`
+ --> packages\core\src\repowise\core\persistence\coordinator.py:209:25
+ |
+209 | async def _vector_count(store) -> int:
+ | ^^^^^
+210 | """Return the number of vectors in the store.
+ |
+
+TC003 Move standard library import `collections.abc.AsyncGenerator` into a type-checking block
+ --> packages\core\src\repowise\core\persistence\database.py:15:29
+ |
+14 | import os
+15 | from collections.abc import AsyncGenerator
+ | ^^^^^^^^^^^^^^
+16 | from contextlib import asynccontextmanager
+17 | from pathlib import Path
+ |
+help: Move into type-checking block
+
+ANN202 Missing return type annotation for private function `_make_pragma_listener`
+ --> packages\core\src\repowise\core\persistence\database.py:54:5
+ |
+54 | def _make_pragma_listener(busy_timeout_ms: int):
+ | ^^^^^^^^^^^^^^^^^^^^^
+55 | """Build a ``connect`` event listener that applies our SQLite pragmas.
+ |
+help: Add return type annotation
+
+PIE810 Call `startswith` once with a `tuple`
+ --> packages\core\src\repowise\core\persistence\database.py:141:8
+ |
+139 | return url.replace("sqlite://", "sqlite+aiosqlite://", 1)
+140 |
+141 | if url.startswith("postgresql://") or url.startswith("postgres://"):
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+142 | return url.replace("://", "+asyncpg://", 1)
+ |
+help: Merge into a single `startswith` call
+
+D413 [*] Missing blank line after last section ("Args")
+ --> packages\core\src\repowise\core\persistence\database.py:182:5
+ |
+180 | """Create an AsyncEngine for the given database URL.
+181 |
+182 | Args:
+ | ^^^^
+183 | url: Raw or async-prefixed database URL. Defaults to SQLite.
+184 | echo: Log all SQL statements (useful for debugging).
+ |
+help: Add blank line after "Args"
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\database.py:349:76
+ |
+347 | column_ddl = _add_column_ddl(column, dialect)
+348 | connection.execute( # type: ignore[attr-defined]
+349 | text(f'ALTER TABLE "{table.name}" ADD COLUMN {column_ddl}')
+ | ^
+350 | )
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\database.py:384:68
+ |
+382 | text(
+383 | "CREATE VIRTUAL TABLE IF NOT EXISTS page_fts "
+384 | "USING fts5(page_id UNINDEXED, title, content)"
+ | ^
+385 | )
+386 | )
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\database.py:385:18
+ |
+383 | "CREATE VIRTUAL TABLE IF NOT EXISTS page_fts "
+384 | "USING fts5(page_id UNINDEXED, title, content)"
+385 | )
+ | ^
+386 | )
+ |
+help: Add trailing comma
+
+TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncSession` into a type-checking block
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:22:36
+ |
+21 | from sqlalchemy import delete, select
+22 | from sqlalchemy.ext.asyncio import AsyncSession
+ | ^^^^^^^^^^^^
+23 |
+24 | from .models import DecisionEdge, DecisionNodeLink, DecisionRecord
+ |
+help: Move into type-checking block
+
+PLR0913 Too many arguments in function definition (7 > 5)
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:52:11
+ |
+52 | async def upsert_decision_edge(
+ | ^^^^^^^^^^^^^^^^^^^^
+53 | session: AsyncSession,
+54 | *,
+ |
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:80:14
+ |
+78 | DecisionEdge.dst_decision_id == dst_decision_id,
+79 | DecisionEdge.kind == kind,
+80 | )
+ | ^
+81 | )
+82 | ).scalar_one_or_none()
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:125:60
+ |
+123 | clauses.append(
+124 | (DecisionEdge.src_decision_id == decision_id)
+125 | | (DecisionEdge.dst_decision_id == decision_id)
+ | ^
+126 | )
+127 | q = select(DecisionEdge).where(*clauses)
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:141:18
+ |
+139 | DecisionEdge.repository_id == repository_id,
+140 | DecisionEdge.kind == "conflicts_with",
+141 | )
+ | ^
+142 | )
+143 | )
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:145:15
+ |
+143 | )
+144 | .scalars()
+145 | .all()
+ | ^
+146 | )
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:169:84
+ |
+167 | """
+168 | await session.execute(
+169 | delete(DecisionNodeLink).where(DecisionNodeLink.decision_id == decision_id)
+ | ^
+170 | )
+171 | seen: set[tuple[str, str]] = set()
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:183:14
+ |
+181 | node_id=node_id,
+182 | link_type="file",
+183 | )
+ | ^
+184 | )
+185 | for node_id in modules or []:
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:196:14
+ |
+194 | node_id=node_id,
+195 | link_type="module",
+196 | )
+ | ^
+197 | )
+198 | await session.flush()
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:214:14
+ |
+212 | DecisionNodeLink.repository_id == repository_id,
+213 | DecisionNodeLink.node_id == node_id,
+214 | )
+ | ^
+215 | )
+216 | ).scalars()
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:228:92
+ |
+226 | (
+227 | await session.execute(
+228 | select(DecisionNodeLink).where(DecisionNodeLink.decision_id == decision_id)
+ | ^
+229 | )
+230 | )
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:232:15
+ |
+230 | )
+231 | .scalars()
+232 | .all()
+ | ^
+233 | )
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:302:14
+ |
+300 | # how the *newer* decision related to this one (None for the leaf)
+301 | "relation": kind,
+302 | }
+ | ^
+303 | )
+304 | return chain
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:325:88
+ |
+323 | (
+324 | await session.execute(
+325 | select(DecisionEdge).where(DecisionEdge.repository_id == repository_id)
+ | ^
+326 | )
+327 | )
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:329:15
+ |
+327 | )
+328 | .scalars()
+329 | .all()
+ | ^
+330 | )
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:345:96
+ |
+343 | (
+344 | await session.execute(
+345 | select(DecisionNodeLink).where(DecisionNodeLink.repository_id == repository_id)
+ | ^
+346 | )
+347 | )
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\decision_graph.py:349:15
+ |
+347 | )
+348 | .scalars()
+349 | .all()
+ | ^
+350 | )
+ |
+help: Add trailing comma
+
+TC002 Move third-party import `sqlalchemy.ext.asyncio.AsyncEngine` into a type-checking block
+ --> packages\core\src\repowise\core\persistence\search.py:22:36
+ |
+20 | from typing import Literal
+21 |
+22 | from sqlalchemy.ext.asyncio import AsyncEngine
+ | ^^^^^^^^^^^
+23 | from sqlalchemy.sql import text
+ |
+help: Move into type-checking block
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\search.py:127:6
+ |
+125 | "too",
+126 | "only",
+127 | }
+ | ^
+128 | )
+ |
+help: Add trailing comma
+
+PLC0415 `import` should be at the top-level of a file
+ --> packages\core\src\repowise\core\persistence\search.py:139:5
+ |
+137 | Falls back to the raw (quoted) query when all tokens are stop words.
+138 | """
+139 | import re
+ | ^^^^^^^^^
+140 |
+141 | # Keep only alphanumeric tokens
+ |
+
+D107 Missing docstring in `__init__`
+ --> packages\core\src\repowise\core\persistence\search.py:162:9
+ |
+160 | """Full-text search backed by SQLite FTS5 or PostgreSQL tsvector."""
+161 |
+162 | def __init__(self, engine: AsyncEngine) -> None:
+ | ^^^^^^^^
+163 | self._engine = engine
+164 | self._dialect = engine.dialect.name # "sqlite" or "postgresql"
+ |
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\search.py:178:72
+ |
+176 | text(
+177 | "CREATE VIRTUAL TABLE IF NOT EXISTS page_fts "
+178 | "USING fts5(page_id UNINDEXED, title, content)"
+ | ^
+179 | )
+180 | )
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\search.py:179:22
+ |
+177 | "CREATE VIRTUAL TABLE IF NOT EXISTS page_fts "
+178 | "USING fts5(page_id UNINDEXED, title, content)"
+179 | )
+ | ^
+180 | )
+181 | elif self._dialect == "postgresql":
+ |
+help: Add trailing comma
+
+E501 Line too long (103 > 100)
+ --> packages\core\src\repowise\core\persistence\search.py:187:101
+ |
+185 | "CREATE INDEX IF NOT EXISTS idx_wiki_pages_fts "
+186 | "ON wiki_pages USING GIN("
+187 | " to_tsvector('english', COALESCE(title, '') || ' ' || COALESCE(content, ''))"
+ | ^^^
+188 | ")"
+189 | )
+ |
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\search.py:188:28
+ |
+186 | "ON wiki_pages USING GIN("
+187 | " to_tsvector('english', COALESCE(title, '') || ' ' || COALESCE(content, ''))"
+188 | ")"
+ | ^
+189 | )
+190 | )
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\search.py:189:22
+ |
+187 | " to_tsvector('english', COALESCE(title, '') || ' ' || COALESCE(content, ''))"
+188 | ")"
+189 | )
+ | ^
+190 | )
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\search.py:204:58
+ |
+202 | text(
+203 | "INSERT INTO page_fts(page_id, title, content) "
+204 | "VALUES (:pid, :title, :content)"
+ | ^
+205 | ),
+206 | {"pid": page_id, "title": title, "content": content},
+ |
+help: Add trailing comma
+
+S608 Possible SQL injection vector through string-based query construction
+ --> packages\core\src\repowise\core\persistence\search.py:233:30
+ |
+231 | params = {f"p{i}": pid for i, pid in enumerate(chunk)}
+232 | await conn.execute(
+233 | text(f"DELETE FROM page_fts WHERE page_id IN ({placeholders})"),
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+234 | params,
+235 | )
+ |
+
+D413 [*] Missing blank line after last section ("Returns")
+ --> packages\core\src\repowise\core\persistence\search.py:261:9
+ |
+259 | limit: Maximum number of results to return.
+260 |
+261 | Returns:
+ | ^^^^^^^
+262 | List of SearchResult objects sorted by relevance (descending).
+263 | """
+ |
+help: Add blank line after "Returns"
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\search.py:282:33
+ |
+280 | "WHERE page_fts MATCH :q "
+281 | "ORDER BY rank "
+282 | "LIMIT :lim"
+ | ^
+283 | ),
+284 | {"q": fts_query, "lim": limit},
+ |
+help: Add trailing comma
+
+S608 Possible SQL injection vector through string-based query construction
+ --> packages\core\src\repowise\core\persistence\search.py:302:21
+ |
+300 | page_rows = await conn.execute(
+301 | text(
+302 | / f"SELECT id, page_type, target_path FROM wiki_pages "
+303 | | f"WHERE id IN ({placeholders})"
+ | |___________________________________________________^
+304 | ),
+305 | params,
+ |
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\search.py:303:52
+ |
+301 | text(
+302 | f"SELECT id, page_type, target_path FROM wiki_pages "
+303 | f"WHERE id IN ({placeholders})"
+ | ^
+304 | ),
+305 | params,
+ |
+help: Add trailing comma
+
+COM812 [*] Trailing comma missing
+ --> packages\core\src\repowise\core\persistence\search.py:322:18
+ |
+320 | snippet=_snippet(content_by_id[pid]),
+321 | search_type="fulltext",
+322 | )
+ | ^
+323 | )
+324 | return results
+ |
+help: Add trailing comma
+
+E501 Line too long (101 > 100)
+ --> packages\core\src\repowise\core\persistence\search.py:333:101
+ |
+331 | "SELECT id, title, content, page_type, target_path, "
+332 | " ts_rank("
+333 | " to_tsvector('english', COALESCE(title,'') || ' ' || COALESCE(content,'')), "
+ | ^
+334 | " plainto_tsquery('english', :q)"
+335 | " ) AS rank "
+ |
+
+E501 Line too long (102 > 100)
+ --> packages\core\src\repowise\core\persistence\search.py:337:101
+ |
+335 | " ) AS rank "
+336 | "FROM wiki_pages "
+337 | "WHERE to_tsvector('english', COALESCE(title,'') || ' ' || COALESCE(content,'')) "
+ | ^^
+338 | " @@ plainto_tsquery('english', :q) "
+339 | "ORDER BY rank DESC "
+ |
+
+Found 67 errors.
+[*] 32 fixable with the `--fix` option (7 hidden fixes can be enabled with the `--unsafe-fixes` option).
diff --git a/tests/unit/distill/test_cli.py b/tests/unit/distill/test_cli.py
index 9e413e9ac..b22a8f7b7 100644
--- a/tests/unit/distill/test_cli.py
+++ b/tests/unit/distill/test_cli.py
@@ -104,6 +104,28 @@ def test_expand_invalid_ref_fails_cleanly(repo_cwd: Path) -> None:
assert result.exit_code == 2
+def test_distill_source_flag_tags_the_ledger(repo_cwd: Path) -> None:
+ """The hook's --source tag flows into the ledger for `saved --by source`."""
+ runner = CliRunner()
+ noisy = "import sys; sys.stdout.write('x.py:1:1: E501 line too long\\n' * 80)"
+ result = runner.invoke(distill_command, ["--source", "hook-powershell", *_py(noisy)])
+ assert result.exit_code == 0
+ store = OmissionStore(repo_cwd / ".repowise" / "omissions" / "omissions.db")
+ rows = store.savings_rollup(by="source")
+ store.close()
+ assert [r["group"] for r in rows] == ["hook-powershell"]
+
+
+def test_distill_does_not_eat_the_wrapped_commands_source_flag(repo_cwd: Path) -> None:
+ """--source after the command belongs to the command, not to distill."""
+ result = CliRunner().invoke(
+ distill_command,
+ _py("import sys; print(sys.argv[1:])") + ["--source", "mine"],
+ )
+ assert result.exit_code == 0
+ assert "['--source', 'mine']" in result.output
+
+
def test_distill_records_savings_ledger(repo_cwd: Path, fixtures_dir: Path) -> None:
fixture = fixtures_dir / "distill" / "find_paths.txt"
raw = fixture.read_text(encoding="utf-8-sig")
diff --git a/tests/unit/distill/test_filters.py b/tests/unit/distill/test_filters.py
index 8e9f95d23..2f6649423 100644
--- a/tests/unit/distill/test_filters.py
+++ b/tests/unit/distill/test_filters.py
@@ -13,6 +13,7 @@ Two invariants run across the board:
from __future__ import annotations
+import re
import statistics
import pytest
@@ -142,6 +143,101 @@ def test_tsc_all_error_output_is_kept_whole(load_fixture) -> None:
assert "Found 6 errors in 4 files." in distilled
+# -- lint_output ---------------------------------------------------------------
+
+#: (fixture, command) pairs for the lint savings bench. ruff fixtures are real
+#: output from this repo (`--select ALL` over core/persistence); eslint is real
+#: output from packages/web; clippy/golangci/mypy are format-faithful samples
+#: for toolchains not installed here. eslint and mypy are error-heavy by
+#: construction — they participate in the median as the all-signal end.
+LINT_BENCH_CASES = [
+ ("ruff_check_full.txt", "ruff check packages"),
+ ("ruff_check_concise.txt", "ruff check --output-format=concise packages"),
+ ("eslint_fail.txt", "npm run lint"),
+ ("clippy_warnings.txt", "cargo clippy"),
+ ("golangci_lint.txt", "golangci-lint run ./..."),
+ ("mypy_errors.txt", "mypy packages"),
+]
+
+
[email protected](("fixture", "command"), LINT_BENCH_CASES)
+def test_lint_no_error_line_lost(load_fixture, fixture, command) -> None:
+ raw, distilled = _distill(load_fixture, fixture, "lint_output", command)
+ _assert_no_error_line_lost(raw, distilled)
+
+
+def test_lint_bench_median_savings_at_least_60pct(load_fixture) -> None:
+ """Exit criterion: >=60% median token reduction across the lint fixtures."""
+ pcts = []
+ for fixture, command in LINT_BENCH_CASES:
+ raw, distilled = _distill(load_fixture, fixture, "lint_output", command)
+ pcts.append(_pct(raw, distilled))
+ assert statistics.median(pcts) >= 60.0, f"median savings {pcts}"
+
+
+def test_ruff_full_groups_by_rule_and_keeps_summary(load_fixture) -> None:
+ raw, distilled = _distill(load_fixture, "ruff_check_full.txt", "lint_output", "ruff check")
+ # Rule groups carry counts and file:line anchors.
+ assert re.search(r"D\d{3} ×\d+", distilled) # noqa: RUF001
+ assert re.search(r"coordinator\.py:\d+", distilled)
+ # The tool's own totals and fixable summary survive verbatim.
+ assert re.search(r"^Found \d+ errors\.$", distilled, re.MULTILINE)
+ assert "fixable with the `--fix` option" in distilled
+ assert _pct(raw, distilled) >= 75.0
+
+
+def test_ruff_concise_groups_by_rule(load_fixture) -> None:
+ raw, distilled = _distill(load_fixture, "ruff_check_concise.txt", "lint_output", "ruff check")
+ assert re.search(r"[A-Z]+\d+ ×\d+, \d+ fixable", distilled) # noqa: RUF001
+ assert _pct(raw, distilled) >= 70.0
+
+
+def test_eslint_errors_verbatim_warnings_grouped(load_fixture) -> None:
+ raw, distilled = _distill(load_fixture, "eslint_fail.txt", "lint_output", "npm run lint")
+ # Every error row survives verbatim (the hooks error among them).
+ assert 'React Hook "useEffect" is called conditionally' in distilled
+ # Identical repeated error rows collapse to one annotated copy.
+ assert distilled.count("no-html-link-for-pages") < raw.count("no-html-link-for-pages")
+ assert "(×5)" in distilled # noqa: RUF001
+ # Warnings are grouped by rule.
+ assert re.search(r"@next/next/no-img-element ×\d+", distilled) # noqa: RUF001
+ # The problems summary survives.
+ assert "✖ 19 problems (9 errors, 10 warnings)" in distilled
+
+
+def test_clippy_error_block_survives_warnings_group(load_fixture) -> None:
+ raw, distilled = _distill(load_fixture, "clippy_warnings.txt", "lint_output", "cargo clippy")
+ # The compile error block is verbatim, frame included.
+ assert "error[E0308]: mismatched types" in distilled
+ assert "expected `usize`, found `Option<usize>`" in distilled
+ # Warning blocks collapse into clippy rule groups.
+ assert re.search(r"clippy::redundant_clone ×\d+", distilled) # noqa: RUF001
+ assert "error: could not compile `gitscan`" in distilled
+ assert _pct(raw, distilled) >= 60.0
+
+
+def test_golangci_errcheck_lines_survive(load_fixture) -> None:
+ raw, distilled = _distill(load_fixture, "golangci_lint.txt", "lint_output", "golangci-lint run")
+ # Error-classified messages survive verbatim, not as a lossy group.
+ for line in raw.splitlines():
+ if "Error return value" in line:
+ assert line in distilled
+ assert re.search(r"wsl ×8", distilled) # noqa: RUF001
+
+
+def test_mypy_all_signal_output_keeps_every_error(load_fixture) -> None:
+ """mypy output is mostly errors — nothing to win, nothing to lose."""
+ raw, distilled = _distill(load_fixture, "mypy_errors.txt", "lint_output", "mypy packages")
+ _assert_no_error_line_lost(raw, distilled)
+ assert "Found 7 errors in 3 files" in distilled
+
+
+def test_lint_unrecognized_raises() -> None:
+ f = filter_registry.get("lint_output")
+ with pytest.raises(ValueError, match="lint"):
+ f.distill("random text\n" * 50, command="npm run lint")
+
+
# -- git family -------------------------------------------------------------------
@@ -233,11 +329,12 @@ def test_logs_collapse_templates_keep_errors(load_fixture) -> None:
# -- registry/meta -----------------------------------------------------------------
-def test_all_seven_filters_registered() -> None:
+def test_all_core_filters_registered() -> None:
names = {f.name for f in filter_registry.filters()}
assert names >= {
"test_output",
"build_output",
+ "lint_output",
"git_status",
"git_log",
"git_diff",
diff --git a/tests/unit/distill/test_missed_savings.py b/tests/unit/distill/test_missed_savings.py
new file mode 100644
index 000000000..41346443f
--- /dev/null
+++ b/tests/unit/distill/test_missed_savings.py
@@ -0,0 +1,216 @@
+"""Missed-savings discovery — transcript scan, gates, and the CLI surface.
+
+Transcript lines follow the Claude Code JSONL shape captured from real
+sessions on this machine: assistant entries carry ``message.content[]``
+``tool_use`` blocks plus top-level ``cwd``/``timestamp``; the paired user
+entry carries ``message.content[].tool_result`` and a top-level
+``toolUseResult`` with ``stdout``/``stderr``.
+"""
+
+from __future__ import annotations
+
+import json
+import time
+from datetime import UTC, datetime
+from pathlib import Path
+
+import pytest
+from click.testing import CliRunner
+
+from repowise.cli.commands.saved_cmd import saved_command
+from repowise.core.distill.missed import (
+ RATIO_FLOOR,
+ scan_missed_savings,
+ transcript_dir_for,
+)
+
+NOW = time.time()
+
+
+def _iso(ts: float) -> str:
+ return datetime.fromtimestamp(ts, tz=UTC).strftime("%Y-%m-%dT%H:%M:%S.%fZ")
+
+
+def _tool_pair(
+ command: str,
+ stdout: str,
+ *,
+ cwd: str,
+ tool: str = "Bash",
+ block_id: str = "toolu_01",
+ ts: float = NOW,
+) -> list[dict]:
+ return [
+ {
+ "type": "assistant",
+ "cwd": cwd,
+ "timestamp": _iso(ts),
+ "message": {
+ "role": "assistant",
+ "content": [
+ {
+ "type": "tool_use",
+ "id": block_id,
+ "name": tool,
+ "input": {"command": command},
+ }
+ ],
+ },
+ },
+ {
+ "type": "user",
+ "cwd": cwd,
+ "timestamp": _iso(ts + 1),
+ "message": {
+ "role": "user",
+ "content": [{"type": "tool_result", "tool_use_id": block_id, "content": "..."}],
+ },
+ "toolUseResult": {"stdout": stdout, "stderr": ""},
+ },
+ ]
+
+
+def repo(tmp_path: Path) -> Path:
+ root = tmp_path / "myrepo"
+ (root / ".repowise").mkdir(parents=True)
+ return root
+
+
+def projects(tmp_path: Path, repo: Path) -> Path:
+ """A projects root holding the munged transcript dir for *repo*."""
+ root = tmp_path / "projects"
+ transcript_dir_for(repo, root).mkdir(parents=True)
+ return root
+
+
+def _write_session(projects: Path, repo: Path, entries: list[dict], name: str = "s1") -> Path:
+ path = transcript_dir_for(repo, projects) / f"{name}.jsonl"
+ path.write_text("\n".join(json.dumps(e) for e in entries) + "\n", encoding="utf-8")
+ return path
+
+
+#: A pytest run noisy enough to clear min_lines and the net-positive floor.
+PYTEST_OUT = (
+ "=" * 20 + " test session starts " + "=" * 20 + "\n" + ("tests/test_x.py::t PASSED\n" * 60)
+)
+
+
+def test_transcript_dir_munging() -> None:
+ assert (
+ transcript_dir_for(Path(r"C:\Users\x\Desktop\repo"), Path("/p")).name
+ == "C--Users-x-Desktop-repo"
+ )
+
+
+def test_counts_classifiable_raw_command(repo: Path, projects: Path) -> None:
+ _write_session(projects, repo, _tool_pair("pytest -q", PYTEST_OUT, cwd=str(repo)))
+ report = scan_missed_savings(repo, projects_root=projects, now=NOW + 10)
+ assert report["events"] == 1
+ assert report["per_filter"]["test_output"]["events"] == 1
+ expected = int(report["per_filter"]["test_output"]["raw_tokens"] * RATIO_FLOOR["test_output"])
+ assert report["est_saved_tokens"] == expected
+
+
+def test_powershell_tool_counts_too(repo: Path, projects: Path) -> None:
+ _write_session(
+ projects, repo, _tool_pair("pytest -q", PYTEST_OUT, cwd=str(repo), tool="PowerShell")
+ )
+ report = scan_missed_savings(repo, projects_root=projects, now=NOW + 10)
+ assert report["events"] == 1
+
+
+def test_distill_prefixed_commands_are_not_missed(repo: Path, projects: Path) -> None:
+ _write_session(
+ projects, repo, _tool_pair("repowise distill pytest -q", PYTEST_OUT, cwd=str(repo))
+ )
+ report = scan_missed_savings(repo, projects_root=projects, now=NOW + 10)
+ assert report["events"] == 0
+
+
+def test_unclassifiable_command_skipped(repo: Path, projects: Path) -> None:
+ _write_session(projects, repo, _tool_pair("docker compose up", "y\n" * 80, cwd=str(repo)))
+ report = scan_missed_savings(repo, projects_root=projects, now=NOW + 10)
+ assert report["events"] == 0
+
+
+def test_small_output_below_threshold_skipped(repo: Path, projects: Path) -> None:
+ _write_session(projects, repo, _tool_pair("pytest -q", "ok\n", cwd=str(repo)))
+ report = scan_missed_savings(repo, projects_root=projects, now=NOW + 10)
+ assert report["events"] == 0
+
+
+def test_other_cwd_skipped(repo: Path, projects: Path) -> None:
+ _write_session(projects, repo, _tool_pair("pytest -q", PYTEST_OUT, cwd=r"C:\elsewhere"))
+ report = scan_missed_savings(repo, projects_root=projects, now=NOW + 10)
+ assert report["events"] == 0
+
+
+def test_old_entries_outside_window_skipped(repo: Path, projects: Path) -> None:
+ entries = _tool_pair("pytest -q", PYTEST_OUT, cwd=str(repo), ts=NOW - 10 * 86400)
+ path = _write_session(projects, repo, entries)
+ # Keep the file mtime fresh so only the per-entry timestamp gate applies.
+ import os
+
+ os.utime(path, (NOW, NOW))
+ report = scan_missed_savings(repo, projects_root=projects, days=7, now=NOW)
+ assert report["events"] == 0
+
+
+def test_malformed_lines_and_files_are_tolerated(repo: Path, projects: Path) -> None:
+ good = _tool_pair("pytest -q", PYTEST_OUT, cwd=str(repo))
+ path = transcript_dir_for(repo, projects) / "s1.jsonl"
+ path.write_text(
+ '{"tool_use" broken json "command"\n'
+ + json.dumps(good[0])
+ + "\n"
+ + "not json at all toolUseResult\n"
+ + json.dumps(good[1])
+ + "\n",
+ encoding="utf-8",
+ )
+ report = scan_missed_savings(repo, projects_root=projects, now=NOW + 10)
+ assert report["events"] == 1
+
+
+def test_absent_transcript_dir_is_empty_report(repo: Path, tmp_path: Path) -> None:
+ report = scan_missed_savings(repo, projects_root=tmp_path / "nowhere")
+ assert report == {
+ "events": 0,
+ "raw_tokens": 0,
+ "est_saved_tokens": 0,
+ "per_filter": {},
+ "window_days": 7.0,
+ }
+
+
+def test_ratio_floors_cover_all_registered_filters() -> None:
+ from repowise.core.distill.registry import filter_registry
+
+ assert set(RATIO_FLOOR) == {f.name for f in filter_registry.filters()}
+
+
+# -- CLI surface --------------------------------------------------------------
+
+
+def test_saved_missed_empty_report_message(tmp_path: Path, monkeypatch) -> None:
+ (tmp_path / ".repowise").mkdir()
+ monkeypatch.chdir(tmp_path)
+ result = CliRunner().invoke(saved_command, ["--missed"])
+ assert result.exit_code == 0
+ assert "No missed savings" in result.output
+
+
+def test_saved_missed_table(repo: Path, projects: Path, monkeypatch) -> None:
+ _write_session(projects, repo, _tool_pair("pytest -q", PYTEST_OUT, cwd=str(repo)))
+ monkeypatch.setattr(
+ "repowise.core.distill.missed.transcript_dir_for",
+ lambda root, projects_root=None: transcript_dir_for(root, projects),
+ )
+ result = CliRunner().invoke(saved_command, ["--missed", str(repo)])
+ assert result.exit_code == 0
+ assert "test_output" in result.output
+ assert "Estimated foregone" in result.output
+ flat = " ".join(result.output.split())
+ assert "nothing leaves this machine" in flat
diff --git a/tests/unit/distill/test_rewrite_hook.py b/tests/unit/distill/test_rewrite_hook.py
index dda283121..dca8f0d50 100644
--- a/tests/unit/distill/test_rewrite_hook.py
+++ b/tests/unit/distill/test_rewrite_hook.py
@@ -44,6 +44,15 @@ class TestClassify:
("cargo build --release", "build_output"),
("go vet ./...", "build_output"),
("make", "build_output"),
+ # linters
+ ("npm run lint", "lint_output"),
+ ("eslint src", "lint_output"),
+ ("npx eslint .", "lint_output"),
+ ("ruff check .", "lint_output"),
+ ("flake8 src", "lint_output"),
+ ("mypy packages", "lint_output"),
+ ("cargo clippy", "lint_output"),
+ ("golangci-lint run", "lint_output"),
# git
("git status", "git_status"),
("git log --oneline -20", "git_log"),
@@ -120,6 +129,7 @@ class TestClassify:
# opted-out variants
"git status --porcelain",
"git diff --stat",
+ "ruff format .",
# non-table commands
"docker compose up",
"curl https://example.com",
@@ -178,7 +188,7 @@ class TestDecide:
def test_default_is_ask(self, repo) -> None:
result = decide("pytest -x", str(repo))
assert result is not None
- assert result.command == "repowise distill pytest -x"
+ assert result.command == "repowise distill --source hook-bash pytest -x"
assert result.permission == "ask"
assert "repowise expand" in result.reason
@@ -261,7 +271,7 @@ class TestDecidePowerShell:
def test_shell_neutral_commands_rewrite(self, repo, command) -> None:
result = decide(command, str(repo), shell="powershell")
assert result is not None
- assert result.command == f"repowise distill {command}"
+ assert result.command == f"repowise distill --source hook-powershell {command}"
assert result.permission == "ask"
@@ -301,7 +311,7 @@ class TestMain:
hso = response["hookSpecificOutput"]
assert hso["hookEventName"] == "PreToolUse"
assert hso["permissionDecision"] == "ask"
- assert hso["updatedInput"] == {"command": "repowise distill pytest -x"}
+ assert hso["updatedInput"] == {"command": "repowise distill --source hook-bash pytest -x"}
assert hso["permissionDecisionReason"]
def test_passthrough_emits_nothing(self, monkeypatch, repo) -> None:
@@ -313,7 +323,9 @@ class TestMain:
def test_powershell_tool_rewrites(self, monkeypatch, repo) -> None:
out = _run_main(monkeypatch, _payload("git status", str(repo), tool_name="PowerShell"))
hso = json.loads(out)["hookSpecificOutput"]
- assert hso["updatedInput"] == {"command": "repowise distill git status"}
+ assert hso["updatedInput"] == {
+ "command": "repowise distill --source hook-powershell git status"
+ }
assert hso["permissionDecision"] == "ask"
def test_powershell_alias_passes_through(self, monkeypatch, repo) -> None:
diff --git a/tests/unit/distill/test_rewrite_perf.py b/tests/unit/distill/test_rewrite_perf.py
index c55bb963a..b8ced5cab 100644
--- a/tests/unit/distill/test_rewrite_perf.py
+++ b/tests/unit/distill/test_rewrite_perf.py
@@ -80,7 +80,7 @@ def test_p95_under_100ms(tmp_path: Path) -> None:
result = subprocess.run(cmd, input=payload, capture_output=True, text=True)
timings.append((time.perf_counter() - start) * 1000)
assert result.returncode == 0
- assert "repowise distill pytest -x" in result.stdout
+ assert "repowise distill --source hook-bash pytest -x" in result.stdout
timings.sort()
p95 = timings[int(len(timings) * 0.95) - 1]
diff --git a/tests/unit/distill/test_router.py b/tests/unit/distill/test_router.py
index f406a7ceb..66eed8c5e 100644
--- a/tests/unit/distill/test_router.py
+++ b/tests/unit/distill/test_router.py
@@ -41,7 +41,18 @@ def test_normalize_command(raw: str, expected: str) -> None:
("npm run build", "build_output"),
("tsc --noEmit", "build_output"),
("cargo build --release", "build_output"),
+ ("cargo check", "build_output"),
("npm run type-check", "build_output"),
+ ("npm run lint", "lint_output"),
+ ("eslint src --format stylish", "lint_output"),
+ ("npx eslint .", "lint_output"),
+ ("ruff check packages", "lint_output"),
+ ("uv run ruff check .", "lint_output"),
+ ("flake8 src", "lint_output"),
+ ("mypy packages/core", "lint_output"),
+ ("cargo clippy --workspace", "lint_output"),
+ ("golangci-lint run ./...", "lint_output"),
+ ("biome check src", "lint_output"),
("find . -name *.py", "file_listing"),
("ls -la", "file_listing"),
("tree packages", "file_listing"),
@@ -67,6 +78,7 @@ def test_select_filter_by_command(command: str, filter_name: str) -> None:
"python script.py",
"lsof -i :8000", # 'ls' must not greedily match
"git statuses", # word boundary
+ "ruff format .", # formatter, not a linter
],
)
def test_unrelated_commands_do_not_match(command: str) -> None:
diff --git a/tests/unit/server/test_distill_savings.py b/tests/unit/server/test_distill_savings.py
index 69bc7f777..80430e3f4 100644
--- a/tests/unit/server/test_distill_savings.py
+++ b/tests/unit/server/test_distill_savings.py
@@ -86,3 +86,43 @@ async def test_savings_endpoint_since_filter(client: AsyncClient, tmp_path: Path
async def test_savings_endpoint_unknown_repo_404(client: AsyncClient) -> None:
resp = await client.get("/api/repos/nope/distill-savings")
assert resp.status_code == 404
+
+
+async def test_savings_endpoint_reports_missed_stats(
+ client: AsyncClient, tmp_path: Path, monkeypatch
+) -> None:
+ """The missed-savings secondary stat rides on the same response."""
+ repo = await create_test_repo(client, tmp_path)
+ _seed_store(Path(repo["local_path"]))
+
+ import repowise.core.distill.missed as missed
+
+ monkeypatch.setattr(
+ missed,
+ "scan_missed_savings",
+ lambda root, **kw: {
+ "events": 3,
+ "raw_tokens": 9_000,
+ "est_saved_tokens": 4_200,
+ "per_filter": {},
+ "window_days": 7.0,
+ },
+ )
+ resp = await client.get(f"/api/repos/{repo['id']}/distill-savings")
+ assert resp.status_code == 200
+ data = resp.json()
+ assert data["missed_events"] == 3
+ assert data["missed_tokens_est"] == 4_200
+ assert data["missed_window_days"] == 7.0
+
+
+async def test_savings_endpoint_no_transcripts_means_zero_missed(
+ client: AsyncClient, tmp_path: Path
+) -> None:
+ repo = await create_test_repo(client, tmp_path)
+ _seed_store(Path(repo["local_path"]))
+ resp = await client.get(f"/api/repos/{repo['id']}/distill-savings")
+ assert resp.status_code == 200
+ data = resp.json()
+ assert data["missed_events"] == 0
+ assert data["missed_tokens_est"] == 0