MCPcopy Create free account
hub / github.com/MatterAIOrg/OrbCode / trustProjectHooks

Function trustProjectHooks

src/config/settings.ts:127–138  ·  view source on GitHub ↗
(cwd = process.cwd())

Source from the content-addressed store, hash-verified

125
126/** Persist trust for the current project's hooks (call after the user agrees). */
127export 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

Callers 2

AppFunction · 0.85

Calls 5

readProjectHooksFunction · 0.85
getTrustStorePathFunction · 0.85
hashHooksFunction · 0.85
getConfigDirFunction · 0.85
readJsonFunction · 0.70

Tested by

no test coverage detected