Skip to main content

Module opencode_plugin

Module opencode_plugin 

Source

Structs§

PlannedOpencodeChange
Result of a dry-run over the OpenCode config.

Functions§

find_opencode_config
Locate an existing OpenCode project config. Returns the path to opencode.jsonc if present, else opencode.json if present, else None. Prefers .jsonc because a user who bothered to write a comment-annotated config is more invested in it, and sqz must not silently create a parallel .json that would leave the .jsonc looking un-updated (reported in issue #6).
generate_opencode_plugin
Generate the OpenCode TypeScript plugin content.
install_opencode_plugin
Install the OpenCode plugin to ~/.config/opencode/plugins/sqz.ts.
opencode_config_has_comments
Return true if the user’s OpenCode project config is a .jsonc file that contains comments. Callers use this to decide whether to warn the user that sqz’s upcoming merge will drop those comments (serde_json round-trips discard them).
opencode_plugin_path
Default path for the OpenCode plugin file.
plan_opencode_config_change
Dry-run preview of what update_opencode_config_detailed would do.
process_opencode_hook
Process an OpenCode tool.execute.before hook invocation.
remove_sqz_from_opencode_config
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.
strip_jsonc_comments
Strip JSONC-style comments from src while preserving string literals byte-exact. Handles:
update_opencode_config
Update an existing opencode.json/opencode.jsonc, or create a fresh opencode.json, so that sqz’s plugin and MCP server are registered. Idempotent.
update_opencode_config_detailed
Like update_opencode_config but also reports whether comments had to be dropped from a JSONC file during the merge. Used by the sqz init CLI to print a warning.