analyze-build

analyze-build is a command for Claude Code from sapientpants/deepsource-mcp-server. It costs 0 tokens per session (1,956 once invoked), scanned A, original, MIT.

A command that examines a GitHub Actions workflow run, which is an automated build or test job, and explains why it failed. It can inspect the latest run or a run chosen by branch, workflow, pull request, or run ID.

In plain words
What is it for?
Investigating broken builds, failed tests, recurring failure patterns, possible flaky tests, and the likely root cause of a GitHub Actions run.
Why use it?
Failed builds often contain many logs and errors, making the real cause hard to find. This command gathers the relevant failures, messages, timing, commits, and pull-request context into one analysis.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/sapientpants/deepsource-mcp-server/analyze-build
Clone the repo
git clone --depth 1 https://github.com/sapientpants/deepsource-mcp-server

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for analyze-build

README.md
[![agentmods](https://agentmods.dev/badge/commands/sapientpants/deepsource-mcp-server/analyze-build.svg)](https://agentmods.dev/commands/sapientpants/deepsource-mcp-server/analyze-build)
Your own site
<a href="https://agentmods.dev/commands/sapientpants/deepsource-mcp-server/analyze-build"><img src="https://agentmods.dev/badge/commands/sapientpants/deepsource-mcp-server/analyze-build.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,956 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01956
Opus 5 $0.00000 $0.00978
Sonnet 5 $0.00000 $0.00391
Haiku 4.5 $0.00000 $0.00196

Measured 4d ago against content hash bf1f508b379b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

analyze-build scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/analyze-build.md · 378 lines

How it starts

The opening of the file, as written. The whole thing — 378 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Analyze GitHub Actions Build

Analyzes a GitHub Actions build to identify failures and their root causes. By default, examines the latest build on the main branch, but you can specify a different run.

Usage

/analyze-build [options]

Options

  • --run-id <id>: Analyze a specific workflow run by ID
  • --branch <name>: Analyze the latest run from a specific branch (default: main)
  • --workflow <name>: Specify which workflow to analyze (default: checks all)
  • --pr <number>: Analyze the latest run for a specific PR

Process

  1. Identify Target Build

    • Default: Latest workflow run on main branch
    • Or use provided run ID, branch, PR, or workflow name
  2. Gather Build Information

    • Workflow run status and conclusion
    • Failed jobs and steps
    • Error logs and annotations
    • Timing information
    • Related commits and PRs
  3. Analyze Failures

    • Parse error messages and stack traces
    • Identify failure patterns
    • Categorize error types
    • Determine root causes
    • Check for flaky test indicators
  4. Generate Report

    • Executive summary
    • Detailed failure analysis
    • Root cause identification
    • Suggested fixes
    • Historical context (if available)

Analysis Categories

1. Test Failures

  • Unit test failures
  • Integration test failures
  • E2E test failures
  • Flaky tests
  • Timeout issues

2. Build Errors

  • Compilation errors
  • TypeScript errors
  • Dependency resolution issues
  • Missing dependencies
  • Version conflicts

3. Linting/Formatting

  • ESLint violations
  • Prettier formatting issues
  • Commit message format
  • Markdown linting
  • YAML validation

4. Infrastructure Issues

  • Runner problems
  • Network failures
  • API rate limits
  • Token/permission issues
  • Resource exhaustion

5. Deployment Failures

  • Docker build issues
  • Registry push failures
  • Security scan violations
  • Release creation problems

Implementation Steps

# 1. Get the target workflow run
echo "🔍 Identifying target build..."

# Default: latest run on main
if [ -z "$RUN_ID" ]; then
  if [ -n "$PR_NUMBER" ]; then
    # Get latest run for PR
    RUN_ID=$(gh pr checks $PR_NUMBER --json statusCheckRollup --jq '.statusCheckRollup[0].workflowRun.databaseId')
  elif [ -n "$WORKFLOW_NAME" ]; then
    # Get latest run for specific workflow
    RUN_ID=$(gh run list --workflow="$WORKFLOW_NAME" --branch="${BRANCH:-main}" --limit=1 --json databaseId --jq '.[0].databaseId')
  else
    # Get latest run on branch
    RUN_ID=$(gh run list --branch="${BRANCH:-main}" --limit=1 --json databaseId --jq '.[0].databaseId')
  fi
fi

# 2. Fetch run details
echo "📊 Fetching run details for #$RUN_ID..."
gh run view $RUN_ID --json status,conclusion,name,workflowName,event,headBranch,headSha

# 3. Get failed jobs
echo "❌ Identifying failed jobs..."
gh run view $RUN_ID --json jobs --jq '.jobs[] | select(.conclusion == "failure")'

# 4. Fetch logs for failed jobs
echo "📝 Analyzing failure logs..."
gh run view $RUN_ID --log-failed

# 5. Get annotations (errors/warnings)
echo "📌 Checking annotations..."
gh api /repos/{owner}/{repo}/check-runs --jq '.check_runs[].output.annotations[]'

Read the full file on GitHub · 378 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 378 lines · 0 tokens per session scan A bf1f508b379b

Subscribe to this mod's changes

analyze-build is a command published in the GitHub repository sapientpants/deepsource-mcp-server (7 stars, last pushed 10mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,956 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.