(cwd = process.cwd())
| 143 | * trusted). The TUI uses this to gate project hooks behind a trust prompt. |
| 144 | */ |
| 145 | export function getPendingProjectHooks(cwd = process.cwd()): { commands: string[] } | null { |
| 146 | const hooks = readProjectHooks(cwd) |
| 147 | if (!hooks) return null |
| 148 | if (isProjectHooksTrusted(cwd, hashHooks(hooks))) return null |
| 149 | const commands: string[] = [] |
| 150 | for (const matchers of Object.values(hooks)) { |
| 151 | for (const matcher of matchers ?? []) { |
| 152 | for (const hook of matcher.hooks ?? []) { |
| 153 | if (hook?.command) commands.push(hook.command) |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | return { commands } |
| 158 | } |
| 159 | |
| 160 | /** Make sure ~/.orbcode/settings.json exists (empty JSON) so users can find it. */ |
| 161 | function ensureUserSettingsFile(): void { |
no test coverage detected