pub fn install_tool_hooks_scoped(
project_dir: &Path,
sqz_path: &str,
scope: InstallScope,
) -> Vec<String>Expand description
Like install_tool_hooks but lets the caller choose between
project-local and user-global scope. This is the function sqz init
and sqz init --global both call.
For InstallScope::Global:
-
Claude Code hook is merged into
~/.claude/settings.json(the user settings file). We merge rather than overwrite because the user may already have permissions, env, statusLine, or other hooks there — blindly writing would nuke their config. Any existing sqz hook entries are replaced in place; unrelated fields are preserved. -
Cursor, Windsurf, Cline, Gemini CLI rules files don’t have a user-level equivalent that Cursor/etc. actually load. We keep those at project scope and note it in the plan. Users who want Cursor compressed across all projects should follow the Cursor docs (docs.cursor.com/en/context/rules) and add the rule at user scope manually — Cursor honours ~/.cursor/rules/*.mdc but only within workspaces that opt in.
-
OpenCode plugin is already user-level by design (lives at
~/.config/opencode/plugins/sqz.ts), so scope doesn’t matter here. -
Codex MCP config is always user-level (
~/.codex/config.toml). AGENTS.md stays per-project because that’s where it belongs.