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
This commit is contained in:
Robin Olsen
2026-04-03 11:19:57 +02:00
parent b3a52759ee
commit 1cfd23f1b0
6 changed files with 25 additions and 10 deletions

View File

@@ -73,6 +73,7 @@ func init() {
issues.CloseCmd.GroupID = "issues" issues.CloseCmd.GroupID = "issues"
issues.DeleteCmd.GroupID = "issues" issues.DeleteCmd.GroupID = "issues"
issues.DepCmd.GroupID = "issues" issues.DepCmd.GroupID = "issues"
issues.SprintCmd.GroupID = "issues"
RootCmd.AddCommand(issues.CreateCmd) RootCmd.AddCommand(issues.CreateCmd)
RootCmd.AddCommand(issues.GetCmd) RootCmd.AddCommand(issues.GetCmd)
@@ -81,6 +82,7 @@ func init() {
RootCmd.AddCommand(issues.CloseCmd) RootCmd.AddCommand(issues.CloseCmd)
RootCmd.AddCommand(issues.DeleteCmd) RootCmd.AddCommand(issues.DeleteCmd)
RootCmd.AddCommand(issues.DepCmd) RootCmd.AddCommand(issues.DepCmd)
RootCmd.AddCommand(issues.SprintCmd)
RootCmd.AddGroup(&cobra.Group{ID: "comment", Title: "Comment Management"}) RootCmd.AddGroup(&cobra.Group{ID: "comment", Title: "Comment Management"})
issues.CommentCmd.GroupID = "comment" issues.CommentCmd.GroupID = "comment"

View File

@@ -158,7 +158,12 @@ func runStartCmd(cmd *cobra.Command, args []string) error {
return nil 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 var iNames []string
for name := range interfaces { for name := range interfaces {
iNames = append(iNames, name) 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) 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") fmt.Println("\033[H\033[2J")
if err := runner.Run(ctx, t, selected, tasks.InterfaceToType(selected)); err != nil { if err := runner.Run(ctx, t, selected, tasks.InterfaceToType(selected)); err != nil {
return err return err

View File

@@ -15,6 +15,7 @@ const codingDescription = `You are tasked with fixing a logical error in the cod
Your task: Your task:
1. A text file will appear in this directory(your desktop): 1. A text file will appear in this directory(your desktop):
- Name: code.txt
- Open it and follow the instructions inside. - Open it and follow the instructions inside.
- Save the file after you are done. - Save the file after you are done.
2. Change status of the Issue "Fix major error" to Closed.` 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 return expect.ValidationFeedback
} }
code, ok := strings.CutPrefix(string(fileContent), codingDescription+textFileDescription+"\n") code, ok := strings.CutPrefix(string(fileContent), textFileDescription+"\n")
if !ok { if !ok {
expect.Fail("The content of code.txt does not match the expected format.") expect.Fail("The content of code.txt does not match the expected format.")
return expect.ValidationFeedback return expect.ValidationFeedback

View File

@@ -317,6 +317,4 @@ func init() {
SprintCmd.AddCommand(SprintAddCmd) SprintCmd.AddCommand(SprintAddCmd)
SprintCmd.AddCommand(SprintRemoveCmd) SprintCmd.AddCommand(SprintRemoveCmd)
SprintCmd.AddCommand(SprintDeleteCmd) SprintCmd.AddCommand(SprintDeleteCmd)
RootCmd.AddCommand(SprintCmd)
} }

View File

@@ -25,12 +25,11 @@ func (r *REPL) execute(input string) (string, error) {
return executePMCommand("status") return executePMCommand("status")
} }
if input == "pm" {
return executePMCommand("help")
}
if after, ok := strings.CutPrefix(input, "pm"); ok { if after, ok := strings.CutPrefix(input, "pm"); ok {
if strings.Contains(strings.Split(after, " ")[1], "start") {
return "Nice try👻", nil
}
return executePMCommand(after) return executePMCommand(after)
} }
return executeShellCommand(input) return executeShellCommand(input)

View File

@@ -120,7 +120,7 @@ func (m TaskModel) View() tea.View {
} }
detailsText := fmt.Sprintf( 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.InterfaceType,
m.TimeToComplete, m.TimeToComplete,
m.Difficulty, m.Difficulty,
@@ -140,6 +140,7 @@ func (m TaskModel) View() tea.View {
centerInCard(descStyle.Render(m.Description)), centerInCard(descStyle.Render(m.Description)),
"", "",
centerInCard(detailsStyle.Render(detailsText)), 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.interfaceHelpText())),
centerInCard(infoStyle.Render(m.getQuitHelpText())), centerInCard(infoStyle.Render(m.getQuitHelpText())),
) )