@zuolan/micucodeline 1.3.3 → 1.4.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 +52 -38
- package/bin/micucodeline.js +25 -14
- package/package.json +9 -6
- package/scripts/postinstall.js +20 -9
package/README.md
CHANGED
|
@@ -1,58 +1,72 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MicuCodeLine
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@zuolan/micucodeline)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
MicuCodeLine 是 **MicuCode 专用版** Claude Code 状态栏工具,Rust 编写,支持余额显示、多主题、TUI 配置面板以及智能终端宽度换行。
|
|
7
|
+
|
|
8
|
+
> GitHub: https://github.com/zuoliangyu/MICUCODELINE
|
|
4
9
|
|
|
5
10
|
## 安装
|
|
11
|
+
|
|
6
12
|
```bash
|
|
7
13
|
npm install -g @zuolan/micucodeline
|
|
8
14
|
```
|
|
9
15
|
|
|
10
|
-
|
|
16
|
+
安装完成后会自动:
|
|
17
|
+
1. 将二进制文件复制到 `~/.claude/micucodeline/`
|
|
18
|
+
2. 运行 `micucodeline --init` 初始化配置
|
|
11
19
|
|
|
12
|
-
## Claude Code
|
|
20
|
+
## 配置 Claude Code
|
|
13
21
|
|
|
14
|
-
在 `~/.claude/settings.json`
|
|
22
|
+
在 `~/.claude/settings.json` 中添加:
|
|
15
23
|
|
|
16
24
|
```json
|
|
17
25
|
{
|
|
18
|
-
"
|
|
19
|
-
"ANTHROPIC_AUTH_TOKEN": "你的 API Key(sk-xxx)",
|
|
20
|
-
"ANTHROPIC_BASE_URL": "https://www.openclaudecode.cn"
|
|
21
|
-
},
|
|
22
|
-
"statusLine": {
|
|
23
|
-
"type": "command",
|
|
24
|
-
"command": "~/.claude/micucodeline/micucodeline",
|
|
25
|
-
"padding": 0
|
|
26
|
-
}
|
|
26
|
+
"statusCommand": "micucodeline"
|
|
27
27
|
}
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"command": "C:/Users/zuolan/.claude/micucodeline/micucodeline.exe",
|
|
39
|
-
"padding": 0,
|
|
40
|
-
"type": "command"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
```
|
|
30
|
+
## 功能特性
|
|
31
|
+
|
|
32
|
+
- **余额显示**:自动读取 Claude Code 已有 Token,无需额外配置
|
|
33
|
+
- **多模型支持**:Opus 4.6 / Sonnet 4.6 / Haiku 4.5 / 1M context 模型 / 第三方模型(GLM、Kimi、Qwen 等)
|
|
34
|
+
- **智能换行**:自动检测终端宽度,超出时按 Segment 换行,不截断内容
|
|
35
|
+
- **多主题**:内置 Default / Gruvbox / Nord / Tokyo Night / Rose Pine 等主题
|
|
36
|
+
- **TUI 配置面板**:运行 `micucodeline --config` 交互式调整所有设置
|
|
37
|
+
- **Git / 目录 / 上下文窗口 / 会话** 等多种 Segment
|
|
44
38
|
|
|
45
|
-
|
|
39
|
+
## 命令
|
|
46
40
|
|
|
47
|
-
## 使用
|
|
48
41
|
```bash
|
|
49
|
-
micucodeline --help
|
|
50
|
-
micucodeline --init
|
|
51
|
-
micucodeline --config
|
|
52
|
-
micucodeline --
|
|
42
|
+
micucodeline --help # 查看帮助
|
|
43
|
+
micucodeline --init # 初始化配置文件
|
|
44
|
+
micucodeline --config # 打开 TUI 配置面板
|
|
45
|
+
micucodeline --check # 检查配置是否合法
|
|
46
|
+
micucodeline --print # 打印当前配置
|
|
53
47
|
```
|
|
54
48
|
|
|
55
|
-
##
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
## 自定义模型显示
|
|
50
|
+
|
|
51
|
+
编辑 `~/.claude/micucodeline/models.toml` 添加自定义模型:
|
|
52
|
+
|
|
53
|
+
```toml
|
|
54
|
+
[[models]]
|
|
55
|
+
pattern = "my-custom-model"
|
|
56
|
+
display_name = "My Model"
|
|
57
|
+
context_limit = 128000
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 支持平台
|
|
61
|
+
|
|
62
|
+
| 平台 | 包名 |
|
|
63
|
+
|------|------|
|
|
64
|
+
| macOS x64 | `@zuolan/micucodeline-darwin-x64` |
|
|
65
|
+
| macOS arm64 | `@zuolan/micucodeline-darwin-arm64` |
|
|
66
|
+
| Linux x64 | `@zuolan/micucodeline-linux-x64` |
|
|
67
|
+
| Linux x64 (musl) | `@zuolan/micucodeline-linux-x64-musl` |
|
|
68
|
+
| Windows x64 | `@zuolan/micucodeline-win32-x64` |
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
MIT
|
package/bin/micucodeline.js
CHANGED
|
@@ -27,15 +27,19 @@ const arch = process.arch;
|
|
|
27
27
|
// Handle special cases
|
|
28
28
|
let platformKey = `${platform}-${arch}`;
|
|
29
29
|
if (platform === 'linux') {
|
|
30
|
+
// Map Node.js arch names to package keys
|
|
31
|
+
const archMap = { 'x64': 'x64', 'arm64': 'arm64', 'arm': 'armv7' };
|
|
32
|
+
const archKey = archMap[arch] || arch;
|
|
33
|
+
|
|
30
34
|
// Detect if static linking is needed based on glibc version
|
|
31
35
|
function shouldUseStaticBinary() {
|
|
32
36
|
try {
|
|
33
37
|
const { execSync } = require('child_process');
|
|
34
|
-
const lddOutput = execSync('ldd --version 2>/dev/null || echo ""', {
|
|
38
|
+
const lddOutput = execSync('ldd --version 2>/dev/null || echo ""', {
|
|
35
39
|
encoding: 'utf8',
|
|
36
|
-
timeout: 1000
|
|
40
|
+
timeout: 1000
|
|
37
41
|
});
|
|
38
|
-
|
|
42
|
+
|
|
39
43
|
// Parse "ldd (GNU libc) 2.35" format
|
|
40
44
|
const match = lddOutput.match(/(?:GNU libc|GLIBC).*?(\d+)\.(\d+)/);
|
|
41
45
|
if (match) {
|
|
@@ -48,28 +52,35 @@ if (platform === 'linux') {
|
|
|
48
52
|
// If detection fails, default to dynamic binary
|
|
49
53
|
return false;
|
|
50
54
|
}
|
|
51
|
-
|
|
55
|
+
|
|
52
56
|
return false;
|
|
53
57
|
}
|
|
54
|
-
|
|
55
|
-
if (
|
|
56
|
-
platformKey = 'linux-
|
|
58
|
+
|
|
59
|
+
if (archKey === 'armv7') {
|
|
60
|
+
platformKey = 'linux-armv7';
|
|
61
|
+
} else if (shouldUseStaticBinary()) {
|
|
62
|
+
platformKey = `linux-${archKey}-musl`;
|
|
63
|
+
} else {
|
|
64
|
+
platformKey = `linux-${archKey}`;
|
|
57
65
|
}
|
|
58
66
|
}
|
|
59
67
|
|
|
60
68
|
const packageMap = {
|
|
61
|
-
'darwin-x64': '@
|
|
62
|
-
'darwin-arm64': '@
|
|
63
|
-
'linux-x64': '@
|
|
64
|
-
'linux-x64-musl': '@
|
|
65
|
-
'
|
|
66
|
-
'
|
|
69
|
+
'darwin-x64': '@zuolan/micucodeline-darwin-x64',
|
|
70
|
+
'darwin-arm64': '@zuolan/micucodeline-darwin-arm64',
|
|
71
|
+
'linux-x64': '@zuolan/micucodeline-linux-x64',
|
|
72
|
+
'linux-x64-musl': '@zuolan/micucodeline-linux-x64-musl',
|
|
73
|
+
'linux-arm64': '@zuolan/micucodeline-linux-arm64',
|
|
74
|
+
'linux-arm64-musl': '@zuolan/micucodeline-linux-arm64-musl',
|
|
75
|
+
'linux-armv7': '@zuolan/micucodeline-linux-armv7',
|
|
76
|
+
'win32-x64': '@zuolan/micucodeline-win32-x64',
|
|
77
|
+
'win32-ia32': '@zuolan/micucodeline-win32-x64', // Use 64-bit for 32-bit systems
|
|
67
78
|
};
|
|
68
79
|
|
|
69
80
|
const packageName = packageMap[platformKey];
|
|
70
81
|
if (!packageName) {
|
|
71
82
|
console.error(`Error: Unsupported platform ${platformKey}`);
|
|
72
|
-
console.error('Supported platforms: darwin (x64/arm64), linux (x64), win32 (x64)');
|
|
83
|
+
console.error('Supported platforms: darwin (x64/arm64), linux (x64/arm64/armv7), win32 (x64)');
|
|
73
84
|
console.error('Please visit https://github.com/zuoliangyu/MICUCODELINE for manual installation');
|
|
74
85
|
process.exit(1);
|
|
75
86
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuolan/micucodeline",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "MicuCodeLine - High-performance Claude Code StatusLine tool",
|
|
5
5
|
"bin": {
|
|
6
6
|
"micucodeline": "bin/micucodeline.js"
|
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
"postinstall": "node scripts/postinstall.js"
|
|
10
10
|
},
|
|
11
11
|
"optionalDependencies": {
|
|
12
|
-
"@zuolan/micucodeline-darwin-x64": "1.
|
|
13
|
-
"@zuolan/micucodeline-darwin-arm64": "1.
|
|
14
|
-
"@zuolan/micucodeline-linux-x64": "1.
|
|
15
|
-
"@zuolan/micucodeline-linux-x64-musl": "1.
|
|
16
|
-
"@zuolan/micucodeline-
|
|
12
|
+
"@zuolan/micucodeline-darwin-x64": "1.4.1",
|
|
13
|
+
"@zuolan/micucodeline-darwin-arm64": "1.4.1",
|
|
14
|
+
"@zuolan/micucodeline-linux-x64": "1.4.1",
|
|
15
|
+
"@zuolan/micucodeline-linux-x64-musl": "1.4.1",
|
|
16
|
+
"@zuolan/micucodeline-linux-arm64": "1.4.1",
|
|
17
|
+
"@zuolan/micucodeline-linux-arm64-musl": "1.4.1",
|
|
18
|
+
"@zuolan/micucodeline-linux-armv7": "1.4.1",
|
|
19
|
+
"@zuolan/micucodeline-win32-x64": "1.4.1"
|
|
17
20
|
},
|
|
18
21
|
"repository": {
|
|
19
22
|
"type": "git",
|
package/scripts/postinstall.js
CHANGED
|
@@ -22,15 +22,19 @@ try {
|
|
|
22
22
|
// Determine platform key
|
|
23
23
|
let platformKey = `${platform}-${arch}`;
|
|
24
24
|
if (platform === 'linux') {
|
|
25
|
+
// Map Node.js arch names to package keys
|
|
26
|
+
const archMap = { 'x64': 'x64', 'arm64': 'arm64', 'arm': 'armv7' };
|
|
27
|
+
const archKey = archMap[arch] || arch;
|
|
28
|
+
|
|
25
29
|
// Detect if static linking is needed based on glibc version
|
|
26
30
|
function shouldUseStaticBinary() {
|
|
27
31
|
try {
|
|
28
32
|
const { execSync } = require('child_process');
|
|
29
|
-
const lddOutput = execSync('ldd --version 2>/dev/null || echo ""', {
|
|
33
|
+
const lddOutput = execSync('ldd --version 2>/dev/null || echo ""', {
|
|
30
34
|
encoding: 'utf8',
|
|
31
|
-
timeout: 1000
|
|
35
|
+
timeout: 1000
|
|
32
36
|
});
|
|
33
|
-
|
|
37
|
+
|
|
34
38
|
// Parse "ldd (GNU libc) 2.35" format
|
|
35
39
|
const match = lddOutput.match(/(?:GNU libc|GLIBC).*?(\d+)\.(\d+)/);
|
|
36
40
|
if (match) {
|
|
@@ -43,12 +47,16 @@ try {
|
|
|
43
47
|
// If detection fails, default to dynamic binary
|
|
44
48
|
return false;
|
|
45
49
|
}
|
|
46
|
-
|
|
50
|
+
|
|
47
51
|
return false;
|
|
48
52
|
}
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
platformKey = 'linux-
|
|
53
|
+
|
|
54
|
+
if (archKey === 'armv7') {
|
|
55
|
+
platformKey = 'linux-armv7';
|
|
56
|
+
} else if (shouldUseStaticBinary()) {
|
|
57
|
+
platformKey = `linux-${archKey}-musl`;
|
|
58
|
+
} else {
|
|
59
|
+
platformKey = `linux-${archKey}`;
|
|
52
60
|
}
|
|
53
61
|
}
|
|
54
62
|
|
|
@@ -57,6 +65,9 @@ try {
|
|
|
57
65
|
'darwin-arm64': '@zuolan/micucodeline-darwin-arm64',
|
|
58
66
|
'linux-x64': '@zuolan/micucodeline-linux-x64',
|
|
59
67
|
'linux-x64-musl': '@zuolan/micucodeline-linux-x64-musl',
|
|
68
|
+
'linux-arm64': '@zuolan/micucodeline-linux-arm64',
|
|
69
|
+
'linux-arm64-musl': '@zuolan/micucodeline-linux-arm64-musl',
|
|
70
|
+
'linux-armv7': '@zuolan/micucodeline-linux-armv7',
|
|
60
71
|
'win32-x64': '@zuolan/micucodeline-win32-x64',
|
|
61
72
|
'win32-ia32': '@zuolan/micucodeline-win32-x64', // Use 64-bit for 32-bit
|
|
62
73
|
};
|
|
@@ -93,13 +104,13 @@ try {
|
|
|
93
104
|
if (pnpmMatch) {
|
|
94
105
|
const pnpmRoot = pnpmMatch[1];
|
|
95
106
|
const packageNameEncoded = packageName.replace('/', '+');
|
|
96
|
-
|
|
107
|
+
|
|
97
108
|
try {
|
|
98
109
|
// Try to find any version of the package
|
|
99
110
|
const pnpmContents = fs.readdirSync(pnpmRoot);
|
|
100
111
|
const packagePattern = new RegExp(`^${packageNameEncoded.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}@`);
|
|
101
112
|
const matchingPackage = pnpmContents.find(dir => packagePattern.test(dir));
|
|
102
|
-
|
|
113
|
+
|
|
103
114
|
if (matchingPackage) {
|
|
104
115
|
return path.join(pnpmRoot, matchingPackage, 'node_modules', packageName, binaryName);
|
|
105
116
|
}
|