free-coding-models 0.1.46 → 0.1.48
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.
- package/bin/free-coding-models.js +17 -1
- package/lib/utils.js +10 -8
- package/package.json +1 -1
|
@@ -1217,6 +1217,14 @@ function filterByTierOrExit(results, tierLetter) {
|
|
|
1217
1217
|
}
|
|
1218
1218
|
|
|
1219
1219
|
async function main() {
|
|
1220
|
+
const cliArgs = parseArgs(process.argv)
|
|
1221
|
+
|
|
1222
|
+
// Validate --tier early, before entering alternate screen
|
|
1223
|
+
if (cliArgs.tierFilter && !TIER_LETTER_MAP[cliArgs.tierFilter]) {
|
|
1224
|
+
console.error(chalk.red(` Unknown tier "${cliArgs.tierFilter}". Valid tiers: S, A, B, C`))
|
|
1225
|
+
process.exit(1)
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1220
1228
|
// 📖 Load JSON config (auto-migrates old plain-text ~/.free-coding-models if needed)
|
|
1221
1229
|
const config = loadConfig()
|
|
1222
1230
|
|
|
@@ -1452,6 +1460,14 @@ async function main() {
|
|
|
1452
1460
|
state.settingsTestResults[providerKey] = code === '200' ? 'ok' : 'fail'
|
|
1453
1461
|
}
|
|
1454
1462
|
|
|
1463
|
+
// Apply CLI --tier filter if provided
|
|
1464
|
+
if (cliArgs.tierFilter) {
|
|
1465
|
+
const allowed = TIER_LETTER_MAP[cliArgs.tierFilter]
|
|
1466
|
+
state.results.forEach(r => {
|
|
1467
|
+
r.hidden = !allowed.includes(r.tier)
|
|
1468
|
+
})
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1455
1471
|
// 📖 Setup keyboard input for interactive selection during pings
|
|
1456
1472
|
// 📖 Use readline with keypress event for arrow key handling
|
|
1457
1473
|
process.stdin.setEncoding('utf8')
|
|
@@ -1566,7 +1582,7 @@ async function main() {
|
|
|
1566
1582
|
'l': 'ping', 'a': 'avg', 's': 'swe', 'n': 'ctx', 'h': 'condition', 'v': 'verdict', 'u': 'uptime'
|
|
1567
1583
|
}
|
|
1568
1584
|
|
|
1569
|
-
if (sortKeys[key.name]) {
|
|
1585
|
+
if (sortKeys[key.name] && !key.ctrl) {
|
|
1570
1586
|
const col = sortKeys[key.name]
|
|
1571
1587
|
// 📖 Toggle direction if same column, otherwise reset to asc
|
|
1572
1588
|
if (state.sortColumn === col) {
|
package/lib/utils.js
CHANGED
|
@@ -289,9 +289,17 @@ export function parseArgs(argv) {
|
|
|
289
289
|
let apiKey = null
|
|
290
290
|
const flags = []
|
|
291
291
|
|
|
292
|
-
|
|
292
|
+
// Determine which arg index is consumed by --tier so we skip it
|
|
293
|
+
const tierIdx = args.findIndex(a => a.toLowerCase() === '--tier')
|
|
294
|
+
const tierValueIdx = (tierIdx !== -1 && args[tierIdx + 1] && !args[tierIdx + 1].startsWith('--'))
|
|
295
|
+
? tierIdx + 1
|
|
296
|
+
: -1
|
|
297
|
+
|
|
298
|
+
for (const [i, arg] of args.entries()) {
|
|
293
299
|
if (arg.startsWith('--')) {
|
|
294
300
|
flags.push(arg.toLowerCase())
|
|
301
|
+
} else if (i === tierValueIdx) {
|
|
302
|
+
// Skip -- this is the --tier value, not an API key
|
|
295
303
|
} else if (!apiKey) {
|
|
296
304
|
apiKey = arg
|
|
297
305
|
}
|
|
@@ -303,13 +311,7 @@ export function parseArgs(argv) {
|
|
|
303
311
|
const openCodeDesktopMode = flags.includes('--opencode-desktop')
|
|
304
312
|
const openClawMode = flags.includes('--openclaw')
|
|
305
313
|
|
|
306
|
-
|
|
307
|
-
// 📖 If the next arg is another flag (--), treat it as missing value → tierFilter stays null
|
|
308
|
-
let tierFilter = null
|
|
309
|
-
const tierIdx = args.findIndex(a => a.toLowerCase() === '--tier')
|
|
310
|
-
if (tierIdx !== -1 && args[tierIdx + 1] && !args[tierIdx + 1].startsWith('--')) {
|
|
311
|
-
tierFilter = args[tierIdx + 1].toUpperCase()
|
|
312
|
-
}
|
|
314
|
+
let tierFilter = tierValueIdx !== -1 ? args[tierValueIdx].toUpperCase() : null
|
|
313
315
|
|
|
314
316
|
return { apiKey, bestMode, fiableMode, openCodeMode, openCodeDesktopMode, openClawMode, tierFilter }
|
|
315
317
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "free-coding-models",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.48",
|
|
4
4
|
"description": "Find the fastest coding LLM models in seconds — ping free models from multiple providers, pick the best one for OpenCode, Cursor, or any AI coding assistant.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nvidia",
|