(cwd = process.cwd())
| 125 | |
| 126 | /** Persist trust for the current project's hooks (call after the user agrees). */ |
| 127 | export function trustProjectHooks(cwd = process.cwd()): void { |
| 128 | const hooks = readProjectHooks(cwd) |
| 129 | if (!hooks) return |
| 130 | const store = (readJson(getTrustStorePath()) as Record<string, string> | undefined) ?? {} |
| 131 | store[cwd] = hashHooks(hooks) |
| 132 | try { |
| 133 | fs.mkdirSync(getConfigDir(), { recursive: true }) |
| 134 | fs.writeFileSync(getTrustStorePath(), JSON.stringify(store, null, "\t") + "\n", { mode: 0o600 }) |
| 135 | } catch { |
| 136 | // best-effort; if it can't be persisted the user will simply be re-prompted |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * If this project defines hooks that are not yet trusted, return the list of |
no test coverage detected