pluriply 0.1.0 → 0.3.0

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.
@@ -1,79 +1,37 @@
1
1
  import { execFileSync } from "node:child_process";
2
- import { agyCommand } from "./agy.js";
2
+ import { CLIENTS, MCP_REGISTRARS, makeEnv } from "../setup/clients.js";
3
3
 
4
- /**
5
- * 도구별 pluriply MCP 서버 등록 명령. `list`로 이미 등록됐는지 보고 없으면 `add`한다.
6
- * claude-code 는 워커 템플릿이 --mcp-config 로 인라인 등록하므로 여기 없다.
7
- * @type {Record<string, {label: string, list: string[], add: (node: string, bin: string) => string[], hint: (bin: string) => string}>}
8
- */
9
- export const MCP_REGISTRARS = {
10
- codex: {
11
- label: "Codex",
12
- list: ["codex", "mcp", "list"],
13
- add: (node, bin) => [
14
- "codex",
15
- "mcp",
16
- "add",
17
- "pluriply",
18
- "--",
19
- node,
20
- bin,
21
- "connector",
22
- "--agent",
23
- "codex",
24
- ],
25
- hint: (bin) =>
26
- `codex mcp add pluriply -- node "${bin}" connector --agent codex`,
27
- },
28
- antigravity: {
29
- label: "Antigravity CLI",
30
- // agy mcp add 는 user 스코프가 기본이다. `--` 는 필수: 뒤의 명령·인자가 `-` 로 시작할 수
31
- // 있고(--agent), 플래그는 <name> 앞에만 올 수 있다(agy mcp add --help).
32
- list: [agyCommand(), "mcp", "list"],
33
- add: (node, bin) => [
34
- agyCommand(),
35
- "mcp",
36
- "add",
37
- "pluriply",
38
- "--",
39
- node,
40
- bin,
41
- "connector",
42
- "--agent",
43
- "antigravity",
44
- ],
45
- hint: (bin) =>
46
- `agy mcp add pluriply -- node "${bin}" connector --agent antigravity`,
47
- },
48
- };
4
+ /** 등록 명령표는 src/setup/clients.js 로 옮겼다. 기존 import 경로를 위해 재수출한다. */
5
+ export { MCP_REGISTRARS };
49
6
 
50
7
  /**
51
8
  * `pluriply worker enable <agent>` 가 부른다. 실패해도 던지지 않는다(enable 자체는 성공).
9
+ * 실제 등록(타임아웃 쓰기 포함)은 `pluriply setup` 과 같은 어댑터가 한다. claude-code 는 워커
10
+ * 템플릿이 --mcp-config 로 인라인 등록하므로 여기서는 "none".
52
11
  * @param {string} agent
53
- * @param {{binPath: string, exec?: typeof execFileSync, log?: (msg: string) => void, env?: NodeJS.ProcessEnv}} deps
12
+ * @param {{binPath: string, exec?: typeof execFileSync, log?: (msg: string) => void, env?: NodeJS.ProcessEnv, homeDir?: string}} deps
54
13
  * @returns {"registered"|"present"|"skipped"|"failed"|"none"}
55
14
  */
56
15
  export function registerMcpServer(
57
16
  agent,
58
- { binPath, exec = execFileSync, log = console.log, env = process.env },
17
+ {
18
+ binPath,
19
+ exec = execFileSync,
20
+ log = console.log,
21
+ env = process.env,
22
+ homeDir,
23
+ },
59
24
  ) {
60
- const r = MCP_REGISTRARS[agent];
61
- if (!r) return "none";
62
- // PLURIPLY_SKIP_CODEX_MCP 는 Plan 2c 때 이름이라 호환으로 남긴다.
63
- if (env.PLURIPLY_SKIP_MCP_REGISTER || env.PLURIPLY_SKIP_CODEX_MCP)
64
- return "skipped";
65
- try {
66
- const [cmd, ...args] = r.list;
67
- const list = exec(cmd, args, { stdio: "pipe" }).toString();
68
- if (list.includes("pluriply")) return "present";
69
- const [addCmd, ...addArgs] = r.add(process.execPath, binPath);
70
- exec(addCmd, addArgs, { stdio: "pipe" });
71
- log(`registered pluriply MCP server in ${r.label}`);
72
- return "registered";
73
- } catch {
74
- log(
75
- `hint: make sure ${r.label} has pluriply registered: ${r.hint(binPath)}`,
76
- );
77
- return "failed";
78
- }
25
+ if (!MCP_REGISTRARS[agent]) return "none";
26
+ const client = CLIENTS.find((c) => c.agent === agent);
27
+ const r = client.register(
28
+ makeEnv({
29
+ binPath,
30
+ exec,
31
+ log,
32
+ processEnv: env,
33
+ ...(homeDir ? { homeDir } : {}),
34
+ }),
35
+ );
36
+ return r.startsWith("failed") ? "failed" : r;
79
37
  }