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:
11
src/hooks/comment-checker/output/formatter.ts
Normal file
11
src/hooks/comment-checker/output/formatter.ts
Normal 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`
|
||||
}
|
||||
Reference in New Issue
Block a user