claudeline 1.6.0 → 1.6.2

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.
Files changed (2) hide show
  1. package/dist/index.js +33 -25
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -747,9 +747,9 @@ function calculatePace(window, windowDurationMs) {
747
747
  return { target, delta };
748
748
  }
749
749
  function paceColor(delta) {
750
- if (delta > 10) return "\x1B[33m";
751
- if (delta < -10) return "\x1B[36m";
752
- return "\x1B[32m";
750
+ if (delta > 10) return "\x1B[0;33m";
751
+ if (delta < -10) return "\x1B[0;36m";
752
+ return "\x1B[0;32m";
753
753
  }
754
754
  function formatPaceIcon(delta, noColor) {
755
755
  const icon = delta > 10 ? "\uF0E7" : delta < -10 ? "\uF017" : "\uF00C";
@@ -860,19 +860,19 @@ function evaluateUsageComponent(key, args, noColor = false) {
860
860
  case "5h-icon": {
861
861
  const pct = data.five_hour.utilization;
862
862
  const icon = "\uF111";
863
- if (pct < 50) return `\x1B[32m${icon}\x1B[0m`;
864
- if (pct < 75) return `\x1B[33m${icon}\x1B[0m`;
865
- if (pct < 90) return `\x1B[31m${icon}\x1B[0m`;
866
- return `\x1B[1;31m${icon}\x1B[0m`;
863
+ if (pct < 50) return `\x1B[0;32m${icon}\x1B[0m`;
864
+ if (pct < 75) return `\x1B[0;33m${icon}\x1B[0m`;
865
+ if (pct < 90) return `\x1B[0;31m${icon}\x1B[0m`;
866
+ return `\x1B[0;1;31m${icon}\x1B[0m`;
867
867
  }
868
868
  case "week-icon":
869
869
  case "7d-icon": {
870
870
  const pct = data.seven_day.utilization;
871
871
  const icon = "\uF111";
872
- if (pct < 50) return `\x1B[32m${icon}\x1B[0m`;
873
- if (pct < 75) return `\x1B[33m${icon}\x1B[0m`;
874
- if (pct < 90) return `\x1B[31m${icon}\x1B[0m`;
875
- return `\x1B[1;31m${icon}\x1B[0m`;
872
+ if (pct < 50) return `\x1B[0;32m${icon}\x1B[0m`;
873
+ if (pct < 75) return `\x1B[0;33m${icon}\x1B[0m`;
874
+ if (pct < 90) return `\x1B[0;31m${icon}\x1B[0m`;
875
+ return `\x1B[0;1;31m${icon}\x1B[0m`;
876
876
  }
877
877
  case "5h-target": {
878
878
  const { target } = calculatePace(data.five_hour, FIVE_HOUR_MS);
@@ -1060,7 +1060,7 @@ function applyStyles(text, styles, noColor) {
1060
1060
  if (noColor || styles.length === 0 || !text) return text;
1061
1061
  const codes = styles.map((s) => COLORS[s]).filter(Boolean);
1062
1062
  if (codes.length === 0) return text;
1063
- return `\x1B[${codes.join(";")}m${text}\x1B[${RESET}m`;
1063
+ return `\x1B[0;${codes.join(";")}m${text}\x1B[${RESET}m`;
1064
1064
  }
1065
1065
  function evaluateClaudeComponent(key, data, noColor = false) {
1066
1066
  switch (key) {
@@ -1078,9 +1078,17 @@ function evaluateClaudeComponent(key, data, noColor = false) {
1078
1078
  return data.session_id || "";
1079
1079
  case "effort": {
1080
1080
  try {
1081
- const settingsPath = path3.join(os2.homedir(), ".claude", "settings.json");
1082
- const settings = JSON.parse(fs3.readFileSync(settingsPath, "utf8"));
1083
- const effort = settings.effortLevel || "high";
1081
+ const globalPath = path3.join(os2.homedir(), ".claude", "settings.json");
1082
+ const projectPath = path3.join(process.cwd(), ".claude", "settings.json");
1083
+ let effort = "high";
1084
+ try {
1085
+ effort = JSON.parse(fs3.readFileSync(globalPath, "utf8")).effortLevel || effort;
1086
+ } catch {
1087
+ }
1088
+ try {
1089
+ effort = JSON.parse(fs3.readFileSync(projectPath, "utf8")).effortLevel || effort;
1090
+ } catch {
1091
+ }
1084
1092
  if (noColor) return effort;
1085
1093
  const r = `\x1B[${RESET}m`;
1086
1094
  const colors = {
@@ -1089,7 +1097,7 @@ function evaluateClaudeComponent(key, data, noColor = false) {
1089
1097
  high: COLORS.red
1090
1098
  };
1091
1099
  const code = colors[effort] || "";
1092
- return code ? `\x1B[${code}m${effort}${r}` : effort;
1100
+ return code ? `\x1B[0;${code}m${effort}${r}` : effort;
1093
1101
  } catch {
1094
1102
  return "";
1095
1103
  }
@@ -1195,9 +1203,9 @@ function evaluateGitComponent(key, noColor = false) {
1195
1203
  if (modified > 0) parts.push("~" + modified);
1196
1204
  } else {
1197
1205
  const r = `\x1B[${RESET}m`;
1198
- if (staged > 0) parts.push(`\x1B[${COLORS.green}m+${staged}${r}`);
1199
- if (untracked > 0) parts.push(`\x1B[${COLORS.red}m-${untracked}${r}`);
1200
- if (modified > 0) parts.push(`\x1B[${COLORS.yellow}m~${modified}${r}`);
1206
+ if (staged > 0) parts.push(`\x1B[0;${COLORS.green}m+${staged}${r}`);
1207
+ if (untracked > 0) parts.push(`\x1B[0;${COLORS.red}m-${untracked}${r}`);
1208
+ if (modified > 0) parts.push(`\x1B[0;${COLORS.yellow}m~${modified}${r}`);
1201
1209
  }
1202
1210
  return parts.join(" ");
1203
1211
  }
@@ -1253,10 +1261,10 @@ function evaluateContextComponent(key, data, args) {
1253
1261
  case "icon": {
1254
1262
  const pct = ctx?.used_percentage || 0;
1255
1263
  const icon = getNerdIcon("circle");
1256
- if (pct < 50) return `\x1B[${COLORS.green}m${icon}\x1B[${RESET}m`;
1257
- if (pct < 75) return `\x1B[${COLORS.yellow}m${icon}\x1B[${RESET}m`;
1258
- if (pct < 90) return `\x1B[${COLORS.red}m${icon}\x1B[${RESET}m`;
1259
- return `\x1B[${COLORS.red};${COLORS.bold}m${icon}\x1B[${RESET}m`;
1264
+ if (pct < 50) return `\x1B[0;${COLORS.green}m${icon}\x1B[${RESET}m`;
1265
+ if (pct < 75) return `\x1B[0;${COLORS.yellow}m${icon}\x1B[${RESET}m`;
1266
+ if (pct < 90) return `\x1B[0;${COLORS.red}m${icon}\x1B[${RESET}m`;
1267
+ return `\x1B[0;${COLORS.red};${COLORS.bold}m${icon}\x1B[${RESET}m`;
1260
1268
  }
1261
1269
  case "used-tokens": {
1262
1270
  const used = (ctx?.total_input_tokens || 0) + (ctx?.total_output_tokens || 0);
@@ -1522,11 +1530,11 @@ function evaluateFormat(format, data, options = {}) {
1522
1530
  };
1523
1531
  const components = parseFormat(format);
1524
1532
  const result = evaluateComponents(components, data, opts);
1525
- return opts.noColor ? result : `\x1B[0m` + result + `\x1B[0m`;
1533
+ return opts.noColor ? result : result + `\x1B[0m`;
1526
1534
  }
1527
1535
 
1528
1536
  // src/index.ts
1529
- var VERSION = "1.6.0";
1537
+ var VERSION = "1.6.2";
1530
1538
  async function readStdin() {
1531
1539
  return new Promise((resolve, reject) => {
1532
1540
  let input = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudeline",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "Customizable status line generator for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {