Thank you for your interest in contributing to Protocol. This document provides guidelines for contributing to this project.
Be respectful and constructive. We are building tools that organizations depend on for production deployments.
# Fork and clone the repository
git clone git@github.com:your-username/protocol.git
cd protocol
# Install dependencies
php bin/composer.phar install --ignore-platform-reqs
# Make the binary executable
chmod +x protocol
# Verify it works
./protocol -vprotocol/
├── protocol # CLI entry point
├── src/
│ ├── Commands/ # CLI commands (auto-registered)
│ │ └── Init/ # Project initializer classes
│ ├── Helpers/ # Domain logic (static methods)
│ └── Utils/ # Data persistence layer
├── bin/ # Shell scripts
├── config/ # Protocol's own configuration
├── templates/ # Template files for new projects
└── docs/ # Documentation
See docs/architecture.md for a detailed architecture overview.
All classes use the Gitcd\ namespace (PSR-4 mapped to src/). This is a legacy name — use it for consistency with existing code.
- Use the appropriate issue template
- For security vulnerabilities, follow the process in SECURITY.md
- Fork the repository and create a feature branch from
master - Make your changes following the coding standards below
- Test your changes locally against a real git repository
- Submit a pull request using the PR template
- Fill out the PR template completely, including the security checklist
- Ensure your changes don't break existing commands
- Update documentation in
docs/if you change command behavior or add features - A maintainer will review your PR and may request changes
- Follow PSR-12 coding style
- Use type hints where possible
- Keep methods focused — one responsibility per method
- Use meaningful variable and method names
These are non-negotiable for all contributions:
- Shell commands: Always use
escapeshellarg()for variables interpolated into shell commands - File paths: Validate that resolved paths stay within expected directories
- User input: Sanitize all input from CLI arguments, options, and interactive prompts
- No debug code: Never commit
var_dump(),print_r(),die(), ordd()statements - No credentials: Never hardcode or commit secrets, tokens, passwords, or API keys
- Error handling: Handle errors gracefully — don't suppress errors with
@operator without good reason
When adding new commands:
- Place the file in
src/Commands/(it will be auto-registered) - Extend
Symfony\Component\Console\Command\Command - Set
$defaultNameand$defaultDescription - Use the
--diroption pattern for directory specification (default toGit::getGitLocalFolder()) - Add help text via
setHelp() - Return
Command::SUCCESSorCommand::FAILURE - Document the command in
docs/commands.md
When modifying or adding helpers:
- All methods should be
static - Delegate shell execution to
Shell::run()orShell::passthru() - Handle missing dependencies gracefully (check if files/directories exist before operating)
- Return meaningful values — avoid returning
voidwhen a success/failure indicator is useful
Protocol does not currently have an automated test suite. When testing your changes:
- Test against a real git repository with a remote
- Test both with and without
protocol.jsonpresent - Test both with and without a config repository
- Test with and without Docker installed
- Verify
protocol statusreports correctly after your changes
If you're adding automated tests, we welcome PHPUnit-based test suites.
- Update
docs/commands.mdwhen adding or changing commands - Update
docs/configuration.mdwhen changing config schema - Update
docs/architecture.mdwhen changing system design - Update
docs/security.mdwhen changes have security implications - Keep documentation factual and concise
Protocol uses semantic versioning. The current version is defined in the protocol entry point file.
- Patch (0.3.x): Bug fixes, security patches
- Minor (0.x.0): New features, non-breaking changes
- Major (x.0.0): Breaking changes
By contributing, you agree that your contributions will be licensed under the MIT License.