feat(sublime-text): add known_human checkpoint plugin#1049
feat(sublime-text): add known_human checkpoint plugin#1049
Conversation
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>
| 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(), | ||
| }]) | ||
| } |
There was a problem hiding this comment.
🔴 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.
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()) |
There was a problem hiding this comment.
🟡 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
…cleanup, and binary path escaping Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
agent-support/sublime-text/git_ai.py) that firesgit-ai checkpoint known_human --hook-input stdinon every file save with 500ms debounce per git repo rootSublimeTextInstallerthat auto-installs the plugin to the platform-appropriate Sublime Text Packages directoryon_post_save_asyncso saves never block the UIManual install
Test plan
cargo clippy -- -D warningspassescargo testpasses🤖 Generated with Claude Code