[PR #225] Add enable/disable commands for git-ai wrapper #337

Closed
opened 2026-03-02 04:13:20 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/git-ai-project/git-ai/pull/225

State: closed
Merged: No


Summary

This PR adds git-ai enable and git-ai disable commands to provide a mechanism to disable the git-ai wrapper for git operations in case git-ai blocks execution or creates other problems. This allows users to bypass git-ai and use the underlying git binary directly when needed.

Problem

When git-ai is installed as a wrapper (the recommended enterprise deployment method), it intercepts all git commands. In some cases, git-ai may block execution or create problems that prevent normal git operations. Users need a reliable way to disable the wrapper to bypass git-ai and use the underlying git binary directly.

Solution

This PR adds two new commands:

  1. git-ai disable: Disables the git-ai wrapper by renaming the git binary wrapper, allowing all git commands to bypass git-ai and execute the underlying git binary directly
  2. git-ai enable: Re-enables the git-ai wrapper by restoring the git binary wrapper

The implementation works by:

  • When disabled: The git wrapper binary is renamed to git.disabled, so git commands no longer route through git-ai
  • When enabled: The git.disabled binary is renamed back to git, restoring git-ai interception

The commands include user-friendly error messages and help text that clearly explain their purpose without exposing implementation details.

Changes

  • Added enable and disable command handlers in src/commands/git_ai_handlers.rs
  • Added enable_git_ai() and disable_git_ai() utility functions in src/utils.rs
  • Added is_git_ai_disabled() check function to detect wrapper state
  • Updated help text to document the new commands
  • Added logic to allow enable/disable commands to work even when git-ai is disabled
  • Added user-friendly error messages that don't expose implementation details

Usage

Users can now disable git-ai when needed:

# Disable git-ai wrapper (bypasses git-ai, uses underlying git directly)
git-ai disable

# Re-enable git-ai wrapper
git-ai enable

When disabled, all git commands will bypass git-ai and execute the underlying git binary directly, allowing users to continue working even if git-ai is experiencing issues.

Testing

  • Verified that help text displays correctly
  • Verified that error messages are clear and user-friendly
  • The underlying functionality remains unchanged (still uses file renaming mechanism)
**Original Pull Request:** https://github.com/git-ai-project/git-ai/pull/225 **State:** closed **Merged:** No --- ## Summary This PR adds `git-ai enable` and `git-ai disable` commands to provide a mechanism to disable the git-ai wrapper for git operations in case git-ai blocks execution or creates other problems. This allows users to bypass git-ai and use the underlying git binary directly when needed. ## Problem When git-ai is installed as a wrapper (the recommended enterprise deployment method), it intercepts all `git` commands. In some cases, git-ai may block execution or create problems that prevent normal git operations. Users need a reliable way to disable the wrapper to bypass git-ai and use the underlying git binary directly. ## Solution This PR adds two new commands: 1. **`git-ai disable`**: Disables the git-ai wrapper by renaming the git binary wrapper, allowing all `git` commands to bypass git-ai and execute the underlying git binary directly 2. **`git-ai enable`**: Re-enables the git-ai wrapper by restoring the git binary wrapper The implementation works by: - When disabled: The git wrapper binary is renamed to `git.disabled`, so `git` commands no longer route through git-ai - When enabled: The `git.disabled` binary is renamed back to `git`, restoring git-ai interception The commands include user-friendly error messages and help text that clearly explain their purpose without exposing implementation details. ## Changes - Added `enable` and `disable` command handlers in `src/commands/git_ai_handlers.rs` - Added `enable_git_ai()` and `disable_git_ai()` utility functions in `src/utils.rs` - Added `is_git_ai_disabled()` check function to detect wrapper state - Updated help text to document the new commands - Added logic to allow enable/disable commands to work even when git-ai is disabled - Added user-friendly error messages that don't expose implementation details ## Usage Users can now disable git-ai when needed: ```bash # Disable git-ai wrapper (bypasses git-ai, uses underlying git directly) git-ai disable # Re-enable git-ai wrapper git-ai enable ``` When disabled, all `git` commands will bypass git-ai and execute the underlying git binary directly, allowing users to continue working even if git-ai is experiencing issues. ## Testing - Verified that help text displays correctly - Verified that error messages are clear and user-friendly - The underlying functionality remains unchanged (still uses file renaming mechanism)
kerem 2026-03-02 04:13:20 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#337
No description provided.