anthropics / anthropics/claude-code

Expose whether a shell command was user-typed (`!`) vs agent-initiated

Offen
#91,261 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area:bash enhancement
Vorherrschende Sprache
Python
Sterne
145k
Forks
23.1k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

Commands the user types via the `!` prefix run in the same environment as agent-initiated Bash tool calls: identical env (`CLAUDECODE=1`, `AI_AGENT=…`) and no TTY. Child processes cannot tell a human typed the command.

This breaks CLIs that adapt behavior to agent environments. Concrete case: `pulumi login` detects `CLAUDECODE` and mints an ephemeral agent account instead of running its interactive browser login — even when the human typed `! pulumi login` themselves, silently creating throwaway accounts.

**Request:** set a variable like `CLAUDE_CODE_USER_INITIATED=1` (or omit `CLAUDECODE`) for `!` bash-input commands, so tools can distinguish "human typed this" from "agent ran this".

Related: #531 (request to expose `CLAUDECODE` itself).

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

No files or tests are named. Start by locating the handler for `!`-prefixed commands and the environment setup shared with Bash tool calls; compare both execution paths. Done means child processes can reliably distinguish human-entered `!` commands from agent-initiated commands without breaking the existing environment behavior.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
bash
Bereich
cli, developer-experience
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
62/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.