ccstatusline 2.0.23 → 2.0.25

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.
@@ -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.23";
51408
+ var PACKAGE_VERSION = "2.0.25";
51409
51409
  function getPackageVersion() {
51410
51410
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
51411
51411
  return PACKAGE_VERSION;
@@ -52251,8 +52251,11 @@ class ModelWidget {
52251
52251
  render(item, context, settings) {
52252
52252
  if (context.isPreview) {
52253
52253
  return item.rawValue ? "Claude" : "Model: Claude";
52254
- } else if (context.data?.model?.display_name) {
52255
- return item.rawValue ? context.data.model.display_name : `Model: ${context.data.model.display_name}`;
52254
+ }
52255
+ const model = context.data?.model;
52256
+ const modelDisplayName = typeof model === "string" ? model : model?.display_name ?? model?.id;
52257
+ if (modelDisplayName) {
52258
+ return item.rawValue ? modelDisplayName : `Model: ${modelDisplayName}`;
52256
52259
  }
52257
52260
  return null;
52258
52261
  }
@@ -52545,7 +52548,8 @@ function calculateContextPercentage(context) {
52545
52548
  if (!context.tokenMetrics) {
52546
52549
  return 0;
52547
52550
  }
52548
- const modelId = context.data?.model?.id;
52551
+ const model = context.data?.model;
52552
+ const modelId = typeof model === "string" ? model : model?.id;
52549
52553
  const contextConfig = getContextConfig(modelId);
52550
52554
  return Math.min(100, context.tokenMetrics.contextLength / contextConfig.maxTokens * 100);
52551
52555
  }
@@ -53401,7 +53405,8 @@ class ContextPercentageWidget {
53401
53405
  const previewValue = isInverse ? "90.7%" : "9.3%";
53402
53406
  return item.rawValue ? previewValue : `Ctx: ${previewValue}`;
53403
53407
  } else if (context.tokenMetrics) {
53404
- const modelId = context.data?.model?.id;
53408
+ const model = context.data?.model;
53409
+ const modelId = typeof model === "string" ? model : model?.id;
53405
53410
  const contextConfig = getContextConfig(modelId);
53406
53411
  const usedPercentage = Math.min(100, context.tokenMetrics.contextLength / contextConfig.maxTokens * 100);
53407
53412
  const displayPercentage = isInverse ? 100 - usedPercentage : usedPercentage;
@@ -53462,7 +53467,8 @@ class ContextPercentageUsableWidget {
53462
53467
  const previewValue = isInverse ? "88.4%" : "11.6%";
53463
53468
  return item.rawValue ? previewValue : `Ctx(u): ${previewValue}`;
53464
53469
  } else if (context.tokenMetrics) {
53465
- const modelId = context.data?.model?.id;
53470
+ const model = context.data?.model;
53471
+ const modelId = typeof model === "string" ? model : model?.id;
53466
53472
  const contextConfig = getContextConfig(modelId);
53467
53473
  const usedPercentage = Math.min(100, context.tokenMetrics.contextLength / contextConfig.usableTokens * 100);
53468
53474
  const displayPercentage = isInverse ? 100 - usedPercentage : usedPercentage;
@@ -55911,6 +55917,7 @@ var LineSelector = ({
55911
55917
  }) => {
55912
55918
  const [selectedIndex, setSelectedIndex] = import_react37.useState(initialSelection);
55913
55919
  const [showDeleteDialog, setShowDeleteDialog] = import_react37.useState(false);
55920
+ const [moveMode, setMoveMode] = import_react37.useState(false);
55914
55921
  const [localLines, setLocalLines] = import_react37.useState(lines);
55915
55922
  import_react37.useEffect(() => {
55916
55923
  setLocalLines(lines);
@@ -55942,6 +55949,32 @@ var LineSelector = ({
55942
55949
  onBack();
55943
55950
  return;
55944
55951
  }
55952
+ if (moveMode) {
55953
+ if (key.upArrow && selectedIndex > 0) {
55954
+ const newLines = [...localLines];
55955
+ const temp = newLines[selectedIndex];
55956
+ const prev = newLines[selectedIndex - 1];
55957
+ if (temp && prev) {
55958
+ [newLines[selectedIndex], newLines[selectedIndex - 1]] = [prev, temp];
55959
+ }
55960
+ setLocalLines(newLines);
55961
+ onLinesUpdate(newLines);
55962
+ setSelectedIndex(selectedIndex - 1);
55963
+ } else if (key.downArrow && selectedIndex < localLines.length - 1) {
55964
+ const newLines = [...localLines];
55965
+ const temp = newLines[selectedIndex];
55966
+ const next = newLines[selectedIndex + 1];
55967
+ if (temp && next) {
55968
+ [newLines[selectedIndex], newLines[selectedIndex + 1]] = [next, temp];
55969
+ }
55970
+ setLocalLines(newLines);
55971
+ onLinesUpdate(newLines);
55972
+ setSelectedIndex(selectedIndex + 1);
55973
+ } else if (key.escape || key.return) {
55974
+ setMoveMode(false);
55975
+ }
55976
+ return;
55977
+ }
55945
55978
  switch (input) {
55946
55979
  case "a":
55947
55980
  if (allowEditing) {
@@ -55953,6 +55986,11 @@ var LineSelector = ({
55953
55986
  setShowDeleteDialog(true);
55954
55987
  }
55955
55988
  return;
55989
+ case "m":
55990
+ if (allowEditing && localLines.length > 1 && selectedIndex < localLines.length) {
55991
+ setMoveMode(true);
55992
+ }
55993
+ return;
55956
55994
  }
55957
55995
  if (key.escape) {
55958
55996
  onBack();
@@ -56075,17 +56113,31 @@ var LineSelector = ({
56075
56113
  children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
56076
56114
  flexDirection: "column",
56077
56115
  children: [
56078
- /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56079
- bold: true,
56080
- children: title ?? "Select Line to Edit"
56081
- }, undefined, false, undefined, this),
56116
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
56117
+ children: [
56118
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56119
+ bold: true,
56120
+ children: [
56121
+ title ?? "Select Line to Edit",
56122
+ " "
56123
+ ]
56124
+ }, undefined, true, undefined, this),
56125
+ moveMode && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56126
+ color: "blue",
56127
+ children: "[MOVE MODE]"
56128
+ }, undefined, false, undefined, this)
56129
+ ]
56130
+ }, undefined, true, undefined, this),
56082
56131
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56083
56132
  dimColor: true,
56084
56133
  children: "Choose which status line to configure"
56085
56134
  }, undefined, false, undefined, this),
56086
- /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56135
+ moveMode ? /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56136
+ dimColor: true,
56137
+ children: "↑↓ to move line, ESC or Enter to exit move mode"
56138
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56087
56139
  dimColor: true,
56088
- children: allowEditing ? localLines.length > 1 ? "(a) to append new line, (d) to delete line, ESC to go back" : "(a) to append new line, ESC to go back" : "ESC to go back"
56140
+ children: allowEditing ? localLines.length > 1 ? "(a) to append new line, (d) to delete line, (m) to move line, ESC to go back" : "(a) to append new line, ESC to go back" : "ESC to go back"
56089
56141
  }, undefined, false, undefined, this),
56090
56142
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
56091
56143
  marginTop: 1,
@@ -56096,10 +56148,10 @@ var LineSelector = ({
56096
56148
  const suffix = line.length ? import_pluralize.default("widget", line.length, true) : "empty";
56097
56149
  return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
56098
56150
  children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56099
- color: isSelected ? "green" : undefined,
56151
+ color: isSelected ? moveMode ? "blue" : "green" : undefined,
56100
56152
  children: [
56101
56153
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56102
- children: isSelected ? "▶ " : " "
56154
+ children: isSelected ? moveMode ? "◆ " : "▶ " : " "
56103
56155
  }, undefined, false, undefined, this),
56104
56156
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56105
56157
  children: [
@@ -56125,7 +56177,7 @@ var LineSelector = ({
56125
56177
  }, undefined, true, undefined, this)
56126
56178
  }, index, false, undefined, this);
56127
56179
  }),
56128
- /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
56180
+ !moveMode && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
56129
56181
  marginTop: 1,
56130
56182
  children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56131
56183
  color: selectedIndex === localLines.length ? "green" : undefined,
@@ -58145,10 +58197,13 @@ var StatusJSONSchema = exports_external.looseObject({
58145
58197
  session_id: exports_external.string().optional(),
58146
58198
  transcript_path: exports_external.string().optional(),
58147
58199
  cwd: exports_external.string().optional(),
58148
- model: exports_external.object({
58149
- id: exports_external.string().optional(),
58150
- display_name: exports_external.string().optional()
58151
- }).optional(),
58200
+ model: exports_external.union([
58201
+ exports_external.string(),
58202
+ exports_external.object({
58203
+ id: exports_external.string().optional(),
58204
+ display_name: exports_external.string().optional()
58205
+ })
58206
+ ]).optional(),
58152
58207
  workspace: exports_external.object({
58153
58208
  current_dir: exports_external.string().optional(),
58154
58209
  project_dir: exports_external.string().optional()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline",
3
- "version": "2.0.23",
3
+ "version": "2.0.25",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",