code-abyss 1.6.10 → 1.6.12

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/bin/install.js CHANGED
@@ -7,7 +7,7 @@ const os = require('os');
7
7
  const VERSION = require(path.join(__dirname, '..', 'package.json')).version;
8
8
  const HOME = os.homedir();
9
9
  const SKIP = ['__pycache__', '.pyc', '.pyo', '.egg-info', '.DS_Store', 'Thumbs.db', '.git'];
10
- const PKG_ROOT = path.join(__dirname, '..');
10
+ const PKG_ROOT = fs.realpathSync(path.join(__dirname, '..'));
11
11
 
12
12
  // ── ANSI ──
13
13
 
@@ -250,7 +250,10 @@ function installCore(tgt) {
250
250
  filesToInstall.forEach(({ src, dest }) => {
251
251
  const srcPath = path.join(PKG_ROOT, src);
252
252
  const destPath = path.join(targetDir, dest);
253
- if (!fs.existsSync(srcPath)) { warn(`跳过: ${src}`); return; }
253
+ if (!fs.existsSync(srcPath)) {
254
+ if (src === 'skills') { fail(`核心文件缺失: ${srcPath}\n 请尝试: npm cache clean --force && npx code-abyss`); process.exit(1); }
255
+ warn(`跳过: ${src}`); return;
256
+ }
254
257
  if (fs.existsSync(destPath)) {
255
258
  const bp = path.join(backupDir, dest);
256
259
  rmSafe(bp); copyRecursive(destPath, bp); manifest.backups.push(dest);
@@ -316,6 +319,7 @@ async function postClaude(ctx) {
316
319
  printMergeLog(log);
317
320
  fs.writeFileSync(ctx.settingsPath, JSON.stringify(ctx.settings, null, 2) + '\n');
318
321
  ok('settings.json 合并完成');
322
+ await installCcline(ctx);
319
323
  return;
320
324
  }
321
325
 
@@ -323,7 +327,7 @@ async function postClaude(ctx) {
323
327
  message: '选择要安装的配置 (空格选择, 回车确认)',
324
328
  choices: [
325
329
  { name: '精细合并推荐 settings.json (保留现有配置)', value: 'settings', checked: true },
326
- { name: '安装 ccline 状态栏 (需要 Nerd Font)', value: 'ccline' },
330
+ { name: '安装 ccline 状态栏 (需要 Nerd Font)', value: 'ccline', checked: true },
327
331
  ],
328
332
  });
329
333
 
@@ -343,45 +347,64 @@ async function installCcline(ctx) {
343
347
  console.log('');
344
348
  info('安装 ccline 状态栏...');
345
349
  const { execSync } = require('child_process');
350
+ const cclineDir = path.join(HOME, '.claude', 'ccline');
351
+ const cclineBin = path.join(cclineDir, process.platform === 'win32' ? 'ccline.exe' : 'ccline');
346
352
 
347
- let installed = false;
348
- try { execSync('ccline --version', { stdio: 'pipe' }); installed = true; } catch (e) {}
349
- if (!installed) {
350
- const cclineBin = path.join(HOME, '.claude', 'ccline', 'ccline');
351
- if (fs.existsSync(cclineBin)) installed = true;
353
+ // 1. 检测是否已有二进制
354
+ let hasBin = fs.existsSync(cclineBin);
355
+ if (!hasBin) {
356
+ try { execSync('ccline --version', { stdio: 'pipe' }); hasBin = true; } catch (e) {}
352
357
  }
353
358
 
354
- if (!installed) {
359
+ // 2. 未安装则通过 npm 安装(postinstall 自动下载原生二进制)
360
+ if (!hasBin) {
355
361
  info('ccline 未检测到,正在安装...');
356
362
  try {
357
363
  execSync('npm install -g @cometix/ccline', { stdio: 'inherit' });
358
- installed = true;
359
- ok('ccline 安装成功');
364
+ hasBin = fs.existsSync(cclineBin);
365
+ if (hasBin) ok('ccline 二进制安装成功');
366
+ else {
367
+ try { execSync('ccline --version', { stdio: 'pipe' }); hasBin = true; ok('ccline 安装成功 (全局)'); } catch (e) {}
368
+ }
360
369
  } catch (e) {
361
370
  warn('npm install -g @cometix/ccline 失败');
362
- info(`手动: ${c.cyn('https://github.com/Haleclipse/CCometixLine/releases')}`);
371
+ info(`手动安装: ${c.cyn('npm install -g @cometix/ccline')}`);
372
+ info(`或下载: ${c.cyn('https://github.com/Haleclipse/CCometixLine/releases')}`);
363
373
  }
364
374
  } else {
365
- ok('ccline 已安装');
375
+ ok('ccline 二进制已存在');
366
376
  }
367
377
 
368
- const cclineConfig = path.join(HOME, '.claude', 'ccline', 'config.toml');
369
- if (installed && !fs.existsSync(cclineConfig)) {
370
- try { execSync('ccline --init', { stdio: 'inherit' }); ok('ccline 默认配置已生成'); }
371
- catch (e) { warn('ccline --init 失败,可手动运行'); }
372
- } else if (fs.existsSync(cclineConfig)) {
373
- ok('ccline/config.toml (已存在)');
378
+ // 3. 部署打包的 config.toml(覆盖默认配置)
379
+ const bundledConfig = path.join(PKG_ROOT, 'config', 'ccline', 'config.toml');
380
+ const targetConfig = path.join(cclineDir, 'config.toml');
381
+ if (fs.existsSync(bundledConfig)) {
382
+ fs.mkdirSync(cclineDir, { recursive: true });
383
+ if (fs.existsSync(targetConfig)) {
384
+ info(`备份: ${c.d('ccline/config.toml')}`);
385
+ const backupDir = path.join(HOME, '.claude', '.sage-backup');
386
+ fs.mkdirSync(backupDir, { recursive: true });
387
+ fs.copyFileSync(targetConfig, path.join(backupDir, 'ccline-config.toml'));
388
+ }
389
+ fs.copyFileSync(bundledConfig, targetConfig);
390
+ ok('ccline/config.toml 已部署 (Code Abyss 定制版)');
391
+ } else {
392
+ // 无打包配置,回退到 ccline --init
393
+ if (hasBin && !fs.existsSync(targetConfig)) {
394
+ try { execSync('ccline --init', { stdio: 'inherit' }); ok('ccline 默认配置已生成'); }
395
+ catch (e) { warn('ccline --init 失败,可手动运行'); }
396
+ }
374
397
  }
375
398
 
399
+ // 4. 合并 statusLine 到 settings.json
376
400
  ctx.settings.statusLine = CCLINE_STATUS_LINE.statusLine;
377
401
  ok(`statusLine → ${c.cyn(CCLINE_STATUS_LINE.statusLine.command)}`);
378
402
  fs.writeFileSync(ctx.settingsPath, JSON.stringify(ctx.settings, null, 2) + '\n');
379
403
 
380
404
  console.log('');
381
- warn(`需要 ${c.b('Nerd Font')} 字体`);
405
+ warn(`需要 ${c.b('Nerd Font')} 字体才能正确显示图标`);
382
406
  info(`推荐: FiraCode Nerd Font / JetBrainsMono Nerd Font`);
383
407
  info(`下载: ${c.cyn('https://www.nerdfonts.com/')}`);
384
- info(`配置: ${c.cyn('ccline --config')}`);
385
408
  ok('ccline 配置完成');
386
409
  }
387
410
 
@@ -0,0 +1,161 @@
1
+ theme = "www"
2
+
3
+ [style]
4
+ mode = "nerd_font"
5
+ separator = " | "
6
+
7
+ [[segments]]
8
+ id = "model"
9
+ enabled = true
10
+
11
+ [segments.icon]
12
+ plain = "🤖"
13
+ nerd_font = ""
14
+
15
+ [segments.colors.icon]
16
+ c256 = 208
17
+
18
+ [segments.colors.text]
19
+ c256 = 208
20
+
21
+ [segments.styles]
22
+ text_bold = true
23
+
24
+ [segments.options]
25
+
26
+ [[segments]]
27
+ id = "directory"
28
+ enabled = true
29
+
30
+ [segments.icon]
31
+ plain = "📁"
32
+ nerd_font = "󰉋"
33
+
34
+ [segments.colors.icon]
35
+ c256 = 142
36
+
37
+ [segments.colors.text]
38
+ c256 = 142
39
+
40
+ [segments.styles]
41
+ text_bold = true
42
+
43
+ [segments.options]
44
+
45
+ [[segments]]
46
+ id = "git"
47
+ enabled = true
48
+
49
+ [segments.icon]
50
+ plain = "🌿"
51
+ nerd_font = "󰊢"
52
+
53
+ [segments.colors.icon]
54
+ c256 = 109
55
+
56
+ [segments.colors.text]
57
+ c256 = 109
58
+
59
+ [segments.styles]
60
+ text_bold = true
61
+
62
+ [segments.options]
63
+ show_sha = false
64
+
65
+ [[segments]]
66
+ id = "context_window"
67
+ enabled = true
68
+
69
+ [segments.icon]
70
+ plain = "⚡️"
71
+ nerd_font = ""
72
+
73
+ [segments.colors.icon]
74
+ c16 = 5
75
+
76
+ [segments.colors.text]
77
+ c16 = 5
78
+
79
+ [segments.styles]
80
+ text_bold = true
81
+
82
+ [segments.options]
83
+
84
+ [[segments]]
85
+ id = "usage"
86
+ enabled = true
87
+
88
+ [segments.icon]
89
+ plain = "📊"
90
+ nerd_font = "󰪞"
91
+
92
+ [segments.colors.icon]
93
+ c16 = 14
94
+
95
+ [segments.colors.text]
96
+ c16 = 14
97
+
98
+ [segments.styles]
99
+ text_bold = false
100
+
101
+ [segments.options]
102
+ cache_duration = 180
103
+ timeout = 2
104
+ api_base_url = "https://api.anthropic.com"
105
+
106
+ [[segments]]
107
+ id = "cost"
108
+ enabled = true
109
+
110
+ [segments.icon]
111
+ plain = "💰"
112
+ nerd_font = ""
113
+
114
+ [segments.colors.icon]
115
+ c256 = 214
116
+
117
+ [segments.colors.text]
118
+ c256 = 214
119
+
120
+ [segments.styles]
121
+ text_bold = true
122
+
123
+ [segments.options]
124
+
125
+ [[segments]]
126
+ id = "session"
127
+ enabled = true
128
+
129
+ [segments.icon]
130
+ plain = "⏱️"
131
+ nerd_font = "󱦻"
132
+
133
+ [segments.colors.icon]
134
+ c256 = 142
135
+
136
+ [segments.colors.text]
137
+ c256 = 142
138
+
139
+ [segments.styles]
140
+ text_bold = true
141
+
142
+ [segments.options]
143
+
144
+ [[segments]]
145
+ id = "output_style"
146
+ enabled = true
147
+
148
+ [segments.icon]
149
+ plain = "🎯"
150
+ nerd_font = "󱋵"
151
+
152
+ [segments.colors.icon]
153
+ c256 = 109
154
+
155
+ [segments.colors.text]
156
+ c256 = 109
157
+
158
+ [segments.styles]
159
+ text_bold = true
160
+
161
+ [segments.options]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-abyss",
3
- "version": "1.6.10",
3
+ "version": "1.6.12",
4
4
  "description": "邪修红尘仙·宿命深渊 - 一键为 Claude Code / Codex CLI 注入邪修人格与安全工程知识体系",
5
5
  "keywords": [
6
6
  "claude",