feat(molecules): add bd molecule commands and template protection (beads-1ra)
- Add `bd molecule list` to list template molecules - Add `bd molecule show` to show molecule details - Add `bd molecule instantiate` to create work items from templates - Exclude templates from `bd list` by default (use --include-templates) - Reject mutations (update/close/delete) to template issues - Add IncludeTemplates to RPC ListArgs for daemon mode Templates are marked with is_template=true and are read-only. Use `bd molecule instantiate` to create editable work items. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -141,6 +141,9 @@ var listCmd = &cobra.Command{
|
||||
pinnedFlag, _ := cmd.Flags().GetBool("pinned")
|
||||
noPinnedFlag, _ := cmd.Flags().GetBool("no-pinned")
|
||||
|
||||
// Template filtering (beads-1ra)
|
||||
includeTemplates, _ := cmd.Flags().GetBool("include-templates")
|
||||
|
||||
// Use global jsonOutput set by PersistentPreRun
|
||||
|
||||
// Normalize labels: trim, dedupe, remove empty
|
||||
@@ -290,6 +293,13 @@ var listCmd = &cobra.Command{
|
||||
filter.Pinned = &pinned
|
||||
}
|
||||
|
||||
// Template filtering (beads-1ra): exclude templates by default
|
||||
// Use --include-templates to show all issues including templates
|
||||
if !includeTemplates {
|
||||
isTemplate := false
|
||||
filter.IsTemplate = &isTemplate
|
||||
}
|
||||
|
||||
// Check database freshness before reading (bd-2q6d, bd-c4rq)
|
||||
// Skip check when using daemon (daemon auto-imports on staleness)
|
||||
ctx := rootCtx
|
||||
@@ -368,6 +378,9 @@ var listCmd = &cobra.Command{
|
||||
// Pinned filtering (bd-p8e)
|
||||
listArgs.Pinned = filter.Pinned
|
||||
|
||||
// Template filtering (beads-1ra)
|
||||
listArgs.IncludeTemplates = includeTemplates
|
||||
|
||||
resp, err := daemonClient.List(listArgs)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
@@ -585,6 +598,9 @@ func init() {
|
||||
listCmd.Flags().Bool("pinned", false, "Show only pinned issues")
|
||||
listCmd.Flags().Bool("no-pinned", false, "Exclude pinned issues")
|
||||
|
||||
// Template filtering (beads-1ra): exclude templates by default
|
||||
listCmd.Flags().Bool("include-templates", false, "Include template molecules in output")
|
||||
|
||||
// Note: --json flag is defined as a persistent flag in main.go, not here
|
||||
rootCmd.AddCommand(listCmd)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user