Visitar URL original
Enable hooks to be called on commands or subcommands that affirm/reject or modify inputs (e.g., body text) · Issue #15042 · cli/cli · GitHub
Skip to content

Enable hooks to be called on commands or subcommands that affirm/reject or modify inputs (e.g., body text) #15042

Open

Agent suggestions

Public preview

Description

@keithboone

Describe the feature or problem you’d like to solve

git itself has hooks which enables me to enforce certain behaviors when users do a commit or other sort of action. gh does not have such a mechanism.

When agents use gh directly, I have to rely on agent instructions to get them to properly tag a commit with a Prompt-URL: string at the end of the PR, Comment, issue, et cetera.

See https://datatracker.ietf.org/doc/html/draft-boone-prompt-uri-scheme-01#name-appendix-a-automatic-prompt for an example of this behavior.

What I want gh to be able to do is call an installable hook so that we can enforce desired behaviors, or as in this case, automate them.

Proposed solution

Give a specific command or subcommand is called
Before gh goes to execute it, it checks for a hook that is installed in the user environment, either globally or specific to the repository being accessed, allowing execution of a command that can check the action conforms to team guidelines, and reject the action if an error is reported in evaluation, or work with the modified action content returned by the hook.

How will it benefit CLI and its users?
This will enable teams to create hooks to ensure that development guidelines are followed in the course of using gh on a specific project.

Additional context

I do have a smaller change tested that just adds the Prompt-URL: tag at the end of a pr, issue, comment or other body that is configurable to work with any agent. However, as a feature, that is very specific to ONE use case, whereas the hook capability has broader applicability, and is consistent with existing capabilities already in git itself.

Add any other context like screenshots or mockups are helpful, if applicable.

Activity

  1. cli-triage commented on Nov 12, 2026

    @cli-triage

    GitHub CLI 2.103.3 supports aliases and extensions, but those add or wrap commands. They do not provide a global or repository-scoped hook that can reject a built-in command or rewrite its body before submission. The requested behavior is therefore not currently supported and is a clear enhancement request. The proposal gives a concrete use case and describes both validation and content transformation, so it has enough detail for product and design review.

    Supporting reports

    Generated by issue triage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions