ccstatusline-zh 2.2.7 → 2.2.9
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 +19 -15
- package/dist/ccstatusline.js +22 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -84,22 +84,26 @@ bun install -g ccstatusline-zh
|
|
|
84
84
|
|
|
85
85
|
### 配置 Claude Code
|
|
86
86
|
|
|
87
|
-
在 Claude Code
|
|
87
|
+
在 Claude Code 设置中添加状态栏配置。编辑 `~/.claude/settings.json`:
|
|
88
88
|
|
|
89
89
|
```json
|
|
90
90
|
{
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
91
|
+
"statusLine": {
|
|
92
|
+
"type": "command",
|
|
93
|
+
"command": "ccstatusline-zh",
|
|
94
|
+
"padding": 0
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
如果使用 `npx` 或 `bunx` 运行,可以使用以下命令:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"statusLine": {
|
|
104
|
+
"type": "command",
|
|
105
|
+
"command": "npx -y ccstatusline-zh@latest",
|
|
106
|
+
"padding": 0
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
```
|
|
@@ -127,7 +131,7 @@ ccstatusline-zh 完整支持 Windows 系统。安装方式相同:
|
|
|
127
131
|
npm install -g ccstatusline-zh
|
|
128
132
|
```
|
|
129
133
|
|
|
130
|
-
Windows 下 Claude Code
|
|
134
|
+
Windows 下 Claude Code 的配置路径为 `%USERPROFILE%\.claude\settings.json`。
|
|
131
135
|
|
|
132
136
|
---
|
|
133
137
|
|
|
@@ -135,7 +139,7 @@ Windows 下 Claude Code 的 Hook 配置路径为 `%USERPROFILE%\.claude\settings
|
|
|
135
139
|
|
|
136
140
|
### 基本用法
|
|
137
141
|
|
|
138
|
-
安装并配置
|
|
142
|
+
安装并配置 statusLine 后,ccstatusline-zh 会在每次 Claude Code 更新状态时自动运行。状态数据通过 stdin 以 JSON 格式传入。
|
|
139
143
|
|
|
140
144
|
### 手动测试
|
|
141
145
|
|
package/dist/ccstatusline.js
CHANGED
|
@@ -53882,7 +53882,7 @@ function getTerminalWidth() {
|
|
|
53882
53882
|
function canDetectTerminalWidth() {
|
|
53883
53883
|
return probeTerminalWidth() !== null;
|
|
53884
53884
|
}
|
|
53885
|
-
var __dirname = "/Users/bytedance/Documents/code/bytedance/ccstatusline-zh/src/utils", PACKAGE_VERSION = "2.2.
|
|
53885
|
+
var __dirname = "/Users/bytedance/Documents/code/bytedance/ccstatusline-zh/src/utils", PACKAGE_VERSION = "2.2.9";
|
|
53886
53886
|
var init_terminal = () => {};
|
|
53887
53887
|
|
|
53888
53888
|
// src/utils/renderer.ts
|
|
@@ -54708,21 +54708,22 @@ class ContextPercentageWidget {
|
|
|
54708
54708
|
}
|
|
54709
54709
|
render(item, context, settings) {
|
|
54710
54710
|
const isInverse = isContextInverse(item);
|
|
54711
|
+
const label = isInverse ? "剩余: " : "已用: ";
|
|
54711
54712
|
const contextWindowMetrics = getContextWindowMetrics(context.data);
|
|
54712
54713
|
if (context.isPreview) {
|
|
54713
54714
|
const previewValue = isInverse ? "90.7%" : "9.3%";
|
|
54714
|
-
return formatRawOrLabeledValue(item,
|
|
54715
|
+
return formatRawOrLabeledValue(item, label, previewValue);
|
|
54715
54716
|
}
|
|
54716
54717
|
if (contextWindowMetrics.usedPercentage !== null) {
|
|
54717
54718
|
const displayPercentage = isInverse ? 100 - contextWindowMetrics.usedPercentage : contextWindowMetrics.usedPercentage;
|
|
54718
|
-
return formatRawOrLabeledValue(item,
|
|
54719
|
+
return formatRawOrLabeledValue(item, label, `${displayPercentage.toFixed(1)}%`);
|
|
54719
54720
|
}
|
|
54720
54721
|
if (context.tokenMetrics) {
|
|
54721
54722
|
const modelIdentifier = getModelContextIdentifier(context.data?.model);
|
|
54722
54723
|
const contextConfig = getContextConfig(modelIdentifier, contextWindowMetrics.windowSize);
|
|
54723
54724
|
const usedPercentage = Math.min(100, context.tokenMetrics.contextLength / contextConfig.maxTokens * 100);
|
|
54724
54725
|
const displayPercentage = isInverse ? 100 - usedPercentage : usedPercentage;
|
|
54725
|
-
return formatRawOrLabeledValue(item,
|
|
54726
|
+
return formatRawOrLabeledValue(item, label, `${displayPercentage.toFixed(1)}%`);
|
|
54726
54727
|
}
|
|
54727
54728
|
return null;
|
|
54728
54729
|
}
|
|
@@ -54748,10 +54749,10 @@ class ContextPercentageUsableWidget {
|
|
|
54748
54749
|
return "green";
|
|
54749
54750
|
}
|
|
54750
54751
|
getDescription() {
|
|
54751
|
-
return "
|
|
54752
|
+
return "显示有效上下文窗口已用或剩余百分比(自动压缩前最大值的 80%)";
|
|
54752
54753
|
}
|
|
54753
54754
|
getDisplayName() {
|
|
54754
|
-
return "上下文
|
|
54755
|
+
return "上下文 %(有效)";
|
|
54755
54756
|
}
|
|
54756
54757
|
getCategory() {
|
|
54757
54758
|
return "上下文";
|
|
@@ -54767,22 +54768,23 @@ class ContextPercentageUsableWidget {
|
|
|
54767
54768
|
}
|
|
54768
54769
|
render(item, context, settings) {
|
|
54769
54770
|
const isInverse = isContextInverse(item);
|
|
54771
|
+
const label = isInverse ? "剩余: " : "已用: ";
|
|
54770
54772
|
const modelIdentifier = getModelContextIdentifier(context.data?.model);
|
|
54771
54773
|
const contextWindowMetrics = getContextWindowMetrics(context.data);
|
|
54772
54774
|
const contextConfig = getContextConfig(modelIdentifier, contextWindowMetrics.windowSize);
|
|
54773
54775
|
if (context.isPreview) {
|
|
54774
54776
|
const previewValue = isInverse ? "88.4%" : "11.6%";
|
|
54775
|
-
return formatRawOrLabeledValue(item,
|
|
54777
|
+
return formatRawOrLabeledValue(item, label, previewValue);
|
|
54776
54778
|
}
|
|
54777
54779
|
if (contextWindowMetrics.contextLengthTokens !== null) {
|
|
54778
54780
|
const usedPercentage = Math.min(100, contextWindowMetrics.contextLengthTokens / contextConfig.usableTokens * 100);
|
|
54779
54781
|
const displayPercentage = isInverse ? 100 - usedPercentage : usedPercentage;
|
|
54780
|
-
return formatRawOrLabeledValue(item,
|
|
54782
|
+
return formatRawOrLabeledValue(item, label, `${displayPercentage.toFixed(1)}%`);
|
|
54781
54783
|
}
|
|
54782
54784
|
if (context.tokenMetrics) {
|
|
54783
54785
|
const usedPercentage = Math.min(100, context.tokenMetrics.contextLength / contextConfig.usableTokens * 100);
|
|
54784
54786
|
const displayPercentage = isInverse ? 100 - usedPercentage : usedPercentage;
|
|
54785
|
-
return formatRawOrLabeledValue(item,
|
|
54787
|
+
return formatRawOrLabeledValue(item, label, `${displayPercentage.toFixed(1)}%`);
|
|
54786
54788
|
}
|
|
54787
54789
|
return null;
|
|
54788
54790
|
}
|
|
@@ -65796,8 +65798,11 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
65796
65798
|
if (canMerge) {
|
|
65797
65799
|
helpText += ", (m)合并";
|
|
65798
65800
|
}
|
|
65799
|
-
helpText += ", ESC 返回";
|
|
65800
65801
|
const customKeybindsText = customKeybinds.map((kb) => kb.label).join(", ");
|
|
65802
|
+
if (customKeybindsText) {
|
|
65803
|
+
helpText += `, ${customKeybindsText}`;
|
|
65804
|
+
}
|
|
65805
|
+
helpText += ", ESC 返回";
|
|
65801
65806
|
const pickerActionLabel = widgetPicker?.action === "add" ? "添加组件" : widgetPicker?.action === "insert" ? "插入组件" : "更改组件类型";
|
|
65802
65807
|
if (customEditorWidget?.impl.renderEditor) {
|
|
65803
65808
|
return customEditorWidget.impl.renderEditor({
|
|
@@ -65952,17 +65957,11 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
65952
65957
|
}, undefined, true, undefined, this)
|
|
65953
65958
|
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
65954
65959
|
flexDirection: "column",
|
|
65955
|
-
children:
|
|
65956
|
-
|
|
65957
|
-
|
|
65958
|
-
|
|
65959
|
-
|
|
65960
|
-
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
65961
|
-
dimColor: true,
|
|
65962
|
-
children: customKeybindsText || " "
|
|
65963
|
-
}, undefined, false, undefined, this)
|
|
65964
|
-
]
|
|
65965
|
-
}, undefined, true, undefined, this),
|
|
65960
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Text, {
|
|
65961
|
+
dimColor: true,
|
|
65962
|
+
children: helpText
|
|
65963
|
+
}, undefined, false, undefined, this)
|
|
65964
|
+
}, undefined, false, undefined, this),
|
|
65966
65965
|
hasFlexSeparator && !widthDetectionAvailable && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(Box_default, {
|
|
65967
65966
|
marginTop: 1,
|
|
65968
65967
|
children: [
|
|
@@ -67086,7 +67085,8 @@ var PowerlineThemeSelector = ({
|
|
|
67086
67085
|
// src/tui/components/PowerlineSetup.tsx
|
|
67087
67086
|
var jsx_dev_runtime17 = __toESM(require_jsx_dev_runtime(), 1);
|
|
67088
67087
|
function formatPowerlineMenuLabel(label) {
|
|
67089
|
-
const
|
|
67088
|
+
const segmenter2 = new Intl.Segmenter;
|
|
67089
|
+
const displayWidth = Array.from(segmenter2.segment(label)).reduce((w, { segment: ch }) => w + ((ch.codePointAt(0) ?? 0) > 127 ? 2 : 1), 0);
|
|
67090
67090
|
const targetWidth = 10;
|
|
67091
67091
|
const padCount = Math.max(0, targetWidth - displayWidth);
|
|
67092
67092
|
return label + " ".repeat(padCount);
|