@elvatis_com/failprompt
v0.1.0
Published
Parse CI failure logs and generate ready-to-paste AI prompts - in one command.
Maintainers
Readme
failprompt
Parse CI failure logs and generate ready-to-paste AI prompts, in one command.
npx @elvatis_com/failprompt
# → prints a structured LLM-ready prompt to stdout, ready for Claude / ChatGPT / CopilotThe Problem
Every developer using AI has done this manually:
- CI fails on GitHub Actions or GitLab CI
- Open the run, scroll through 200 lines of logs
- Copy the relevant error
- Paste into Claude: "what's wrong with this?"
- Paste the relevant file
- Get the fix
failprompt automates steps 2-5.
Prerequisites
- Node.js 18+ (LTS recommended)
- GitHub CLI (
gh): installed and authenticated (for GitHub Actions) - GitLab CLI (
glab): installed and authenticated (for GitLab CI)
# GitHub CLI
brew install gh # macOS
sudo apt install gh # Linux (or follow https://cli.github.com/manual/installation)
gh auth login
# GitLab CLI
brew install glab # macOS
sudo apt install glab # Linux (or follow https://gitlab.com/gitlab-org/cli)
glab auth loginInstallation
# Global install
npm install -g @elvatis_com/failprompt
# Or run directly without installing
npx @elvatis_com/failpromptUsage
# Auto-detect latest failed run on current branch (GitHub Actions)
failprompt
# Specific GitHub Actions run ID
failprompt --run 1234567890
# GitLab CI - auto-detect latest failed pipeline
failprompt --provider gitlab
# GitLab CI - specific pipeline ID
failprompt --pipeline 98765
# Different repo
failprompt --repo owner/repo
# Write prompt to file instead of stdout
failprompt --output prompt.md
# Skip source file context extraction
failprompt --no-context
# Verbose debug output (sent to stderr)
failprompt --verbose
# Pipe to clipboard (macOS)
failprompt | pbcopy
# Pipe to clipboard (Linux)
failprompt | xclip -selection clipboard
# Pipe to clipboard (Windows)
failprompt | clipFlags
| Flag | Short | Description |
|------|-------|-------------|
| --run <id> | -r | Specific GitHub Actions run ID |
| --pipeline <id> | -p | Specific GitLab CI pipeline ID |
| --provider <type> | -P | CI provider: github, gitlab, auto (default: auto) |
| --repo <owner/repo> | -R | Repository (default: git remote origin) |
| --output <file> | -o | Write prompt to file |
| --no-context | | Skip git source context extraction |
| --verbose | -v | Print debug info to stderr |
| --version | -V | Output version number |
| --help | | Show help |
How It Works
- Auto-detects CI provider (GitHub Actions or GitLab CI) from environment variables or log content
- Fetches the failed log via
gh(GitHub) orglab(GitLab) CLI - For GitLab, normalizes section markers (
section_start/section_end) to a common format - Strips ANSI codes and timestamps from raw output
- Detects error lines via
##[error]markers,ERROR: Job failed, and fallbacks forError:,npm ERR!,FAILED,ENOENT,SyntaxError:, and more - Finds the failing step/section name
- Extracts the relevant +/-30-line error context block
- If a file path is referenced in the error, reads +/-20 lines from that file
- Outputs a structured Markdown prompt optimized for LLMs
Output Format
## CI Failure - owner/repo / branch
**Run:** <run-id>
**Failing step:** <step-name>
### All Errors
- ##[error]Process completed with exit code 1.
### ErrorSource Context
<relevant file snippet>Task
Fix the error above. Explain what caused it and provide the corrected code.
---
## ⚠️ AAHP Case Study
> **This project is a public demonstration of the [AAHP Protocol](https://github.com/homeofe/AAHP).**
>
> It was built end-to-end by a multi-agent pipeline (Sonar → Opus → Sonnet → Review → Fix)
> with no manual code writing. Every decision is documented in `.ai/handoff/LOG.md`.
>
> The goal is to show how AAHP enables autonomous, auditable, multi-agent software development
>, not just as a concept, but as a working repository you can clone and inspect.
>
> Read the handoff files to see exactly what each agent decided and why:
> - [`.ai/handoff/STATUS.md`](.ai/handoff/STATUS.md), current build state
> - [`.ai/handoff/LOG.md`](.ai/handoff/LOG.md), full agent journal
> - [`.ai/handoff/NEXT_ACTIONS.md`](.ai/handoff/NEXT_ACTIONS.md), task queue
---
## License
MIT