tokenmix 1.5.0 → 1.5.1

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.
@@ -6,7 +6,7 @@ import { t } from '../i18n/index.js';
6
6
  // Major version of the running Node (e.g. 22 from "v22.9.0"). Gates agents whose
7
7
  // binary needs a newer Node than this process (Codex / Qwen Code require 22).
8
8
  export function nodeMajor() {
9
- return parseInt(process.versions.node.split('.')[0], 10);
9
+ return parseInt(process.versions.node.split('.')[0] ?? '', 10);
10
10
  }
11
11
  // Flags that are pure information requests meant for the underlying agent binary.
12
12
  // For these we must NOT rewrite global config or require login — just forward them.
@@ -11,7 +11,7 @@ export function detectLocale(env = process.env) {
11
11
  .trim();
12
12
  // Primary language subtag: zh_CN.UTF-8 → zh, pt-BR → pt, fr.UTF-8 → fr.
13
13
  // Any subtag with a catalog is supported; everything else falls back to en.
14
- const lang = raw.split(/[-_.@]/)[0];
14
+ const lang = raw.split(/[-_.@]/)[0] ?? '';
15
15
  return Object.prototype.hasOwnProperty.call(catalogs, lang) ? lang : 'en';
16
16
  }
17
17
  export function setLocale(loc) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokenmix",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Zero-config CLI to use any open-source coding agent with TokenMix as the unified LLM backend.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,7 +17,9 @@
17
17
  "format:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\"",
18
18
  "test": "vitest run",
19
19
  "test:watch": "vitest",
20
- "prepublishOnly": "pnpm build"
20
+ "test:coverage": "vitest run --coverage",
21
+ "prepublishOnly": "pnpm build",
22
+ "prepare": "husky"
21
23
  },
22
24
  "engines": {
23
25
  "node": ">=18"
@@ -72,9 +74,12 @@
72
74
  "@types/node": "^22.9.0",
73
75
  "@types/prompts": "^2.4.9",
74
76
  "@types/which": "^3.0.4",
77
+ "@vitest/coverage-v8": "^4.1.7",
75
78
  "eslint": "^10.4.1",
76
79
  "eslint-config-prettier": "^10.1.8",
77
80
  "globals": "^17.6.0",
81
+ "husky": "^9.1.7",
82
+ "lint-staged": "^17.0.7",
78
83
  "prettier": "^3.8.3",
79
84
  "tsx": "^4.19.2",
80
85
  "typescript": "^5.6.3",
@@ -85,5 +90,11 @@
85
90
  "onlyBuiltDependencies": [
86
91
  "esbuild"
87
92
  ]
93
+ },
94
+ "lint-staged": {
95
+ "*.ts": [
96
+ "eslint --fix",
97
+ "prettier --write"
98
+ ]
88
99
  }
89
100
  }