@inbrace-tech/tokenline 1.2.2 → 1.2.3

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/package.json +10 -10
  2. package/tokenline.sh +15 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inbrace-tech/tokenline",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "A cache-aware statusline for AI coding CLIs — installs tokenline.sh and wires it into your Claude Code settings.",
5
5
  "bin": {
6
6
  "tokenline": "dist/cli.js"
@@ -37,21 +37,21 @@
37
37
  "access": "public"
38
38
  },
39
39
  "devDependencies": {
40
- "@changesets/cli": "^2.31.0",
40
+ "@changesets/cli": "^3.0.2",
41
41
  "@eslint/js": "10.0.1",
42
- "@types/node": "24.13.3",
43
- "@vitest/eslint-plugin": "1.6.23",
44
- "eslint": "10.7.0",
42
+ "@types/node": "24.13.4",
43
+ "@vitest/eslint-plugin": "1.6.27",
44
+ "eslint": "10.10.0",
45
45
  "eslint-config-prettier": "10.1.8",
46
- "eslint-plugin-n": "18.2.2",
46
+ "eslint-plugin-n": "18.3.0",
47
47
  "eslint-plugin-prettier": "5.5.6",
48
48
  "eslint-plugin-simple-import-sort": "13.0.0",
49
- "globals": "17.7.0",
50
- "prettier": "3.9.5",
49
+ "globals": "17.12.0",
50
+ "prettier": "3.9.6",
51
51
  "tsup": "^8.5.1",
52
52
  "typescript": "5.9.3",
53
- "typescript-eslint": "8.64.0",
54
- "vitest": "4.1.10"
53
+ "typescript-eslint": "8.70.0",
54
+ "vitest": "4.1.11"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "tsup",
package/tokenline.sh CHANGED
@@ -56,6 +56,19 @@ epoch_from_iso() {
56
56
  fi
57
57
  }
58
58
 
59
+ epoch_from_reset() {
60
+ # rate_limits.*.resets_at -> epoch seconds; empty on failure.
61
+ # Claude Code sends Unix epoch seconds, which `date` cannot parse as a date
62
+ # (GNU needs '@<n>', BSD needs '-r <n>'), so an integer is taken as-is and
63
+ # never reaches `date`. Anything else is tried as ISO-8601.
64
+ local value="$1"
65
+ if [[ "$value" =~ ^[0-9]+$ ]]; then
66
+ printf '%s' "$value"
67
+ elif [ -n "$value" ]; then
68
+ epoch_from_iso "$value"
69
+ fi
70
+ }
71
+
59
72
  file_mtime() {
60
73
  local f="$1"
61
74
  if [ "$_stat_gnu" -eq 1 ]; then
@@ -109,9 +122,9 @@ parse_and_prepare_paths() {
109
122
  transcript_path="${_f[3]}"
110
123
  session_id="${_f[4]}"
111
124
  rl_5h_pct="${_f[5]}"
112
- rl_5h_reset=$(epoch_from_iso "${_f[6]}")
125
+ rl_5h_reset=$(epoch_from_reset "${_f[6]}")
113
126
  rl_7d_pct="${_f[7]}"
114
- rl_7d_reset=$(epoch_from_iso "${_f[8]}")
127
+ rl_7d_reset=$(epoch_from_reset "${_f[8]}")
115
128
  cur_input="${_f[9]}"
116
129
  cur_output="${_f[10]}"
117
130
  cur_cwrite="${_f[11]}"