anthropics / anthropics/claude-code

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

未关闭
#91,261 0 条评论 0 个 reaction 已指派 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 摘要。