Skip to content

Add assignGithubIssue helper #499

@SorraTheOrc

Description

@SorraTheOrc

Add assignGithubIssue helper to src/github.ts

Add new async function assignGithubIssueAsync (and sync assignGithubIssue) to src/github.ts that wraps gh issue edit <number> --add-assignee <user> with the existing retry/backoff infrastructure.

User Story

As a developer building the delegate command, I need a reusable helper function to assign a GitHub issue to a user so that the delegate command can call it without reimplementing the gh CLI wrapper logic.

Acceptance Criteria

  1. assignGithubIssueAsync(config, issueNumber, assignee) calls gh issue edit <N> --add-assignee <user> and returns { ok: boolean; error?: string }.
  2. Sync variant assignGithubIssue(config, issueNumber, assignee) exists for non-async callers.
  3. Rate-limit retry/backoff logic is reused from existing runGhDetailedAsync.
  4. If the gh command fails (exit code != 0), returns { ok: false, error: <stderr> } without throwing.
  5. Unit tests with mocked gh calls verify success, failure, and retry scenarios.
  6. Both functions are exported from src/github.ts for use by other modules.
  7. If gh is not authenticated or unavailable, the function returns { ok: false, error: ... } without throwing.

Minimal Implementation

  • Add assignGithubIssueAsync and assignGithubIssue functions to src/github.ts.
  • Use runGhDetailedAsync / runGhDetailed internally.
  • Add unit tests following existing patterns.

Dependencies

None (foundational layer).

Deliverables

  • Updated src/github.ts
  • New test file for assign helper

Key Files

  • src/github.ts (lines 35-163 for existing runGh/runGhDetailed/runGhAsync patterns)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions