claude-limitline 1.5.1 → 1.5.2
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/dist/index.js +29 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -188,6 +188,35 @@ async function getOAuthTokenMacOS() {
|
|
|
188
188
|
} catch (error) {
|
|
189
189
|
debug("macOS Keychain retrieval failed:", error);
|
|
190
190
|
}
|
|
191
|
+
const configPaths = [
|
|
192
|
+
path2.join(os2.homedir(), ".claude", ".credentials.json"),
|
|
193
|
+
path2.join(os2.homedir(), ".claude", "credentials.json"),
|
|
194
|
+
path2.join(os2.homedir(), ".config", "claude-code", "credentials.json")
|
|
195
|
+
];
|
|
196
|
+
for (const configPath of configPaths) {
|
|
197
|
+
try {
|
|
198
|
+
if (fs2.existsSync(configPath)) {
|
|
199
|
+
const content = fs2.readFileSync(configPath, "utf-8");
|
|
200
|
+
const config = JSON.parse(content);
|
|
201
|
+
if (config.claudeAiOauth && typeof config.claudeAiOauth === "object") {
|
|
202
|
+
const token = config.claudeAiOauth.accessToken;
|
|
203
|
+
if (token && typeof token === "string" && token.startsWith("sk-ant-oat")) {
|
|
204
|
+
debug(`Found OAuth token in ${configPath} under claudeAiOauth.accessToken`);
|
|
205
|
+
return token;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
for (const key of ["oauth_token", "token", "accessToken"]) {
|
|
209
|
+
const token = config[key];
|
|
210
|
+
if (token && typeof token === "string" && token.startsWith("sk-ant-oat")) {
|
|
211
|
+
debug(`Found OAuth token in ${configPath} under key ${key}`);
|
|
212
|
+
return token;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
} catch (error) {
|
|
217
|
+
debug(`Failed to read config from ${configPath}:`, error);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
191
220
|
return null;
|
|
192
221
|
}
|
|
193
222
|
async function getOAuthTokenLinux() {
|