fix(#90): detect opencode-go credentials in auth.json#162
Open
janekbaraniewski wants to merge 2 commits into
Open
fix(#90): detect opencode-go credentials in auth.json#162janekbaraniewski wants to merge 2 commits into
janekbaraniewski wants to merge 2 commits into
Conversation
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
📘 Docs previewBuilt and deployed for commit Preview URL: https://44a54478.openusage-docs.pages.dev/ Routes to check: Home · Install · Providers · CLI reference · FAQ Re-deployed on every push to this PR. The build artifact is also attached to the workflow run. |
Extend the OpenCode auth detector so it also picks up tokens written by the newer opencode-go client (auth.json layout with provider-keyed entries and `key`/`apiKey` fields), in addition to the legacy single top-level token blob. This restores auto-import for users that switched to opencode-go. Closes #90
Documents the auto-detection extension that picks up tokens written by the newer opencode-go client alongside legacy opencode/Zen entries, so users know both upstream client variants are supported. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
c2da504 to
4e02617
Compare
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.
Summary
opencodeAuthMappingto recognise the newopencode-gokey in OpenCode'sauth.jsonalongside the legacyopencode(Zen) key. Both ids shareOPENCODE_API_KEYupstream and hit the same Zen endpoint, so they land on the sameopencodeopenusage account/tile.auth.jsonpath resolution: honoursXDG_DATA_HOME(any platform), keeps~/.local/share/opencode/auth.jsonas the default, and adds a~/Library/Application Support/opencode/auth.jsonfallback on macOS for users who pinned to the Apple-native location.docs/site/docs/providers/opencode.md.Closes #90 — without this, users on the
opencode-gocatalog see "No providers detected" even when their key is present inauth.json, because the previous mapping only matched the legacyopencodekey.Test plan
go test ./internal/detect/ -run TestDetectOpenCodeAuth -v— all 7 cases passgo build ./...cleanDOCS_PREVIEW=1 npm run buildindocs/site/finishes with[SUCCESS]and no broken-link warnings{"opencode-go": {"type":"api","key":"sk-fake"}}into~/.local/share/opencode/auth.json, runopenusage detect, confirm anopencodeaccount is reported🤖 Generated with Claude Code