@reconcrap/boss-recommend-mcp 1.0.3 → 1.0.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.
- package/README.md +1 -0
- package/package.json +1 -1
- package/src/adapters.js +45 -2
package/README.md
CHANGED
|
@@ -90,6 +90,7 @@ npx -y @reconcrap/boss-recommend-mcp@latest run --instruction "推荐页筛选98
|
|
|
90
90
|
注意:
|
|
91
91
|
|
|
92
92
|
- `install` / `postinstall` 会自动创建 `screening-config.json` 模板(若目标路径可写)
|
|
93
|
+
- 当当前目录是系统目录(例如 `C:\\Windows\\System32`)、用户主目录根(例如 `C:\\Users\\<name>`)或磁盘根目录时,不会再写入 `<cwd>/config`,而是回退到 `~/.boss-recommend-mcp/screening-config.json`
|
|
93
94
|
- 首次运行时,若仍检测到默认占位词(如 `replace-with-openai-api-key`),pipeline 会返回配置目录并要求用户修改后确认“已修改完成”再继续
|
|
94
95
|
- 在 `npx` 临时目录(如 `AppData\\Local\\npm-cache\\_npx\\...`)执行时,不会再把该临时目录当作 `screening-config.json` 目标路径
|
|
95
96
|
|
package/package.json
CHANGED
package/src/adapters.js
CHANGED
|
@@ -58,9 +58,50 @@ function parsePositiveInteger(raw) {
|
|
|
58
58
|
return Number.isFinite(value) && value > 0 ? value : null;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
function isRootDirectory(targetPath) {
|
|
62
|
+
const resolved = path.resolve(String(targetPath || ""));
|
|
63
|
+
const parsed = path.parse(resolved);
|
|
64
|
+
return resolved.toLowerCase() === String(parsed.root || "").toLowerCase();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function isSystemDirectoryWorkspaceRoot(workspaceRoot) {
|
|
68
|
+
const root = path.resolve(String(workspaceRoot || ""));
|
|
69
|
+
const normalized = root.replace(/\\/g, "/").toLowerCase();
|
|
70
|
+
if (process.platform === "win32") {
|
|
71
|
+
return (
|
|
72
|
+
normalized.endsWith("/windows")
|
|
73
|
+
|| normalized.endsWith("/windows/system32")
|
|
74
|
+
|| normalized.endsWith("/windows/syswow64")
|
|
75
|
+
|| normalized.endsWith("/program files")
|
|
76
|
+
|| normalized.endsWith("/program files (x86)")
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
return (
|
|
80
|
+
normalized === "/system"
|
|
81
|
+
|| normalized.startsWith("/system/")
|
|
82
|
+
|| normalized === "/usr"
|
|
83
|
+
|| normalized.startsWith("/usr/")
|
|
84
|
+
|| normalized === "/bin"
|
|
85
|
+
|| normalized.startsWith("/bin/")
|
|
86
|
+
|| normalized === "/sbin"
|
|
87
|
+
|| normalized.startsWith("/sbin/")
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function shouldIgnoreWorkspaceConfigRoot(workspaceRoot) {
|
|
92
|
+
const root = path.resolve(String(workspaceRoot || process.cwd()));
|
|
93
|
+
const home = path.resolve(os.homedir());
|
|
94
|
+
return (
|
|
95
|
+
isEphemeralNpxWorkspaceRoot(root)
|
|
96
|
+
|| isRootDirectory(root)
|
|
97
|
+
|| root.toLowerCase() === home.toLowerCase()
|
|
98
|
+
|| isSystemDirectoryWorkspaceRoot(root)
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
61
102
|
function resolveWorkspaceConfigCandidates(workspaceRoot) {
|
|
62
103
|
const root = path.resolve(String(workspaceRoot || process.cwd()));
|
|
63
|
-
if (
|
|
104
|
+
if (shouldIgnoreWorkspaceConfigRoot(root)) {
|
|
64
105
|
return [];
|
|
65
106
|
}
|
|
66
107
|
const directPath = path.join(root, "config", "screening-config.json");
|
|
@@ -174,11 +215,13 @@ export function getScreenConfigResolution(workspaceRoot) {
|
|
|
174
215
|
const candidateMap = buildScreenConfigCandidateMap(workspaceRoot);
|
|
175
216
|
const candidate_paths = resolveScreenConfigCandidates(workspaceRoot);
|
|
176
217
|
const resolved_path = resolveScreenConfigPath(workspaceRoot) || null;
|
|
218
|
+
const workspace_root = path.resolve(String(workspaceRoot || process.cwd()));
|
|
177
219
|
return {
|
|
178
220
|
resolved_path,
|
|
179
221
|
candidate_paths,
|
|
180
|
-
workspace_root
|
|
222
|
+
workspace_root,
|
|
181
223
|
workspace_ephemeral: isEphemeralNpxWorkspaceRoot(workspaceRoot),
|
|
224
|
+
workspace_ignored_for_config: shouldIgnoreWorkspaceConfigRoot(workspace_root),
|
|
182
225
|
writable_path: resolveWritableScreenConfigPath(workspaceRoot),
|
|
183
226
|
legacy_path: candidateMap.legacy_path
|
|
184
227
|
};
|