free-coding-models 0.5.56 โ 0.5.57
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.
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog v0.5.57 - 2026-07-25
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
- ๐ฆ **`patch-openclaw.js` now finds `sources.js` in more locations** ([#35](https://github.com/vava-nessa/free-coding-models/issues/35)) โ when users copy just `patch-openclaw.js` to another directory (e.g. `~/.free-coding-models/`) and run it, the static `import './sources.js'` failed with `ERR_MODULE_NOT_FOUND` because ESM resolves imports relative to the importer file at parse time. Switched to a runtime search over multiple candidate paths:
|
|
5
|
+
|
|
6
|
+
1. Same directory as the script (primary โ FCM source / global install layout)
|
|
7
|
+
2. Parent directory (covers `tools/`-style subdirs)
|
|
8
|
+
3. Two levels up
|
|
9
|
+
4. Three levels up
|
|
10
|
+
5. `process.cwd()` (last-resort fallback)
|
|
11
|
+
|
|
12
|
+
If none resolve, the script now prints a clear error pointing to the script's actual location and how to fix it, instead of a cryptic `ERR_MODULE_NOT_FOUND`.
|
|
13
|
+
|
|
14
|
+
### Maintenance
|
|
15
|
+
- ๐งช **+1 unit test** (`test/patch-openclaw.test.js`) locking in the search order so any future reordering is caught.
|
|
16
|
+
- ๐งช **592/592 tests pass** (`pnpm test`).
|
|
17
|
+
- ๐งน `vite build` succeeds.
|
|
18
|
+
|
|
19
|
+
### Why a top-level `await import()`?
|
|
20
|
+
ESM `import './sources.js'` is resolved at parse-time relative to the importer file's directory. There's no way to fall back at parse time, so the only way to support multiple candidate paths is to compute the path at runtime and use dynamic `import(pathToFileURL(sourcesPath).href)`. Top-level `await` keeps the rest of the script's top-level statements unchanged.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "free-coding-models",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.57",
|
|
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",
|
package/patch-openclaw.js
CHANGED
|
@@ -9,8 +9,39 @@
|
|
|
9
9
|
|
|
10
10
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs'
|
|
11
11
|
import { homedir } from 'os'
|
|
12
|
-
import { join } from 'path'
|
|
13
|
-
import {
|
|
12
|
+
import { join, dirname } from 'path'
|
|
13
|
+
import { fileURLToPath, pathToFileURL } from 'url'
|
|
14
|
+
|
|
15
|
+
// ๐ Issue #35: when users copy just patch-openclaw.js to another directory
|
|
16
|
+
// ๐ (e.g. ~/.free-coding-models/) and try to run it, the relative import of
|
|
17
|
+
// ๐ sources.js fails with ERR_MODULE_NOT_FOUND. Look up the tree + check CWD
|
|
18
|
+
// ๐ before giving up with a helpful message.
|
|
19
|
+
const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url))
|
|
20
|
+
|
|
21
|
+
function findSourcesPath() {
|
|
22
|
+
const candidates = [
|
|
23
|
+
join(SCRIPT_DIR, 'sources.js'),
|
|
24
|
+
join(SCRIPT_DIR, '..', 'sources.js'),
|
|
25
|
+
join(SCRIPT_DIR, '..', '..', 'sources.js'),
|
|
26
|
+
join(SCRIPT_DIR, '..', '..', '..', 'sources.js'),
|
|
27
|
+
join(process.cwd(), 'sources.js'),
|
|
28
|
+
]
|
|
29
|
+
for (const p of candidates) {
|
|
30
|
+
if (existsSync(p)) return p
|
|
31
|
+
}
|
|
32
|
+
return null
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const sourcesPath = findSourcesPath()
|
|
36
|
+
if (!sourcesPath) {
|
|
37
|
+
console.error(' โ Could not locate sources.js next to this script.')
|
|
38
|
+
console.error(` Script location: ${SCRIPT_DIR}`)
|
|
39
|
+
console.error(' Make sure sources.js is in the same directory as patch-openclaw.js,')
|
|
40
|
+
console.error(' or run this from the free-coding-models repo root.')
|
|
41
|
+
process.exit(1)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const { nvidiaNim } = await import(pathToFileURL(sourcesPath).href)
|
|
14
45
|
|
|
15
46
|
const MODELS_JSON = join(homedir(), '.openclaw', 'agents', 'main', 'agent', 'models.json')
|
|
16
47
|
const OPENCLAW_JSON = join(homedir(), '.openclaw', 'openclaw.json')
|