anthropics / anthropics/claude-code

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

オープン
#91,261 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area:bash enhancement
主要言語
Python
スター
145k
フォーク
23.1k
PR マージ指標
PR 指標を取得中

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
bash
領域
cli, developer-experience
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
62/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。