feat(hooks): add comment-checker hook for detecting unnecessary comments

- Port Go comment-checker to TypeScript using web-tree-sitter
- Support 38 programming languages via tree-sitter-wasms
- Filter out valid comments: BDD patterns, lint directives, docstrings, shebangs
- Integrate with OpenCode's tool.execute.before/after hooks
- Attach feedback to Write/Edit/MultiEdit tool output
This commit is contained in:
YeonGyu-Kim
2025-12-05 02:49:47 +09:00
parent 22acb0def1
commit 02a9402472
15 changed files with 655 additions and 4 deletions

View File

@@ -0,0 +1,11 @@
import type { FileComments } from "../types"
import { HOOK_MESSAGE_HEADER } from "../constants"
import { buildCommentsXml } from "./xml-builder"
export function formatHookMessage(fileCommentsList: FileComments[]): string {
if (fileCommentsList.length === 0) {
return ""
}
const xml = buildCommentsXml(fileCommentsList)
return `${HOOK_MESSAGE_HEADER}${xml}\n`
}