ocai-search-agent-skill 0.1.21 → 0.1.22

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,82 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // 跨平台入口:不要在 Windows 依赖 bash。
5
+ // 这里直接用 Python 运行 ocai_cli.py,并透传参数给它。
6
+
7
+ const path = require("path");
8
+ const { spawnSync } = require("child_process");
9
+
10
+ const SCRIPT_DIR = path.resolve(__dirname);
11
+ const CLI_PY = path.join(
12
+ SCRIPT_DIR,
13
+ "skills",
14
+ "research-collect-orchestrator",
15
+ "scripts",
16
+ "ocai_cli.py"
17
+ );
18
+ const REQ_PATH = path.join(
19
+ SCRIPT_DIR,
20
+ "skills",
21
+ "research-collect-orchestrator",
22
+ "deps",
23
+ "requirements.txt"
24
+ );
25
+
26
+ function detectPython(explicit) {
27
+ if (explicit) {
28
+ // 显式传入 OCAI_PYTHON 直接当作 python 可执行文件(不支持额外参数)。
29
+ return { exe: explicit, baseArgs: [] };
30
+ }
31
+
32
+ const candidates =
33
+ process.platform === "win32"
34
+ ? [
35
+ // 与 ocai.ps1 保持一致的优先级:python -> py -3 -> python3 -> python
36
+ { exe: "python", baseArgs: [] },
37
+ { exe: "py", baseArgs: ["-3"] },
38
+ { exe: "python3", baseArgs: [] },
39
+ { exe: "python", baseArgs: [] },
40
+ ]
41
+ : [
42
+ { exe: "python3", baseArgs: [] },
43
+ { exe: "python", baseArgs: [] },
44
+ ];
45
+
46
+ for (const c of candidates) {
47
+ const r = spawnSync(
48
+ c.exe,
49
+ [...c.baseArgs, "-c", "import sys; print(sys.version)"],
50
+ {
51
+ stdio: "ignore",
52
+ }
53
+ );
54
+ if (r.status === 0) return c;
55
+ }
56
+
57
+ throw new Error("未找到 Python,请先安装 Python 3.10+ 并加入 PATH。");
58
+ }
59
+
60
+ function run(cmd, args) {
61
+ const r = spawnSync(cmd, args, { stdio: "inherit" });
62
+ const code = typeof r.status === "number" ? r.status : 1;
63
+ process.exit(code);
64
+ }
65
+
66
+ function main() {
67
+ const explicit = process.env.OCAI_PYTHON || null;
68
+ const { exe, baseArgs } = detectPython(explicit);
69
+
70
+ const args = process.argv.slice(2);
71
+ if (args.length > 0 && args[0] === "install-env") {
72
+ // 兼容原 ocai.ps1:用 pip 安装依赖
73
+ run(exe, [...baseArgs, "-m", "pip", "install", "-r", REQ_PATH]);
74
+ return;
75
+ }
76
+
77
+ // 把所有参数透传给 python 脚本(init/doctor/collect/...)
78
+ run(exe, [...baseArgs, CLI_PY, ...args]);
79
+ }
80
+
81
+ main();
82
+
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "ocai-search-agent-skill",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "OCAI collection skill and CLI for MCP-based collection workflows.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
7
7
  "bin": {
8
- "ocai": "ocai-skill/ocai",
9
- "ocai-search-agent-skill": "ocai-skill/ocai",
8
+ "ocai": "ocai-skill/ocai-entry.cjs",
9
+ "ocai-search-agent-skill": "ocai-skill/ocai-entry.cjs",
10
10
  "ocai-mcp-setup": "scripts/ocai-mcp-setup.cjs"
11
11
  },
12
12
  "scripts": {
@@ -21,6 +21,7 @@
21
21
  ".cursor/skills/ocai-project-collector/SKILL.md",
22
22
  "ocai-skill/ocai",
23
23
  "ocai-skill/ocai.ps1",
24
+ "ocai-skill/ocai-entry.cjs",
24
25
  "ocai-skill/scripts/ocai-init.sh",
25
26
  "ocai-skill/skills/research-collect-orchestrator/SKILL.md",
26
27
  "ocai-skill/skills/research-collect-orchestrator/docs/reference.md",