Skip to main content

install_opencode_plugin

Function install_opencode_plugin 

Source
pub fn install_opencode_plugin(project_root: Option<&Path>) -> Result<()>
Expand description

Install the TraceVault OpenCode plugin. project_root = Some(dir) installs project-local at <dir>/.opencode/plugins/tracevault.ts; None installs global at ~/.config/opencode/plugins/tracevault.ts (using the same config-dir resolution as gsd_extension_source_dir above). OpenCode auto-loads *.ts modules from that directory — no separate “install” command. Returns an error on failure (unresolvable config dir, or a write error) so the caller aborts init loudly, consistent with the Codex/GSD arms — a swallowed failure would make init report success while no plugin was written, silently disabling capture.

A FLAT .ts file is used rather than a tracevault/ package directory: a package subdir (index.ts + package.json) makes OpenCode try to resolve it as an npm package and stalls at startup offline, whereas a flat module loads directly (both confirmed during the capture spike). The plugin only imports the node:child_process builtin, so it needs no package manifest.