ccstatusline-usage 2.0.29 → 2.0.31

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.
@@ -50982,18 +50982,18 @@ var SettingsSchema = exports_external.object({
50982
50982
  version: exports_external.number().default(CURRENT_VERSION),
50983
50983
  lines: exports_external.array(exports_external.array(WidgetItemSchema)).min(1).default([
50984
50984
  [
50985
- { id: "session-usage", type: "custom-command", color: "brightBlue", commandPath: "$PKG/scripts/usage.sh session", timeout: 5000 },
50985
+ { id: "session-usage", type: "custom-command", color: "brightBlue", commandPath: "$PKG/scripts/usage.sh session", timeout: 5000, label: "Session Usage" },
50986
50986
  { id: "sep1", type: "separator" },
50987
- { id: "weekly-usage", type: "custom-command", color: "brightBlue", commandPath: "$PKG/scripts/usage.sh weekly", timeout: 5000 },
50987
+ { id: "weekly-usage", type: "custom-command", color: "brightBlue", commandPath: "$PKG/scripts/usage.sh weekly", timeout: 5000, label: "Weekly Usage" },
50988
50988
  { id: "sep2", type: "separator" },
50989
- { id: "reset-timer", type: "custom-command", color: "brightBlue", commandPath: "$PKG/scripts/usage.sh reset", timeout: 5000 },
50989
+ { id: "reset-timer", type: "custom-command", color: "brightBlue", commandPath: "$PKG/scripts/usage.sh reset", timeout: 5000, label: "Reset Timer" },
50990
50990
  { id: "sep3", type: "separator" },
50991
50991
  { id: "model", type: "model", color: "magenta" },
50992
50992
  { id: "sep4", type: "separator" },
50993
50993
  { id: "session-id", type: "claude-session-id", color: "cyan" }
50994
50994
  ],
50995
50995
  [
50996
- { id: "context-usage", type: "custom-command", color: "blue", commandPath: "$PKG/scripts/context.sh", timeout: 5000 }
50996
+ { id: "context-usage", type: "custom-command", color: "blue", commandPath: "$PKG/scripts/context.sh", timeout: 5000, label: "Context Bar" }
50997
50997
  ],
50998
50998
  []
50999
50999
  ]),
@@ -51450,7 +51450,7 @@ import { execSync as execSync3 } from "child_process";
51450
51450
  import * as fs5 from "fs";
51451
51451
  import * as path4 from "path";
51452
51452
  var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils";
51453
- var PACKAGE_VERSION = "2.0.29";
51453
+ var PACKAGE_VERSION = "2.0.31";
51454
51454
  function getPackageVersion() {
51455
51455
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
51456
51456
  return PACKAGE_VERSION;
@@ -53814,15 +53814,18 @@ var CustomTextEditor = ({ widget, onComplete, onCancel }) => {
53814
53814
  import { execSync as execSync7 } from "child_process";
53815
53815
  import * as fs6 from "fs";
53816
53816
  var import_react30 = __toESM(require_react(), 1);
53817
- var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
53818
53817
  import * as path5 from "path";
53818
+ var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
53819
53819
  function getPackageDir() {
53820
- const scriptPath = process.argv[1];
53821
- if (scriptPath) {
53820
+ const scriptPaths = [
53821
+ process.argv[1],
53822
+ __require.main?.filename
53823
+ ].filter(Boolean);
53824
+ for (const scriptPath of scriptPaths) {
53822
53825
  try {
53823
53826
  const realPath = fs6.realpathSync(scriptPath);
53824
53827
  let dir = path5.dirname(realPath);
53825
- for (let i = 0;i < 5; i++) {
53828
+ for (let i = 0;i < 10; i++) {
53826
53829
  const pkgJson = path5.join(dir, "package.json");
53827
53830
  if (fs6.existsSync(pkgJson)) {
53828
53831
  try {
@@ -53832,10 +53835,57 @@ function getPackageDir() {
53832
53835
  }
53833
53836
  } catch {}
53834
53837
  }
53838
+ const scriptsDir = path5.join(dir, "scripts");
53839
+ if (fs6.existsSync(path5.join(scriptsDir, "usage.sh"))) {
53840
+ return dir;
53841
+ }
53835
53842
  dir = path5.dirname(dir);
53836
53843
  }
53837
53844
  } catch {}
53838
53845
  }
53846
+ const home = process.env.HOME ?? "";
53847
+ const npxPaths = [
53848
+ path5.join(home, ".npm", "_npx"),
53849
+ path5.join(home, ".cache", "npm", "_npx"),
53850
+ path5.join(home, ".local", "share", "npm", "_npx")
53851
+ ];
53852
+ for (const npxBase of npxPaths) {
53853
+ if (fs6.existsSync(npxBase)) {
53854
+ try {
53855
+ const entries = fs6.readdirSync(npxBase);
53856
+ for (const entry of entries) {
53857
+ const pkgDir = path5.join(npxBase, entry, "node_modules", "ccstatusline-usage");
53858
+ if (fs6.existsSync(path5.join(pkgDir, "scripts", "usage.sh"))) {
53859
+ return pkgDir;
53860
+ }
53861
+ }
53862
+ } catch {}
53863
+ }
53864
+ }
53865
+ const globalPaths = [
53866
+ "/usr/local/lib/node_modules/ccstatusline-usage",
53867
+ "/usr/lib/node_modules/ccstatusline-usage",
53868
+ path5.join(home, ".nvm", "versions", "node"),
53869
+ path5.join(home, "node_modules", "ccstatusline-usage"),
53870
+ path5.join(home, ".local", "lib", "node_modules", "ccstatusline-usage")
53871
+ ];
53872
+ for (const globalPath of globalPaths) {
53873
+ if (globalPath.includes(".nvm")) {
53874
+ try {
53875
+ if (fs6.existsSync(globalPath)) {
53876
+ const versions2 = fs6.readdirSync(globalPath);
53877
+ for (const ver of versions2) {
53878
+ const pkgDir = path5.join(globalPath, ver, "lib", "node_modules", "ccstatusline-usage");
53879
+ if (fs6.existsSync(path5.join(pkgDir, "scripts", "usage.sh"))) {
53880
+ return pkgDir;
53881
+ }
53882
+ }
53883
+ }
53884
+ } catch {}
53885
+ } else if (fs6.existsSync(path5.join(globalPath, "scripts", "usage.sh"))) {
53886
+ return globalPath;
53887
+ }
53888
+ }
53839
53889
  return "";
53840
53890
  }
53841
53891
  var PKG_DIR = getPackageDir();
@@ -53851,9 +53901,11 @@ class CustomCommandWidget {
53851
53901
  return "Custom Command";
53852
53902
  }
53853
53903
  getEditorDisplay(item) {
53854
- const cmd = item.commandPath ?? "No command";
53855
- const truncatedCmd = cmd.length > 20 ? `${cmd.substring(0, 17)}...` : cmd;
53856
- const displayText = `${this.getDisplayName()} (${truncatedCmd})`;
53904
+ const displayText = item.label ? item.label : (() => {
53905
+ const cmd = item.commandPath ?? "No command";
53906
+ const truncatedCmd = cmd.length > 20 ? `${cmd.substring(0, 17)}...` : cmd;
53907
+ return `${this.getDisplayName()} (${truncatedCmd})`;
53908
+ })();
53857
53909
  const modifiers = [];
53858
53910
  if (item.maxWidth) {
53859
53911
  modifiers.push(`max:${item.maxWidth}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline-usage",
3
- "version": "2.0.29",
3
+ "version": "2.0.31",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",