UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

27 lines • 1.44 kB
import { stripManagedAuthEnvironment } from "./auth-environment.js"; /** * Host variables that would redirect a `claude` CLI-store account away from its own dir: the secure-store redirect * (undocumented, moves only the keychain item), an inherited config dir, and the host's browser. */ const HOST_REDIRECT_NAMES = ["CLAUDE_SECURESTORAGE_CONFIG_DIR", "CLAUDE_CONFIG_DIR", "BROWSER"]; /** Inherited credentials the CLI reads from a file descriptor; they would beat the account's own login (senpi#4436). */ const INHERITED_CREDENTIAL_DESCRIPTORS = [ "CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR", "CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR", ]; /** * Environment for every `claude auth *` spawn of a CLI-store account. An inherited `CLAUDE_CODE_OAUTH_TOKEN` or * `ANTHROPIC_API_KEY` takes precedence over the stored claude.ai login inside the CLI, so they are stripped with the * rest of the managed auth set before the account dir is pinned. */ export function buildClaudeCliEnvironment(parent, options) { const environment = stripManagedAuthEnvironment(parent); for (const name of [...HOST_REDIRECT_NAMES, ...INHERITED_CREDENTIAL_DESCRIPTORS]) delete environment[name]; environment.CLAUDE_CONFIG_DIR = options.configDir; environment.NO_COLOR = "1"; if (options.browser !== undefined) environment.BROWSER = options.browser; return environment; } //# sourceMappingURL=claude-cli-environment.js.map