Skip to content

[plan] Migrate from gh CLI shell-outs to native go-gh API clients #5828

@github-actions

Description

@github-actions

Overview

This tracking issue covers the migration from shell-out gh.Exec() calls to native REST and GraphQL API clients provided by github.com/cli/go-gh/v2. This will improve performance (5-10x faster), simplify code, and follow upstream best practices.

Source: Discussion #5826 (Go Fan report on go-gh module usage)

Current State

The project uses gh.Exec() shell-outs for all GitHub API interactions across 4 files:

  • pkg/workflow/repository_features_validation.go - Repository feature detection
  • pkg/workflow/github_cli.go - Wrapper functions
  • pkg/cli/exec.go - Conditional gh CLI usage
  • pkg/parser/remote_fetch.go - Remote file downloads

Expected Benefits

  • Performance: 5-10x faster (eliminates process spawning overhead)
  • Code Quality: Type-safe API calls with automatic JSON handling
  • Maintainability: Cleaner error handling and better testability
  • Reliability: Built-in retry logic and caching support

Planned Tasks

This work is broken into focused, incremental tasks that can be completed independently:

  1. #aw_a1b2c3d4e5f6 - Replace gh repo view with repository.Current()
  2. #aw_b2c3d4e5f6a7 - Migrate repository features to REST client
  3. #aw_c3d4e5f6a7b8 - Migrate GraphQL discussions check to native client
  4. #aw_d4e5f6a7b8c9 - Migrate remote file downloads to REST client
  5. #aw_e5f6a7b8c9d4 - Enable API caching and adopt pkg/auth

Success Criteria

  • All gh.Exec() calls replaced with native API clients
  • Performance benchmarks show 5-10x improvement
  • All tests passing (unit + integration)
  • Code simplified with better error handling
  • API caching enabled for better performance

AI generated by Plan Command for discussion #5826

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions