Skip to content

feat(sublime-text): add known_human checkpoint plugin#1049

Open
svarlamov wants to merge 10 commits intomainfrom
feat/known-human-sublime-text
Open

feat(sublime-text): add known_human checkpoint plugin#1049
svarlamov wants to merge 10 commits intomainfrom
feat/known-human-sublime-text

Conversation

@svarlamov
Copy link
Copy Markdown
Member

@svarlamov svarlamov commented Apr 11, 2026

Summary

  • New Python plugin (agent-support/sublime-text/git_ai.py) that fires git-ai checkpoint known_human --hook-input stdin on every file save with 500ms debounce per git repo root
  • New SublimeTextInstaller that auto-installs the plugin to the platform-appropriate Sublime Text Packages directory
  • Uses on_post_save_async so saves never block the UI
  • Hot-reloads: no Sublime Text restart required after install

Manual install

# Find your Packages directory: Preferences → Browse Packages
mkdir -p "~/.config/sublime-text/Packages/git-ai"
cp agent-support/sublime-text/git_ai.py "~/.config/sublime-text/Packages/git-ai/"
# Edit GIT_AI_BIN in the file to point to your git-ai binary

Test plan

  • cargo clippy -- -D warnings passes
  • cargo test passes

🤖 Generated with Claude Code


Open with Devin

Adds a Python plugin for Sublime Text that fires
git-ai checkpoint known_human --hook-input stdin on file save
with 500ms debounce per repo root. The Rust installer auto-installs
the plugin to the platform-appropriate Packages directory.
Sublime Text hot-reloads Python packages — no restart needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
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 2 potential issues.

View 4 additional findings in Devin Review.

Open in Devin Review

Comment on lines +165 to +192
fn uninstall_extras(
&self,
_params: &HookInstallerParams,
_dry_run: bool,
) -> Result<Vec<UninstallResult>, GitAiError> {
let Some(plugin_path) = Self::plugin_path() else {
return Ok(vec![UninstallResult {
changed: false,
diff: None,
message: "Sublime Text: Could not determine Packages directory".to_string(),
}]);
};
if let Some(dir) = plugin_path.parent()
&& dir.exists()
{
fs::remove_dir_all(dir)?;
return Ok(vec![UninstallResult {
changed: true,
diff: None,
message: "Sublime Text: Plugin removed".to_string(),
}]);
}
Ok(vec![UninstallResult {
changed: false,
diff: None,
message: "Sublime Text: Plugin was not installed".to_string(),
}])
}
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot Apr 11, 2026

Choose a reason for hiding this comment

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

🔴 uninstall_extras performs destructive remove_dir_all even during dry run

The _dry_run parameter is prefixed with underscore and completely ignored. At line 189, fs::remove_dir_all(dir)? unconditionally deletes the entire git-ai plugin directory even when dry_run is true. Every other installer in the codebase guards destructive file operations with if !dry_run — see amp.rs:128, opencode.rs:157.

Open in Devin Review

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

let Ok(content) = fs::read_to_string(&path) else {
return false;
};
content.contains(&binary_path.display().to_string())
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot Apr 11, 2026

Choose a reason for hiding this comment

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

🟡 is_plugin_installed check fails on Windows due to path escaping mismatch

On Windows, install_extras writes the binary path with doubled backslashes for Python string escaping (replace('\', "\\\\") at sublime_text.rs:156), so the installed file contains e.g. C:\\Users\\.... However, is_plugin_installed at line 73 checks content.contains(&binary_path.display().to_string()) which produces a string with single backslashes (C:\Users\...). Since the single-backslash string is not a substring of the double-backslash content, the check always returns false on Windows after a successful install. This causes check_hooks to report hooks_installed: false and install_extras to redundantly overwrite the plugin on every run.

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