fix: register custom tasks in task list/show/run commands#93
Open
orban wants to merge 1 commit intomarcus:mainfrom
Open
fix: register custom tasks in task list/show/run commands#93orban wants to merge 1 commit intomarcus:mainfrom
orban wants to merge 1 commit intomarcus:mainfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Custom tasks defined under
tasks.customin config were parsed and validated correctly, but only registered at runtime by therunandpreviewcommands. Thetask list,task show, andtask runsubcommands calledtasks.AllDefinitionsSorted()/tasks.GetDefinition()without first registering custom tasks, so they only saw built-in tasks.Fix
Added a
registerCustomTasks()helper intask.gothat loads config and callsRegisterCustomTasksFromConfig— the same pattern already used inrun.go:228-230andpreview.go. Called at the top ofrunTaskList,runTaskShow, andrunTaskRun.Before/After
Test plan
TestTaskInstanceFromDefpassesTestRegisterCustom_*tests passtask listshows custom tasks with[custom]labeltask show <custom>displays details and prompttask run <custom> --dry-runshows correct prompt