This is a submission for the GitHub Copilot CLI Challenge
What I Built
Contextual Ghost (CG) is a CLI-based "survival agent" designed for developers and DevOps engineers who want to eliminate the tedious "Error -> Copy -> Search -> Fix" cycle.
Ghost acts as a transparent wrapper for any terminal command. It stays quiet in the shadows while your commands succeed, but the moment a process fails (exit code != 0), it manifests instantly. It automatically harvests your current Git state (diffs and logs), environment variables, and error logs, then sends this rich context to GitHub Copilot CLI to provide a surgically accurate explanation and a specific fix—all without you ever leaving the terminal.
Demo
The project is hosted on GitHub: Bzaid94/contextual-ghost
How it looks in action:
When a command fails, Ghost transforms your terminal into an interactive analysis hub:
- Context Harvesting: Ghost gathers recent changes and intent.
- AI Analysis: Consults Copilot with full local context.
-
Elegant UI: Displays the solution using a refined, fuchsia-themed interface powered by
bubbletea.
# Example of failure manifestation:
./contextual-ghost ls /nonexistent-directory
My Experience with GitHub Copilot CLI
Building Contextual Ghost allowed me to see the GitHub Copilot CLI not just as a tool, but as an API-first engine for developer productivity.
Integrating the CLI into a Go sub-process was seamless. By using the gh copilot command as our "Brain," we were able to provide answers that are significantly more accurate than a standard AI prompt, because we feed it the actual environment state (the "Context" in Contextual Ghost).
The impact on development experience is massive: instead of guessing why a build failed, you have an agent that's already read your git diff and figured it out for you. It turns every error into a learning moment.
🚀 Getting Started
Installation
You can install Contextual Ghost via Go:
go install github.com/Bzaid94/contextual-ghost@latest
Or download the pre-compiled binaries from the Releases page.
Usage
Simply prefix any command with ghost (alias for contextual-ghost):
ghost npm run build
ghost go build ./...
ghost terraform apply
If the command succeeds: Silence.
If the command fails: Salvation.
Built with ❤️ and 👻 by @Bzaid94.
Top comments (0)