beads/cmd/bd/quick.go
Steve Yegge 6a51223b6f refactor: remove 171 dead if daemonClient != nil branches from 56 files (-3,384 lines)
Since daemonClient is always nil (daemon_deprecated.go stub), every
`if daemonClient != nil` branch was dead code. This removes all 171
occurrences across 56 command files, keeping only the direct storage
(else) branches. Also cleans up unused rpc/json/types imports and
fixes variable shadowing issues left behind.

Part of Dolt transition Phase 2 (dolt-test-woho epic).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-10 00:23:20 -08:00

68 lines
1.7 KiB
Go

package main
import (
"fmt"
"strings"
"github.com/spf13/cobra"
"github.com/steveyegge/beads/internal/types"
"github.com/steveyegge/beads/internal/validation"
)
var quickCmd = &cobra.Command{
Use: "q [title]",
GroupID: "issues",
Short: "Quick capture: create issue and output only ID",
Long: `Quick capture creates an issue and outputs only the issue ID.
Designed for scripting and AI agent integration.
Example:
bd q "Fix login bug" # Outputs: bd-a1b2
ISSUE=$(bd q "New feature") # Capture ID in variable
bd q "Task" | xargs bd show # Pipe to other commands`,
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
CheckReadonly("create")
title := strings.Join(args, " ")
// Get optional flags
priorityStr, _ := cmd.Flags().GetString("priority")
issueType, _ := cmd.Flags().GetString("type")
labels, _ := cmd.Flags().GetStringSlice("labels")
// Parse priority
priority, err := validation.ValidatePriority(priorityStr)
if err != nil {
FatalError("%v", err)
}
// Direct mode
issue := &types.Issue{
Title: title,
Status: types.StatusOpen,
Priority: priority,
IssueType: types.IssueType(issueType).Normalize(),
}
ctx := rootCtx
if err := store.CreateIssue(ctx, issue, actor); err != nil {
FatalError("%v", err)
}
// Add labels if specified (silently ignore failures)
for _, label := range labels {
_ = store.AddLabel(ctx, issue.ID, label, actor)
}
// Output only the ID
fmt.Println(issue.ID)
},
}
func init() {
quickCmd.Flags().StringP("priority", "p", "2", "Priority (0-4 or P0-P4)")
quickCmd.Flags().StringP("type", "t", "task", "Issue type")
quickCmd.Flags().StringSliceP("labels", "l", []string{}, "Labels")
rootCmd.AddCommand(quickCmd)
}