Skip to content

feat: add --agent-mode flag and AUTH0_AGENT_MODE env - #1612

Open
ramya18101 wants to merge 3 commits into
mainfrom
DXCDT-2043-validate-agent-friendly-surface
Open

feat: add --agent-mode flag and AUTH0_AGENT_MODE env #1612
ramya18101 wants to merge 3 commits into
mainfrom
DXCDT-2043-validate-agent-friendly-surface

Conversation

@ramya18101

@ramya18101 ramya18101 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🔧 Changes

ntroduces Agent Mode — a single switch that optimizes CLI output for AI agents and automation. When enabled, it applies three defaults in PersistentPreRunE, before any subcommand runs: sets --json, --no-input, --no-color`

Decisions:

  • Generic scope. Flag, env, and behavior all apply CLI-wide (no per-resource gating).
  • Explicit flags always win. Agent mode sets defaults, never overrides — each toggle applies only if that flag wasn't explicitly passed (Cobra flag.Changed). auth0 apps list --csv in agent mode still emits CSV.
  • Env beats flag; both beat auto-detect.
  • Opt-out is first-class. AUTH0_AGENT_MODE=false (or --agent-mode=false) forces it off even inside a detected agent; surfaced in a stderr notice on activation and in the flag help.
  • Notice → stderr, keeping stdout clean for JSON parsing.
  • No refactor of the 109 per-command --json registrations. Agent mode rides the shared cli.json field that configureRenderer() already consumes, so output flips without touching per-command flag wiring. Global---json consolidation deferred to a separate ticket.
  • --force deliberately excluded — agent mode never auto-confirms destructive operations.

Applies to all commands (generic, CLI-wide).

📚 References

  • Builds on the detectAgent() agent-client detection work.

🔬 Testing

Unit (TestResolveAgentMode, table-driven): env-true-over-flag, env-false-over-flag, invalid-env-falls-through-to-flag, flag-true, flag-false.

Manual (live tenant):

AUTH0_AGENT_MODE=true  auth0 apps list          # → JSON
AUTH0_AGENT_MODE=false auth0 apps list          # → table (baseline)
AUTH0_AGENT_MODE=true  auth0 actions list --csv # → CSV (explicit flag wins)
CLAUDECODE=1 AUTH0_AGENT_MODE=false auth0 apps list  # → opt-out honored
CLAUDECODE=1 auth0 apps list                    # → auto-detected on

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@ramya18101
ramya18101 marked this pull request as ready for review August 14, 2026 07:48
@ramya18101
ramya18101 requested a review from a team as a code owner August 14, 2026 07:48
@ramya18101 ramya18101 changed the title feat: add --agent-mode flag to output JSON and disable prompts/colors for AI agents feat: add --agent-mode flag and AUTH0_AGENT_MODE env Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant