This directory contains multiple .pytoolsrc configuration files for different use cases.
- Purpose: Interactive development with safety
- Mode: Interactive with confirmations
- Best for: Day-to-day development work
- Usage: Default configuration (no setup needed)
- Purpose: Continuous integration and automated testing
- Mode: Fully non-interactive, auto-confirm safe operations
- Best for: GitHub Actions, GitLab CI, Jenkins, automated testing
- Usage:
export PYTOOLSRC=.pytoolsrc.ci
- Purpose: Local automation and batch processing
- Mode: Non-interactive but keeps output for debugging
- Best for: Scripts, batch operations, local automation
- Usage:
export PYTOOLSRC=.pytoolsrc.automation
- Purpose: Maximum safety with extensive validation
- Mode: Interactive with dry-run by default
- Best for: Production changes, critical code, learning
- Usage:
export PYTOOLSRC=.pytoolsrc.safe
env:
PYTOOLSRC: .pytoolsrc.ci
steps:
- run: ./run_any_python_tool.sh safe_file_manager.py organize src/#\!/bin/bash
export PYTOOLSRC=.pytoolsrc.automation
# Your automated operations
./run_any_python_tool.sh replace_text_v9.py "TODO" "DONE" --scope src/
./run_any_python_tool.sh safe_file_manager.py organize ~/Downloadsexport PYTOOLSRC=.pytoolsrc.safe
./run_any_python_tool.sh replace_text_v9.py "oldAPI" "newAPI" --scope src/
# Will preview changes and ask for confirmationYou can override specific settings with environment variables (highest priority):
# Force non-interactive mode for any tool
export PYTOOLSRC_NON_INTERACTIVE=1
# Tool-specific overrides
export SFM_ASSUME_YES=1 # safe_file_manager
export SAFEGIT_NONINTERACTIVE=1 # safegit
export TEXT_UNDO_ASSUME_YES=1 # text_undo
export REPLACE_TEXT_ASSUME_YES=1 # replace_text_v9
export REPLACE_TEXT_AST_ASSUME_YES=1 # replace_text_ast_v3
export UNIFIED_REFACTOR_ASSUME_YES=1 # unified_refactor_v2Tools check settings in this order (first found wins):
- Command-line flags (e.g.,
--yes,--non-interactive) - Environment variables (e.g.,
TOOL_NAME_ASSUME_YES=1) - Configuration file (specified by
PYTOOLSRC) - Default config (
.pytoolsrc) - Tool defaults (interactive mode)
All configurations support the new interactive_utils features:
- ✅ EOF Error Elimination: No more "EOF when reading a line" crashes
- ✅ Auto CI Detection: Automatically detects CI environments
- ✅ Unified Behavior: Same patterns work across all migrated tools
- ✅ Clear Error Messages: Actionable hints when interaction is required
- ✅ Multiple Prompt Types: Yes/no, typed phrases, numbered selections
- ✅ Language-Aware Backends: Auto-detects Java vs Python for optimal AST processing
Fully Migrated (support all configurations):
- ✅
text_undo.py- Numbered selection menus - ✅
safe_file_manager.py- Risk-based confirmations - ✅
safegit.py- Multi-choice prompts - ✅
replace_text_v9.py- Large change confirmations - ✅
replace_text_ast_v3.py- Batch operation confirmations
Legacy Tools (basic environment variable support):
- Tools using older patterns - use environment variables for non-interactive mode
- Check
PYTOOLSRCis set:echo $PYTOOLSRC - Verify tool supports interactive_utils:
grep "interactive_utils" tool_name.py - Add tool-specific environment variable:
export TOOL_NAME_ASSUME_YES=1 - Use command-line flag:
./run_any_python_tool.sh tool.py --yes
# Test with no stdin (should not hang)
(exec < /dev/null && PYTOOLSRC=.pytoolsrc.ci ./run_any_python_tool.sh safe_file_manager.py list .)All configurations use intelligent backend selection for unified_refactor:
[unified_refactor_v2]
backend = auto # Auto-detect: java_scope for .java, python_ast for .pyHow it works:
.javafiles →java_scopebackend (Java AST analysis).pyfiles →python_astbackend (Python AST analysis)- Other files →
text_basedbackend (fallback)
Benefits:
- ✅ Mixed codebases work seamlessly without manual configuration
- ✅ Optimal performance using language-specific AST parsers
- ✅ No configuration overhead - just works for any file type
- ✅ Consistent behavior across all configuration profiles
Copy an existing configuration and modify as needed:
cp .pytoolsrc.automation .pytoolsrc.custom
# Edit .pytoolsrc.custom with your specific requirements
export PYTOOLSRC=.pytoolsrc.custom- Never set
force = truein configuration files - Use environment variables for temporary force operations
- Test configurations in safe environments first
- Keep backups enabled (
backup = true) in all configurations
For complete documentation, see:
- NON_INTERACTIVE_GUIDE.md
- INTERACTIVE_UTILS_MIGRATION_STATUS.md EOF < /dev/null