Skip to content

Commit 65785cf

Browse files
committed
perf(hooks): deduplicate repeated cli-repeat and file-covered advisories per session
1 parent ac81a4d commit 65785cf

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎src/hooks_bash.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,10 +765,12 @@ function preBashHandlerInner(event: HookEvent): HookOutput {
765765
if (tgRead !== null) {
766766
const cliKey = tgRead.sub + '::' + tgRead.spec
767767
const notes = []
768-
if (wasCliReadThisSession(cliKey)) {
768+
if (wasCliReadThisSession(cliKey) && !wasHintShown('cli_repeat::' + cliKey)) {
769+
markHintShown('cli_repeat::' + cliKey)
769770
notes.push('You already ran this exact `token-goat ' + tgRead.sub + '` query earlier this session — check your context above before re-running it.')
770771
}
771-
if (tgRead.filePath !== null && wasFileReadThisSession(tgRead.filePath)) {
772+
if (tgRead.filePath !== null && wasFileReadThisSession(tgRead.filePath) && !wasHintShown('file_read_covered::' + tgRead.filePath)) {
773+
markHintShown('file_read_covered::' + tgRead.filePath)
772774
notes.push(sentenceStart(fileSubject('', displaySafePath(tgRead.filePath))) + ' was already fully read via the Read tool this session — that content may already cover this.')
773775
}
774776
if (notes.length > 0) {

0 commit comments

Comments
 (0)