MCPcopy Create free account
hub / github.com/Tencent/teamai-cli / injectOpencodeHooks

Function injectOpencodeHooks

src/opencode-hooks.ts:157–163  ·  view source on GitHub ↗
(baseDir: string, scope: 'project' | 'user')

Source from the content-addressed store, hash-verified

155 * Idempotent — rewrites the plugin file each time.
156 */
157export async function injectOpencodeHooks(baseDir: string, scope: 'project' | 'user'): Promise<void> {
158 const dir = resolveOpencodePluginDir(baseDir, scope);
159 await ensureDir(dir);
160 const file = path.join(dir, OPENCODE_HOOK_FILE);
161 await writeFile(file, buildPluginSource());
162 log.success(`Injected teamai OpenCode hook into ${file}`);
163}
164
165/** Remove the teamai OpenCode plugin for a scope if present. */
166export async function removeOpencodeHooks(baseDir: string, scope: 'project' | 'user'): Promise<void> {

Callers 2

reconcileOpencodePluginFunction · 0.85

Calls 4

resolveOpencodePluginDirFunction · 0.85
ensureDirFunction · 0.85
writeFileFunction · 0.85
buildPluginSourceFunction · 0.85

Tested by

no test coverage detected