(cwd: string, hash: string)
| 114 | } |
| 115 | |
| 116 | function isProjectHooksTrusted(cwd: string, hash: string): boolean { |
| 117 | // Escape hatch for CI / non-interactive automation. Only honored when |
| 118 | // stdin is not a TTY (so a stray export in a shell rc file can't silently |
| 119 | // disable the trust gate for interactive sessions). A non-TTY check keeps |
| 120 | // the gate meaningful in the TUI while still letting CI opt in. |
| 121 | if (process.env.MATTERAI_TRUST_PROJECT_HOOKS === "1" && !process.stdin.isTTY) return true |
| 122 | const store = readJson(getTrustStorePath()) |
| 123 | return Boolean(store && store[cwd] === hash) |
| 124 | } |
| 125 | |
| 126 | /** Persist trust for the current project's hooks (call after the user agrees). */ |
| 127 | export function trustProjectHooks(cwd = process.cwd()): void { |
no test coverage detected