feat: Task and hook management via CLI commands#166
Conversation
Co-authored-by: alirezanet <7004080+alirezanet@users.noreply.github.com>
Co-authored-by: alirezanet <7004080+alirezanet@users.noreply.github.com>
alirezanet
left a comment
There was a problem hiding this comment.
it looks ok, but feel free to use the spectre.console package to make the add or update calls more interactive if needed. user should be able to use the cli tool to change any part of the task they want or define a task as they want. I think plus supporting one liner commands we should also support a interactive wizard like form to guide and help users in all steps and for all properties.
|
|
||
| namespace Husky.Cli; | ||
|
|
||
| [Command("hook ls", Description = "List all husky hooks")] |
There was a problem hiding this comment.
hook commands doesn't need to be one level nested since the add is also a hook command.
should be just list if possible also support shortcuts like ls
There was a problem hiding this comment.
Renamed to hook list in commit 5a1d410. Also added hook ls as a shortcut alias.
|
|
||
| namespace Husky.Cli; | ||
|
|
||
| [Command("hook rm", Description = "Remove a husky hook")] |
There was a problem hiding this comment.
hook commands doesn't need to be one level nested since the add is also a hook command.
it should be remove if possible also support shortcuts like rm
There was a problem hiding this comment.
Renamed to hook remove in commit 5a1d410. Also added hook rm as a shortcut alias.
|
|
||
| namespace Husky.Cli; | ||
|
|
||
| [Command("task ls", Description = "List all tasks in task-runner.json")] |
There was a problem hiding this comment.
list is better I think, if possible also support shortcuts like ls
There was a problem hiding this comment.
Renamed to task list in commit 5a1d410. Also added task ls as a shortcut alias.
|
|
||
| namespace Husky.Cli; | ||
|
|
||
| [Command("task rm", Description = "Remove a task from task-runner.json")] |
There was a problem hiding this comment.
it should be remove if possible also support shortcuts like rm
There was a problem hiding this comment.
Renamed to task remove in commit 5a1d410. Also added task rm as a shortcut alias.
…ve wizard Co-authored-by: alirezanet <7004080+alirezanet@users.noreply.github.com>
Added Spectre.Console interactive wizard to |
Adds CLI sub-commands to list, add, update, and remove tasks and hooks directly from the terminal, without manually editing
task-runner.jsonor.husky/files.Description
Adds CLI sub-commands to list, add, update, and remove tasks and hooks directly from the terminal, without manually editing
task-runner.jsonor.husky/files.All task commands support both a one-liner mode (pass all options as flags) and an interactive wizard mode (run without options to be guided through a step-by-step form powered by Spectre.Console).
New Commands
Tasks (
task-runner.jsonmanipulation viaSystem.Text.Json.Nodes— preserves schema, variables, and all existing content):dotnet husky task list(alias:task ls) — list all tasksdotnet husky task add [-n <name>] [-c <command>] [-a <args>...] [-g <group>] [--branch] [--cwd] [--path-mode] [-o <output>] [--include] [--exclude]— add a task; launches interactive wizard if--nameor--commandis omitteddotnet husky task update [-n <name>] [-c <cmd>] [-a <args>...] [-g <group>] [--branch] [--cwd] [--path-mode] [-o <output>] [--include] [--exclude]— update a task; launches interactive wizard with task-selection prompt if--nameis omitteddotnet husky task remove(alias:task rm)-n <name>— remove a task by nameHooks (operates on
.husky/directory):dotnet husky hook list(alias:hook ls) — list hook scripts (excludes files with extensions)dotnet husky hook remove(alias:hook rm)<hook-name>— delete a hook fileInteractive Wizard
When
task addortask updateis run without providing required options, a Spectre.Console-powered wizard guides the user through all task properties:task add: prompts for name, command, args, group, cwd, branch, pathMode (selection), output mode (selection), include/exclude patternstask update: first presents a selection list of all existing tasks, then prompts for each field with current values pre-filledImplementation Notes
CommandBase, constructor DI withIGit/IFileSystem, registered inProgram.cstask ls,task rm,hook ls,hook rm) are implemented as thin subclasses of the full-name commandshook removevalidates againstPath.DirectorySeparatorChar/Path.AltDirectorySeparatorCharto correctly prevent path traversalType of change
Checklist
Original prompt
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.