@winston.wan/burn-your-money 2.3.0 → 3.0.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 +13 -9
- package/install.js +3 -1
- package/nul +0 -0
- package/package.json +1 -1
- package/src/commands/burn-your-money-uninstall.md +23 -0
- package/src/token-history.js +51 -6
- package/uninstall.js +2 -1
package/README.md
CHANGED
|
@@ -71,6 +71,7 @@ npm install -g "@winston.wan/burn-your-money"
|
|
|
71
71
|
| `/burn-your-money` | 查看详细账单(今日/周/月/总计 + 有趣统计) |
|
|
72
72
|
| `/burn-your-money-stats` | 查看 token 使用趋势图 |
|
|
73
73
|
| `/burn-your-money-export` | 导出 token 数据(CSV 格式) |
|
|
74
|
+
| `/burn-your-money-uninstall` | **完全卸载插件(推荐使用此命令卸载)** |
|
|
74
75
|
|
|
75
76
|
---
|
|
76
77
|
|
|
@@ -108,21 +109,16 @@ npm install -g "@winston.wan/burn-your-money"
|
|
|
108
109
|
|
|
109
110
|
### 3. 卸载后状态栏还显示?
|
|
110
111
|
|
|
111
|
-
npm 的 `
|
|
112
|
+
npm 的 `postuninstall` 钩子在某些情况下可能不触发。如果卸载后状态栏还显示:
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
node D:/code/burn-your-money/uninstall.js
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
**方案 2**:手动删除文件和配置
|
|
114
|
+
**手动清理方法**:
|
|
119
115
|
```bash
|
|
120
116
|
# 删除插件文件
|
|
121
117
|
rm -f ~/.claude/statusline.js
|
|
122
118
|
rm -f ~/.claude/scripts/token-history.js
|
|
123
119
|
rm -f ~/.claude/commands/burn-your-money-*.md
|
|
124
120
|
|
|
125
|
-
#
|
|
121
|
+
# 编辑 ~/.claude/settings.json,删除 statusLine 配置项
|
|
126
122
|
```
|
|
127
123
|
|
|
128
124
|
然后重启 Claude Code。
|
|
@@ -131,7 +127,15 @@ rm -f ~/.claude/commands/burn-your-money-*.md
|
|
|
131
127
|
|
|
132
128
|
## 🗑️ 卸载
|
|
133
129
|
|
|
134
|
-
|
|
130
|
+
**推荐方式**:在 Claude Code 中使用自定义命令
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
/burn-your-money-uninstall
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
这个命令会自动删除所有插件文件和配置。
|
|
137
|
+
|
|
138
|
+
**备选方式**:使用 npm 卸载(可能需要手动清理)
|
|
135
139
|
|
|
136
140
|
```bash
|
|
137
141
|
npm uninstall -g "@winston.wan/burn-your-money"
|
package/install.js
CHANGED
|
@@ -88,6 +88,7 @@ function installScripts() {
|
|
|
88
88
|
function configureSettings() {
|
|
89
89
|
log("Configuring Claude Code...", colors.cyan);
|
|
90
90
|
const home = getHomeDir();
|
|
91
|
+
const projectRoot = __dirname;
|
|
91
92
|
const settingsFile = path.join(home, '.claude', 'settings.json');
|
|
92
93
|
|
|
93
94
|
let settings = {};
|
|
@@ -126,7 +127,8 @@ function configureSettings() {
|
|
|
126
127
|
const commands = [
|
|
127
128
|
'burn-your-money.md',
|
|
128
129
|
'burn-your-money-stats.md',
|
|
129
|
-
'burn-your-money-export.md'
|
|
130
|
+
'burn-your-money-export.md',
|
|
131
|
+
'burn-your-money-uninstall.md'
|
|
130
132
|
];
|
|
131
133
|
|
|
132
134
|
const projectCommandsDir = path.join(projectRoot, 'src', 'commands');
|
package/nul
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: burn-your-money-uninstall
|
|
3
|
+
description: 🗑️ 完全卸载 Burn Your Money 插件
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 🗑️ Burn Your Money - 卸载
|
|
7
|
+
|
|
8
|
+
我将帮你完全卸载 Burn Your Money 插件,包括:
|
|
9
|
+
- 删除所有插件文件
|
|
10
|
+
- 移除 settings.json 中的配置
|
|
11
|
+
|
|
12
|
+
请执行以下命令:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
node ~/.claude/scripts/token-history.js uninstall
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
卸载完成后请重启 Claude Code。
|
|
19
|
+
|
|
20
|
+
如果你是通过 npm 全局安装的,也可以运行:
|
|
21
|
+
```bash
|
|
22
|
+
npm uninstall -g @winston.wan/burn-your-money
|
|
23
|
+
```
|
package/src/token-history.js
CHANGED
|
@@ -257,12 +257,6 @@ function main() {
|
|
|
257
257
|
console.log('');
|
|
258
258
|
|
|
259
259
|
// 统计数据
|
|
260
|
-
console.log('📅 今日消费');
|
|
261
|
-
console.log('─'.repeat(40));
|
|
262
|
-
console.log(` Tokens: ${formatNumber(stats.today_tokens)}`);
|
|
263
|
-
console.log(` 费用: $${stats.today_cost}`);
|
|
264
|
-
console.log('');
|
|
265
|
-
|
|
266
260
|
console.log('📆 本周消费');
|
|
267
261
|
console.log('─'.repeat(40));
|
|
268
262
|
console.log(` Tokens: ${formatNumber(stats.week_tokens)}`);
|
|
@@ -321,6 +315,57 @@ function main() {
|
|
|
321
315
|
console.log(' 🎮 "知识就是财富,而财富就是知识" 🎮');
|
|
322
316
|
console.log('='.repeat(50) + '\n');
|
|
323
317
|
break;
|
|
318
|
+
case 'uninstall':
|
|
319
|
+
// 卸载插件
|
|
320
|
+
console.log('\n🗑️ 卸载 Burn Your Money...\n');
|
|
321
|
+
|
|
322
|
+
const homeDir = os.homedir();
|
|
323
|
+
const filesToDelete = [
|
|
324
|
+
path.join(homeDir, '.claude', 'statusline.js'),
|
|
325
|
+
path.join(homeDir, '.claude', 'scripts', 'token-history.js'),
|
|
326
|
+
path.join(homeDir, '.claude', 'commands', 'burn-your-money.md'),
|
|
327
|
+
path.join(homeDir, '.claude', 'commands', 'burn-your-money-stats.md'),
|
|
328
|
+
path.join(homeDir, '.claude', 'commands', 'burn-your-money-export.md'),
|
|
329
|
+
path.join(homeDir, '.claude', 'commands', 'burn-your-money-uninstall.md')
|
|
330
|
+
];
|
|
331
|
+
|
|
332
|
+
// 删除文件
|
|
333
|
+
let deletedCount = 0;
|
|
334
|
+
filesToDelete.forEach(file => {
|
|
335
|
+
if (fs.existsSync(file)) {
|
|
336
|
+
try {
|
|
337
|
+
fs.unlinkSync(file);
|
|
338
|
+
console.log(` ✓ 已删除: ${path.basename(file)}`);
|
|
339
|
+
deletedCount++;
|
|
340
|
+
} catch (e) {
|
|
341
|
+
console.log(` ✗ 删除失败: ${path.basename(file)} - ${e.message}`);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
// 移除 settings.json 中的 statusLine 配置
|
|
347
|
+
const settingsFile = path.join(homeDir, '.claude', 'settings.json');
|
|
348
|
+
if (fs.existsSync(settingsFile)) {
|
|
349
|
+
try {
|
|
350
|
+
const settings = JSON.parse(fs.readFileSync(settingsFile, 'utf8'));
|
|
351
|
+
if (settings.statusLine) {
|
|
352
|
+
delete settings.statusLine;
|
|
353
|
+
fs.writeFileSync(settingsFile, JSON.stringify(settings, null, 2));
|
|
354
|
+
console.log(` ✓ 已移除 settings.json 中的 statusLine 配置`);
|
|
355
|
+
deletedCount++;
|
|
356
|
+
}
|
|
357
|
+
} catch (e) {
|
|
358
|
+
console.log(` ✗ 更新 settings.json 失败: ${e.message}`);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
console.log(`\n✅ 卸载完成!共处理 ${deletedCount} 项。`);
|
|
363
|
+
console.log(`\n请重启 Claude Code 使更改生效。\n`);
|
|
364
|
+
|
|
365
|
+
// 如果是通过 npm 安装的,提示也运行 npm uninstall
|
|
366
|
+
console.log('💡 提示:如果你是通过 npm 全局安装的,也可以运行:');
|
|
367
|
+
console.log(' npm uninstall -g @winston.wan/burn-your-money\n');
|
|
368
|
+
break;
|
|
324
369
|
default:
|
|
325
370
|
// summary
|
|
326
371
|
console.log(JSON.stringify(stats, null, 2));
|
package/uninstall.js
CHANGED
|
@@ -35,7 +35,8 @@ function uninstallFiles() {
|
|
|
35
35
|
// 命令文件
|
|
36
36
|
path.join(home, '.claude', 'commands', 'burn-your-money.md'),
|
|
37
37
|
path.join(home, '.claude', 'commands', 'burn-your-money-stats.md'),
|
|
38
|
-
path.join(home, '.claude', 'commands', 'burn-your-money-export.md')
|
|
38
|
+
path.join(home, '.claude', 'commands', 'burn-your-money-export.md'),
|
|
39
|
+
path.join(home, '.claude', 'commands', 'burn-your-money-uninstall.md')
|
|
39
40
|
];
|
|
40
41
|
|
|
41
42
|
log("Removing plugin files...", colors.cyan);
|