modelfunction-cli 0.4.3 → 0.4.4

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 (3) hide show
  1. package/README.md +3 -3
  2. package/mf.js +11 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ## 安装
6
6
 
7
7
  ```bash
8
- npx -y modelfunction-cli@0.4.3 --version
8
+ npx -y modelfunction-cli@0.4.4 --version
9
9
  # 或
10
10
  npm i -D modelfunction-cli
11
11
  npx mf --version
@@ -111,7 +111,7 @@ mf eval --suite mf.suite.json --models internal-ds \
111
111
  "mcpServers": {
112
112
  "modelfunction": {
113
113
  "command": "npx",
114
- "args": ["-y", "modelfunction-cli@0.4.3", "mcp"]
114
+ "args": ["-y", "modelfunction-cli@0.4.4", "mcp"]
115
115
  }
116
116
  }
117
117
  }
@@ -137,7 +137,7 @@ mf eval --suite mf.suite.json --models internal-ds \
137
137
 
138
138
  ```bash
139
139
  # 1. 把 mf 挂成 MCP server
140
- claude mcp add modelfunction -- npx -y modelfunction-cli@0.4.3 mcp
140
+ claude mcp add modelfunction -- npx -y modelfunction-cli@0.4.4 mcp
141
141
  ```
142
142
 
143
143
  ```text
package/mf.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { realpathSync } from "node:fs";
2
3
  import { readFile } from "node:fs/promises";
3
4
  import { basename, dirname, extname, relative, resolve } from "node:path";
4
5
  import { fileURLToPath } from "node:url";
@@ -795,7 +796,16 @@ function splitList(value) {
795
796
  return value.split(",").map((item) => item.trim()).filter(Boolean);
796
797
  }
797
798
 
798
- const isMain = process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url);
799
+ // pnpm installs packages through symlinks; Node resolves ESM to the real
800
+ // path, so a plain resolve(argv[1]) mismatch makes the CLI exit silently.
801
+ const isMain = (() => {
802
+ if (!process.argv[1]) return false;
803
+ try {
804
+ return realpathSync(resolve(process.argv[1])) === realpathSync(fileURLToPath(import.meta.url));
805
+ } catch {
806
+ return false;
807
+ }
808
+ })();
799
809
 
800
810
  if (isMain) {
801
811
  let argv = process.argv.slice(2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "modelfunction-cli",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "mf — function-calling accuracy scorecard for AI agents",