{"id":46126116,"url":"https://github.com/elvatis/failprompt","last_synced_at":"2026-03-02T02:16:26.666Z","repository":{"id":339732423,"uuid":"1163170441","full_name":"elvatis/failprompt","owner":"elvatis","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-27T19:50:33.000Z","size":214,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-27T20:44:06.011Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elvatis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-21T07:45:03.000Z","updated_at":"2026-02-27T19:50:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/elvatis/failprompt","commit_stats":null,"previous_names":["homeofe/failprompt","elvatis/failprompt"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/elvatis/failprompt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvatis%2Ffailprompt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvatis%2Ffailprompt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvatis%2Ffailprompt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvatis%2Ffailprompt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elvatis","download_url":"https://codeload.github.com/elvatis/failprompt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvatis%2Ffailprompt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29987827,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T22:42:38.399Z","status":"ssl_error","status_checked_at":"2026-03-01T22:41:51.863Z","response_time":124,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-03-02T02:16:26.166Z","updated_at":"2026-03-02T02:16:26.650Z","avatar_url":"https://github.com/elvatis.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# failprompt\n\n\u003e **Parse CI failure logs and generate ready-to-paste AI prompts, in one command.**\n\n```bash\nnpx @elvatis_com/failprompt\n# → prints a structured LLM-ready prompt to stdout, ready for Claude / ChatGPT / Copilot\n```\n\n---\n\n## The Problem\n\nEvery developer using AI has done this manually:\n\n1. CI fails on GitHub Actions or GitLab CI\n2. Open the run, scroll through 200 lines of logs\n3. Copy the relevant error\n4. Paste into Claude: *\"what's wrong with this?\"*\n5. Paste the relevant file\n6. Get the fix\n\n`failprompt` automates steps 2-5.\n\n---\n\n## Prerequisites\n\n- **Node.js** 18+ (LTS recommended)\n- **[GitHub CLI (`gh`)](https://cli.github.com)**: installed and authenticated (for GitHub Actions)\n- **[GitLab CLI (`glab`)](https://gitlab.com/gitlab-org/cli)**: installed and authenticated (for GitLab CI)\n\n```bash\n# GitHub CLI\nbrew install gh        # macOS\nsudo apt install gh    # Linux (or follow https://cli.github.com/manual/installation)\ngh auth login\n\n# GitLab CLI\nbrew install glab      # macOS\nsudo apt install glab  # Linux (or follow https://gitlab.com/gitlab-org/cli)\nglab auth login\n```\n\n---\n\n## Installation\n\n```bash\n# Global install\nnpm install -g @elvatis_com/failprompt\n\n# Or run directly without installing\nnpx @elvatis_com/failprompt\n```\n\n---\n\n## Usage\n\n```bash\n# Auto-detect latest failed run on current branch (GitHub Actions)\nfailprompt\n\n# Specific GitHub Actions run ID\nfailprompt --run 1234567890\n\n# GitLab CI - auto-detect latest failed pipeline\nfailprompt --provider gitlab\n\n# GitLab CI - specific pipeline ID\nfailprompt --pipeline 98765\n\n# Different repo\nfailprompt --repo owner/repo\n\n# Write prompt to file instead of stdout\nfailprompt --output prompt.md\n\n# Skip source file context extraction\nfailprompt --no-context\n\n# Verbose debug output (sent to stderr)\nfailprompt --verbose\n\n# Pipe to clipboard (macOS)\nfailprompt | pbcopy\n\n# Pipe to clipboard (Linux)\nfailprompt | xclip -selection clipboard\n\n# Pipe to clipboard (Windows)\nfailprompt | clip\n```\n\n### Flags\n\n| Flag | Short | Description |\n|------|-------|-------------|\n| `--run \u003cid\u003e` | `-r` | Specific GitHub Actions run ID |\n| `--pipeline \u003cid\u003e` | `-p` | Specific GitLab CI pipeline ID |\n| `--provider \u003ctype\u003e` | `-P` | CI provider: `github`, `gitlab`, `auto` (default: auto) |\n| `--repo \u003cowner/repo\u003e` | `-R` | Repository (default: git remote origin) |\n| `--output \u003cfile\u003e` | `-o` | Write prompt to file |\n| `--no-context` | | Skip git source context extraction |\n| `--verbose` | `-v` | Print debug info to stderr |\n| `--version` | `-V` | Output version number |\n| `--help` | | Show help |\n\n---\n\n## How It Works\n\n1. Auto-detects CI provider (GitHub Actions or GitLab CI) from environment variables or log content\n2. Fetches the failed log via `gh` (GitHub) or `glab` (GitLab) CLI\n3. For GitLab, normalizes section markers (`section_start`/`section_end`) to a common format\n4. Strips ANSI codes and timestamps from raw output\n5. Detects error lines via `##[error]` markers, `ERROR: Job failed`, and fallbacks for `Error:`, `npm ERR!`, `FAILED`, `ENOENT`, `SyntaxError:`, and more\n6. Finds the failing step/section name\n7. Extracts the relevant +/-30-line error context block\n8. If a file path is referenced in the error, reads +/-20 lines from that file\n9. Outputs a structured Markdown prompt optimized for LLMs\n\n---\n\n## Output Format\n\n```markdown\n## CI Failure - owner/repo / branch\n**Run:** \u003crun-id\u003e\n**Failing step:** \u003cstep-name\u003e\n\n### All Errors\n- ##[error]Process completed with exit code 1.\n\n### Error\n```\n\u003cerror context block\u003e\n```\n\n### Source Context\n```ts\n\u003crelevant file snippet\u003e\n```\n\n### Task\nFix the error above. Explain what caused it and provide the corrected code.\n```\n\n---\n\n## ⚠️ AAHP Case Study\n\n\u003e **This project is a public demonstration of the [AAHP Protocol](https://github.com/homeofe/AAHP).**\n\u003e\n\u003e It was built end-to-end by a multi-agent pipeline (Sonar → Opus → Sonnet → Review → Fix)\n\u003e with no manual code writing. Every decision is documented in `.ai/handoff/LOG.md`.\n\u003e\n\u003e The goal is to show how AAHP enables autonomous, auditable, multi-agent software development\n\u003e, not just as a concept, but as a working repository you can clone and inspect.\n\u003e\n\u003e Read the handoff files to see exactly what each agent decided and why:\n\u003e - [`.ai/handoff/STATUS.md`](.ai/handoff/STATUS.md), current build state\n\u003e - [`.ai/handoff/LOG.md`](.ai/handoff/LOG.md), full agent journal\n\u003e - [`.ai/handoff/NEXT_ACTIONS.md`](.ai/handoff/NEXT_ACTIONS.md), task queue\n\n---\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felvatis%2Ffailprompt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felvatis%2Ffailprompt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felvatis%2Ffailprompt/lists"}