ccstatusline 2.0.9 → 2.0.10
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 +9 -1
- package/dist/ccstatusline.js +203 -68
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
[](https://github.com/sirmalloc/ccstatusline/graphs/commit-activity)
|
|
23
23
|
|
|
24
24
|
[](https://github.com/hesreallyhim/awesome-claude-code)
|
|
25
|
+
[](https://claudelog.com/)
|
|
26
|
+
|
|
25
27
|
|
|
26
28
|

|
|
27
29
|
|
|
@@ -42,6 +44,11 @@
|
|
|
42
44
|
|
|
43
45
|
## 🆕 Recent Updates
|
|
44
46
|
|
|
47
|
+
### v2.0.10 - Git Updates
|
|
48
|
+
|
|
49
|
+
- **🌳 Git Worktree widget** - Shows the active worktree name when working with git worktrees
|
|
50
|
+
- **👻 Hide 'no git' message toggle** - Git widgets now support hiding the 'no git' message when not in a repository (toggle with 'h' key while editing the widget)
|
|
51
|
+
|
|
45
52
|
### v2.0.8 - Powerline Auto-Alignment
|
|
46
53
|
|
|
47
54
|

|
|
@@ -137,6 +144,7 @@ Once configured, ccstatusline automatically formats your Claude Code status line
|
|
|
137
144
|
- **Model Name** - Shows the current Claude model (e.g., "Claude 3.5 Sonnet")
|
|
138
145
|
- **Git Branch** - Displays current git branch name
|
|
139
146
|
- **Git Changes** - Shows uncommitted insertions/deletions (e.g., "+42,-10")
|
|
147
|
+
- **Git Worktree** - Shows the name of the current git worktree
|
|
140
148
|
- **Session Clock** - Shows elapsed time since session start (e.g., "2hr 15m")
|
|
141
149
|
- **Session Cost** - Shows total session cost in USD (e.g., "$1.23")
|
|
142
150
|
- **Block Timer** - Shows time elapsed in current 5-hour block or progress bar
|
|
@@ -285,7 +293,7 @@ When terminal width is detected, status lines automatically truncate with ellips
|
|
|
285
293
|
|
|
286
294
|
```bash
|
|
287
295
|
# Clone the repository
|
|
288
|
-
git clone https://github.com/
|
|
296
|
+
git clone https://github.com/sirmalloc/ccstatusline.git
|
|
289
297
|
cd ccstatusline
|
|
290
298
|
|
|
291
299
|
# Install dependencies
|
package/dist/ccstatusline.js
CHANGED
|
@@ -36263,7 +36263,7 @@ function wrapAnsi(string, columns, options) {
|
|
|
36263
36263
|
`);
|
|
36264
36264
|
}
|
|
36265
36265
|
|
|
36266
|
-
// node_modules/is-fullwidth-code-point/index.js
|
|
36266
|
+
// node_modules/cli-truncate/node_modules/slice-ansi/node_modules/is-fullwidth-code-point/index.js
|
|
36267
36267
|
function isFullwidthCodePoint(codePoint) {
|
|
36268
36268
|
if (!Number.isInteger(codePoint)) {
|
|
36269
36269
|
return false;
|
|
@@ -37556,6 +37556,14 @@ function styledCharsToString(chars) {
|
|
|
37556
37556
|
}
|
|
37557
37557
|
return ret;
|
|
37558
37558
|
}
|
|
37559
|
+
// node_modules/is-fullwidth-code-point/index.js
|
|
37560
|
+
function isFullwidthCodePoint3(codePoint) {
|
|
37561
|
+
if (!Number.isInteger(codePoint)) {
|
|
37562
|
+
return false;
|
|
37563
|
+
}
|
|
37564
|
+
return codePoint >= 4352 && (codePoint <= 4447 || codePoint === 9001 || codePoint === 9002 || 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || 12880 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65131 || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 262141);
|
|
37565
|
+
}
|
|
37566
|
+
|
|
37559
37567
|
// node_modules/@alcalzone/ansi-tokenize/build/tokenize.js
|
|
37560
37568
|
function findNumberIndex2(str) {
|
|
37561
37569
|
for (let index = 0;index < str.length; index++) {
|
|
@@ -37607,7 +37615,7 @@ function tokenize2(str, endChar = Number.POSITIVE_INFINITY) {
|
|
|
37607
37615
|
continue;
|
|
37608
37616
|
}
|
|
37609
37617
|
}
|
|
37610
|
-
const fullWidth =
|
|
37618
|
+
const fullWidth = isFullwidthCodePoint3(codePoint);
|
|
37611
37619
|
const character = String.fromCodePoint(codePoint);
|
|
37612
37620
|
ret.push({
|
|
37613
37621
|
type: "char",
|
|
@@ -51037,7 +51045,7 @@ import { execSync as execSync3 } from "child_process";
|
|
|
51037
51045
|
import * as fs5 from "fs";
|
|
51038
51046
|
import * as path4 from "path";
|
|
51039
51047
|
var __dirname = "/Users/sirmalloc/Projects/Personal/ccstatusline/src/utils";
|
|
51040
|
-
var PACKAGE_VERSION = "2.0.
|
|
51048
|
+
var PACKAGE_VERSION = "2.0.10";
|
|
51041
51049
|
function getPackageVersion() {
|
|
51042
51050
|
if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
|
|
51043
51051
|
return PACKAGE_VERSION;
|
|
@@ -51938,16 +51946,38 @@ class GitBranchWidget {
|
|
|
51938
51946
|
return "Git Branch";
|
|
51939
51947
|
}
|
|
51940
51948
|
getEditorDisplay(item) {
|
|
51941
|
-
|
|
51949
|
+
const hideNoGit = item.metadata?.hideNoGit === "true";
|
|
51950
|
+
const modifiers = [];
|
|
51951
|
+
if (hideNoGit) {
|
|
51952
|
+
modifiers.push("hide 'no git'");
|
|
51953
|
+
}
|
|
51954
|
+
return {
|
|
51955
|
+
displayText: this.getDisplayName(),
|
|
51956
|
+
modifierText: modifiers.length > 0 ? `(${modifiers.join(", ")})` : undefined
|
|
51957
|
+
};
|
|
51958
|
+
}
|
|
51959
|
+
handleEditorAction(action, item) {
|
|
51960
|
+
if (action === "toggle-nogit") {
|
|
51961
|
+
const currentState = item.metadata?.hideNoGit === "true";
|
|
51962
|
+
return {
|
|
51963
|
+
...item,
|
|
51964
|
+
metadata: {
|
|
51965
|
+
...item.metadata,
|
|
51966
|
+
hideNoGit: (!currentState).toString()
|
|
51967
|
+
}
|
|
51968
|
+
};
|
|
51969
|
+
}
|
|
51970
|
+
return null;
|
|
51942
51971
|
}
|
|
51943
51972
|
render(item, context, settings) {
|
|
51973
|
+
const hideNoGit = item.metadata?.hideNoGit === "true";
|
|
51944
51974
|
if (context.isPreview) {
|
|
51945
51975
|
return item.rawValue ? "main" : "⎇ main";
|
|
51946
51976
|
}
|
|
51947
51977
|
const branch = this.getGitBranch();
|
|
51948
51978
|
if (branch)
|
|
51949
51979
|
return item.rawValue ? branch : `⎇ ${branch}`;
|
|
51950
|
-
return "⎇ no git";
|
|
51980
|
+
return hideNoGit ? null : "⎇ no git";
|
|
51951
51981
|
}
|
|
51952
51982
|
getGitBranch() {
|
|
51953
51983
|
try {
|
|
@@ -51960,6 +51990,11 @@ class GitBranchWidget {
|
|
|
51960
51990
|
return null;
|
|
51961
51991
|
}
|
|
51962
51992
|
}
|
|
51993
|
+
getCustomKeybinds() {
|
|
51994
|
+
return [
|
|
51995
|
+
{ key: "h", label: "(h)ide 'no git' message", action: "toggle-nogit" }
|
|
51996
|
+
];
|
|
51997
|
+
}
|
|
51963
51998
|
supportsRawValue() {
|
|
51964
51999
|
return true;
|
|
51965
52000
|
}
|
|
@@ -51981,9 +52016,31 @@ class GitChangesWidget {
|
|
|
51981
52016
|
return "Git Changes";
|
|
51982
52017
|
}
|
|
51983
52018
|
getEditorDisplay(item) {
|
|
51984
|
-
|
|
52019
|
+
const hideNoGit = item.metadata?.hideNoGit === "true";
|
|
52020
|
+
const modifiers = [];
|
|
52021
|
+
if (hideNoGit) {
|
|
52022
|
+
modifiers.push("hide 'no git'");
|
|
52023
|
+
}
|
|
52024
|
+
return {
|
|
52025
|
+
displayText: this.getDisplayName(),
|
|
52026
|
+
modifierText: modifiers.length > 0 ? `(${modifiers.join(", ")})` : undefined
|
|
52027
|
+
};
|
|
52028
|
+
}
|
|
52029
|
+
handleEditorAction(action, item) {
|
|
52030
|
+
if (action === "toggle-nogit") {
|
|
52031
|
+
const currentState = item.metadata?.hideNoGit === "true";
|
|
52032
|
+
return {
|
|
52033
|
+
...item,
|
|
52034
|
+
metadata: {
|
|
52035
|
+
...item.metadata,
|
|
52036
|
+
hideNoGit: (!currentState).toString()
|
|
52037
|
+
}
|
|
52038
|
+
};
|
|
52039
|
+
}
|
|
52040
|
+
return null;
|
|
51985
52041
|
}
|
|
51986
52042
|
render(item, context, settings) {
|
|
52043
|
+
const hideNoGit = item.metadata?.hideNoGit === "true";
|
|
51987
52044
|
if (context.isPreview) {
|
|
51988
52045
|
return "(+42,-10)";
|
|
51989
52046
|
}
|
|
@@ -51991,7 +52048,7 @@ class GitChangesWidget {
|
|
|
51991
52048
|
if (changes)
|
|
51992
52049
|
return `(+${changes.insertions},-${changes.deletions})`;
|
|
51993
52050
|
else
|
|
51994
|
-
return "(no git)";
|
|
52051
|
+
return hideNoGit ? null : "(no git)";
|
|
51995
52052
|
}
|
|
51996
52053
|
getGitChanges() {
|
|
51997
52054
|
try {
|
|
@@ -52022,6 +52079,11 @@ class GitChangesWidget {
|
|
|
52022
52079
|
return null;
|
|
52023
52080
|
}
|
|
52024
52081
|
}
|
|
52082
|
+
getCustomKeybinds() {
|
|
52083
|
+
return [
|
|
52084
|
+
{ key: "h", label: "(h)ide 'no git' message", action: "toggle-nogit" }
|
|
52085
|
+
];
|
|
52086
|
+
}
|
|
52025
52087
|
supportsRawValue() {
|
|
52026
52088
|
return false;
|
|
52027
52089
|
}
|
|
@@ -52029,6 +52091,78 @@ class GitChangesWidget {
|
|
|
52029
52091
|
return true;
|
|
52030
52092
|
}
|
|
52031
52093
|
}
|
|
52094
|
+
// src/widgets/GitWorktree.ts
|
|
52095
|
+
import { execSync as execSync6 } from "child_process";
|
|
52096
|
+
|
|
52097
|
+
class GitWorktreeWidget {
|
|
52098
|
+
getDefaultColor() {
|
|
52099
|
+
return "blue";
|
|
52100
|
+
}
|
|
52101
|
+
getDescription() {
|
|
52102
|
+
return "Shows the current git worktree name";
|
|
52103
|
+
}
|
|
52104
|
+
getDisplayName() {
|
|
52105
|
+
return "Git Worktree";
|
|
52106
|
+
}
|
|
52107
|
+
getEditorDisplay(item) {
|
|
52108
|
+
const hideNoGit = item.metadata?.hideNoGit === "true";
|
|
52109
|
+
const modifiers = [];
|
|
52110
|
+
if (hideNoGit) {
|
|
52111
|
+
modifiers.push("hide 'no git'");
|
|
52112
|
+
}
|
|
52113
|
+
return {
|
|
52114
|
+
displayText: this.getDisplayName(),
|
|
52115
|
+
modifierText: modifiers.length > 0 ? `(${modifiers.join(", ")})` : undefined
|
|
52116
|
+
};
|
|
52117
|
+
}
|
|
52118
|
+
handleEditorAction(action, item) {
|
|
52119
|
+
if (action === "toggle-nogit") {
|
|
52120
|
+
const currentState = item.metadata?.hideNoGit === "true";
|
|
52121
|
+
return {
|
|
52122
|
+
...item,
|
|
52123
|
+
metadata: {
|
|
52124
|
+
...item.metadata,
|
|
52125
|
+
hideNoGit: (!currentState).toString()
|
|
52126
|
+
}
|
|
52127
|
+
};
|
|
52128
|
+
}
|
|
52129
|
+
return null;
|
|
52130
|
+
}
|
|
52131
|
+
render(item, context) {
|
|
52132
|
+
const hideNoGit = item.metadata?.hideNoGit === "true";
|
|
52133
|
+
if (context.isPreview)
|
|
52134
|
+
return item.rawValue ? "main" : "\uD81A\uDC30 main";
|
|
52135
|
+
const worktree = this.getGitWorktree();
|
|
52136
|
+
if (worktree)
|
|
52137
|
+
return item.rawValue ? worktree : `\uD81A\uDC30 ${worktree}`;
|
|
52138
|
+
return hideNoGit ? null : "\uD81A\uDC30 no git";
|
|
52139
|
+
}
|
|
52140
|
+
getGitWorktree() {
|
|
52141
|
+
try {
|
|
52142
|
+
const worktreeDir = execSync6("git rev-parse --git-dir", {
|
|
52143
|
+
encoding: "utf8",
|
|
52144
|
+
stdio: ["pipe", "pipe", "ignore"]
|
|
52145
|
+
}).trim();
|
|
52146
|
+
if (worktreeDir.endsWith("/.git") || worktreeDir === ".git")
|
|
52147
|
+
return "main";
|
|
52148
|
+
const [, worktree] = worktreeDir.split(".git/worktrees/");
|
|
52149
|
+
return worktree ?? null;
|
|
52150
|
+
} catch {
|
|
52151
|
+
return null;
|
|
52152
|
+
}
|
|
52153
|
+
}
|
|
52154
|
+
getCustomKeybinds() {
|
|
52155
|
+
return [
|
|
52156
|
+
{ key: "h", label: "(h)ide 'no git' message", action: "toggle-nogit" }
|
|
52157
|
+
];
|
|
52158
|
+
}
|
|
52159
|
+
supportsRawValue() {
|
|
52160
|
+
return true;
|
|
52161
|
+
}
|
|
52162
|
+
supportsColors(item) {
|
|
52163
|
+
return true;
|
|
52164
|
+
}
|
|
52165
|
+
}
|
|
52032
52166
|
// src/utils/renderer.ts
|
|
52033
52167
|
var ANSI_REGEX = new RegExp(`\\x1b\\[[0-9;]*m`, "g");
|
|
52034
52168
|
function formatTokens(count) {
|
|
@@ -52092,6 +52226,13 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
|
|
|
52092
52226
|
}
|
|
52093
52227
|
const widgetElements = [];
|
|
52094
52228
|
let widgetColorIndex = 0;
|
|
52229
|
+
const preRenderedIndices = [];
|
|
52230
|
+
for (let i = 0;i < widgets.length; i++) {
|
|
52231
|
+
const widget = widgets[i];
|
|
52232
|
+
if (widget && widget.type !== "separator" && widget.type !== "flex-separator") {
|
|
52233
|
+
preRenderedIndices.push(i);
|
|
52234
|
+
}
|
|
52235
|
+
}
|
|
52095
52236
|
for (let i = 0;i < filteredWidgets.length; i++) {
|
|
52096
52237
|
const widget = filteredWidgets[i];
|
|
52097
52238
|
if (!widget)
|
|
@@ -52101,13 +52242,14 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
|
|
|
52101
52242
|
if (widget.type === "separator" || widget.type === "flex-separator") {
|
|
52102
52243
|
continue;
|
|
52103
52244
|
}
|
|
52104
|
-
const
|
|
52245
|
+
const actualPreRenderedIndex = preRenderedIndices[i];
|
|
52246
|
+
const preRendered = actualPreRenderedIndex !== undefined ? preRenderedWidgets[actualPreRenderedIndex] : undefined;
|
|
52105
52247
|
if (preRendered?.content) {
|
|
52106
52248
|
widgetText = preRendered.content;
|
|
52107
|
-
|
|
52108
|
-
|
|
52249
|
+
const widgetImpl = getWidget(widget.type);
|
|
52250
|
+
if (widgetImpl) {
|
|
52109
52251
|
defaultColor = widgetImpl.getDefaultColor();
|
|
52110
|
-
}
|
|
52252
|
+
}
|
|
52111
52253
|
}
|
|
52112
52254
|
if (widgetText) {
|
|
52113
52255
|
const padding = settings.defaultPadding ?? "";
|
|
@@ -52152,7 +52294,7 @@ function renderPowerlineStatusLine(widgets, settings, context, lineIndex = 0, gl
|
|
|
52152
52294
|
const element = widgetElements[i];
|
|
52153
52295
|
const maxWidth = preCalculatedMaxWidths[i];
|
|
52154
52296
|
if (element && maxWidth !== undefined) {
|
|
52155
|
-
const currentLength = element.content.replace(ANSI_REGEX, "")
|
|
52297
|
+
const currentLength = stringWidth(element.content.replace(ANSI_REGEX, ""));
|
|
52156
52298
|
const paddingNeeded = maxWidth - currentLength;
|
|
52157
52299
|
if (paddingNeeded > 0) {
|
|
52158
52300
|
element.content += " ".repeat(paddingNeeded);
|
|
@@ -52333,19 +52475,12 @@ function preRenderAllWidgets(allLinesWidgets, settings, context) {
|
|
|
52333
52475
|
});
|
|
52334
52476
|
continue;
|
|
52335
52477
|
}
|
|
52336
|
-
|
|
52337
|
-
|
|
52338
|
-
const widgetImpl = getWidget(widget.type);
|
|
52339
|
-
widgetText = widgetImpl.render(widget, context, settings) ?? "";
|
|
52340
|
-
} catch {
|
|
52341
|
-
preRenderedLine.push({
|
|
52342
|
-
content: "",
|
|
52343
|
-
plainLength: 0,
|
|
52344
|
-
widget
|
|
52345
|
-
});
|
|
52478
|
+
const widgetImpl = getWidget(widget.type);
|
|
52479
|
+
if (!widgetImpl) {
|
|
52346
52480
|
continue;
|
|
52347
52481
|
}
|
|
52348
|
-
const
|
|
52482
|
+
const widgetText = widgetImpl.render(widget, context, settings) ?? "";
|
|
52483
|
+
const plainLength = stringWidth(widgetText.replace(ANSI_REGEX, ""));
|
|
52349
52484
|
preRenderedLine.push({
|
|
52350
52485
|
content: widgetText,
|
|
52351
52486
|
plainLength,
|
|
@@ -52445,12 +52580,8 @@ function renderStatusLine(widgets, settings, context, preRenderedWidgets, preCal
|
|
|
52445
52580
|
if (prevWidget && prevWidget.type !== "separator" && prevWidget.type !== "flex-separator") {
|
|
52446
52581
|
let widgetColor = prevWidget.color;
|
|
52447
52582
|
if (!widgetColor) {
|
|
52448
|
-
|
|
52449
|
-
|
|
52450
|
-
widgetColor = widgetImpl.getDefaultColor();
|
|
52451
|
-
} catch {
|
|
52452
|
-
widgetColor = "white";
|
|
52453
|
-
}
|
|
52583
|
+
const widgetImpl = getWidget(prevWidget.type);
|
|
52584
|
+
widgetColor = widgetImpl ? widgetImpl.getDefaultColor() : "white";
|
|
52454
52585
|
}
|
|
52455
52586
|
separatorColor = widgetColor;
|
|
52456
52587
|
separatorBg = prevWidget.backgroundColor;
|
|
@@ -52471,10 +52602,10 @@ function renderStatusLine(widgets, settings, context, preRenderedWidgets, preCal
|
|
|
52471
52602
|
const preRendered = preRenderedWidgets[i];
|
|
52472
52603
|
if (preRendered?.content) {
|
|
52473
52604
|
widgetText = preRendered.content;
|
|
52474
|
-
|
|
52475
|
-
|
|
52605
|
+
const widgetImpl = getWidget(widget.type);
|
|
52606
|
+
if (widgetImpl) {
|
|
52476
52607
|
defaultColor = widgetImpl.getDefaultColor();
|
|
52477
|
-
}
|
|
52608
|
+
}
|
|
52478
52609
|
}
|
|
52479
52610
|
if (widgetText) {
|
|
52480
52611
|
if (widget.type === "custom-command" && widget.preserveColors) {
|
|
@@ -52540,7 +52671,7 @@ function renderStatusLine(widgets, settings, context, preRenderedWidgets, preCal
|
|
|
52540
52671
|
let widgetColor = prevElem2.widget.color;
|
|
52541
52672
|
if (!widgetColor && prevElem2.widget.type !== "separator" && prevElem2.widget.type !== "flex-separator") {
|
|
52542
52673
|
const widgetImpl = getWidget(prevElem2.widget.type);
|
|
52543
|
-
widgetColor = widgetImpl.getDefaultColor();
|
|
52674
|
+
widgetColor = widgetImpl ? widgetImpl.getDefaultColor() : "white";
|
|
52544
52675
|
}
|
|
52545
52676
|
const coloredSep = applyColorsWithOverride(defaultSep, widgetColor, prevElem2.widget.backgroundColor, prevElem2.widget.bold);
|
|
52546
52677
|
finalElements.push(coloredSep);
|
|
@@ -53070,7 +53201,7 @@ var CustomTextEditor = ({ widget, onComplete, onCancel }) => {
|
|
|
53070
53201
|
}, undefined, true, undefined, this);
|
|
53071
53202
|
};
|
|
53072
53203
|
// src/widgets/CustomCommand.tsx
|
|
53073
|
-
import { execSync as
|
|
53204
|
+
import { execSync as execSync7 } from "child_process";
|
|
53074
53205
|
var import_react30 = __toESM(require_react(), 1);
|
|
53075
53206
|
var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
|
|
53076
53207
|
|
|
@@ -53116,7 +53247,7 @@ class CustomCommandWidget {
|
|
|
53116
53247
|
try {
|
|
53117
53248
|
const timeout = item.timeout ?? 1000;
|
|
53118
53249
|
const jsonInput = JSON.stringify(context.data);
|
|
53119
|
-
let output =
|
|
53250
|
+
let output = execSync7(item.commandPath, {
|
|
53120
53251
|
encoding: "utf8",
|
|
53121
53252
|
input: jsonInput,
|
|
53122
53253
|
timeout,
|
|
@@ -53571,6 +53702,7 @@ var widgetRegistry = new Map([
|
|
|
53571
53702
|
["output-style", new OutputStyleWidget],
|
|
53572
53703
|
["git-branch", new GitBranchWidget],
|
|
53573
53704
|
["git-changes", new GitChangesWidget],
|
|
53705
|
+
["git-worktree", new GitWorktreeWidget],
|
|
53574
53706
|
["current-working-dir", new CurrentWorkingDirWidget],
|
|
53575
53707
|
["tokens-input", new TokensInputWidget],
|
|
53576
53708
|
["tokens-output", new TokensOutputWidget],
|
|
@@ -53588,11 +53720,7 @@ var widgetRegistry = new Map([
|
|
|
53588
53720
|
["custom-command", new CustomCommandWidget]
|
|
53589
53721
|
]);
|
|
53590
53722
|
function getWidget(type) {
|
|
53591
|
-
|
|
53592
|
-
if (!widget) {
|
|
53593
|
-
throw new Error(`Unknown widget type: ${type}`);
|
|
53594
|
-
}
|
|
53595
|
-
return widget;
|
|
53723
|
+
return widgetRegistry.get(type) ?? null;
|
|
53596
53724
|
}
|
|
53597
53725
|
function getAllWidgetTypes(settings) {
|
|
53598
53726
|
const allTypes = Array.from(widgetRegistry.keys());
|
|
@@ -53679,12 +53807,8 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
53679
53807
|
if (widget.type === "separator") {
|
|
53680
53808
|
return showSeparators;
|
|
53681
53809
|
}
|
|
53682
|
-
|
|
53683
|
-
|
|
53684
|
-
return widgetInstance.supportsColors(widget);
|
|
53685
|
-
} catch {
|
|
53686
|
-
return false;
|
|
53687
|
-
}
|
|
53810
|
+
const widgetInstance = getWidget(widget.type);
|
|
53811
|
+
return widgetInstance ? widgetInstance.supportsColors(widget) : true;
|
|
53688
53812
|
});
|
|
53689
53813
|
const [highlightedItemId, setHighlightedItemId] = import_react33.useState(colorableWidgets[0]?.id ?? null);
|
|
53690
53814
|
const [editingBackground, setEditingBackground] = import_react33.useState(false);
|
|
@@ -53854,7 +53978,9 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
53854
53978
|
let defaultColor = "white";
|
|
53855
53979
|
if (widget.type !== "separator" && widget.type !== "flex-separator") {
|
|
53856
53980
|
const widgetImpl = getWidget(widget.type);
|
|
53857
|
-
|
|
53981
|
+
if (widgetImpl) {
|
|
53982
|
+
defaultColor = widgetImpl.getDefaultColor();
|
|
53983
|
+
}
|
|
53858
53984
|
}
|
|
53859
53985
|
let currentColor2 = widget.color ?? defaultColor;
|
|
53860
53986
|
if (currentColor2 === "dim") {
|
|
@@ -53920,7 +54046,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
53920
54046
|
return "Flex Separator";
|
|
53921
54047
|
}
|
|
53922
54048
|
const widgetImpl = getWidget(widget.type);
|
|
53923
|
-
return widgetImpl.getDisplayName()
|
|
54049
|
+
return widgetImpl ? widgetImpl.getDisplayName() : `Unknown: ${widget.type}`;
|
|
53924
54050
|
};
|
|
53925
54051
|
const colorOptions = getAvailableColorsForUI();
|
|
53926
54052
|
const colors = colorOptions.map((c) => c.value || "");
|
|
@@ -53932,7 +54058,9 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
53932
54058
|
let defaultColor = "white";
|
|
53933
54059
|
if (widget.type !== "separator" && widget.type !== "flex-separator") {
|
|
53934
54060
|
const widgetImpl = getWidget(widget.type);
|
|
53935
|
-
|
|
54061
|
+
if (widgetImpl) {
|
|
54062
|
+
defaultColor = widgetImpl.getDefaultColor();
|
|
54063
|
+
}
|
|
53936
54064
|
}
|
|
53937
54065
|
const styledLabel = applyColors(label, widget.color ?? defaultColor, widget.backgroundColor, widget.bold, level);
|
|
53938
54066
|
return {
|
|
@@ -53953,7 +54081,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
53953
54081
|
const currentColor = editingBackground ? selectedWidget?.backgroundColor ?? "" : selectedWidget ? selectedWidget.color ?? (() => {
|
|
53954
54082
|
if (selectedWidget.type !== "separator" && selectedWidget.type !== "flex-separator") {
|
|
53955
54083
|
const widgetImpl = getWidget(selectedWidget.type);
|
|
53956
|
-
return widgetImpl.getDefaultColor();
|
|
54084
|
+
return widgetImpl ? widgetImpl.getDefaultColor() : "white";
|
|
53957
54085
|
}
|
|
53958
54086
|
return "white";
|
|
53959
54087
|
})() : "white";
|
|
@@ -54900,8 +55028,8 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
54900
55028
|
} else if (widgets.length > 0) {
|
|
54901
55029
|
const currentWidget2 = widgets[selectedIndex];
|
|
54902
55030
|
if (currentWidget2 && currentWidget2.type !== "separator" && currentWidget2.type !== "flex-separator") {
|
|
54903
|
-
|
|
54904
|
-
|
|
55031
|
+
const widgetImpl = getWidget(currentWidget2.type);
|
|
55032
|
+
if (widgetImpl) {
|
|
54905
55033
|
if (widgetImpl.getCustomKeybinds) {
|
|
54906
55034
|
const customKeybinds2 = widgetImpl.getCustomKeybinds();
|
|
54907
55035
|
const matchedKeybind = customKeybinds2.find((kb) => kb.key === input);
|
|
@@ -54920,7 +55048,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
54920
55048
|
}
|
|
54921
55049
|
}
|
|
54922
55050
|
}
|
|
54923
|
-
}
|
|
55051
|
+
}
|
|
54924
55052
|
}
|
|
54925
55053
|
}
|
|
54926
55054
|
}
|
|
@@ -54935,8 +55063,11 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
54935
55063
|
return "Flex Separator";
|
|
54936
55064
|
}
|
|
54937
55065
|
const widgetImpl = getWidget(widget.type);
|
|
54938
|
-
|
|
54939
|
-
|
|
55066
|
+
if (widgetImpl) {
|
|
55067
|
+
const { displayText, modifierText } = widgetImpl.getEditorDisplay(widget);
|
|
55068
|
+
return displayText + (modifierText ? ` ${modifierText}` : "");
|
|
55069
|
+
}
|
|
55070
|
+
return `Unknown: ${widget.type}`;
|
|
54940
55071
|
};
|
|
54941
55072
|
const hasFlexSeparator = widgets.some((widget) => widget.type === "flex-separator");
|
|
54942
55073
|
const widthDetectionAvailable = canDetectTerminalWidth();
|
|
@@ -54946,13 +55077,13 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
54946
55077
|
let canToggleRaw = false;
|
|
54947
55078
|
let customKeybinds = [];
|
|
54948
55079
|
if (currentWidget && !isSeparator && !isFlexSeparator) {
|
|
54949
|
-
|
|
54950
|
-
|
|
55080
|
+
const widgetImpl = getWidget(currentWidget.type);
|
|
55081
|
+
if (widgetImpl) {
|
|
54951
55082
|
canToggleRaw = widgetImpl.supportsRawValue();
|
|
54952
55083
|
if (widgetImpl.getCustomKeybinds) {
|
|
54953
55084
|
customKeybinds = widgetImpl.getCustomKeybinds();
|
|
54954
55085
|
}
|
|
54955
|
-
}
|
|
55086
|
+
} else {
|
|
54956
55087
|
canToggleRaw = false;
|
|
54957
55088
|
}
|
|
54958
55089
|
}
|
|
@@ -55102,12 +55233,8 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55102
55233
|
} else if (currentWidget.type === "flex-separator") {
|
|
55103
55234
|
return "Expands to fill available terminal width";
|
|
55104
55235
|
} else {
|
|
55105
|
-
|
|
55106
|
-
|
|
55107
|
-
return widgetImpl.getDescription();
|
|
55108
|
-
} catch {
|
|
55109
|
-
return "Widget description not available";
|
|
55110
|
-
}
|
|
55236
|
+
const widgetImpl = getWidget(currentWidget.type);
|
|
55237
|
+
return widgetImpl ? widgetImpl.getDescription() : "Unknown widget type";
|
|
55111
55238
|
}
|
|
55112
55239
|
})()
|
|
55113
55240
|
}, undefined, false, undefined, this)
|
|
@@ -56488,7 +56615,9 @@ var TerminalOptionsMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
56488
56615
|
if (widget.color?.startsWith("hex:")) {
|
|
56489
56616
|
if (widget.type !== "separator" && widget.type !== "flex-separator") {
|
|
56490
56617
|
const widgetImpl = getWidget(widget.type);
|
|
56491
|
-
|
|
56618
|
+
if (widgetImpl) {
|
|
56619
|
+
newWidget.color = widgetImpl.getDefaultColor();
|
|
56620
|
+
}
|
|
56492
56621
|
}
|
|
56493
56622
|
}
|
|
56494
56623
|
if (widget.backgroundColor?.startsWith("hex:")) {
|
|
@@ -56498,7 +56627,9 @@ var TerminalOptionsMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
56498
56627
|
if (widget.color?.startsWith("ansi256:")) {
|
|
56499
56628
|
if (widget.type !== "separator" && widget.type !== "flex-separator") {
|
|
56500
56629
|
const widgetImpl = getWidget(widget.type);
|
|
56501
|
-
|
|
56630
|
+
if (widgetImpl) {
|
|
56631
|
+
newWidget.color = widgetImpl.getDefaultColor();
|
|
56632
|
+
}
|
|
56502
56633
|
}
|
|
56503
56634
|
}
|
|
56504
56635
|
if (widget.backgroundColor?.startsWith("ansi256:")) {
|
|
@@ -56508,7 +56639,9 @@ var TerminalOptionsMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
56508
56639
|
if (widget.color?.startsWith("ansi256:") || widget.color?.startsWith("hex:")) {
|
|
56509
56640
|
if (widget.type !== "separator" && widget.type !== "flex-separator") {
|
|
56510
56641
|
const widgetImpl = getWidget(widget.type);
|
|
56511
|
-
|
|
56642
|
+
if (widgetImpl) {
|
|
56643
|
+
newWidget.color = widgetImpl.getDefaultColor();
|
|
56644
|
+
}
|
|
56512
56645
|
}
|
|
56513
56646
|
}
|
|
56514
56647
|
if (widget.backgroundColor?.startsWith("ansi256:") || widget.backgroundColor?.startsWith("hex:")) {
|
|
@@ -56534,7 +56667,9 @@ var TerminalOptionsMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
56534
56667
|
if (widget.color?.startsWith("ansi256:") || widget.color?.startsWith("hex:")) {
|
|
56535
56668
|
if (widget.type !== "separator" && widget.type !== "flex-separator") {
|
|
56536
56669
|
const widgetImpl = getWidget(widget.type);
|
|
56537
|
-
|
|
56670
|
+
if (widgetImpl) {
|
|
56671
|
+
newWidget.color = widgetImpl.getDefaultColor();
|
|
56672
|
+
}
|
|
56538
56673
|
}
|
|
56539
56674
|
}
|
|
56540
56675
|
if (widget.backgroundColor?.startsWith("ansi256:") || widget.backgroundColor?.startsWith("hex:")) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccstatusline",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"description": "A customizable status line formatter for Claude Code CLI",
|
|
5
5
|
"module": "src/ccstatusline.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"dist/"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
-
"start": "bun run
|
|
14
|
+
"start": "bun run src/ccstatusline.ts",
|
|
15
15
|
"statusline": "bun run src/ccstatusline.ts",
|
|
16
|
-
"
|
|
17
|
-
"build": "bun run patch && rm -rf dist/* && bun build src/ccstatusline.ts --target=node --outfile=dist/ccstatusline.js --target-version=14",
|
|
16
|
+
"build": "rm -rf dist/* && bun build src/ccstatusline.ts --target=node --outfile=dist/ccstatusline.js --target-version=14",
|
|
18
17
|
"postbuild": "bun run scripts/replace-version.ts",
|
|
19
18
|
"prepublishOnly": "bun run build",
|
|
20
|
-
"lint": "bun tsc --noEmit; eslint . --config eslint.config.js --max-warnings=999999 --fix"
|
|
19
|
+
"lint": "bun tsc --noEmit; eslint . --config eslint.config.js --max-warnings=999999 --fix",
|
|
20
|
+
"test": "bun vitest"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@eslint/js": "^9.33.0",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"ink": "^6.2.0",
|
|
35
35
|
"ink-gradient": "^3.0.0",
|
|
36
36
|
"ink-select-input": "^6.2.0",
|
|
37
|
-
"patch-package": "^8.0.0",
|
|
38
37
|
"react": "^19.1.1",
|
|
39
38
|
"react-devtools-core": "^6.1.5",
|
|
40
39
|
"strip-ansi": "^7.1.0",
|
|
41
40
|
"tinyglobby": "^0.2.14",
|
|
42
41
|
"typescript": "^5.9.2",
|
|
43
42
|
"typescript-eslint": "^8.39.1",
|
|
43
|
+
"vitest": "^3.2.4",
|
|
44
44
|
"zod": "^4.0.17"
|
|
45
45
|
},
|
|
46
46
|
"keywords": [
|
|
@@ -61,5 +61,8 @@
|
|
|
61
61
|
},
|
|
62
62
|
"trustedDependencies": [
|
|
63
63
|
"unrs-resolver"
|
|
64
|
-
]
|
|
64
|
+
],
|
|
65
|
+
"patchedDependencies": {
|
|
66
|
+
"ink@6.2.0": "patches/ink@6.2.0.patch"
|
|
67
|
+
}
|
|
65
68
|
}
|