@ken-jo/agent-connector 0.1.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.
Files changed (203) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +6 -0
  3. package/README.md +348 -0
  4. package/dist/amp-QSFH2V7Y.js +217 -0
  5. package/dist/amp-QSFH2V7Y.js.map +1 -0
  6. package/dist/amp-TULUPXXL.js +237 -0
  7. package/dist/amp-TULUPXXL.js.map +1 -0
  8. package/dist/antigravity-CX2YLSY7.js +17 -0
  9. package/dist/antigravity-CX2YLSY7.js.map +1 -0
  10. package/dist/antigravity-STHZWMP3.js +171 -0
  11. package/dist/antigravity-STHZWMP3.js.map +1 -0
  12. package/dist/antigravity-cli-P6HADOAO.js +121 -0
  13. package/dist/antigravity-cli-P6HADOAO.js.map +1 -0
  14. package/dist/antigravity-cli-YQDFVV4U.js +86 -0
  15. package/dist/antigravity-cli-YQDFVV4U.js.map +1 -0
  16. package/dist/chunk-54EMKTTX.js +191 -0
  17. package/dist/chunk-54EMKTTX.js.map +1 -0
  18. package/dist/chunk-7L6ITC4T.js +54 -0
  19. package/dist/chunk-7L6ITC4T.js.map +1 -0
  20. package/dist/chunk-7MSDGHJW.js +316 -0
  21. package/dist/chunk-7MSDGHJW.js.map +1 -0
  22. package/dist/chunk-BCHWFTV4.js +196 -0
  23. package/dist/chunk-BCHWFTV4.js.map +1 -0
  24. package/dist/chunk-DBQMX75U.js +36 -0
  25. package/dist/chunk-DBQMX75U.js.map +1 -0
  26. package/dist/chunk-EXLS7BSI.js +29 -0
  27. package/dist/chunk-EXLS7BSI.js.map +1 -0
  28. package/dist/chunk-JNM3TPLX.js +593 -0
  29. package/dist/chunk-JNM3TPLX.js.map +1 -0
  30. package/dist/chunk-JWNT5KW7.js +197 -0
  31. package/dist/chunk-JWNT5KW7.js.map +1 -0
  32. package/dist/chunk-KHO5WNTP.js +30 -0
  33. package/dist/chunk-KHO5WNTP.js.map +1 -0
  34. package/dist/chunk-LTT56GI3.js +155 -0
  35. package/dist/chunk-LTT56GI3.js.map +1 -0
  36. package/dist/chunk-MEH7GC7R.js +111 -0
  37. package/dist/chunk-MEH7GC7R.js.map +1 -0
  38. package/dist/chunk-MQPNU2CY.js +64 -0
  39. package/dist/chunk-MQPNU2CY.js.map +1 -0
  40. package/dist/chunk-OPXAP3AC.js +12 -0
  41. package/dist/chunk-OPXAP3AC.js.map +1 -0
  42. package/dist/chunk-RK6VBLXP.js +50 -0
  43. package/dist/chunk-RK6VBLXP.js.map +1 -0
  44. package/dist/chunk-TIIP3RG2.js +420 -0
  45. package/dist/chunk-TIIP3RG2.js.map +1 -0
  46. package/dist/chunk-TRKWUNO4.js +702 -0
  47. package/dist/chunk-TRKWUNO4.js.map +1 -0
  48. package/dist/chunk-TRQKHP7D.js +93 -0
  49. package/dist/chunk-TRQKHP7D.js.map +1 -0
  50. package/dist/chunk-WCETQWWK.js +59 -0
  51. package/dist/chunk-WCETQWWK.js.map +1 -0
  52. package/dist/chunk-WV63X7IK.js +357 -0
  53. package/dist/chunk-WV63X7IK.js.map +1 -0
  54. package/dist/chunk-XD7MY6HB.js +343 -0
  55. package/dist/chunk-XD7MY6HB.js.map +1 -0
  56. package/dist/chunk-XNAM7F35.js +276 -0
  57. package/dist/chunk-XNAM7F35.js.map +1 -0
  58. package/dist/chunk-XUCWLJY5.js +238 -0
  59. package/dist/chunk-XUCWLJY5.js.map +1 -0
  60. package/dist/chunk-YNZU6PAV.js +800 -0
  61. package/dist/chunk-YNZU6PAV.js.map +1 -0
  62. package/dist/chunk-YT43MUSJ.js +146 -0
  63. package/dist/chunk-YT43MUSJ.js.map +1 -0
  64. package/dist/claude-code-HKDV7T32.js +637 -0
  65. package/dist/claude-code-HKDV7T32.js.map +1 -0
  66. package/dist/claude-code-W74MNTAC.js +652 -0
  67. package/dist/claude-code-W74MNTAC.js.map +1 -0
  68. package/dist/cli/sdk.d.ts +54 -0
  69. package/dist/cli/sdk.js +82 -0
  70. package/dist/cli/sdk.js.map +1 -0
  71. package/dist/cli.d.ts +2 -0
  72. package/dist/cli.js +15 -0
  73. package/dist/cli.js.map +1 -0
  74. package/dist/codebuff-3PMZJJHP.js +307 -0
  75. package/dist/codebuff-3PMZJJHP.js.map +1 -0
  76. package/dist/codebuff-QX57FJDN.js +220 -0
  77. package/dist/codebuff-QX57FJDN.js.map +1 -0
  78. package/dist/codex-JFQTS6LU.js +593 -0
  79. package/dist/codex-JFQTS6LU.js.map +1 -0
  80. package/dist/codex-Q3ATRRX3.js +364 -0
  81. package/dist/codex-Q3ATRRX3.js.map +1 -0
  82. package/dist/copilot-cli-MTCGHZ2T.js +622 -0
  83. package/dist/copilot-cli-MTCGHZ2T.js.map +1 -0
  84. package/dist/copilot-cli-SJGIXVSD.js +369 -0
  85. package/dist/copilot-cli-SJGIXVSD.js.map +1 -0
  86. package/dist/crush-I7PK3FGI.js +360 -0
  87. package/dist/crush-I7PK3FGI.js.map +1 -0
  88. package/dist/crush-LN5QFFR2.js +183 -0
  89. package/dist/crush-LN5QFFR2.js.map +1 -0
  90. package/dist/cursor-4TMXKJOZ.js +603 -0
  91. package/dist/cursor-4TMXKJOZ.js.map +1 -0
  92. package/dist/cursor-QZ6MTO74.js +194 -0
  93. package/dist/cursor-QZ6MTO74.js.map +1 -0
  94. package/dist/detect-WIAGVYS4.js +68 -0
  95. package/dist/detect-WIAGVYS4.js.map +1 -0
  96. package/dist/doctor-EZW2K4NI.js +372 -0
  97. package/dist/doctor-EZW2K4NI.js.map +1 -0
  98. package/dist/droid-KN6VRMMT.js +424 -0
  99. package/dist/droid-KN6VRMMT.js.map +1 -0
  100. package/dist/droid-W5WF5XEX.js +224 -0
  101. package/dist/droid-W5WF5XEX.js.map +1 -0
  102. package/dist/gemini-cli-CIRW37TU.js +369 -0
  103. package/dist/gemini-cli-CIRW37TU.js.map +1 -0
  104. package/dist/gemini-cli-Y35FFK4M.js +705 -0
  105. package/dist/gemini-cli-Y35FFK4M.js.map +1 -0
  106. package/dist/goose-A3M5GODH.js +212 -0
  107. package/dist/goose-A3M5GODH.js.map +1 -0
  108. package/dist/goose-ZTGTSUFJ.js +480 -0
  109. package/dist/goose-ZTGTSUFJ.js.map +1 -0
  110. package/dist/hermes-H2KV44GK.js +470 -0
  111. package/dist/hermes-H2KV44GK.js.map +1 -0
  112. package/dist/hermes-ZYLMOFLZ.js +196 -0
  113. package/dist/hermes-ZYLMOFLZ.js.map +1 -0
  114. package/dist/hook-YVDILAMZ.js +75 -0
  115. package/dist/hook-YVDILAMZ.js.map +1 -0
  116. package/dist/index.d.ts +22 -0
  117. package/dist/index.js +10 -0
  118. package/dist/index.js.map +1 -0
  119. package/dist/install-HQRYZOQ2.js +60 -0
  120. package/dist/install-HQRYZOQ2.js.map +1 -0
  121. package/dist/jetbrains-copilot-HWA3DMH7.js +633 -0
  122. package/dist/jetbrains-copilot-HWA3DMH7.js.map +1 -0
  123. package/dist/kilo-NSWAVP6P.js +235 -0
  124. package/dist/kilo-NSWAVP6P.js.map +1 -0
  125. package/dist/kilo-QXJRCSLT.js +384 -0
  126. package/dist/kilo-QXJRCSLT.js.map +1 -0
  127. package/dist/kilo-cli-EAQTHXUW.js +587 -0
  128. package/dist/kilo-cli-EAQTHXUW.js.map +1 -0
  129. package/dist/kilo-cli-EVBKUODA.js +160 -0
  130. package/dist/kilo-cli-EVBKUODA.js.map +1 -0
  131. package/dist/kimi-EI3UM3ZV.js +155 -0
  132. package/dist/kimi-EI3UM3ZV.js.map +1 -0
  133. package/dist/kimi-GQ7VXNYT.js +423 -0
  134. package/dist/kimi-GQ7VXNYT.js.map +1 -0
  135. package/dist/kiro-UCLSLBW2.js +217 -0
  136. package/dist/kiro-UCLSLBW2.js.map +1 -0
  137. package/dist/kiro-VQTT6LO2.js +451 -0
  138. package/dist/kiro-VQTT6LO2.js.map +1 -0
  139. package/dist/leaderboard-K6ON3SWW.js +137 -0
  140. package/dist/leaderboard-K6ON3SWW.js.map +1 -0
  141. package/dist/mux-T2TV4CIQ.js +211 -0
  142. package/dist/mux-T2TV4CIQ.js.map +1 -0
  143. package/dist/mux-ZMLVAXOO.js +96 -0
  144. package/dist/mux-ZMLVAXOO.js.map +1 -0
  145. package/dist/omp-PB4VDKS6.js +586 -0
  146. package/dist/omp-PB4VDKS6.js.map +1 -0
  147. package/dist/openclaw-ETN2M63O.js +751 -0
  148. package/dist/openclaw-ETN2M63O.js.map +1 -0
  149. package/dist/openclaw-IYA7ASL6.js +150 -0
  150. package/dist/openclaw-IYA7ASL6.js.map +1 -0
  151. package/dist/opencode-FZ33JKUZ.js +734 -0
  152. package/dist/opencode-FZ33JKUZ.js.map +1 -0
  153. package/dist/opencode-HWT3RSMN.js +216 -0
  154. package/dist/opencode-HWT3RSMN.js.map +1 -0
  155. package/dist/package-DLOVE2E4.js +1132 -0
  156. package/dist/package-DLOVE2E4.js.map +1 -0
  157. package/dist/pi-CIU2QHT4.js +208 -0
  158. package/dist/pi-CIU2QHT4.js.map +1 -0
  159. package/dist/pi-UFX2OYFV.js +139 -0
  160. package/dist/pi-UFX2OYFV.js.map +1 -0
  161. package/dist/qwen-code-5POCNU6P.js +573 -0
  162. package/dist/qwen-code-5POCNU6P.js.map +1 -0
  163. package/dist/qwen-code-W7NUCDEN.js +134 -0
  164. package/dist/qwen-code-W7NUCDEN.js.map +1 -0
  165. package/dist/roo-code-IOIUXRDE.js +242 -0
  166. package/dist/roo-code-IOIUXRDE.js.map +1 -0
  167. package/dist/roo-code-ZLKH4A7N.js +229 -0
  168. package/dist/roo-code-ZLKH4A7N.js.map +1 -0
  169. package/dist/runtime/index.d.ts +157 -0
  170. package/dist/runtime/index.js +20 -0
  171. package/dist/runtime/index.js.map +1 -0
  172. package/dist/serve-HVWWY4B6.js +65 -0
  173. package/dist/serve-HVWWY4B6.js.map +1 -0
  174. package/dist/status-FE7TECZD.js +128 -0
  175. package/dist/status-FE7TECZD.js.map +1 -0
  176. package/dist/synthetic-UKR6SMGS.js +178 -0
  177. package/dist/synthetic-UKR6SMGS.js.map +1 -0
  178. package/dist/telemetry-36GESKQQ.js +349 -0
  179. package/dist/telemetry-36GESKQQ.js.map +1 -0
  180. package/dist/trae-JSNDZFKL.js +204 -0
  181. package/dist/trae-JSNDZFKL.js.map +1 -0
  182. package/dist/trae-PA26DPBW.js +157 -0
  183. package/dist/trae-PA26DPBW.js.map +1 -0
  184. package/dist/types-CYUB1OTr.d.ts +427 -0
  185. package/dist/uninstall-IGCKNOSF.js +72 -0
  186. package/dist/uninstall-IGCKNOSF.js.map +1 -0
  187. package/dist/upgrade-JV2VK242.js +104 -0
  188. package/dist/upgrade-JV2VK242.js.map +1 -0
  189. package/dist/usage-6ER6EMEY.js +324 -0
  190. package/dist/usage-6ER6EMEY.js.map +1 -0
  191. package/dist/usage-event-JKBI6XCF.js +48 -0
  192. package/dist/usage-event-JKBI6XCF.js.map +1 -0
  193. package/dist/vscode-copilot-CK3NO54M.js +715 -0
  194. package/dist/vscode-copilot-CK3NO54M.js.map +1 -0
  195. package/dist/warp-JNQA7PBU.js +126 -0
  196. package/dist/warp-JNQA7PBU.js.map +1 -0
  197. package/dist/warp-QNVDXOG4.js +199 -0
  198. package/dist/warp-QNVDXOG4.js.map +1 -0
  199. package/dist/zed-NNNX5MNT.js +272 -0
  200. package/dist/zed-NNNX5MNT.js.map +1 -0
  201. package/dist/zed-VRJKWYUR.js +209 -0
  202. package/dist/zed-VRJKWYUR.js.map +1 -0
  203. package/package.json +79 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/app.ts"],"sourcesContent":["/**\n * cli/app — shared CLI helpers + command dispatch (NO side effects).\n *\n * Command modules import the shared helpers (print, fail, parse-flags,\n * renderInstallResult) from here, and main() dispatches the first positional to a\n * command module.\n * This module never auto-runs — `cli/index.ts` is the thin bin entry that calls\n * `main()`. Keeping the auto-run out of here is what prevents a dispatch recursion\n * (a command module importing a helper must not re-trigger the program) and makes\n * it robust to bundler entry-splitting (the old import.meta.url entry-guard broke\n * once tsup hoisted this code into a shared chunk).\n */\n\nimport { createRequire } from \"node:module\";\n\nimport type {\n ChangeRecord,\n InstallResult,\n InstallScope,\n PlatformId,\n} from \"../core/types.js\";\n\n// ─────────────────────────────────────────────────────────────────────────\n// Shared helpers (imported by the command modules)\n// ─────────────────────────────────────────────────────────────────────────\n\n/** Print a line to stdout (machine-readable payloads must stay on stdout). */\nexport function print(line: string): void {\n process.stdout.write(`${line}\\n`);\n}\n\n/**\n * The brand active for THIS invocation. main() sets it from\n * {@link MainOptions.programName} before dispatch, so error messages printed by\n * command modules via {@link fail} read as the embedding tool (e.g. `acme-db:`)\n * instead of always `agent-connector:`.\n */\nlet activeProgramName = \"agent-connector\";\n\n/** Print an error to stderr (branded) and return a non-zero exit code (default 2). */\nexport function fail(message: string, code = 2): number {\n process.stderr.write(`${activeProgramName}: ${message}\\n`);\n return code;\n}\n\n/**\n * Resolve agent-connector's own package version at runtime. Works from both the\n * bundled dist layout (dist/*.js → ../package.json) and the src layout under\n * tsx/vitest (src/cli/ → ../../package.json); the name check guards against\n * accidentally reading some other package.json on the walk.\n */\nexport function resolveOwnVersion(): string {\n const req = createRequire(import.meta.url);\n for (const rel of [\"../package.json\", \"../../package.json\", \"../../../package.json\"]) {\n try {\n const pkg = req(rel) as { name?: string; version?: string };\n if (pkg.name === \"@ken-jo/agent-connector\" && typeof pkg.version === \"string\") {\n return pkg.version;\n }\n } catch {\n /* keep walking */\n }\n }\n return \"0.0.0\";\n}\n\n/** Parse a --scope value the CLI accepts (user|project) into an InstallScope. */\nexport function parseScope(value: string | undefined): InstallScope | null {\n if (value === \"user\" || value === \"project\") return value;\n return null;\n}\n\n/**\n * Parse a comma-separated --targets value into PlatformId[]. Returns undefined\n * when the flag is absent/empty so callers can fall back to connector/detection.\n */\nexport function parseTargets(value: string | undefined): PlatformId[] | undefined {\n if (value == null || value.trim() === \"\") return undefined;\n const ids = value\n .split(\",\")\n .map((s) => s.trim())\n .filter((s) => s !== \"\") as PlatformId[];\n return ids.length > 0 ? ids : undefined;\n}\n\nconst ACTION_GLYPH: Record<ChangeRecord[\"action\"], string> = {\n create: \"+\",\n update: \"~\",\n remove: \"-\",\n skip: \"=\",\n warn: \"!\",\n};\n\n/**\n * Render an InstallResult as a readable diff: one line per ChangeRecord (glyph,\n * platform, detail, path) followed by any warnings and a summary tally. Used by\n * install / upgrade / uninstall.\n */\nexport function renderInstallResult(\n result: InstallResult,\n verb: \"install\" | \"upgrade\" | \"uninstall\",\n): string {\n const lines: string[] = [];\n const mode = result.dryRun ? \" (dry-run — nothing written)\" : \"\";\n lines.push(`${verb} \"${result.connectorId}\"${mode}`);\n\n if (result.changes.length === 0) {\n lines.push(\" (no changes)\");\n } else {\n for (const c of result.changes) {\n const glyph = ACTION_GLYPH[c.action];\n const where = c.path ? ` ${c.path}` : \"\";\n lines.push(` ${glyph} [${c.platform}] ${c.action}: ${c.detail}${where}`);\n }\n }\n\n if (result.warnings.length > 0) {\n lines.push(\"\");\n lines.push(\"warnings:\");\n for (const w of result.warnings) lines.push(` ! ${w}`);\n }\n\n const tally = result.changes.reduce<Record<ChangeRecord[\"action\"], number>>(\n (acc, c) => {\n acc[c.action] += 1;\n return acc;\n },\n { create: 0, update: 0, remove: 0, skip: 0, warn: 0 },\n );\n lines.push(\"\");\n lines.push(\n `summary: ${tally.create} created, ${tally.update} updated, ` +\n `${tally.remove} removed, ${tally.skip} skipped, ${tally.warn} warning(s)`,\n );\n\n return lines.join(\"\\n\");\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Command dispatch\n// ─────────────────────────────────────────────────────────────────────────\n\n/** A command module: takes the post-command argv slice, returns an exit code. */\ntype CommandModule = { run: (argv: string[]) => Promise<number> | number };\n\n/** Lazy command loaders — keyed by the first positional. Imported on demand. */\nconst COMMANDS: Record<string, () => Promise<CommandModule>> = {\n detect: () => import(\"./commands/detect.js\"),\n install: () => import(\"./commands/install.js\"),\n uninstall: () => import(\"./commands/uninstall.js\"),\n // `upgrade` is the single \"bring everything current\" verb (re-render host\n // config + refresh the home pointer + managed channel guidance). `sync` and\n // `update` are kept as back-compat aliases that route to the same module so\n // existing scripts/docs keep working without a second concept to learn.\n upgrade: () => import(\"./commands/upgrade.js\"),\n sync: () => import(\"./commands/upgrade.js\"),\n update: () => import(\"./commands/upgrade.js\"),\n package: () => import(\"./commands/package.js\"),\n doctor: () => import(\"./commands/doctor.js\"),\n status: () => import(\"./commands/status.js\"),\n telemetry: () => import(\"./commands/telemetry.js\"),\n usage: () => import(\"./commands/usage.js\"),\n leaderboard: () => import(\"./commands/leaderboard.js\"),\n hook: () => import(\"./commands/hook.js\"),\n serve: () => import(\"./commands/serve.js\"),\n // Hidden (omitted from USAGE): the opt-in host-native turn-usage entrypoint an\n // AfterModel / PostInvocation hook points at. Always exits 0; records a\n // distinct `model_turn` row. See cli/commands/usage-event.ts.\n \"usage-event\": () => import(\"./commands/usage-event.js\"),\n};\n\n/** Default program name; an embedding SDK CLI overrides it via {@link MainOptions}. */\nexport const DEFAULT_PROGRAM_NAME = \"agent-connector\";\n\n/**\n * One-line usage signature per command — the single central copy behind\n * `<command> --help` and the friendly bad-flag error. Command modules use\n * node:util parseArgs (strict), which THROWS on an unknown flag; without the\n * dispatcher-level handling in {@link main}, `agent-connector install --help`\n * would die with a raw ERR_PARSE_ARGS stack trace — the very invocation the\n * root help tells users to run.\n */\nconst COMMAND_USAGE: Record<string, string> = {\n detect: \"detect [--json] [--project <dir>]\",\n install:\n \"install [--connector <path>] [--scope user|project] [--targets a,b] [--project <dir>] [--dry-run]\",\n uninstall:\n \"uninstall [--connector <path>] [--connector-id <id>] [--scope user|project] [--targets a,b] [--project <dir>] [--dry-run] [--purge]\",\n upgrade:\n \"upgrade [--channel stable|latest] [--connector <path>] [--scope user|project] [--targets a,b] [--project <dir>] [--dry-run]\",\n sync: \"sync — alias of upgrade (see `upgrade --help`)\",\n update: \"update — alias of upgrade (see `upgrade --help`)\",\n package:\n \"package [--connector <path>] [--format <fmt>|all] [--out <dir>] [--project <dir>] [--dry-run]\",\n doctor:\n \"doctor [--targets a,b] [--connector <path>] [--scope user|project] [--project <dir>] [--probe] [--json]\",\n status: \"status [--connector <path>] [--scope user|project] [--project <dir>] [--json]\",\n telemetry:\n \"telemetry report|export|leaderboard [--by <dim>] [--since <dur>] [--connector <id>] [--scope <slice>] [--format csv|json] [--out <file>] [--json]\",\n usage:\n \"usage report|export|leaderboard [--by <dim>] [--since <dur>] [--platform <id>] [--format csv|json] [--out <file>] [--json]\",\n leaderboard: \"leaderboard [--since <dur>] [--connector <id>] [--scope <slice>] [--json]\",\n hook: \"hook <platform> <event> --connector <id> (internal — host hook configs point here)\",\n serve:\n \"serve --connector <id> [--scope user|project] [--host <platformId>] -- <command> [args...] (internal — host MCP entries point here)\",\n};\n\n/**\n * Build the top-level usage string for a given program name. The brand replaces\n * \"agent-connector\" in the title, the `usage:` line, and the per-command help\n * footer so an embedded CLI (e.g. `acme-db`) reads as its own tool.\n */\nfunction buildUsage(programName: string): string {\n return `${programName} — write your MCP server + hooks once, install everywhere.\n\nusage: ${programName} <command> [flags]\n\ncommands:\n detect List the AI-agent platforms installed on this machine.\n install Deploy a connector across its target platforms.\n uninstall Remove a connector's MCP + hook registrations.\n upgrade Bring everything current: re-render host config + heal the home pointer + managed update guidance (alias: update, sync).\n package Emit a marketplace/extension bundle (9 host formats, or the standard artifacts mcp-server-json | mcpb).\n doctor Health-check every detected platform; non-zero exit on any failure.\n status Light install-state summary: which connectors are present on which hosts (always exits 0).\n telemetry Inspect local per-tool token telemetry (report | export | leaderboard).\n usage Inspect host-native token usage from agent CLI logs (report | export | leaderboard).\n leaderboard Three leaderboards: 🔌 MCP/plugin (mcp-self) + 🖥️ host/user (host-scan-logs) + 🛰️ host-native turns (host-native-live) — never summed.\n hook Universal json-stdio hook entrypoint (hosts call this).\n serve Telemetry-wrapping MCP stdio proxy (wraps a real server command).\n\nRun \\`${programName} <command> --help\\` for command-specific flags.`;\n}\n\n/** Options accepted by {@link main}. */\nexport interface MainOptions {\n /**\n * The brand shown in usage/help text. Defaults to {@link DEFAULT_PROGRAM_NAME}.\n * An embedding SDK CLI (see cli/sdk.ts) passes its own bin name so every\n * subcommand's help reads as the developer's tool.\n */\n programName?: string;\n}\n\nexport async function main(argv: string[], opts: MainOptions = {}): Promise<number> {\n const programName = opts.programName ?? DEFAULT_PROGRAM_NAME;\n activeProgramName = programName; // brand every fail() in this invocation\n const usage = buildUsage(programName);\n const command = argv[0];\n\n if (command == null || command === \"--help\" || command === \"-h\" || command === \"help\") {\n print(usage);\n return command == null ? 1 : 0;\n }\n if (command === \"--version\" || command === \"-v\") {\n print(`${programName} ${resolveOwnVersion()}`);\n return 0;\n }\n\n const loader = COMMANDS[command];\n if (!loader) {\n process.stderr.write(`${programName}: unknown command \"${command}\"\\n\\n`);\n process.stderr.write(`${usage}\\n`);\n return 2;\n }\n\n // Per-command help: no command module defines a --help flag (strict parseArgs\n // would throw on it), so answer it centrally from COMMAND_USAGE.\n const rest = argv.slice(1);\n if (rest.includes(\"--help\") || rest.includes(\"-h\")) {\n const sig = COMMAND_USAGE[command];\n if (sig) {\n print(`usage: ${programName} ${sig}`);\n return 0;\n }\n }\n\n const mod = await loader();\n try {\n return await mod.run(rest);\n } catch (err) {\n // Friendly bad-flag errors: strict parseArgs throws ERR_PARSE_ARGS_* for an\n // unknown/malformed option — print the message + the usage line instead of\n // letting a raw stack trace reach the user. Everything else still rethrows\n // (the bin entry reports those as fatal).\n const code = (err as { code?: string }).code;\n if (typeof code === \"string\" && code.startsWith(\"ERR_PARSE_ARGS\")) {\n const message = err instanceof Error ? err.message : String(err);\n const sig = COMMAND_USAGE[command];\n if (sig) process.stderr.write(`usage: ${programName} ${sig}\\n`);\n return fail(message);\n }\n throw err;\n }\n}\n"],"mappings":";;;AAaA,SAAS,qBAAqB;AAcvB,SAAS,MAAM,MAAoB;AACxC,UAAQ,OAAO,MAAM,GAAG,IAAI;AAAA,CAAI;AAClC;AAQA,IAAI,oBAAoB;AAGjB,SAAS,KAA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ClD,UAAM,MAAM,cAAc,OAAO;AACjC,QAAI,KAAK;AACP,YAAM,UAAU,WAAW,IAAI,GAAG,EAAE;AACpC,aAAO;AAAA,IACT;AAAA,EACF;AAEA,QAAM,MAAM,MAAM,OAAO;AACzB,MAAI;AACF,WAAO,MAAM,IAAI,IAAI,IAAI;AAAA,EAC3B,SAAS,KAAK;AAKZ,UAAM,OAAQ,IAA0B;AACxC,QAAI,OAAO,SAAS,YAAY,KAAK,WAAW,gBAAgB,GAAG;AACjE,YAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC/D,YAAM,MAAM,cAAc,OAAO;AACjC,UAAI,IAAK,SAAQ,OAAO,MAAM,UAAU,WAAW,IAAI,GAAG;AAAA,CAAI;AAC9D,aAAO,KAAK,OAAO;AAAA,IACrB;AACA,UAAM;AAAA,EACR;AACF;","names":[]}
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/adapters/claude-code/render.ts
4
+ import { stringify as stringifyYaml } from "yaml";
5
+ function renderFrontmatterMd(frontmatter, body) {
6
+ return `---
7
+ ${stringifyYaml(frontmatter)}---
8
+
9
+ ${body}
10
+ `;
11
+ }
12
+ function renderCommandMd(cmd) {
13
+ const frontmatter = {};
14
+ if (cmd.description !== void 0) frontmatter.description = cmd.description;
15
+ if (cmd.argumentHint !== void 0) frontmatter["argument-hint"] = cmd.argumentHint;
16
+ const allow = cmd.tools?.allow;
17
+ if (allow && allow.length > 0) frontmatter["allowed-tools"] = allow.join(", ");
18
+ if (cmd.model !== void 0) frontmatter.model = cmd.model;
19
+ if (cmd.extra) Object.assign(frontmatter, cmd.extra);
20
+ return renderFrontmatterMd(frontmatter, cmd.prompt);
21
+ }
22
+ function renderSkillMd(skill) {
23
+ const frontmatter = {
24
+ name: skill.name,
25
+ description: skill.description
26
+ };
27
+ if (skill.model !== void 0) frontmatter.model = skill.model;
28
+ const allow = skill.tools?.allow;
29
+ if (allow && allow.length > 0) frontmatter["allowed-tools"] = allow.join(", ");
30
+ if (skill.disableModelInvocation !== void 0) {
31
+ frontmatter["disable-model-invocation"] = skill.disableModelInvocation;
32
+ }
33
+ if (skill.extra) Object.assign(frontmatter, skill.extra);
34
+ return renderFrontmatterMd(frontmatter, skill.body);
35
+ }
36
+ function renderSubagentMd(agent) {
37
+ const frontmatter = {
38
+ name: agent.name,
39
+ description: agent.description
40
+ };
41
+ const allow = agent.tools?.allow;
42
+ if (allow && allow.length > 0) frontmatter.tools = allow.join(", ");
43
+ if (agent.model !== void 0) frontmatter.model = agent.model;
44
+ if (agent.extra) Object.assign(frontmatter, agent.extra);
45
+ return renderFrontmatterMd(frontmatter, agent.prompt);
46
+ }
47
+
48
+ export {
49
+ renderFrontmatterMd,
50
+ renderCommandMd,
51
+ renderSkillMd,
52
+ renderSubagentMd
53
+ };
54
+ //# sourceMappingURL=chunk-7L6ITC4T.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/claude-code/render.ts"],"sourcesContent":["/**\n * adapters/claude-code/render — shared content-surface renderers.\n *\n * The single source of truth for how a connector's commands / skills / subagents\n * are serialized into Claude Code's native `md + YAML-frontmatter` documents.\n * BOTH the live claude-code adapter (which writes into ~/.claude or .claude when\n * installing) AND `core/package` (which emits a marketplace-installable plugin\n * bundle) import these so the two paths produce BYTE-IDENTICAL output — there is\n * no second, subtly-different copy to drift.\n *\n * The frontmatter serializer reuses the `yaml` package (the same serializer\n * core/yaml and BaseAdapter.renderFrontmatterMd use): a `---` fence, the YAML\n * block, a closing `---`, a blank line, then the markdown body and a trailing\n * newline.\n */\n\nimport { stringify as stringifyYaml } from \"yaml\";\n\nimport type { CommandDef, SkillDef, SubagentDef } from \"../../core/types.js\";\n\n/**\n * Render a YAML-frontmatter + markdown body document:\n * \"---\\n\" + <yaml> + \"---\\n\\n\" + <body> + \"\\n\".\n * Identical to BaseAdapter.renderFrontmatterMd (which now delegates here).\n */\nexport function renderFrontmatterMd(\n frontmatter: Record<string, unknown>,\n body: string,\n): string {\n return `---\\n${stringifyYaml(frontmatter)}---\\n\\n${body}\\n`;\n}\n\n/**\n * Render a command to md+frontmatter\n * (description, argument-hint, allowed-tools, model + verbatim extra).\n */\nexport function renderCommandMd(cmd: CommandDef): string {\n const frontmatter: Record<string, unknown> = {};\n if (cmd.description !== undefined) frontmatter.description = cmd.description;\n if (cmd.argumentHint !== undefined) frontmatter[\"argument-hint\"] = cmd.argumentHint;\n const allow = cmd.tools?.allow;\n if (allow && allow.length > 0) frontmatter[\"allowed-tools\"] = allow.join(\", \");\n if (cmd.model !== undefined) frontmatter.model = cmd.model;\n if (cmd.extra) Object.assign(frontmatter, cmd.extra);\n return renderFrontmatterMd(frontmatter, cmd.prompt);\n}\n\n/**\n * Render a skill's SKILL.md: frontmatter (name, description + optional model,\n * allowed-tools, disable-model-invocation, verbatim extra) + body.\n */\nexport function renderSkillMd(skill: SkillDef): string {\n const frontmatter: Record<string, unknown> = {\n name: skill.name,\n description: skill.description,\n };\n if (skill.model !== undefined) frontmatter.model = skill.model;\n const allow = skill.tools?.allow;\n if (allow && allow.length > 0) frontmatter[\"allowed-tools\"] = allow.join(\", \");\n if (skill.disableModelInvocation !== undefined) {\n frontmatter[\"disable-model-invocation\"] = skill.disableModelInvocation;\n }\n if (skill.extra) Object.assign(frontmatter, skill.extra);\n return renderFrontmatterMd(frontmatter, skill.body);\n}\n\n/** Render a subagent to md+frontmatter (name, description, tools, model) + prompt body. */\nexport function renderSubagentMd(agent: SubagentDef): string {\n const frontmatter: Record<string, unknown> = {\n name: agent.name,\n description: agent.description,\n };\n const allow = agent.tools?.allow;\n if (allow && allow.length > 0) frontmatter.tools = allow.join(\", \");\n if (agent.model !== undefined) frontmatter.model = agent.model;\n if (agent.extra) Object.assign(frontmatter, agent.extra);\n return renderFrontmatterMd(frontmatter, agent.prompt);\n}\n"],"mappings":";;;AAgBA,SAAS,aAAa,qBAAqB;AASpC,SAAS,oBACd,aACA,MACQ;AACR,SAAO;AAAA,EAAQ,cA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B,aAAa,MAAM,MAAM;AACtD;","names":[]}
@@ -0,0 +1,316 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ log
4
+ } from "./chunk-KHO5WNTP.js";
5
+ import {
6
+ REGISTERED_PLATFORM_IDS,
7
+ detectInstalledPlatforms,
8
+ loadAdapter
9
+ } from "./chunk-XUCWLJY5.js";
10
+ import {
11
+ deregisterConnector,
12
+ loadRegisteredConnector,
13
+ registerConnector
14
+ } from "./chunk-LTT56GI3.js";
15
+ import {
16
+ connectorDir,
17
+ connectorsDir,
18
+ dataRoot,
19
+ ensureHomeBin,
20
+ homeBinPath
21
+ } from "./chunk-TRQKHP7D.js";
22
+
23
+ // src/core/installer.ts
24
+ import { existsSync, readdirSync, rmSync } from "fs";
25
+ import { dirname, join } from "path";
26
+ import { fileURLToPath } from "url";
27
+ async function installConnector(opts) {
28
+ const { connector, modulePath, scope, projectDir, dryRun } = opts;
29
+ if (!dryRun) {
30
+ try {
31
+ ensureHomeBin(resolveCliEntry());
32
+ } catch (err) {
33
+ log.warn(`ensureHomeBin failed: ${errMessage(err)}`);
34
+ }
35
+ try {
36
+ registerConnector(connector, modulePath);
37
+ } catch (err) {
38
+ log.warn(`registerConnector failed: ${errMessage(err)}`);
39
+ }
40
+ }
41
+ const targets = await resolveTargets(opts.targets, connector.targets, projectDir);
42
+ const result = newResult(connector.id, dryRun);
43
+ if (targets.length === 0) {
44
+ result.warnings.push(
45
+ "no target platforms resolved (none installed / detected, or all filtered out)"
46
+ );
47
+ return result;
48
+ }
49
+ for (const id of targets) {
50
+ const adapter = await tryLoadAdapter(id, result);
51
+ if (!adapter) continue;
52
+ const ctx = buildContext(connector, id, scope, projectDir, dryRun);
53
+ if (!dryRun) {
54
+ runStep(id, "backupSettings", result, () => {
55
+ const backup = adapter.backupSettings(ctx);
56
+ if (backup) {
57
+ result.changes.push({
58
+ platform: id,
59
+ action: "create",
60
+ path: backup,
61
+ detail: "backed up settings before install"
62
+ });
63
+ }
64
+ });
65
+ }
66
+ runStep(id, "installServer", result, () => {
67
+ pushAll(result.changes, adapter.installServer(ctx));
68
+ });
69
+ runStep(id, "installHooks", result, () => {
70
+ pushAll(result.changes, adapter.installHooks(ctx));
71
+ });
72
+ if (connector.commands.length) {
73
+ runStep(id, "installCommands", result, () => {
74
+ pushAll(result.changes, adapter.installCommands(ctx));
75
+ });
76
+ }
77
+ if (connector.skills.length) {
78
+ runStep(id, "installSkills", result, () => {
79
+ pushAll(result.changes, adapter.installSkills(ctx));
80
+ });
81
+ }
82
+ if (connector.subagents.length) {
83
+ runStep(id, "installSubagents", result, () => {
84
+ pushAll(result.changes, adapter.installSubagents(ctx));
85
+ });
86
+ }
87
+ }
88
+ return result;
89
+ }
90
+ async function syncConnector(opts) {
91
+ return installConnector(opts);
92
+ }
93
+ async function uninstallConnector(opts) {
94
+ const { connectorId, scope, projectDir, dryRun, purge } = opts;
95
+ const connector = await loadConnectorForUninstall(connectorId);
96
+ const result = newResult(connectorId, dryRun);
97
+ const targets = await resolveTargets(opts.targets, connector.targets, projectDir);
98
+ if (targets.length === 0) {
99
+ result.warnings.push(
100
+ "no target platforms resolved for uninstall (none installed / detected, or all filtered out)"
101
+ );
102
+ if (purge) purgeFrameworkState(connectorId, dryRun, result);
103
+ return result;
104
+ }
105
+ for (const id of targets) {
106
+ const adapter = await tryLoadAdapter(id, result);
107
+ if (!adapter) continue;
108
+ const ctx = buildContext(connector, id, scope, projectDir, dryRun);
109
+ if (connector.subagents.length) {
110
+ runStep(id, "uninstallSubagents", result, () => {
111
+ pushAll(result.changes, adapter.uninstallSubagents(ctx));
112
+ });
113
+ }
114
+ if (connector.commands.length) {
115
+ runStep(id, "uninstallCommands", result, () => {
116
+ pushAll(result.changes, adapter.uninstallCommands(ctx));
117
+ });
118
+ }
119
+ if (connector.skills.length) {
120
+ runStep(id, "uninstallSkills", result, () => {
121
+ pushAll(result.changes, adapter.uninstallSkills(ctx));
122
+ });
123
+ }
124
+ runStep(id, "uninstallHooks", result, () => {
125
+ pushAll(result.changes, adapter.uninstallHooks(ctx));
126
+ });
127
+ runStep(id, "uninstallServer", result, () => {
128
+ pushAll(result.changes, adapter.uninstallServer(ctx));
129
+ });
130
+ }
131
+ if (purge) purgeFrameworkState(connectorId, dryRun, result);
132
+ return result;
133
+ }
134
+ function purgeFrameworkState(connectorId, dryRun, result) {
135
+ const platform = connectorId;
136
+ const recordDir = connectorDir(connectorId);
137
+ const recordExisted = existsSync(recordDir);
138
+ if (recordExisted) {
139
+ if (!dryRun) {
140
+ try {
141
+ deregisterConnector(connectorId);
142
+ } catch (err) {
143
+ log.warn(`deregisterConnector failed: ${errMessage(err)}`);
144
+ }
145
+ }
146
+ result.changes.push({
147
+ platform,
148
+ action: "remove",
149
+ path: recordDir,
150
+ detail: "deregistered connector record"
151
+ });
152
+ }
153
+ if (noConnectorsRemain(connectorId, dryRun, recordExisted)) {
154
+ const binPath = homeBinPath();
155
+ if (existsSync(binPath)) {
156
+ if (!dryRun) {
157
+ try {
158
+ rmSync(binPath, { force: true });
159
+ } catch (err) {
160
+ log.warn(`home-bin removal failed: ${errMessage(err)}`);
161
+ }
162
+ }
163
+ result.changes.push({
164
+ platform,
165
+ action: "remove",
166
+ path: binPath,
167
+ detail: "removed home-bin (no connectors remain)"
168
+ });
169
+ }
170
+ }
171
+ }
172
+ function noConnectorsRemain(connectorId, dryRun, recordExisted) {
173
+ const dir = connectorsDir();
174
+ if (!existsSync(dir)) return true;
175
+ let entries;
176
+ try {
177
+ entries = readdirSync(dir);
178
+ } catch {
179
+ return false;
180
+ }
181
+ const remaining = entries.filter(
182
+ (e) => !(dryRun && recordExisted && e === connectorId)
183
+ );
184
+ return remaining.length === 0;
185
+ }
186
+ function resolveCliEntry() {
187
+ try {
188
+ let dir = dirname(fileURLToPath(import.meta.url));
189
+ for (let i = 0; i < 8; i++) {
190
+ if (existsSync(join(dir, "package.json"))) {
191
+ const cli = join(dir, "dist", "cli.js");
192
+ if (existsSync(cli)) return cli;
193
+ }
194
+ const parent = dirname(dir);
195
+ if (parent === dir) break;
196
+ dir = parent;
197
+ }
198
+ const sameDir = fileURLToPath(new URL("./cli.js", import.meta.url));
199
+ if (existsSync(sameDir)) return sameDir;
200
+ } catch {
201
+ }
202
+ const argv1 = process.argv[1];
203
+ if (argv1 && argv1.length > 0) return argv1;
204
+ return "cli.js";
205
+ }
206
+ async function resolveTargets(flagTargets, connectorTargets, projectDir) {
207
+ let requested;
208
+ if (flagTargets && flagTargets.length > 0) {
209
+ requested = flagTargets;
210
+ } else if (Array.isArray(connectorTargets) && connectorTargets.length > 0) {
211
+ requested = connectorTargets;
212
+ } else {
213
+ requested = await autoDetectIds(projectDir);
214
+ }
215
+ const seen = /* @__PURE__ */ new Set();
216
+ const out = [];
217
+ for (const id of requested) {
218
+ if (!REGISTERED_PLATFORM_IDS.has(id)) continue;
219
+ if (seen.has(id)) continue;
220
+ seen.add(id);
221
+ out.push(id);
222
+ }
223
+ return out;
224
+ }
225
+ async function autoDetectIds(projectDir) {
226
+ try {
227
+ const detected = await detectInstalledPlatforms(projectDir);
228
+ return detected.filter((p) => p.installed).map((p) => p.id);
229
+ } catch (err) {
230
+ log.warn(`platform detection failed: ${errMessage(err)}`);
231
+ return [];
232
+ }
233
+ }
234
+ function buildContext(connector, id, defaultScope, projectDir, dryRun) {
235
+ return {
236
+ connector,
237
+ scope: connector.platforms[id]?.scope ?? defaultScope,
238
+ projectDir,
239
+ homeBinPath: homeBinPath(),
240
+ dataRoot: dataRoot(),
241
+ dryRun
242
+ };
243
+ }
244
+ async function tryLoadAdapter(id, result) {
245
+ try {
246
+ const adapter = await loadAdapter(id);
247
+ if (adapter) return adapter;
248
+ const detail = `no adapter registered for ${id}`;
249
+ result.changes.push({ platform: id, action: "warn", detail });
250
+ result.warnings.push(detail);
251
+ return null;
252
+ } catch (err) {
253
+ const detail = `failed to load adapter for ${id}: ${errMessage(err)}`;
254
+ result.changes.push({ platform: id, action: "warn", detail });
255
+ result.warnings.push(detail);
256
+ return null;
257
+ }
258
+ }
259
+ function runStep(id, step, result, fn) {
260
+ try {
261
+ fn();
262
+ } catch (err) {
263
+ const detail = `${step} failed on ${id}: ${errMessage(err)}`;
264
+ result.changes.push({ platform: id, action: "warn", detail });
265
+ result.warnings.push(detail);
266
+ }
267
+ }
268
+ async function loadConnectorForUninstall(connectorId) {
269
+ try {
270
+ return await loadRegisteredConnector(connectorId);
271
+ } catch (err) {
272
+ log.warn(
273
+ `could not load registered connector "${connectorId}" for uninstall (${errMessage(err)}); proceeding with a minimal id-only context`
274
+ );
275
+ return syntheticConnector(connectorId);
276
+ }
277
+ }
278
+ function syntheticConnector(id) {
279
+ return {
280
+ id,
281
+ displayName: id,
282
+ version: "0.0.0",
283
+ hooks: {},
284
+ hookEvents: [],
285
+ telemetry: {
286
+ enabled: true,
287
+ modelFamilyHint: "auto",
288
+ measureToolDefs: true,
289
+ hostNativeUsage: false,
290
+ store: "ndjson",
291
+ calibration: { anthropicCountTokens: false }
292
+ },
293
+ commands: [],
294
+ skills: [],
295
+ subagents: [],
296
+ platforms: {},
297
+ targets: "auto"
298
+ };
299
+ }
300
+ function newResult(connectorId, dryRun) {
301
+ return { connectorId, dryRun, changes: [], warnings: [] };
302
+ }
303
+ function pushAll(target, records) {
304
+ for (const r of records) target.push(r);
305
+ }
306
+ function errMessage(err) {
307
+ return err instanceof Error ? err.message : String(err);
308
+ }
309
+
310
+ export {
311
+ installConnector,
312
+ syncConnector,
313
+ uninstallConnector,
314
+ resolveCliEntry
315
+ };
316
+ //# sourceMappingURL=chunk-7MSDGHJW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/installer.ts"],"sourcesContent":["/**\n * core/installer — install / uninstall / sync orchestration.\n *\n * This is the coordination layer that sits above the per-platform adapters. It\n * does NOT know any platform's native dialect (that is the adapter's job); it\n * owns the cross-cutting choreography that every install flow shares:\n *\n * 1. Refresh the single stable home binary (so every host's pointer config\n * keeps execing a working CLI) and register the connector's serializable\n * metadata so the runtime can re-import live handlers later.\n * 2. Resolve the set of target platforms — explicit flag → connector targets →\n * auto-detected installed hosts — intersected with the registry's known ids.\n * 3. For each target: load its adapter, build a uniform InstallContext, back up\n * the native settings, then render the MCP server + hooks (install) or strip\n * them (uninstall). Per-adapter failures are captured as `warn` ChangeRecords\n * and never abort the whole run — partial success is always reported.\n *\n * `sync` is just an idempotent re-run of `install`: adapters are write-idempotent\n * (identical entries yield \"skip\"), and `ensureHomeBin` heals a stale/missing\n * home-bin pointer on every pass (docs/ARCHITECTURE.md §3 R1 / \"sync … heals\n * stale pointers\").\n */\n\nimport { existsSync, readdirSync, rmSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport type {\n ChangeRecord,\n InstallResult,\n InstallScope,\n PlatformId,\n ResolvedConnector,\n} from \"./types.js\";\nimport type { Adapter, InstallContext } from \"../adapters/spi.js\";\nimport { REGISTERED_PLATFORM_IDS, loadAdapter } from \"../adapters/registry.js\";\nimport { detectInstalledPlatforms } from \"../adapters/detect.js\";\nimport {\n deregisterConnector,\n loadRegisteredConnector,\n registerConnector,\n} from \"./load-connector.js\";\nimport {\n connectorDir,\n connectorsDir,\n dataRoot,\n ensureHomeBin,\n homeBinPath,\n} from \"./paths.js\";\nimport { log } from \"./logger.js\";\n\n// ─────────────────────────────────────────────────────────────────────────\n// Options\n// ─────────────────────────────────────────────────────────────────────────\n\n/** Options for {@link installConnector} / {@link syncConnector}. */\nexport interface OrchestrationOptions {\n /** The live, resolved connector (with hook handlers) to deploy. */\n connector: ResolvedConnector;\n /** Absolute path to the source module that produced `connector`. */\n modulePath: string;\n /** Default install scope; per-platform overrides win where present. */\n scope: InstallScope;\n /** Resolved project root used by project-scoped adapters and detection. */\n projectDir: string;\n /** Explicit target allow-list. Omit to derive from the connector / detection. */\n targets?: PlatformId[];\n /** Render but do not write anything. */\n dryRun: boolean;\n}\n\n/** Options for {@link uninstallConnector}. */\nexport interface UninstallOptions {\n /** Id of a previously-registered connector to tear down. */\n connectorId: string;\n /** Default scope to uninstall from; per-platform overrides win. */\n scope: InstallScope;\n /** Resolved project root used by project-scoped adapters and detection. */\n projectDir: string;\n /** Explicit target allow-list. Omit to derive from the connector / detection. */\n targets?: PlatformId[];\n /** Compute changes but do not write anything. */\n dryRun: boolean;\n /**\n * Also remove the framework-state for this connector after stripping every\n * per-target registration: the DATA-dir connector record (connectorDir(id)) and,\n * when no connectors remain, the shared home-bin launcher. Respects dryRun (no\n * mutation, but the would-be changes are still reported).\n */\n purge?: boolean;\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Public orchestration\n// ─────────────────────────────────────────────────────────────────────────\n\n/**\n * Install a connector across its target platforms.\n *\n * Steps mirror docs/ARCHITECTURE.md §8 (\"Install per target\"):\n * 1. Refresh the stable home binary + register connector metadata.\n * 2. Resolve targets (flag → connector.targets → auto-detect) ∩ registry ids.\n * 3. Per target: backup → installServer → installHooks, collecting changes.\n * Per-adapter errors become `warn` records; the run never aborts midway.\n */\nexport async function installConnector(\n opts: OrchestrationOptions,\n): Promise<InstallResult> {\n const { connector, modulePath, scope, projectDir, dryRun } = opts;\n\n // 1. Stable home binary + connector registry record. These are framework-state\n // mutations (never platform-native config) and are safe to skip on dry-run.\n if (!dryRun) {\n try {\n ensureHomeBin(resolveCliEntry());\n } catch (err) {\n log.warn(`ensureHomeBin failed: ${errMessage(err)}`);\n }\n try {\n registerConnector(connector, modulePath);\n } catch (err) {\n log.warn(`registerConnector failed: ${errMessage(err)}`);\n }\n }\n\n const targets = await resolveTargets(opts.targets, connector.targets, projectDir);\n const result = newResult(connector.id, dryRun);\n\n if (targets.length === 0) {\n result.warnings.push(\n \"no target platforms resolved (none installed / detected, or all filtered out)\",\n );\n return result;\n }\n\n for (const id of targets) {\n const adapter = await tryLoadAdapter(id, result);\n if (!adapter) continue;\n\n const ctx = buildContext(connector, id, scope, projectDir, dryRun);\n\n // Back up native settings before any mutation (no-op on dry-run / absent file).\n if (!dryRun) {\n runStep(id, \"backupSettings\", result, () => {\n const backup = adapter.backupSettings(ctx);\n if (backup) {\n result.changes.push({\n platform: id,\n action: \"create\",\n path: backup,\n detail: \"backed up settings before install\",\n });\n }\n });\n }\n\n runStep(id, \"installServer\", result, () => {\n pushAll(result.changes, adapter.installServer(ctx));\n });\n runStep(id, \"installHooks\", result, () => {\n pushAll(result.changes, adapter.installHooks(ctx));\n });\n\n // Content surfaces: guarded by declaration so undeclared surfaces add no\n // noise. BaseAdapter defines all six, so the `!` is safe; per-step\n // try/catch (runStep) turns any adapter failure into a warn, never aborting.\n if (connector.commands.length) {\n runStep(id, \"installCommands\", result, () => {\n pushAll(result.changes, adapter.installCommands!(ctx));\n });\n }\n if (connector.skills.length) {\n runStep(id, \"installSkills\", result, () => {\n pushAll(result.changes, adapter.installSkills!(ctx));\n });\n }\n if (connector.subagents.length) {\n runStep(id, \"installSubagents\", result, () => {\n pushAll(result.changes, adapter.installSubagents!(ctx));\n });\n }\n }\n\n return result;\n}\n\n/**\n * Idempotent re-run of {@link installConnector}: every adapter re-renders its\n * config (identical entries report \"skip\"), and `ensureHomeBin` repairs a stale\n * or missing home-bin pointer. Use after editing a connector or upgrading the\n * framework. Behaviorally identical to install — the distinct name documents\n * intent and gives the CLI a stable verb to wire `agent-connector sync` to.\n */\nexport async function syncConnector(\n opts: OrchestrationOptions,\n): Promise<InstallResult> {\n return installConnector(opts);\n}\n\n/**\n * Uninstall a previously-registered connector: strip its hook registrations and\n * MCP server entries from every target platform. The registered connector is\n * loaded (best-effort) only to provide adapter context (server id, hook ids,\n * per-platform overrides); when it cannot be loaded a minimal synthetic\n * connector built from the id still lets adapters locate and remove their\n * entries (they key removals off `connector.id` + the home-bin path).\n */\nexport async function uninstallConnector(\n opts: UninstallOptions,\n): Promise<InstallResult> {\n const { connectorId, scope, projectDir, dryRun, purge } = opts;\n\n const connector = await loadConnectorForUninstall(connectorId);\n const result = newResult(connectorId, dryRun);\n\n const targets = await resolveTargets(opts.targets, connector.targets, projectDir);\n if (targets.length === 0) {\n result.warnings.push(\n \"no target platforms resolved for uninstall (none installed / detected, or all filtered out)\",\n );\n // --purge still removes the orphan framework-state even when no host targets\n // resolve (e.g. the user already uninstalled from every host).\n if (purge) purgeFrameworkState(connectorId, dryRun, result);\n return result;\n }\n\n for (const id of targets) {\n const adapter = await tryLoadAdapter(id, result);\n if (!adapter) continue;\n\n const ctx = buildContext(connector, id, scope, projectDir, dryRun);\n\n // Inverse order of install: remove content surfaces, then hooks, then the\n // server entry. Surface removals are guarded by declaration; BaseAdapter\n // defines all six so the `!` is safe.\n if (connector.subagents.length) {\n runStep(id, \"uninstallSubagents\", result, () => {\n pushAll(result.changes, adapter.uninstallSubagents!(ctx));\n });\n }\n if (connector.commands.length) {\n runStep(id, \"uninstallCommands\", result, () => {\n pushAll(result.changes, adapter.uninstallCommands!(ctx));\n });\n }\n if (connector.skills.length) {\n runStep(id, \"uninstallSkills\", result, () => {\n pushAll(result.changes, adapter.uninstallSkills!(ctx));\n });\n }\n runStep(id, \"uninstallHooks\", result, () => {\n pushAll(result.changes, adapter.uninstallHooks(ctx));\n });\n runStep(id, \"uninstallServer\", result, () => {\n pushAll(result.changes, adapter.uninstallServer(ctx));\n });\n }\n\n // --purge: after every per-target registration is stripped, also remove the\n // framework-state this connector left behind (its DATA-dir record and, when no\n // connectors remain, the shared home-bin launcher).\n if (purge) purgeFrameworkState(connectorId, dryRun, result);\n\n return result;\n}\n\n/**\n * Remove the framework-state a connector left behind (the inverse of install's\n * registerConnector + ensureHomeBin):\n * 1. Deregister the DATA-dir connector record (connectorDir(id)).\n * 2. When no connector records remain, remove the shared home-bin launcher.\n * All steps are guarded/best-effort and respect dryRun — on a dry run nothing is\n * mutated, but the would-be `remove` changes are still reported.\n */\nfunction purgeFrameworkState(\n connectorId: string,\n dryRun: boolean,\n result: InstallResult,\n): void {\n // These are framework-state changes, not platform-native ones. ChangeRecord\n // types `platform` as the closed PlatformId union, so label them with the\n // connector id (cast once) — there is no real host platform to attribute.\n const platform = connectorId as PlatformId;\n\n // 1. Deregister the connector record directory.\n const recordDir = connectorDir(connectorId);\n const recordExisted = existsSync(recordDir);\n if (recordExisted) {\n if (!dryRun) {\n try {\n deregisterConnector(connectorId);\n } catch (err) {\n log.warn(`deregisterConnector failed: ${errMessage(err)}`);\n }\n }\n result.changes.push({\n platform,\n action: \"remove\",\n path: recordDir,\n detail: \"deregistered connector record\",\n });\n }\n\n // 2. If no connector records remain, remove the shared home-bin launcher.\n if (noConnectorsRemain(connectorId, dryRun, recordExisted)) {\n const binPath = homeBinPath();\n if (existsSync(binPath)) {\n if (!dryRun) {\n try {\n rmSync(binPath, { force: true });\n } catch (err) {\n log.warn(`home-bin removal failed: ${errMessage(err)}`);\n }\n }\n result.changes.push({\n platform,\n action: \"remove\",\n path: binPath,\n detail: \"removed home-bin (no connectors remain)\",\n });\n }\n }\n}\n\n/**\n * True when `connectorsDir()` holds no remaining connector records. On a dry run\n * the just-deregistered record is still on disk, so it is discounted: the dir is\n * \"empty\" when its only remaining entry is the connector we are purging.\n */\nfunction noConnectorsRemain(\n connectorId: string,\n dryRun: boolean,\n recordExisted: boolean,\n): boolean {\n const dir = connectorsDir();\n if (!existsSync(dir)) return true;\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return false;\n }\n const remaining = entries.filter(\n (e) => !(dryRun && recordExisted && e === connectorId),\n );\n return remaining.length === 0;\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Internals\n// ─────────────────────────────────────────────────────────────────────────\n\n/**\n * Absolute path to the CLI entry (`dist/cli.js`) the home binary should exec.\n *\n * Robust to the bundler's output layout: tsup flattens this module into a\n * `dist/chunk-*.js`, so a fixed relative guess like `../cli.js` is wrong. We\n * instead walk up from this module to the package root (the dir whose\n * `package.json` declares the `agent-connector` bin) and use its `dist/cli.js`.\n * Fallbacks: a same-directory `cli.js` (flat-bundle case) then `process.argv[1]`.\n */\nexport function resolveCliEntry(): string {\n try {\n let dir = dirname(fileURLToPath(import.meta.url));\n for (let i = 0; i < 8; i++) {\n if (existsSync(join(dir, \"package.json\"))) {\n const cli = join(dir, \"dist\", \"cli.js\");\n if (existsSync(cli)) return cli;\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n // Flat-bundle case: cli.js sits beside this chunk.\n const sameDir = fileURLToPath(new URL(\"./cli.js\", import.meta.url));\n if (existsSync(sameDir)) return sameDir;\n } catch {\n /* fall through */\n }\n const argv1 = process.argv[1];\n if (argv1 && argv1.length > 0) return argv1;\n return \"cli.js\";\n}\n\n/**\n * Resolve the ordered, de-duplicated list of platform targets, intersected with\n * the adapter registry's known ids (an unknown id can have no adapter to drive).\n *\n * Precedence: explicit `flagTargets` → connector's `targets` array → auto-detect\n * installed hosts. \"auto\" connector targets also fall through to detection.\n */\nasync function resolveTargets(\n flagTargets: PlatformId[] | undefined,\n connectorTargets: ResolvedConnector[\"targets\"],\n projectDir: string,\n): Promise<PlatformId[]> {\n let requested: PlatformId[];\n if (flagTargets && flagTargets.length > 0) {\n requested = flagTargets;\n } else if (Array.isArray(connectorTargets) && connectorTargets.length > 0) {\n requested = connectorTargets;\n } else {\n requested = await autoDetectIds(projectDir);\n }\n\n const seen = new Set<PlatformId>();\n const out: PlatformId[] = [];\n for (const id of requested) {\n if (!REGISTERED_PLATFORM_IDS.has(id)) continue; // no adapter registered → cannot drive it\n if (seen.has(id)) continue;\n seen.add(id);\n out.push(id);\n }\n return out;\n}\n\n/** Auto-detect installed platforms and map them to their ids (best-effort). */\nasync function autoDetectIds(projectDir: string): Promise<PlatformId[]> {\n try {\n const detected = await detectInstalledPlatforms(projectDir);\n return detected.filter((p) => p.installed).map((p) => p.id);\n } catch (err) {\n log.warn(`platform detection failed: ${errMessage(err)}`);\n return [];\n }\n}\n\n/**\n * Build the uniform InstallContext for one platform. The effective scope is the\n * connector's per-platform override when present, else the run-wide default.\n */\nfunction buildContext(\n connector: ResolvedConnector,\n id: PlatformId,\n defaultScope: InstallScope,\n projectDir: string,\n dryRun: boolean,\n): InstallContext {\n return {\n connector,\n scope: connector.platforms[id]?.scope ?? defaultScope,\n projectDir,\n homeBinPath: homeBinPath(),\n dataRoot: dataRoot(),\n dryRun,\n };\n}\n\n/**\n * Load an adapter, recording a `warn` change (not throwing) when unavailable.\n * `loadAdapter` returns `undefined` for an unregistered id and may reject if the\n * adapter module itself fails to import; both degrade to a warn here.\n */\nasync function tryLoadAdapter(\n id: PlatformId,\n result: InstallResult,\n): Promise<Adapter | null> {\n try {\n const adapter = await loadAdapter(id);\n if (adapter) return adapter;\n const detail = `no adapter registered for ${id}`;\n result.changes.push({ platform: id, action: \"warn\", detail });\n result.warnings.push(detail);\n return null;\n } catch (err) {\n const detail = `failed to load adapter for ${id}: ${errMessage(err)}`;\n result.changes.push({ platform: id, action: \"warn\", detail });\n result.warnings.push(detail);\n return null;\n }\n}\n\n/**\n * Run one adapter step, converting any thrown error into a `warn` ChangeRecord +\n * warning string so a single bad adapter never aborts the whole run.\n */\nfunction runStep(\n id: PlatformId,\n step: string,\n result: InstallResult,\n fn: () => void,\n): void {\n try {\n fn();\n } catch (err) {\n const detail = `${step} failed on ${id}: ${errMessage(err)}`;\n result.changes.push({ platform: id, action: \"warn\", detail });\n result.warnings.push(detail);\n }\n}\n\n/**\n * Load the registered connector for uninstall context. If it cannot be loaded\n * (record removed, source module deleted/moved), fall back to a minimal\n * synthetic connector carrying just the id — enough for adapters to locate and\n * strip their entries, which they match by `connector.id` + the home-bin path.\n */\nasync function loadConnectorForUninstall(\n connectorId: string,\n): Promise<ResolvedConnector> {\n try {\n return await loadRegisteredConnector(connectorId);\n } catch (err) {\n log.warn(\n `could not load registered connector \"${connectorId}\" for uninstall (${errMessage(err)}); ` +\n \"proceeding with a minimal id-only context\",\n );\n return syntheticConnector(connectorId);\n }\n}\n\n/** Minimal id-only connector used as uninstall fallback context. */\nfunction syntheticConnector(id: string): ResolvedConnector {\n return {\n id,\n displayName: id,\n version: \"0.0.0\",\n hooks: {},\n hookEvents: [],\n telemetry: {\n enabled: true,\n modelFamilyHint: \"auto\",\n measureToolDefs: true,\n hostNativeUsage: false,\n store: \"ndjson\",\n calibration: { anthropicCountTokens: false },\n },\n commands: [],\n skills: [],\n subagents: [],\n platforms: {},\n targets: \"auto\",\n };\n}\n\nfunction newResult(connectorId: string, dryRun: boolean): InstallResult {\n return { connectorId, dryRun, changes: [], warnings: [] };\n}\n\nfunction pushAll(target: ChangeRecord[], records: ChangeRecord[]): void {\n for (const r of records) target.push(r);\n}\n\nfunction errMessage(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,YAAY,aAAa,cAAc;AAChD,SAAS,SAAS,YAAY;AAC9B,SAAS,qBAAqB;AAgF9B,eAAsB,iBACpB,MACwB;AACxB,QAAM,EAAE,WAAW,YAAY,OAAO,YAAY,OAAO,IAAI;AAI7D,MAAI,CAAC,QAAQ;AACX,QAAI;AACF,oBAAc,gBAAgB,CAAC;AAAA,IACjC,SAAS,KAAK;AACZ,UAAI,KAAK,yBAAyB,WAAW,GAAG,CAAC,EAAE;AAAA,IACrD;AACA,QAAI;AACF,wBAAkB,WAAW,UAAU;AAAA,IACzC,SAAS,KAAK;AACZ,UAAI,KAAK,6BAA6B,WAAW,GAAG,CAAC,EAAE;AAAA,IACzD;AAAA,EACF;AAEA,QAAM,UAAU,MAAM,eAAe,KAAK,SAAS,UAAU,SAAS,UAAU;AAChF,QAAM,SAAS,UAAU,UAAU,IAAI,MAAM;AAE7C,MAAI,QAAQ,WAAW,GAAG;AACxB,WAAO,SAAS;AAAA,MACd;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAEA,aAAW,MAAM,SAAS;AACxB,UAAM,UAAU,MAAM,eAAe,IAAI,MAAM;AAC/C,QAAI,CAAC,QAAS;AAEd,UAAM,MAAM,aAAa,WAAW,IAAI,OAAO,YAAY,MAAM;AAGjE,QAAI,CAAC,QAAQ;AACX,cAAQ,IAAI,kBAAkB,QAAQ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