DEV Community

Cover image for Operational Intelligence for the Command Line
Seshan Pillay
Seshan Pillay

Posted on

Operational Intelligence for the Command Line

GitHub Copilot CLI Challenge Submission

This is a submission for the GitHub Copilot CLI Challenge

What I Built 🚀

Introducing OpsPilot: an AI Incident Commander for the terminal, designed for real SRE incident workflows.

OpsPilot is a Node.js CLI that helps teams:

  • analyze logs (opspilot analyze) 🔎
  • suggest next diagnostic commands with safety classification (SAFE, CAUTION, DANGEROUS) (opspilot suggest) 🛡️
  • generate incident timelines from shell history, git commits, and logs (opspilot timeline) 🕒
  • draft structured postmortems (opspilot postmortem) 📝

The tool is recommendation-only and never auto-executes commands. It includes strict command safety checks and graceful fallback behavior when Copilot CLI is unavailable.

Demo 🎬

Suggested demo flow:

  1. opspilot init --environment kubernetes --service payments-api --namespace prod
  2. opspilot analyze examples/sample-incident.log
  3. opspilot suggest
  4. opspilot timeline --log examples/sample-incident.log
  5. opspilot postmortem

Terminal Output Examples 💻

opspilot analyze examples/sample-incident.log

- Reading incident log...
✔ Log loaded.
- Asking GitHub Copilot CLI for incident analysis...
✔ Analysis received from Copilot CLI.

Incident Analysis
------------------------------------------------------------
## Incident Summary
...

## Likely Root Causes (ranked)
1. ...
2. ...

[OK] Saved analysis to /path/to/repo/.incident/analysis.md
Enter fullscreen mode Exit fullscreen mode

opspilot suggest

- Reading shell history...
✔ Loaded 250 history entries.
- Asking GitHub Copilot CLI for command suggestions...
✔ Suggestions received from Copilot CLI.

Copilot Suggestions
------------------------------------------------------------
## Recommended Checks
- `kubectl get pods -n prod`
- `kubectl logs deploy/payments-api -n prod --tail=200`

Safety Classification
------------------------------------------------------------
[SAFE] kubectl get pods -n prod
[SAFE] kubectl logs deploy/payments-api -n prod --tail=200
[INFO] OpsPilot only recommends commands. It never executes them.
Enter fullscreen mode Exit fullscreen mode

My Experience with GitHub Copilot CLI 🤖

I used GitHub Copilot CLI as the core reasoning engine for OpsPilot, not just a helper.

Key integrations:

runCopilotAsk(prompt) for deep incident analysis and postmortem drafting runCopilotSuggest(prompt) for next diagnostic command recommendations structured prompts that force useful Markdown output for incident response workflows

What stood out:
Copilot CLI made it much faster to turn raw logs/history into actionable incident guidance. Prompt quality mattered a lot; structured prompts produced consistently better, safer output.
Building robust wrapper logic around Copilot CLI (timeouts, command-format compatibility, auth failure handling) was essential for production-like reliability. Overall, Copilot CLI significantly reduced context-switching and accelerated my iteration loop while building a practical terminal-first SRE tool. 🎉

Top comments (0)