Related Code Files:
safegit.py- Main SafeGIT wrapper with new config supportcommon_config.py- Configuration system used by SafeGIT.pytoolsrc- Configuration file with [safegit] section
SafeGIT has been updated to integrate with the Code Intelligence Toolkit's unified configuration system. It now reads settings from the .pytoolsrc configuration file while maintaining full backward compatibility with environment variables.
- Added import for
common_configmodule - Added new
_load_config()method to read from.pytoolsrc - Updated
__init__()to call_load_config()before_check_environment() - Modified
_check_environment()to only override when env vars are set
The configuration priority (highest to lowest) is now:
- Command-line flags (
--yes,--force-yes, etc.) - Environment variables (
SAFEGIT_NONINTERACTIVE, etc.) - Configuration file (
.pytoolsrc[safegit]section) - Built-in defaults (all disabled)
Users can now configure SafeGIT in .pytoolsrc:
[safegit]
non_interactive = false # Set to true for automation
assume_yes = false # Auto-confirm safe operations
force_yes = false # DANGEROUS: Auto-confirm all operations
dry_run = false # Preview modeUpdated the following documentation files:
- NON_INTERACTIVE_GUIDE.md: Added
.pytoolsrcas Method 1 for SafeGIT configuration - SAFEGIT_COMPREHENSIVE.md:
- Added new "Configuration" section after Installation
- Updated "Configuration Methods" to show
.pytoolsrcas recommended - Updated AI Agent Integration to recommend config file approach
- Enhanced troubleshooting section for config issues
- Consistency: SafeGIT now follows the same configuration pattern as all other tools
- Simplicity: Users can configure all tools in one place
- Safety: Configuration file approach is safer than environment variables
- Flexibility: Environment variables still work for temporary overrides
- Backward Compatibility: Existing workflows continue to function
The implementation has been tested and verified:
- Configuration loads correctly from
.pytoolsrc - Environment variables properly override config file settings
- CI environment detection still works
- All existing functionality remains intact
# .pytoolsrc
[safegit]
non_interactive = false
assume_yes = false# .pytoolsrc.ci
[safegit]
non_interactive = true
assume_yes = true
force_yes = false # Still require explicit --force# Override config for one command
SAFEGIT_ASSUME_YES=1 ./run_any_python_tool.sh safegit.py add .This update makes SafeGIT more integrated with the toolkit while maintaining all its safety features and backward compatibility.