DEV Community

Cover image for Building env-doctor with GitHub Copilot CLI
Lewis Sawe
Lewis Sawe Subscriber

Posted on

Building env-doctor with GitHub Copilot CLI

GitHub Copilot CLI Challenge Submission

This is a submission for the GitHub Copilot CLI Challenge

What I Built

I built env-doctor, a CLI tool that automatically checks if your local environment matches what your project expects. You know that frustrating moment when you clone a project and spend an hour figuring out why it won't run? Usually it's missing Node versions, environment variables, or services that weren't mentioned clearly in the README. This tool solves that.

It scans your project files - package.json, Dockerfile, docker-compose.yml, README, CI configs, and more - then extracts what the project actually needs. After that, it checks your local setup and gives you a clear checklist of what's working and what needs fixing. Instead of hunting through documentation, you get a direct report: "Node.js ✅, Docker ✅, PostgreSQL ❌ not running, DATABASE_URL ❌ missing."

The tool covers runtime versions, package managers, databases, services, environment variables, and port availability. It works with Node.js, Python, Go projects and gives you actionable suggestions for fixing issues. There's also JSON output for CI pipelines and a verbose mode that explains everything it found.

Demo

The tool is available at github.com/env-doctor with a comprehensive example project that demonstrates all features.

Env-Doctor

Here's what happens when you run it on a complex project:

$ env-doctor --verbose

env-doctor - Analyzing project environment...

Runtime Versions:
✅ Node.js 18.17.0 (required: >=18.0.0)
✅ Docker running (v24.0.7)
❌ Python 3.8.10 (required: >=3.9.0)

Services:
❌ redis not found
✅ PostgreSQL accessible on port 5432

Environment Variables:
❌ DATABASE_URL environment variable not set
❌ JWT_SECRET environment variable not setNODE_ENV=development

📊 Results: 4/8 checks passed (4 failed)
❌ Environment needs attention

 Next steps:
1. Update Python to >=3.9.0
2. Install and start redis
3. Set DATABASE_URL environment variable
4. Set JWT_SECRET environment variable
Enter fullscreen mode Exit fullscreen mode

Runtime and services

The example project I included shows off the tool's capabilities with a realistic full-stack application. It has Node.js, Python, and Go services, multiple databases, complex Docker setup, and tons of environment variables. When you run env-doctor on it, you get 13/59 checks passing, which perfectly demonstrates how the tool handles complex real-world projects.

I also built a simple demo script that explains what each file type contributes to the analysis. You can clone the repo and run cd example-project && ./demo.sh to see everything in action.

My Experience with GitHub Copilot CLI

Using GitHub Copilot CLI completely changed how I approached this project. Instead of writing code bit by bit, I could focus on the bigger picture and let Copilot handle the implementation details.

The most helpful part was how Copilot understood context across multiple files. When I described the file parsing requirements, it generated parsers for package.json, Dockerfile, docker-compose.yml, and CI configs all at once. Each parser was tailored to extract the right information - Node versions from package.json, base images from Dockerfiles, services from docker-compose files.

What impressed me was how it handled the environment checking logic. I explained that I needed to verify Node versions, check if Docker is running, test database connectivity, and validate environment variables. Copilot created a comprehensive checking system with proper error handling and meaningful status messages.

The CLI also helped with the user experience aspects I hadn't initially planned. It suggested adding colored output with emoji indicators, a verbose mode for detailed explanations, JSON output for CI integration, and helpful suggestions for fixing issues. These weren't things I explicitly asked for, but Copilot recognized they would make the tool more useful.

Testing was another area where Copilot excelled. It created unit tests for individual components and an integration test that builds a temporary project structure to verify everything works together. The test coverage caught several edge cases I would have missed.

The most significant impact was being able to iterate quickly on complex features. When I wanted to add support for Python projects, Copilot immediately understood I needed requirements.txt and pyproject.toml parsers, Python version checking, and pip availability tests. What would have taken me hours of research and implementation happened in minutes.

Copilot also helped with the example project creation. I described wanting a comprehensive test case, and it built a realistic social media application with multiple languages, databases, microservices, and CI/CD pipelines. This wasn't just a toy example - it's the kind of complex project where env-doctor actually provides value.

The experience showed me how AI tools can handle the mechanical aspects of programming while leaving the creative and strategic decisions to the human developer. I focused on the problem design and user experience while Copilot handled the implementation patterns, error cases, and integration detail

Top comments (0)