Skip to content

Add opt-in command approval alert hook #111

Description

@jpia

When a shell command requires approval, the current flow pauses for user confirmation. If late-cli is running in a background terminal or another window, the approval prompt can be missed for a while.

I’d like to propose an opt-in config hook that runs a user-defined shell command whenever approval is requested. This would let users trigger a macOS spoken alert, a desktop notification, or any custom script the user deems appropriate.

Examples:

  • mac: say 'Yo, I am late. I need some more of them approvals bruh!'
  • linux: notify-send 'late-cli' 'A command is waiting for approval.'
{
  "alert_on_approval_command": "say 'Yo, I am late. I need some more of them approvals bruh!'"
}

This should be:

  • disabled by default when unset, empty, or whitespace-only
  • fired once per approval request
  • executed asynchronously with a 10s timeout
  • fire-and-forget with no blocking and no output/error surfacing
  • run with the current environment, without extra injected variables

Why this seems useful

It is a lightweight, zero-dependency extension that fits the existing approval model. It does not auto-approve commands; it only alerts the user that one is waiting for consent. It also works naturally with both root orchestrator approvals and subagent-triggered approvals if the hook is placed at the shared TUI confirmation layer.

Implementation sketch

The idea is a new config field:

AlertOnApprovalCommand string `json:"alert_on_approval_command,omitempty"`

Then, when the TUI enters a confirmation state for a tool requiring approval, it triggers a helper that runs:

exec.CommandContext(ctx, "sh", "-c", cmdStr)

(or the Windows equivalent) in a goroutine with a 10s timeout and discards stdout/stderr.

Discussion points for maintainers

  • Is an opt-in shell-command hook acceptable as a general alert mechanism?
  • Any concerns about arbitrary user-configured shell commands being executed as a notification hook?
  • Would maintainers prefer this as a generic “approval alert” hook instead of a built-in notification mode enum (adds config complexity)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions