CLI-247 Post tool use#159
CLI-247 Post tool use#159kirill-knize-sonarsource wants to merge 1 commit intotask/kk/CLI-244-245-callback-infrastructurefrom
Conversation
SummaryThis PR implements the Previously, the hook command was a no-op stub. This PR replaces it with a functional handler that:
The implementation is defensive by design—it silently returns without output if authentication is missing, the file doesn't exist, the tool is not Edit/Write, or analysis fails. This prevents hook failures from blocking agent workflows. What reviewers should knowStart with the main implementation: Understand the defensive design: The function uses early returns to skip processing without output. This is intentional—see the comments around each condition (tool name, file existence, auth). The handler should never crash a hook. Review the command registration: Focus on tests for behavior clarity: The unit tests in Note the result format: The output is wrapped in
|
e5bc9f8 to
6f2f053
Compare
bbd8e20 to
c8fca3a
Compare
6f2f053 to
aa6bc64
Compare
d64356e to
80c4a76
Compare
80c4a76 to
4853f25
Compare
143d5f1 to
31cb0f1
Compare
4853f25 to
e2211ff
Compare
140c6be to
020d2e9
Compare
e2211ff to
581f8af
Compare
581f8af to
00bea22
Compare
There was a problem hiding this comment.
Conclusion: The hook implementation itself is clean and the unit test suite is thorough. One logic duplication worth fixing, and the quality gate needs addressing before merge.
SonarQube Cloud status: Coverage on new code is at 69.1%, below the required 80% threshold. The integration test added in this PR targets an analyze sqaa edge case (unregistered project with --branch) rather than exercising the new agent-post-tool-use hook — so coverage of agent-post-tool-use.ts comes entirely from unit tests. See the reviewer guide above for details.
| hookSpecificOutput: { hookEventName: 'PostToolUse', additionalContext: text }, | ||
| }) + '\n', | ||
| ); | ||
| } catch (err) { |
There was a problem hiding this comment.
Logic duplication: formatSqaaResult reimplements the same logic as displaySqaaResults in src/cli/commands/analyze/sqaa.ts (line 162). Both iterate over issues with the same [idx+1] message (line startLine) structure and handle the errors array the same way. They've already diverged: displaySqaaResults puts the rule on a separate Rule: X line, while this version inlines it as [rule].
If the output format needs to change (e.g. adding severity, effort, or a new field), both functions must be updated. Extract shared formatting logic — for example a buildSqaaIssueLines(issues, errors): string[] helper in a shared module — and have each caller apply its own output target on top.
- Mark as noise
00bea22 to
959f7da
Compare
959f7da to
01e509f
Compare
e44c9d3 to
d117a3a
Compare
01e509f to
ae124e1
Compare
f4cbc21 to
468e45c
Compare
ae124e1 to
523d6f8
Compare
9191141 to
129cc50
Compare
523d6f8 to
675cd92
Compare
675cd92 to
cf59297
Compare
|



No description provided.