#2573

feat(web): ASC_WEB_APPLE_ID environment fallback for --apple-id

Openrudrankriyamopened 1mo ago

Summary

Add ASC_WEB_APPLE_ID as the environment fallback for --apple-id on every asc web subcommand, resolved between the explicit flag and the cached-session default introduced in #2572 (flag → ASC_WEB_APPLE_ID → last/sole cached session → usage error).

Motivation

  • Non-interactive login already takes ASC_WEB_PASSWORD and ASC_WEB_2FA_CODE_COMMAND from the environment; the Apple ID is the only login input that still has to be on the command line.
  • With #2572, two cached sessions produce a usage error; CI runners need a way to select one without editing every command.
  • Precedent: --app falls back to ASC_APP_ID.

Not a config-file key: config.json holds API-key profiles and web sessions live in their own cache keyed by Apple ID, so a persisted email would be a second source of truth.

Contract

  • ASC_WEB_APPLE_ID is read only when --apple-id is empty; whitespace-trimmed; an empty value is ignored.
  • Applies to web auth login and to every command using the shared resolveWebSession path; --session-from-env unaffected.
  • When the env var selects a session, print the same stderr notice as the cached-session default but naming the source (from ASC_WEB_APPLE_ID).
  • Never recorded in telemetry.

Acceptance criteria

  • resolver unit tests: env precedence over cache, flag precedence over env, empty env ignored
  • cmdtest on one command with an isolated session store
  • commands/web.mdx and the environment-variable reference updated; docs/COMMANDS.md regenerated if help changed

Depends on #2572 (stack the PR on branch claude/default-apple-id-20260913).

Activity

0

No activity yet.