Skip to content

support windsurf in intellej plugin#769

Open
acunniffe wants to merge 1 commit intomainfrom
feat/intellej-windsurf
Open

support windsurf in intellej plugin#769
acunniffe wants to merge 1 commit intomainfrom
feat/intellej-windsurf

Conversation

@acunniffe
Copy link
Collaborator

@acunniffe acunniffe commented Mar 21, 2026

Fix for #757

Screenshot 2026-03-21 at 9 15 41 AM https://docs.windsurf.com/windsurf/cascade/hooks#user-level

Appears that we have to register hooks in both locations for the time being.


Open with Devin

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

Comment on lines +215 to +251
let mut all_installed = true;
for hooks_path in Self::hooks_paths() {
if !hooks_path.exists() {
all_installed = false;
continue;
}

let content = fs::read_to_string(&hooks_path)?;
let existing: Value =
serde_json::from_str(&content).unwrap_or_else(|_| json!({}));

let has_hooks = HOOK_EVENTS.iter().all(|event| {
existing
.get("hooks")
.and_then(|h| h.get(*event))
.and_then(|v| v.as_array())
.map(|arr| {
arr.iter().any(|item| {
item.get("command")
.and_then(|c| c.as_str())
.map(is_git_ai_checkpoint_command)
.unwrap_or(false)
})
})
.unwrap_or(false)
});

if !has_hooks {
all_installed = false;
}
}

Ok(HookCheckResult {
tool_installed: true,
hooks_installed: all_installed,
hooks_up_to_date: all_installed,
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 check_hooks requires ALL locations to have hooks, preventing uninstall when hooks exist in only one location

The new check_hooks sets hooks_installed to true only when hooks are present in every path returned by hooks_paths(). Before this PR, hooks were only written to ~/.codeium/windsurf/hooks.json. After this upgrade, check_hooks also requires ~/.codeium/hooks.json to exist and contain hooks. For any user upgrading from the prior version, ~/.codeium/hooks.json won't exist, so check_hooks returns hooks_installed: false.

The uninstall flow at src/commands/install_hooks.rs:461-464 skips the tool entirely when hooks_installed is false:

if !check_result.hooks_installed {
    continue;
}

This means uninstall-hooks will silently skip Windsurf and leave the existing hooks in ~/.codeium/windsurf/hooks.json in place. The fix would be to use an any_installed check (are hooks in any location?) rather than requiring all locations.

Prompt for agents
In src/mdm/agents/windsurf.rs, the check_hooks function (lines 202-252) currently requires hooks to be present in ALL locations for hooks_installed to be true. This breaks the uninstall flow in src/commands/install_hooks.rs:461-464 which skips uninstall when hooks_installed is false.

Change the check_hooks logic to track two separate booleans: any_installed (hooks found in at least one location) and all_installed (hooks found in every location). Use any_installed for hooks_installed (so uninstall works when hooks exist in any location) and all_installed for hooks_up_to_date (so install knows to fill in missing locations).

Specifically, replace the single all_installed boolean with:
  let mut any_installed = false;
  let mut all_installed = true;

In the loop body, when has_hooks is true for a path, set any_installed = true. When has_hooks is false or the file doesn't exist, set all_installed = false.

Then return:
  HookCheckResult {
      tool_installed: true,
      hooks_installed: any_installed,
      hooks_up_to_date: all_installed,
  }
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant