ccstatusline 2.0.14 → 2.0.16
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 +6 -0
- package/dist/ccstatusline.js +88 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,6 +46,12 @@
|
|
|
46
46
|
|
|
47
47
|
## 🆕 Recent Updates
|
|
48
48
|
|
|
49
|
+
### v2.0.16 - Add fish style path abbreviation toggle to Current Working Directory widget
|
|
50
|
+
|
|
51
|
+
### v2.0.15 - Block Timer calculation fixes
|
|
52
|
+
|
|
53
|
+
- Fix miscalculation in the block timer
|
|
54
|
+
|
|
49
55
|
### v2.0.14 - Add remaining mode toggle to Context Percentage widgets
|
|
50
56
|
|
|
51
57
|
- **Remaining Mode** - You can now toggle the Context Percentage widgets between usage percentage and remaining percentage when configuring them in the TUI by pressing the 'l' key.
|
package/dist/ccstatusline.js
CHANGED
|
@@ -51374,7 +51374,7 @@ import { execSync as execSync3 } from "child_process";
|
|
|
51374
51374
|
import * as fs5 from "fs";
|
|
51375
51375
|
import * as path4 from "path";
|
|
51376
51376
|
var __dirname = "/Users/sirmalloc/Projects/Personal/ccstatusline/src/utils";
|
|
51377
|
-
var PACKAGE_VERSION = "2.0.
|
|
51377
|
+
var PACKAGE_VERSION = "2.0.16";
|
|
51378
51378
|
function getPackageVersion() {
|
|
51379
51379
|
if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
|
|
51380
51380
|
return PACKAGE_VERSION;
|
|
@@ -54057,6 +54057,7 @@ class BlockTimerWidget {
|
|
|
54057
54057
|
// src/widgets/CurrentWorkingDir.tsx
|
|
54058
54058
|
var import_react31 = __toESM(require_react(), 1);
|
|
54059
54059
|
var jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
|
|
54060
|
+
import * as os5 from "node:os";
|
|
54060
54061
|
|
|
54061
54062
|
class CurrentWorkingDirWidget {
|
|
54062
54063
|
getDefaultColor() {
|
|
@@ -54070,8 +54071,11 @@ class CurrentWorkingDirWidget {
|
|
|
54070
54071
|
}
|
|
54071
54072
|
getEditorDisplay(item) {
|
|
54072
54073
|
const segments = item.metadata?.segments ? parseInt(item.metadata.segments, 10) : undefined;
|
|
54074
|
+
const fishStyle = item.metadata?.fishStyle === "true";
|
|
54073
54075
|
const modifiers = [];
|
|
54074
|
-
if (
|
|
54076
|
+
if (fishStyle) {
|
|
54077
|
+
modifiers.push("fish-style");
|
|
54078
|
+
} else if (segments && segments > 0) {
|
|
54075
54079
|
modifiers.push(`segments: ${segments}`);
|
|
54076
54080
|
}
|
|
54077
54081
|
return {
|
|
@@ -54079,28 +54083,54 @@ class CurrentWorkingDirWidget {
|
|
|
54079
54083
|
modifierText: modifiers.length > 0 ? `(${modifiers.join(", ")})` : undefined
|
|
54080
54084
|
};
|
|
54081
54085
|
}
|
|
54086
|
+
handleEditorAction(action, item) {
|
|
54087
|
+
if (action === "toggle-fish-style") {
|
|
54088
|
+
const currentFishStyle = item.metadata?.fishStyle === "true";
|
|
54089
|
+
const newFishStyle = !currentFishStyle;
|
|
54090
|
+
if (newFishStyle) {
|
|
54091
|
+
const { segments, ...restMetadata } = item.metadata ?? {};
|
|
54092
|
+
return {
|
|
54093
|
+
...item,
|
|
54094
|
+
metadata: {
|
|
54095
|
+
...restMetadata,
|
|
54096
|
+
fishStyle: "true"
|
|
54097
|
+
}
|
|
54098
|
+
};
|
|
54099
|
+
} else {
|
|
54100
|
+
const { fishStyle, ...restMetadata } = item.metadata ?? {};
|
|
54101
|
+
return {
|
|
54102
|
+
...item,
|
|
54103
|
+
metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
|
|
54104
|
+
};
|
|
54105
|
+
}
|
|
54106
|
+
}
|
|
54107
|
+
return null;
|
|
54108
|
+
}
|
|
54082
54109
|
render(item, context, settings) {
|
|
54110
|
+
const segments = item.metadata?.segments ? parseInt(item.metadata.segments, 10) : undefined;
|
|
54111
|
+
const fishStyle = item.metadata?.fishStyle === "true";
|
|
54083
54112
|
if (context.isPreview) {
|
|
54084
|
-
const segments2 = item.metadata?.segments ? parseInt(item.metadata.segments, 10) : undefined;
|
|
54085
54113
|
let previewPath;
|
|
54086
|
-
if (
|
|
54087
|
-
|
|
54114
|
+
if (fishStyle) {
|
|
54115
|
+
previewPath = "~/D/P/my-project";
|
|
54116
|
+
} else if (segments && segments > 0) {
|
|
54117
|
+
if (segments === 1) {
|
|
54088
54118
|
previewPath = ".../project";
|
|
54089
54119
|
} else {
|
|
54090
54120
|
previewPath = ".../example/project";
|
|
54091
54121
|
}
|
|
54092
54122
|
} else {
|
|
54093
|
-
previewPath = "/Users/example/project";
|
|
54123
|
+
previewPath = "/Users/example/Documents/Projects/my-project";
|
|
54094
54124
|
}
|
|
54095
54125
|
return item.rawValue ? previewPath : `cwd: ${previewPath}`;
|
|
54096
54126
|
}
|
|
54097
54127
|
const cwd2 = context.data?.cwd;
|
|
54098
|
-
if (!cwd2)
|
|
54128
|
+
if (!cwd2)
|
|
54099
54129
|
return null;
|
|
54100
|
-
}
|
|
54101
|
-
const segments = item.metadata?.segments ? parseInt(item.metadata.segments, 10) : undefined;
|
|
54102
54130
|
let displayPath = cwd2;
|
|
54103
|
-
if (
|
|
54131
|
+
if (fishStyle) {
|
|
54132
|
+
displayPath = this.abbreviatePath(cwd2);
|
|
54133
|
+
} else if (segments && segments > 0) {
|
|
54104
54134
|
const useBackslash = cwd2.includes("\\") && !cwd2.includes("/");
|
|
54105
54135
|
const outSep = useBackslash ? "\\" : "/";
|
|
54106
54136
|
const pathParts = cwd2.split(/[\\/]+/);
|
|
@@ -54114,7 +54144,8 @@ class CurrentWorkingDirWidget {
|
|
|
54114
54144
|
}
|
|
54115
54145
|
getCustomKeybinds() {
|
|
54116
54146
|
return [
|
|
54117
|
-
{ key: "s", label: "(s)egments", action: "edit-segments" }
|
|
54147
|
+
{ key: "s", label: "(s)egments", action: "edit-segments" },
|
|
54148
|
+
{ key: "f", label: "(f)ish style", action: "toggle-fish-style" }
|
|
54118
54149
|
];
|
|
54119
54150
|
}
|
|
54120
54151
|
renderEditor(props) {
|
|
@@ -54128,6 +54159,32 @@ class CurrentWorkingDirWidget {
|
|
|
54128
54159
|
supportsColors(item) {
|
|
54129
54160
|
return true;
|
|
54130
54161
|
}
|
|
54162
|
+
abbreviatePath(path5) {
|
|
54163
|
+
const homeDir = os5.homedir();
|
|
54164
|
+
const useBackslash = path5.includes("\\") && !path5.includes("/");
|
|
54165
|
+
const sep = useBackslash ? "\\" : "/";
|
|
54166
|
+
let normalizedPath = path5;
|
|
54167
|
+
if (path5.startsWith(homeDir)) {
|
|
54168
|
+
normalizedPath = "~" + path5.slice(homeDir.length);
|
|
54169
|
+
}
|
|
54170
|
+
const parts = normalizedPath.split(/[\\/]+/).filter((part) => part !== "");
|
|
54171
|
+
const abbreviated = parts.map((part, index) => {
|
|
54172
|
+
if (index === 0 || index === parts.length - 1) {
|
|
54173
|
+
return part;
|
|
54174
|
+
}
|
|
54175
|
+
if (part.startsWith(".") && part.length > 1) {
|
|
54176
|
+
return "." + (part[1] ?? "");
|
|
54177
|
+
}
|
|
54178
|
+
return part[0];
|
|
54179
|
+
});
|
|
54180
|
+
if (normalizedPath.startsWith("~")) {
|
|
54181
|
+
return abbreviated.join(sep);
|
|
54182
|
+
} else if (normalizedPath.startsWith("/")) {
|
|
54183
|
+
return sep + abbreviated.join(sep);
|
|
54184
|
+
} else {
|
|
54185
|
+
return abbreviated.join(sep);
|
|
54186
|
+
}
|
|
54187
|
+
}
|
|
54131
54188
|
}
|
|
54132
54189
|
var CurrentWorkingDirEditor = ({ widget, onComplete, onCancel, action }) => {
|
|
54133
54190
|
const [segmentsInput, setSegmentsInput] = import_react31.useState(widget.metadata?.segments ?? "");
|
|
@@ -56020,7 +56077,7 @@ var MainMenu = ({ onSelect, isClaudeInstalled, hasChanges, initialSelection = 0,
|
|
|
56020
56077
|
});
|
|
56021
56078
|
const getDescription = (value) => {
|
|
56022
56079
|
const descriptions = {
|
|
56023
|
-
lines: "Configure
|
|
56080
|
+
lines: "Configure any number of status lines with various widgets like model info, git status, and token usage",
|
|
56024
56081
|
colors: "Customize colors for each widget including foreground, background, and bold styling",
|
|
56025
56082
|
powerline: "Install Powerline fonts for enhanced visual separators and symbols in your status line",
|
|
56026
56083
|
globalOverrides: "Set global padding, separators, and color overrides that apply to all widgets",
|
|
@@ -56082,7 +56139,7 @@ var MainMenu = ({ onSelect, isClaudeInstalled, hasChanges, initialSelection = 0,
|
|
|
56082
56139
|
};
|
|
56083
56140
|
// src/tui/components/PowerlineSetup.tsx
|
|
56084
56141
|
var import_react41 = __toESM(require_react(), 1);
|
|
56085
|
-
import * as
|
|
56142
|
+
import * as os6 from "os";
|
|
56086
56143
|
|
|
56087
56144
|
// src/tui/components/PowerlineSeparatorEditor.tsx
|
|
56088
56145
|
var import_react39 = __toESM(require_react(), 1);
|
|
@@ -56799,7 +56856,7 @@ var PowerlineSetup = ({
|
|
|
56799
56856
|
}, undefined, false, undefined, this)
|
|
56800
56857
|
]
|
|
56801
56858
|
}, undefined, true, undefined, this),
|
|
56802
|
-
|
|
56859
|
+
os6.platform() === "darwin" && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(jsx_dev_runtime13.Fragment, {
|
|
56803
56860
|
children: [
|
|
56804
56861
|
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
56805
56862
|
dimColor: true,
|
|
@@ -56815,7 +56872,7 @@ var PowerlineSetup = ({
|
|
|
56815
56872
|
}, undefined, false, undefined, this)
|
|
56816
56873
|
]
|
|
56817
56874
|
}, undefined, true, undefined, this),
|
|
56818
|
-
|
|
56875
|
+
os6.platform() === "linux" && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(jsx_dev_runtime13.Fragment, {
|
|
56819
56876
|
children: [
|
|
56820
56877
|
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
56821
56878
|
dimColor: true,
|
|
@@ -56831,7 +56888,7 @@ var PowerlineSetup = ({
|
|
|
56831
56888
|
}, undefined, false, undefined, this)
|
|
56832
56889
|
]
|
|
56833
56890
|
}, undefined, true, undefined, this),
|
|
56834
|
-
|
|
56891
|
+
os6.platform() === "win32" && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(jsx_dev_runtime13.Fragment, {
|
|
56835
56892
|
children: [
|
|
56836
56893
|
/* @__PURE__ */ jsx_dev_runtime13.jsxDEV(Text, {
|
|
56837
56894
|
dimColor: true,
|
|
@@ -59030,12 +59087,21 @@ function getAllTimestampsFromFile(filePath) {
|
|
|
59030
59087
|
for (const line of lines) {
|
|
59031
59088
|
try {
|
|
59032
59089
|
const json2 = JSON.parse(line);
|
|
59033
|
-
|
|
59034
|
-
|
|
59035
|
-
|
|
59036
|
-
|
|
59037
|
-
|
|
59038
|
-
|
|
59090
|
+
const usage = json2.message?.usage;
|
|
59091
|
+
if (!usage)
|
|
59092
|
+
continue;
|
|
59093
|
+
const hasInputTokens = typeof usage.input_tokens === "number";
|
|
59094
|
+
const hasOutputTokens = typeof usage.output_tokens === "number";
|
|
59095
|
+
if (!hasInputTokens || !hasOutputTokens)
|
|
59096
|
+
continue;
|
|
59097
|
+
if (json2.isSidechain === true)
|
|
59098
|
+
continue;
|
|
59099
|
+
const timestamp = json2.timestamp;
|
|
59100
|
+
if (typeof timestamp !== "string")
|
|
59101
|
+
continue;
|
|
59102
|
+
const date5 = new Date(timestamp);
|
|
59103
|
+
if (!Number.isNaN(date5.getTime()))
|
|
59104
|
+
timestamps.push(date5);
|
|
59039
59105
|
} catch {
|
|
59040
59106
|
continue;
|
|
59041
59107
|
}
|