Skip to content

feat: auto-run Java lint after every Java edit tool - #3

Merged
gsnowdrift merged 2 commits into
mainfrom
feat/lint-auto-enforce
Nov 21, 2026
Merged

gsnowdrift merged 2 commits into
mainfrom
feat/lint-auto-enforce

Conversation

@gsnowdrift

Copy link
Copy Markdown
Owner

背景

AI 改完 Java 后本应自动跑代码检查并把报告塞进编辑结果,但钩子只匹配 write/edit 两个工具。
本会话实际用 str_replace_editor/insert 改文件,检查从未触发。

改动

  • 新增 JAVA_WRITE_TOOLS 集合,覆盖 write / edit / insert / undo_last_edit / str_replace_editor / ops_write_file / ops_edit_file
  • editedJavaPath 统一解析路径,排除 str_replace_editor 的只读 view 命令
  • 只报告不强制:检查失败仍放行编辑,报告追加在结果里由 AI 决定是否修

验证

  • node --check 通过;12 组匹配用例单测全绿(含各写工具、view 排除、非 java、无参数)

限制

  • 一轮三件套约 27s,检查器需在设置页先启用

GaoJ added 2 commits November 21, 2026 19:04
The post-execute hook only matched write and edit, so edits made through
str_replace_editor or insert were never checked. Match every built-in tool
that can write a file, while excluding str_replace_editor's read-only view
command.
- checkstyle: post-execute on Java edits (was running all enabled checkers)
- pmd: fire-and-forget at agent/turn-stopping after a Java edit
- spotbugs: tools/pre-execute gate on git commit (denies with findings)
- refresh the system prompt and tool description to match

Co-authored-by: user decision m14280
@gsnowdrift
gsnowdrift merged commit f2649c0 into main Nov 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant