Skip to content

Add /help command#544

Merged
timja merged 6 commits into
mainfrom
copilot/add-help-command
Jul 25, 2026
Merged

Add /help command#544
timja merged 6 commits into
mainfrom
copilot/add-help-command

Conversation

Copilot AI commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Adds a /help command that responds to issue/PR comments by posting a markdown table of all supported commands and their usage.

Changes

  • matchers.js — adds helpMatcher (same line-boundary pattern as other matchers)
  • commands/help-command.js — new HelpCommand class; always enabled (no config required), posts a markdown table listing all commands
  • commands.js — registers HelpCommand alongside existing commands

Help output

When a user comments /help, the bot replies with:

Command Description
/label label1,label2 Add labels to this issue or pull request
/remove-label label1,label2 Remove labels from this issue or pull request
/close Close this issue
/close not-planned Close this issue as not planned
/reopen Reopen this issue
/reviewer reviewer1,reviewer2 Request reviewers for this pull request
/transfer repo-name Transfer this issue to another repository
/help Show this help message

Copilot AI linked an issue Jul 25, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add /help command to display available commands and usage Add /help command Jul 25, 2026
Copilot finished work on behalf of timja July 25, 2026 08:04
Copilot AI requested a review from timja July 25, 2026 08:04
@timja

timja commented Jul 25, 2026

Copy link
Copy Markdown
Owner

@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.

Copilot AI commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@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 usage and description getters to the Command base class interface and implementing them in each command, then updating HelpCommand to discover and build the table dynamically.

@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.

Done in 3f2b1f8. Added usage and description getters to the Command base class interface; each command implements them. HelpCommand now discovers all commands at runtime via CommandClass.prototype.usage/description and builds the markdown table dynamically — no hard-coded text.

Copilot finished work on behalf of timja July 25, 2026 21:14
Comment thread app/commands/help-command.js Outdated
}

// Defined after HelpCommand so the class is available for inclusion in the list.
const DOCUMENTED_COMMANDS = [

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot finished work on behalf of timja July 25, 2026 21:21
Copilot AI requested a review from timja July 25, 2026 21:21
Comment thread app/commands.js Outdated
];
const commands = ALL_COMMANDS.map((Cls) => new Cls(id, payload));
const helpCommand = commands.find((c) => c instanceof HelpCommand);
if (helpCommand) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot this seems unnecessary you can access the command classes from the exported const in this file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the injection. HelpCommand now imports ALL_COMMANDS directly from commands.js and getCommands no longer has the special-case code.

Copilot finished work on behalf of timja July 25, 2026 21:36
Copilot AI requested a review from timja July 25, 2026 21:36
@timja
timja marked this pull request as ready for review July 25, 2026 21:52
@timja timja added the enhancement New feature or request label Jul 25, 2026
@timja
timja merged commit 97c9bd3 into main Jul 25, 2026
4 checks passed
@timja
timja deleted the copilot/add-help-command branch July 25, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/help command

2 participants