@alyibrahim/claude-statusline 1.0.0 → 1.1.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/LICENSE +21 -0
- package/README.md +67 -24
- package/package.json +20 -4
- package/scripts/config.js +18 -1
- package/scripts/postinstall.js +8 -0
- package/scripts/setup.js +7 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 AlyIbrahim1
|
|
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
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
#
|
|
1
|
+
# claude-statusline
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/AlyIbrahim1/claude-statusline/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@alyibrahim/claude-statusline)
|
|
5
|
+
[](https://www.npmjs.com/package/@alyibrahim/claude-statusline)
|
|
6
|
+
[](LICENSE)
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
**A rich, fast statusline for [Claude Code](https://claude.ai/code)** — shows model, git branch, context usage, rate limits, and session cost after every response.
|
|
9
|
+
|
|
10
|
+
Runs as a **compiled Rust binary** (~5ms startup vs ~100ms for Node.js). Zero shell dependencies. One install command.
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
- **git** — optional, used for branch display; gracefully absent if not installed
|
|
12
|
+

|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
---
|
|
11
15
|
|
|
12
16
|
## Install
|
|
13
17
|
|
|
@@ -15,42 +19,81 @@ No `jq`, `bc`, `ccusage`, or other external tools needed.
|
|
|
15
19
|
npm install -g @alyibrahim/claude-statusline
|
|
16
20
|
```
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
Done. The statusline configures itself automatically. Restart Claude Code to see it.
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
> If auto-setup didn't run: `claude-statusline setup`
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## What you get
|
|
29
|
+
|
|
30
|
+
**Line 1** — Model name · Effort level · Active subagents · Current task · Directory `[branch]` · Context bar
|
|
31
|
+
|
|
32
|
+
**Line 2** — Weekly token usage · 5h usage · Reset countdown *(Pro/Max)* — or — Session cost *(API key)*
|
|
33
|
+
|
|
34
|
+
| Feature | Details |
|
|
35
|
+
|---|---|
|
|
36
|
+
| Context bar | Normalized to usable % — accounts for the auto-compact buffer |
|
|
37
|
+
| Rate limits | Shows 5h and weekly usage with color-coded thresholds |
|
|
38
|
+
| Session cost | Displayed only for API key users, hidden for subscribers |
|
|
39
|
+
| Active agents | Counts running subagents from your `~/.claude/todos/` directory |
|
|
40
|
+
| Effort level | Reads `CLAUDE_CODE_EFFORT_LEVEL` env var or `settings.json` |
|
|
41
|
+
| Git branch | Detected automatically, silently absent if not a git repo |
|
|
24
42
|
|
|
25
|
-
|
|
43
|
+
---
|
|
26
44
|
|
|
27
|
-
|
|
45
|
+
## Platform support
|
|
28
46
|
|
|
29
|
-
|
|
47
|
+
The Rust binary is pre-built and installed automatically for your platform via npm `optionalDependencies`:
|
|
48
|
+
|
|
49
|
+
| Platform | Package |
|
|
50
|
+
|---|---|
|
|
51
|
+
| Linux x64 | [`@alyibrahim/claude-statusline-linux-x64`](https://www.npmjs.com/package/@alyibrahim/claude-statusline-linux-x64) |
|
|
52
|
+
| Linux arm64 | [`@alyibrahim/claude-statusline-linux-arm64`](https://www.npmjs.com/package/@alyibrahim/claude-statusline-linux-arm64) |
|
|
53
|
+
| macOS x64 (Intel) | [`@alyibrahim/claude-statusline-darwin-x64`](https://www.npmjs.com/package/@alyibrahim/claude-statusline-darwin-x64) |
|
|
54
|
+
| macOS arm64 (Apple Silicon) | [`@alyibrahim/claude-statusline-darwin-arm64`](https://www.npmjs.com/package/@alyibrahim/claude-statusline-darwin-arm64) |
|
|
55
|
+
| Windows x64 | [`@alyibrahim/claude-statusline-win32-x64`](https://www.npmjs.com/package/@alyibrahim/claude-statusline-win32-x64) |
|
|
56
|
+
|
|
57
|
+
npm picks the right one automatically. If your platform isn't listed, the JS fallback is used instead — no action needed.
|
|
58
|
+
|
|
59
|
+
---
|
|
30
60
|
|
|
31
61
|
## Why this one
|
|
32
62
|
|
|
33
|
-
| |
|
|
63
|
+
| | claude-statusline | Others |
|
|
34
64
|
|---|---|---|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
65
|
+
| Startup time | ~5ms (Rust binary) | ~100ms (Node.js cold-start every prompt) |
|
|
66
|
+
| Shell dependencies | None | Require `jq`, `bc`, or `ccusage` |
|
|
67
|
+
| API calls | None — reads Claude's stdin directly | Poll OAuth endpoint, risk rate limits |
|
|
68
|
+
| Subscription-aware | Shows usage/resets for Pro/Max, cost for API | Treat everyone as API user |
|
|
69
|
+
| Context bar | Usable % after auto-compact buffer | Raw remaining % |
|
|
70
|
+
| Subagent counter | Counts active agents from todos dir | — |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Requirements
|
|
75
|
+
|
|
76
|
+
- **Node.js ≥16** — for install/uninstall scripts only (not needed at runtime on supported platforms)
|
|
77
|
+
- **git** — optional, enables branch display
|
|
78
|
+
|
|
79
|
+
---
|
|
40
80
|
|
|
41
81
|
## Uninstall
|
|
42
82
|
|
|
43
83
|
```bash
|
|
84
|
+
claude-statusline uninstall
|
|
44
85
|
npm uninstall -g @alyibrahim/claude-statusline
|
|
45
86
|
```
|
|
46
87
|
|
|
47
|
-
>
|
|
88
|
+
> Always run `claude-statusline uninstall` first — it removes the `statusLine` entry from `~/.claude/settings.json` before the files are deleted.
|
|
89
|
+
|
|
90
|
+
---
|
|
48
91
|
|
|
49
92
|
## Notes
|
|
50
93
|
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
94
|
+
- Settings are written only to the `statusLine` key — all other `~/.claude/settings.json` keys are untouched
|
|
95
|
+
- Respects `$CLAUDE_CONFIG_DIR` if set
|
|
96
|
+
- Switched Node versions on an unsupported platform? Re-run `claude-statusline setup`
|
|
54
97
|
|
|
55
98
|
## License
|
|
56
99
|
|
package/package.json
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alyibrahim/claude-statusline",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "A zero-dependency Claude Code statusline — reads rate limits from stdin, no API calls",
|
|
5
|
-
"engines": {
|
|
6
|
-
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=16"
|
|
7
|
+
},
|
|
8
|
+
"bin": {
|
|
9
|
+
"claude-statusline": "bin/cli.js"
|
|
10
|
+
},
|
|
7
11
|
"scripts": {
|
|
8
12
|
"postinstall": "node scripts/postinstall.js",
|
|
9
13
|
"preuninstall": "node scripts/preuninstall.js",
|
|
10
14
|
"test": "jest"
|
|
11
15
|
},
|
|
12
|
-
"files": [
|
|
16
|
+
"files": [
|
|
17
|
+
"statusline.js",
|
|
18
|
+
"bin/",
|
|
19
|
+
"scripts/",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
13
22
|
"license": "MIT",
|
|
23
|
+
"optionalDependencies": {
|
|
24
|
+
"@alyibrahim/claude-statusline-linux-x64": "1.1.0",
|
|
25
|
+
"@alyibrahim/claude-statusline-linux-arm64": "1.1.0",
|
|
26
|
+
"@alyibrahim/claude-statusline-darwin-x64": "1.1.0",
|
|
27
|
+
"@alyibrahim/claude-statusline-darwin-arm64": "1.1.0",
|
|
28
|
+
"@alyibrahim/claude-statusline-win32-x64": "1.1.0"
|
|
29
|
+
},
|
|
14
30
|
"devDependencies": {
|
|
15
31
|
"jest": "^29.0.0"
|
|
16
32
|
}
|
package/scripts/config.js
CHANGED
|
@@ -23,4 +23,21 @@ function atomicWrite(filePath, obj) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the path to the platform-specific binary, or returns null if not found.
|
|
28
|
+
* @returns {string|null}
|
|
29
|
+
*/
|
|
30
|
+
function resolveBinary() {
|
|
31
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
32
|
+
const pkgName = `@alyibrahim/claude-statusline-${platformKey}`;
|
|
33
|
+
const binName = process.platform === 'win32' ? 'statusline.exe' : 'statusline';
|
|
34
|
+
let binaryPath = null;
|
|
35
|
+
try {
|
|
36
|
+
const pkgJson = require.resolve(`${pkgName}/package.json`);
|
|
37
|
+
const candidate = path.join(path.dirname(pkgJson), binName);
|
|
38
|
+
if (fs.existsSync(candidate)) binaryPath = candidate;
|
|
39
|
+
} catch (e) {}
|
|
40
|
+
return binaryPath;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
module.exports = { getSettingsPath, atomicWrite, resolveBinary };
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
+
const fs = require('fs');
|
|
3
4
|
const { setup } = require('./setup');
|
|
5
|
+
const config = require('./config');
|
|
4
6
|
try {
|
|
5
7
|
const result = setup({ force: false });
|
|
6
8
|
if (result.settingsPath === null) process.exit(0); // non-global install, skip silently
|
|
@@ -10,6 +12,12 @@ try {
|
|
|
10
12
|
} else {
|
|
11
13
|
console.log('\n✓ claude-statusline configured. Restart Claude Code to see it.\n');
|
|
12
14
|
}
|
|
15
|
+
const binaryPath = config.resolveBinary();
|
|
16
|
+
if (binaryPath && process.platform !== 'win32') {
|
|
17
|
+
try {
|
|
18
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
19
|
+
} catch (e) {}
|
|
20
|
+
}
|
|
13
21
|
} catch (e) {
|
|
14
22
|
// Fully silent on any error — postinstall must never fail npm install
|
|
15
23
|
}
|
package/scripts/setup.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const path = require('path');
|
|
4
|
-
const
|
|
4
|
+
const config = require('./config');
|
|
5
|
+
const { getSettingsPath, atomicWrite } = config;
|
|
5
6
|
|
|
6
7
|
const UNSAFE_CHARS = /["`$!()\\]/;
|
|
7
8
|
|
|
@@ -30,7 +31,11 @@ function setup({ force = false } = {}) {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
const
|
|
34
|
+
const binaryPath = config.resolveBinary();
|
|
35
|
+
const safeBinary = binaryPath && !UNSAFE_CHARS.test(binaryPath) ? binaryPath : null;
|
|
36
|
+
const command = safeBinary
|
|
37
|
+
? `"${safeBinary}"`
|
|
38
|
+
: `"${process.execPath}" "${scriptPath}"`;
|
|
34
39
|
settings.statusLine = { type: 'command', command };
|
|
35
40
|
|
|
36
41
|
fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
|