Asks before git push and wrangler --remote, showing the folder, the branch, the remote and the commits that will go out. Understands git -C dir and cd dir &&…

Fourteen Claude Code mods, packaged as one plugin marketplace (qa-mods). Made for a manual QA workflow: guard rails around risky commands, evidence for what was tested, and a status band above the prompt.
Run in your own Terminal (a sandboxed Claude session cannot write ~/.claude).
claude plugin marketplace add oleksandrkodua/qa-mods
claude plugin install hud@qa-mods
Replace hud with any plugin from the table.
To install everything from a local clone, or to set up a fresh machine, see INSTALL.md and install-pack.sh.
| Plugin | What it does |
|---|---|
sandbox-guard | Denies writes to protected Claude config paths and hands back a Terminal command |
remote-gate | Asks before git push and wrangler --remote, showing folder, branch, remote and the commits that will go out |
blast-radius | Shows what a risky Bash command will touch before it runs |
retry-analyzer | Detects repeated identical failing tool calls and tells Claude to change strategy |
secret-redactor | Masks tokens and keys in tool output |
evidence-saver | Saves screenshots from tool results to a folder you pick |
replay-theater | /replay: step through the session's file edits one by one |
verification-guard | Checks claims like "tests pass" against tool calls that actually ran |
handoff | Offers /handoff as the context fills up; fills the prompt box with a HANDOFF.md prompt |
notify | A toast and a macOS notification when a long command or turn finishes |
quick-actions | Compact and Clear buttons, each asks to confirm first |
hud | Context fill and rate-limit windows above the prompt, a кеш 59:48 chip (m:ss) while the prompt cache is warm, five buttons, and /hud with the figures as text |
next-steps-uk | Fork of next-steps (MIT, Thariq Shihipar): suggested next prompts are always in Ukrainian. Install instead of next-steps |
plan-progress | Fork of plan-progress 0.7.6 (zycck, MIT): live progress bars above the prompt. Install instead of plan-progress@zycck-mods |
claude plugin test hud # from the repo root
cd hud && node --test tests/format.test.mjs tests/handoff-prompt.test.mjs
A bare node --test also picks up register.test.ts, which only runs under claude plugin test.
No license file for the original mods yet. The two forks keep their upstream MIT notices: next-steps-uk/NOTICE.md and plan-progress/NOTICE.md (plus plan-progress/LICENSE.upstream).
hooks/register.ts 68 lines1import type { Register } from 'claude-code'
2
3import { classify, pushSummary, remoteDbSummary, repoDir } from './gate'
4
5/**
6 * Remote Gate: asks before `git push` and `wrangler ... --remote`, showing the remote, the branch
7 * and the commits that will go out. The repository shown is the one the command works in
8 * (`git -C dir push`, `cd dir && git push`), not only the session's own.
9 * Fail closed: a dismissed or unavailable dialog refuses the command.
10 */
11export const register: Register = on => {
12 let home = ''
13
14 on('session.start', async ($, e, next) => {
15 home = String((await $.env.get('HOME')) ?? '')
16
17 return next(e)
18 })
19
20 on('tool.call', { tool: 'Bash' }, async ($, e, next) => {
21 const command = String(e.command ?? '')
22 const kind = classify(command)
23
24 if (kind === undefined) return next(e)
25
26 let approved = false
27
28 try {
29 let info = ''
30 let what = remoteDbSummary(command)
31
32 if (kind !== 'remote-db') {
33 const dir = repoDir(command, home)
34 const where = dir ? ['-C', dir] : []
35 const remote = await $.process.run(['git', ...where, 'remote', '-v'])
36 const branch = await $.process.run(['git', ...where, 'rev-parse', '--abbrev-ref', 'HEAD'])
37 const out = await $.process.run(['git', ...where, 'log', '--oneline', '@{u}..HEAD'])
38 const urls = remote.stdout.split('\n').filter(l => l.includes('(push)')).join('; ')
39 const commits = out.exitCode === 0 ? out.stdout.trim() || 'немає нових комітів' : 'upstream не задано'
40 const remotes = remote.stdout.split('\n').flatMap(l => {
41 const m = /^(\S+)\s+(\S+)\s+\(push\)/.exec(l)
42
43 return m ? [{ name: m[1]!, url: m[2]! }] : []
44 })
45
46 what = pushSummary(command, { branch: branch.stdout.trim(), remotes, commits: out.exitCode === 0 ? out.stdout.split('\n').filter(Boolean) : null })
47
48 // the dialog collapses line breaks, so the parts are labelled sentences
49 info = ` Тека: ${dir ?? 'тека сесії'}. Гілка: ${branch.stdout.trim() || '?'}. Remote: ${urls || '?'}. Піде: ${commits.split('\n').slice(0, 12).join(' | ')}.`
50 }
51
52 const label = kind === 'force-push' ? 'FORCE-PUSH' : kind === 'push' ? 'git push' : 'wrangler --remote (бойові дані)'
53 const answer = await $.ui.ask(`Remote Gate: ${label}. Що зробить: ${what} Команда: ${command.slice(0, 200)}.${info} Виконати?`, {
54 options: ['Виконати', 'Скасувати'],
55 header: 'Remote Gate',
56 })
57
58 approved = answer === 'Виконати'
59 } catch {
60 // dismissed or headless: fail closed
61 }
62
63 if (!approved) return { deny: 'remote-gate: не підтверджено. Не повторюй команду без нової згоди користувача.' }
64
65 return next(e)
66 })
67}
68hooks/gate.ts 183 lines1export type Kind = 'push' | 'force-push' | 'remote-db'
2
3/** Drop heredoc bodies (documents/code fed to another program) unless a shell reads them. */
4function stripHeredocs(cmd: string): string {
5 const out: string[] = []
6 let end: string | null = null
7 let keep = false
8
9 for (const line of cmd.split('\n')) {
10 if (end !== null) {
11 if (line.trim() === end) end = null
12 else if (keep) out.push(line)
13
14 continue
15 }
16
17 out.push(line)
18
19 const m = /<<-?\s*(['"]?)([A-Za-z_]\w*)\1/.exec(line)
20
21 if (m) {
22 end = m[2]!
23 keep = /\b(ba|z|da|)sh\s*(-\w+\s*)*(-\s*)?<</.test(line)
24 }
25 }
26
27 return out.join('\n')
28}
29
30/** Quoted strings emptied: `echo "git push"` and a commit message that mentions it are not a push. */
31const maskQuotes = (s: string) => s.replace(/'[^']*'|"(?:[^"\\]|\\.)*"/g, '""')
32
33// git's own options that take the next word as their value: `git -C dir push`, `git -c k=v push`
34const GIT_ARG_OPTS = new Set(['-C', '-c', '--git-dir', '--work-tree', '--namespace', '--exec-path', '--config-env', '--super-prefix', '--attr-source'])
35
36/** Where the git subcommand sits after the `git` at words[at], past git's own options: in `git -C dir stash push` it is `stash`. */
37function gitSubIndex(words: string[], at: number): number {
38 for (let i = at + 1; i < words.length; ) {
39 if (!words[i]!.startsWith('-')) return i
40
41 i += GIT_ARG_OPTS.has(words[i]!) ? 2 : 1
42 }
43
44 return -1
45}
46
47const gitSubcommand = (words: string[], at: number) => words[gitSubIndex(words, at)]
48
49const segmentWords = (seg: string) => seg.trim().replace(/^[({]+\s*/, '').split(/\s+/).filter(Boolean)
50
51/** The words after `push` in the first `git push` of the command line, or undefined if there is none. */
52function pushArgs(command: string): { words: string[]; seg: string } | undefined {
53 for (const seg of maskQuotes(stripHeredocs(command)).split(/\n|;|&&|\|\||\|/)) {
54 const words = segmentWords(seg)
55
56 for (let at = 0; at < words.length; at++) {
57 if (words[at]!.replace(/^.*\//, '') === 'git' && gitSubcommand(words, at) === 'push') return { words: words.slice(gitSubIndex(words, at) + 1), seg }
58 }
59 }
60
61 return undefined
62}
63
64const FORCE = /--force\b|--force-with-lease|--force-if-includes|(^|\s)-f(\s|$)|\+\S+:|\s\+\S+/
65
66export function classify(command: string): Kind | undefined {
67 const cmd = maskQuotes(stripHeredocs(command))
68 let push: Kind | undefined
69
70 // `push` counts only as the git subcommand (`git push`, `git -C dir push`); `git stash push` and `git log --grep push` do not
71 for (const seg of cmd.split(/\n|;|&&|\|\||\|/)) {
72 const words = segmentWords(seg)
73
74 for (let at = 0; at < words.length; at++) {
75 if (words[at]!.replace(/^.*\//, '') !== 'git' || gitSubcommand(words, at) !== 'push') continue
76
77 push = push === 'force-push' || FORCE.test(seg) ? 'force-push' : 'push'
78 }
79 }
80
81 if (push) return push
82
83 if (/\bwrangler\b/.test(cmd) && /--remote\b/.test(cmd)) return 'remote-db'
84
85 return undefined
86}
87
88const unquote = (s: string) => s.replace(/^["']|["']$/g, '')
89
90/**
91 * The folder the command works in: `git -C <dir> push` or a leading `cd <dir> &&`.
92 * Without it the gate would describe the session's own repository, not the one being pushed.
93 */
94export function repoDir(command: string, home: string): string | undefined {
95 const cmd = stripHeredocs(command)
96 const c = /\bgit\s+(?:--?[\w-]+(?:=\S+)?\s+)*-C\s+("[^"]+"|'[^']+'|[^\s"']+)/.exec(cmd)
97 const cd = /^\s*cd\s+("[^"]+"|'[^']+'|[^\s;&"']+)\s*(?:&&|;)/.exec(cmd)
98 const raw = c?.[1] ?? cd?.[1]
99
100 if (!raw) return undefined
101
102 const dir = unquote(raw)
103
104 return dir.startsWith('~/') && home ? `${home}${dir.slice(1)}` : dir
105}
106
107export interface PushContext {
108 /** the branch checked out in the repository the push runs in */
109 branch?: string
110 /** `git remote -v`: the push URL of every remote */
111 remotes: { name: string; url: string }[]
112 /** the commits not yet on the upstream (one line each); null when no upstream is set so they cannot be counted */
113 commits: string[] | null
114}
115
116// push options that take the next word as their value (so it is not read as the remote or a refspec)
117const PUSH_ARG_OPTS = new Set(['-o', '--push-option', '--repo', '--receive-pack', '--exec'])
118
119/** What a `git push` will do, in plain words: what goes where, and how much it can hurt. */
120export function pushSummary(command: string, ctx: PushContext): string {
121 const parsed = pushArgs(command)
122 const words = parsed?.words ?? []
123 const flags = new Set<string>()
124 const positional: string[] = []
125
126 for (let i = 0; i < words.length; i++) {
127 const w = words[i]!
128
129 if (w.startsWith('-')) {
130 flags.add(w.replace(/=.*$/, ''))
131 if (PUSH_ARG_OPTS.has(w)) i++
132 } else positional.push(w)
133 }
134
135 const known = ctx.remotes.find(r => r.name === positional[0])
136 const asUrl = positional[0] && !known && /[/:@]/.test(positional[0]) ? positional[0] : undefined
137 const remote = known ?? (asUrl ? { name: asUrl, url: '' } : positional[0] ? { name: positional[0], url: '' } : ctx.remotes.find(r => r.name === 'origin') ?? ctx.remotes[0])
138 const refs = positional.slice(remote && positional[0] ? 1 : 0)
139 const where = remote ? `remote ${remote.name}${remote.url && remote.url !== remote.name ? ` (${remote.url})` : ''}` : 'remote'
140 const target = refs.length ? refs.join(', ') : `гілку ${ctx.branch || '?'}`
141 const deleted = flags.has('--delete') || flags.has('-d') ? refs : refs.filter(r => r.startsWith(':')).map(r => r.slice(1))
142 const count = ctx.commits?.length ?? 0
143 const sent =
144 ctx.commits === null
145 ? 'upstream не задано, кількість комітів невідома'
146 : count === 0
147 ? 'нових комітів немає, на сервері майже нічого не зміниться'
148 : `нових комітів: ${count}`
149
150 if (flags.has('--dry-run') || flags.has('-n')) return `Пробний запуск (--dry-run): покаже, що було б відправлено в ${where}, але нічого не відправить і нічого не змінить.`
151 if (deleted.length) return `ВИДАЛИТЬ ${deleted.join(', ')} у ${where}: гілка зникне на сервері.`
152 if (flags.has('--mirror')) return `ПЕРЕЗАПИШЕ усі refs у ${where} дзеркально: те, чого немає локально, буде видалено на сервері.`
153 if (flags.has('--force-with-lease') || flags.has('--force-if-includes')) return `Примусово оновить ${target} у ${where}, але лише якщо на сервері немає чужих нових комітів (--force-with-lease).`
154 if (flags.has('--force') || flags.has('-f') || refs.some(r => r.startsWith('+'))) return `ПРИМУСОВО (force) перезапише ${target} у ${where}: коміти на сервері, яких немає локально, буде втрачено.`
155 if (flags.has('--all')) return `Відправить усі локальні гілки в ${where} (${sent}).`
156 if (flags.has('--tags')) return `Відправить усі локальні теги в ${where}.`
157
158 const upstream = flags.has('-u') || flags.has('--set-upstream') ? ' і запам\'ятає її як основну (-u)' : ''
159
160 return `Відправить ${target} з локальної теки в ${where} (${sent})${upstream}.${ctx.commits === null || count > 0 ? " Зміни одразу з'являться на сервері." : ''}`
161}
162
163/** What a `wrangler ... --remote` command will do, in plain words: it works on the live database, not the local one. */
164export function remoteDbSummary(command: string): string {
165 const db = /\bd1\s+execute\s+(?:--\S+\s+)*([\w-]+)/.exec(command)?.[1]
166 const sql = /--command[= ]\s*(?:"([^"]*)"|'([^']*)'|(\S+))/.exec(command)
167 const text = (sql?.[1] ?? sql?.[2] ?? sql?.[3] ?? '').trim()
168 const verb = /^\s*(\w+)/.exec(text)?.[1]?.toUpperCase()
169 const effect = !verb
170 ? 'виконає команду'
171 : /^(SELECT|PRAGMA|EXPLAIN|WITH)$/.test(verb)
172 ? 'лише читає дані'
173 : /^(DROP|ALTER|CREATE|TRUNCATE)$/.test(verb)
174 ? 'ЗМІНЮЄ структуру бази'
175 : /^(INSERT|UPDATE|DELETE|REPLACE)$/.test(verb)
176 ? 'ЗМІНЮЄ дані'
177 : 'виконає запит'
178
179 if (db) return `Виконає запит у БОЙОВІЙ базі ${db} (Cloudflare D1, не локальній): ${effect}. Зміни одразу бачать усі користувачі.`
180
181 return 'Виконає команду wrangler проти бойового середовища Cloudflare (--remote), а не локального: зміни одразу побачать усі.'
182}
183