Skip to content

feat: add --token flag and LARAVEL_CLOUD_API_TOKEN env var support#33

Open
JoshSalway wants to merge 1 commit intolaravel:mainfrom
JoshSalway:feature/token-flag-env-var
Open

feat: add --token flag and LARAVEL_CLOUD_API_TOKEN env var support#33
JoshSalway wants to merge 1 commit intolaravel:mainfrom
JoshSalway:feature/token-flag-env-var

Conversation

@JoshSalway
Copy link

Summary

  • Adds a global --token option to BaseCommand so all commands accept an explicit API token
  • Adds LARAVEL_CLOUD_API_TOKEN environment variable support in HasAClient::resolveApiToken()
  • Token resolution priority: --token flag > LARAVEL_CLOUD_API_TOKEN env var > stored config token > interactive prompt
  • Tokens passed via flag or env var are used directly without validation and are not persisted to config.json
  • Updates ensureApiTokenExists() to skip config checks when env var token is available

Closes #27

Test plan

  • All 40 existing tests pass (./vendor/bin/pest)
  • Verify cloud app:list --token=<valid-token> authenticates without stored config
  • Verify LARAVEL_CLOUD_API_TOKEN=<token> cloud app:list works in non-interactive mode
  • Verify --token flag takes precedence over env var
  • Verify commands with NoAuthRequired interface still work without a token
  • Verify tokens passed via flag/env are not written to ~/.config/cloud/config.json

🤖 Generated with Claude Code

Enable non-interactive token authentication for CI/CD pipelines, Docker
containers, and AI assistants. Token resolution priority:
--token flag > LARAVEL_CLOUD_API_TOKEN env var > stored config > prompt.

Tokens passed via flag or env var are used directly without validation
and are not persisted to config.json.

Closes laravel#27

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@JoshSalway JoshSalway changed the title Add --token flag and LARAVEL_CLOUD_API_TOKEN env var support feat: add --token flag and LARAVEL_CLOUD_API_TOKEN env var support Mar 16, 2026
@JoshSalway

This comment was marked as spam.

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.

Feature: --token flag and LARAVEL_CLOUD_API_TOKEN env var for non-interactive auth

1 participant