feat: add --resolution as alias for --reason on bd close (GH#721)

Jira CLIs use --resolution flag (go-jira, jira-cli). Adding this as a
hidden alias improves agent ergonomics - LLMs have a prior for this flag.

Follows same pattern as --body alias for --description (GitHub CLI).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-23 13:16:04 -08:00
parent 235dc570b2
commit c4ce191bb2
2 changed files with 22 additions and 0 deletions

View File

@@ -972,6 +972,10 @@ var closeCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
CheckReadonly("close")
reason, _ := cmd.Flags().GetString("reason")
// Check --resolution alias if --reason not provided
if reason == "" {
reason, _ = cmd.Flags().GetString("resolution")
}
if reason == "" {
reason = "Closed"
}
@@ -1411,6 +1415,8 @@ func init() {
rootCmd.AddCommand(editCmd)
closeCmd.Flags().StringP("reason", "r", "", "Reason for closing")
closeCmd.Flags().String("resolution", "", "Alias for --reason (Jira CLI convention)")
_ = closeCmd.Flags().MarkHidden("resolution") // Hidden alias for agent/CLI ergonomics
closeCmd.Flags().Bool("json", false, "Output JSON format")
closeCmd.Flags().BoolP("force", "f", false, "Force close pinned issues")
closeCmd.Flags().Bool("continue", false, "Auto-advance to next step in molecule")

View File

@@ -0,0 +1,16 @@
# Test bd close --resolution alias (GH#721)
# Jira CLI convention: --resolution instead of --reason
bd init --prefix test
# Create issue
bd create 'Issue to close with resolution'
cp stdout issue.txt
exec sh -c 'grep -oE "test-[a-z0-9]+" issue.txt > issue_id.txt'
# Close using --resolution alias
exec sh -c 'bd close $(cat issue_id.txt) --resolution "Fixed via resolution alias"'
stdout 'Closed test-'
# Verify close_reason is set correctly
exec sh -c 'bd show $(cat issue_id.txt) --json'
stdout 'Fixed via resolution alias'