@reconcrap/boss-recommend-mcp 0.1.10 → 0.1.11

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/README.md CHANGED
@@ -82,6 +82,7 @@ node src/cli.js run --instruction "推荐页筛选985男生,近14天没有,
82
82
 
83
83
  - `install` 阶段不会自动创建 `screening-config.json`
84
84
  - 首次运行若缺配置,会由 doctor / pipeline 明确提示用户填写 `baseUrl`、`apiKey`、`model`
85
+ - 在 `npx` 临时目录(如 `AppData\\Local\\npm-cache\\_npx\\...`)执行时,不会再把该临时目录当作 `screening-config.json` 目标路径
85
86
 
86
87
  配置样例见:
87
88
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reconcrap/boss-recommend-mcp",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Unified MCP pipeline for recommend-page filtering and screening on Boss Zhipin",
5
5
  "keywords": [
6
6
  "boss",
package/src/adapters.js CHANGED
@@ -60,6 +60,9 @@ function parsePositiveInteger(raw) {
60
60
 
61
61
  function resolveWorkspaceConfigCandidates(workspaceRoot) {
62
62
  const root = path.resolve(String(workspaceRoot || process.cwd()));
63
+ if (isEphemeralNpxWorkspaceRoot(root)) {
64
+ return [];
65
+ }
63
66
  const directPath = path.join(root, "config", "screening-config.json");
64
67
  const nestedPath = path.join(root, "boss-recommend-mcp", "config", "screening-config.json");
65
68
  const candidates = [directPath];
@@ -93,16 +96,13 @@ function serializeSchoolTagSelection(value) {
93
96
  return normalized || "不限";
94
97
  }
95
98
 
96
- function canWriteConfigPath(filePath) {
97
- if (!filePath) return false;
98
- try {
99
- const dirPath = path.dirname(filePath);
100
- ensureDir(dirPath);
101
- fs.accessSync(dirPath, fs.constants.W_OK);
102
- return true;
103
- } catch {
104
- return false;
105
- }
99
+ function isEphemeralNpxWorkspaceRoot(workspaceRoot) {
100
+ const root = path.resolve(String(workspaceRoot || ""));
101
+ const normalized = root.replace(/\\/g, "/").toLowerCase();
102
+ return (
103
+ normalized.includes("/appdata/local/npm-cache/_npx/")
104
+ || normalized.includes("/node_modules/@reconcrap/boss-recommend-mcp")
105
+ );
106
106
  }
107
107
 
108
108
  function buildScreenConfigCandidateMap(workspaceRoot) {
@@ -135,14 +135,7 @@ function resolveScreenConfigPath(workspaceRoot) {
135
135
  if (existingWorkspacePath) {
136
136
  return existingWorkspacePath;
137
137
  }
138
- if (canWriteConfigPath(candidateMap.user_path)) {
139
- return candidateMap.user_path;
140
- }
141
- const writableWorkspacePath = candidateMap.workspace_paths.find((item) => canWriteConfigPath(item));
142
- if (writableWorkspacePath) {
143
- return writableWorkspacePath;
144
- }
145
- // 默认固定写入/读取 Agent 无关路径,避免意外落到 .codex 旧路径。
138
+ // 默认固定写入/读取 Agent 无关路径,避免落到 npx 临时目录或 .codex 旧路径。
146
139
  if (candidateMap.user_path) {
147
140
  return candidateMap.user_path;
148
141
  }
@@ -156,6 +149,8 @@ export function getScreenConfigResolution(workspaceRoot) {
156
149
  return {
157
150
  resolved_path,
158
151
  candidate_paths,
152
+ workspace_root: path.resolve(String(workspaceRoot || process.cwd())),
153
+ workspace_ephemeral: isEphemeralNpxWorkspaceRoot(workspaceRoot),
159
154
  writable_path: candidateMap.user_path,
160
155
  legacy_path: candidateMap.legacy_path
161
156
  };