From c243209aff554bd4dcb99edc9561acf665a7372e Mon Sep 17 00:00:00 2001 From: vb Date: Thu, 5 Feb 2026 14:51:19 +0100 Subject: [PATCH 1/9] adding delete command in the file pkg/cli/commands/delete.go --- .beads/issues.jsonl | 3 +++ pkg/cli/commands/delete.go | 47 ++++++++++++++++++++++++++++++++++++++ pkg/cli/commands/root.go | 1 + 3 files changed, 51 insertions(+) create mode 100644 .beads/issues.jsonl create mode 100644 pkg/cli/commands/delete.go diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl new file mode 100644 index 0000000..dc687ff --- /dev/null +++ b/.beads/issues.jsonl @@ -0,0 +1,3 @@ +{"id":"LazyPM-15e","title":"issue1","status":"tombstone","priority":2,"issue_type":"feature","owner":"viljarb@tutanota.com","created_at":"2026-02-05T12:54:47.980567399+01:00","created_by":"vb","updated_at":"2026-02-05T12:54:54.505284343+01:00","deleted_at":"2026-02-05T12:54:54.505284343+01:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"feature"} +{"id":"LazyPM-5dx","title":"gergreerg","description":"rgkjioergioreg","status":"tombstone","priority":2,"issue_type":"feature","owner":"viljarb@tutanota.com","created_at":"2026-02-05T12:59:44.540301146+01:00","created_by":"vb","updated_at":"2026-02-05T14:14:33.565644925+01:00","deleted_at":"2026-02-05T14:14:33.565644925+01:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"feature"} +{"id":"LazyPM-9qt","title":"asdf","description":"asjoidiajsoijodas","status":"tombstone","priority":2,"issue_type":"feature","owner":"viljarb@tutanota.com","created_at":"2026-02-05T12:59:28.40054283+01:00","created_by":"vb","updated_at":"2026-02-05T14:14:28.948203666+01:00","deleted_at":"2026-02-05T14:14:28.948203666+01:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"feature"} diff --git a/pkg/cli/commands/delete.go b/pkg/cli/commands/delete.go new file mode 100644 index 0000000..443bc58 --- /dev/null +++ b/pkg/cli/commands/delete.go @@ -0,0 +1,47 @@ +package commands + +import ( + "fmt" + "strings" + + "github.com/LazyBachelor/LazyPM/internal/models" + + "github.com/spf13/cobra" +) + +var deleteCmd = &cobra.Command{ + Use: "delete [id]", + Short: "Delete existing issue", + Long: `Delete an existing issue by its ID.`, + Example: `pm delete issue_id`, + RunE: runDeleteCmd, + Aliases: []string{"del"}, + Args: cobra.MinimumNArgs(1), +} + +func runDeleteCmd(cmd *cobra.Command, args []string) error { + deleteID := strings.Join(args, " ") + + if deleteID == "" { + return fmt.Errorf("issue title cannot be empty") + } + + issue := &models.Issue{ + ID: deleteID, + } + + err := svc.Beads.DeleteIssue(cmd.Context(), issue.ID) + if err != nil { + return fmt.Errorf("error deleting issue: %w", err) + } + + str := fmt.Sprintf("Deleted issue with ID: %s\n", issue.ID) + + if issue.Title != "" { + str += fmt.Sprintf("Title: %s\n", issue.Title) + } + + fmt.Print(str) + + return nil +} diff --git a/pkg/cli/commands/root.go b/pkg/cli/commands/root.go index ebe772f..75098e3 100644 --- a/pkg/cli/commands/root.go +++ b/pkg/cli/commands/root.go @@ -21,6 +21,7 @@ func Execute(services *service.Services) error { func init() { rootCmd.AddCommand(createCmd) + rootCmd.AddCommand(deleteCmd) rootCmd.CompletionOptions.DisableDefaultCmd = false rootCmd.AddGroup(&cobra.Group{ID: "other", Title: "Helping Commands"}) rootCmd.SetCompletionCommandGroupID("other") From 3ffe17ed08db1e19cdf1857782a86f9bf75cabc1 Mon Sep 17 00:00:00 2001 From: vb Date: Thu, 5 Feb 2026 14:52:44 +0100 Subject: [PATCH 2/9] removing redundant reference to issue title --- pkg/cli/commands/delete.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg/cli/commands/delete.go b/pkg/cli/commands/delete.go index 443bc58..6d95498 100644 --- a/pkg/cli/commands/delete.go +++ b/pkg/cli/commands/delete.go @@ -37,10 +37,6 @@ func runDeleteCmd(cmd *cobra.Command, args []string) error { str := fmt.Sprintf("Deleted issue with ID: %s\n", issue.ID) - if issue.Title != "" { - str += fmt.Sprintf("Title: %s\n", issue.Title) - } - fmt.Print(str) return nil From e62472951130ec61ae6ac7b41ff769866bc644ba Mon Sep 17 00:00:00 2001 From: viljarb Date: Thu, 5 Feb 2026 17:40:25 +0100 Subject: [PATCH 3/9] removing issues.json1 From fc10092bb25617826f0e79c84d6bb2508b4a463c Mon Sep 17 00:00:00 2001 From: viljarb0 <156418063+viljarb0@users.noreply.github.com> Date: Thu, 5 Feb 2026 17:41:28 +0100 Subject: [PATCH 4/9] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- pkg/cli/commands/delete.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cli/commands/delete.go b/pkg/cli/commands/delete.go index 6d95498..1792776 100644 --- a/pkg/cli/commands/delete.go +++ b/pkg/cli/commands/delete.go @@ -23,7 +23,7 @@ func runDeleteCmd(cmd *cobra.Command, args []string) error { deleteID := strings.Join(args, " ") if deleteID == "" { - return fmt.Errorf("issue title cannot be empty") + return fmt.Errorf("issue ID cannot be empty") } issue := &models.Issue{ From 9e7eb962272c879dbd419530e34dfae906f8ed46 Mon Sep 17 00:00:00 2001 From: viljarb0 <156418063+viljarb0@users.noreply.github.com> Date: Thu, 5 Feb 2026 17:41:40 +0100 Subject: [PATCH 5/9] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- pkg/cli/commands/delete.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg/cli/commands/delete.go b/pkg/cli/commands/delete.go index 1792776..9c52d86 100644 --- a/pkg/cli/commands/delete.go +++ b/pkg/cli/commands/delete.go @@ -22,10 +22,6 @@ var deleteCmd = &cobra.Command{ func runDeleteCmd(cmd *cobra.Command, args []string) error { deleteID := strings.Join(args, " ") - if deleteID == "" { - return fmt.Errorf("issue ID cannot be empty") - } - issue := &models.Issue{ ID: deleteID, } From dbff78cb6b57e11fb69b1f258e3e983ed3706b1f Mon Sep 17 00:00:00 2001 From: viljarb Date: Thu, 5 Feb 2026 17:44:21 +0100 Subject: [PATCH 6/9] modified: pkg/cli/commands/delete.go --- pkg/cli/commands/delete.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cli/commands/delete.go b/pkg/cli/commands/delete.go index 9c52d86..10045c9 100644 --- a/pkg/cli/commands/delete.go +++ b/pkg/cli/commands/delete.go @@ -11,7 +11,7 @@ import ( var deleteCmd = &cobra.Command{ Use: "delete [id]", - Short: "Delete existing issue", + Short: "Delete an existing issue", Long: `Delete an existing issue by its ID.`, Example: `pm delete issue_id`, RunE: runDeleteCmd, From 45e076aeb7e787a04bac2b0a91d8e6478fe08e1b Mon Sep 17 00:00:00 2001 From: viljarb Date: Thu, 5 Feb 2026 17:45:51 +0100 Subject: [PATCH 7/9] simplifying the code in pkg/cli/commands/delete.go --- pkg/cli/commands/delete.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pkg/cli/commands/delete.go b/pkg/cli/commands/delete.go index 10045c9..2569332 100644 --- a/pkg/cli/commands/delete.go +++ b/pkg/cli/commands/delete.go @@ -4,8 +4,6 @@ import ( "fmt" "strings" - "github.com/LazyBachelor/LazyPM/internal/models" - "github.com/spf13/cobra" ) @@ -22,11 +20,7 @@ var deleteCmd = &cobra.Command{ func runDeleteCmd(cmd *cobra.Command, args []string) error { deleteID := strings.Join(args, " ") - issue := &models.Issue{ - ID: deleteID, - } - - err := svc.Beads.DeleteIssue(cmd.Context(), issue.ID) + err := svc.Beads.DeleteIssue(cmd.Context(), deleteID) if err != nil { return fmt.Errorf("error deleting issue: %w", err) } From 632ea19a1d5ca352a6948ffbb9a20e1dcdf8a10a Mon Sep 17 00:00:00 2001 From: viljarb Date: Thu, 5 Feb 2026 17:46:15 +0100 Subject: [PATCH 8/9] deleted: .beads/issues.jsonl From c762c9db32c61eb22d9b66f39c6922b1cb5dc33f Mon Sep 17 00:00:00 2001 From: viljarb Date: Thu, 5 Feb 2026 18:01:43 +0100 Subject: [PATCH 9/9] corrected non-existed variable name --- pkg/cli/commands/delete.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cli/commands/delete.go b/pkg/cli/commands/delete.go index 2569332..68fce1b 100644 --- a/pkg/cli/commands/delete.go +++ b/pkg/cli/commands/delete.go @@ -25,7 +25,7 @@ func runDeleteCmd(cmd *cobra.Command, args []string) error { return fmt.Errorf("error deleting issue: %w", err) } - str := fmt.Sprintf("Deleted issue with ID: %s\n", issue.ID) + str := fmt.Sprintf("Deleted issue with ID: %s\n", deleteID) fmt.Print(str)