copilot-statusline 0.1.15 → 0.1.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 +2 -1
- package/dist/copilot-statusline.js +182 -100
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -264,7 +264,7 @@ Copilot CLI spawns your status line command on every state change, passing sessi
|
|
|
264
264
|
|--------|------|-------------|
|
|
265
265
|
| Tokens Input | `tokens-input` | Total input tokens |
|
|
266
266
|
| Tokens Output | `tokens-output` | Total output tokens |
|
|
267
|
-
| Tokens Cached | `tokens-cached` |
|
|
267
|
+
| Tokens Cached | `tokens-cached` | Cached tokens from the most recent API call (`current_usage.cache_creation_input_tokens + cache_read_input_tokens`; rendered as `Last Cache:`) |
|
|
268
268
|
| Tokens Reasoning | `tokens-reasoning` | Total reasoning (thinking) tokens consumed |
|
|
269
269
|
| Tokens Total | `tokens-total` | Total tokens |
|
|
270
270
|
| Last Call Input | `last-call-input` | Input tokens from most recent API call |
|
|
@@ -374,6 +374,7 @@ Widget-specific shortcuts:
|
|
|
374
374
|
| Widget | Key | Action |
|
|
375
375
|
|--------|-----|--------|
|
|
376
376
|
| Git widgets | `h` | Toggle hide `no git` output |
|
|
377
|
+
| Count widgets | `z` | Toggle hide when rendered value is zero |
|
|
377
378
|
| Git Branch | `l` | Toggle GitHub link |
|
|
378
379
|
| Context % widgets | `u` | Toggle used/remaining display |
|
|
379
380
|
| Context % widgets | `p` | Cycle numeric/short bar display |
|
|
@@ -52913,7 +52913,7 @@ import { execSync as execSync3 } from "child_process";
|
|
|
52913
52913
|
import * as fs5 from "fs";
|
|
52914
52914
|
import * as path4 from "path";
|
|
52915
52915
|
var __dirname = "/Users/ts/workspace/active/statusline/copilot_statusline/src/utils";
|
|
52916
|
-
var PACKAGE_VERSION = "0.1.
|
|
52916
|
+
var PACKAGE_VERSION = "0.1.16";
|
|
52917
52917
|
function getPackageVersion() {
|
|
52918
52918
|
if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
|
|
52919
52919
|
return PACKAGE_VERSION;
|
|
@@ -54104,7 +54104,8 @@ function getContextWindowMetrics(data) {
|
|
|
54104
54104
|
const cacheWriteTokens = toFiniteNonNegativeNumber(contextWindow.total_cache_write_tokens);
|
|
54105
54105
|
const lastCallInputTokens = toFiniteNonNegativeNumber(contextWindow.last_call_input_tokens);
|
|
54106
54106
|
const lastCallOutputTokens = toFiniteNonNegativeNumber(contextWindow.last_call_output_tokens);
|
|
54107
|
-
const
|
|
54107
|
+
const currentUsage = contextWindow.current_usage;
|
|
54108
|
+
const cachedTokens = currentUsage ? (toFiniteNonNegativeNumber(currentUsage.cache_creation_input_tokens) ?? 0) + (toFiniteNonNegativeNumber(currentUsage.cache_read_input_tokens) ?? 0) : null;
|
|
54108
54109
|
const totalTokens = toFiniteNonNegativeNumber(contextWindow.total_tokens) ?? (totalInputTokens !== null && totalOutputTokens !== null ? totalInputTokens + totalOutputTokens : null);
|
|
54109
54110
|
return {
|
|
54110
54111
|
windowSize,
|
|
@@ -54211,7 +54212,7 @@ class TokensCachedWidget {
|
|
|
54211
54212
|
return "brightBlack";
|
|
54212
54213
|
}
|
|
54213
54214
|
getDescription() {
|
|
54214
|
-
return "Shows
|
|
54215
|
+
return "Shows cached tokens for the latest API call (cache read + cache creation)";
|
|
54215
54216
|
}
|
|
54216
54217
|
getDisplayName() {
|
|
54217
54218
|
return "Tokens Cached";
|
|
@@ -54224,11 +54225,11 @@ class TokensCachedWidget {
|
|
|
54224
54225
|
}
|
|
54225
54226
|
render(item, context, settings) {
|
|
54226
54227
|
if (context.isPreview) {
|
|
54227
|
-
return formatRawOrLabeledValue(item, "
|
|
54228
|
+
return formatRawOrLabeledValue(item, "Last Cache: ", "8.5k");
|
|
54228
54229
|
}
|
|
54229
54230
|
const metrics = getContextWindowMetrics(context.data);
|
|
54230
54231
|
if (metrics.cachedTokens !== null) {
|
|
54231
|
-
return formatRawOrLabeledValue(item, "
|
|
54232
|
+
return formatRawOrLabeledValue(item, "Last Cache: ", formatTokens(metrics.cachedTokens));
|
|
54232
54233
|
}
|
|
54233
54234
|
return null;
|
|
54234
54235
|
}
|
|
@@ -54239,6 +54240,49 @@ class TokensCachedWidget {
|
|
|
54239
54240
|
return true;
|
|
54240
54241
|
}
|
|
54241
54242
|
}
|
|
54243
|
+
// src/widgets/shared/editor-display.ts
|
|
54244
|
+
function makeModifierText(modifiers) {
|
|
54245
|
+
return modifiers.length > 0 ? `(${modifiers.join(", ")})` : undefined;
|
|
54246
|
+
}
|
|
54247
|
+
|
|
54248
|
+
// src/widgets/shared/metadata.ts
|
|
54249
|
+
function isMetadataFlagEnabled(item, key) {
|
|
54250
|
+
return item.metadata?.[key] === "true";
|
|
54251
|
+
}
|
|
54252
|
+
function toggleMetadataFlag(item, key) {
|
|
54253
|
+
return {
|
|
54254
|
+
...item,
|
|
54255
|
+
metadata: {
|
|
54256
|
+
...item.metadata,
|
|
54257
|
+
[key]: (!isMetadataFlagEnabled(item, key)).toString()
|
|
54258
|
+
}
|
|
54259
|
+
};
|
|
54260
|
+
}
|
|
54261
|
+
|
|
54262
|
+
// src/widgets/shared/hide-when-zero.ts
|
|
54263
|
+
var HIDE_WHEN_ZERO_KEY = "hideWhenZero";
|
|
54264
|
+
var TOGGLE_HIDE_WHEN_ZERO_ACTION = "toggle-hide-when-zero";
|
|
54265
|
+
var HIDE_WHEN_ZERO_KEYBIND = {
|
|
54266
|
+
key: "z",
|
|
54267
|
+
label: "(z) hide when zero",
|
|
54268
|
+
action: TOGGLE_HIDE_WHEN_ZERO_ACTION
|
|
54269
|
+
};
|
|
54270
|
+
function isHideWhenZeroEnabled(item) {
|
|
54271
|
+
return isMetadataFlagEnabled(item, HIDE_WHEN_ZERO_KEY);
|
|
54272
|
+
}
|
|
54273
|
+
function getHideWhenZeroLabel(item) {
|
|
54274
|
+
return isHideWhenZeroEnabled(item) ? "hide when zero" : undefined;
|
|
54275
|
+
}
|
|
54276
|
+
function handleToggleHideWhenZeroAction(action, item) {
|
|
54277
|
+
if (action !== TOGGLE_HIDE_WHEN_ZERO_ACTION) {
|
|
54278
|
+
return null;
|
|
54279
|
+
}
|
|
54280
|
+
return toggleMetadataFlag(item, HIDE_WHEN_ZERO_KEY);
|
|
54281
|
+
}
|
|
54282
|
+
function getHideWhenZeroKeybinds() {
|
|
54283
|
+
return [HIDE_WHEN_ZERO_KEYBIND];
|
|
54284
|
+
}
|
|
54285
|
+
|
|
54242
54286
|
// src/widgets/TokensReasoning.ts
|
|
54243
54287
|
class TokensReasoningWidget {
|
|
54244
54288
|
getDefaultColor() {
|
|
@@ -54253,8 +54297,14 @@ class TokensReasoningWidget {
|
|
|
54253
54297
|
getCategory() {
|
|
54254
54298
|
return "Tokens";
|
|
54255
54299
|
}
|
|
54256
|
-
getEditorDisplay(
|
|
54257
|
-
return {
|
|
54300
|
+
getEditorDisplay(item) {
|
|
54301
|
+
return {
|
|
54302
|
+
displayText: this.getDisplayName(),
|
|
54303
|
+
modifierText: makeModifierText([getHideWhenZeroLabel(item)].filter((label) => label !== undefined))
|
|
54304
|
+
};
|
|
54305
|
+
}
|
|
54306
|
+
handleEditorAction(action, item) {
|
|
54307
|
+
return handleToggleHideWhenZeroAction(action, item);
|
|
54258
54308
|
}
|
|
54259
54309
|
render(item, context, _settings) {
|
|
54260
54310
|
if (context.isPreview) {
|
|
@@ -54262,10 +54312,16 @@ class TokensReasoningWidget {
|
|
|
54262
54312
|
}
|
|
54263
54313
|
const metrics = getContextWindowMetrics(context.data);
|
|
54264
54314
|
if (metrics.reasoningTokens !== null) {
|
|
54315
|
+
if (metrics.reasoningTokens === 0 && isHideWhenZeroEnabled(item)) {
|
|
54316
|
+
return null;
|
|
54317
|
+
}
|
|
54265
54318
|
return formatRawOrLabeledValue(item, "Reasoning: ", formatTokens(metrics.reasoningTokens));
|
|
54266
54319
|
}
|
|
54267
54320
|
return null;
|
|
54268
54321
|
}
|
|
54322
|
+
getCustomKeybinds() {
|
|
54323
|
+
return getHideWhenZeroKeybinds();
|
|
54324
|
+
}
|
|
54269
54325
|
supportsRawValue() {
|
|
54270
54326
|
return true;
|
|
54271
54327
|
}
|
|
@@ -54376,33 +54432,14 @@ class ContextWindowWidget {
|
|
|
54376
54432
|
return true;
|
|
54377
54433
|
}
|
|
54378
54434
|
}
|
|
54379
|
-
// src/widgets/shared/editor-display.ts
|
|
54380
|
-
function makeModifierText(modifiers) {
|
|
54381
|
-
return modifiers.length > 0 ? `(${modifiers.join(", ")})` : undefined;
|
|
54382
|
-
}
|
|
54383
|
-
|
|
54384
|
-
// src/widgets/shared/metadata.ts
|
|
54385
|
-
function isMetadataFlagEnabled(item, key) {
|
|
54386
|
-
return item.metadata?.[key] === "true";
|
|
54387
|
-
}
|
|
54388
|
-
function toggleMetadataFlag(item, key) {
|
|
54389
|
-
return {
|
|
54390
|
-
...item,
|
|
54391
|
-
metadata: {
|
|
54392
|
-
...item.metadata,
|
|
54393
|
-
[key]: (!isMetadataFlagEnabled(item, key)).toString()
|
|
54394
|
-
}
|
|
54395
|
-
};
|
|
54396
|
-
}
|
|
54397
|
-
|
|
54398
54435
|
// src/widgets/shared/context-inverse.ts
|
|
54399
54436
|
var INVERSE_KEY = "inverse";
|
|
54400
54437
|
var TOGGLE_INVERSE_ACTION = "toggle-inverse";
|
|
54401
54438
|
function isContextInverse(item) {
|
|
54402
54439
|
return isMetadataFlagEnabled(item, INVERSE_KEY);
|
|
54403
54440
|
}
|
|
54404
|
-
function
|
|
54405
|
-
return
|
|
54441
|
+
function getContextInverseLabel(item) {
|
|
54442
|
+
return isContextInverse(item) ? "remaining" : undefined;
|
|
54406
54443
|
}
|
|
54407
54444
|
function handleContextInverseAction(action, item) {
|
|
54408
54445
|
if (action !== TOGGLE_INVERSE_ACTION) {
|
|
@@ -54455,13 +54492,13 @@ function renderContextSlider(mode, percent) {
|
|
|
54455
54492
|
}
|
|
54456
54493
|
return slider;
|
|
54457
54494
|
}
|
|
54458
|
-
function
|
|
54495
|
+
function getContextSliderLabel(item) {
|
|
54459
54496
|
const mode = getContextSliderMode(item);
|
|
54460
54497
|
if (mode === "slider") {
|
|
54461
|
-
return "
|
|
54498
|
+
return "short bar";
|
|
54462
54499
|
}
|
|
54463
54500
|
if (mode === "slider-only") {
|
|
54464
|
-
return "
|
|
54501
|
+
return "short bar only";
|
|
54465
54502
|
}
|
|
54466
54503
|
return;
|
|
54467
54504
|
}
|
|
@@ -54484,13 +54521,13 @@ class ContextPercentageWidget {
|
|
|
54484
54521
|
return "Context";
|
|
54485
54522
|
}
|
|
54486
54523
|
getEditorDisplay(item) {
|
|
54487
|
-
const
|
|
54488
|
-
|
|
54489
|
-
|
|
54490
|
-
].filter((
|
|
54524
|
+
const labels = [
|
|
54525
|
+
getContextInverseLabel(item),
|
|
54526
|
+
getContextSliderLabel(item)
|
|
54527
|
+
].filter((label) => label !== undefined);
|
|
54491
54528
|
return {
|
|
54492
54529
|
displayText: this.getDisplayName(),
|
|
54493
|
-
modifierText:
|
|
54530
|
+
modifierText: makeModifierText(labels)
|
|
54494
54531
|
};
|
|
54495
54532
|
}
|
|
54496
54533
|
handleEditorAction(action, item) {
|
|
@@ -54545,6 +54582,18 @@ function makeUsageProgressBar(percent, width = 15, powerlineMode = false) {
|
|
|
54545
54582
|
}
|
|
54546
54583
|
|
|
54547
54584
|
// src/widgets/ContextBar.ts
|
|
54585
|
+
var DISPLAY_MODE_CYCLE = {
|
|
54586
|
+
"progress-short": "progress",
|
|
54587
|
+
progress: "slider",
|
|
54588
|
+
slider: "slider-only",
|
|
54589
|
+
"slider-only": "progress-short"
|
|
54590
|
+
};
|
|
54591
|
+
var DISPLAY_MODE_LABELS = {
|
|
54592
|
+
"progress-short": "medium bar",
|
|
54593
|
+
progress: "",
|
|
54594
|
+
slider: "short bar",
|
|
54595
|
+
"slider-only": "short bar only"
|
|
54596
|
+
};
|
|
54548
54597
|
function getDisplayMode(item) {
|
|
54549
54598
|
const mode = item.metadata?.display;
|
|
54550
54599
|
if (mode === "progress" || mode === "slider" || mode === "slider-only") {
|
|
@@ -54570,26 +54619,17 @@ class ContextBarWidget {
|
|
|
54570
54619
|
return "Context";
|
|
54571
54620
|
}
|
|
54572
54621
|
getEditorDisplay(item) {
|
|
54573
|
-
const
|
|
54574
|
-
const modifiers = [];
|
|
54575
|
-
if (mode === "progress-short") {
|
|
54576
|
-
modifiers.push("medium bar");
|
|
54577
|
-
} else if (mode === "slider") {
|
|
54578
|
-
modifiers.push("short bar");
|
|
54579
|
-
} else if (mode === "slider-only") {
|
|
54580
|
-
modifiers.push("short bar only");
|
|
54581
|
-
}
|
|
54622
|
+
const label = DISPLAY_MODE_LABELS[getDisplayMode(item)];
|
|
54582
54623
|
return {
|
|
54583
54624
|
displayText: this.getDisplayName(),
|
|
54584
|
-
modifierText:
|
|
54625
|
+
modifierText: label ? `(${label})` : undefined
|
|
54585
54626
|
};
|
|
54586
54627
|
}
|
|
54587
54628
|
handleEditorAction(action, item) {
|
|
54588
54629
|
if (action !== "toggle-progress") {
|
|
54589
54630
|
return null;
|
|
54590
54631
|
}
|
|
54591
|
-
const
|
|
54592
|
-
const nextMode = currentMode === "progress-short" ? "progress" : currentMode === "progress" ? "slider" : currentMode === "slider" ? "slider-only" : "progress-short";
|
|
54632
|
+
const nextMode = DISPLAY_MODE_CYCLE[getDisplayMode(item)];
|
|
54593
54633
|
return {
|
|
54594
54634
|
...item,
|
|
54595
54635
|
metadata: {
|
|
@@ -54707,7 +54747,13 @@ class PremiumRequestsWidget {
|
|
|
54707
54747
|
return "Session";
|
|
54708
54748
|
}
|
|
54709
54749
|
getEditorDisplay(item) {
|
|
54710
|
-
return {
|
|
54750
|
+
return {
|
|
54751
|
+
displayText: this.getDisplayName(),
|
|
54752
|
+
modifierText: makeModifierText([getHideWhenZeroLabel(item)].filter((label) => label !== undefined))
|
|
54753
|
+
};
|
|
54754
|
+
}
|
|
54755
|
+
handleEditorAction(action, item) {
|
|
54756
|
+
return handleToggleHideWhenZeroAction(action, item);
|
|
54711
54757
|
}
|
|
54712
54758
|
render(item, context, settings) {
|
|
54713
54759
|
if (context.isPreview) {
|
|
@@ -54715,10 +54761,16 @@ class PremiumRequestsWidget {
|
|
|
54715
54761
|
}
|
|
54716
54762
|
const requests = context.data?.cost?.total_premium_requests;
|
|
54717
54763
|
if (typeof requests === "number") {
|
|
54764
|
+
if (requests === 0 && isHideWhenZeroEnabled(item)) {
|
|
54765
|
+
return null;
|
|
54766
|
+
}
|
|
54718
54767
|
return formatRawOrLabeledValue(item, "Reqs: ", String(requests));
|
|
54719
54768
|
}
|
|
54720
54769
|
return null;
|
|
54721
54770
|
}
|
|
54771
|
+
getCustomKeybinds() {
|
|
54772
|
+
return getHideWhenZeroKeybinds();
|
|
54773
|
+
}
|
|
54722
54774
|
supportsRawValue() {
|
|
54723
54775
|
return true;
|
|
54724
54776
|
}
|
|
@@ -54744,7 +54796,13 @@ class ApiCallsWidget {
|
|
|
54744
54796
|
return "Session";
|
|
54745
54797
|
}
|
|
54746
54798
|
getEditorDisplay(item) {
|
|
54747
|
-
return {
|
|
54799
|
+
return {
|
|
54800
|
+
displayText: this.getDisplayName(),
|
|
54801
|
+
modifierText: makeModifierText([getHideWhenZeroLabel(item)].filter((label) => label !== undefined))
|
|
54802
|
+
};
|
|
54803
|
+
}
|
|
54804
|
+
handleEditorAction(action, item) {
|
|
54805
|
+
return handleToggleHideWhenZeroAction(action, item);
|
|
54748
54806
|
}
|
|
54749
54807
|
render(item, context, settings) {
|
|
54750
54808
|
if (context.isPreview) {
|
|
@@ -54757,10 +54815,16 @@ class ApiCallsWidget {
|
|
|
54757
54815
|
const parsed = parseDisplayName(context.data?.model?.display_name);
|
|
54758
54816
|
if (parsed.multiplierValue && parsed.multiplierValue > 0) {
|
|
54759
54817
|
const apiCalls = Math.round(requests / parsed.multiplierValue);
|
|
54818
|
+
if (apiCalls === 0 && isHideWhenZeroEnabled(item)) {
|
|
54819
|
+
return null;
|
|
54820
|
+
}
|
|
54760
54821
|
return formatRawOrLabeledValue(item, "Calls: ", String(apiCalls));
|
|
54761
54822
|
}
|
|
54762
54823
|
return null;
|
|
54763
54824
|
}
|
|
54825
|
+
getCustomKeybinds() {
|
|
54826
|
+
return getHideWhenZeroKeybinds();
|
|
54827
|
+
}
|
|
54764
54828
|
supportsRawValue() {
|
|
54765
54829
|
return true;
|
|
54766
54830
|
}
|
|
@@ -54982,7 +55046,7 @@ class CacheWriteTokensWidget {
|
|
|
54982
55046
|
}
|
|
54983
55047
|
}
|
|
54984
55048
|
// src/utils/git.ts
|
|
54985
|
-
import {
|
|
55049
|
+
import { execFileSync } from "child_process";
|
|
54986
55050
|
var gitCommandCache = new Map;
|
|
54987
55051
|
function resolveGitCwd(context) {
|
|
54988
55052
|
const candidates = [
|
|
@@ -54997,13 +55061,14 @@ function resolveGitCwd(context) {
|
|
|
54997
55061
|
return;
|
|
54998
55062
|
}
|
|
54999
55063
|
function runGit(command, context) {
|
|
55064
|
+
const args = command.trim().split(/\s+/).filter(Boolean);
|
|
55000
55065
|
const cwd2 = resolveGitCwd(context);
|
|
55001
55066
|
const cacheKey = `${command}|${cwd2 ?? ""}`;
|
|
55002
55067
|
if (gitCommandCache.has(cacheKey)) {
|
|
55003
55068
|
return gitCommandCache.get(cacheKey) ?? null;
|
|
55004
55069
|
}
|
|
55005
55070
|
try {
|
|
55006
|
-
const output =
|
|
55071
|
+
const output = execFileSync("git", args, {
|
|
55007
55072
|
encoding: "utf8",
|
|
55008
55073
|
stdio: ["pipe", "pipe", "ignore"],
|
|
55009
55074
|
...cwd2 ? { cwd: cwd2 } : {}
|
|
@@ -55040,6 +55105,20 @@ function getGitChangeCounts(context) {
|
|
|
55040
55105
|
function hasRenameOrCopyStatus(line) {
|
|
55041
55106
|
return line.startsWith("R") || line.startsWith("C") || line[1] === "R" || line[1] === "C";
|
|
55042
55107
|
}
|
|
55108
|
+
function forEachPorcelainEntry(output, visit) {
|
|
55109
|
+
const entries = output.split("\x00");
|
|
55110
|
+
for (let index = 0;index < entries.length; index += 1) {
|
|
55111
|
+
const line = entries[index];
|
|
55112
|
+
if (typeof line !== "string" || line.length < 2)
|
|
55113
|
+
continue;
|
|
55114
|
+
const shouldContinue = visit(line);
|
|
55115
|
+
if (hasRenameOrCopyStatus(line)) {
|
|
55116
|
+
index += 1;
|
|
55117
|
+
}
|
|
55118
|
+
if (shouldContinue === false)
|
|
55119
|
+
return;
|
|
55120
|
+
}
|
|
55121
|
+
}
|
|
55043
55122
|
function getGitStatus(context) {
|
|
55044
55123
|
const output = runGit("--no-optional-locks status --porcelain -z", context);
|
|
55045
55124
|
if (!output) {
|
|
@@ -55049,11 +55128,7 @@ function getGitStatus(context) {
|
|
|
55049
55128
|
let unstaged = false;
|
|
55050
55129
|
let untracked = false;
|
|
55051
55130
|
let conflicts = false;
|
|
55052
|
-
|
|
55053
|
-
for (let index = 0;index < entries.length; index += 1) {
|
|
55054
|
-
const line = entries[index];
|
|
55055
|
-
if (typeof line !== "string" || line.length < 2)
|
|
55056
|
-
continue;
|
|
55131
|
+
forEachPorcelainEntry(output, (line) => {
|
|
55057
55132
|
if (!conflicts && /^(DD|AU|UD|UA|DU|AA|UU)/.test(line))
|
|
55058
55133
|
conflicts = true;
|
|
55059
55134
|
if (!staged && /^[MADRCTU]/.test(line))
|
|
@@ -55063,11 +55138,9 @@ function getGitStatus(context) {
|
|
|
55063
55138
|
if (!untracked && line.startsWith("??"))
|
|
55064
55139
|
untracked = true;
|
|
55065
55140
|
if (staged && unstaged && untracked && conflicts)
|
|
55066
|
-
|
|
55067
|
-
|
|
55068
|
-
|
|
55069
|
-
}
|
|
55070
|
-
}
|
|
55141
|
+
return false;
|
|
55142
|
+
return;
|
|
55143
|
+
});
|
|
55071
55144
|
return { staged, unstaged, untracked, conflicts };
|
|
55072
55145
|
}
|
|
55073
55146
|
function getGitFileStatusCounts(context) {
|
|
@@ -55078,23 +55151,17 @@ function getGitFileStatusCounts(context) {
|
|
|
55078
55151
|
let staged = 0;
|
|
55079
55152
|
let unstaged = 0;
|
|
55080
55153
|
let untracked = 0;
|
|
55081
|
-
|
|
55082
|
-
for (let index = 0;index < entries.length; index += 1) {
|
|
55083
|
-
const line = entries[index];
|
|
55084
|
-
if (typeof line !== "string" || line.length < 2)
|
|
55085
|
-
continue;
|
|
55154
|
+
forEachPorcelainEntry(output, (line) => {
|
|
55086
55155
|
if (line.startsWith("??")) {
|
|
55087
55156
|
untracked += 1;
|
|
55088
|
-
|
|
55089
|
-
if (/^[MADRCTU]/.test(line))
|
|
55090
|
-
staged += 1;
|
|
55091
|
-
if (/^.[MADRCTU]/.test(line))
|
|
55092
|
-
unstaged += 1;
|
|
55093
|
-
}
|
|
55094
|
-
if (hasRenameOrCopyStatus(line)) {
|
|
55095
|
-
index += 1;
|
|
55157
|
+
return;
|
|
55096
55158
|
}
|
|
55097
|
-
|
|
55159
|
+
if (/^[MADRCTU]/.test(line))
|
|
55160
|
+
staged += 1;
|
|
55161
|
+
if (/^.[MADRCTU]/.test(line))
|
|
55162
|
+
unstaged += 1;
|
|
55163
|
+
return;
|
|
55164
|
+
});
|
|
55098
55165
|
return { staged, unstaged, untracked };
|
|
55099
55166
|
}
|
|
55100
55167
|
function getGitAheadBehind(context) {
|
|
@@ -55282,6 +55349,9 @@ var HIDE_NO_GIT_KEYBIND = {
|
|
|
55282
55349
|
function isHideNoGitEnabled(item) {
|
|
55283
55350
|
return isMetadataFlagEnabled(item, HIDE_NO_GIT_KEY);
|
|
55284
55351
|
}
|
|
55352
|
+
function getHideNoGitLabel(item) {
|
|
55353
|
+
return isHideNoGitEnabled(item) ? "hide 'no git'" : undefined;
|
|
55354
|
+
}
|
|
55285
55355
|
function getHideNoGitModifierText(item) {
|
|
55286
55356
|
return makeModifierText(isHideNoGitEnabled(item) ? ["hide 'no git'"] : []);
|
|
55287
55357
|
}
|
|
@@ -55636,7 +55706,7 @@ class GitRootDirWidget {
|
|
|
55636
55706
|
}
|
|
55637
55707
|
}
|
|
55638
55708
|
// src/utils/gh-pr-cache.ts
|
|
55639
|
-
import { execFileSync } from "child_process";
|
|
55709
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
55640
55710
|
import {
|
|
55641
55711
|
existsSync as existsSync6,
|
|
55642
55712
|
mkdirSync as mkdirSync3,
|
|
@@ -55651,7 +55721,7 @@ var PR_CACHE_TTL = 30000;
|
|
|
55651
55721
|
var GH_TIMEOUT = 5000;
|
|
55652
55722
|
var DEFAULT_TITLE_MAX_WIDTH = 30;
|
|
55653
55723
|
var DEFAULT_PR_CACHE_DEPS = {
|
|
55654
|
-
execFileSync,
|
|
55724
|
+
execFileSync: execFileSync2,
|
|
55655
55725
|
existsSync: existsSync6,
|
|
55656
55726
|
mkdirSync: mkdirSync3,
|
|
55657
55727
|
readFileSync: readFileSync4,
|
|
@@ -56030,13 +56100,14 @@ class GitStagedFilesWidget {
|
|
|
56030
56100
|
return "Git";
|
|
56031
56101
|
}
|
|
56032
56102
|
getEditorDisplay(item) {
|
|
56103
|
+
const labels = [getHideNoGitLabel(item), getHideWhenZeroLabel(item)].filter((label) => label !== undefined);
|
|
56033
56104
|
return {
|
|
56034
56105
|
displayText: this.getDisplayName(),
|
|
56035
|
-
modifierText:
|
|
56106
|
+
modifierText: makeModifierText(labels)
|
|
56036
56107
|
};
|
|
56037
56108
|
}
|
|
56038
56109
|
handleEditorAction(action, item) {
|
|
56039
|
-
return handleToggleNoGitAction(action, item);
|
|
56110
|
+
return handleToggleNoGitAction(action, item) ?? handleToggleHideWhenZeroAction(action, item);
|
|
56040
56111
|
}
|
|
56041
56112
|
render(item, context, _settings) {
|
|
56042
56113
|
const hideNoGit = isHideNoGitEnabled(item);
|
|
@@ -56047,10 +56118,13 @@ class GitStagedFilesWidget {
|
|
|
56047
56118
|
return hideNoGit ? null : "(no git)";
|
|
56048
56119
|
}
|
|
56049
56120
|
const count = getGitFileStatusCounts(context).staged;
|
|
56121
|
+
if (count === 0 && isHideWhenZeroEnabled(item)) {
|
|
56122
|
+
return null;
|
|
56123
|
+
}
|
|
56050
56124
|
return item.rawValue ? count.toString() : `S:${count}`;
|
|
56051
56125
|
}
|
|
56052
56126
|
getCustomKeybinds() {
|
|
56053
|
-
return getHideNoGitKeybinds();
|
|
56127
|
+
return [...getHideNoGitKeybinds(), ...getHideWhenZeroKeybinds()];
|
|
56054
56128
|
}
|
|
56055
56129
|
getNumericValue(context, _item) {
|
|
56056
56130
|
if (!isInsideGitWorkTree(context))
|
|
@@ -56138,13 +56212,14 @@ class GitUnstagedFilesWidget {
|
|
|
56138
56212
|
return "Git";
|
|
56139
56213
|
}
|
|
56140
56214
|
getEditorDisplay(item) {
|
|
56215
|
+
const labels = [getHideNoGitLabel(item), getHideWhenZeroLabel(item)].filter((label) => label !== undefined);
|
|
56141
56216
|
return {
|
|
56142
56217
|
displayText: this.getDisplayName(),
|
|
56143
|
-
modifierText:
|
|
56218
|
+
modifierText: makeModifierText(labels)
|
|
56144
56219
|
};
|
|
56145
56220
|
}
|
|
56146
56221
|
handleEditorAction(action, item) {
|
|
56147
|
-
return handleToggleNoGitAction(action, item);
|
|
56222
|
+
return handleToggleNoGitAction(action, item) ?? handleToggleHideWhenZeroAction(action, item);
|
|
56148
56223
|
}
|
|
56149
56224
|
render(item, context, _settings) {
|
|
56150
56225
|
const hideNoGit = isHideNoGitEnabled(item);
|
|
@@ -56155,10 +56230,13 @@ class GitUnstagedFilesWidget {
|
|
|
56155
56230
|
return hideNoGit ? null : "(no git)";
|
|
56156
56231
|
}
|
|
56157
56232
|
const count = getGitFileStatusCounts(context).unstaged;
|
|
56233
|
+
if (count === 0 && isHideWhenZeroEnabled(item)) {
|
|
56234
|
+
return null;
|
|
56235
|
+
}
|
|
56158
56236
|
return item.rawValue ? count.toString() : `M:${count}`;
|
|
56159
56237
|
}
|
|
56160
56238
|
getCustomKeybinds() {
|
|
56161
|
-
return getHideNoGitKeybinds();
|
|
56239
|
+
return [...getHideNoGitKeybinds(), ...getHideWhenZeroKeybinds()];
|
|
56162
56240
|
}
|
|
56163
56241
|
getNumericValue(context, _item) {
|
|
56164
56242
|
if (!isInsideGitWorkTree(context))
|
|
@@ -56246,13 +56324,14 @@ class GitUntrackedFilesWidget {
|
|
|
56246
56324
|
return "Git";
|
|
56247
56325
|
}
|
|
56248
56326
|
getEditorDisplay(item) {
|
|
56327
|
+
const labels = [getHideNoGitLabel(item), getHideWhenZeroLabel(item)].filter((label) => label !== undefined);
|
|
56249
56328
|
return {
|
|
56250
56329
|
displayText: this.getDisplayName(),
|
|
56251
|
-
modifierText:
|
|
56330
|
+
modifierText: makeModifierText(labels)
|
|
56252
56331
|
};
|
|
56253
56332
|
}
|
|
56254
56333
|
handleEditorAction(action, item) {
|
|
56255
|
-
return handleToggleNoGitAction(action, item);
|
|
56334
|
+
return handleToggleNoGitAction(action, item) ?? handleToggleHideWhenZeroAction(action, item);
|
|
56256
56335
|
}
|
|
56257
56336
|
render(item, context, _settings) {
|
|
56258
56337
|
const hideNoGit = isHideNoGitEnabled(item);
|
|
@@ -56263,10 +56342,13 @@ class GitUntrackedFilesWidget {
|
|
|
56263
56342
|
return hideNoGit ? null : "(no git)";
|
|
56264
56343
|
}
|
|
56265
56344
|
const count = getGitFileStatusCounts(context).untracked;
|
|
56345
|
+
if (count === 0 && isHideWhenZeroEnabled(item)) {
|
|
56346
|
+
return null;
|
|
56347
|
+
}
|
|
56266
56348
|
return item.rawValue ? count.toString() : `?:${count}`;
|
|
56267
56349
|
}
|
|
56268
56350
|
getCustomKeybinds() {
|
|
56269
|
-
return getHideNoGitKeybinds();
|
|
56351
|
+
return [...getHideNoGitKeybinds(), ...getHideWhenZeroKeybinds()];
|
|
56270
56352
|
}
|
|
56271
56353
|
getNumericValue(context, _item) {
|
|
56272
56354
|
if (!isInsideGitWorkTree(context))
|
|
@@ -56415,17 +56497,14 @@ class GitConflictsWidget {
|
|
|
56415
56497
|
return "Git";
|
|
56416
56498
|
}
|
|
56417
56499
|
getEditorDisplay(item) {
|
|
56418
|
-
const
|
|
56419
|
-
const noGitText = getHideNoGitModifierText(item);
|
|
56420
|
-
if (noGitText)
|
|
56421
|
-
modifiers.push("hide 'no git'");
|
|
56500
|
+
const labels = [getHideNoGitLabel(item), getHideWhenZeroLabel(item)].filter((label) => label !== undefined);
|
|
56422
56501
|
return {
|
|
56423
56502
|
displayText: this.getDisplayName(),
|
|
56424
|
-
modifierText: makeModifierText(
|
|
56503
|
+
modifierText: makeModifierText(labels)
|
|
56425
56504
|
};
|
|
56426
56505
|
}
|
|
56427
56506
|
handleEditorAction(action, item) {
|
|
56428
|
-
return handleToggleNoGitAction(action, item);
|
|
56507
|
+
return handleToggleNoGitAction(action, item) ?? handleToggleHideWhenZeroAction(action, item);
|
|
56429
56508
|
}
|
|
56430
56509
|
render(item, context, _settings) {
|
|
56431
56510
|
const hideNoGit = isHideNoGitEnabled(item);
|
|
@@ -56438,13 +56517,16 @@ class GitConflictsWidget {
|
|
|
56438
56517
|
return hideNoGit ? null : "(no git)";
|
|
56439
56518
|
}
|
|
56440
56519
|
const count = getGitConflictCount(context);
|
|
56520
|
+
if (count === 0 && isHideWhenZeroEnabled(item)) {
|
|
56521
|
+
return null;
|
|
56522
|
+
}
|
|
56441
56523
|
if (item.rawValue) {
|
|
56442
56524
|
return count.toString();
|
|
56443
56525
|
}
|
|
56444
56526
|
return `⚠ ${count}`;
|
|
56445
56527
|
}
|
|
56446
56528
|
getCustomKeybinds() {
|
|
56447
|
-
return getHideNoGitKeybinds();
|
|
56529
|
+
return [...getHideNoGitKeybinds(), ...getHideWhenZeroKeybinds()];
|
|
56448
56530
|
}
|
|
56449
56531
|
getNumericValue(context, _item) {
|
|
56450
56532
|
if (!isInsideGitWorkTree(context))
|
|
@@ -57324,7 +57406,7 @@ class TerminalWidthWidget {
|
|
|
57324
57406
|
}
|
|
57325
57407
|
}
|
|
57326
57408
|
// src/widgets/FreeMemory.ts
|
|
57327
|
-
import { execSync as
|
|
57409
|
+
import { execSync as execSync4 } from "child_process";
|
|
57328
57410
|
import os8 from "os";
|
|
57329
57411
|
function formatBytes(bytes) {
|
|
57330
57412
|
const GB = 1024 ** 3;
|
|
@@ -57340,7 +57422,7 @@ function formatBytes(bytes) {
|
|
|
57340
57422
|
}
|
|
57341
57423
|
function getUsedMemoryMacOS() {
|
|
57342
57424
|
try {
|
|
57343
|
-
const output =
|
|
57425
|
+
const output = execSync4("vm_stat", { encoding: "utf8" });
|
|
57344
57426
|
const lines = output.split(`
|
|
57345
57427
|
`);
|
|
57346
57428
|
const firstLine = lines[0];
|
|
@@ -57653,7 +57735,7 @@ var CustomSymbolEditor = ({ widget, onComplete, onCancel }) => {
|
|
|
57653
57735
|
}, undefined, true, undefined, this);
|
|
57654
57736
|
};
|
|
57655
57737
|
// src/widgets/CustomCommand.tsx
|
|
57656
|
-
import { execSync as
|
|
57738
|
+
import { execSync as execSync5 } from "child_process";
|
|
57657
57739
|
var import_react32 = __toESM(require_react(), 1);
|
|
57658
57740
|
|
|
57659
57741
|
// src/utils/ansi.ts
|
|
@@ -58041,7 +58123,7 @@ class CustomCommandWidget {
|
|
|
58041
58123
|
try {
|
|
58042
58124
|
const timeout = item.timeout ?? 1000;
|
|
58043
58125
|
const jsonInput = JSON.stringify(context.data);
|
|
58044
|
-
let output =
|
|
58126
|
+
let output = execSync5(item.commandPath, {
|
|
58045
58127
|
encoding: "utf8",
|
|
58046
58128
|
input: jsonInput,
|
|
58047
58129
|
timeout,
|
|
@@ -63795,8 +63877,8 @@ async function ensureWindowsUtf8CodePage() {
|
|
|
63795
63877
|
return;
|
|
63796
63878
|
}
|
|
63797
63879
|
try {
|
|
63798
|
-
const { execFileSync:
|
|
63799
|
-
|
|
63880
|
+
const { execFileSync: execFileSync3 } = await import("child_process");
|
|
63881
|
+
execFileSync3("chcp.com", ["65001"], { stdio: "ignore" });
|
|
63800
63882
|
} catch {}
|
|
63801
63883
|
}
|
|
63802
63884
|
async function renderMultipleLines(data) {
|
package/package.json
CHANGED