Skip to content

Add GCS_DEFAULT_ORG env var to avoid repeating --org on every invocation #207

Description

@shouze

Context

--org <org> is a required CLI flag on every invocation of the default command and the query subcommand. Most users only ever query a single organization, so passing --org on every single call is repetitive friction.

Solution

  • Read a new GCS_DEFAULT_ORG environment variable as a fallback default for --org.
  • --org (the CLI flag) still takes precedence whenever it's explicitly passed.
  • When neither --org nor GCS_DEFAULT_ORG is set, exit with a clear, actionable error message (no raw Commander "required option" stack trace).
  • Implementation: switch --org from a Commander requiredOption to a regular Option using Commander's native .env("GCS_DEFAULT_ORG") support (precedence CLI flag > env var is handled by Commander itself), then validate presence explicitly in the action handler.
  • Update documentation end to end: docs/reference/environment.md, docs/reference/cli-options.md, README.md, docs/getting-started/index.md / first-search.md.

Acceptance Criteria

  • --org <org> continues to work exactly as before and always takes precedence over GCS_DEFAULT_ORG when both are set.
  • When --org is omitted and GCS_DEFAULT_ORG is set, its value is used transparently (both the default command and the query subcommand, since they share addSearchOptions).
  • When neither --org nor GCS_DEFAULT_ORG is set, the CLI prints a clear error to stderr and exits with a non-zero code.
  • --help output documents the GCS_DEFAULT_ORG fallback for --org.
  • docs/reference/environment.md, docs/reference/cli-options.md, README.md and the getting-started docs are updated to document GCS_DEFAULT_ORG.

Definition of Done

  • bun test, bun run lint, bun run format:check, bun run knip, bun run build.ts all green.
  • Docs and the VitePress site reflect the new behavior end to end.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions