Add GCS_DEFAULT_ORG env var to avoid repeating --org on every invocation - #209
Merged
Merged
Conversation
Contributor
|
Coverage after merging feat/gcs-default-org into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Documentation inaccurately claims an automatic gh auth token fallback and retains a mandatory --org synopsis.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 4
Open (4)
What changed in this PR
Adds GCS_DEFAULT_ORG as a fallback for --org, with validation and documentation updates.
Changes:
- Supports environment-based organization defaults.
- Updates CLI, reference, README, and getting-started documentation.
- Adjusts
--orgusage guidance and prerequisites.
| File | Summary |
|---|---|
README.md |
Documents default-organization usage. |
github-code-search.ts |
Adds environment fallback and validation. |
docs/reference/environment.md |
Documents the new environment variable. |
docs/reference/cli-options.md |
Updates --org behavior and examples. |
docs/getting-started/index.md |
Adds default-organization guidance. |
docs/getting-started/first-search.md |
Updates prerequisites. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| ``` | ||
|
|
||
| > [!TIP] | ||
| > `GITHUB_TOKEN` falls back to `gh auth token` when unset and the [GitHub CLI](https://cli.github.com/) is installed and authenticated. |
|
|
||
| - `github-code-search` [installed](/getting-started/installation) | ||
| - `GITHUB_TOKEN` set in your environment ([see Prerequisites](/getting-started/)) | ||
| - `GITHUB_TOKEN` set in your environment, or the [GitHub CLI](https://cli.github.com/) installed and authenticated ([see Prerequisites](/getting-started/)) |
| ::: | ||
|
|
||
| ::: tip Already using the GitHub CLI? | ||
| If `GITHUB_TOKEN` isn't set and [`gh`](https://cli.github.com/) is installed and authenticated (`gh auth login`), `github-code-search` automatically retrieves a token via `gh auth token` — no extra setup needed. |
| | `public_repo` | Searching public repositories only | | ||
| | `read:org` | Using [`--group-by-team-prefix`](/usage/team-grouping) | | ||
|
|
||
| If `GITHUB_TOKEN` isn't set and the [GitHub CLI](https://cli.github.com/) (`gh`) is installed and authenticated, `github-code-search` automatically falls back to the token returned by `gh auth token` — no extra configuration needed. |
--org is now a regular Commander option using .env("GCS_DEFAULT_ORG") for
CLI > env var precedence, instead of requiredOption. searchAction validates
presence explicitly and exits with a clear error when neither is set.
Closes #207
shouze
force-pushed
the
feat/gcs-default-org
branch
from
September 19, 2026 11:10
d18ef90 to
fb2f84b
Compare
Contributor
|
Coverage after merging feat/gcs-default-org into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
🔦 Lighthouse Report
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What does this PR do?
Closes #207.
github-code-search.ts: switches--orgfrom a CommanderrequiredOptionto a regularOptionusing.env("GCS_DEFAULT_ORG")(native CLI > env var precedence).searchActionvalidatesopts.orgexplicitly and exits with a clear error when neither--orgnorGCS_DEFAULT_ORGis set.docs/reference/environment.md(newGCS_DEFAULT_ORGrow + section),docs/reference/cli-options.md(updated--orgrow/notes),README.md(quick-start tip),docs/getting-started/index.md/first-search.md(new "Default organization" section / prerequisite wording).How did you verify your code works?
--org/noGCS_DEFAULT_ORG→ clear error;GCS_DEFAULT_ORGset + no--org→ search proceeds (fails only on the fake token, confirming org resolution works);--helpshows(env: GCS_DEFAULT_ORG).bun test(1016 passing),bun run lint,bun run format:check,bun run knip,bun run build.tsall green.bun run docs:buildsucceeds (VitePress dead-link check passes on the new#gcs_default_organchor).