Add --project flag to override default project context in CLI commands

Problem
Current behavior in LiveKit CLI binds all commands (e.g. lk room list) to the active default project. Switching context requires mutating global state via lk project set-default, then restoring it. This introduces friction, breaks command composability, and is unsafe in scripted or concurrent workflows.

Use Case
Multiple environments (localhost, dev, dev1, prod) used in parallel. Need to query or act on a non-default project without altering global selection.

Proposed Solution
Add a --project <name> (alias: -p) flag to all project-scoped commands.

Examples

lk room list --project dev1
lk room create test-room -p dev
lk participant list my-room --project agent-dev

Behavior

  • --project overrides the currently selected default project for that command only

  • Validation: fail fast if project does not exist in lk project list.

Optional Extensions

  • --url and --api-key flags for fully stateless invocation.

  • Environment variable override: LK_PROJECT=dev1 lk room list.

  • Support for scripting: no mutation of global config when flags are used.

Benefits

  • Eliminates context switching overhead.

  • Safe for automation and CI pipelines.

  • Aligns with standard CLI patterns (kubectl, aws, gcloud).

  • Enables parallel operations across multiple environments.

Thanks for the feedback. I will pass this along to the team.

Heard back from the team on this:

There is already a global --project flag. Also, you can unset the default and be prompted for the project on each command.