Skip to main content

remove_sqz_from_opencode_config

Function remove_sqz_from_opencode_config 

Source
pub fn remove_sqz_from_opencode_config(
    project_dir: &Path,
) -> Result<Option<(PathBuf, bool)>>
Expand description

Remove sqz’s entries from an existing opencode.json/opencode.jsonc without deleting the whole file. Removes mcp.sqz and any "sqz" entry from plugin. If this leaves mcp or plugin empty the keys are dropped too. Returns (path, changed)changed is false when neither sqz entry was present.

Callers are expected to honour a .jsonc file’s comments losing fidelity on write: we parse with comment-stripping and emit as plain JSON. The file keeps its original extension so OpenCode keeps reading it. If the resulting config is completely empty (or would be the near-empty shape we’d create from scratch), we remove the file entirely since that’s the cleaner uninstall state.