Skip to content

Merge git_review_api.py into git-pr-reader skill#39

Merged
aireilly merged 9 commits intomainfrom
merge-git-review-api-into-git-pr-reader
Mar 18, 2026
Merged

Merge git_review_api.py into git-pr-reader skill#39
aireilly merged 9 commits intomainfrom
merge-git-review-api-into-git-pr-reader

Conversation

@aireilly
Copy link
Copy Markdown
Member

Summary

Unifies the two separate Git API scripts into a single unified git_pr_reader.py in the git-pr-reader skill:

  • commands/scripts/git_review_api.py (deleted) — full-featured API using urllib.request with review posting, line extraction, branch detection, and CLI subcommands
  • skills/git-pr-reader/scripts/git_pr_reader.py (was read-only) — now the unified script with all capabilities

Changes

Unified script (skills/git-pr-reader/scripts/git_pr_reader.py)

The merged script uses PyGithub and python-gitlab libraries (not raw urllib.request) and provides all capabilities via CLI subcommands:

Subcommand Description Source
read Read PR/MR data with diffs and YAML-based file filtering git_pr_reader.py
info Get PR/MR info (title, description, base branch, head SHA) git_review_api.py
files List changed files with glob filtering git_review_api.py
comments List review comments/discussions, filter bots git_review_api.py
diff Get unified diff git_review_api.py
post Post inline review comments with duplicate detection git_review_api.py
extract Extract line numbers from diff, validate comments git_review_api.py
detect Auto-detect PR/MR for current git branch git_review_api.py

Architecture:

  • Abstract base class GitReviewAPI with GitHubReviewAPI and GitLabReviewAPI implementations
  • Dataclasses: ReviewComment, DiffLine, PostResult
  • YAML-based file filtering from config/git_filters.yaml
  • Inline load_env_file() (no env_utils dependency)
  • GitHub get_diff() uses urllib.request with Accept: application/vnd.github.diff (PyGithub doesn't expose raw unified diffs)
  • detect subcommand uses gh CLI for GitHub and urllib.request for GitLab API discovery

Reference updates

  • docs-review.md — Updated all script paths from commands/scripts/git_review_api.py to skills/git-pr-reader/scripts/git_pr_reader.py
  • requirements-analyst.md — Switched from direct script calls to idiomatic Skill: docs-tools:git-pr-reader, args: "..." pattern
  • docs-planner.md — Same Skill pattern update
  • docs-technical-review.md — Updated reference
  • docs-workflow.md — Updated prerequisite reference

Deleted

  • commands/scripts/git_review_api.py — All functionality merged into the skill

Testing

All subcommands tested against real GitHub PR and GitLab MR:

Subcommand GitHub GitLab
read (json + markdown)
info --json
files (plain + --filter + --json)
comments
diff
extract --dump
detect

Test URLs:

  • GitHub: https://github.com/openshift/openshift-docs/pull/108356
  • GitLab: https://gitlab.cee.redhat.com/.../merge_requests/389

Test plan

  • Verify docs-review --pr workflow still works end-to-end
  • Verify docs-tools:git-pr-reader skill invocation from agents
  • Run post --dry-run against a test PR/MR

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 17, 2026

@aireilly aireilly marked this pull request as draft March 17, 2026 09:53
@aireilly aireilly force-pushed the merge-git-review-api-into-git-pr-reader branch from 441db99 to 3250376 Compare March 18, 2026 09:09
@aireilly aireilly marked this pull request as ready for review March 18, 2026 09:10
Unify the read-only git_pr_reader.py skill and the full-featured
git_review_api.py command script into a single unified script at
skills/git-pr-reader/scripts/git_pr_reader.py.

The merged script uses PyGithub and python-gitlab libraries and
provides all capabilities from both sources via CLI subcommands:
read, info, files, comments, diff, post, extract, and detect.

- Remove commands/scripts/git_review_api.py
- Update docs-review command to reference new script path
- Update requirements-analyst and docs-planner agents to use
  idiomatic Skill invocation pattern (docs-tools:git-pr-reader)
- Update docs-technical-review and docs-workflow references
- Update SKILL.md with complete documentation of all subcommands

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
…Skill invocations

Replace Skill: docs-tools:git-pr-reader invocations with direct python3
script calls in agent and command files, and fix python -> python3 in
docs-review.md per project convention.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
Document that commands and agents should call backing scripts directly
via ${CLAUDE_PLUGIN_ROOT} rather than using Skill: invocations. Reserve
Skill: pseudocode for pure knowledge/checklist skills with no script.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
Add decision table clarifying when to use direct script calls
(${CLAUDE_PLUGIN_ROOT}/...) vs Skill: invocations for loading full
skill knowledge.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
Replace jira-reader with rh-ssg-formatting and ibm-sg-punctuation as
examples of pure knowledge skills with no backing script.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
Convert jira-reader, redhat-docs-toc, and article-extractor from
Skill: pseudocode to python3 ${CLAUDE_PLUGIN_ROOT}/... direct calls,
since all three have backing scripts. Also fix python -> python3 for
jira_ticket_graph.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Signed-off-by: Aidan Reilly <aireilly@redhat.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@aireilly aireilly force-pushed the merge-git-review-api-into-git-pr-reader branch from 3250376 to 863fb69 Compare March 18, 2026 09:12
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@aireilly aireilly merged commit dd9d80c into main Mar 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant