ccstatusline 2.0.25 → 2.0.27
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 +14 -0
- package/dist/ccstatusline.js +823 -121
- package/package.json +2 -2
package/dist/ccstatusline.js
CHANGED
|
@@ -51405,7 +51405,7 @@ import { execSync as execSync3 } from "child_process";
|
|
|
51405
51405
|
import * as fs5 from "fs";
|
|
51406
51406
|
import * as path4 from "path";
|
|
51407
51407
|
var __dirname = "/Users/sirmalloc/Projects/Personal/ccstatusline/src/utils";
|
|
51408
|
-
var PACKAGE_VERSION = "2.0.
|
|
51408
|
+
var PACKAGE_VERSION = "2.0.27";
|
|
51409
51409
|
function getPackageVersion() {
|
|
51410
51410
|
if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
|
|
51411
51411
|
return PACKAGE_VERSION;
|
|
@@ -52234,6 +52234,18 @@ function getDefaultPowerlineTheme() {
|
|
|
52234
52234
|
return "nord-aurora";
|
|
52235
52235
|
}
|
|
52236
52236
|
|
|
52237
|
+
// src/utils/input-guards.ts
|
|
52238
|
+
var CONTROL_CHAR_REGEX = /[\u0000-\u001F\u007F]/u;
|
|
52239
|
+
var shouldInsertInput = (input, key) => {
|
|
52240
|
+
if (!input) {
|
|
52241
|
+
return false;
|
|
52242
|
+
}
|
|
52243
|
+
if (key.ctrl || key.meta || key.tab) {
|
|
52244
|
+
return false;
|
|
52245
|
+
}
|
|
52246
|
+
return !CONTROL_CHAR_REGEX.test(input);
|
|
52247
|
+
};
|
|
52248
|
+
|
|
52237
52249
|
// src/widgets/Model.ts
|
|
52238
52250
|
class ModelWidget {
|
|
52239
52251
|
getDefaultColor() {
|
|
@@ -52245,6 +52257,9 @@ class ModelWidget {
|
|
|
52245
52257
|
getDisplayName() {
|
|
52246
52258
|
return "Model";
|
|
52247
52259
|
}
|
|
52260
|
+
getCategory() {
|
|
52261
|
+
return "Core";
|
|
52262
|
+
}
|
|
52248
52263
|
getEditorDisplay(item) {
|
|
52249
52264
|
return { displayText: this.getDisplayName() };
|
|
52250
52265
|
}
|
|
@@ -52277,6 +52292,9 @@ class OutputStyleWidget {
|
|
|
52277
52292
|
getDisplayName() {
|
|
52278
52293
|
return "Output Style";
|
|
52279
52294
|
}
|
|
52295
|
+
getCategory() {
|
|
52296
|
+
return "Core";
|
|
52297
|
+
}
|
|
52280
52298
|
getEditorDisplay(item) {
|
|
52281
52299
|
return { displayText: this.getDisplayName() };
|
|
52282
52300
|
}
|
|
@@ -52308,6 +52326,9 @@ class GitBranchWidget {
|
|
|
52308
52326
|
getDisplayName() {
|
|
52309
52327
|
return "Git Branch";
|
|
52310
52328
|
}
|
|
52329
|
+
getCategory() {
|
|
52330
|
+
return "Git";
|
|
52331
|
+
}
|
|
52311
52332
|
getEditorDisplay(item) {
|
|
52312
52333
|
const hideNoGit = item.metadata?.hideNoGit === "true";
|
|
52313
52334
|
const modifiers = [];
|
|
@@ -52378,6 +52399,9 @@ class GitChangesWidget {
|
|
|
52378
52399
|
getDisplayName() {
|
|
52379
52400
|
return "Git Changes";
|
|
52380
52401
|
}
|
|
52402
|
+
getCategory() {
|
|
52403
|
+
return "Git";
|
|
52404
|
+
}
|
|
52381
52405
|
getEditorDisplay(item) {
|
|
52382
52406
|
const hideNoGit = item.metadata?.hideNoGit === "true";
|
|
52383
52407
|
const modifiers = [];
|
|
@@ -52454,9 +52478,90 @@ class GitChangesWidget {
|
|
|
52454
52478
|
return true;
|
|
52455
52479
|
}
|
|
52456
52480
|
}
|
|
52457
|
-
// src/widgets/
|
|
52481
|
+
// src/widgets/GitRootDir.ts
|
|
52458
52482
|
import { execSync as execSync6 } from "child_process";
|
|
52459
52483
|
|
|
52484
|
+
class GitRootDirWidget {
|
|
52485
|
+
getDefaultColor() {
|
|
52486
|
+
return "cyan";
|
|
52487
|
+
}
|
|
52488
|
+
getDescription() {
|
|
52489
|
+
return "Shows the git repository root directory name";
|
|
52490
|
+
}
|
|
52491
|
+
getDisplayName() {
|
|
52492
|
+
return "Git Root Dir";
|
|
52493
|
+
}
|
|
52494
|
+
getCategory() {
|
|
52495
|
+
return "Git";
|
|
52496
|
+
}
|
|
52497
|
+
getEditorDisplay(item) {
|
|
52498
|
+
const hideNoGit = item.metadata?.hideNoGit === "true";
|
|
52499
|
+
const modifiers = [];
|
|
52500
|
+
if (hideNoGit) {
|
|
52501
|
+
modifiers.push("hide 'no git'");
|
|
52502
|
+
}
|
|
52503
|
+
return {
|
|
52504
|
+
displayText: this.getDisplayName(),
|
|
52505
|
+
modifierText: modifiers.length > 0 ? `(${modifiers.join(", ")})` : undefined
|
|
52506
|
+
};
|
|
52507
|
+
}
|
|
52508
|
+
handleEditorAction(action, item) {
|
|
52509
|
+
if (action === "toggle-nogit") {
|
|
52510
|
+
const currentState = item.metadata?.hideNoGit === "true";
|
|
52511
|
+
return {
|
|
52512
|
+
...item,
|
|
52513
|
+
metadata: {
|
|
52514
|
+
...item.metadata,
|
|
52515
|
+
hideNoGit: (!currentState).toString()
|
|
52516
|
+
}
|
|
52517
|
+
};
|
|
52518
|
+
}
|
|
52519
|
+
return null;
|
|
52520
|
+
}
|
|
52521
|
+
render(item, context, _settings) {
|
|
52522
|
+
const hideNoGit = item.metadata?.hideNoGit === "true";
|
|
52523
|
+
if (context.isPreview) {
|
|
52524
|
+
return "my-repo";
|
|
52525
|
+
}
|
|
52526
|
+
const rootDir = this.getGitRootDir();
|
|
52527
|
+
if (rootDir) {
|
|
52528
|
+
return this.getRootDirName(rootDir);
|
|
52529
|
+
}
|
|
52530
|
+
return hideNoGit ? null : "no git";
|
|
52531
|
+
}
|
|
52532
|
+
getGitRootDir() {
|
|
52533
|
+
try {
|
|
52534
|
+
const rootDir = execSync6("git rev-parse --show-toplevel", {
|
|
52535
|
+
encoding: "utf8",
|
|
52536
|
+
stdio: ["pipe", "pipe", "ignore"]
|
|
52537
|
+
}).trim();
|
|
52538
|
+
return rootDir || null;
|
|
52539
|
+
} catch {
|
|
52540
|
+
return null;
|
|
52541
|
+
}
|
|
52542
|
+
}
|
|
52543
|
+
getRootDirName(rootDir) {
|
|
52544
|
+
const trimmedRootDir = rootDir.replace(/[\\/]+$/, "");
|
|
52545
|
+
const normalizedRootDir = trimmedRootDir.length > 0 ? trimmedRootDir : rootDir;
|
|
52546
|
+
const parts = normalizedRootDir.split(/[\\/]/).filter(Boolean);
|
|
52547
|
+
const lastPart = parts[parts.length - 1];
|
|
52548
|
+
return lastPart && lastPart.length > 0 ? lastPart : normalizedRootDir;
|
|
52549
|
+
}
|
|
52550
|
+
getCustomKeybinds() {
|
|
52551
|
+
return [
|
|
52552
|
+
{ key: "h", label: "(h)ide 'no git' message", action: "toggle-nogit" }
|
|
52553
|
+
];
|
|
52554
|
+
}
|
|
52555
|
+
supportsRawValue() {
|
|
52556
|
+
return false;
|
|
52557
|
+
}
|
|
52558
|
+
supportsColors(item) {
|
|
52559
|
+
return true;
|
|
52560
|
+
}
|
|
52561
|
+
}
|
|
52562
|
+
// src/widgets/GitWorktree.ts
|
|
52563
|
+
import { execSync as execSync7 } from "child_process";
|
|
52564
|
+
|
|
52460
52565
|
class GitWorktreeWidget {
|
|
52461
52566
|
getDefaultColor() {
|
|
52462
52567
|
return "blue";
|
|
@@ -52467,6 +52572,9 @@ class GitWorktreeWidget {
|
|
|
52467
52572
|
getDisplayName() {
|
|
52468
52573
|
return "Git Worktree";
|
|
52469
52574
|
}
|
|
52575
|
+
getCategory() {
|
|
52576
|
+
return "Git";
|
|
52577
|
+
}
|
|
52470
52578
|
getEditorDisplay(item) {
|
|
52471
52579
|
const hideNoGit = item.metadata?.hideNoGit === "true";
|
|
52472
52580
|
const modifiers = [];
|
|
@@ -52502,7 +52610,7 @@ class GitWorktreeWidget {
|
|
|
52502
52610
|
}
|
|
52503
52611
|
getGitWorktree() {
|
|
52504
52612
|
try {
|
|
52505
|
-
const worktreeDir =
|
|
52613
|
+
const worktreeDir = execSync7("git rev-parse --git-dir", {
|
|
52506
52614
|
encoding: "utf8",
|
|
52507
52615
|
stdio: ["pipe", "pipe", "ignore"]
|
|
52508
52616
|
}).trim();
|
|
@@ -52534,7 +52642,7 @@ function getContextConfig(modelId) {
|
|
|
52534
52642
|
};
|
|
52535
52643
|
if (!modelId)
|
|
52536
52644
|
return defaultConfig;
|
|
52537
|
-
if (modelId.
|
|
52645
|
+
if (modelId.toLowerCase().includes("[1m]")) {
|
|
52538
52646
|
return {
|
|
52539
52647
|
maxTokens: 1e6,
|
|
52540
52648
|
usableTokens: 800000
|
|
@@ -53230,6 +53338,9 @@ class TokensInputWidget {
|
|
|
53230
53338
|
getDisplayName() {
|
|
53231
53339
|
return "Tokens Input";
|
|
53232
53340
|
}
|
|
53341
|
+
getCategory() {
|
|
53342
|
+
return "Tokens";
|
|
53343
|
+
}
|
|
53233
53344
|
getEditorDisplay(item) {
|
|
53234
53345
|
return { displayText: this.getDisplayName() };
|
|
53235
53346
|
}
|
|
@@ -53259,6 +53370,9 @@ class TokensOutputWidget {
|
|
|
53259
53370
|
getDisplayName() {
|
|
53260
53371
|
return "Tokens Output";
|
|
53261
53372
|
}
|
|
53373
|
+
getCategory() {
|
|
53374
|
+
return "Tokens";
|
|
53375
|
+
}
|
|
53262
53376
|
getEditorDisplay(item) {
|
|
53263
53377
|
return { displayText: this.getDisplayName() };
|
|
53264
53378
|
}
|
|
@@ -53288,6 +53402,9 @@ class TokensCachedWidget {
|
|
|
53288
53402
|
getDisplayName() {
|
|
53289
53403
|
return "Tokens Cached";
|
|
53290
53404
|
}
|
|
53405
|
+
getCategory() {
|
|
53406
|
+
return "Tokens";
|
|
53407
|
+
}
|
|
53291
53408
|
getEditorDisplay(item) {
|
|
53292
53409
|
return { displayText: this.getDisplayName() };
|
|
53293
53410
|
}
|
|
@@ -53317,6 +53434,9 @@ class TokensTotalWidget {
|
|
|
53317
53434
|
getDisplayName() {
|
|
53318
53435
|
return "Tokens Total";
|
|
53319
53436
|
}
|
|
53437
|
+
getCategory() {
|
|
53438
|
+
return "Tokens";
|
|
53439
|
+
}
|
|
53320
53440
|
getEditorDisplay(item) {
|
|
53321
53441
|
return { displayText: this.getDisplayName() };
|
|
53322
53442
|
}
|
|
@@ -53346,6 +53466,9 @@ class ContextLengthWidget {
|
|
|
53346
53466
|
getDisplayName() {
|
|
53347
53467
|
return "Context Length";
|
|
53348
53468
|
}
|
|
53469
|
+
getCategory() {
|
|
53470
|
+
return "Context";
|
|
53471
|
+
}
|
|
53349
53472
|
getEditorDisplay(item) {
|
|
53350
53473
|
return { displayText: this.getDisplayName() };
|
|
53351
53474
|
}
|
|
@@ -53375,6 +53498,9 @@ class ContextPercentageWidget {
|
|
|
53375
53498
|
getDisplayName() {
|
|
53376
53499
|
return "Context %";
|
|
53377
53500
|
}
|
|
53501
|
+
getCategory() {
|
|
53502
|
+
return "Context";
|
|
53503
|
+
}
|
|
53378
53504
|
getEditorDisplay(item) {
|
|
53379
53505
|
const isInverse = item.metadata?.inverse === "true";
|
|
53380
53506
|
const modifiers = [];
|
|
@@ -53437,6 +53563,9 @@ class ContextPercentageUsableWidget {
|
|
|
53437
53563
|
getDisplayName() {
|
|
53438
53564
|
return "Context % (usable)";
|
|
53439
53565
|
}
|
|
53566
|
+
getCategory() {
|
|
53567
|
+
return "Context";
|
|
53568
|
+
}
|
|
53440
53569
|
getEditorDisplay(item) {
|
|
53441
53570
|
const isInverse = item.metadata?.inverse === "true";
|
|
53442
53571
|
const modifiers = [];
|
|
@@ -53499,6 +53628,9 @@ class SessionClockWidget {
|
|
|
53499
53628
|
getDisplayName() {
|
|
53500
53629
|
return "Session Clock";
|
|
53501
53630
|
}
|
|
53631
|
+
getCategory() {
|
|
53632
|
+
return "Session";
|
|
53633
|
+
}
|
|
53502
53634
|
getEditorDisplay(item) {
|
|
53503
53635
|
return { displayText: this.getDisplayName() };
|
|
53504
53636
|
}
|
|
@@ -53527,6 +53659,9 @@ class SessionCostWidget {
|
|
|
53527
53659
|
getDisplayName() {
|
|
53528
53660
|
return "Session Cost";
|
|
53529
53661
|
}
|
|
53662
|
+
getCategory() {
|
|
53663
|
+
return "Session";
|
|
53664
|
+
}
|
|
53530
53665
|
getEditorDisplay(item) {
|
|
53531
53666
|
return { displayText: this.getDisplayName() };
|
|
53532
53667
|
}
|
|
@@ -53559,6 +53694,9 @@ class TerminalWidthWidget {
|
|
|
53559
53694
|
getDisplayName() {
|
|
53560
53695
|
return "Terminal Width";
|
|
53561
53696
|
}
|
|
53697
|
+
getCategory() {
|
|
53698
|
+
return "Environment";
|
|
53699
|
+
}
|
|
53562
53700
|
getEditorDisplay(item) {
|
|
53563
53701
|
return { displayText: this.getDisplayName() };
|
|
53564
53702
|
}
|
|
@@ -53590,6 +53728,9 @@ class VersionWidget {
|
|
|
53590
53728
|
getDisplayName() {
|
|
53591
53729
|
return "Version";
|
|
53592
53730
|
}
|
|
53731
|
+
getCategory() {
|
|
53732
|
+
return "Core";
|
|
53733
|
+
}
|
|
53593
53734
|
getEditorDisplay(item) {
|
|
53594
53735
|
return { displayText: this.getDisplayName() };
|
|
53595
53736
|
}
|
|
@@ -53622,6 +53763,9 @@ class CustomTextWidget {
|
|
|
53622
53763
|
getDisplayName() {
|
|
53623
53764
|
return "Custom Text";
|
|
53624
53765
|
}
|
|
53766
|
+
getCategory() {
|
|
53767
|
+
return "Custom";
|
|
53768
|
+
}
|
|
53625
53769
|
getEditorDisplay(item) {
|
|
53626
53770
|
const text = item.customText ?? "Empty";
|
|
53627
53771
|
return { displayText: `${this.getDisplayName()} (${text})` };
|
|
@@ -53724,7 +53868,7 @@ var CustomTextEditor = ({ widget, onComplete, onCancel }) => {
|
|
|
53724
53868
|
setText(text.slice(0, deleteFromIndex) + text.slice(deleteToIndex));
|
|
53725
53869
|
}
|
|
53726
53870
|
}
|
|
53727
|
-
} else if (input
|
|
53871
|
+
} else if (shouldInsertInput(input, key)) {
|
|
53728
53872
|
const newText = text.slice(0, cursorPos) + input + text.slice(cursorPos);
|
|
53729
53873
|
setText(newText);
|
|
53730
53874
|
setCursorPos(cursorPos + input.length);
|
|
@@ -53760,7 +53904,7 @@ var CustomTextEditor = ({ widget, onComplete, onCancel }) => {
|
|
|
53760
53904
|
}, undefined, true, undefined, this);
|
|
53761
53905
|
};
|
|
53762
53906
|
// src/widgets/CustomCommand.tsx
|
|
53763
|
-
import { execSync as
|
|
53907
|
+
import { execSync as execSync8 } from "child_process";
|
|
53764
53908
|
var import_react30 = __toESM(require_react(), 1);
|
|
53765
53909
|
var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
|
|
53766
53910
|
|
|
@@ -53774,6 +53918,9 @@ class CustomCommandWidget {
|
|
|
53774
53918
|
getDisplayName() {
|
|
53775
53919
|
return "Custom Command";
|
|
53776
53920
|
}
|
|
53921
|
+
getCategory() {
|
|
53922
|
+
return "Custom";
|
|
53923
|
+
}
|
|
53777
53924
|
getEditorDisplay(item) {
|
|
53778
53925
|
const cmd = item.commandPath ?? "No command";
|
|
53779
53926
|
const truncatedCmd = cmd.length > 20 ? `${cmd.substring(0, 17)}...` : cmd;
|
|
@@ -53806,7 +53953,7 @@ class CustomCommandWidget {
|
|
|
53806
53953
|
try {
|
|
53807
53954
|
const timeout = item.timeout ?? 1000;
|
|
53808
53955
|
const jsonInput = JSON.stringify(context.data);
|
|
53809
|
-
let output =
|
|
53956
|
+
let output = execSync8(item.commandPath, {
|
|
53810
53957
|
encoding: "utf8",
|
|
53811
53958
|
input: jsonInput,
|
|
53812
53959
|
timeout,
|
|
@@ -53897,7 +54044,7 @@ var CustomCommandEditor = ({ widget, onComplete, onCancel, action }) => {
|
|
|
53897
54044
|
if (commandCursorPos < commandInput.length) {
|
|
53898
54045
|
setCommandInput(commandInput.slice(0, commandCursorPos) + commandInput.slice(commandCursorPos + 1));
|
|
53899
54046
|
}
|
|
53900
|
-
} else if (input) {
|
|
54047
|
+
} else if (shouldInsertInput(input, key)) {
|
|
53901
54048
|
setCommandInput(commandInput.slice(0, commandCursorPos) + input + commandInput.slice(commandCursorPos));
|
|
53902
54049
|
setCommandCursorPos(commandCursorPos + input.length);
|
|
53903
54050
|
}
|
|
@@ -53914,7 +54061,7 @@ var CustomCommandEditor = ({ widget, onComplete, onCancel, action }) => {
|
|
|
53914
54061
|
onCancel();
|
|
53915
54062
|
} else if (key.backspace) {
|
|
53916
54063
|
setWidthInput(widthInput.slice(0, -1));
|
|
53917
|
-
} else if (input && /\d/.test(input)) {
|
|
54064
|
+
} else if (shouldInsertInput(input, key) && /\d/.test(input)) {
|
|
53918
54065
|
setWidthInput(widthInput + input);
|
|
53919
54066
|
}
|
|
53920
54067
|
} else if (mode === "timeout") {
|
|
@@ -53930,7 +54077,7 @@ var CustomCommandEditor = ({ widget, onComplete, onCancel, action }) => {
|
|
|
53930
54077
|
onCancel();
|
|
53931
54078
|
} else if (key.backspace) {
|
|
53932
54079
|
setTimeoutInput(timeoutInput.slice(0, -1));
|
|
53933
|
-
} else if (input && /\d/.test(input)) {
|
|
54080
|
+
} else if (shouldInsertInput(input, key) && /\d/.test(input)) {
|
|
53934
54081
|
setTimeoutInput(timeoutInput + input);
|
|
53935
54082
|
}
|
|
53936
54083
|
}
|
|
@@ -54024,6 +54171,9 @@ class BlockTimerWidget {
|
|
|
54024
54171
|
getDisplayName() {
|
|
54025
54172
|
return "Block Timer";
|
|
54026
54173
|
}
|
|
54174
|
+
getCategory() {
|
|
54175
|
+
return "Session";
|
|
54176
|
+
}
|
|
54027
54177
|
getEditorDisplay(item) {
|
|
54028
54178
|
const mode = item.metadata?.display ?? "time";
|
|
54029
54179
|
const modifiers = [];
|
|
@@ -54124,8 +54274,8 @@ class BlockTimerWidget {
|
|
|
54124
54274
|
}
|
|
54125
54275
|
// src/widgets/CurrentWorkingDir.tsx
|
|
54126
54276
|
var import_react31 = __toESM(require_react(), 1);
|
|
54127
|
-
var jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
|
|
54128
54277
|
import * as os5 from "node:os";
|
|
54278
|
+
var jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
|
|
54129
54279
|
|
|
54130
54280
|
class CurrentWorkingDirWidget {
|
|
54131
54281
|
getDefaultColor() {
|
|
@@ -54137,10 +54287,17 @@ class CurrentWorkingDirWidget {
|
|
|
54137
54287
|
getDisplayName() {
|
|
54138
54288
|
return "Current Working Dir";
|
|
54139
54289
|
}
|
|
54290
|
+
getCategory() {
|
|
54291
|
+
return "Environment";
|
|
54292
|
+
}
|
|
54140
54293
|
getEditorDisplay(item) {
|
|
54141
54294
|
const segments = item.metadata?.segments ? parseInt(item.metadata.segments, 10) : undefined;
|
|
54142
54295
|
const fishStyle = item.metadata?.fishStyle === "true";
|
|
54296
|
+
const abbreviateHome = item.metadata?.abbreviateHome === "true";
|
|
54143
54297
|
const modifiers = [];
|
|
54298
|
+
if (abbreviateHome) {
|
|
54299
|
+
modifiers.push("~");
|
|
54300
|
+
}
|
|
54144
54301
|
if (fishStyle) {
|
|
54145
54302
|
modifiers.push("fish-style");
|
|
54146
54303
|
} else if (segments && segments > 0) {
|
|
@@ -54152,11 +54309,31 @@ class CurrentWorkingDirWidget {
|
|
|
54152
54309
|
};
|
|
54153
54310
|
}
|
|
54154
54311
|
handleEditorAction(action, item) {
|
|
54312
|
+
if (action === "toggle-abbreviate-home") {
|
|
54313
|
+
const currentAbbreviateHome = item.metadata?.abbreviateHome === "true";
|
|
54314
|
+
const newAbbreviateHome = !currentAbbreviateHome;
|
|
54315
|
+
if (newAbbreviateHome) {
|
|
54316
|
+
const { fishStyle, ...restMetadata } = item.metadata ?? {};
|
|
54317
|
+
return {
|
|
54318
|
+
...item,
|
|
54319
|
+
metadata: {
|
|
54320
|
+
...restMetadata,
|
|
54321
|
+
abbreviateHome: "true"
|
|
54322
|
+
}
|
|
54323
|
+
};
|
|
54324
|
+
} else {
|
|
54325
|
+
const { abbreviateHome, ...restMetadata } = item.metadata ?? {};
|
|
54326
|
+
return {
|
|
54327
|
+
...item,
|
|
54328
|
+
metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
|
|
54329
|
+
};
|
|
54330
|
+
}
|
|
54331
|
+
}
|
|
54155
54332
|
if (action === "toggle-fish-style") {
|
|
54156
54333
|
const currentFishStyle = item.metadata?.fishStyle === "true";
|
|
54157
54334
|
const newFishStyle = !currentFishStyle;
|
|
54158
54335
|
if (newFishStyle) {
|
|
54159
|
-
const { segments, ...restMetadata } = item.metadata ?? {};
|
|
54336
|
+
const { segments, abbreviateHome, ...restMetadata } = item.metadata ?? {};
|
|
54160
54337
|
return {
|
|
54161
54338
|
...item,
|
|
54162
54339
|
metadata: {
|
|
@@ -54177,10 +54354,19 @@ class CurrentWorkingDirWidget {
|
|
|
54177
54354
|
render(item, context, settings) {
|
|
54178
54355
|
const segments = item.metadata?.segments ? parseInt(item.metadata.segments, 10) : undefined;
|
|
54179
54356
|
const fishStyle = item.metadata?.fishStyle === "true";
|
|
54357
|
+
const abbreviateHome = item.metadata?.abbreviateHome === "true";
|
|
54180
54358
|
if (context.isPreview) {
|
|
54181
54359
|
let previewPath;
|
|
54182
54360
|
if (fishStyle) {
|
|
54183
54361
|
previewPath = "~/D/P/my-project";
|
|
54362
|
+
} else if (abbreviateHome && segments && segments > 0) {
|
|
54363
|
+
if (segments === 1) {
|
|
54364
|
+
previewPath = "~/.../my-project";
|
|
54365
|
+
} else {
|
|
54366
|
+
previewPath = "~/.../Projects/my-project";
|
|
54367
|
+
}
|
|
54368
|
+
} else if (abbreviateHome) {
|
|
54369
|
+
previewPath = "~/Documents/Projects/my-project";
|
|
54184
54370
|
} else if (segments && segments > 0) {
|
|
54185
54371
|
if (segments === 1) {
|
|
54186
54372
|
previewPath = ".../project";
|
|
@@ -54198,20 +54384,27 @@ class CurrentWorkingDirWidget {
|
|
|
54198
54384
|
let displayPath = cwd2;
|
|
54199
54385
|
if (fishStyle) {
|
|
54200
54386
|
displayPath = this.abbreviatePath(cwd2);
|
|
54201
|
-
} else
|
|
54202
|
-
|
|
54203
|
-
|
|
54204
|
-
|
|
54205
|
-
|
|
54206
|
-
|
|
54207
|
-
const
|
|
54208
|
-
|
|
54387
|
+
} else {
|
|
54388
|
+
if (abbreviateHome) {
|
|
54389
|
+
displayPath = this.abbreviateHomeDir(displayPath);
|
|
54390
|
+
}
|
|
54391
|
+
if (segments && segments > 0) {
|
|
54392
|
+
const useBackslash = displayPath.includes("\\") && !displayPath.includes("/");
|
|
54393
|
+
const outSep = useBackslash ? "\\" : "/";
|
|
54394
|
+
const pathParts = displayPath.split(/[\\/]+/);
|
|
54395
|
+
const filteredParts = pathParts.filter((part) => part !== "");
|
|
54396
|
+
if (filteredParts.length > segments) {
|
|
54397
|
+
const selectedSegments = filteredParts.slice(-segments);
|
|
54398
|
+
const prefix = displayPath.startsWith("~") ? `~${outSep}` : "";
|
|
54399
|
+
displayPath = prefix + "..." + outSep + selectedSegments.join(outSep);
|
|
54400
|
+
}
|
|
54209
54401
|
}
|
|
54210
54402
|
}
|
|
54211
54403
|
return item.rawValue ? displayPath : `cwd: ${displayPath}`;
|
|
54212
54404
|
}
|
|
54213
54405
|
getCustomKeybinds() {
|
|
54214
54406
|
return [
|
|
54407
|
+
{ key: "h", label: "(h)ome ~", action: "toggle-abbreviate-home" },
|
|
54215
54408
|
{ key: "s", label: "(s)egments", action: "edit-segments" },
|
|
54216
54409
|
{ key: "f", label: "(f)ish style", action: "toggle-fish-style" }
|
|
54217
54410
|
];
|
|
@@ -54227,6 +54420,20 @@ class CurrentWorkingDirWidget {
|
|
|
54227
54420
|
supportsColors(item) {
|
|
54228
54421
|
return true;
|
|
54229
54422
|
}
|
|
54423
|
+
abbreviateHomeDir(path5) {
|
|
54424
|
+
const homeDir = os5.homedir();
|
|
54425
|
+
if (path5 === homeDir) {
|
|
54426
|
+
return "~";
|
|
54427
|
+
}
|
|
54428
|
+
if (path5.startsWith(homeDir)) {
|
|
54429
|
+
const boundaryChar = path5[homeDir.length];
|
|
54430
|
+
if (boundaryChar !== "/" && boundaryChar !== "\\") {
|
|
54431
|
+
return path5;
|
|
54432
|
+
}
|
|
54433
|
+
return "~" + path5.slice(homeDir.length);
|
|
54434
|
+
}
|
|
54435
|
+
return path5;
|
|
54436
|
+
}
|
|
54230
54437
|
abbreviatePath(path5) {
|
|
54231
54438
|
const homeDir = os5.homedir();
|
|
54232
54439
|
const useBackslash = path5.includes("\\") && !path5.includes("/");
|
|
@@ -54279,7 +54486,7 @@ var CurrentWorkingDirEditor = ({ widget, onComplete, onCancel, action }) => {
|
|
|
54279
54486
|
onCancel();
|
|
54280
54487
|
} else if (key.backspace) {
|
|
54281
54488
|
setSegmentsInput(segmentsInput.slice(0, -1));
|
|
54282
|
-
} else if (input && /\d/.test(input)
|
|
54489
|
+
} else if (shouldInsertInput(input, key) && /\d/.test(input)) {
|
|
54283
54490
|
setSegmentsInput(segmentsInput + input);
|
|
54284
54491
|
}
|
|
54285
54492
|
}
|
|
@@ -54325,6 +54532,9 @@ class ClaudeSessionIdWidget {
|
|
|
54325
54532
|
getDisplayName() {
|
|
54326
54533
|
return "Claude Session ID";
|
|
54327
54534
|
}
|
|
54535
|
+
getCategory() {
|
|
54536
|
+
return "Core";
|
|
54537
|
+
}
|
|
54328
54538
|
getEditorDisplay(item) {
|
|
54329
54539
|
return { displayText: this.getDisplayName() };
|
|
54330
54540
|
}
|
|
@@ -54346,12 +54556,65 @@ class ClaudeSessionIdWidget {
|
|
|
54346
54556
|
return true;
|
|
54347
54557
|
}
|
|
54348
54558
|
}
|
|
54559
|
+
// src/widgets/SessionName.ts
|
|
54560
|
+
import * as fs6 from "fs";
|
|
54561
|
+
|
|
54562
|
+
class SessionNameWidget {
|
|
54563
|
+
getDefaultColor() {
|
|
54564
|
+
return "cyan";
|
|
54565
|
+
}
|
|
54566
|
+
getDescription() {
|
|
54567
|
+
return "Shows the session name set via /rename command in Claude Code";
|
|
54568
|
+
}
|
|
54569
|
+
getDisplayName() {
|
|
54570
|
+
return "Session Name";
|
|
54571
|
+
}
|
|
54572
|
+
getCategory() {
|
|
54573
|
+
return "Session";
|
|
54574
|
+
}
|
|
54575
|
+
getEditorDisplay(item) {
|
|
54576
|
+
return { displayText: this.getDisplayName() };
|
|
54577
|
+
}
|
|
54578
|
+
render(item, context, settings) {
|
|
54579
|
+
if (context.isPreview) {
|
|
54580
|
+
return item.rawValue ? "my-session" : "Session: my-session";
|
|
54581
|
+
}
|
|
54582
|
+
const transcriptPath = context.data?.transcript_path;
|
|
54583
|
+
if (!transcriptPath) {
|
|
54584
|
+
return null;
|
|
54585
|
+
}
|
|
54586
|
+
try {
|
|
54587
|
+
const content = fs6.readFileSync(transcriptPath, "utf-8");
|
|
54588
|
+
const lines = content.split(`
|
|
54589
|
+
`);
|
|
54590
|
+
for (let i = lines.length - 1;i >= 0; i--) {
|
|
54591
|
+
const line = lines[i]?.trim();
|
|
54592
|
+
if (!line)
|
|
54593
|
+
continue;
|
|
54594
|
+
try {
|
|
54595
|
+
const entry = JSON.parse(line);
|
|
54596
|
+
if (entry.type === "custom-title" && entry.customTitle) {
|
|
54597
|
+
return item.rawValue ? entry.customTitle : `Session: ${entry.customTitle}`;
|
|
54598
|
+
}
|
|
54599
|
+
} catch {}
|
|
54600
|
+
}
|
|
54601
|
+
} catch {}
|
|
54602
|
+
return null;
|
|
54603
|
+
}
|
|
54604
|
+
supportsRawValue() {
|
|
54605
|
+
return true;
|
|
54606
|
+
}
|
|
54607
|
+
supportsColors(item) {
|
|
54608
|
+
return true;
|
|
54609
|
+
}
|
|
54610
|
+
}
|
|
54349
54611
|
// src/utils/widgets.ts
|
|
54350
54612
|
var widgetRegistry = new Map([
|
|
54351
54613
|
["model", new ModelWidget],
|
|
54352
54614
|
["output-style", new OutputStyleWidget],
|
|
54353
54615
|
["git-branch", new GitBranchWidget],
|
|
54354
54616
|
["git-changes", new GitChangesWidget],
|
|
54617
|
+
["git-root-dir", new GitRootDirWidget],
|
|
54355
54618
|
["git-worktree", new GitWorktreeWidget],
|
|
54356
54619
|
["current-working-dir", new CurrentWorkingDirWidget],
|
|
54357
54620
|
["tokens-input", new TokensInputWidget],
|
|
@@ -54368,7 +54631,8 @@ var widgetRegistry = new Map([
|
|
|
54368
54631
|
["version", new VersionWidget],
|
|
54369
54632
|
["custom-text", new CustomTextWidget],
|
|
54370
54633
|
["custom-command", new CustomCommandWidget],
|
|
54371
|
-
["claude-session-id", new ClaudeSessionIdWidget]
|
|
54634
|
+
["claude-session-id", new ClaudeSessionIdWidget],
|
|
54635
|
+
["session-name", new SessionNameWidget]
|
|
54372
54636
|
]);
|
|
54373
54637
|
function getWidget(type) {
|
|
54374
54638
|
return widgetRegistry.get(type) ?? null;
|
|
@@ -54383,6 +54647,98 @@ function getAllWidgetTypes(settings) {
|
|
|
54383
54647
|
}
|
|
54384
54648
|
return allTypes;
|
|
54385
54649
|
}
|
|
54650
|
+
var LAYOUT_WIDGETS = {
|
|
54651
|
+
separator: {
|
|
54652
|
+
displayName: "Separator",
|
|
54653
|
+
description: "A separator character between status line widgets",
|
|
54654
|
+
category: "Layout"
|
|
54655
|
+
},
|
|
54656
|
+
"flex-separator": {
|
|
54657
|
+
displayName: "Flex Separator",
|
|
54658
|
+
description: "Expands to fill available terminal width",
|
|
54659
|
+
category: "Layout"
|
|
54660
|
+
}
|
|
54661
|
+
};
|
|
54662
|
+
function getLayoutCatalogEntry(type) {
|
|
54663
|
+
const layout = LAYOUT_WIDGETS[type];
|
|
54664
|
+
if (!layout) {
|
|
54665
|
+
return null;
|
|
54666
|
+
}
|
|
54667
|
+
return {
|
|
54668
|
+
type,
|
|
54669
|
+
displayName: layout.displayName,
|
|
54670
|
+
description: layout.description,
|
|
54671
|
+
category: layout.category,
|
|
54672
|
+
searchText: `${layout.displayName} ${layout.description} ${type}`.toLowerCase()
|
|
54673
|
+
};
|
|
54674
|
+
}
|
|
54675
|
+
function getWidgetCatalog(settings) {
|
|
54676
|
+
return getAllWidgetTypes(settings).map((type) => {
|
|
54677
|
+
const layoutEntry = getLayoutCatalogEntry(type);
|
|
54678
|
+
if (layoutEntry) {
|
|
54679
|
+
return layoutEntry;
|
|
54680
|
+
}
|
|
54681
|
+
const widget = getWidget(type);
|
|
54682
|
+
const displayName = widget?.getDisplayName() ?? type;
|
|
54683
|
+
const description = widget?.getDescription() ?? `Unknown widget: ${type}`;
|
|
54684
|
+
const category = widget?.getCategory() ?? "Other";
|
|
54685
|
+
return {
|
|
54686
|
+
type,
|
|
54687
|
+
displayName,
|
|
54688
|
+
description,
|
|
54689
|
+
category,
|
|
54690
|
+
searchText: `${displayName} ${description} ${type}`.toLowerCase()
|
|
54691
|
+
};
|
|
54692
|
+
});
|
|
54693
|
+
}
|
|
54694
|
+
function getWidgetCatalogCategories(catalog) {
|
|
54695
|
+
const categories = new Set;
|
|
54696
|
+
for (const entry of catalog) {
|
|
54697
|
+
categories.add(entry.category);
|
|
54698
|
+
}
|
|
54699
|
+
return Array.from(categories);
|
|
54700
|
+
}
|
|
54701
|
+
function filterWidgetCatalog(catalog, category, query) {
|
|
54702
|
+
const normalizedQuery = query.trim().toLowerCase();
|
|
54703
|
+
const categoryFiltered = category === "All" ? [...catalog] : catalog.filter((entry) => entry.category === category);
|
|
54704
|
+
const withScore = categoryFiltered.map((entry) => {
|
|
54705
|
+
if (!normalizedQuery) {
|
|
54706
|
+
return {
|
|
54707
|
+
entry,
|
|
54708
|
+
score: 99
|
|
54709
|
+
};
|
|
54710
|
+
}
|
|
54711
|
+
const name = entry.displayName.toLowerCase();
|
|
54712
|
+
const description = entry.description.toLowerCase();
|
|
54713
|
+
const type = entry.type.toLowerCase();
|
|
54714
|
+
if (name.startsWith(normalizedQuery)) {
|
|
54715
|
+
return { entry, score: 0 };
|
|
54716
|
+
}
|
|
54717
|
+
if (name.includes(normalizedQuery)) {
|
|
54718
|
+
return { entry, score: 1 };
|
|
54719
|
+
}
|
|
54720
|
+
if (type.includes(normalizedQuery)) {
|
|
54721
|
+
return { entry, score: 2 };
|
|
54722
|
+
}
|
|
54723
|
+
if (description.includes(normalizedQuery)) {
|
|
54724
|
+
return { entry, score: 3 };
|
|
54725
|
+
}
|
|
54726
|
+
if (entry.searchText.includes(normalizedQuery)) {
|
|
54727
|
+
return { entry, score: 4 };
|
|
54728
|
+
}
|
|
54729
|
+
return null;
|
|
54730
|
+
}).filter((item) => item !== null);
|
|
54731
|
+
return withScore.sort((a, b) => {
|
|
54732
|
+
if (a.score !== b.score) {
|
|
54733
|
+
return a.score - b.score;
|
|
54734
|
+
}
|
|
54735
|
+
const byDisplayName = a.entry.displayName.localeCompare(b.entry.displayName);
|
|
54736
|
+
if (byDisplayName !== 0) {
|
|
54737
|
+
return byDisplayName;
|
|
54738
|
+
}
|
|
54739
|
+
return a.entry.type.localeCompare(b.entry.type);
|
|
54740
|
+
}).map((item) => item.entry);
|
|
54741
|
+
}
|
|
54386
54742
|
|
|
54387
54743
|
// src/tui/components/ConfirmDialog.tsx
|
|
54388
54744
|
var import_react32 = __toESM(require_react(), 1);
|
|
@@ -54501,7 +54857,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
54501
54857
|
}
|
|
54502
54858
|
} else if (key.backspace || key.delete) {
|
|
54503
54859
|
setHexInput(hexInput.slice(0, -1));
|
|
54504
|
-
} else if (input && hexInput.length < 6) {
|
|
54860
|
+
} else if (shouldInsertInput(input, key) && hexInput.length < 6) {
|
|
54505
54861
|
const upperInput = input.toUpperCase();
|
|
54506
54862
|
if (/^[0-9A-F]$/.test(upperInput)) {
|
|
54507
54863
|
setHexInput(hexInput + upperInput);
|
|
@@ -54539,7 +54895,7 @@ var ColorMenu = ({ widgets, lineIndex, settings, onUpdate, onBack }) => {
|
|
|
54539
54895
|
}
|
|
54540
54896
|
} else if (key.backspace || key.delete) {
|
|
54541
54897
|
setAnsi256Input(ansi256Input.slice(0, -1));
|
|
54542
|
-
} else if (input && ansi256Input.length < 3) {
|
|
54898
|
+
} else if (shouldInsertInput(input, key) && ansi256Input.length < 3) {
|
|
54543
54899
|
if (/^[0-9]$/.test(input)) {
|
|
54544
54900
|
const newInput = ansi256Input + input;
|
|
54545
54901
|
const code = parseInt(newInput, 10);
|
|
@@ -55013,7 +55369,7 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
55013
55369
|
setEditingPadding(false);
|
|
55014
55370
|
} else if (key.backspace) {
|
|
55015
55371
|
setPaddingInput(paddingInput.slice(0, -1));
|
|
55016
|
-
} else if (key.delete) {} else if (input) {
|
|
55372
|
+
} else if (key.delete) {} else if (shouldInsertInput(input, key)) {
|
|
55017
55373
|
setPaddingInput(paddingInput + input);
|
|
55018
55374
|
}
|
|
55019
55375
|
} else if (editingSeparator) {
|
|
@@ -55035,7 +55391,7 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
55035
55391
|
setEditingSeparator(false);
|
|
55036
55392
|
} else if (key.backspace) {
|
|
55037
55393
|
setSeparatorInput(separatorInput.slice(0, -1));
|
|
55038
|
-
} else if (key.delete) {} else if (input) {
|
|
55394
|
+
} else if (key.delete) {} else if (shouldInsertInput(input, key)) {
|
|
55039
55395
|
setSeparatorInput(separatorInput + input);
|
|
55040
55396
|
}
|
|
55041
55397
|
} else if (confirmingSeparator) {
|
|
@@ -55502,21 +55858,11 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55502
55858
|
const [selectedIndex, setSelectedIndex] = import_react36.useState(0);
|
|
55503
55859
|
const [moveMode, setMoveMode] = import_react36.useState(false);
|
|
55504
55860
|
const [customEditorWidget, setCustomEditorWidget] = import_react36.useState(null);
|
|
55861
|
+
const [widgetPicker, setWidgetPicker] = import_react36.useState(null);
|
|
55862
|
+
const [showClearConfirm, setShowClearConfirm] = import_react36.useState(false);
|
|
55505
55863
|
const separatorChars = ["|", "-", ",", " "];
|
|
55506
|
-
const
|
|
55507
|
-
|
|
55508
|
-
if (settings.defaultSeparator) {
|
|
55509
|
-
allowedTypes = allowedTypes.filter((t) => t !== "separator");
|
|
55510
|
-
}
|
|
55511
|
-
if (settings.powerline.enabled) {
|
|
55512
|
-
allowedTypes = allowedTypes.filter((t) => t !== "separator" && t !== "flex-separator");
|
|
55513
|
-
}
|
|
55514
|
-
return allowedTypes;
|
|
55515
|
-
};
|
|
55516
|
-
const getDefaultItemType = () => {
|
|
55517
|
-
const allowedTypes = getAllowedTypes();
|
|
55518
|
-
return allowedTypes.includes("model") ? "model" : allowedTypes[0] ?? "model";
|
|
55519
|
-
};
|
|
55864
|
+
const widgetCatalog = getWidgetCatalog(settings);
|
|
55865
|
+
const widgetCategories = ["All", ...getWidgetCatalogCategories(widgetCatalog)];
|
|
55520
55866
|
const getUniqueBackgroundColor = (insertIndex) => {
|
|
55521
55867
|
if (!settings.powerline.enabled || settings.powerline.theme === "custom") {
|
|
55522
55868
|
return;
|
|
@@ -55542,10 +55888,187 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55542
55888
|
const handleEditorCancel = () => {
|
|
55543
55889
|
setCustomEditorWidget(null);
|
|
55544
55890
|
};
|
|
55891
|
+
const getFilteredCategories = (query) => {
|
|
55892
|
+
return [...widgetCategories];
|
|
55893
|
+
};
|
|
55894
|
+
const normalizePickerState = (state) => {
|
|
55895
|
+
const filteredCategories = getFilteredCategories(state.categoryQuery);
|
|
55896
|
+
const selectedCategory = state.selectedCategory && filteredCategories.includes(state.selectedCategory) ? state.selectedCategory : filteredCategories[0] ?? null;
|
|
55897
|
+
const hasTopLevelSearch = state.level === "category" && state.categoryQuery.trim().length > 0;
|
|
55898
|
+
const effectiveCategory = hasTopLevelSearch ? "All" : selectedCategory ?? "All";
|
|
55899
|
+
const effectiveQuery = hasTopLevelSearch ? state.categoryQuery : state.widgetQuery;
|
|
55900
|
+
const filteredWidgets = filterWidgetCatalog(widgetCatalog, effectiveCategory, effectiveQuery);
|
|
55901
|
+
const hasSelectedType = state.selectedType ? filteredWidgets.some((entry) => entry.type === state.selectedType) : false;
|
|
55902
|
+
return {
|
|
55903
|
+
...state,
|
|
55904
|
+
selectedCategory,
|
|
55905
|
+
selectedType: hasSelectedType ? state.selectedType : filteredWidgets[0]?.type ?? null
|
|
55906
|
+
};
|
|
55907
|
+
};
|
|
55908
|
+
const openWidgetPicker = (action) => {
|
|
55909
|
+
if (widgetCatalog.length === 0) {
|
|
55910
|
+
return;
|
|
55911
|
+
}
|
|
55912
|
+
const currentType = widgets[selectedIndex]?.type;
|
|
55913
|
+
const selectedType = action === "change" ? currentType ?? null : null;
|
|
55914
|
+
setWidgetPicker(normalizePickerState({
|
|
55915
|
+
action,
|
|
55916
|
+
level: "category",
|
|
55917
|
+
selectedCategory: "All",
|
|
55918
|
+
categoryQuery: "",
|
|
55919
|
+
widgetQuery: "",
|
|
55920
|
+
selectedType
|
|
55921
|
+
}));
|
|
55922
|
+
};
|
|
55923
|
+
const applyWidgetPickerSelection = (selectedType) => {
|
|
55924
|
+
if (!widgetPicker) {
|
|
55925
|
+
return;
|
|
55926
|
+
}
|
|
55927
|
+
if (widgetPicker.action === "change") {
|
|
55928
|
+
const currentWidget2 = widgets[selectedIndex];
|
|
55929
|
+
if (currentWidget2) {
|
|
55930
|
+
const newWidgets = [...widgets];
|
|
55931
|
+
newWidgets[selectedIndex] = { ...currentWidget2, type: selectedType };
|
|
55932
|
+
onUpdate(newWidgets);
|
|
55933
|
+
}
|
|
55934
|
+
} else {
|
|
55935
|
+
const insertIndex = widgetPicker.action === "add" ? widgets.length > 0 ? selectedIndex + 1 : 0 : selectedIndex;
|
|
55936
|
+
const backgroundColor = getUniqueBackgroundColor(insertIndex);
|
|
55937
|
+
const newWidget = {
|
|
55938
|
+
id: generateGuid(),
|
|
55939
|
+
type: selectedType,
|
|
55940
|
+
...backgroundColor && { backgroundColor }
|
|
55941
|
+
};
|
|
55942
|
+
const newWidgets = [...widgets];
|
|
55943
|
+
newWidgets.splice(insertIndex, 0, newWidget);
|
|
55944
|
+
onUpdate(newWidgets);
|
|
55945
|
+
setSelectedIndex(insertIndex);
|
|
55946
|
+
}
|
|
55947
|
+
setWidgetPicker(null);
|
|
55948
|
+
};
|
|
55545
55949
|
use_input_default((input, key) => {
|
|
55546
55950
|
if (customEditorWidget) {
|
|
55547
55951
|
return;
|
|
55548
55952
|
}
|
|
55953
|
+
if (showClearConfirm) {
|
|
55954
|
+
return;
|
|
55955
|
+
}
|
|
55956
|
+
if (widgetPicker) {
|
|
55957
|
+
const filteredCategories = getFilteredCategories(widgetPicker.categoryQuery);
|
|
55958
|
+
const selectedCategory = widgetPicker.selectedCategory && filteredCategories.includes(widgetPicker.selectedCategory) ? widgetPicker.selectedCategory : filteredCategories[0] ?? null;
|
|
55959
|
+
const hasTopLevelSearch = widgetPicker.level === "category" && widgetPicker.categoryQuery.trim().length > 0;
|
|
55960
|
+
const topLevelSearchEntries2 = hasTopLevelSearch ? filterWidgetCatalog(widgetCatalog, "All", widgetPicker.categoryQuery) : [];
|
|
55961
|
+
const topLevelSelectedEntry = topLevelSearchEntries2.find((entry) => entry.type === widgetPicker.selectedType) ?? topLevelSearchEntries2[0];
|
|
55962
|
+
const filteredWidgets = filterWidgetCatalog(widgetCatalog, selectedCategory ?? "All", widgetPicker.widgetQuery);
|
|
55963
|
+
const selectedEntry = filteredWidgets.find((entry) => entry.type === widgetPicker.selectedType) ?? filteredWidgets[0];
|
|
55964
|
+
if (widgetPicker.level === "category") {
|
|
55965
|
+
if (key.escape) {
|
|
55966
|
+
if (widgetPicker.categoryQuery.length > 0) {
|
|
55967
|
+
setWidgetPicker((prev) => prev ? normalizePickerState({
|
|
55968
|
+
...prev,
|
|
55969
|
+
categoryQuery: ""
|
|
55970
|
+
}) : prev);
|
|
55971
|
+
} else {
|
|
55972
|
+
setWidgetPicker(null);
|
|
55973
|
+
}
|
|
55974
|
+
} else if (key.return) {
|
|
55975
|
+
if (hasTopLevelSearch) {
|
|
55976
|
+
if (topLevelSelectedEntry) {
|
|
55977
|
+
applyWidgetPickerSelection(topLevelSelectedEntry.type);
|
|
55978
|
+
}
|
|
55979
|
+
} else if (selectedCategory) {
|
|
55980
|
+
setWidgetPicker((prev) => prev ? normalizePickerState({
|
|
55981
|
+
...prev,
|
|
55982
|
+
level: "widget",
|
|
55983
|
+
selectedCategory
|
|
55984
|
+
}) : prev);
|
|
55985
|
+
}
|
|
55986
|
+
} else if (key.upArrow || key.downArrow) {
|
|
55987
|
+
if (hasTopLevelSearch) {
|
|
55988
|
+
if (topLevelSearchEntries2.length === 0) {
|
|
55989
|
+
return;
|
|
55990
|
+
}
|
|
55991
|
+
let currentIndex = topLevelSearchEntries2.findIndex((entry) => entry.type === widgetPicker.selectedType);
|
|
55992
|
+
if (currentIndex === -1) {
|
|
55993
|
+
currentIndex = 0;
|
|
55994
|
+
}
|
|
55995
|
+
const nextIndex = key.downArrow ? Math.min(topLevelSearchEntries2.length - 1, currentIndex + 1) : Math.max(0, currentIndex - 1);
|
|
55996
|
+
const nextType = topLevelSearchEntries2[nextIndex]?.type ?? null;
|
|
55997
|
+
setWidgetPicker((prev) => prev ? normalizePickerState({
|
|
55998
|
+
...prev,
|
|
55999
|
+
selectedType: nextType
|
|
56000
|
+
}) : prev);
|
|
56001
|
+
} else {
|
|
56002
|
+
if (filteredCategories.length === 0) {
|
|
56003
|
+
return;
|
|
56004
|
+
}
|
|
56005
|
+
let currentIndex = filteredCategories.findIndex((category) => category === selectedCategory);
|
|
56006
|
+
if (currentIndex === -1) {
|
|
56007
|
+
currentIndex = 0;
|
|
56008
|
+
}
|
|
56009
|
+
const nextIndex = key.downArrow ? Math.min(filteredCategories.length - 1, currentIndex + 1) : Math.max(0, currentIndex - 1);
|
|
56010
|
+
const nextCategory = filteredCategories[nextIndex] ?? null;
|
|
56011
|
+
setWidgetPicker((prev) => prev ? normalizePickerState({
|
|
56012
|
+
...prev,
|
|
56013
|
+
selectedCategory: nextCategory
|
|
56014
|
+
}) : prev);
|
|
56015
|
+
}
|
|
56016
|
+
} else if (key.backspace || key.delete) {
|
|
56017
|
+
setWidgetPicker((prev) => prev ? normalizePickerState({
|
|
56018
|
+
...prev,
|
|
56019
|
+
categoryQuery: prev.categoryQuery.slice(0, -1)
|
|
56020
|
+
}) : prev);
|
|
56021
|
+
} else if (input && !key.ctrl && !key.meta && !key.tab) {
|
|
56022
|
+
setWidgetPicker((prev) => prev ? normalizePickerState({
|
|
56023
|
+
...prev,
|
|
56024
|
+
categoryQuery: prev.categoryQuery + input
|
|
56025
|
+
}) : prev);
|
|
56026
|
+
}
|
|
56027
|
+
} else {
|
|
56028
|
+
if (key.escape) {
|
|
56029
|
+
if (widgetPicker.widgetQuery.length > 0) {
|
|
56030
|
+
setWidgetPicker((prev) => prev ? normalizePickerState({
|
|
56031
|
+
...prev,
|
|
56032
|
+
widgetQuery: ""
|
|
56033
|
+
}) : prev);
|
|
56034
|
+
} else {
|
|
56035
|
+
setWidgetPicker((prev) => prev ? normalizePickerState({
|
|
56036
|
+
...prev,
|
|
56037
|
+
level: "category"
|
|
56038
|
+
}) : prev);
|
|
56039
|
+
}
|
|
56040
|
+
} else if (key.return) {
|
|
56041
|
+
if (selectedEntry) {
|
|
56042
|
+
applyWidgetPickerSelection(selectedEntry.type);
|
|
56043
|
+
}
|
|
56044
|
+
} else if (key.upArrow || key.downArrow) {
|
|
56045
|
+
if (filteredWidgets.length === 0) {
|
|
56046
|
+
return;
|
|
56047
|
+
}
|
|
56048
|
+
let currentIndex = filteredWidgets.findIndex((entry) => entry.type === widgetPicker.selectedType);
|
|
56049
|
+
if (currentIndex === -1) {
|
|
56050
|
+
currentIndex = 0;
|
|
56051
|
+
}
|
|
56052
|
+
const nextIndex = key.downArrow ? Math.min(filteredWidgets.length - 1, currentIndex + 1) : Math.max(0, currentIndex - 1);
|
|
56053
|
+
const nextType = filteredWidgets[nextIndex]?.type ?? null;
|
|
56054
|
+
setWidgetPicker((prev) => prev ? normalizePickerState({
|
|
56055
|
+
...prev,
|
|
56056
|
+
selectedType: nextType
|
|
56057
|
+
}) : prev);
|
|
56058
|
+
} else if (key.backspace || key.delete) {
|
|
56059
|
+
setWidgetPicker((prev) => prev ? normalizePickerState({
|
|
56060
|
+
...prev,
|
|
56061
|
+
widgetQuery: prev.widgetQuery.slice(0, -1)
|
|
56062
|
+
}) : prev);
|
|
56063
|
+
} else if (input && !key.ctrl && !key.meta && !key.tab) {
|
|
56064
|
+
setWidgetPicker((prev) => prev ? normalizePickerState({
|
|
56065
|
+
...prev,
|
|
56066
|
+
widgetQuery: prev.widgetQuery + input
|
|
56067
|
+
}) : prev);
|
|
56068
|
+
}
|
|
56069
|
+
}
|
|
56070
|
+
return;
|
|
56071
|
+
}
|
|
55549
56072
|
if (moveMode) {
|
|
55550
56073
|
if (key.upArrow && selectedIndex > 0) {
|
|
55551
56074
|
const newWidgets = [...widgets];
|
|
@@ -55569,69 +56092,20 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55569
56092
|
setMoveMode(false);
|
|
55570
56093
|
}
|
|
55571
56094
|
} else {
|
|
55572
|
-
if (key.upArrow) {
|
|
56095
|
+
if (key.upArrow && widgets.length > 0) {
|
|
55573
56096
|
setSelectedIndex(Math.max(0, selectedIndex - 1));
|
|
55574
|
-
} else if (key.downArrow) {
|
|
56097
|
+
} else if (key.downArrow && widgets.length > 0) {
|
|
55575
56098
|
setSelectedIndex(Math.min(widgets.length - 1, selectedIndex + 1));
|
|
55576
56099
|
} else if (key.leftArrow && widgets.length > 0) {
|
|
55577
|
-
|
|
55578
|
-
const currentWidget2 = widgets[selectedIndex];
|
|
55579
|
-
if (currentWidget2) {
|
|
55580
|
-
const currentType = currentWidget2.type;
|
|
55581
|
-
let currentIndex = types.indexOf(currentType);
|
|
55582
|
-
if (currentIndex === -1) {
|
|
55583
|
-
currentIndex = 0;
|
|
55584
|
-
}
|
|
55585
|
-
const prevIndex = currentIndex === 0 ? types.length - 1 : currentIndex - 1;
|
|
55586
|
-
const newWidgets = [...widgets];
|
|
55587
|
-
const prevType = types[prevIndex];
|
|
55588
|
-
if (prevType) {
|
|
55589
|
-
newWidgets[selectedIndex] = { ...currentWidget2, type: prevType };
|
|
55590
|
-
onUpdate(newWidgets);
|
|
55591
|
-
}
|
|
55592
|
-
}
|
|
56100
|
+
openWidgetPicker("change");
|
|
55593
56101
|
} else if (key.rightArrow && widgets.length > 0) {
|
|
55594
|
-
|
|
55595
|
-
const currentWidget2 = widgets[selectedIndex];
|
|
55596
|
-
if (currentWidget2) {
|
|
55597
|
-
const currentType = currentWidget2.type;
|
|
55598
|
-
let currentIndex = types.indexOf(currentType);
|
|
55599
|
-
if (currentIndex === -1) {
|
|
55600
|
-
currentIndex = 0;
|
|
55601
|
-
}
|
|
55602
|
-
const nextIndex = (currentIndex + 1) % types.length;
|
|
55603
|
-
const newWidgets = [...widgets];
|
|
55604
|
-
const nextType = types[nextIndex];
|
|
55605
|
-
if (nextType) {
|
|
55606
|
-
newWidgets[selectedIndex] = { ...currentWidget2, type: nextType };
|
|
55607
|
-
onUpdate(newWidgets);
|
|
55608
|
-
}
|
|
55609
|
-
}
|
|
56102
|
+
openWidgetPicker("change");
|
|
55610
56103
|
} else if (key.return && widgets.length > 0) {
|
|
55611
56104
|
setMoveMode(true);
|
|
55612
56105
|
} else if (input === "a") {
|
|
55613
|
-
|
|
55614
|
-
const backgroundColor = getUniqueBackgroundColor(insertIndex);
|
|
55615
|
-
const newWidget = {
|
|
55616
|
-
id: generateGuid(),
|
|
55617
|
-
type: getDefaultItemType(),
|
|
55618
|
-
...backgroundColor && { backgroundColor }
|
|
55619
|
-
};
|
|
55620
|
-
const newWidgets = [...widgets];
|
|
55621
|
-
newWidgets.splice(insertIndex, 0, newWidget);
|
|
55622
|
-
onUpdate(newWidgets);
|
|
55623
|
-
setSelectedIndex(insertIndex);
|
|
56106
|
+
openWidgetPicker("add");
|
|
55624
56107
|
} else if (input === "i") {
|
|
55625
|
-
|
|
55626
|
-
const backgroundColor = getUniqueBackgroundColor(insertIndex);
|
|
55627
|
-
const newWidget = {
|
|
55628
|
-
id: generateGuid(),
|
|
55629
|
-
type: getDefaultItemType(),
|
|
55630
|
-
...backgroundColor && { backgroundColor }
|
|
55631
|
-
};
|
|
55632
|
-
const newWidgets = [...widgets];
|
|
55633
|
-
newWidgets.splice(insertIndex, 0, newWidget);
|
|
55634
|
-
onUpdate(newWidgets);
|
|
56108
|
+
openWidgetPicker("insert");
|
|
55635
56109
|
} else if (input === "d" && widgets.length > 0) {
|
|
55636
56110
|
const newWidgets = widgets.filter((_, i) => i !== selectedIndex);
|
|
55637
56111
|
onUpdate(newWidgets);
|
|
@@ -55639,8 +56113,9 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55639
56113
|
setSelectedIndex(selectedIndex - 1);
|
|
55640
56114
|
}
|
|
55641
56115
|
} else if (input === "c") {
|
|
55642
|
-
|
|
55643
|
-
|
|
56116
|
+
if (widgets.length > 0) {
|
|
56117
|
+
setShowClearConfirm(true);
|
|
56118
|
+
}
|
|
55644
56119
|
} else if (input === " " && widgets.length > 0) {
|
|
55645
56120
|
const currentWidget2 = widgets[selectedIndex];
|
|
55646
56121
|
if (currentWidget2 && currentWidget2.type === "separator") {
|
|
@@ -55653,7 +56128,11 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55653
56128
|
}
|
|
55654
56129
|
} else if (input === "r" && widgets.length > 0) {
|
|
55655
56130
|
const currentWidget2 = widgets[selectedIndex];
|
|
55656
|
-
if (currentWidget2 && currentWidget2.type !== "separator" && currentWidget2.type !== "flex-separator"
|
|
56131
|
+
if (currentWidget2 && currentWidget2.type !== "separator" && currentWidget2.type !== "flex-separator") {
|
|
56132
|
+
const widgetImpl = getWidget(currentWidget2.type);
|
|
56133
|
+
if (!widgetImpl?.supportsRawValue()) {
|
|
56134
|
+
return;
|
|
56135
|
+
}
|
|
55657
56136
|
const newWidgets = [...widgets];
|
|
55658
56137
|
newWidgets[selectedIndex] = { ...currentWidget2, rawValue: !currentWidget2.rawValue };
|
|
55659
56138
|
onUpdate(newWidgets);
|
|
@@ -55726,6 +56205,12 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55726
56205
|
};
|
|
55727
56206
|
const hasFlexSeparator = widgets.some((widget) => widget.type === "flex-separator");
|
|
55728
56207
|
const widthDetectionAvailable = canDetectTerminalWidth();
|
|
56208
|
+
const pickerCategories = widgetPicker ? getFilteredCategories(widgetPicker.categoryQuery) : [];
|
|
56209
|
+
const selectedPickerCategory = widgetPicker ? widgetPicker.selectedCategory && pickerCategories.includes(widgetPicker.selectedCategory) ? widgetPicker.selectedCategory : pickerCategories[0] ?? null : null;
|
|
56210
|
+
const topLevelSearchEntries = widgetPicker && widgetPicker.level === "category" && widgetPicker.categoryQuery.trim().length > 0 ? filterWidgetCatalog(widgetCatalog, "All", widgetPicker.categoryQuery) : [];
|
|
56211
|
+
const selectedTopLevelSearchEntry = widgetPicker ? topLevelSearchEntries.find((entry) => entry.type === widgetPicker.selectedType) ?? topLevelSearchEntries[0] : null;
|
|
56212
|
+
const pickerEntries = widgetPicker ? filterWidgetCatalog(widgetCatalog, selectedPickerCategory ?? "All", widgetPicker.widgetQuery) : [];
|
|
56213
|
+
const selectedPickerEntry = widgetPicker ? pickerEntries.find((entry) => entry.type === widgetPicker.selectedType) ?? pickerEntries[0] : null;
|
|
55729
56214
|
const currentWidget = widgets[selectedIndex];
|
|
55730
56215
|
const isSeparator = currentWidget?.type === "separator";
|
|
55731
56216
|
const isFlexSeparator = currentWidget?.type === "flex-separator";
|
|
@@ -55743,11 +56228,14 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55743
56228
|
}
|
|
55744
56229
|
}
|
|
55745
56230
|
const canMerge = currentWidget && selectedIndex < widgets.length - 1 && !isSeparator && !isFlexSeparator;
|
|
55746
|
-
|
|
56231
|
+
const hasWidgets = widgets.length > 0;
|
|
56232
|
+
let helpText = hasWidgets ? "↑↓ select, ←→ open type picker" : "(a)dd via picker, (i)nsert via picker";
|
|
55747
56233
|
if (isSeparator) {
|
|
55748
56234
|
helpText += ", Space edit separator";
|
|
55749
56235
|
}
|
|
55750
|
-
|
|
56236
|
+
if (hasWidgets) {
|
|
56237
|
+
helpText += ", Enter to move, (a)dd via picker, (i)nsert via picker, (d)elete, (c)lear line";
|
|
56238
|
+
}
|
|
55751
56239
|
if (canToggleRaw) {
|
|
55752
56240
|
helpText += ", (r)aw value";
|
|
55753
56241
|
}
|
|
@@ -55756,6 +56244,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55756
56244
|
}
|
|
55757
56245
|
helpText += ", ESC back";
|
|
55758
56246
|
const customKeybindsText = customKeybinds.map((kb) => kb.label).join(", ");
|
|
56247
|
+
const pickerActionLabel = widgetPicker?.action === "add" ? "Add Widget" : widgetPicker?.action === "insert" ? "Insert Widget" : "Change Widget Type";
|
|
55759
56248
|
if (customEditorWidget?.impl.renderEditor) {
|
|
55760
56249
|
return customEditorWidget.impl.renderEditor({
|
|
55761
56250
|
widget: customEditorWidget.widget,
|
|
@@ -55764,6 +56253,56 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55764
56253
|
action: customEditorWidget.action
|
|
55765
56254
|
});
|
|
55766
56255
|
}
|
|
56256
|
+
if (showClearConfirm) {
|
|
56257
|
+
return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56258
|
+
flexDirection: "column",
|
|
56259
|
+
children: [
|
|
56260
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56261
|
+
bold: true,
|
|
56262
|
+
color: "yellow",
|
|
56263
|
+
children: "⚠ Confirm Clear Line"
|
|
56264
|
+
}, undefined, false, undefined, this),
|
|
56265
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56266
|
+
marginTop: 1,
|
|
56267
|
+
flexDirection: "column",
|
|
56268
|
+
children: [
|
|
56269
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56270
|
+
children: [
|
|
56271
|
+
"This will remove all widgets from Line",
|
|
56272
|
+
" ",
|
|
56273
|
+
lineNumber,
|
|
56274
|
+
"."
|
|
56275
|
+
]
|
|
56276
|
+
}, undefined, true, undefined, this),
|
|
56277
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56278
|
+
color: "red",
|
|
56279
|
+
children: "This action cannot be undone!"
|
|
56280
|
+
}, undefined, false, undefined, this)
|
|
56281
|
+
]
|
|
56282
|
+
}, undefined, true, undefined, this),
|
|
56283
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56284
|
+
marginTop: 2,
|
|
56285
|
+
children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56286
|
+
children: "Continue?"
|
|
56287
|
+
}, undefined, false, undefined, this)
|
|
56288
|
+
}, undefined, false, undefined, this),
|
|
56289
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56290
|
+
marginTop: 1,
|
|
56291
|
+
children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ConfirmDialog, {
|
|
56292
|
+
inline: true,
|
|
56293
|
+
onConfirm: () => {
|
|
56294
|
+
onUpdate([]);
|
|
56295
|
+
setSelectedIndex(0);
|
|
56296
|
+
setShowClearConfirm(false);
|
|
56297
|
+
},
|
|
56298
|
+
onCancel: () => {
|
|
56299
|
+
setShowClearConfirm(false);
|
|
56300
|
+
}
|
|
56301
|
+
}, undefined, false, undefined, this)
|
|
56302
|
+
}, undefined, false, undefined, this)
|
|
56303
|
+
]
|
|
56304
|
+
}, undefined, true, undefined, this);
|
|
56305
|
+
}
|
|
55767
56306
|
return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
55768
56307
|
flexDirection: "column",
|
|
55769
56308
|
children: [
|
|
@@ -55782,6 +56321,10 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55782
56321
|
color: "blue",
|
|
55783
56322
|
children: "[MOVE MODE]"
|
|
55784
56323
|
}, undefined, false, undefined, this),
|
|
56324
|
+
widgetPicker && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56325
|
+
color: "cyan",
|
|
56326
|
+
children: `[${pickerActionLabel.toUpperCase()}]`
|
|
56327
|
+
}, undefined, false, undefined, this),
|
|
55785
56328
|
(settings.powerline.enabled || Boolean(settings.defaultSeparator)) && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
55786
56329
|
marginLeft: 2,
|
|
55787
56330
|
children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
@@ -55802,6 +56345,57 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55802
56345
|
dimColor: true,
|
|
55803
56346
|
children: "↑↓ to move widget, ESC or Enter to exit move mode"
|
|
55804
56347
|
}, undefined, false, undefined, this)
|
|
56348
|
+
}, undefined, false, undefined, this) : widgetPicker ? /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56349
|
+
flexDirection: "column",
|
|
56350
|
+
children: widgetPicker.level === "category" ? /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(jsx_dev_runtime8.Fragment, {
|
|
56351
|
+
children: [
|
|
56352
|
+
widgetPicker.categoryQuery.trim().length > 0 ? /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56353
|
+
dimColor: true,
|
|
56354
|
+
children: "↑↓ select widget match, Enter apply, ESC clear/cancel"
|
|
56355
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56356
|
+
dimColor: true,
|
|
56357
|
+
children: "↑↓ select category, type to search all widgets, Enter continue, ESC cancel"
|
|
56358
|
+
}, undefined, false, undefined, this),
|
|
56359
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56360
|
+
children: [
|
|
56361
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56362
|
+
dimColor: true,
|
|
56363
|
+
children: "Search: "
|
|
56364
|
+
}, undefined, false, undefined, this),
|
|
56365
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56366
|
+
color: "cyan",
|
|
56367
|
+
children: widgetPicker.categoryQuery || "(none)"
|
|
56368
|
+
}, undefined, false, undefined, this)
|
|
56369
|
+
]
|
|
56370
|
+
}, undefined, true, undefined, this)
|
|
56371
|
+
]
|
|
56372
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(jsx_dev_runtime8.Fragment, {
|
|
56373
|
+
children: [
|
|
56374
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56375
|
+
dimColor: true,
|
|
56376
|
+
children: "↑↓ select widget, type to search widgets, Enter apply, ESC back"
|
|
56377
|
+
}, undefined, false, undefined, this),
|
|
56378
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56379
|
+
children: [
|
|
56380
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56381
|
+
dimColor: true,
|
|
56382
|
+
children: [
|
|
56383
|
+
"Category:",
|
|
56384
|
+
" ",
|
|
56385
|
+
selectedPickerCategory ?? "(none)",
|
|
56386
|
+
" ",
|
|
56387
|
+
"| Search:",
|
|
56388
|
+
" "
|
|
56389
|
+
]
|
|
56390
|
+
}, undefined, true, undefined, this),
|
|
56391
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56392
|
+
color: "cyan",
|
|
56393
|
+
children: widgetPicker.widgetQuery || "(none)"
|
|
56394
|
+
}, undefined, false, undefined, this)
|
|
56395
|
+
]
|
|
56396
|
+
}, undefined, true, undefined, this)
|
|
56397
|
+
]
|
|
56398
|
+
}, undefined, true, undefined, this)
|
|
55805
56399
|
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
55806
56400
|
flexDirection: "column",
|
|
55807
56401
|
children: [
|
|
@@ -55828,7 +56422,114 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55828
56422
|
}, undefined, false, undefined, this)
|
|
55829
56423
|
]
|
|
55830
56424
|
}, undefined, true, undefined, this),
|
|
55831
|
-
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56425
|
+
widgetPicker && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56426
|
+
marginTop: 1,
|
|
56427
|
+
flexDirection: "column",
|
|
56428
|
+
children: widgetPicker.level === "category" ? widgetPicker.categoryQuery.trim().length > 0 ? topLevelSearchEntries.length === 0 ? /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56429
|
+
dimColor: true,
|
|
56430
|
+
children: "No widgets match the search."
|
|
56431
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(jsx_dev_runtime8.Fragment, {
|
|
56432
|
+
children: [
|
|
56433
|
+
topLevelSearchEntries.map((entry, index) => {
|
|
56434
|
+
const isSelected = entry.type === selectedTopLevelSearchEntry?.type;
|
|
56435
|
+
return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56436
|
+
flexDirection: "row",
|
|
56437
|
+
flexWrap: "nowrap",
|
|
56438
|
+
children: [
|
|
56439
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56440
|
+
width: 3,
|
|
56441
|
+
children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56442
|
+
color: isSelected ? "green" : undefined,
|
|
56443
|
+
children: isSelected ? "▶ " : " "
|
|
56444
|
+
}, undefined, false, undefined, this)
|
|
56445
|
+
}, undefined, false, undefined, this),
|
|
56446
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56447
|
+
color: isSelected ? "green" : undefined,
|
|
56448
|
+
children: `${index + 1}. ${entry.displayName}`
|
|
56449
|
+
}, undefined, false, undefined, this)
|
|
56450
|
+
]
|
|
56451
|
+
}, entry.type, true, undefined, this);
|
|
56452
|
+
}),
|
|
56453
|
+
selectedTopLevelSearchEntry && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56454
|
+
marginTop: 1,
|
|
56455
|
+
paddingLeft: 2,
|
|
56456
|
+
children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56457
|
+
dimColor: true,
|
|
56458
|
+
children: selectedTopLevelSearchEntry.description
|
|
56459
|
+
}, undefined, false, undefined, this)
|
|
56460
|
+
}, undefined, false, undefined, this)
|
|
56461
|
+
]
|
|
56462
|
+
}, undefined, true, undefined, this) : pickerCategories.length === 0 ? /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56463
|
+
dimColor: true,
|
|
56464
|
+
children: "No categories available."
|
|
56465
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(jsx_dev_runtime8.Fragment, {
|
|
56466
|
+
children: [
|
|
56467
|
+
pickerCategories.map((category, index) => {
|
|
56468
|
+
const isSelected = category === selectedPickerCategory;
|
|
56469
|
+
return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56470
|
+
flexDirection: "row",
|
|
56471
|
+
flexWrap: "nowrap",
|
|
56472
|
+
children: [
|
|
56473
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56474
|
+
width: 3,
|
|
56475
|
+
children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56476
|
+
color: isSelected ? "green" : undefined,
|
|
56477
|
+
children: isSelected ? "▶ " : " "
|
|
56478
|
+
}, undefined, false, undefined, this)
|
|
56479
|
+
}, undefined, false, undefined, this),
|
|
56480
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56481
|
+
color: isSelected ? "green" : undefined,
|
|
56482
|
+
children: `${index + 1}. ${category}`
|
|
56483
|
+
}, undefined, false, undefined, this)
|
|
56484
|
+
]
|
|
56485
|
+
}, category, true, undefined, this);
|
|
56486
|
+
}),
|
|
56487
|
+
selectedPickerCategory === "All" && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56488
|
+
marginTop: 1,
|
|
56489
|
+
paddingLeft: 2,
|
|
56490
|
+
children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56491
|
+
dimColor: true,
|
|
56492
|
+
children: "Search across all widget categories."
|
|
56493
|
+
}, undefined, false, undefined, this)
|
|
56494
|
+
}, undefined, false, undefined, this)
|
|
56495
|
+
]
|
|
56496
|
+
}, undefined, true, undefined, this) : pickerEntries.length === 0 ? /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56497
|
+
dimColor: true,
|
|
56498
|
+
children: "No widgets match the current category/search."
|
|
56499
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(jsx_dev_runtime8.Fragment, {
|
|
56500
|
+
children: [
|
|
56501
|
+
pickerEntries.map((entry, index) => {
|
|
56502
|
+
const isSelected = entry.type === selectedPickerEntry?.type;
|
|
56503
|
+
return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56504
|
+
flexDirection: "row",
|
|
56505
|
+
flexWrap: "nowrap",
|
|
56506
|
+
children: [
|
|
56507
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56508
|
+
width: 3,
|
|
56509
|
+
children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56510
|
+
color: isSelected ? "green" : undefined,
|
|
56511
|
+
children: isSelected ? "▶ " : " "
|
|
56512
|
+
}, undefined, false, undefined, this)
|
|
56513
|
+
}, undefined, false, undefined, this),
|
|
56514
|
+
/* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56515
|
+
color: isSelected ? "green" : undefined,
|
|
56516
|
+
children: `${index + 1}. ${entry.displayName}`
|
|
56517
|
+
}, undefined, false, undefined, this)
|
|
56518
|
+
]
|
|
56519
|
+
}, entry.type, true, undefined, this);
|
|
56520
|
+
}),
|
|
56521
|
+
selectedPickerEntry && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
56522
|
+
marginTop: 1,
|
|
56523
|
+
paddingLeft: 2,
|
|
56524
|
+
children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56525
|
+
dimColor: true,
|
|
56526
|
+
children: selectedPickerEntry.description
|
|
56527
|
+
}, undefined, false, undefined, this)
|
|
56528
|
+
}, undefined, false, undefined, this)
|
|
56529
|
+
]
|
|
56530
|
+
}, undefined, true, undefined, this)
|
|
56531
|
+
}, undefined, false, undefined, this),
|
|
56532
|
+
!widgetPicker && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
55832
56533
|
marginTop: 1,
|
|
55833
56534
|
flexDirection: "column",
|
|
55834
56535
|
children: widgets.length === 0 ? /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
@@ -55840,6 +56541,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55840
56541
|
const isSelected = index === selectedIndex;
|
|
55841
56542
|
const widgetImpl = widget.type !== "separator" && widget.type !== "flex-separator" ? getWidget(widget.type) : null;
|
|
55842
56543
|
const { displayText, modifierText } = widgetImpl?.getEditorDisplay(widget) ?? { displayText: getWidgetDisplay(widget) };
|
|
56544
|
+
const supportsRawValue = widgetImpl?.supportsRawValue() ?? false;
|
|
55843
56545
|
return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
55844
56546
|
flexDirection: "row",
|
|
55845
56547
|
flexWrap: "nowrap",
|
|
@@ -55862,7 +56564,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
|
|
|
55862
56564
|
modifierText
|
|
55863
56565
|
]
|
|
55864
56566
|
}, undefined, true, undefined, this),
|
|
55865
|
-
widget.rawValue && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
56567
|
+
supportsRawValue && widget.rawValue && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Text, {
|
|
55866
56568
|
dimColor: true,
|
|
55867
56569
|
children: " (raw value)"
|
|
55868
56570
|
}, undefined, false, undefined, this),
|
|
@@ -56395,7 +57097,7 @@ var PowerlineSeparatorEditor = ({
|
|
|
56395
57097
|
} else if (key.backspace && cursorPos > 0) {
|
|
56396
57098
|
setHexInput(hexInput.slice(0, cursorPos - 1) + hexInput.slice(cursorPos));
|
|
56397
57099
|
setCursorPos(cursorPos - 1);
|
|
56398
|
-
} else if (input && /[0-9a-fA-F]/.test(input) && hexInput.length < 4) {
|
|
57100
|
+
} else if (shouldInsertInput(input, key) && /[0-9a-fA-F]/.test(input) && hexInput.length < 4) {
|
|
56399
57101
|
setHexInput(hexInput.slice(0, cursorPos) + input.toUpperCase() + hexInput.slice(cursorPos));
|
|
56400
57102
|
setCursorPos(cursorPos + 1);
|
|
56401
57103
|
}
|
|
@@ -57671,7 +58373,7 @@ var TerminalWidthMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
57671
58373
|
} else if (key.backspace) {
|
|
57672
58374
|
setThresholdInput(thresholdInput.slice(0, -1));
|
|
57673
58375
|
setValidationError(null);
|
|
57674
|
-
} else if (key.delete) {} else if (input && /\d/.test(input)) {
|
|
58376
|
+
} else if (key.delete) {} else if (shouldInsertInput(input, key) && /\d/.test(input)) {
|
|
57675
58377
|
const newValue = thresholdInput + input;
|
|
57676
58378
|
if (newValue.length <= 2) {
|
|
57677
58379
|
setThresholdInput(newValue);
|
|
@@ -58220,7 +58922,7 @@ var StatusJSONSchema = exports_external.looseObject({
|
|
|
58220
58922
|
});
|
|
58221
58923
|
|
|
58222
58924
|
// src/utils/jsonl.ts
|
|
58223
|
-
import * as
|
|
58925
|
+
import * as fs7 from "fs";
|
|
58224
58926
|
import path6 from "node:path";
|
|
58225
58927
|
|
|
58226
58928
|
// node_modules/tinyglobby/dist/index.mjs
|
|
@@ -58355,12 +59057,12 @@ function build$3(options) {
|
|
|
58355
59057
|
return options.group ? groupFiles : empty;
|
|
58356
59058
|
}
|
|
58357
59059
|
var resolveSymlinksAsync = function(path5, state, callback$1) {
|
|
58358
|
-
const { queue, fs:
|
|
59060
|
+
const { queue, fs: fs7, options: { suppressErrors } } = state;
|
|
58359
59061
|
queue.enqueue();
|
|
58360
|
-
|
|
59062
|
+
fs7.realpath(path5, (error43, resolvedPath) => {
|
|
58361
59063
|
if (error43)
|
|
58362
59064
|
return queue.dequeue(suppressErrors ? null : error43, state);
|
|
58363
|
-
|
|
59065
|
+
fs7.stat(resolvedPath, (error$1, stat) => {
|
|
58364
59066
|
if (error$1)
|
|
58365
59067
|
return queue.dequeue(suppressErrors ? null : error$1, state);
|
|
58366
59068
|
if (stat.isDirectory() && isRecursive(path5, resolvedPath, state))
|
|
@@ -58371,11 +59073,11 @@ var resolveSymlinksAsync = function(path5, state, callback$1) {
|
|
|
58371
59073
|
});
|
|
58372
59074
|
};
|
|
58373
59075
|
var resolveSymlinks = function(path5, state, callback$1) {
|
|
58374
|
-
const { queue, fs:
|
|
59076
|
+
const { queue, fs: fs7, options: { suppressErrors } } = state;
|
|
58375
59077
|
queue.enqueue();
|
|
58376
59078
|
try {
|
|
58377
|
-
const resolvedPath =
|
|
58378
|
-
const stat =
|
|
59079
|
+
const resolvedPath = fs7.realpathSync(path5);
|
|
59080
|
+
const stat = fs7.statSync(resolvedPath);
|
|
58379
59081
|
if (stat.isDirectory() && isRecursive(path5, resolvedPath, state))
|
|
58380
59082
|
return;
|
|
58381
59083
|
callback$1(stat, resolvedPath);
|
|
@@ -58458,23 +59160,23 @@ var walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
|
|
|
58458
59160
|
state.queue.enqueue();
|
|
58459
59161
|
if (currentDepth < 0)
|
|
58460
59162
|
return state.queue.dequeue(null, state);
|
|
58461
|
-
const { fs:
|
|
59163
|
+
const { fs: fs7 } = state;
|
|
58462
59164
|
state.visited.push(crawlPath);
|
|
58463
59165
|
state.counts.directories++;
|
|
58464
|
-
|
|
59166
|
+
fs7.readdir(crawlPath || ".", readdirOpts, (error43, entries = []) => {
|
|
58465
59167
|
callback$1(entries, directoryPath, currentDepth);
|
|
58466
59168
|
state.queue.dequeue(state.options.suppressErrors ? null : error43, state);
|
|
58467
59169
|
});
|
|
58468
59170
|
};
|
|
58469
59171
|
var walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
|
|
58470
|
-
const { fs:
|
|
59172
|
+
const { fs: fs7 } = state;
|
|
58471
59173
|
if (currentDepth < 0)
|
|
58472
59174
|
return;
|
|
58473
59175
|
state.visited.push(crawlPath);
|
|
58474
59176
|
state.counts.directories++;
|
|
58475
59177
|
let entries = [];
|
|
58476
59178
|
try {
|
|
58477
|
-
entries =
|
|
59179
|
+
entries = fs7.readdirSync(crawlPath || ".", readdirOpts);
|
|
58478
59180
|
} catch (e) {
|
|
58479
59181
|
if (!state.options.suppressErrors)
|
|
58480
59182
|
throw e;
|
|
@@ -59009,12 +59711,12 @@ function globSync(patternsOrOptions, options) {
|
|
|
59009
59711
|
|
|
59010
59712
|
// src/utils/jsonl.ts
|
|
59011
59713
|
import { promisify } from "util";
|
|
59012
|
-
var readFile4 = promisify(
|
|
59013
|
-
var
|
|
59014
|
-
var statSync4 =
|
|
59714
|
+
var readFile4 = promisify(fs7.readFile);
|
|
59715
|
+
var readFileSync5 = fs7.readFileSync;
|
|
59716
|
+
var statSync4 = fs7.statSync;
|
|
59015
59717
|
async function getSessionDuration(transcriptPath) {
|
|
59016
59718
|
try {
|
|
59017
|
-
if (!
|
|
59719
|
+
if (!fs7.existsSync(transcriptPath)) {
|
|
59018
59720
|
return null;
|
|
59019
59721
|
}
|
|
59020
59722
|
const content = await readFile4(transcriptPath, "utf-8");
|
|
@@ -59066,7 +59768,7 @@ async function getSessionDuration(transcriptPath) {
|
|
|
59066
59768
|
}
|
|
59067
59769
|
async function getTokenMetrics(transcriptPath) {
|
|
59068
59770
|
try {
|
|
59069
|
-
if (!
|
|
59771
|
+
if (!fs7.existsSync(transcriptPath)) {
|
|
59070
59772
|
return { inputTokens: 0, outputTokens: 0, cachedTokens: 0, totalTokens: 0, contextLength: 0 };
|
|
59071
59773
|
}
|
|
59072
59774
|
const content = await readFile4(transcriptPath, "utf-8");
|
|
@@ -59213,7 +59915,7 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
|
|
|
59213
59915
|
function getAllTimestampsFromFile(filePath) {
|
|
59214
59916
|
const timestamps = [];
|
|
59215
59917
|
try {
|
|
59216
|
-
const content =
|
|
59918
|
+
const content = readFileSync5(filePath, "utf-8");
|
|
59217
59919
|
const lines = content.trim().split(`
|
|
59218
59920
|
`).filter((line) => line.length > 0);
|
|
59219
59921
|
for (const line of lines) {
|