Accepted
The gh-please extension currently has only two commands (init and review-reply). We need to expand functionality to include:
- PleaseAI workflow triggers: triage, investigate, fix (for issues) and review, apply (for PRs)
- Issue management: sub-issue creation/management, dependency management (blocked_by)
- PR management: review thread resolution, review comment replies
The challenge is to design a command structure that is:
- Intuitive: Easy to discover and remember
- Scalable: Can accommodate future features
- Consistent: Follows a clear pattern
- Explicit: Avoids ambiguity about what will be modified
We will adopt a grouped subcommand structure organized by function:
gh please <group> <action> <target> [options]-
aigroup: Commands that trigger PleaseAI bot via GitHub commentsgh please ai triage <issue-number>gh please ai investigate <issue-number>gh please ai fix <issue-number>gh please ai review <pr-number>gh please ai apply <pr-number>
-
issuegroup: Commands that directly manipulate GitHub issues via APIgh please issue sub-issue create <parent> --title "..."gh please issue sub-issue add <parent> <child>gh please issue sub-issue list <parent>gh please issue dependency add <issue> --blocked-by <blocker>gh please issue dependency remove <issue> <blocker>gh please issue dependency list <issue>
-
prgroup: Commands that directly manipulate PRs via APIgh please pr review-reply <comment-id> -b "text"gh please pr resolve <pr-number> [--thread <id> | --all]
-
Top-level commands: Configuration and utilities
gh please init
Decision: All commands require explicit issue/PR numbers as arguments.
Rationale:
- Prevents accidental modifications to wrong issues/PRs
- Makes command behavior predictable and testable
- Allows operating on any issue/PR, not just current context
- Simpler implementation with clearer error messages
Alternative Considered: Auto-detect from current branch
- Rejected: Too implicit, error-prone, limits flexibility
Decision: Separate PleaseAI triggers (ai) from direct API manipulation (issue/pr).
Rationale:
- Clarity of intent:
aicommands delegate to bot, others execute immediately - Different execution models:
aicommands create comments and are asynchronousissue/prcommands call APIs directly and are synchronous
- Discoverability:
gh please ai --helpshows all bot-triggerable actions - Future-proof: Easy to add new AI capabilities or direct API operations
Alternative Considered: Group by resource type only (issue/pr)
- Rejected: Mixes asynchronous bot triggers with synchronous API calls, unclear semantics
Decision: PleaseAI commands create GitHub comments in the format /please <action>.
Rationale:
- Simplicity: No need for direct PleaseAI API integration
- Transparency: Users can see the trigger comment in GitHub UI
- Flexibility: PleaseAI bot configuration is independent of extension
- Existing pattern: Aligns with how other GitHub bots work (e.g., slash commands)
Alternative Considered: Direct PleaseAI API calls
- Rejected: Requires authentication management, API endpoint configuration, tighter coupling
Decision: Use GitHub GraphQL API for:
- Sub-issue creation and management
- Review thread resolution
Rationale:
- Required: Sub-issue relationships are only exposed via GraphQL
- Efficiency: GraphQL allows fetching nested data in single request
- Modern: GraphQL is GitHub's recommended API for new features
REST API usage: Issue dependencies (blocked_by) use REST API endpoints.
Decision: Keep gh please review-reply as a deprecated alias that redirects to gh please pr review-reply with a warning.
Rationale:
- User experience: Existing users won't have commands break
- Migration path: Warning educates users about new structure
- Low cost: Minimal code to maintain alias
- Clear separation of concerns: Bot triggers vs direct API calls
- Scalable: Easy to add new commands within existing groups
- Explicit: No hidden auto-detection reduces surprises
- Discoverable: Help text organized by logical groups
- Flexible: Works with any issue/PR, not just current context
- More typing:
gh please pr review-replyis longer thangh please review-reply- Mitigation: Most users will use shell aliases for frequent commands
- Learning curve: Users must understand distinction between
aiandissue/prgroups- Mitigation: Clear documentation and help text
- Breaking change: Existing
review-replyusers see deprecation warning- Mitigation: Command still works, just shows warning
- Explicit numbers: Some users may prefer auto-detection for convenience
- Trade-off: We prioritize safety and predictability over convenience
- Commander.js structure: Each group is a
Commandwith subcommands - Code organization: Mirror command structure in
src/commands/directory - Shared utilities: GraphQL/REST clients in
src/lib/ - Type safety: TypeScript types for all API interactions
- Error handling: Clear, actionable error messages for common failures
- GitHub GraphQL API: https://docs.github.com/en/graphql
- GitHub REST API - Issue Dependencies: https://docs.github.com/en/rest/issues/issue-dependencies
- Commander.js Documentation: https://github.com/tj/commander.js
- Existing extension code:
src/commands/review-reply.ts,src/lib/github-api.ts
None (first ADR for command structure)
- Future ADR: Error handling strategy
- Future ADR: Testing approach for API interactions
- Future ADR: i18n support for new commands