copilot-statusline 0.1.11 → 0.1.12
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/copilot-statusline.js +111 -1
- package/package.json +1 -1
|
@@ -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.12";
|
|
52917
52917
|
function getPackageVersion() {
|
|
52918
52918
|
if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
|
|
52919
52919
|
return PACKAGE_VERSION;
|
|
@@ -56633,6 +56633,114 @@ class GitIsForkWidget {
|
|
|
56633
56633
|
return true;
|
|
56634
56634
|
}
|
|
56635
56635
|
}
|
|
56636
|
+
// src/widgets/GitWorktree.ts
|
|
56637
|
+
class GitWorktreeWidget {
|
|
56638
|
+
getDefaultColor() {
|
|
56639
|
+
return "blue";
|
|
56640
|
+
}
|
|
56641
|
+
getDescription() {
|
|
56642
|
+
return "Shows the current git worktree name";
|
|
56643
|
+
}
|
|
56644
|
+
getDisplayName() {
|
|
56645
|
+
return "Git Worktree";
|
|
56646
|
+
}
|
|
56647
|
+
getCategory() {
|
|
56648
|
+
return "Git";
|
|
56649
|
+
}
|
|
56650
|
+
getEditorDisplay(item) {
|
|
56651
|
+
return {
|
|
56652
|
+
displayText: this.getDisplayName(),
|
|
56653
|
+
modifierText: getHideNoGitModifierText(item)
|
|
56654
|
+
};
|
|
56655
|
+
}
|
|
56656
|
+
handleEditorAction(action, item) {
|
|
56657
|
+
return handleToggleNoGitAction(action, item);
|
|
56658
|
+
}
|
|
56659
|
+
render(item, context) {
|
|
56660
|
+
const hideNoGit = isHideNoGitEnabled(item);
|
|
56661
|
+
if (context.isPreview)
|
|
56662
|
+
return item.rawValue ? "main" : "\uD81A\uDC30 main";
|
|
56663
|
+
if (!isInsideGitWorkTree(context)) {
|
|
56664
|
+
return hideNoGit ? null : "\uD81A\uDC30 no git";
|
|
56665
|
+
}
|
|
56666
|
+
const worktree = this.getGitWorktree(context);
|
|
56667
|
+
if (worktree)
|
|
56668
|
+
return item.rawValue ? worktree : `\uD81A\uDC30 ${worktree}`;
|
|
56669
|
+
return hideNoGit ? null : "\uD81A\uDC30 no git";
|
|
56670
|
+
}
|
|
56671
|
+
getGitWorktree(context) {
|
|
56672
|
+
const worktreeDir = runGit("rev-parse --git-dir", context);
|
|
56673
|
+
if (!worktreeDir)
|
|
56674
|
+
return null;
|
|
56675
|
+
const normalizedGitDir = worktreeDir.replace(/\\/g, "/");
|
|
56676
|
+
if (normalizedGitDir.endsWith("/.git") || normalizedGitDir === ".git")
|
|
56677
|
+
return "main";
|
|
56678
|
+
const repoMarker = ".git/worktrees/";
|
|
56679
|
+
const repoMarkerIndex = normalizedGitDir.lastIndexOf(repoMarker);
|
|
56680
|
+
if (repoMarkerIndex !== -1) {
|
|
56681
|
+
const worktree2 = normalizedGitDir.slice(repoMarkerIndex + repoMarker.length);
|
|
56682
|
+
return worktree2.length > 0 ? worktree2 : null;
|
|
56683
|
+
}
|
|
56684
|
+
const bareMarker = "/worktrees/";
|
|
56685
|
+
const bareMarkerIndex = normalizedGitDir.lastIndexOf(bareMarker);
|
|
56686
|
+
if (bareMarkerIndex === -1)
|
|
56687
|
+
return null;
|
|
56688
|
+
const worktree = normalizedGitDir.slice(bareMarkerIndex + bareMarker.length);
|
|
56689
|
+
return worktree.length > 0 ? worktree : null;
|
|
56690
|
+
}
|
|
56691
|
+
getCustomKeybinds() {
|
|
56692
|
+
return getHideNoGitKeybinds();
|
|
56693
|
+
}
|
|
56694
|
+
supportsRawValue() {
|
|
56695
|
+
return true;
|
|
56696
|
+
}
|
|
56697
|
+
supportsColors(_item) {
|
|
56698
|
+
return true;
|
|
56699
|
+
}
|
|
56700
|
+
}
|
|
56701
|
+
// src/widgets/GitWorktreeMode.ts
|
|
56702
|
+
class GitWorktreeModeWidget {
|
|
56703
|
+
getDefaultColor() {
|
|
56704
|
+
return "yellow";
|
|
56705
|
+
}
|
|
56706
|
+
getDescription() {
|
|
56707
|
+
return "Shows indicator when current dir is a non-main git worktree";
|
|
56708
|
+
}
|
|
56709
|
+
getDisplayName() {
|
|
56710
|
+
return "Git Worktree Mode";
|
|
56711
|
+
}
|
|
56712
|
+
getCategory() {
|
|
56713
|
+
return "Git";
|
|
56714
|
+
}
|
|
56715
|
+
getEditorDisplay(_item) {
|
|
56716
|
+
return { displayText: this.getDisplayName() };
|
|
56717
|
+
}
|
|
56718
|
+
render(item, context) {
|
|
56719
|
+
const isInWorktree = context.isPreview ? true : this.isInLinkedWorktree(context);
|
|
56720
|
+
if (item.rawValue) {
|
|
56721
|
+
return isInWorktree ? "true" : "false";
|
|
56722
|
+
}
|
|
56723
|
+
if (!isInWorktree) {
|
|
56724
|
+
return null;
|
|
56725
|
+
}
|
|
56726
|
+
return "⎇";
|
|
56727
|
+
}
|
|
56728
|
+
isInLinkedWorktree(context) {
|
|
56729
|
+
if (!isInsideGitWorkTree(context))
|
|
56730
|
+
return false;
|
|
56731
|
+
const gitDir = runGit("rev-parse --git-dir", context);
|
|
56732
|
+
if (!gitDir)
|
|
56733
|
+
return false;
|
|
56734
|
+
const normalized = gitDir.replace(/\\/g, "/");
|
|
56735
|
+
return normalized.includes("/worktrees/");
|
|
56736
|
+
}
|
|
56737
|
+
supportsRawValue() {
|
|
56738
|
+
return true;
|
|
56739
|
+
}
|
|
56740
|
+
supportsColors(_item) {
|
|
56741
|
+
return true;
|
|
56742
|
+
}
|
|
56743
|
+
}
|
|
56636
56744
|
// src/widgets/CurrentWorkingDir.tsx
|
|
56637
56745
|
var import_react29 = __toESM(require_react(), 1);
|
|
56638
56746
|
import * as os7 from "node:os";
|
|
@@ -58077,6 +58185,8 @@ var WIDGET_MANIFEST = [
|
|
|
58077
58185
|
{ type: "git-upstream-repo", create: () => new GitUpstreamRepoWidget },
|
|
58078
58186
|
{ type: "git-upstream-owner-repo", create: () => new GitUpstreamOwnerRepoWidget },
|
|
58079
58187
|
{ type: "git-is-fork", create: () => new GitIsForkWidget },
|
|
58188
|
+
{ type: "git-worktree", create: () => new GitWorktreeWidget },
|
|
58189
|
+
{ type: "git-worktree-mode", create: () => new GitWorktreeModeWidget },
|
|
58080
58190
|
{ type: "current-working-dir", create: () => new CurrentWorkingDirWidget },
|
|
58081
58191
|
{ type: "terminal-width", create: () => new TerminalWidthWidget },
|
|
58082
58192
|
{ type: "free-memory", create: () => new FreeMemoryWidget },
|
package/package.json
CHANGED