Skip to content

feat: add OpenSpec proposal for gh-client integration#452

Closed
avoidwork wants to merge 3 commits into
mainfrom
feat/gh-client-integration
Closed

feat: add OpenSpec proposal for gh-client integration#452
avoidwork wants to merge 3 commits into
mainfrom
feat/gh-client-integration

Conversation

@avoidwork

Copy link
Copy Markdown
Owner

Description

Add OpenSpec proposal, design, specs, and task breakdown for the gh-client integration feature. This change introduces a dedicated GitHub REST API client module () using native fetch(), with authentication via GITHUB_TOKEN and methods for issue/PR CRUD operations.

Type of Change

  • New feature (non-breaking change which adds functionality)

Testing

OpenSpec artifacts only — no code changes yet. Implementation and tests will follow in the next commit after tasks are applied.

Coverage

  • 100% line coverage maintained (no code changes in this commit)

Checklist

  • npm run lint passes
  • Tests pass with 100% line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

Related

Closes #449

- Add proposal.md: motivation for centralized GitHub API client
- Add design.md: native fetch approach, factory pattern, error handling
- Add specs/gh-client/spec.md: 10 requirements with scenarios
- Add tasks.md: 16 tasks across 6 implementation groups
- Add src/gh-client.js: GitHub REST API client with GhClient class
  - Factory pattern via createGhClient(config)
  - Issue CRUD: createIssue, viewIssue, editIssue, listIssues
  - PR CRUD: createPR, viewPR, editPR, listPRs, mergePR
  - Comments: createComment
  - Auth via GITHUB_TOKEN env var
  - Normalized { data, error } return pattern
  - Error handling: 401/403/404/429/timeout
- Add tests/unit/gh-client.test.js: 20 unit tests
- Extend src/tools/common.js fetchWithTimeout to accept options and return headers
- Add openspec/specs/gh-client/spec.md: 8 spec requirements
@avoidwork

Copy link
Copy Markdown
Owner Author

Implementation Audit Results: gh-client-integration

Goal Fulfillment

All 3 goals addressed:

  • Goal 1 (Client wrapper):src/gh-client.js created with factory pattern, native fetch(), GITHUB_TOKEN auth, 10 methods for issue/PR CRUD
  • Goal 2 (Reusable interface): ✅ Exported createGhClient factory and GhClient class, importable via standard ES modules
  • Goal 3 (Tests):tests/unit/gh-client.test.js with 20 tests covering instantiation, CRUD, error handling

Spec Compliance

All 10 spec requirements implemented:

  • Client instantiation with auth validation
  • Issue CRUD (create, view, edit, list)
  • PR CRUD (create, view, edit, list, merge)
  • Comment creation
  • Auth headers (Authorization + Accept)
  • Rate limiting (429 with Retry-After)
  • Timeout handling
  • Module export pattern

Task Completion

All 16 tasks completed:

  • 1.1-1.4: Client core (factory, token validation, base URL, _request helper)
  • 2.1-2.4: Issue methods
  • 3.1-3.5: PR methods
  • 4.1: Comment method
  • 5.1-5.5: Error handling (normalized return, 401/403, 404, 429, timeout)
  • 6.1-6.6: Tests (infrastructure, CRUD, missing token, error responses, rate limiting, timeout)

Quality Check

  • Tests: 1204 pass, 0 fail (all gh-client tests pass)
  • Lint: 0 warnings, 0 errors, formatting correct
  • Coverage: All new code has corresponding tests
  • No forbidden patterns: No hardcoded secrets, no console.log, no empty catch blocks
  • App starts: Application loads without crashes (TUI raw mode error is expected in non-interactive terminal)

Artifacts

  • src/gh-client.js — GitHub API client (GhClient class + createGhClient factory)
  • tests/unit/gh-client.test.js — 20 unit tests
  • src/tools/common.js — extended fetchWithTimeout to accept options and return headers

@avoidwork avoidwork closed this Jun 25, 2026
@avoidwork avoidwork deleted the feat/gh-client-integration branch June 25, 2026 23:05
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.

feat: add gh CLI to Dockerfile

1 participant