Add /help command#544
Conversation
|
@copilot this needs to be generic and encapsulated in each command the interface should require args / help text and you should discover them, the output looks fine. |
Refactoring now — adding
Done in 3f2b1f8. Added |
| } | ||
|
|
||
| // Defined after HelpCommand so the class is available for inclusion in the list. | ||
| const DOCUMENTED_COMMANDS = [ |
There was a problem hiding this comment.
@copilot this isn't the place for a list of commands you should refactor https://github.com/timja/github-comment-ops/blob/main/app/commands.js to have a list and only enabled commands should be showing
There was a problem hiding this comment.
Done. ALL_COMMANDS is now exported from commands.js and injected into HelpCommand. Each command class gained a static configKey (e.g. "close", "label") which HelpCommand.run() uses to filter against the repo config — so only enabled commands appear in the help output. help-command.js no longer imports any other command classes.
| ]; | ||
| const commands = ALL_COMMANDS.map((Cls) => new Cls(id, payload)); | ||
| const helpCommand = commands.find((c) => c instanceof HelpCommand); | ||
| if (helpCommand) { |
There was a problem hiding this comment.
@copilot this seems unnecessary you can access the command classes from the exported const in this file
There was a problem hiding this comment.
Removed the injection. HelpCommand now imports ALL_COMMANDS directly from commands.js and getCommands no longer has the special-case code.
Adds a
/helpcommand that responds to issue/PR comments by posting a markdown table of all supported commands and their usage.Changes
matchers.js— addshelpMatcher(same line-boundary pattern as other matchers)commands/help-command.js— newHelpCommandclass; always enabled (no config required), posts a markdown table listing all commandscommands.js— registersHelpCommandalongside existing commandsHelp output
When a user comments
/help, the bot replies with:/label label1,label2/remove-label label1,label2/close/close not-planned/reopen/reviewer reviewer1,reviewer2/transfer repo-name/help/helpcommand #36