@kianax/wt 0.1.3 → 0.1.5
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/dist/cli.js +82 -70
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -14851,7 +14851,7 @@ var package_default;
|
|
|
14851
14851
|
var init_package = __esm(() => {
|
|
14852
14852
|
package_default = {
|
|
14853
14853
|
name: "@kianax/wt",
|
|
14854
|
-
version: "0.1.
|
|
14854
|
+
version: "0.1.5",
|
|
14855
14855
|
description: "Git worktree manager - make worktrees as effortless as branches",
|
|
14856
14856
|
type: "module",
|
|
14857
14857
|
main: "dist/cli.js",
|
|
@@ -53452,6 +53452,45 @@ var init_version = __esm(() => {
|
|
|
53452
53452
|
VERSION2 = package_default.version;
|
|
53453
53453
|
});
|
|
53454
53454
|
|
|
53455
|
+
// src/tui/components/columns.ts
|
|
53456
|
+
function formatRow(parts) {
|
|
53457
|
+
const { cursor, icon, name, path, age, status, suffix = "" } = parts;
|
|
53458
|
+
const gap = " ".repeat(GAP);
|
|
53459
|
+
return [
|
|
53460
|
+
cursor.padEnd(COLUMNS.cursor),
|
|
53461
|
+
icon.padEnd(COLUMNS.icon),
|
|
53462
|
+
name.padEnd(COLUMNS.name),
|
|
53463
|
+
gap,
|
|
53464
|
+
path.padEnd(COLUMNS.path),
|
|
53465
|
+
gap,
|
|
53466
|
+
age.padEnd(COLUMNS.age),
|
|
53467
|
+
gap,
|
|
53468
|
+
status.padEnd(COLUMNS.status),
|
|
53469
|
+
suffix
|
|
53470
|
+
].join("");
|
|
53471
|
+
}
|
|
53472
|
+
function formatHeader() {
|
|
53473
|
+
return formatRow({
|
|
53474
|
+
cursor: "",
|
|
53475
|
+
icon: "",
|
|
53476
|
+
name: "name",
|
|
53477
|
+
path: "path",
|
|
53478
|
+
age: "age",
|
|
53479
|
+
status: "status"
|
|
53480
|
+
});
|
|
53481
|
+
}
|
|
53482
|
+
var COLUMNS, GAP = 2;
|
|
53483
|
+
var init_columns = __esm(() => {
|
|
53484
|
+
COLUMNS = {
|
|
53485
|
+
cursor: 2,
|
|
53486
|
+
icon: 2,
|
|
53487
|
+
name: 20,
|
|
53488
|
+
path: 32,
|
|
53489
|
+
age: 4,
|
|
53490
|
+
status: 8
|
|
53491
|
+
};
|
|
53492
|
+
});
|
|
53493
|
+
|
|
53455
53494
|
// src/tui/components/WorktreeItem.tsx
|
|
53456
53495
|
function WorktreeItem({
|
|
53457
53496
|
worktree,
|
|
@@ -53466,8 +53505,6 @@ function WorktreeItem({
|
|
|
53466
53505
|
}
|
|
53467
53506
|
}).catch(() => {});
|
|
53468
53507
|
}, [worktree.path]);
|
|
53469
|
-
const cursor = isSelected ? ">" : " ";
|
|
53470
|
-
const icon = isCurrent ? "●" : "○";
|
|
53471
53508
|
const path = contractHome(worktree.path);
|
|
53472
53509
|
let statusBadge = "";
|
|
53473
53510
|
let statusColor;
|
|
@@ -53493,79 +53530,61 @@ function WorktreeItem({
|
|
|
53493
53530
|
statusBadge = "synced";
|
|
53494
53531
|
statusColor = theme.status.synced;
|
|
53495
53532
|
}
|
|
53496
|
-
const
|
|
53497
|
-
const displayPath = path.length > maxPathLen ? `...${path.slice(-(maxPathLen - 3))}` : path;
|
|
53498
|
-
const { ahead, behind } = worktree;
|
|
53499
|
-
const nameWidth = 20;
|
|
53533
|
+
const displayPath = path.length > COLUMNS.path ? `...${path.slice(-(COLUMNS.path - 3))}` : path;
|
|
53500
53534
|
const primarySuffix = worktree.isPrimary ? " *" : "";
|
|
53501
|
-
const maxNameLen =
|
|
53502
|
-
const
|
|
53503
|
-
const
|
|
53504
|
-
|
|
53505
|
-
|
|
53506
|
-
|
|
53535
|
+
const maxNameLen = COLUMNS.name - primarySuffix.length;
|
|
53536
|
+
const displayName = worktree.name.slice(0, maxNameLen) + primarySuffix;
|
|
53537
|
+
const { ahead, behind } = worktree;
|
|
53538
|
+
let syncSuffix = "";
|
|
53539
|
+
if (ahead !== undefined && ahead > 0)
|
|
53540
|
+
syncSuffix += `+${ahead}`;
|
|
53541
|
+
if (behind !== undefined && behind > 0)
|
|
53542
|
+
syncSuffix += `-${behind}`;
|
|
53543
|
+
const rowText = formatRow({
|
|
53544
|
+
cursor: isSelected ? ">" : "",
|
|
53545
|
+
icon: isCurrent ? "●" : "○",
|
|
53546
|
+
name: displayName,
|
|
53547
|
+
path: displayPath,
|
|
53548
|
+
age: age || "",
|
|
53549
|
+
status: statusBadge,
|
|
53550
|
+
suffix: syncSuffix
|
|
53551
|
+
});
|
|
53552
|
+
const cursorEnd = COLUMNS.cursor;
|
|
53553
|
+
const iconEnd = cursorEnd + COLUMNS.icon;
|
|
53554
|
+
const nameEnd = iconEnd + COLUMNS.name;
|
|
53555
|
+
const pathEnd = nameEnd + GAP + COLUMNS.path;
|
|
53556
|
+
const ageEnd = pathEnd + GAP + COLUMNS.age;
|
|
53557
|
+
const statusEnd = ageEnd + GAP + COLUMNS.status;
|
|
53507
53558
|
return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
|
|
53508
53559
|
children: [
|
|
53509
53560
|
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
53510
53561
|
color: isSelected ? theme.accent : undefined,
|
|
53511
|
-
children:
|
|
53512
|
-
|
|
53513
|
-
" "
|
|
53514
|
-
]
|
|
53515
|
-
}, undefined, true, undefined, this),
|
|
53562
|
+
children: rowText.slice(0, cursorEnd)
|
|
53563
|
+
}, undefined, false, undefined, this),
|
|
53516
53564
|
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
53517
53565
|
color: isCurrent ? theme.accent : "dim",
|
|
53518
|
-
children:
|
|
53566
|
+
children: rowText.slice(cursorEnd, iconEnd)
|
|
53519
53567
|
}, undefined, false, undefined, this),
|
|
53520
53568
|
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
53521
53569
|
color: isSelected ? theme.accent : undefined,
|
|
53522
|
-
children:
|
|
53523
|
-
" ",
|
|
53524
|
-
truncatedName
|
|
53525
|
-
]
|
|
53526
|
-
}, undefined, true, undefined, this),
|
|
53527
|
-
worktree.isPrimary && /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
53528
|
-
color: theme.status.primary,
|
|
53529
|
-
children: primarySuffix
|
|
53530
|
-
}, undefined, false, undefined, this),
|
|
53531
|
-
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
53532
|
-
children: namePadding
|
|
53570
|
+
children: rowText.slice(iconEnd, nameEnd)
|
|
53533
53571
|
}, undefined, false, undefined, this),
|
|
53534
53572
|
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
53535
53573
|
dimColor: true,
|
|
53536
|
-
children:
|
|
53537
|
-
|
|
53538
|
-
pathStr
|
|
53539
|
-
]
|
|
53540
|
-
}, undefined, true, undefined, this),
|
|
53574
|
+
children: rowText.slice(nameEnd, pathEnd)
|
|
53575
|
+
}, undefined, false, undefined, this),
|
|
53541
53576
|
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
53542
53577
|
dimColor: true,
|
|
53543
|
-
children:
|
|
53544
|
-
|
|
53545
|
-
ageStr
|
|
53546
|
-
]
|
|
53547
|
-
}, undefined, true, undefined, this),
|
|
53578
|
+
children: rowText.slice(pathEnd, ageEnd)
|
|
53579
|
+
}, undefined, false, undefined, this),
|
|
53548
53580
|
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
53549
53581
|
color: statusColor,
|
|
53550
|
-
children:
|
|
53551
|
-
|
|
53552
|
-
|
|
53553
|
-
|
|
53554
|
-
|
|
53555
|
-
|
|
53556
|
-
color: theme.ui.success,
|
|
53557
|
-
children: [
|
|
53558
|
-
"↑",
|
|
53559
|
-
ahead
|
|
53560
|
-
]
|
|
53561
|
-
}, undefined, true, undefined, this),
|
|
53562
|
-
behind !== undefined && behind > 0 && /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
53563
|
-
color: theme.status.behind,
|
|
53564
|
-
children: [
|
|
53565
|
-
"↓",
|
|
53566
|
-
behind
|
|
53567
|
-
]
|
|
53568
|
-
}, undefined, true, undefined, this)
|
|
53582
|
+
children: rowText.slice(ageEnd, statusEnd)
|
|
53583
|
+
}, undefined, false, undefined, this),
|
|
53584
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
53585
|
+
color: ahead && ahead > 0 ? theme.ui.success : theme.status.behind,
|
|
53586
|
+
children: rowText.slice(statusEnd)
|
|
53587
|
+
}, undefined, false, undefined, this)
|
|
53569
53588
|
]
|
|
53570
53589
|
}, undefined, true, undefined, this);
|
|
53571
53590
|
}
|
|
@@ -53574,6 +53593,7 @@ var init_WorktreeItem = __esm(async () => {
|
|
|
53574
53593
|
init_log();
|
|
53575
53594
|
init_paths();
|
|
53576
53595
|
init_theme();
|
|
53596
|
+
init_columns();
|
|
53577
53597
|
await init_build2();
|
|
53578
53598
|
import_react30 = __toESM(require_react(), 1);
|
|
53579
53599
|
jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
|
|
@@ -53640,17 +53660,8 @@ function WorktreeList({
|
|
|
53640
53660
|
width: boxWidth - 2,
|
|
53641
53661
|
children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
|
|
53642
53662
|
dimColor: true,
|
|
53643
|
-
children:
|
|
53644
|
-
|
|
53645
|
-
"name".padEnd(20),
|
|
53646
|
-
" ",
|
|
53647
|
-
"path".padEnd(32),
|
|
53648
|
-
" ",
|
|
53649
|
-
"age".padEnd(4),
|
|
53650
|
-
" ",
|
|
53651
|
-
"status".padEnd(8)
|
|
53652
|
-
]
|
|
53653
|
-
}, undefined, true, undefined, this)
|
|
53663
|
+
children: formatHeader()
|
|
53664
|
+
}, undefined, false, undefined, this)
|
|
53654
53665
|
}, undefined, false, undefined, this),
|
|
53655
53666
|
/* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
|
|
53656
53667
|
dimColor: true,
|
|
@@ -53692,6 +53703,7 @@ function WorktreeList({
|
|
|
53692
53703
|
var jsx_dev_runtime7;
|
|
53693
53704
|
var init_WorktreeList = __esm(async () => {
|
|
53694
53705
|
init_version();
|
|
53706
|
+
init_columns();
|
|
53695
53707
|
await __promiseAll([
|
|
53696
53708
|
init_build2(),
|
|
53697
53709
|
init_WorktreeItem()
|