cc-insight 0.1.1 → 0.1.3

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
@@ -47,7 +47,7 @@ CC Insight indexes your local session history and presents it as an interactive
47
47
 
48
48
  ## Requirements
49
49
 
50
- - Node.js ≥ 20
50
+ - Node.js ≥ 20 (LTS recommended: 20, 22, or 24)
51
51
  - Claude Code installed (`~/.claude/` directory must exist)
52
52
 
53
53
  ---
package/README.zh.md CHANGED
@@ -47,7 +47,7 @@ CC Insight 把你本地的对话历史建立索引,以交互式仪表盘的形
47
47
 
48
48
  ## 环境要求
49
49
 
50
- - Node.js ≥ 20
50
+ - Node.js ≥ 20(推荐 LTS 版本:20、22 或 24)
51
51
  - 已安装并使用过 Claude Code(`~/.claude/` 目录存在)
52
52
 
53
53
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-insight",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Local Claude Code usage dashboard — sessions, skills, efficiency, MCP servers, and shareable poster",
5
5
  "type": "module",
6
6
  "bin": {
@@ -3,7 +3,8 @@ import { setRange } from './app.js'
3
3
 
4
4
  const TOPIC_COLORS = {
5
5
  '调试修复': 'var(--green)',
6
- '新功能开发': 'var(--cyan)',
6
+ '功能开发': 'var(--cyan)',
7
+ '新功能开发': 'var(--cyan)', // 旧数据兼容
7
8
  '架构设计': 'var(--amber)',
8
9
  '代码重构': 'var(--purple)',
9
10
  '学习探索': 'var(--red)',
@@ -15,7 +16,8 @@ const TOPIC_COLORS = {
15
16
  // 热力图用 rgba,支持按强度调节透明度
16
17
  const TOPIC_HEX = {
17
18
  '调试修复': '74,222,128',
18
- '新功能开发': '34,211,238',
19
+ '功能开发': '34,211,238',
20
+ '新功能开发': '34,211,238', // 旧数据兼容
19
21
  '架构设计': '245,158,11',
20
22
  '代码重构': '167,139,250',
21
23
  '学习探索': '248,113,113',
@@ -296,7 +298,7 @@ function renderOutliers(el, rows) {
296
298
  ${preview}
297
299
  </div>
298
300
  </div>`
299
- }, '暂无高轮次 Session')
301
+ }, '暂无数据')
300
302
  }
301
303
 
302
304
  // ── 项目分布 ──
@@ -252,7 +252,11 @@ function renderDist(el, data) {
252
252
  col.addEventListener('mouseenter', () => { tip.textContent = col.dataset.label; tip.style.opacity = '1' })
253
253
  col.addEventListener('mouseleave', () => { tip.style.opacity = '0' })
254
254
  col.addEventListener('mousemove', e => {
255
- tip.style.left = (e.clientX + 12) + 'px'
255
+ const tipW = tip.offsetWidth || 120
256
+ const left = e.clientX + 12 + tipW > window.innerWidth
257
+ ? e.clientX - tipW - 8
258
+ : e.clientX + 12
259
+ tip.style.left = left + 'px'
256
260
  tip.style.top = (e.clientY - 24) + 'px'
257
261
  })
258
262
  })
@@ -359,20 +363,28 @@ function renderToolDist(el, data) {
359
363
 
360
364
  // SVG 环形图
361
365
  const R = 54, r = 32, cx = 70, cy = 70
362
- let angle = -Math.PI / 2
363
- const paths = items.map((item, i) => {
364
- const pct = item.count / total
365
- const sweep = pct * 2 * Math.PI
366
- const x1 = cx + R * Math.cos(angle), y1 = cy + R * Math.sin(angle)
367
- const x2 = cx + R * Math.cos(angle + sweep), y2 = cy + R * Math.sin(angle + sweep)
368
- const ix1 = cx + r * Math.cos(angle), iy1 = cy + r * Math.sin(angle)
369
- const ix2 = cx + r * Math.cos(angle + sweep), iy2 = cy + r * Math.sin(angle + sweep)
370
- const large = sweep > Math.PI ? 1 : 0
371
- const color = i < COLORS.length ? COLORS[i] : 'var(--muted)'
372
- const d = `M${x1},${y1} A${R},${R},0,${large},1,${x2},${y2} L${ix2},${iy2} A${r},${r},0,${large},0,${ix1},${iy1} Z`
373
- angle += sweep
374
- return `<path d="${d}" fill="${color}" opacity="0.9"/>`
375
- }).join('')
366
+ let paths
367
+ if (items.length === 1) {
368
+ // 单项无法用 arc path 画完整圆,用两个同心圆代替
369
+ const color = COLORS[0]
370
+ paths = `<circle cx="${cx}" cy="${cy}" r="${R}" fill="${color}" opacity="0.9"/>
371
+ <circle cx="${cx}" cy="${cy}" r="${r}" fill="var(--bg1)"/>`
372
+ } else {
373
+ let angle = -Math.PI / 2
374
+ paths = items.map((item, i) => {
375
+ const pct = item.count / total
376
+ const sweep = pct * 2 * Math.PI
377
+ const x1 = cx + R * Math.cos(angle), y1 = cy + R * Math.sin(angle)
378
+ const x2 = cx + R * Math.cos(angle + sweep), y2 = cy + R * Math.sin(angle + sweep)
379
+ const ix1 = cx + r * Math.cos(angle), iy1 = cy + r * Math.sin(angle)
380
+ const ix2 = cx + r * Math.cos(angle + sweep), iy2 = cy + r * Math.sin(angle + sweep)
381
+ const large = sweep > Math.PI ? 1 : 0
382
+ const color = i < COLORS.length ? COLORS[i] : 'var(--muted)'
383
+ const d = `M${x1},${y1} A${R},${R},0,${large},1,${x2},${y2} L${ix2},${iy2} A${r},${r},0,${large},0,${ix1},${iy1} Z`
384
+ angle += sweep
385
+ return `<path d="${d}" fill="${color}" opacity="0.9"/>`
386
+ }).join('')
387
+ }
376
388
 
377
389
  const totalFmt = total >= 10000 ? (total / 10000).toFixed(1) + 'w次' : total.toLocaleString() + '次'
378
390
 
@@ -8,7 +8,7 @@ export const TOPIC_RULES = [
8
8
  'traceback', 'stacktrace', '调试', 'debug', 'broken', 'not working'],
9
9
  },
10
10
  {
11
- topic: '新功能开发',
11
+ topic: '功能开发',
12
12
  keywords: ['新增', 'implement', 'feature', '功能', ' add ', 'build', '做一个', '开发',
13
13
  '实现', '支持', '创建', 'create', '添加', '增加', 'develop', 'new feature'],
14
14
  },