From 1cfd23f1b02bb45f5d98a29ee3d2194e6bd77bb0 Mon Sep 17 00:00:00 2001 From: Robin Olsen Date: Fri, 3 Apr 2026 11:19:57 +0200 Subject: [PATCH] Enhance command structure and user feedback in task management - Added SprintCmd to issues command group - taskLoop hide survey related commands when in repl - Updated coding task instructions for clarity - Removed redundant SprintCmd registration - Improved REPL command handling for better user experience avoiding a chash if users type pm - Enhanced task UI to display additional information --- cmd/pm/init.go | 2 ++ cmd/pm/runner.go | 16 +++++++++++++++- cmd/pm/tasks/codingTask.go | 3 ++- internal/commands/issues/sprint.go | 2 -- pkg/repl/executor.go | 9 ++++----- pkg/task/taskui.go | 3 ++- 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/cmd/pm/init.go b/cmd/pm/init.go index c851f8b..e92ee8c 100644 --- a/cmd/pm/init.go +++ b/cmd/pm/init.go @@ -73,6 +73,7 @@ func init() { issues.CloseCmd.GroupID = "issues" issues.DeleteCmd.GroupID = "issues" issues.DepCmd.GroupID = "issues" + issues.SprintCmd.GroupID = "issues" RootCmd.AddCommand(issues.CreateCmd) RootCmd.AddCommand(issues.GetCmd) @@ -81,6 +82,7 @@ func init() { RootCmd.AddCommand(issues.CloseCmd) RootCmd.AddCommand(issues.DeleteCmd) RootCmd.AddCommand(issues.DepCmd) + RootCmd.AddCommand(issues.SprintCmd) RootCmd.AddGroup(&cobra.Group{ID: "comment", Title: "Comment Management"}) issues.CommentCmd.GroupID = "comment" diff --git a/cmd/pm/runner.go b/cmd/pm/runner.go index 3a5039c..8cba8e4 100644 --- a/cmd/pm/runner.go +++ b/cmd/pm/runner.go @@ -158,7 +158,12 @@ func runStartCmd(cmd *cobra.Command, args []string) error { return nil } -func taskLoop(ctx context.Context, application *task.App, surveyTasks map[string]task.Tasker, interfaces map[string]task.Interface) error { +func taskLoop( + ctx context.Context, + application *task.App, + surveyTasks map[string]task.Tasker, + interfaces map[string]task.Interface, +) error { var iNames []string for name := range interfaces { iNames = append(iNames, name) @@ -196,6 +201,15 @@ func taskLoop(ctx context.Context, application *task.App, surveyTasks map[string return fmt.Errorf("failed to write task details: %w", err) } + if tasks.InterfaceToType(selected) == tasks.InterfaceTypeREPL { + survey.StartCmd.Hidden = true + survey.StatusCmd.Hidden = true + survey.SubmitCmd.Hidden = true + replCmd.Hidden = true + tuiCmd.Hidden = true + webCmd.Hidden = true + } + fmt.Println("\033[H\033[2J") if err := runner.Run(ctx, t, selected, tasks.InterfaceToType(selected)); err != nil { return err diff --git a/cmd/pm/tasks/codingTask.go b/cmd/pm/tasks/codingTask.go index 1c14a3d..bb30b27 100644 --- a/cmd/pm/tasks/codingTask.go +++ b/cmd/pm/tasks/codingTask.go @@ -15,6 +15,7 @@ const codingDescription = `You are tasked with fixing a logical error in the cod Your task: 1. A text file will appear in this directory(your desktop): + - Name: code.txt - Open it and follow the instructions inside. - Save the file after you are done. 2. Change status of the Issue "Fix major error" to Closed.` @@ -165,7 +166,7 @@ func (t *CodingTask) Validate(ctx context.Context) ValidationFeedback { return expect.ValidationFeedback } - code, ok := strings.CutPrefix(string(fileContent), codingDescription+textFileDescription+"\n") + code, ok := strings.CutPrefix(string(fileContent), textFileDescription+"\n") if !ok { expect.Fail("The content of code.txt does not match the expected format.") return expect.ValidationFeedback diff --git a/internal/commands/issues/sprint.go b/internal/commands/issues/sprint.go index d89a59b..45a1498 100644 --- a/internal/commands/issues/sprint.go +++ b/internal/commands/issues/sprint.go @@ -317,6 +317,4 @@ func init() { SprintCmd.AddCommand(SprintAddCmd) SprintCmd.AddCommand(SprintRemoveCmd) SprintCmd.AddCommand(SprintDeleteCmd) - - RootCmd.AddCommand(SprintCmd) } diff --git a/pkg/repl/executor.go b/pkg/repl/executor.go index d12a89c..88ecd30 100644 --- a/pkg/repl/executor.go +++ b/pkg/repl/executor.go @@ -25,12 +25,11 @@ func (r *REPL) execute(input string) (string, error) { return executePMCommand("status") } + if input == "pm" { + return executePMCommand("help") + } + if after, ok := strings.CutPrefix(input, "pm"); ok { - - if strings.Contains(strings.Split(after, " ")[1], "start") { - return "Nice try👻", nil - } - return executePMCommand(after) } return executeShellCommand(input) diff --git a/pkg/task/taskui.go b/pkg/task/taskui.go index e131912..f8b8a17 100644 --- a/pkg/task/taskui.go +++ b/pkg/task/taskui.go @@ -120,7 +120,7 @@ func (m TaskModel) View() tea.View { } detailsText := fmt.Sprintf( - "Interface Type: %s | Time to complete: %s | Difficulty: %s", + "Interface Type: %s | Time to complete: %s | Difficulty: %s\n", m.InterfaceType, m.TimeToComplete, m.Difficulty, @@ -140,6 +140,7 @@ func (m TaskModel) View() tea.View { centerInCard(descStyle.Render(m.Description)), "", centerInCard(detailsStyle.Render(detailsText)), + centerInCard(style.TextStyle.Render(`On your desktop "Task Details.txt" will contain the same details`)), centerInCard(infoStyle.Render(m.interfaceHelpText())), centerInCard(infoStyle.Render(m.getQuitHelpText())), )