gitlink-cli/docs/pr-draft.md

2.4 KiB

PR Draft: Add workflow agent commands for issue triage, repository health, and PR summaries

Summary

This PR adds workflow +triage, workflow +health, and workflow +pr-summary with safe read-only analysis modes:

  • local flags
  • local JSON input
  • read-only GitLink fetch mode

It also adds stable json, table, and markdown rendering for Agent consumption.

Motivation

  • Help maintainers triage issues faster
  • Provide a structured repository health overview
  • Summarize pull requests with review focus, test suggestions, and merge checklist output
  • Give AI Agents stable machine-readable output
  • Keep the workflow local-first and safe by default
  • Avoid any dependency on external LLM APIs

Changes

  • New shortcuts/workflow rule engine and DTOs
  • Local command layer for workflow +triage and workflow +health
  • Local and remote command layer for workflow +pr-summary
  • Workflow-local renderer for json, table, and markdown
  • Read-only GitLink fetch and normalization helpers
  • Unit tests for rules, fetch normalization, rendering, and command wiring
  • Competition and test documentation updates

Safety

  • Remote mode is read-only
  • No comment, label, close, approve, reject, merge, or release write actions
  • Health scoring tolerates unknown or unavailable metrics
  • Test fixtures do not contain secrets or tokens

Tests

  • gofmt -w shortcuts/workflow/*.go shortcuts/register.go
  • go test ./shortcuts/workflow
  • go test ./...
  • httptest coverage for API normalization and fetch tolerance
  • Manual command examples in local and remote read-only modes
  • PR summary tests for change type, risk level, partial fetch failures, renderers, and command wiring

Known Limitations

  • Real API response shapes may still require minor normalization tweaks
  • Write operations are intentionally deferred to a later PR
  • release-notes and stale are planned next

Screenshots or Examples

gitlink-cli workflow +triage --title "Token leaked in logs" --body "The access token appears in command output" --format json
gitlink-cli workflow +health --repository Gitlink/gitlink-cli --open-issues 3 --open-prs 1 --has-readme --has-license --has-contributing --agent-readiness-known --agent-readiness-score 9 --format table
gitlink-cli workflow +triage --owner Gitlink --repo gitlink-cli --state open --limit 5 --format table
gitlink-cli workflow +pr-summary --owner Gitlink --repo gitlink-cli --number 1 --format markdown