Skip to content

feat(report): add triage report command#20

Open
mvanhorn wants to merge 1 commit intopwrdrvr:mainfrom
mvanhorn:osc/feat-triage-report
Open

feat(report): add triage report command#20
mvanhorn wants to merge 1 commit intopwrdrvr:mainfrom
mvanhorn:osc/feat-triage-report

Conversation

@mvanhorn
Copy link

Summary

Add a ghcrawl triage owner/repo command that generates a markdown triage report from existing cluster data. Local-only, no API calls required.

Why

ghcrawl clusters related issues/PRs, but there is no way to generate a standalone triage report that a maintainer can read, share, or hand to an agent. The SPEC lists "maintainer triage" as a goal. This fills that gap.

The report includes:

  • Data freshness indicators (last sync, embed, cluster dates)
  • Top clusters by size as a sortable table
  • Suggested actions based on simple heuristics (close duplicates, investigate growth, stale clusters)

Changes

File What changed
packages/api-core/src/report/triage.ts New module: generateSuggestedActions() and formatTriageMarkdown()
packages/api-core/src/report/triage.test.ts 4 tests: action generation, no-action case, markdown formatting, stale threshold
packages/api-core/src/service.ts generateTriageReport() method using existing listClusterSummaries()
packages/api-core/src/api/server.ts GET /triage route with format=markdown support
apps/cli/src/main.ts triage command with --json, --limit, --min-size flags
packages/api-core/src/index.ts Re-export report module

Usage

# Markdown report to stdout (default)
ghcrawl triage owner/repo

# JSON for agent consumption
ghcrawl triage owner/repo --json

# Customize scope
ghcrawl triage owner/repo --limit 10 --min-size 5

# HTTP API
GET /triage?owner=X&repo=Y                     # JSON
GET /triage?owner=X&repo=Y&format=markdown      # Markdown

Suggested actions heuristics

  • close_duplicates: Cluster has >= 5 members, all issues (no PRs)
  • investigate_growth: Cluster has >= 6 members with activity in the last 7 days
  • stale_cluster: Cluster's latestUpdatedAt is > 30 days ago with >= 3 open members

Testing

  • pnpm build passes
  • 4 new tests pass (action generation, empty case, markdown formatting, stale threshold boundary)
  • 2 pre-existing config test failures on main are unrelated

The generateSuggestedActions() function in report/triage.ts:18 and the formatTriageMarkdown() formatter in report/triage.ts:62 are pure functions that operate on the existing ClusterSummaryDto contract. The service method at service.ts:1474 reuses listClusterSummaries() with sort: 'size' to avoid duplicating query logic.

This contribution was developed with AI assistance (Claude Code + Codex).

Add ghcrawl triage command that generates markdown triage reports from
existing cluster data. Reports include top clusters by size, freshness
stats, and suggested actions (close duplicates, investigate growth,
stale clusters). Supports --json flag for agent consumption.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@huntharo huntharo added this to ghcrawl Mar 19, 2026
@huntharo huntharo moved this to In Review in ghcrawl Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants