claude-limitline 1.5.0 → 1.5.1

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/README.md CHANGED
@@ -173,12 +173,16 @@ claude-limitline retrieves data from two sources:
173
173
 
174
174
  ### OAuth Token Location
175
175
 
176
+ The tool automatically retrieves your OAuth token from Claude Code's credential storage:
177
+
176
178
  | Platform | Location |
177
179
  |----------|----------|
180
+ | **macOS** | Keychain (`Claude Code-credentials` service) |
178
181
  | **Windows** | Credential Manager or `~/.claude/.credentials.json` |
179
- | **macOS** | Keychain or `~/.claude/.credentials.json` |
180
182
  | **Linux** | secret-tool (GNOME Keyring) or `~/.claude/.credentials.json` |
181
183
 
184
+ > **Note:** On macOS, the token is read directly from the system Keychain where Claude Code stores it. No additional configuration is needed—just make sure you're logged into Claude Code (`claude --login`).
185
+
182
186
  ## Development
183
187
 
184
188
  ```bash
@@ -191,7 +195,7 @@ npm run dev # Watch mode
191
195
 
192
196
  ## Testing
193
197
 
194
- The project uses [Vitest](https://vitest.dev/) for testing with 164 tests covering config loading, themes, segments, utilities, and rendering.
198
+ The project uses [Vitest](https://vitest.dev/) for testing with 170 tests covering config loading, themes, segments, utilities, and rendering.
195
199
 
196
200
  ```bash
197
201
  npm test # Run tests once
@@ -207,7 +211,7 @@ npm run test:coverage # Coverage report
207
211
  | `src/themes/index.test.ts` | 37 | Theme retrieval, color validation |
208
212
  | `src/segments/block.test.ts` | 8 | Block segment, time calculations |
209
213
  | `src/segments/weekly.test.ts` | 13 | Weekly segment, week progress |
210
- | `src/utils/oauth.test.ts` | 13 | API responses, caching, trends |
214
+ | `src/utils/oauth.test.ts` | 19 | API responses, caching, trends, macOS keychain |
211
215
  | `src/utils/claude-hook.test.ts` | 21 | Model name formatting |
212
216
  | `src/utils/environment.test.ts` | 20 | Git branch, directory detection |
213
217
  | `src/utils/terminal.test.ts` | 13 | Terminal width, ANSI handling |
package/dist/index.js CHANGED
@@ -164,12 +164,26 @@ async function getOAuthTokenWindows() {
164
164
  async function getOAuthTokenMacOS() {
165
165
  try {
166
166
  const { stdout } = await execAsync(
167
- `security find-generic-password -s "Claude Code" -w`,
167
+ `security find-generic-password -s "Claude Code-credentials" -w`,
168
168
  { timeout: 5e3 }
169
169
  );
170
- const token = stdout.trim();
171
- if (token && token.startsWith("sk-ant-oat")) {
172
- return token;
170
+ const content = stdout.trim();
171
+ if (content.startsWith("{")) {
172
+ try {
173
+ const parsed = JSON.parse(content);
174
+ if (parsed.claudeAiOauth && typeof parsed.claudeAiOauth === "object") {
175
+ const token = parsed.claudeAiOauth.accessToken;
176
+ if (token && typeof token === "string" && token.startsWith("sk-ant-oat")) {
177
+ debug("Found OAuth token in macOS Keychain under claudeAiOauth.accessToken");
178
+ return token;
179
+ }
180
+ }
181
+ } catch (parseError) {
182
+ debug("Failed to parse keychain JSON:", parseError);
183
+ }
184
+ }
185
+ if (content.startsWith("sk-ant-oat")) {
186
+ return content;
173
187
  }
174
188
  } catch (error) {
175
189
  debug("macOS Keychain retrieval failed:", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-limitline",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "A statusline for Claude Code showing real-time usage limits and weekly tracking",
5
5
  "main": "dist/index.js",
6
6
  "bin": {