@sushant-kum/ccstatus 0.1.0 → 0.1.1
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.
|
@@ -338,6 +338,41 @@ register({
|
|
|
338
338
|
return parts[parts.length - 1] ?? snapshot.cwd;
|
|
339
339
|
}
|
|
340
340
|
});
|
|
341
|
+
register({
|
|
342
|
+
type: "context-bar",
|
|
343
|
+
label: "Ctx Bar",
|
|
344
|
+
format: ({ snapshot }) => bar(snapshot.ctxPct)
|
|
345
|
+
});
|
|
346
|
+
register({
|
|
347
|
+
type: "context-remaining",
|
|
348
|
+
label: "Ctx Left",
|
|
349
|
+
format: ({ snapshot, item }) => labeled(rawOf(item), "Ctx Left", pct(100 - snapshot.ctxPct))
|
|
350
|
+
});
|
|
351
|
+
register({
|
|
352
|
+
type: "thinking-effort",
|
|
353
|
+
label: "Effort",
|
|
354
|
+
format: ({ snapshot, item }) => snapshot.effort ? labeled(rawOf(item), "Effort", snapshot.effort) : null
|
|
355
|
+
});
|
|
356
|
+
register({
|
|
357
|
+
type: "session-id",
|
|
358
|
+
label: "Session ID",
|
|
359
|
+
format: ({ snapshot, item }) => snapshot.sessionId ? rawOf(item) ? snapshot.sessionId : snapshot.sessionId.slice(0, 8) : null
|
|
360
|
+
});
|
|
361
|
+
register({
|
|
362
|
+
type: "context-window",
|
|
363
|
+
label: "Ctx Window",
|
|
364
|
+
format: ({ snapshot, item }) => snapshot.ctxWindow > 0 ? labeled(rawOf(item), "Window", fmtNum(snapshot.ctxWindow)) : null
|
|
365
|
+
});
|
|
366
|
+
register({
|
|
367
|
+
type: "output-style",
|
|
368
|
+
label: "Style",
|
|
369
|
+
format: ({ snapshot, item }) => snapshot.outputStyle ? labeled(rawOf(item), "Style", snapshot.outputStyle) : null
|
|
370
|
+
});
|
|
371
|
+
register({
|
|
372
|
+
type: "terminal-width",
|
|
373
|
+
label: "Width",
|
|
374
|
+
format: ({ snapshot, item }) => snapshot.terminalWidth > 0 ? labeled(rawOf(item), "Width", String(snapshot.terminalWidth)) : null
|
|
375
|
+
});
|
|
341
376
|
|
|
342
377
|
// ../core/src/widgets/git-widgets.ts
|
|
343
378
|
register({
|
|
@@ -360,6 +395,21 @@ register({
|
|
|
360
395
|
label: "Worktree",
|
|
361
396
|
format: ({ snapshot }) => snapshot.repo && snapshot.gitWorktree ? `\u2387 ${snapshot.gitWorktree}` : null
|
|
362
397
|
});
|
|
398
|
+
register({
|
|
399
|
+
type: "git-insertions",
|
|
400
|
+
label: "Insertions",
|
|
401
|
+
format: ({ snapshot }) => snapshot.repo ? `+${snapshot.insertions}` : null
|
|
402
|
+
});
|
|
403
|
+
register({
|
|
404
|
+
type: "git-deletions",
|
|
405
|
+
label: "Deletions",
|
|
406
|
+
format: ({ snapshot }) => snapshot.repo ? `-${snapshot.deletions}` : null
|
|
407
|
+
});
|
|
408
|
+
register({
|
|
409
|
+
type: "git-sha",
|
|
410
|
+
label: "SHA",
|
|
411
|
+
format: ({ snapshot }) => snapshot.repo && snapshot.gitSha ? snapshot.gitSha : null
|
|
412
|
+
});
|
|
363
413
|
|
|
364
414
|
// ../core/src/widgets/usage-widgets.ts
|
|
365
415
|
function until(iso, now) {
|
|
@@ -408,6 +458,46 @@ register({
|
|
|
408
458
|
return reset === null ? null : `Block: ${fmtDur(reset)}`;
|
|
409
459
|
}
|
|
410
460
|
});
|
|
461
|
+
register({
|
|
462
|
+
type: "session-usage",
|
|
463
|
+
label: "Session %",
|
|
464
|
+
format: ({ snapshot }) => snapshot.fivePct === null ? null : `Session: ${pct(snapshot.fivePct)}`
|
|
465
|
+
});
|
|
466
|
+
register({
|
|
467
|
+
type: "weekly-usage",
|
|
468
|
+
label: "Weekly %",
|
|
469
|
+
format: ({ snapshot }) => snapshot.weekPct === null ? null : `Weekly: ${pct(snapshot.weekPct)}`
|
|
470
|
+
});
|
|
471
|
+
register({
|
|
472
|
+
type: "reset-timer",
|
|
473
|
+
label: "Reset",
|
|
474
|
+
format: ({ snapshot }) => {
|
|
475
|
+
const r = until(snapshot.fiveReset, snapshot.now);
|
|
476
|
+
return r === null ? null : `Reset: ${fmtDur(r)}`;
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
register({
|
|
480
|
+
type: "weekly-reset-timer",
|
|
481
|
+
label: "Weekly Reset",
|
|
482
|
+
format: ({ snapshot }) => {
|
|
483
|
+
const r = until(snapshot.weekReset, snapshot.now);
|
|
484
|
+
return r === null ? null : `Weekly Reset: ${fmtDur(r)}`;
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
register({
|
|
488
|
+
type: "session-cost-rate",
|
|
489
|
+
label: "Cost/hr",
|
|
490
|
+
format: ({ snapshot }) => {
|
|
491
|
+
if (snapshot.cost === null) {
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
const ms = snapshot.now - snapshot.startedAt;
|
|
495
|
+
if (ms < 6e4) {
|
|
496
|
+
return null;
|
|
497
|
+
}
|
|
498
|
+
return `$${(snapshot.cost / (ms / 36e5)).toFixed(2)}/hr`;
|
|
499
|
+
}
|
|
500
|
+
});
|
|
411
501
|
|
|
412
502
|
// ../core/src/widgets/custom-widgets.ts
|
|
413
503
|
register({
|
|
@@ -4669,6 +4759,21 @@ var WIDGET_TYPES = [
|
|
|
4669
4759
|
"rate-limit-5h",
|
|
4670
4760
|
"rate-limit-week",
|
|
4671
4761
|
"block-timer",
|
|
4762
|
+
"session-usage",
|
|
4763
|
+
"weekly-usage",
|
|
4764
|
+
"reset-timer",
|
|
4765
|
+
"weekly-reset-timer",
|
|
4766
|
+
"context-bar",
|
|
4767
|
+
"context-remaining",
|
|
4768
|
+
"thinking-effort",
|
|
4769
|
+
"git-insertions",
|
|
4770
|
+
"git-deletions",
|
|
4771
|
+
"session-id",
|
|
4772
|
+
"context-window",
|
|
4773
|
+
"session-cost-rate",
|
|
4774
|
+
"git-sha",
|
|
4775
|
+
"output-style",
|
|
4776
|
+
"terminal-width",
|
|
4672
4777
|
"custom-text",
|
|
4673
4778
|
"custom-command",
|
|
4674
4779
|
"flex-separator"
|
|
@@ -4810,21 +4915,100 @@ function loadConfig(raw) {
|
|
|
4810
4915
|
// ../core/src/config/import-ccstatusline.ts
|
|
4811
4916
|
var clone2 = (v) => JSON.parse(JSON.stringify(v));
|
|
4812
4917
|
var TYPE_MAP = {
|
|
4813
|
-
version: "version",
|
|
4814
4918
|
model: "model",
|
|
4815
|
-
|
|
4919
|
+
version: "version",
|
|
4920
|
+
"thinking-effort": "thinking-effort",
|
|
4816
4921
|
"context-length": "context-length",
|
|
4817
4922
|
"context-percentage": "context-percentage",
|
|
4818
|
-
"
|
|
4923
|
+
"context-window": "context-window",
|
|
4924
|
+
"context-bar": "context-bar",
|
|
4819
4925
|
"tokens-input": "tokens-input",
|
|
4820
4926
|
"tokens-output": "tokens-output",
|
|
4927
|
+
"tokens-cached": "tokens-cached",
|
|
4821
4928
|
"tokens-total": "tokens-total",
|
|
4822
4929
|
"git-root-dir": "git-root-dir",
|
|
4823
4930
|
"git-branch": "git-branch",
|
|
4824
4931
|
"git-worktree": "git-worktree",
|
|
4825
4932
|
"git-changes": "git-changes",
|
|
4826
|
-
"
|
|
4933
|
+
"git-insertions": "git-insertions",
|
|
4934
|
+
"git-deletions": "git-deletions",
|
|
4935
|
+
"git-sha": "git-sha",
|
|
4936
|
+
"session-clock": "session-clock",
|
|
4937
|
+
"session-id": "session-id",
|
|
4938
|
+
"current-working-dir": "cwd",
|
|
4939
|
+
cwd: "cwd",
|
|
4940
|
+
"session-cost": "cost",
|
|
4941
|
+
cost: "cost",
|
|
4942
|
+
"session-cost-rate": "session-cost-rate",
|
|
4943
|
+
"session-usage": "session-usage",
|
|
4944
|
+
"weekly-usage": "weekly-usage",
|
|
4945
|
+
"reset-timer": "reset-timer",
|
|
4946
|
+
"weekly-reset-timer": "weekly-reset-timer",
|
|
4947
|
+
"block-timer": "block-timer",
|
|
4948
|
+
"terminal-width": "terminal-width",
|
|
4949
|
+
"output-style": "output-style"
|
|
4950
|
+
};
|
|
4951
|
+
var UNSUPPORTED = {
|
|
4952
|
+
"weekly-sonnet-usage": "needs the Anthropic usage API, not available to the mod",
|
|
4953
|
+
"weekly-opus-usage": "needs the Anthropic usage API, not available to the mod",
|
|
4954
|
+
"fable-weekly-usage": "needs the Anthropic usage API, not available to the mod",
|
|
4955
|
+
"extra-usage-utilization": "needs the Anthropic usage API, not available to the mod",
|
|
4956
|
+
"extra-usage-remaining": "needs the Anthropic usage API, not available to the mod",
|
|
4957
|
+
"extra-usage-used": "needs the Anthropic usage API, not available to the mod",
|
|
4958
|
+
"extra-usage-daily-budget": "needs the Anthropic usage API, not available to the mod",
|
|
4959
|
+
"input-speed": "needs transcript parsing, not available to the mod",
|
|
4960
|
+
"output-speed": "needs transcript parsing, not available to the mod",
|
|
4961
|
+
"total-speed": "needs transcript parsing, not available to the mod",
|
|
4962
|
+
"cache-hit-rate": "needs transcript parsing, not available to the mod",
|
|
4963
|
+
"cache-read": "needs transcript parsing, not available to the mod",
|
|
4964
|
+
"cache-write": "needs transcript parsing, not available to the mod",
|
|
4965
|
+
"compaction-counter": "needs transcript parsing, not available to the mod",
|
|
4966
|
+
skills: "needs transcript parsing, not available to the mod",
|
|
4967
|
+
"session-name": "needs transcript parsing, not available to the mod",
|
|
4968
|
+
"cache-timer": "needs cache-TTL tracking, not available to the mod",
|
|
4969
|
+
"free-memory": "reads OS memory, not available to the mod",
|
|
4970
|
+
"claude-status": "needs a network status fetch, not available to the mod",
|
|
4971
|
+
"claude-account-email": "needs local Claude config access, not available to the mod",
|
|
4972
|
+
"claude-session-id": "renamed; use the session-id widget",
|
|
4973
|
+
"vim-mode": "engine state not exposed to the mod",
|
|
4974
|
+
"voice-status": "engine state not exposed to the mod",
|
|
4975
|
+
"sandbox-status": "engine state not exposed to the mod",
|
|
4976
|
+
"remote-control-status": "engine state not exposed to the mod",
|
|
4977
|
+
"worktree-mode": "needs Claude Code's worktree object; use the git-worktree widget",
|
|
4978
|
+
"worktree-name": "needs Claude Code's worktree object; use the git-worktree widget",
|
|
4979
|
+
"worktree-branch": "needs Claude Code's worktree object; use the git-worktree widget",
|
|
4980
|
+
"worktree-original-branch": "needs Claude Code's worktree object; use the git-worktree widget",
|
|
4981
|
+
"context-percentage-usable": "needs usable-window data, not available to the mod",
|
|
4982
|
+
"context-window-size": "renamed; use the context-window widget",
|
|
4983
|
+
"git-staged-files": "needs a deeper git probe, not available to the mod",
|
|
4984
|
+
"git-unstaged-files": "needs a deeper git probe, not available to the mod",
|
|
4985
|
+
"git-untracked-files": "needs a deeper git probe, not available to the mod",
|
|
4986
|
+
"git-clean-status": "needs a deeper git probe, not available to the mod",
|
|
4987
|
+
"git-status": "needs a deeper git probe, not available to the mod",
|
|
4988
|
+
"git-staged": "needs a deeper git probe, not available to the mod",
|
|
4989
|
+
"git-unstaged": "needs a deeper git probe, not available to the mod",
|
|
4990
|
+
"git-untracked": "needs a deeper git probe, not available to the mod",
|
|
4991
|
+
"git-ahead-behind": "needs a deeper git probe, not available to the mod",
|
|
4992
|
+
"git-conflicts": "needs a deeper git probe, not available to the mod",
|
|
4993
|
+
"git-origin-owner": "needs a deeper git probe, not available to the mod",
|
|
4994
|
+
"git-origin-repo": "needs a deeper git probe, not available to the mod",
|
|
4995
|
+
"git-origin-owner-repo": "needs a deeper git probe, not available to the mod",
|
|
4996
|
+
"git-upstream-owner": "needs a deeper git probe, not available to the mod",
|
|
4997
|
+
"git-upstream-repo": "needs a deeper git probe, not available to the mod",
|
|
4998
|
+
"git-upstream-owner-repo": "needs a deeper git probe, not available to the mod",
|
|
4999
|
+
"git-is-fork": "needs a deeper git probe, not available to the mod",
|
|
5000
|
+
"git-review": "needs the gh/glab CLI, not available to the mod",
|
|
5001
|
+
"git-ci-status": "needs the gh/glab CLI, not available to the mod",
|
|
5002
|
+
link: "OSC8 links are not yet supported"
|
|
4827
5003
|
};
|
|
5004
|
+
function baseStyle(raw, idFallback) {
|
|
5005
|
+
return {
|
|
5006
|
+
id: String(raw["id"] ?? `${idFallback}-${Math.random().toString(36).slice(2)}`),
|
|
5007
|
+
bg: typeof raw["backgroundColor"] === "string" ? raw["backgroundColor"] : void 0,
|
|
5008
|
+
rawValue: raw["rawValue"] === true || void 0,
|
|
5009
|
+
merge: raw["merge"] === true || void 0
|
|
5010
|
+
};
|
|
5011
|
+
}
|
|
4828
5012
|
function importCcstatusline(raw) {
|
|
4829
5013
|
const warnings = [];
|
|
4830
5014
|
if (!raw || typeof raw !== "object" || !Array.isArray(raw.lines)) {
|
|
@@ -4839,19 +5023,39 @@ function importCcstatusline(raw) {
|
|
|
4839
5023
|
return [];
|
|
4840
5024
|
}
|
|
4841
5025
|
const srcType = String(raw2["type"]);
|
|
5026
|
+
switch (srcType) {
|
|
5027
|
+
case "custom-text":
|
|
5028
|
+
case "custom-symbol":
|
|
5029
|
+
case "custom-command": {
|
|
5030
|
+
const field = srcType === "custom-text" ? "customText" : srcType === "custom-symbol" ? "customSymbol" : "commandPath";
|
|
5031
|
+
const payload = raw2[field];
|
|
5032
|
+
if (payload === void 0 || payload === null || String(payload) === "") {
|
|
5033
|
+
warnings.push(`dropped "${srcType}" \u2014 no ${field} value`);
|
|
5034
|
+
return [];
|
|
5035
|
+
}
|
|
5036
|
+
return [
|
|
5037
|
+
srcType === "custom-command" ? { ...baseStyle(raw2, srcType), type: "custom-command", command: String(payload) } : { ...baseStyle(raw2, srcType), type: "custom-text", text: String(payload) }
|
|
5038
|
+
];
|
|
5039
|
+
}
|
|
5040
|
+
case "flex-separator":
|
|
5041
|
+
return [{ id: baseStyle(raw2, srcType).id, type: "flex-separator" }];
|
|
5042
|
+
case "separator":
|
|
5043
|
+
warnings.push(
|
|
5044
|
+
'dropped "separator" \u2014 ccstatus uses a global separator (set it on the Powerline screen)'
|
|
5045
|
+
);
|
|
5046
|
+
return [];
|
|
5047
|
+
default:
|
|
5048
|
+
}
|
|
4842
5049
|
const type = Object.hasOwn(TYPE_MAP, srcType) ? TYPE_MAP[srcType] : void 0;
|
|
4843
|
-
if (
|
|
4844
|
-
|
|
5050
|
+
if (type) {
|
|
5051
|
+
return [{ ...baseStyle(raw2, type), type }];
|
|
5052
|
+
}
|
|
5053
|
+
if (Object.hasOwn(UNSUPPORTED, srcType)) {
|
|
5054
|
+
warnings.push(`dropped "${srcType}" \u2014 ${UNSUPPORTED[srcType]}`);
|
|
4845
5055
|
return [];
|
|
4846
5056
|
}
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
type,
|
|
4850
|
-
bg: typeof raw2["backgroundColor"] === "string" ? raw2["backgroundColor"] : void 0,
|
|
4851
|
-
rawValue: raw2["rawValue"] === true || void 0,
|
|
4852
|
-
merge: raw2["merge"] === true || void 0
|
|
4853
|
-
};
|
|
4854
|
-
return [mapped];
|
|
5057
|
+
warnings.push(`dropped unmapped ccstatusline item "${srcType}"`);
|
|
5058
|
+
return [];
|
|
4855
5059
|
})
|
|
4856
5060
|
);
|
|
4857
5061
|
const draft = { version: 1, surfaces: { band: { enabled: true, lines } } };
|
|
@@ -4946,6 +5150,8 @@ var sampleSnapshot = {
|
|
|
4946
5150
|
added: 1,
|
|
4947
5151
|
modified: 2,
|
|
4948
5152
|
deleted: 0,
|
|
5153
|
+
insertions: 124,
|
|
5154
|
+
deletions: 37,
|
|
4949
5155
|
ctxTokens: 42e3,
|
|
4950
5156
|
ctxPct: 21,
|
|
4951
5157
|
cached: 1e3,
|
|
@@ -4953,13 +5159,17 @@ var sampleSnapshot = {
|
|
|
4953
5159
|
output: 500,
|
|
4954
5160
|
total: 3500,
|
|
4955
5161
|
startedAt: 0,
|
|
4956
|
-
cost:
|
|
5162
|
+
cost: 0.42,
|
|
4957
5163
|
fivePct: 30,
|
|
4958
5164
|
fiveReset: null,
|
|
4959
5165
|
weekPct: 10,
|
|
4960
5166
|
weekReset: null,
|
|
4961
5167
|
blockReset: null,
|
|
4962
|
-
terminalWidth:
|
|
5168
|
+
terminalWidth: 120,
|
|
5169
|
+
sessionId: "sess-abc1234",
|
|
5170
|
+
ctxWindow: 2e5,
|
|
5171
|
+
gitSha: "a1b2c3d",
|
|
5172
|
+
outputStyle: null,
|
|
4963
5173
|
now: 65e3
|
|
4964
5174
|
};
|
|
4965
5175
|
|
|
@@ -4968,6 +5178,8 @@ var NUMBER_FIELDS = [
|
|
|
4968
5178
|
"added",
|
|
4969
5179
|
"modified",
|
|
4970
5180
|
"deleted",
|
|
5181
|
+
"insertions",
|
|
5182
|
+
"deletions",
|
|
4971
5183
|
"ctxTokens",
|
|
4972
5184
|
"ctxPct",
|
|
4973
5185
|
"cached",
|
|
@@ -4976,11 +5188,27 @@ var NUMBER_FIELDS = [
|
|
|
4976
5188
|
"total",
|
|
4977
5189
|
"startedAt",
|
|
4978
5190
|
"terminalWidth",
|
|
4979
|
-
"now"
|
|
5191
|
+
"now",
|
|
5192
|
+
"ctxWindow"
|
|
4980
5193
|
];
|
|
4981
5194
|
var NULLABLE_NUMBER_FIELDS = ["cost", "fivePct", "weekPct"];
|
|
4982
|
-
var STRING_FIELDS = [
|
|
4983
|
-
|
|
5195
|
+
var STRING_FIELDS = [
|
|
5196
|
+
"version",
|
|
5197
|
+
"model",
|
|
5198
|
+
"cwd",
|
|
5199
|
+
"gitRoot",
|
|
5200
|
+
"gitBranch",
|
|
5201
|
+
"gitWorktree",
|
|
5202
|
+
"sessionId",
|
|
5203
|
+
"gitSha"
|
|
5204
|
+
];
|
|
5205
|
+
var NULLABLE_STRING_FIELDS = [
|
|
5206
|
+
"effort",
|
|
5207
|
+
"fiveReset",
|
|
5208
|
+
"weekReset",
|
|
5209
|
+
"blockReset",
|
|
5210
|
+
"outputStyle"
|
|
5211
|
+
];
|
|
4984
5212
|
var BOOLEAN_FIELDS = ["repo"];
|
|
4985
5213
|
var isNum = (v) => typeof v === "number" && Number.isFinite(v);
|
|
4986
5214
|
function sanitize(parsed) {
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
var sub = process.argv[2];
|
|
6
6
|
if (sub === "statusline") {
|
|
7
|
-
const { runStatusline } = await import("./statusline-cmd-
|
|
7
|
+
const { runStatusline } = await import("./statusline-cmd-XIBNUV3A.js");
|
|
8
8
|
await runStatusline();
|
|
9
9
|
} else {
|
|
10
10
|
const { render } = await import("ink");
|
|
11
|
-
const { App } = await import("./app-
|
|
11
|
+
const { App } = await import("./app-YVZJ6IYT.js");
|
|
12
12
|
render(/* @__PURE__ */ jsx(App, {}));
|
|
13
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sushant-kum/ccstatus",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Interactive configurator (npx @sushant-kum/ccstatus) for the ccstatus Claude Code status bar — band, status line, pane, and threshold toasts from one config.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sushant Kumar",
|