|
| 1 | +<div align="center"> |
| 2 | + |
| 3 | +# KaririCode DevKit |
| 4 | + |
| 5 | +[](https://www.php.net) |
| 6 | +[](https://www.docker.com) |
| 7 | +[](https://www.gnu.org/software/make/) |
| 8 | +[](LICENSE) |
| 9 | + |
| 10 | +**Professional development environment for KaririCode Framework components** |
| 11 | + |
| 12 | +[Website](https://kariricode.org) | [Documentation](https://kariricode.org/docs) | [GitHub](https://github.com/KaririCode-Framework/kariricode-devkit) |
| 13 | + |
| 14 | +</div> |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## 📚 Documentation Index |
| 19 | + |
| 20 | +| Document | Scope | Makefile Modules | |
| 21 | +|----------|-------|------------------| |
| 22 | +| **[Setup & Installation](MAKEFILE-setup.md)** | Dependency management, environment setup | `Makefile.setup.mk` | |
| 23 | +| **[Quality Assurance](MAKEFILE-qa.md)** | Testing, linting, static analysis | `Makefile.qa.mk` | |
| 24 | +| **[CI/CD Pipelines](MAKEFILE-pipeline.md)** | Orchestrated workflows, pre-commit hooks | `Makefile.orchestration.mk` | |
| 25 | +| **[Development Helpers](MAKEFILE-helpers.md)** | Benchmarks, git hooks, release management | `Makefile.helpers.mk` | |
| 26 | +| **[Docker Commands](MAKEFILE-docker.md)** | Docker execution, isolated environments | `Makefile.docker-*.mk` | |
| 27 | +| **[Docker Compose](MAKEFILE-compose.md)** | Full stack environment management | `Makefile.docker-compose.mk` | |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## 🚀 Quick Start |
| 32 | + |
| 33 | +### First Time Setup |
| 34 | +```bash |
| 35 | +# 1. Check prerequisites |
| 36 | +make check-php # Verify PHP 8.4+ |
| 37 | + |
| 38 | +# 2. Install dependencies |
| 39 | +make install # Production dependencies |
| 40 | +make install-dev # + Development tools |
| 41 | + |
| 42 | +# 3. Verify installation |
| 43 | +make info # Show environment info |
| 44 | +``` |
| 45 | + |
| 46 | +### Daily Development Workflow |
| 47 | +```bash |
| 48 | +# Local development |
| 49 | +make format # Auto-fix code style |
| 50 | +make test # Run tests |
| 51 | +make analyse # Static analysis |
| 52 | + |
| 53 | +# Docker environment |
| 54 | +make up # Start services |
| 55 | +make test-compose # Integration tests |
| 56 | +make down # Stop services |
| 57 | +``` |
| 58 | + |
| 59 | +### CI/CD Integration |
| 60 | +```bash |
| 61 | +# Fast CI (1-2 min) |
| 62 | +make ci # Essential checks |
| 63 | + |
| 64 | +# Full CI (3-5 min) |
| 65 | +make ci-full # Complete validation |
| 66 | + |
| 67 | +# Docker CI (isolated) |
| 68 | +make docker-ci # Consistent environment |
| 69 | +``` |
| 70 | + |
| 71 | +--- |
| 72 | + |
| 73 | +## 📖 Architecture Overview |
| 74 | + |
| 75 | +### Module Organization |
| 76 | +``` |
| 77 | +.make/ |
| 78 | +├── core/ # 🔧 Shared infrastructure |
| 79 | +│ ├── Makefile.variables.mk # Colors, paths, tools |
| 80 | +│ └── Makefile.functions.mk # Reusable shell functions |
| 81 | +│ |
| 82 | +├── local/ # 💻 Local development |
| 83 | +│ ├── Makefile.setup.mk # Install, update, clean |
| 84 | +│ ├── Makefile.qa.mk # Test, lint, analyse |
| 85 | +│ └── Makefile.helpers.mk # Bench, hooks, stats |
| 86 | +│ |
| 87 | +├── pipeline/ # 🔄 CI/CD workflows |
| 88 | +│ └── Makefile.orchestration.mk # Composed pipelines |
| 89 | +│ |
| 90 | +└── docker/ # 🐳 Docker execution |
| 91 | + ├── Makefile.docker-core.mk # Shell, composer, php |
| 92 | + ├── Makefile.docker-compose.mk # Service lifecycle |
| 93 | + ├── Makefile.docker-qa.mk # QA in containers |
| 94 | + ├── Makefile.docker-image.mk # Image management |
| 95 | + └── Makefile.docker-tools.mk # Utilities |
| 96 | +``` |
| 97 | + |
| 98 | +### Design Principles |
| 99 | + |
| 100 | +**Single Responsibility Principle (SRP)** |
| 101 | +- Each `.mk` file has one clear purpose |
| 102 | +- Setup ≠ QA ≠ Docker ≠ Pipeline |
| 103 | + |
| 104 | +**DRY (Don't Repeat Yourself)** |
| 105 | +- Shared logic in `core/Makefile.functions.mk` |
| 106 | +- Variables centralized in `core/Makefile.variables.mk` |
| 107 | + |
| 108 | +**Composability** |
| 109 | +- Complex workflows built from simple targets |
| 110 | +- `make ci` = lint + analyse + test |
| 111 | +- `make cd` = ci-full + bench + release prep |
| 112 | + |
| 113 | +**Flexibility** |
| 114 | +- Local execution: `make test` |
| 115 | +- Docker execution: `make docker-test` |
| 116 | +- Same interface, different environment |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +## 🎯 Command Categories |
| 121 | + |
| 122 | +### By Frequency |
| 123 | + |
| 124 | +**Every Commit** |
| 125 | +```bash |
| 126 | +make format # Auto-fix style |
| 127 | +make lint # Syntax check |
| 128 | +make test-unit # Fast tests |
| 129 | +``` |
| 130 | + |
| 131 | +**Before Push** |
| 132 | +```bash |
| 133 | +make ci # Full local CI |
| 134 | +make analyse # Deep static analysis |
| 135 | +``` |
| 136 | + |
| 137 | +**Weekly** |
| 138 | +```bash |
| 139 | +make update # Update dependencies |
| 140 | +make security # Security audit |
| 141 | +make outdated # Check for updates |
| 142 | +``` |
| 143 | + |
| 144 | +**Release** |
| 145 | +```bash |
| 146 | +make cd # Complete validation |
| 147 | +make tag VERSION=X.Y.Z # Create tag |
| 148 | +``` |
| 149 | + |
| 150 | +### By Environment |
| 151 | + |
| 152 | +**Local Machine** |
| 153 | +- Fast iteration |
| 154 | +- IDE integration |
| 155 | +- Custom configuration |
| 156 | + |
| 157 | +**Docker Container** |
| 158 | +- Isolated environment |
| 159 | +- Consistent results |
| 160 | +- CI/CD simulation |
| 161 | + |
| 162 | +**Docker Compose** |
| 163 | +- Full stack (PHP + Redis + Memcached) |
| 164 | +- Integration tests |
| 165 | +- Service dependencies |
| 166 | + |
| 167 | +--- |
| 168 | + |
| 169 | +## 📋 Command Reference |
| 170 | + |
| 171 | +### Essential Commands |
| 172 | +```bash |
| 173 | +# Help |
| 174 | +make help # Show all commands |
| 175 | +make <module>-help # Module-specific help |
| 176 | + |
| 177 | +# Setup |
| 178 | +make install # Install dependencies |
| 179 | +make clean # Clean artifacts |
| 180 | +make verify-install # Verify setup |
| 181 | + |
| 182 | +# Quality |
| 183 | +make test # Run tests |
| 184 | +make analyse # Static analysis |
| 185 | +make format # Auto-fix code |
| 186 | + |
| 187 | +# Pipelines |
| 188 | +make ci # Fast CI |
| 189 | +make ci-full # Complete CI |
| 190 | +make pre-commit # Quick checks |
| 191 | + |
| 192 | +# Docker |
| 193 | +make docker-ci # CI in Docker |
| 194 | +make up # Start compose |
| 195 | +make down # Stop compose |
| 196 | +``` |
| 197 | + |
| 198 | +### Getting Help |
| 199 | +```bash |
| 200 | +# General help |
| 201 | +make help |
| 202 | + |
| 203 | +# Module-specific |
| 204 | +make bench-help # Benchmark parameters |
| 205 | + |
| 206 | +# Debug |
| 207 | +make info # Environment info |
| 208 | +make debug-composer # Composer config |
| 209 | +make env-check # Docker env vars |
| 210 | +``` |
| 211 | + |
| 212 | +--- |
| 213 | + |
| 214 | +## 🔍 Troubleshooting |
| 215 | + |
| 216 | +### Quick Diagnostics |
| 217 | +```bash |
| 218 | +# Check environment |
| 219 | +make info # PHP, Composer, tools |
| 220 | +make check-php # PHP version check |
| 221 | + |
| 222 | +# Verify installation |
| 223 | +make verify-install # Check dependencies |
| 224 | + |
| 225 | +# Docker issues |
| 226 | +make docker-info # Docker environment |
| 227 | +make validate-compose # docker-compose.yml syntax |
| 228 | +make logs # Service logs |
| 229 | +``` |
| 230 | + |
| 231 | +### Common Issues |
| 232 | + |
| 233 | +| Issue | Quick Fix | Documentation | |
| 234 | +|-------|-----------|---------------| |
| 235 | +| Tests not executing | `export XDEBUG_MODE=off` | [MAKEFILE-qa.md](MAKEFILE-qa.md#troubleshooting) | |
| 236 | +| Port conflicts | Edit `.env`, change `APP_PORT` | [MAKEFILE-compose.md](MAKEFILE-compose.md#port-conflicts) | |
| 237 | +| Composer errors | `make debug-composer` | [MAKEFILE-setup.md](MAKEFILE-setup.md#troubleshooting) | |
| 238 | +| PHPStan errors | `make phpstan-baseline` | [MAKEFILE-qa.md](MAKEFILE-qa.md#static-analysis) | |
| 239 | + |
| 240 | +--- |
| 241 | + |
| 242 | +## 🎓 Learning Path |
| 243 | + |
| 244 | +### Beginner (Day 1) |
| 245 | + |
| 246 | +1. Read: [Setup & Installation](MAKEFILE-setup.md) |
| 247 | +2. Run: `make install && make info` |
| 248 | +3. Test: `make test` |
| 249 | + |
| 250 | +### Intermediate (Week 1) |
| 251 | + |
| 252 | +1. Read: [Quality Assurance](MAKEFILE-qa.md) |
| 253 | +2. Setup: `make git-hooks-setup` |
| 254 | +3. Practice: `make pre-commit` workflow |
| 255 | + |
| 256 | +### Advanced (Month 1) |
| 257 | + |
| 258 | +1. Read: [Docker Compose](MAKEFILE-compose.md) |
| 259 | +2. Setup: `make up` |
| 260 | +3. Integrate: `make test-compose` |
| 261 | + |
| 262 | +### Expert (Month 3) |
| 263 | + |
| 264 | +1. Read: [CI/CD Pipelines](MAKEFILE-pipeline.md) |
| 265 | +2. Customize: Add project-specific targets |
| 266 | +3. Optimize: Benchmark and tune |
| 267 | + |
| 268 | +--- |
| 269 | + |
| 270 | +## 🤝 Contributing |
| 271 | + |
| 272 | +### Adding New Targets |
| 273 | + |
| 274 | +1. **Choose the right module** |
| 275 | + - Setup related? → `Makefile.setup.mk` |
| 276 | + - Testing related? → `Makefile.qa.mk` |
| 277 | + - Docker related? → `Makefile.docker-*.mk` |
| 278 | + |
| 279 | +2. **Follow conventions** |
| 280 | +```makefile |
| 281 | + target-name: ## Description for help |
| 282 | + @echo "$(BLUE)→ Action...$(RESET)" |
| 283 | + # implementation |
| 284 | + @echo "$(GREEN)✓ Success$(RESET)" |
| 285 | +``` |
| 286 | + |
| 287 | +3. **Document in corresponding .md file** |
| 288 | + |
| 289 | +4. **Test locally and in Docker** |
| 290 | +```bash |
| 291 | + make target-name |
| 292 | + make docker-<target-name> # if applicable |
| 293 | +``` |
| 294 | + |
| 295 | +### Documentation Standards |
| 296 | + |
| 297 | +- Use **semantic organization** |
| 298 | +- Include **working examples** |
| 299 | +- Add **troubleshooting sections** |
| 300 | +- Maintain **consistent formatting** |
| 301 | +- Update **command reference tables** |
| 302 | + |
| 303 | +--- |
| 304 | + |
| 305 | +## 📞 Support |
| 306 | + |
| 307 | +### Resources |
| 308 | + |
| 309 | +- **Issues**: Found a bug? [Open an issue](https://github.com/KaririCode-Framework/kariricode-devkit/issues) |
| 310 | +- **Discussions**: Questions? [Start a discussion](https://github.com/KaririCode-Framework/kariricode-devkit/discussions) |
| 311 | +- **Documentation**: [Full documentation index](#-documentation-index) |
| 312 | + |
| 313 | +### Quick Links |
| 314 | + |
| 315 | +- [Prerequisites](MAKEFILE-setup.md#prerequisites) |
| 316 | +- [Installation Guide](MAKEFILE-setup.md#installation) |
| 317 | +- [Command Reference](#-command-reference) |
| 318 | +- [Troubleshooting](#-troubleshooting) |
| 319 | +- [Best Practices](MAKEFILE-pipeline.md#best-practices) |
| 320 | + |
| 321 | +--- |
| 322 | + |
| 323 | +**Version**: 1.0.0 |
| 324 | +**Maintainer**: Walmir Silva <walmir.silva@kariricode.org> |
0 commit comments