Skip to content

fix: register custom tasks in task list/show/run commands#93

Open
orban wants to merge 1 commit intomarcus:mainfrom
orban:fix/task-cmd-register-custom
Open

fix: register custom tasks in task list/show/run commands#93
orban wants to merge 1 commit intomarcus:mainfrom
orban:fix/task-cmd-register-custom

Conversation

@orban
Copy link
Copy Markdown

@orban orban commented Apr 2, 2026

Summary

Custom tasks defined under tasks.custom in config were parsed and validated correctly, but only registered at runtime by the run and preview commands. The task list, task show, and task run subcommands called tasks.AllDefinitionsSorted() / tasks.GetDefinition() without first registering custom tasks, so they only saw built-in tasks.

Fix

Added a registerCustomTasks() helper in task.go that loads config and calls RegisterCustomTasksFromConfig — the same pattern already used in run.go:228-230 and preview.go. Called at the top of runTaskList, runTaskShow, and runTaskRun.

Before/After

# Before
$ nightshift task list | grep custom
(nothing)

$ nightshift task show my-custom-task
Error: unknown task: my-custom-task

# After
$ nightshift task list | grep custom
my-custom-task [custom]  My Custom Task  Analysis  Low  10k-50k  Low

$ nightshift task show my-custom-task
Task:    My Custom Task
Type:    my-custom-task
Custom:  yes
...

Test plan

  • Existing TestTaskInstanceFromDef passes
  • Existing TestRegisterCustom_* tests pass
  • Manual: task list shows custom tasks with [custom] label
  • Manual: task show <custom> displays details and prompt
  • Manual: task run <custom> --dry-run shows correct prompt

Custom tasks defined in config under tasks.custom were registered
by the run and preview commands but not by the task subcommands.
This meant `nightshift task list` only showed built-in tasks,
and `nightshift task show/run <custom-task>` returned "unknown task".

Add registerCustomTasks() helper that loads config and calls
RegisterCustomTasksFromConfig, matching the pattern already used
in run.go and preview.go. Call it at the top of runTaskList,
runTaskShow, and runTaskRun.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant