refactor: Reorganize repository structure for better maintainability
Major structural improvements: - Created organized directory structure with logical separation - bin/ directory for legacy scripts (poc.sh, prod.sh) - config/ directory for configuration templates - tests/ directory for test framework - docs/ directory for documentation (ADRs) Enhanced build system: - Comprehensive Makefile with 20+ commands for development workflow - Full CI/CD pipeline support (test, lint, security-check) - Vendor integration testing for git vendor inclusion scenarios - Development environment setup and configuration management Updated test framework: - Smart path resolution for both organized and vendored structures - Improved vendor compatibility testing - Enhanced error handling and timeout protection Documentation updates: - Updated README with new directory structure - Comprehensive command reference and usage examples - Clear vendor integration guidelines - Architecture Decision Record for Node.js version management Files moved: - poc.sh, prod.sh → bin/ (legacy scripts) - bitwarden-config.conf.sample → config/ - test-secrets-manager.sh → tests/ - ADR-Node.md → docs/ All path references updated to maintain full functionality. This reorganization improves maintainability while preserving compatibility for git vendor inclusion scenarios. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
121
README.md
121
README.md
@@ -22,7 +22,7 @@ A comprehensive bash script solution for managing secrets at TSYS using the Bitw
|
||||
|
||||
2. **Create Configuration**:
|
||||
```bash
|
||||
cp bitwarden-config.conf.sample bitwarden-config.conf
|
||||
cp config/bitwarden-config.conf.sample bitwarden-config.conf
|
||||
# Edit bitwarden-config.conf with your actual Bitwarden credentials
|
||||
```
|
||||
|
||||
@@ -43,7 +43,7 @@ A comprehensive bash script solution for managing secrets at TSYS using the Bitw
|
||||
|
||||
## Configuration
|
||||
|
||||
Create a `bitwarden-config.conf` file based on the provided sample:
|
||||
Create a `bitwarden-config.conf` file based on the provided sample in the `config/` directory:
|
||||
|
||||
```bash
|
||||
# Bitwarden server URL
|
||||
@@ -146,21 +146,122 @@ All operations are logged to `/tmp/secrets-manager.sh.log` for debugging and aud
|
||||
|
||||
## Legacy Scripts
|
||||
|
||||
This repository also contains previous implementations:
|
||||
## Repository Structure
|
||||
|
||||
- **`poc.sh`** - Original proof of concept
|
||||
- **`prod.sh`** - ChatGPT-assisted production attempt
|
||||
```
|
||||
KNELSecretsManager/
|
||||
├── secrets-manager.sh # Main secrets management script
|
||||
├── README.md # This documentation
|
||||
├── LICENSE # License information
|
||||
├── Makefile # Build and test automation
|
||||
├── .gitignore # Git ignore rules
|
||||
├── bin/ # Legacy scripts and utilities
|
||||
│ ├── poc.sh # Original proof of concept
|
||||
│ └── prod.sh # ChatGPT-assisted production attempt
|
||||
├── config/ # Configuration templates
|
||||
│ └── bitwarden-config.conf.sample # Sample configuration
|
||||
├── tests/ # Test suite
|
||||
│ └── test-secrets-manager.sh # Comprehensive test framework
|
||||
└── docs/ # Documentation
|
||||
└── ADR-Node.md # Architecture Decision Records
|
||||
```
|
||||
|
||||
The new `secrets-manager.sh` combines the best features of both while adding robust error handling, installation management, and improved security.
|
||||
The main `secrets-manager.sh` script combines the best features of the legacy implementations while adding robust error handling, installation management, and improved security.
|
||||
|
||||
## Testing
|
||||
|
||||
This project includes a comprehensive test suite designed to work both standalone and when vendored into shell scripting frameworks.
|
||||
|
||||
### Running Tests
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
./tests/test-secrets-manager.sh run
|
||||
|
||||
# Run tests in CI mode (no colors)
|
||||
./tests/test-secrets-manager.sh --ci run
|
||||
|
||||
# Using Make (recommended)
|
||||
make test # Run all tests
|
||||
make test-ci # Run in CI mode
|
||||
make lint # Run shellcheck
|
||||
make all # Run deps, lint, and tests
|
||||
```
|
||||
|
||||
### Test Coverage
|
||||
|
||||
The test suite covers:
|
||||
- Script existence and permissions
|
||||
- Command-line argument parsing
|
||||
- Help and version output
|
||||
- Error handling and exit codes
|
||||
- Configuration file validation
|
||||
- Bitwarden CLI dependency checks
|
||||
- Performance and startup time
|
||||
- Vendor integration compatibility
|
||||
|
||||
### Vendor Integration Testing
|
||||
|
||||
When this project is vendored into other shell scripting frameworks:
|
||||
|
||||
```bash
|
||||
# Test as vendored dependency
|
||||
make vendor-test
|
||||
|
||||
# Or manually
|
||||
mkdir /tmp/vendor-test
|
||||
cp secrets-manager.sh tests/test-secrets-manager.sh config/bitwarden-config.conf.sample /tmp/vendor-test/
|
||||
cd /tmp/vendor-test && ./test-secrets-manager.sh --ci run
|
||||
```
|
||||
|
||||
### Development Testing
|
||||
|
||||
```bash
|
||||
# Setup development environment
|
||||
make dev-setup
|
||||
|
||||
# Run tests with development config
|
||||
make dev-test
|
||||
```
|
||||
|
||||
## Architecture Decision Records
|
||||
|
||||
This project includes ADRs for key architectural decisions:
|
||||
|
||||
- **ADR-001**: [Node.js Version Management Strategy](docs/ADR-Node.md) - Analysis of MISE vs system packages for Node.js version management
|
||||
|
||||
## Contributing
|
||||
|
||||
When contributing to this project:
|
||||
|
||||
1. Test all changes thoroughly
|
||||
2. Update documentation as needed
|
||||
3. Follow existing code style and conventions
|
||||
4. Ensure security best practices are maintained
|
||||
1. **Test all changes thoroughly**:
|
||||
```bash
|
||||
make ci # Run full CI pipeline
|
||||
```
|
||||
|
||||
2. **Update documentation as needed**
|
||||
3. **Follow existing code style and conventions**
|
||||
4. **Run security checks**:
|
||||
```bash
|
||||
make security-check
|
||||
```
|
||||
|
||||
5. **Ensure compatibility with vendor integration**:
|
||||
```bash
|
||||
make vendor-test
|
||||
```
|
||||
|
||||
## Development Commands
|
||||
|
||||
```bash
|
||||
make help # Show all available commands
|
||||
make install # Install dependencies
|
||||
make dev-setup # Setup development environment
|
||||
make lint # Run shellcheck
|
||||
make security-check # Basic security validation
|
||||
make clean # Clean temporary files
|
||||
make docs # Generate documentation
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
|
Reference in New Issue
Block a user