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
assignGithubIssueAsync(config, issueNumber, assignee) calls gh issue edit <N> --add-assignee <user> and returns { ok: boolean; error?: string }.
- Sync variant
assignGithubIssue(config, issueNumber, assignee) exists for non-async callers.
- Rate-limit retry/backoff logic is reused from existing
runGhDetailedAsync.
- If the
gh command fails (exit code != 0), returns { ok: false, error: <stderr> } without throwing.
- Unit tests with mocked
gh calls verify success, failure, and retry scenarios.
- Both functions are exported from
src/github.ts for use by other modules.
- 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)
Add assignGithubIssue helper to src/github.ts
Add new async function
assignGithubIssueAsync(and syncassignGithubIssue) tosrc/github.tsthat wrapsgh 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
assignGithubIssueAsync(config, issueNumber, assignee)callsgh issue edit <N> --add-assignee <user>and returns{ ok: boolean; error?: string }.assignGithubIssue(config, issueNumber, assignee)exists for non-async callers.runGhDetailedAsync.ghcommand fails (exit code != 0), returns{ ok: false, error: <stderr> }without throwing.ghcalls verify success, failure, and retry scenarios.src/github.tsfor use by other modules.ghis not authenticated or unavailable, the function returns{ ok: false, error: ... }without throwing.Minimal Implementation
assignGithubIssueAsyncandassignGithubIssuefunctions tosrc/github.ts.runGhDetailedAsync/runGhDetailedinternally.Dependencies
None (foundational layer).
Deliverables
src/github.tsKey Files
src/github.ts(lines 35-163 for existing runGh/runGhDetailed/runGhAsync patterns)