feat: add LintTool and UnitTestTool for code quality#1197
Conversation
LintTool: - Run linters (eslint, prettier, ruff, golangci-lint, shellcheck, etc.) - Auto-detects linter from config files - Actions: check, fix, format UnitTestTool: - Run unit tests (jest, pytest, vitest, go test, cargo test, etc.) - Auto-detects test runner from config - Actions: run, coverage, watch mode Both tools include: - Input validation per tool for security - Permission prompts for destructive actions - Timeout handling
jatmn
left a comment
There was a problem hiding this comment.
Findings
-
[P1] Register the new tools so the model can call them
src/tools.ts:183
The PR addsLintToolandUnitTestTool, butsrc/tools.tsnever imports them or includes them ingetAllBaseTools(). Because the built-in tool pool is assembled from this list, neitherLintnorUnitTestis exposed to the model in normal CLI/SDK execution, so the advertised user-facing feature is currently unreachable. Please wire both tools into the tool registry (and any relevant presets/filtering surfaces) and add coverage thatgetTools()includes them. -
[P2] Use the parent directory as cwd for existing file targets
src/tools/LintTool/LintTool.ts:134
The working directory fallback only usesdirname(targetPath)when the target looks like a file and does not exist. For the common case where the user asks to lint or test an existing file,workingDirbecomes the file path itself, sospawnSync(..., { cwd: workingDir })fails before the linter/test runner can run. The same pattern exists insrc/tools/UnitTestTool/UnitTestTool.ts:95. Please treat existing file paths as file targets too, and keepcwdon the containing directory while passing the file path as the command argument.
|
Thanks for this — built-in lint and test tooling is a nice quality-of-life addition, and the prompt structure is well thought out. I reviewed it independently alongside @jatmn's feedback, and his findings are accurate: neither Once those are sorted, the next review will also want to look at command-execution and sandboxing safety and permission gating for tools that |
Summary
Impact
Testing
Notes