copilot-statusline 0.1.10 → 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.
@@ -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.10";
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;
@@ -53931,6 +53931,13 @@ function normalizeThinkingEffort(value) {
53931
53931
  const match = LABELED_EFFORT_REGEX.exec(normalized);
53932
53932
  return match?.[1] ? match[1] : null;
53933
53933
  }
53934
+ function trustThinkingEffort(value) {
53935
+ if (!value) {
53936
+ return null;
53937
+ }
53938
+ const normalized = value.trim().toLowerCase();
53939
+ return normalized || null;
53940
+ }
53934
53941
  function parseDisplayName(displayName) {
53935
53942
  if (!displayName) {
53936
53943
  return { thinkingEffort: null, multiplier: null, multiplierValue: null };
@@ -54006,7 +54013,7 @@ class ThinkingEffortWidget {
54006
54013
  return item.rawValue ? "high" : "Thinking: high";
54007
54014
  }
54008
54015
  const model = context.data?.model;
54009
- const thinkingEffort = normalizeThinkingEffort(model?.thinking_effort_level) ?? normalizeThinkingEffort(model?.thinking_effort) ?? normalizeThinkingEffort(model?.reasoning_effort) ?? parseDisplayName(model?.display_name).thinkingEffort;
54016
+ const thinkingEffort = trustThinkingEffort(model?.thinking_effort_level) ?? normalizeThinkingEffort(model?.thinking_effort) ?? normalizeThinkingEffort(model?.reasoning_effort) ?? parseDisplayName(model?.display_name).thinkingEffort;
54010
54017
  if (thinkingEffort) {
54011
54018
  return item.rawValue ? thinkingEffort : `Thinking: ${thinkingEffort}`;
54012
54019
  }
@@ -56626,6 +56633,114 @@ class GitIsForkWidget {
56626
56633
  return true;
56627
56634
  }
56628
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
+ }
56629
56744
  // src/widgets/CurrentWorkingDir.tsx
56630
56745
  var import_react29 = __toESM(require_react(), 1);
56631
56746
  import * as os7 from "node:os";
@@ -58070,6 +58185,8 @@ var WIDGET_MANIFEST = [
58070
58185
  { type: "git-upstream-repo", create: () => new GitUpstreamRepoWidget },
58071
58186
  { type: "git-upstream-owner-repo", create: () => new GitUpstreamOwnerRepoWidget },
58072
58187
  { type: "git-is-fork", create: () => new GitIsForkWidget },
58188
+ { type: "git-worktree", create: () => new GitWorktreeWidget },
58189
+ { type: "git-worktree-mode", create: () => new GitWorktreeModeWidget },
58073
58190
  { type: "current-working-dir", create: () => new CurrentWorkingDirWidget },
58074
58191
  { type: "terminal-width", create: () => new TerminalWidthWidget },
58075
58192
  { type: "free-memory", create: () => new FreeMemoryWidget },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "copilot-statusline",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "A customizable status line formatter for GitHub Copilot CLI — based on ccstatusline",
5
5
  "module": "src/copilot-statusline.ts",
6
6
  "type": "module",