opencode-claude-auth 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +75 -0
- package/dist/anthropic-prompt.txt +166 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/dist/keychain.d.ts +7 -0
- package/dist/keychain.d.ts.map +1 -0
- package/dist/keychain.js +79 -0
- package/dist/keychain.js.map +1 -0
- package/installation.md +94 -0
- package/package.json +38 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 gmartin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# opencode-claude-auth
|
|
2
|
+
|
|
3
|
+
OpenCode plugin that uses your existing Claude Code credentials — no separate login needed.
|
|
4
|
+
|
|
5
|
+
## How it works
|
|
6
|
+
|
|
7
|
+
Claude Code stores OAuth tokens in the macOS Keychain (or `~/.claude/.credentials.json` on other platforms). This plugin reads those tokens and provides them to OpenCode via its auth hook, so you don't need to log in twice. When a token is about to expire, it re-reads credentials automatically. If they're still stale, it runs the Claude CLI to trigger a refresh. For OpenCode > 1.2.27, it also injects the Anthropic session prompt via the `experimental.chat.system.transform` hook.
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
- Claude Code installed and authenticated (run `claude` at least once)
|
|
12
|
+
- OpenCode installed
|
|
13
|
+
|
|
14
|
+
macOS is preferred (uses Keychain). Linux and Windows work via the credentials file fallback.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
### Install with AI
|
|
19
|
+
|
|
20
|
+
Paste this into your AI agent (Claude Code, Cursor, Copilot, etc.):
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
Fetch https://raw.githubusercontent.com/griffinmartin/opencode-claude-auth/main/installation.md and follow every step exactly as written.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Manual install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install github:griffinmartin/opencode-claude-auth
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Then add to the `plugin` array in your `opencode.json`:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"plugin": ["opencode-claude-auth"]
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
> npm package coming soon. Until then, install directly from GitHub.
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
Just run OpenCode. The plugin reads your Claude Code credentials automatically and handles token refresh in the background.
|
|
45
|
+
|
|
46
|
+
## Credential sources
|
|
47
|
+
|
|
48
|
+
The plugin checks these in order:
|
|
49
|
+
|
|
50
|
+
1. macOS Keychain ("Claude Code-credentials" entry)
|
|
51
|
+
2. `~/.claude/.credentials.json` (fallback, works on all platforms)
|
|
52
|
+
|
|
53
|
+
## Troubleshooting
|
|
54
|
+
|
|
55
|
+
| Problem | Solution |
|
|
56
|
+
|---------|----------|
|
|
57
|
+
| "Credentials not found" | Run `claude` to authenticate with Claude Code first |
|
|
58
|
+
| "Keychain is locked" | Run `security unlock-keychain ~/Library/Keychains/login.keychain-db` |
|
|
59
|
+
| "Token expired and refresh failed" | The plugin runs `claude` CLI to refresh automatically. If this fails, re-authenticate manually by running `claude` |
|
|
60
|
+
| Not working on Linux/Windows | Ensure `~/.claude/.credentials.json` exists. Run `claude` to create it |
|
|
61
|
+
| Keychain access denied | Grant access when macOS prompts you |
|
|
62
|
+
| Keychain read timed out | Restart Keychain Access (can happen on macOS Tahoe) |
|
|
63
|
+
|
|
64
|
+
## How it works (technical)
|
|
65
|
+
|
|
66
|
+
- Registers an OpenCode auth hook for the `anthropic` provider
|
|
67
|
+
- Overrides the built-in `opencode-anthropic-auth` plugin
|
|
68
|
+
- Returns a custom `fetch` wrapper that injects `Authorization: Bearer` headers
|
|
69
|
+
- When a token is within 60 seconds of expiry, re-reads credentials from Keychain or file
|
|
70
|
+
- If still expired, runs `claude -p . --model claude-haiku-4-5-20250514` to trigger a refresh
|
|
71
|
+
- For OpenCode > 1.2.27, injects the Anthropic session prompt via `experimental.chat.system.transform`
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
MIT
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.
|
|
2
|
+
|
|
3
|
+
IMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Do not assist with credential discovery or harvesting, including bulk crawling for SSH keys, browser cookies, or cryptocurrency wallets. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.
|
|
4
|
+
IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.
|
|
5
|
+
|
|
6
|
+
If the user asks for help or wants to give feedback inform them of the following:
|
|
7
|
+
- /help: Get help with using Claude Code
|
|
8
|
+
- To give feedback, users should report the issue at https://github.com/anthropics/claude-code/issues
|
|
9
|
+
|
|
10
|
+
When the user directly asks about Claude Code (eg. "can Claude Code do...", "does Claude Code have..."), or asks in second person (eg. "are you able...", "can you do..."), or asks how to use a specific Claude Code feature (eg. implement a hook, or write a slash command), use the WebFetch tool to gather information to answer the question from Claude Code docs. The list of available docs is available at https://docs.claude.com/en/docs/claude-code/claude_code_docs_map.md.
|
|
11
|
+
|
|
12
|
+
# Tone and style
|
|
13
|
+
You should be concise, direct, and to the point, while providing complete information and matching the level of detail you provide in your response with the level of complexity of the user's query or the work you have completed.
|
|
14
|
+
A concise response is generally less than 4 lines, not including tool calls or code generated. You should provide more detail when the task is complex or when the user asks you to.
|
|
15
|
+
IMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.
|
|
16
|
+
IMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.
|
|
17
|
+
Do not add additional code explanation summary unless requested by the user. After working on a file, briefly confirm that you have completed the task, rather than providing an explanation of what you did.
|
|
18
|
+
Answer the user's question directly, avoiding any elaboration, explanation, introduction, conclusion, or excessive details. Brief answers are best, but be sure to provide complete information. You MUST avoid extra preamble before/after your response, such as "The answer is <answer>.", "Here is the content of the file..." or "Based on the information provided, the answer is..." or "Here is what I will do next...".
|
|
19
|
+
|
|
20
|
+
Here are some examples to demonstrate appropriate verbosity:
|
|
21
|
+
<example>
|
|
22
|
+
user: 2 + 2
|
|
23
|
+
assistant: 4
|
|
24
|
+
</example>
|
|
25
|
+
|
|
26
|
+
<example>
|
|
27
|
+
user: what is 2+2?
|
|
28
|
+
assistant: 4
|
|
29
|
+
</example>
|
|
30
|
+
|
|
31
|
+
<example>
|
|
32
|
+
user: is 11 a prime number?
|
|
33
|
+
assistant: Yes
|
|
34
|
+
</example>
|
|
35
|
+
|
|
36
|
+
<example>
|
|
37
|
+
user: what command should I run to list files in the current directory?
|
|
38
|
+
assistant: ls
|
|
39
|
+
</example>
|
|
40
|
+
|
|
41
|
+
<example>
|
|
42
|
+
user: what command should I run to watch files in the current directory?
|
|
43
|
+
assistant: [runs ls to list the files in the current directory, then read docs/commands in the relevant file to find out how to watch files]
|
|
44
|
+
npm run dev
|
|
45
|
+
</example>
|
|
46
|
+
|
|
47
|
+
<example>
|
|
48
|
+
user: How many golf balls fit inside a jetta?
|
|
49
|
+
assistant: 150000
|
|
50
|
+
</example>
|
|
51
|
+
|
|
52
|
+
<example>
|
|
53
|
+
user: what files are in the directory src/?
|
|
54
|
+
assistant: [runs ls and sees foo.c, bar.c, baz.c]
|
|
55
|
+
user: which file contains the implementation of foo?
|
|
56
|
+
assistant: src/foo.c
|
|
57
|
+
</example>
|
|
58
|
+
When you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).
|
|
59
|
+
Remember that your output will be displayed on a command line interface. Your responses can use GitHub-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.
|
|
60
|
+
Output text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.
|
|
61
|
+
If you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.
|
|
62
|
+
Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.
|
|
63
|
+
IMPORTANT: Keep your responses short, since they will be displayed on a command line interface.
|
|
64
|
+
|
|
65
|
+
# Proactiveness
|
|
66
|
+
You are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:
|
|
67
|
+
- Doing the right thing when asked, including taking actions and follow-up actions
|
|
68
|
+
- Not surprising the user with actions you take without asking
|
|
69
|
+
For example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.
|
|
70
|
+
|
|
71
|
+
# Professional objectivity
|
|
72
|
+
Prioritize technical accuracy and truthfulness over validating the user's beliefs. Focus on facts and problem-solving, providing direct, objective technical info without any unnecessary superlatives, praise, or emotional validation. It is best for the user if Claude honestly applies the same rigorous standards to all ideas and disagrees when necessary, even if it may not be what the user wants to hear. Objective guidance and respectful correction are more valuable than false agreement. Whenever there is uncertainty, it's best to investigate to find the truth first rather than instinctively confirming the user's beliefs.
|
|
73
|
+
|
|
74
|
+
# Task Management
|
|
75
|
+
You have access to the TodoWrite tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.
|
|
76
|
+
These tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.
|
|
77
|
+
|
|
78
|
+
It is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.
|
|
79
|
+
|
|
80
|
+
Examples:
|
|
81
|
+
|
|
82
|
+
<example>
|
|
83
|
+
user: Run the build and fix any type errors
|
|
84
|
+
assistant: I'm going to use the TodoWrite tool to write the following items to the todo list:
|
|
85
|
+
- Run the build
|
|
86
|
+
- Fix any type errors
|
|
87
|
+
|
|
88
|
+
I'm now going to run the build using Bash.
|
|
89
|
+
|
|
90
|
+
Looks like I found 10 type errors. I'm going to use the TodoWrite tool to write 10 items to the todo list.
|
|
91
|
+
|
|
92
|
+
marking the first todo as in_progress
|
|
93
|
+
|
|
94
|
+
Let me start working on the first item...
|
|
95
|
+
|
|
96
|
+
The first item has been fixed, let me mark the first todo as completed, and move on to the second item...
|
|
97
|
+
..
|
|
98
|
+
..
|
|
99
|
+
</example>
|
|
100
|
+
In the above example, the assistant completes all the tasks, including the 10 error fixes and running the build and fixing all errors.
|
|
101
|
+
|
|
102
|
+
<example>
|
|
103
|
+
user: Help me write a new feature that allows users to track their usage metrics and export them to various formats
|
|
104
|
+
|
|
105
|
+
assistant: I'll help you implement a usage metrics tracking and export feature. Let me first use the TodoWrite tool to plan this task.
|
|
106
|
+
Adding the following todos to the todo list:
|
|
107
|
+
1. Research existing metrics tracking in the codebase
|
|
108
|
+
2. Design the metrics collection system
|
|
109
|
+
3. Implement core metrics tracking functionality
|
|
110
|
+
4. Create export functionality for different formats
|
|
111
|
+
|
|
112
|
+
Let me start by researching the existing codebase to understand what metrics we might already be tracking and how we can build on that.
|
|
113
|
+
|
|
114
|
+
I'm going to search for any existing metrics or telemetry code in the project.
|
|
115
|
+
|
|
116
|
+
I've found some existing telemetry code. Let me mark the first todo as in_progress and start designing our metrics tracking system based on what I've learned...
|
|
117
|
+
|
|
118
|
+
[Assistant continues implementing the feature step by step, marking todos as in_progress and completed as they go]
|
|
119
|
+
</example>
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
Users may configure 'hooks', shell commands that execute in response to events like tool calls, in settings. Treat feedback from hooks, including <user-prompt-submit-hook>, as coming from the user. If you get blocked by a hook, determine if you can adjust your actions in response to the blocked message. If not, ask the user to check their hooks configuration.
|
|
123
|
+
|
|
124
|
+
# Doing tasks
|
|
125
|
+
The user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:
|
|
126
|
+
- Use the TodoWrite tool to plan the task if required
|
|
127
|
+
|
|
128
|
+
- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are automatically added by the system, and bear no direct relation to the specific tool results or user messages in which they appear.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
# Tool usage policy
|
|
132
|
+
- When doing file search, prefer to use the Task tool in order to reduce context usage.
|
|
133
|
+
- You should proactively use the Task tool with specialized agents when the task at hand matches the agent's description.
|
|
134
|
+
|
|
135
|
+
- When WebFetch returns a message about a redirect to a different host, you should immediately make a new WebFetch request with the redirect URL provided in the response.
|
|
136
|
+
- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run "git status" and "git diff", send a single message with two tool calls to run the calls in parallel.
|
|
137
|
+
- If the user specifies that they want you to run tools "in parallel", you MUST send a single message with multiple tool use content blocks. For example, if you need to launch multiple agents in parallel, send a single message with multiple Task tool calls.
|
|
138
|
+
- Use specialized tools instead of bash commands when possible, as this provides a better user experience. For file operations, use dedicated tools: Read for reading files instead of cat/head/tail, Edit for editing instead of sed/awk, and Write for creating files instead of cat with heredoc or echo redirection. Reserve bash tools exclusively for actual system commands and terminal operations that require shell execution. NEVER use bash echo or other command-line tools to communicate thoughts, explanations, or instructions to the user. Output all communication directly in your response text instead.
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
Here is useful information about the environment you are running in:
|
|
142
|
+
<env>
|
|
143
|
+
Working directory: /home/thdxr/dev/projects/anomalyco/opencode/packages/opencode
|
|
144
|
+
Is directory a git repo: Yes
|
|
145
|
+
Platform: linux
|
|
146
|
+
OS Version: Linux 6.12.4-arch1-1
|
|
147
|
+
Today's date: 2025-09-30
|
|
148
|
+
</env>
|
|
149
|
+
You are powered by the model named Sonnet 4.5. The exact model ID is claude-sonnet-4-5-20250929.
|
|
150
|
+
|
|
151
|
+
Assistant knowledge cutoff is January 2025.
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
IMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Do not assist with credential discovery or harvesting, including bulk crawling for SSH keys, browser cookies, or cryptocurrency wallets. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
IMPORTANT: Always use the TodoWrite tool to plan and track tasks throughout the conversation.
|
|
158
|
+
|
|
159
|
+
# Code References
|
|
160
|
+
|
|
161
|
+
When referencing specific functions or pieces of code include the pattern `file_path:line_number` to allow the user to easily navigate to the source code location.
|
|
162
|
+
|
|
163
|
+
<example>
|
|
164
|
+
user: Where are errors from the client handled?
|
|
165
|
+
assistant: Clients are marked as failed in the `connectToServer` function in src/services/process.ts:712.
|
|
166
|
+
</example>
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAY,MAAM,qBAAqB,CAAA;AA+D3D,QAAA,MAAM,MAAM,EAAE,MAqDb,CAAA;AAED,eAAe,MAAM,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { readClaudeCredentials } from "./keychain.js";
|
|
6
|
+
function refreshViaCli() {
|
|
7
|
+
try {
|
|
8
|
+
execSync("claude -p . --model claude-haiku-4-5-20250514", {
|
|
9
|
+
timeout: 60_000,
|
|
10
|
+
encoding: "utf-8",
|
|
11
|
+
env: { ...process.env, TERM: "dumb" },
|
|
12
|
+
stdio: "ignore",
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
// Non-fatal: Claude CLI may not be available
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function loadSessionPrompt() {
|
|
20
|
+
try {
|
|
21
|
+
const dir = dirname(fileURLToPath(import.meta.url));
|
|
22
|
+
const promptPath = join(dir, "anthropic-prompt.txt");
|
|
23
|
+
return readFileSync(promptPath, "utf-8");
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return "You are Claude Code, Anthropic's official CLI for Claude.";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function createAuthFetch(initial, onRefresh) {
|
|
30
|
+
let current = initial;
|
|
31
|
+
return async (fetchInput, init) => {
|
|
32
|
+
if (current.expiresAt < Date.now() + 60_000) {
|
|
33
|
+
const fresh = readClaudeCredentials();
|
|
34
|
+
if (fresh && fresh.expiresAt > Date.now() + 60_000) {
|
|
35
|
+
current = fresh;
|
|
36
|
+
onRefresh(current);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
refreshViaCli();
|
|
40
|
+
const afterRefresh = readClaudeCredentials();
|
|
41
|
+
if (afterRefresh && afterRefresh.expiresAt > Date.now() + 60_000) {
|
|
42
|
+
current = afterRefresh;
|
|
43
|
+
onRefresh(current);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw new Error("opencode-claude-auth: Token expired and refresh failed. " +
|
|
47
|
+
"Re-authenticate with Claude Code by running `claude` in your terminal.");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const headers = new Headers(init?.headers);
|
|
52
|
+
headers.set("Authorization", `Bearer ${current.accessToken}`);
|
|
53
|
+
return fetch(fetchInput, { ...init, headers });
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const plugin = async (input) => {
|
|
57
|
+
const creds = readClaudeCredentials();
|
|
58
|
+
if (!creds) {
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
const auth = {
|
|
62
|
+
provider: "anthropic",
|
|
63
|
+
loader: async (_getAuth, _provider) => {
|
|
64
|
+
const initialCreds = readClaudeCredentials();
|
|
65
|
+
if (!initialCreds) {
|
|
66
|
+
throw new Error("opencode-claude-auth: Claude Code credentials not found. " +
|
|
67
|
+
"Please authenticate with Claude Code first by running `claude` in your terminal.");
|
|
68
|
+
}
|
|
69
|
+
await input.client.auth.set({
|
|
70
|
+
path: { id: "anthropic" },
|
|
71
|
+
body: {
|
|
72
|
+
type: "oauth",
|
|
73
|
+
access: initialCreds.accessToken,
|
|
74
|
+
refresh: initialCreds.refreshToken,
|
|
75
|
+
expires: initialCreds.expiresAt,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
apiKey: "oauth",
|
|
80
|
+
fetch: createAuthFetch(initialCreds, (updated) => {
|
|
81
|
+
void input.client.auth.set({
|
|
82
|
+
path: { id: "anthropic" },
|
|
83
|
+
body: {
|
|
84
|
+
type: "oauth",
|
|
85
|
+
access: updated.accessToken,
|
|
86
|
+
refresh: updated.refreshToken,
|
|
87
|
+
expires: updated.expiresAt,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
}),
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
methods: [],
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
auth,
|
|
97
|
+
async "experimental.chat.system.transform"(hookInput, output) {
|
|
98
|
+
if (hookInput.model.providerID !== "anthropic")
|
|
99
|
+
return;
|
|
100
|
+
const prompt = loadSessionPrompt();
|
|
101
|
+
output.system.unshift(prompt);
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export default plugin;
|
|
106
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,qBAAqB,EAA0B,MAAM,eAAe,CAAA;AAE7E,SAAS,aAAa;IACpB,IAAI,CAAC;QAC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AAE,eAAe,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE;oBAC/C,KAAK,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;wBACzB,IAAI,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE;wBACzB,IAAI,EAAE;4BACJ,IAAI,EAAE,OAAO;4BACb,MAAM,EAAE,OAAO,CAAC,WAAW;4BAC3B,OAAO,EAAE,OAAO,CAAC,YAAY;4BAC7B,OAAO,EAAE,OAAO,CAAC,SAAS;yBAC3B;qBACF,CAAC,CAAA;gBACJ,CAAC,CAAC;aACH,CAAA;QACH,CAAC;QACD,OAAO,EAAE,EAAyB;KACnC,CAAA;IAED,OAAO;QACL,IAAI;QACJ,KAAK,CAAC,oCAAoC,CAAC,SAAS,EAAE,MAAM;YAC1D,IAAI,SAAS,CAAC,KAAK,CAAC,UAAU,KAAK,WAAW;gBAAE,OAAM;YACtD,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAA;YAClC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC/B,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keychain.d.ts","sourceRoot":"","sources":["../src/keychain.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;CAClB;AA8BD,wBAAgB,qBAAqB,IAAI,iBAAiB,GAAG,IAAI,CA8EhE"}
|
package/dist/keychain.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
const SERVICE_NAME = "Claude Code-credentials";
|
|
6
|
+
function readCredentialsFile() {
|
|
7
|
+
try {
|
|
8
|
+
const credPath = join(homedir(), ".claude", ".credentials.json");
|
|
9
|
+
const raw = readFileSync(credPath, "utf-8");
|
|
10
|
+
const parsed = JSON.parse(raw);
|
|
11
|
+
const data = parsed.claudeAiOauth ?? parsed;
|
|
12
|
+
const creds = data;
|
|
13
|
+
if (typeof creds.accessToken !== "string" ||
|
|
14
|
+
typeof creds.refreshToken !== "string" ||
|
|
15
|
+
typeof creds.expiresAt !== "number") {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
accessToken: creds.accessToken,
|
|
20
|
+
refreshToken: creds.refreshToken,
|
|
21
|
+
expiresAt: creds.expiresAt,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function readClaudeCredentials() {
|
|
29
|
+
if (process.platform !== "darwin") {
|
|
30
|
+
return readCredentialsFile();
|
|
31
|
+
}
|
|
32
|
+
let raw;
|
|
33
|
+
try {
|
|
34
|
+
raw = execSync(`security find-generic-password -s "${SERVICE_NAME}" -w`, {
|
|
35
|
+
timeout: 2000,
|
|
36
|
+
encoding: "utf-8",
|
|
37
|
+
}).trim();
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
const error = err;
|
|
41
|
+
if (error.killed || error.code === "ETIMEDOUT") {
|
|
42
|
+
throw new Error("Keychain read timed out. This can happen on macOS Tahoe. Try restarting Keychain Access.");
|
|
43
|
+
}
|
|
44
|
+
if (error.status === 44) {
|
|
45
|
+
return readCredentialsFile();
|
|
46
|
+
}
|
|
47
|
+
if (error.status === 36) {
|
|
48
|
+
throw new Error("macOS Keychain is locked. Please unlock it or run: security unlock-keychain ~/Library/Keychains/login.keychain-db");
|
|
49
|
+
}
|
|
50
|
+
if (error.status === 128) {
|
|
51
|
+
throw new Error("Keychain access was denied. Please grant access when prompted by macOS.");
|
|
52
|
+
}
|
|
53
|
+
throw new Error(`Failed to read Claude Code credentials from Keychain (exit ${error.status ?? "unknown"}). Try re-authenticating with Claude Code.`);
|
|
54
|
+
}
|
|
55
|
+
let parsed;
|
|
56
|
+
try {
|
|
57
|
+
parsed = JSON.parse(raw);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
throw new Error("Claude Code credentials exist but contain invalid JSON. Try re-authenticating with Claude Code.");
|
|
61
|
+
}
|
|
62
|
+
const data = parsed.claudeAiOauth ?? parsed;
|
|
63
|
+
const creds = data;
|
|
64
|
+
if (typeof creds.accessToken !== "string") {
|
|
65
|
+
throw new Error("Claude Code credentials are incomplete (missing accessToken). Try re-authenticating with Claude Code.");
|
|
66
|
+
}
|
|
67
|
+
if (typeof creds.refreshToken !== "string") {
|
|
68
|
+
throw new Error("Claude Code credentials are incomplete (missing refreshToken). Try re-authenticating with Claude Code.");
|
|
69
|
+
}
|
|
70
|
+
if (typeof creds.expiresAt !== "number") {
|
|
71
|
+
throw new Error("Claude Code credentials are incomplete (missing expiresAt). Try re-authenticating with Claude Code.");
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
accessToken: creds.accessToken,
|
|
75
|
+
refreshToken: creds.refreshToken,
|
|
76
|
+
expiresAt: creds.expiresAt,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=keychain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keychain.js","sourceRoot":"","sources":["../src/keychain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAQjC,MAAM,YAAY,GAAG,yBAAyB,CAAA;AAE9C,SAAS,mBAAmB;IAC1B,IAAI,CAA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/installation.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Install opencode-claude-auth
|
|
2
|
+
|
|
3
|
+
These instructions are designed for AI coding agents.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
Before installing, verify you have OpenCode and Claude Code installed and authenticated.
|
|
8
|
+
|
|
9
|
+
### Check OpenCode version
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
opencode --version
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
You should see a version number (e.g., `1.2.28`).
|
|
16
|
+
|
|
17
|
+
### Check Claude Code credentials (macOS)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
security find-generic-password -s "Claude Code-credentials" -w
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
If this returns credentials, you're authenticated. If it fails or returns nothing, try the fallback:
|
|
24
|
+
|
|
25
|
+
### Check Claude Code credentials (fallback for all platforms)
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
cat ~/.claude/.credentials.json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If this file exists and contains valid JSON, you're authenticated.
|
|
32
|
+
|
|
33
|
+
### If credentials don't exist
|
|
34
|
+
|
|
35
|
+
Run Claude Code to authenticate:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
claude
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This will prompt you to log in and store credentials in Keychain (macOS) or `~/.claude/.credentials.json` (other platforms).
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
### Step 1: Install the package
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install github:griffinmartin/opencode-claude-auth
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Step 2: Add to OpenCode configuration
|
|
52
|
+
|
|
53
|
+
Run this command to automatically add the plugin to your `opencode.json`:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
node -e "
|
|
57
|
+
const fs = require('fs'), p = require('path').join(require('os').homedir(), '.config/opencode/opencode.json');
|
|
58
|
+
const c = fs.existsSync(p) ? JSON.parse(fs.readFileSync(p,'utf8')) : {};
|
|
59
|
+
c.plugin = [...new Set([...(Array.isArray(c.plugin) ? c.plugin : []), 'opencode-claude-auth'])];
|
|
60
|
+
fs.mkdirSync(require('path').dirname(p), {recursive:true});
|
|
61
|
+
fs.writeFileSync(p, JSON.stringify(c, null, 2));
|
|
62
|
+
console.log('Added opencode-claude-auth to', p);
|
|
63
|
+
"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This command:
|
|
67
|
+
- Reads your existing `opencode.json` (or creates a new one)
|
|
68
|
+
- Adds `opencode-claude-auth` to the `plugin` array
|
|
69
|
+
- Deduplicates plugins using a Set
|
|
70
|
+
- Writes the updated config back
|
|
71
|
+
|
|
72
|
+
## Verification
|
|
73
|
+
|
|
74
|
+
Verify the plugin was added:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
cat ~/.config/opencode/opencode.json
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
You should see `opencode-claude-auth` in the `plugin` array:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"plugin": ["opencode-claude-auth"]
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Done
|
|
89
|
+
|
|
90
|
+
The plugin is now installed and configured. When you run OpenCode, it will automatically use your Claude Code credentials — no separate login needed.
|
|
91
|
+
|
|
92
|
+
## Troubleshooting
|
|
93
|
+
|
|
94
|
+
If you encounter issues, see the [main README troubleshooting section](README.md#troubleshooting).
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "opencode-claude-auth",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OpenCode plugin that uses your Claude Code credentials — no separate login needed.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"installation.md"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc && cp src/anthropic-prompt.txt dist/",
|
|
15
|
+
"test": "node --test --experimental-strip-types src/**/*.test.ts",
|
|
16
|
+
"prepublishOnly": "npm run build && npm test"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@opencode-ai/plugin": "*"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@opencode-ai/plugin": "latest",
|
|
23
|
+
"@types/node": "^25.5.0",
|
|
24
|
+
"typescript": "^5.0.0"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"opencode",
|
|
28
|
+
"claude",
|
|
29
|
+
"anthropic",
|
|
30
|
+
"plugin",
|
|
31
|
+
"auth"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/griffinmartin/opencode-claude-auth.git"
|
|
37
|
+
}
|
|
38
|
+
}
|