@zuolan/micucodeline 1.1.3 → 1.2.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/README.md CHANGED
@@ -7,30 +7,18 @@ MicuCodeLine 是 MICU OpenClaudeCode 站特供版 Claude Code 状态栏工具,
7
7
  npm install -g @zuolan/micucodeline
8
8
  ```
9
9
 
10
- 安装后默认路径:`~/.claude/micucodeline/micucodeline`
10
+ 安装后自动复制到:`~/.claude/micucodeline/micucodeline`
11
11
 
12
- ## 重要:首次配置
13
-
14
- **安装完成后必须先运行配置工具:**
15
-
16
- ```bash
17
- # Linux/macOS
18
- ~/.claude/micucodeline/micucodeline
19
-
20
- # Windows
21
- C:\Users\你的用户名\.claude\micucodeline\micucodeline.exe
22
- ```
23
-
24
- 运行后会进入交互式配置界面,按照提示输入:
25
- 1. **API Token(系统访问令牌)**:在 OpenClaudeCode 控制台 → 左上角个人设置 → 安全设置 → 系统访问令牌 → 生成令牌
26
- 2. **用户 ID**:在个人设置页面,用户名称下方显示的 ID
12
+ ## Claude Code 配置
27
13
 
28
- 配置参考图:https://github.com/zuoliangyu/MICUCODELINE/blob/master/assets/image2.png
14
+ 在 `~/.claude/settings.json` 中添加 `statusLine` 和 `env`:
29
15
 
30
- ## Claude Code 配置
31
- 在 `~/.claude/settings.json` 中设置:
32
16
  ```json
33
17
  {
18
+ "env": {
19
+ "ANTHROPIC_AUTH_TOKEN": "你的 API Key(sk-xxx)",
20
+ "ANTHROPIC_BASE_URL": "https://www.openclaudecode.cn"
21
+ },
34
22
  "statusLine": {
35
23
  "type": "command",
36
24
  "command": "~/.claude/micucodeline/micucodeline",
@@ -39,24 +27,26 @@ C:\Users\你的用户名\.claude\micucodeline\micucodeline.exe
39
27
  }
40
28
  ```
41
29
 
42
- ## 手动配置余额(可选)
43
- 如果不使用配置工具,也可以在 `settings.json` 的 `env` 中手动添加:
30
+ Windows 示例:
44
31
  ```json
45
32
  {
46
33
  "env": {
47
- "ANTHROPIC_AUTH_TOKEN": "xxx",
48
- "ANTHROPIC_BASE_URL": "xxx",
49
- "BALANCE_API_KEY": "YOUR_TOKEN",
50
- "BALANCE_API_USER": "12345",
51
- "BALANCE_API_URL": "https://www.openclaudecode.cn/api/user/self"
34
+ "ANTHROPIC_AUTH_TOKEN": "你的 API Key(sk-xxx",
35
+ "ANTHROPIC_BASE_URL": "https://www.openclaudecode.cn"
36
+ },
37
+ "statusLine": {
38
+ "command": "C:/Users/zuolan/.claude/micucodeline/micucodeline.exe",
39
+ "padding": 0,
40
+ "type": "command"
52
41
  }
53
42
  }
54
43
  ```
55
44
 
45
+ 配置好后,MicuCodeLine 会自动从 `settings.json` 的 `env` 中读取 API Key 和 Base URL,通过 `/api/user/self` 接口自动获取用户真实余额,**无需额外配置**。
46
+
56
47
  ## 使用
57
48
  ```bash
58
49
  micucodeline --help # 查看帮助
59
- micucodeline --version # 查看版本
60
50
  micucodeline --init # 初始化配置与主题
61
51
  micucodeline --config # 打开配置面板
62
52
  micucodeline --theme nord # 指定主题运行
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuolan/micucodeline",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "MicuCodeLine - High-performance Claude Code StatusLine tool",
5
5
  "bin": {
6
6
  "micucodeline": "bin/micucodeline.js"
@@ -9,11 +9,11 @@
9
9
  "postinstall": "node scripts/postinstall.js"
10
10
  },
11
11
  "optionalDependencies": {
12
- "@zuolan/micucodeline-darwin-x64": "1.1.3",
13
- "@zuolan/micucodeline-darwin-arm64": "1.1.3",
14
- "@zuolan/micucodeline-linux-x64": "1.1.3",
15
- "@zuolan/micucodeline-linux-x64-musl": "1.1.3",
16
- "@zuolan/micucodeline-win32-x64": "1.1.3"
12
+ "@zuolan/micucodeline-darwin-x64": "1.2.0",
13
+ "@zuolan/micucodeline-darwin-arm64": "1.2.0",
14
+ "@zuolan/micucodeline-linux-x64": "1.2.0",
15
+ "@zuolan/micucodeline-linux-x64-musl": "1.2.0",
16
+ "@zuolan/micucodeline-win32-x64": "1.2.0"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
@@ -149,35 +149,29 @@ try {
149
149
  console.log('✨ MicuCodeLine is ready for Claude Code!');
150
150
  console.log(`📍 Location: ${targetPath}`);
151
151
  console.log('');
152
+ }
152
153
 
153
- // Auto-run configuration if this is a global install
154
- const isGlobalInstall = process.env.npm_config_global === 'true';
155
-
156
- if (isGlobalInstall && process.stdin.isTTY) {
157
- console.log('🔧 Starting first-time setup...');
158
- console.log('');
159
-
160
- try {
161
- const { spawnSync } = require('child_process');
162
- const result = spawnSync(targetPath, [], {
163
- stdio: 'inherit',
164
- shell: true
165
- });
166
-
167
- if (result.status === 0) {
168
- console.log('');
169
- console.log('✅ Setup completed!');
170
- console.log('🎉 You can now use: micucodeline --help');
171
- }
172
- } catch (error) {
173
- console.log('');
174
- console.log('⚠️ Could not auto-run setup.');
175
- console.log(`💡 Please run manually: ${targetPath}`);
176
- }
177
- } else {
178
- console.log('🎉 You can now use: micucodeline --help');
154
+ // 自动运行 --init 初始化配置(同时触发 auto_install)
155
+ try {
156
+ const { spawnSync } = require('child_process');
157
+ const result = spawnSync(targetPath, ['--init'], {
158
+ stdio: silent ? 'ignore' : 'inherit',
159
+ shell: false,
160
+ timeout: 10000
161
+ });
162
+
163
+ if (!silent && result.status === 0) {
164
+ console.log('✅ Configuration initialized!');
165
+ }
166
+ } catch (error) {
167
+ if (!silent) {
168
+ console.log('⚠️ Could not auto-initialize. Run manually: micucodeline --init');
179
169
  }
180
170
  }
171
+
172
+ if (!silent) {
173
+ console.log('🎉 You can now use: micucodeline --help');
174
+ }
181
175
  } catch (error) {
182
176
  // Silent failure - don't break installation
183
177
  if (!silent) {