@alyibrahim/claude-statusline 1.0.0 → 1.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 +18 -9
- 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,13 @@
|
|
|
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)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
A fast statusline for [Claude Code](https://claude.ai/code). Shows model, git branch, context usage, subscription rate limits, and session cost — updating after every response.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
- **git** — optional, used for branch display; gracefully absent if not installed
|
|
8
|
+
Runs as a compiled Rust binary on Linux x64/arm64, macOS x64/arm64, and Windows x64 — no Node.js startup overhead on every prompt. Falls back to Node.js automatically on unsupported platforms.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+

|
|
11
11
|
|
|
12
12
|
## Install
|
|
13
13
|
|
|
@@ -22,6 +22,13 @@ That's it. The statusline is configured automatically. Restart Claude Code to se
|
|
|
22
22
|
claude-statusline setup
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
## Requirements
|
|
26
|
+
|
|
27
|
+
- **Node.js >=16** — needed for install/uninstall lifecycle scripts
|
|
28
|
+
- **git** — optional, used for branch display; gracefully absent if not installed
|
|
29
|
+
|
|
30
|
+
No `jq`, `bc`, `ccusage`, or other external tools needed.
|
|
31
|
+
|
|
25
32
|
## What it shows
|
|
26
33
|
|
|
27
34
|
**Line 1:** Model · Effort level · Active agents · Current task · Directory `[git branch]` · Context bar
|
|
@@ -32,7 +39,8 @@ claude-statusline setup
|
|
|
32
39
|
|
|
33
40
|
| | This package | Others |
|
|
34
41
|
|---|---|---|
|
|
35
|
-
|
|
|
42
|
+
| Fast startup | ✓ compiled Rust binary | Node.js cold-start every prompt |
|
|
43
|
+
| No dependencies | ✓ no `jq`, `bc`, etc. | Require external tools |
|
|
36
44
|
| No API calls | ✓ reads stdin directly | Poll OAuth endpoint, hit rate limits |
|
|
37
45
|
| Subscription vs API aware | ✓ | Show cost for everyone |
|
|
38
46
|
| Context bar normalized | ✓ usable % | Raw remaining % |
|
|
@@ -41,14 +49,15 @@ claude-statusline setup
|
|
|
41
49
|
## Uninstall
|
|
42
50
|
|
|
43
51
|
```bash
|
|
52
|
+
claude-statusline uninstall
|
|
44
53
|
npm uninstall -g @alyibrahim/claude-statusline
|
|
45
54
|
```
|
|
46
55
|
|
|
47
|
-
>
|
|
56
|
+
> Run `claude-statusline uninstall` first regardless of package manager — this removes the statusline from `~/.claude/settings.json` before the package files are deleted.
|
|
48
57
|
|
|
49
58
|
## Notes
|
|
50
59
|
|
|
51
|
-
- **Switched Node versions?** Re-run `claude-statusline setup` — the
|
|
60
|
+
- **Switched Node versions?** Re-run `claude-statusline setup` — only needed if the Rust binary wasn't installed (unsupported platform fallback).
|
|
52
61
|
- Writes only the `statusLine` key in `~/.claude/settings.json` — all other settings are preserved.
|
|
53
62
|
- Respects `$CLAUDE_CONFIG_DIR` if set.
|
|
54
63
|
|
package/package.json
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alyibrahim/claude-statusline",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
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 });
|