Skip to content

refactor(github): the caller supplies the API token - #213

Open
ecalifornica wants to merge 1 commit into
robert/config-pifrom
robert/config-github-token
Open

refactor(github): the caller supplies the API token#213
ecalifornica wants to merge 1 commit into
robert/config-pifrom
robert/config-github-token

Conversation

@ecalifornica

@ecalifornica ecalifornica commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Closes #186. GitHub is a remote source: the crate's input is an API token, not a resolver. DeriveConfig.token already carries it, so resolve_token leaves the crate, the crate reads no environment variable and runs no subprocess, and the caller owns where the token comes from.

Judgment calls:

  • The gh auth token subprocess stays a live call below the composition root, in providers::github_token. Running a program is execution environment, not configuration, so it is not a Config field. Only the $GITHUB_TOKEN read moves to Config.
  • providers::github_token keeps the deleted resolve_token precedence exactly: the configured value when set and not empty, else the token the GitHub CLI holds. Error messages stay the same, so the variable and the gh fallback keep their behavior for CLI users.
  • providers::github_token_or_else exists as a seam so the precedence (configured value wins, empty string falls through) is unit-tested without running gh.

https://pathbase.dev/u/ecalifornica/pathstash/graphs/80e149fb-206b-4223-b591-4ebc1373f13c


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown

🔍 Preview deployed: https://32c1b3ab.toolpath.pages.dev

@ecalifornica
ecalifornica force-pushed the robert/config-github-token branch from 5b3365c to 7413348 Compare August 14, 2026 19:49
@ecalifornica
ecalifornica marked this pull request as ready for review August 17, 2026 18:08
Comment thread crates/path-cli/src/config.rs Outdated
"CODEX_ROLLOUT_STRICT",
"COPILOT_EVENTS_STRICT",
"COPILOT_HOME",
"GITHUB_TOKEN",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be refactored.

@ecalifornica
ecalifornica requested a review from akesling August 17, 2026 18:09
@ecalifornica ecalifornica assigned akesling and unassigned akesling Aug 17, 2026
toolpath-github drops resolve_token. DeriveConfig.token is the only
token input, so the crate reads no environment variable and runs no
subprocess.

path-cli resolves the token at the composition root. Config reads
$GITHUB_TOKEN, and providers::github_token prefers that value over the
'gh auth token' fallback. p import github and p list github take the
token from there, so both keep their behavior for CLI users.
@ecalifornica
ecalifornica force-pushed the robert/config-github-token branch from 7413348 to cf004f1 Compare August 18, 2026 20:10
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.

toolpath-github: pass credentials as a parameter

2 participants