@ken-jo/agent-connector 0.4.6 → 0.4.8
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/dist/{action-EV63GAPY.js → action-RWPRIZIC.js} +10 -10
- package/dist/{amazon-q-COAL3764.js → amazon-q-5LJOB5L3.js} +6 -18
- package/dist/amazon-q-5LJOB5L3.js.map +1 -0
- package/dist/{amp-XJQ4TDAU.js → amp-PU4LFSY6.js} +16 -48
- package/dist/amp-PU4LFSY6.js.map +1 -0
- package/dist/{antigravity-AMKKKHS4.js → antigravity-DWW35HZO.js} +6 -5
- package/dist/{antigravity-cli-XERXEH5W.js → antigravity-cli-VTQ6DNWL.js} +6 -5
- package/dist/{antigravity-cli-XERXEH5W.js.map → antigravity-cli-VTQ6DNWL.js.map} +1 -1
- package/dist/{chunk-F5RX62T7.js → chunk-7QRUZAUG.js} +2 -2
- package/dist/{chunk-G5CQHVQG.js → chunk-7TVBFRVI.js} +12 -15
- package/dist/chunk-7TVBFRVI.js.map +1 -0
- package/dist/{chunk-QC5A3TFQ.js → chunk-A2T4Q7RM.js} +18 -18
- package/dist/{chunk-2X4EH2D7.js → chunk-CDVOBKSG.js} +4 -4
- package/dist/{chunk-RQPKL62M.js → chunk-CENEXP7K.js} +9 -38
- package/dist/chunk-CENEXP7K.js.map +1 -0
- package/dist/chunk-FBJQGRET.js +38 -0
- package/dist/chunk-FBJQGRET.js.map +1 -0
- package/dist/{chunk-WZA4CSGJ.js → chunk-H53QZQJI.js} +15 -2
- package/dist/chunk-H53QZQJI.js.map +1 -0
- package/dist/{chunk-DCK5FADX.js → chunk-HOE2MN36.js} +2 -2
- package/dist/{chunk-7L6ITC4T.js → chunk-IEGR4TP3.js} +22 -6
- package/dist/chunk-IEGR4TP3.js.map +1 -0
- package/dist/{chunk-CPLK7GTE.js → chunk-KG6T3YNJ.js} +353 -36
- package/dist/chunk-KG6T3YNJ.js.map +1 -0
- package/dist/{chunk-MZF2YCXX.js → chunk-MOW2RKHX.js} +2 -2
- package/dist/{chunk-EXLS7BSI.js → chunk-NLFPH4S2.js} +10 -2
- package/dist/chunk-NLFPH4S2.js.map +1 -0
- package/dist/{chunk-EROJDXMW.js → chunk-NYR55UT7.js} +2 -2
- package/dist/{chunk-SRVAA2VN.js → chunk-OZ5EXXQV.js} +2 -2
- package/dist/{chunk-I5MLE6S7.js → chunk-TO57WYBB.js} +15 -1
- package/dist/chunk-TO57WYBB.js.map +1 -0
- package/dist/chunk-UM5S7DKK.js +33 -0
- package/dist/chunk-UM5S7DKK.js.map +1 -0
- package/dist/{chunk-5G4EPJ4Y.js → chunk-VRKTVCYJ.js} +7 -7
- package/dist/{chunk-QOGMDOUX.js → chunk-WI6YSXOC.js} +3 -3
- package/dist/{chunk-BMD7ANKF.js → chunk-XQUUNAGC.js} +36 -36
- package/dist/{chunk-LQRAPXS4.js → chunk-YS2NYJ6R.js} +15 -49
- package/dist/chunk-YS2NYJ6R.js.map +1 -0
- package/dist/{chunk-H67V7DEL.js → chunk-YYISBXOM.js} +7 -7
- package/dist/{claude-code-T2LPFNC3.js → claude-code-64X6RR2S.js} +46 -133
- package/dist/claude-code-64X6RR2S.js.map +1 -0
- package/dist/cli/sdk.js +4 -4
- package/dist/cli.js +1 -1
- package/dist/{cline-WRYMNS7Z.js → cline-T7ZDJYZQ.js} +15 -47
- package/dist/cline-T7ZDJYZQ.js.map +1 -0
- package/dist/{codebuff-PODYPOOP.js → codebuff-PPPY3SJV.js} +9 -40
- package/dist/codebuff-PPPY3SJV.js.map +1 -0
- package/dist/{codex-O4G7D7KK.js → codex-EEVN43C2.js} +115 -172
- package/dist/codex-EEVN43C2.js.map +1 -0
- package/dist/{continue-K43SUHLQ.js → continue-VLLZO4PM.js} +12 -33
- package/dist/continue-VLLZO4PM.js.map +1 -0
- package/dist/{copilot-cli-Q3SSPT4V.js → copilot-cli-A7G5WB4N.js} +17 -64
- package/dist/copilot-cli-A7G5WB4N.js.map +1 -0
- package/dist/{crush-MBEH2R3I.js → crush-AH24GDDB.js} +17 -42
- package/dist/crush-AH24GDDB.js.map +1 -0
- package/dist/{cursor-TMBXDYR4.js → cursor-GJBSMXI6.js} +61 -183
- package/dist/cursor-GJBSMXI6.js.map +1 -0
- package/dist/{detect-AHJIUMBO.js → detect-YDCZNV4W.js} +4 -4
- package/dist/{doctor-G5MLCPAB.js → doctor-DGC7P3P7.js} +13 -12
- package/dist/{doctor-G5MLCPAB.js.map → doctor-DGC7P3P7.js.map} +1 -1
- package/dist/{droid-JC2NT6S4.js → droid-RBWCFKL3.js} +63 -144
- package/dist/droid-RBWCFKL3.js.map +1 -0
- package/dist/{gemini-cli-ILR7M5X3.js → gemini-cli-CFPFEJEA.js} +20 -63
- package/dist/gemini-cli-CFPFEJEA.js.map +1 -0
- package/dist/{goose-SFO5BBGW.js → goose-UBJVQFUE.js} +107 -183
- package/dist/goose-UBJVQFUE.js.map +1 -0
- package/dist/{hermes-3N7WN4WS.js → hermes-6FXGXLNL.js} +41 -83
- package/dist/hermes-6FXGXLNL.js.map +1 -0
- package/dist/{hook-76JBKTUX.js → hook-CDGSCASQ.js} +10 -10
- package/dist/index.js +2 -2
- package/dist/{install-R7252QFH.js → install-2D3UKEME.js} +13 -12
- package/dist/{install-R7252QFH.js.map → install-2D3UKEME.js.map} +1 -1
- package/dist/{jetbrains-copilot-NRZHI5PC.js → jetbrains-copilot-K26KMA3U.js} +12 -37
- package/dist/jetbrains-copilot-K26KMA3U.js.map +1 -0
- package/dist/{kilo-IX4T3OHJ.js → kilo-BKZJ26RM.js} +26 -90
- package/dist/kilo-BKZJ26RM.js.map +1 -0
- package/dist/{kilo-cli-2AYCXBQD.js → kilo-cli-6UVWCXQD.js} +17 -48
- package/dist/kilo-cli-6UVWCXQD.js.map +1 -0
- package/dist/{kimi-2YFK2GBA.js → kimi-QALYPSRR.js} +20 -31
- package/dist/kimi-QALYPSRR.js.map +1 -0
- package/dist/{kiro-YL6AWUYG.js → kiro-J5J42I5Z.js} +12 -31
- package/dist/kiro-J5J42I5Z.js.map +1 -0
- package/dist/{leaderboard-V6VWA5ZV.js → leaderboard-VZQXNWTX.js} +2 -2
- package/dist/{mimo-code-FTMGSKMQ.js → mimo-code-BEE622P2.js} +22 -87
- package/dist/mimo-code-BEE622P2.js.map +1 -0
- package/dist/{mux-5XZFB44C.js → mux-5HTNKK4K.js} +10 -54
- package/dist/mux-5HTNKK4K.js.map +1 -0
- package/dist/{nemoclaw-CQYXZVQN.js → nemoclaw-DNFIZFDF.js} +5 -5
- package/dist/{omp-2QMEY6HD.js → omp-I3UTRBNP.js} +16 -48
- package/dist/omp-I3UTRBNP.js.map +1 -0
- package/dist/{openclaw-UZC437RW.js → openclaw-QE2LMWIF.js} +5 -5
- package/dist/{opencode-L4BGFP25.js → opencode-ZFSUYJXI.js} +22 -88
- package/dist/opencode-ZFSUYJXI.js.map +1 -0
- package/dist/{package-DNLQTPNN.js → package-BSCCMW4E.js} +8 -8
- package/dist/{pi-PVVPVWKG.js → pi-H2KBBDDJ.js} +4 -4
- package/dist/{qwen-code-G4CXKUHR.js → qwen-code-5LE34FNE.js} +63 -152
- package/dist/qwen-code-5LE34FNE.js.map +1 -0
- package/dist/{roo-code-67TYJIQR.js → roo-code-XH4GCYIS.js} +15 -52
- package/dist/roo-code-XH4GCYIS.js.map +1 -0
- package/dist/runtime/index.js +8 -8
- package/dist/sdk/index.js +3 -3
- package/dist/sdk/test.js +5 -5
- package/dist/{serve-EOVWYBGZ.js → serve-MQNGPY2H.js} +10 -10
- package/dist/{status-VTD6XXLW.js → status-MRHVRDFY.js} +8 -7
- package/dist/{status-VTD6XXLW.js.map → status-MRHVRDFY.js.map} +1 -1
- package/dist/{statusline-3ET5YPQ5.js → statusline-IYWA75TR.js} +9 -9
- package/dist/{telemetry-QCTMKDBQ.js → telemetry-IONIOMLC.js} +5 -5
- package/dist/{trae-7CZZGOGI.js → trae-RVNRSV7X.js} +10 -39
- package/dist/trae-RVNRSV7X.js.map +1 -0
- package/dist/{uninstall-FL3SH2DT.js → uninstall-ESLSVCLE.js} +13 -12
- package/dist/{uninstall-FL3SH2DT.js.map → uninstall-ESLSVCLE.js.map} +1 -1
- package/dist/{upgrade-SLFG2FCT.js → upgrade-VICY5T64.js} +13 -12
- package/dist/{upgrade-SLFG2FCT.js.map → upgrade-VICY5T64.js.map} +1 -1
- package/dist/{usage-IRBLVUZM.js → usage-TCUWV2YZ.js} +2 -2
- package/dist/{usage-event-VFF77WYY.js → usage-event-CBZZP37Q.js} +9 -9
- package/dist/{vscode-copilot-MF2CDNMT.js → vscode-copilot-B2QBBHJW.js} +17 -65
- package/dist/vscode-copilot-B2QBBHJW.js.map +1 -0
- package/dist/{warp-VKG55TAT.js → warp-5R54ST3N.js} +7 -19
- package/dist/warp-5R54ST3N.js.map +1 -0
- package/dist/{windsurf-FU5G4SHF.js → windsurf-L32UEOLY.js} +6 -18
- package/dist/windsurf-L32UEOLY.js.map +1 -0
- package/dist/{zed-SFUHL3GS.js → zed-FDJHJZKD.js} +11 -21
- package/dist/zed-FDJHJZKD.js.map +1 -0
- package/package.json +1 -1
- package/dist/amazon-q-COAL3764.js.map +0 -1
- package/dist/amp-XJQ4TDAU.js.map +0 -1
- package/dist/chunk-7L6ITC4T.js.map +0 -1
- package/dist/chunk-CPLK7GTE.js.map +0 -1
- package/dist/chunk-EXLS7BSI.js.map +0 -1
- package/dist/chunk-G5CQHVQG.js.map +0 -1
- package/dist/chunk-I5MLE6S7.js.map +0 -1
- package/dist/chunk-LQRAPXS4.js.map +0 -1
- package/dist/chunk-RQPKL62M.js.map +0 -1
- package/dist/chunk-WZA4CSGJ.js.map +0 -1
- package/dist/claude-code-T2LPFNC3.js.map +0 -1
- package/dist/cline-WRYMNS7Z.js.map +0 -1
- package/dist/codebuff-PODYPOOP.js.map +0 -1
- package/dist/codex-O4G7D7KK.js.map +0 -1
- package/dist/continue-K43SUHLQ.js.map +0 -1
- package/dist/copilot-cli-Q3SSPT4V.js.map +0 -1
- package/dist/crush-MBEH2R3I.js.map +0 -1
- package/dist/cursor-TMBXDYR4.js.map +0 -1
- package/dist/droid-JC2NT6S4.js.map +0 -1
- package/dist/gemini-cli-ILR7M5X3.js.map +0 -1
- package/dist/goose-SFO5BBGW.js.map +0 -1
- package/dist/hermes-3N7WN4WS.js.map +0 -1
- package/dist/jetbrains-copilot-NRZHI5PC.js.map +0 -1
- package/dist/kilo-IX4T3OHJ.js.map +0 -1
- package/dist/kilo-cli-2AYCXBQD.js.map +0 -1
- package/dist/kimi-2YFK2GBA.js.map +0 -1
- package/dist/kiro-YL6AWUYG.js.map +0 -1
- package/dist/mimo-code-FTMGSKMQ.js.map +0 -1
- package/dist/mux-5XZFB44C.js.map +0 -1
- package/dist/omp-2QMEY6HD.js.map +0 -1
- package/dist/opencode-L4BGFP25.js.map +0 -1
- package/dist/qwen-code-G4CXKUHR.js.map +0 -1
- package/dist/roo-code-67TYJIQR.js.map +0 -1
- package/dist/trae-7CZZGOGI.js.map +0 -1
- package/dist/vscode-copilot-MF2CDNMT.js.map +0 -1
- package/dist/warp-VKG55TAT.js.map +0 -1
- package/dist/windsurf-FU5G4SHF.js.map +0 -1
- package/dist/zed-SFUHL3GS.js.map +0 -1
- /package/dist/{action-EV63GAPY.js.map → action-RWPRIZIC.js.map} +0 -0
- /package/dist/{antigravity-AMKKKHS4.js.map → antigravity-DWW35HZO.js.map} +0 -0
- /package/dist/{chunk-F5RX62T7.js.map → chunk-7QRUZAUG.js.map} +0 -0
- /package/dist/{chunk-QC5A3TFQ.js.map → chunk-A2T4Q7RM.js.map} +0 -0
- /package/dist/{chunk-2X4EH2D7.js.map → chunk-CDVOBKSG.js.map} +0 -0
- /package/dist/{chunk-DCK5FADX.js.map → chunk-HOE2MN36.js.map} +0 -0
- /package/dist/{chunk-MZF2YCXX.js.map → chunk-MOW2RKHX.js.map} +0 -0
- /package/dist/{chunk-EROJDXMW.js.map → chunk-NYR55UT7.js.map} +0 -0
- /package/dist/{chunk-SRVAA2VN.js.map → chunk-OZ5EXXQV.js.map} +0 -0
- /package/dist/{chunk-5G4EPJ4Y.js.map → chunk-VRKTVCYJ.js.map} +0 -0
- /package/dist/{chunk-QOGMDOUX.js.map → chunk-WI6YSXOC.js.map} +0 -0
- /package/dist/{chunk-BMD7ANKF.js.map → chunk-XQUUNAGC.js.map} +0 -0
- /package/dist/{chunk-H67V7DEL.js.map → chunk-YYISBXOM.js.map} +0 -0
- /package/dist/{detect-AHJIUMBO.js.map → detect-YDCZNV4W.js.map} +0 -0
- /package/dist/{hook-76JBKTUX.js.map → hook-CDGSCASQ.js.map} +0 -0
- /package/dist/{leaderboard-V6VWA5ZV.js.map → leaderboard-VZQXNWTX.js.map} +0 -0
- /package/dist/{nemoclaw-CQYXZVQN.js.map → nemoclaw-DNFIZFDF.js.map} +0 -0
- /package/dist/{openclaw-UZC437RW.js.map → openclaw-QE2LMWIF.js.map} +0 -0
- /package/dist/{package-DNLQTPNN.js.map → package-BSCCMW4E.js.map} +0 -0
- /package/dist/{pi-PVVPVWKG.js.map → pi-H2KBBDDJ.js.map} +0 -0
- /package/dist/{serve-EOVWYBGZ.js.map → serve-MQNGPY2H.js.map} +0 -0
- /package/dist/{statusline-3ET5YPQ5.js.map → statusline-IYWA75TR.js.map} +0 -0
- /package/dist/{telemetry-QCTMKDBQ.js.map → telemetry-IONIOMLC.js.map} +0 -0
- /package/dist/{usage-IRBLVUZM.js.map → usage-TCUWV2YZ.js.map} +0 -0
- /package/dist/{usage-event-VFF77WYY.js.map → usage-event-CBZZP37Q.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/crush/index.ts"],"sourcesContent":["/**\n * adapters/crush — Crush (Charm) platform adapter for agent-connector.\n *\n * Crush is a json-stdio host. A single JSON config file holds BOTH the MCP\n * server registrations and the hook registrations, and agent-connector MERGES\n * into it (never replaces it — unrelated keys are preserved verbatim):\n * - User scope: ~/.config/crush/crush.json\n * (Windows: %LOCALAPPDATA%\\crush\\crush.json)\n * - Project scope: ./.crush.json (preferred) or ./crush.json\n *\n * MCP servers live under the ROOT KEY \"mcp\" (NOT \"mcpServers\"). A stdio entry is\n * { type:\"stdio\", command, args, env, timeout:120, disabled:false }.\n * Hooks live under the top-level \"hooks\" key. Crush supports PreToolUse ONLY;\n * the hook reads the host's JSON on stdin and writes a JSON object on stdout\n * carrying a `decision` field. A deny is `{ decision:\"deny\", reason }` on\n * stdout (exit 0); an allow is an empty stdout (exit 0). Crush cannot rewrite\n * tool args/output nor inject session context — every non-deny decision (and\n * every non-PreToolUse event) degrades to a silent allow.\n *\n * SECURITY NOTE: Crush expands `$(...)` command substitution in its config file\n * at load time. We therefore NEVER emit shell-substitution syntax into the\n * command/args/env we write — every value is a literal path/string built by the\n * spawn helpers (which quote, not interpolate). Connector ids are kebab-case and\n * the home-bin path is an absolute literal, so nothing we write can be coerced\n * into a `$(...)` substitution.\n */\n\nimport { existsSync, statSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nimport { BaseAdapter } from \"../base.js\";\nimport type { Adapter, HookReply, InstallContext, NormalizedEvent } from \"../spi.js\";\nimport type {\n ChangeRecord,\n DetectedPlatform,\n HealthCheck,\n HookEventName,\n HookParadigm,\n HookResponse,\n PlatformCapabilities,\n PlatformId,\n PreToolUseEvent,\n ServerDef,\n Transport,\n} from \"../../core/types.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport { localAppData } from \"../../core/host-paths.js\";\nimport {\n buildHomeBinHookCommand,\n buildWrappedStdio,\n isHomeBinHookCommand,\n} from \"../../core/spawn.js\";\nimport { renderSkillMd } from \"../claude-code/render.js\";\n\nconst HOST: PlatformId = \"crush\";\n/** Crush registers MCP servers under \"mcp\" — NOT the \"mcpServers\" of Claude/Gemini. */\nconst MCP_ROOT_KEY = \"mcp\";\n/** Default per-server timeout (seconds) Crush expects on a stdio entry. */\nconst STDIO_TIMEOUT_SECONDS = 120;\n\n/**\n * Crush hook events agent-connector can register. Crush honors PreToolUse ONLY,\n * and only its deny decision is meaningful; every other normalized event has no\n * Crush equivalent and is skipped at install time.\n */\nconst CRUSH_HOOK_EVENTS = [\"PreToolUse\"] as const;\ntype CrushHookEventName = (typeof CRUSH_HOOK_EVENTS)[number];\n\n/**\n * Newer canonical events with NO Crush analog: there is no permission-dialog,\n * tool-failure, or subagent lifecycle hook. Declared hooks for these warn-skip\n * at install so the degradation is reported, never silent. (The legacy silent\n * drop of the other unwired events — SessionStart, Stop, … — predates this\n * convention and is deliberately left untouched.)\n */\nconst WARN_SKIP_EVENTS: ReadonlySet<HookEventName> = new Set([\n \"PermissionRequest\",\n \"PostToolUseFailure\",\n \"SubagentStart\",\n \"SubagentStop\",\n]);\n\n// ─────────────────────────────────────────────────────────────────────────\n// Native config shapes (only the parts we touch; rest preserved verbatim)\n// ─────────────────────────────────────────────────────────────────────────\n\n/** One hook registration entry as Crush stores it under top-level \"hooks\". */\ninterface CrushHookEntry {\n matcher?: string;\n command: string;\n [key: string]: unknown;\n}\n\n/** Crush's crush.json shape — only the keys we read/merge. */\ninterface CrushConfigFile {\n mcp?: Record<string, unknown>;\n hooks?: Record<string, CrushHookEntry[]>;\n [key: string]: unknown;\n}\n\n/** Native stdio MCP server entry under \"mcp\". */\ninterface CrushStdioServer {\n type: \"stdio\";\n command: string;\n args: string[];\n env?: Record<string, string>;\n timeout: number;\n disabled: boolean;\n}\n\n/** Native HTTP MCP server entry under \"mcp\". */\ninterface CrushHttpServer {\n type: \"http\";\n url: string;\n headers?: Record<string, string>;\n timeout: number;\n disabled: boolean;\n}\n\n/** Raw Crush hook stdin payload (Claude-style: PascalCase event, snake_case fields). */\ninterface CrushHookInput {\n tool_name?: string;\n tool_input?: Record<string, unknown>;\n session_id?: string;\n cwd?: string;\n hook_event_name?: string;\n connector?: unknown;\n}\n\nexport class CrushAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Crush\";\n readonly paradigm: HookParadigm = \"json-stdio\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block via the BaseAdapter default\n // (memoryTargets: project <projectDir>/AGENTS.md; user scope where documented).\n supportsMemory: true,\n // PreToolUse deny is the only hook decision Crush honors.\n preToolUse: true,\n postToolUse: false,\n preCompact: false,\n sessionStart: false,\n sessionEnd: false,\n userPromptSubmit: false,\n stop: false,\n notification: false,\n // Newer events: Crush honors PreToolUse ONLY — no permission-dialog,\n // tool-failure, or subagent lifecycle events exist, so permissionRequest /\n // postToolUseFailure / subagentStart / subagentStop stay unset — install\n // reports the standard skip-warn for them.\n // Crush is deny-only: it cannot rewrite tool args/output nor inject context.\n canModifyArgs: false,\n canModifyOutput: false,\n canInjectSessionContext: false,\n transports: [\"stdio\", \"http\"],\n // Content surface: Crush auto-discovers Agent-Skills dirs (dir-per-skill\n // SKILL.md). Paths are HARD-CODED — no crush.json entry needed\n // (charmbracelet/crush internal/config/load.go GlobalSkillsDirs +\n // ProjectSkillsDir, fetched 2026-06-16):\n // project → <projectDir>/.crush/skills/<name>/SKILL.md (crush-native, in\n // projectSkillSubdirs; preferred over .agents/.claude/.cursor)\n // user → ~/.config/crush/skills/<name>/SKILL.md (home.Config()/crush/\n // skills; XDG_CONFIG_HOME or ~/.config).\n supportsSkills: true,\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = this.userConfigDir();\n const userConfig = join(userDir, \"crush.json\");\n const projectDot = join(projectDir, \".crush.json\");\n const projectBare = join(projectDir, \"crush.json\");\n const userInstalled = existsSync(userDir) || existsSync(userConfig);\n const projInstalled = existsSync(projectDot) || existsSync(projectBare);\n const installed = userInstalled || projInstalled;\n // Report the scope/path that actually matched so a project-only install is\n // not misreported as a (non-existent) user install.\n const scope = projInstalled && !userInstalled ? \"project\" : \"user\";\n const projectPath = existsSync(projectBare) && !existsSync(projectDot) ? projectBare : projectDot;\n const configPath = scope === \"project\" ? projectPath : userConfig;\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n configPath,\n scope,\n reason: installed\n ? scope === \"project\"\n ? `found project Crush config at ${configPath}`\n : `found Crush config under ${userDir}`\n : `no Crush config at ${userConfig}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\" ? ctx.projectDir : this.userConfigDir();\n }\n\n /** MCP servers and hooks share ONE crush.json file. */\n getServerConfigPath(ctx: InstallContext): string {\n if (ctx.scope === \"project\") {\n // Prefer ./.crush.json, but MERGE into an existing ./crush.json if that is\n // the file already present (so we don't fork the user's config in two).\n const dot = join(ctx.projectDir, \".crush.json\");\n const bare = join(ctx.projectDir, \"crush.json\");\n if (existsSync(bare) && !existsSync(dot)) return bare;\n return dot;\n }\n return join(this.userConfigDir(), \"crush.json\");\n }\n\n /** Hooks live in the SAME crush.json under the top-level \"hooks\" key. */\n getHookConfigPath(ctx: InstallContext): string {\n return this.getServerConfigPath(ctx);\n }\n\n /**\n * Crush's user config dir:\n * - Windows: %LOCALAPPDATA%\\crush (Local; falls back to AppData/Local)\n * - macOS / Linux: ~/.config/crush\n */\n private userConfigDir(): string {\n if (process.platform === \"win32\") {\n return join(localAppData(), \"crush\");\n }\n return join(homedir(), \".config\", \"crush\");\n }\n\n // ── MCP server install / uninstall (crush.json → mcp.<id>) ───────────────\n\n installServer(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n const override = connector.platforms[HOST]?.server;\n if (!connector.server || override === false) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: connector.server\n ? \"server registration disabled for crush\"\n : \"connector declares no MCP server\",\n },\n ];\n }\n\n // Shallow-merge any per-platform server override into the base ServerDef.\n const server: ServerDef =\n override && typeof override === \"object\"\n ? { ...connector.server, ...override }\n : connector.server;\n\n const serverPath = this.getServerConfigPath(ctx);\n const entry = this.renderServerEntry(ctx, server);\n\n return [\n this.upsertServerInJson(serverPath, MCP_ROOT_KEY, connector.id, entry, ctx.dryRun),\n ];\n }\n\n uninstallServer(ctx: InstallContext): ChangeRecord[] {\n const serverPath = this.getServerConfigPath(ctx);\n return [\n this.removeServerFromJson(serverPath, MCP_ROOT_KEY, ctx.connector.id, ctx.dryRun),\n ];\n }\n\n /**\n * Render a normalized ServerDef into Crush's native \"mcp\" entry. Crush has no\n * documented native `${env:VAR}` interpolation — and it expands `$(...)` at\n * load time — so refs are resolved to LITERALS at install time (the safe\n * posture for a host without native interpolation, matching Codex/Kimi).\n */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): CrushStdioServer | CrushHttpServer {\n const transport: Transport = server.transport;\n const disabled = server.enabled === false;\n\n if (transport === \"stdio\") {\n let command = server.command ?? \"\";\n let args = [...(server.args ?? [])];\n\n // Transparent telemetry wrapping: route the real command through\n // `<homeBin> serve --connector <id> -- <command> <args...>`.\n ({ command, args } = buildWrappedStdio(ctx, server, this.id, command, args));\n\n // Resolve to literals — never emit `$(...)` Crush would expand at load.\n command = resolveEnvRefsDeep(command);\n args = resolveEnvRefsDeep(args);\n\n const entry: CrushStdioServer = {\n type: \"stdio\",\n command,\n args,\n timeout: STDIO_TIMEOUT_SECONDS,\n disabled,\n };\n const env = this.renderEnv(server.env);\n if (env) entry.env = env;\n return entry;\n }\n\n // http (and any other remote transport we surface) — Crush registers a URL.\n const entry: CrushHttpServer = {\n type: \"http\",\n url: resolveEnvRefsDeep(server.url ?? \"\"),\n timeout: STDIO_TIMEOUT_SECONDS,\n disabled,\n };\n const headers = this.renderEnv(server.headers);\n if (headers) entry.headers = headers;\n return entry;\n }\n\n /** Resolve env/header values to literals (no native interpolation on Crush). */\n private renderEnv(\n env: Record<string, string> | undefined,\n ): Record<string, string> | undefined {\n if (!env || Object.keys(env).length === 0) return undefined;\n const out: Record<string, string> = {};\n for (const [k, v] of Object.entries(resolveEnvRefsDeep({ ...env }))) {\n out[k] = String(v);\n }\n return out;\n }\n\n // ── Hook install / uninstall (crush.json → hooks.PreToolUse[]) ───────────\n\n installHooks(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.hooks === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"hooks disabled for crush\" }];\n }\n\n const events = this.effectiveHookEvents(ctx);\n const dropped = this.warnSkipHookEvents(ctx);\n const path = this.getHookConfigPath(ctx);\n\n if (events.length === 0 && dropped.length === 0) {\n return [{ platform: this.id, action: \"skip\", path, detail: \"no hooks declared\" }];\n }\n\n const cfg = this.readJson<CrushConfigFile>(path) ?? {};\n const __skip = this.malformedHookRootSkip(path, (cfg as Record<string, unknown>).hooks);\n if (__skip) return [__skip];\n const hooks = (cfg.hooks ??= {});\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n // Declared events Crush cannot fire are reported, never silently dropped.\n for (const event of dropped) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n path,\n detail: `${event} has no Crush hook equivalent — skipped`,\n });\n }\n\n for (const event of events) {\n const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, event, connector.id);\n const matcher = connector.hooks[event]?.matcher ?? \"\";\n const entry: CrushHookEntry = { matcher, command };\n\n const bucket = (hooks[event] ??= []);\n const existingIdx = bucket.findIndex((e) => this.isOurHook(e, ctx));\n\n if (existingIdx >= 0) {\n if (JSON.stringify(bucket[existingIdx]) === JSON.stringify(entry)) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path,\n detail: `hooks.${event} already registered`,\n });\n continue;\n }\n bucket[existingIdx] = entry;\n changes.push({ platform: this.id, action: \"update\", path, detail: `hooks.${event}` });\n } else {\n bucket.push(entry);\n changes.push({ platform: this.id, action: \"create\", path, detail: `hooks.${event}` });\n }\n mutated = true;\n }\n\n if (mutated) this.writeJson(path, cfg, ctx.dryRun);\n return changes;\n }\n\n uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n const path = this.getHookConfigPath(ctx);\n const cfg = this.readJson<CrushConfigFile>(path);\n const hooks = cfg?.hooks;\n if (!cfg || !hooks) {\n return [\n { platform: this.id, action: \"skip\", path, detail: \"no hooks section present\" },\n ];\n }\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const event of Object.keys(hooks)) {\n const bucket = hooks[event];\n if (!Array.isArray(bucket)) continue;\n\n // Keep every entry that is NOT ours (anchored match) so a shared-prefix\n // connector id — or the user's own hook — is never stripped.\n const kept = bucket.filter((e) => !this.isOurHook(e, ctx));\n const removed = bucket.length - kept.length;\n if (removed > 0) {\n if (kept.length > 0) hooks[event] = kept;\n else delete hooks[event];\n changes.push({\n platform: this.id,\n action: \"remove\",\n path,\n detail: `hooks.${event} (${removed})`,\n });\n mutated = true;\n }\n }\n\n if (mutated) this.writeJson(path, cfg, ctx.dryRun);\n if (changes.length === 0) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path,\n detail: \"no matching hook entries\",\n });\n }\n return changes;\n }\n\n // ── Internal helpers ─────────────────────────────────────────────────────\n\n /** Which canonical hook events to register for Crush, honoring overrides. */\n private effectiveHookEvents(ctx: InstallContext): CrushHookEventName[] {\n if (ctx.connector.platforms[HOST]?.hooks === false) return [];\n return CRUSH_HOOK_EVENTS.filter((e) => ctx.connector.hookEvents.includes(e));\n }\n\n /** Declared events Crush has no analog for — install reports a warn-skip. */\n private warnSkipHookEvents(ctx: InstallContext): HookEventName[] {\n if (ctx.connector.platforms[HOST]?.hooks === false) return [];\n return ctx.connector.hookEvents.filter((e) => WARN_SKIP_EVENTS.has(e));\n }\n\n /**\n * Does this hook entry belong to this connector? Anchored on the home-bin +\n * connector-id token (isHomeBinHookCommand) so uninstalling a shared-prefix\n * connector id never strips a sibling's hook.\n */\n private isOurHook(entry: CrushHookEntry | undefined, ctx: InstallContext): boolean {\n if (!entry || typeof entry !== \"object\") return false;\n return isHomeBinHookCommand(entry.command, ctx.homeBinPath, ctx.connector.id);\n }\n\n // ── Content surface: skills (dir-per-skill SKILL.md) ─────────────────────\n // CONTENT-ONLY: pure native-file writers, mirroring goose/openclaw. No\n // runtime dispatch, no home-bin pointer, no telemetry wrap. Each write is\n // idempotent (byte-identical → skip) via writeContentFile and reversible via\n // removeContentFile + removeDirIfEmpty (never rm -rf a shared dir). Honors\n // platforms[\"crush\"].skills === false. No crush.json entry is written — Crush\n // auto-discovers these hard-coded dirs (load.go GlobalSkillsDirs/ProjectSkillsDir).\n //\n // Native locations (Agent-Skills spec — dir-per-skill SKILL.md + resources):\n // project → <projectDir>/.crush/skills/<name>/SKILL.md\n // user → ~/.config/crush/skills/<name>/SKILL.md\n\n /** The skills ROOT dir for ctx.scope (parent of every per-skill dir). */\n private skillsDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".crush\", \"skills\")\n : join(this.userConfigDir(), \"skills\");\n }\n\n /** Per-skill directory: <skillsDir>/<name>. */\n private skillDir(ctx: InstallContext, name: string): string {\n return join(this.skillsDir(ctx), name);\n }\n\n override installSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.skills === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"skills disabled for crush\" }];\n }\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n // Guard a skills path occupied by a regular FILE (would throw ENOTDIR on\n // mkdir): skip-warn rather than crash (the cline `.clinerules`-is-a-file\n // precedent). The per-skill dir or any parent up to the scope root counts.\n const blockingFile = firstFileOnPath(this.skillsDir(ctx), dir);\n if (blockingFile !== null) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: blockingFile,\n detail: `${blockingFile} is a file, not a directory; skill \"${skill.name}\" skipped`,\n });\n continue;\n }\n changes.push(\n this.writeContentFile(join(dir, \"SKILL.md\"), renderSkillMd(skill), ctx.dryRun),\n );\n // Bundle any resource files beside SKILL.md (relative path → contents).\n // Defense-in-depth: skip+warn on any key that escapes the skill dir\n // (config-time validation already rejects these, but never trust input).\n for (const [rel, contents] of Object.entries(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail: `skill resource \"${rel}\" escapes the skill dir; skipped`,\n });\n continue;\n }\n changes.push(this.writeContentFile(target, contents, ctx.dryRun));\n }\n }\n return changes;\n }\n\n override uninstallSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n // Remove only the files we wrote (SKILL.md + declared resources), then the\n // skill dir itself when we own its full contents.\n changes.push(this.removeContentFile(join(dir, \"SKILL.md\"), ctx.dryRun));\n for (const rel of Object.keys(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) continue; // never delete outside the skill dir\n changes.push(this.removeContentFile(target, ctx.dryRun));\n }\n // Only remove the skill dir when WE own its full contents — never rm -rf a\n // dir that still holds user-added / sibling-tool / shared files.\n changes.push(this.removeDirIfEmpty(dir, ctx.dryRun));\n }\n return changes;\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const configPath = this.getServerConfigPath(ctx);\n const connectorId = ctx.connector.id;\n const homeBin = ctx.homeBinPath;\n const hookEvents = this.effectiveHookEvents(ctx);\n return [\n {\n name: `${this.name}: crush.json present`,\n check: () =>\n existsSync(configPath)\n ? { status: \"OK\", detail: configPath }\n : { status: \"FAIL\", detail: `not found: ${configPath}` },\n },\n {\n name: `${this.name}: mcp.${connectorId} registered`,\n check: () => {\n if (!ctx.connector.server) return { status: \"OK\", detail: \"no MCP server declared\" };\n const cfg = this.readJson<CrushConfigFile>(configPath);\n const bucket = cfg?.[MCP_ROOT_KEY];\n const present =\n typeof bucket === \"object\" && bucket !== null && connectorId in bucket;\n return present\n ? { status: \"OK\", detail: `mcp.${connectorId}` }\n : { status: \"FAIL\", detail: `mcp.${connectorId} not found in ${configPath}` };\n },\n },\n {\n name: `${this.name}: hook command registered`,\n check: () => {\n if (hookEvents.length === 0) {\n return { status: \"OK\", detail: \"no hooks declared\" };\n }\n const cfg = this.readJson<CrushConfigFile>(configPath);\n if (!cfg) return { status: \"FAIL\", detail: `cannot read ${configPath}` };\n const hooks = cfg.hooks ?? {};\n const registered = Object.values(hooks).some((entries) =>\n (entries ?? []).some((e) => isHomeBinHookCommand(e?.command, homeBin, connectorId)),\n );\n return registered\n ? { status: \"OK\", detail: \"hook command present\" }\n : { status: \"FAIL\", detail: `no hook for ${connectorId} in ${configPath}` };\n },\n },\n ];\n }\n\n // ── Runtime: parse Crush stdin JSON → normalized event ───────────────────\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as CrushHookInput;\n const connectorId = typeof input.connector === \"string\" ? input.connector : \"\";\n const sessionId = typeof input.session_id === \"string\" ? input.session_id : \"\";\n const projectDir = typeof input.cwd === \"string\" ? input.cwd : undefined;\n\n const base = {\n hostPlatform: HOST,\n connectorId,\n sessionId,\n raw,\n ...(projectDir !== undefined ? { projectDir } : {}),\n } as const;\n\n if (event === \"PreToolUse\") {\n const ev: PreToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n };\n return ev;\n }\n\n // Crush only ever delivers PreToolUse. Surface anything else loudly rather\n // than silently mis-parsing a payload the host cannot actually produce.\n throw new Error(`unsupported crush hook event: ${String(event)}`);\n }\n\n // ── Runtime: normalized response → Crush native hook reply ───────────────\n\n formatReply(event: HookEventName, response: HookResponse): HookReply {\n const decision = response.decision ?? \"allow\";\n\n // deny → Crush blocks the pending tool call via a stdout JSON object with a\n // `decision:\"deny\"` (+ reason). Only PreToolUse is honored; every other\n // event/decision degrades to a silent allow.\n if (decision === \"deny\" && event === \"PreToolUse\") {\n return this.stdout({\n decision: \"deny\",\n reason: response.reason ?? \"Blocked by hook\",\n });\n }\n\n // allow / modify / context / ask / unsupported → pass through (exit 0, empty\n // stdout). Crush cannot rewrite args/output or inject context, so those are\n // dropped fail-open here (the deny path above is the only fail-safe lever).\n return { exitCode: 0 };\n }\n\n private stdout(payload: unknown): HookReply {\n return { exitCode: 0, stdout: JSON.stringify(payload) };\n }\n}\n\n/**\n * Walk every path segment from `root` down to (and including) `leaf` and return\n * the FIRST one that exists as a regular file (which would make a mkdir for the\n * skill dir throw ENOTDIR), else null. Used to skip-warn instead of crashing\n * when a user has a `.crush/skills` file where we need a directory.\n */\nfunction firstFileOnPath(root: string, leaf: string): string | null {\n const segments: string[] = [];\n let cur = leaf;\n while (cur.length >= root.length) {\n segments.unshift(cur);\n if (cur === root) break;\n const parent = dirname(cur);\n if (parent === cur) break;\n cur = parent;\n }\n for (const p of segments) {\n if (!existsSync(p)) return null; // nothing planted from here down\n try {\n if (statSync(p).isFile()) return p;\n } catch {\n return null;\n }\n }\n return null;\n}\n\nexport const adapter = new CrushAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,YAAY,gBAAgB;AACrC,SAAS,eAAe;AACxB,SAAS,SAAS,YAAY;AA0B9B,IAAM,OAAmB;AAEzB,IAAM,eAAe;AAErB,IAAM,wBAAwB;AAO9B,IAAM,oBAAoB,CAAC,YAAY;AAUvC,IAAM,mBAA+C,oBAAI,IAAI;AAAA,EAC3D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAiDM,IAAM,eAAN,cAA2B,YAA+B;AAAA,EACtD,KAAiB;AAAA,EACjB,OAAO;AAAA,EACP,WAAyB;AAAA,EAEzB,eAAqC;AAAA;AAAA;AAAA,IAG5C,gBAAgB;AAAA;AAAA,IAEhB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,c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,cAAc;AACjD,aAAO,KAAK,OAAO;AAAA,QACjB,UAAU;AAAA,QACV,QAAQ,SAAS,UAAU;AAAA,MAC7B,CAAC;AAAA,IACH;AAKA,WAAO,EAAE,UAAU,EAAE;AAAA,EACvB;AAAA,EAEQ,OAAO,SAA6B;AAC1C,WAAO,EAAE,UAAU,GAAG,QAAQ,KAAK,UAAU,OAAO,EAAE;AAAA,EACxD;AACF;AAQA,SAAS,gBAAgB,MAAc,MAA6B;AAClE,QAAM,WAAqB,CAAC;AAC5B,MAAI,MAAM;AACV,SAAO,IAAI,UAAU,KAAK,QAAQ;AAChC,aAAS,QAAQ,GAAG;AACpB,QAAI,QAAQ,KAAM;AAClB,UAAM,SAAS,QAAQ,GAAG;AAC1B,QAAI,WAAW,IAAK;AACpB,UAAM;AAAA,EACR;AACA,aAAW,KAAK,UAAU;AACxB,QAAI,CAAC,WAAW,CAAC,EAAG,QAAO;AAC3B,QAAI;AACF,UAAI,SAAS,CAAC,EAAE,OAAO,EAAG,QAAO;AAAA,IACnC,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEO,IAAM,UAAU,IAAI,aAAa;AACxC,IAAO,gBAAQ;","names":["entry"]}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
normalizeSessionSource
|
|
4
|
+
} from "./chunk-H53QZQJI.js";
|
|
2
5
|
import {
|
|
3
6
|
rewriteEnvRefs
|
|
4
7
|
} from "./chunk-DBQMX75U.js";
|
|
5
8
|
import {
|
|
6
9
|
BaseAdapter
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import
|
|
10
|
+
} from "./chunk-KG6T3YNJ.js";
|
|
11
|
+
import {
|
|
12
|
+
renderSkillMd
|
|
13
|
+
} from "./chunk-IEGR4TP3.js";
|
|
9
14
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
shouldWrapForTelemetry
|
|
14
|
-
} from "./chunk-I5MLE6S7.js";
|
|
15
|
+
buildWrappedStdio,
|
|
16
|
+
isHomeBinHookCommand
|
|
17
|
+
} from "./chunk-TO57WYBB.js";
|
|
15
18
|
import "./chunk-N6HH7K6P.js";
|
|
16
19
|
import "./chunk-TRQKHP7D.js";
|
|
17
20
|
|
|
@@ -164,18 +167,7 @@ var CursorAdapter = class extends BaseAdapter {
|
|
|
164
167
|
if (transport === "stdio") {
|
|
165
168
|
let command = server.command ?? "";
|
|
166
169
|
let args = [...server.args ?? []];
|
|
167
|
-
|
|
168
|
-
const wrapped = buildServeWrapperCommand(
|
|
169
|
-
ctx.homeBinPath,
|
|
170
|
-
ctx.connector.id,
|
|
171
|
-
command,
|
|
172
|
-
args,
|
|
173
|
-
ctx.scope,
|
|
174
|
-
this.id
|
|
175
|
-
);
|
|
176
|
-
command = wrapped.command;
|
|
177
|
-
args = wrapped.args;
|
|
178
|
-
}
|
|
170
|
+
({ command, args } = buildWrappedStdio(ctx, server, this.id, command, args));
|
|
179
171
|
const entry2 = { command: this.rewrite(command) };
|
|
180
172
|
if (args.length > 0) entry2.args = args.map((a) => this.rewrite(a));
|
|
181
173
|
const env = this.renderEnv(server.env);
|
|
@@ -219,140 +211,57 @@ var CursorAdapter = class extends BaseAdapter {
|
|
|
219
211
|
}
|
|
220
212
|
];
|
|
221
213
|
}
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const entry = matcher ? { command, matcher } : { command };
|
|
241
|
-
const bucket = hooks[cursorEvent] ??= [];
|
|
242
|
-
const existingIdx = bucket.findIndex((e) => this.isOurCommand(e.command, ctx));
|
|
243
|
-
if (existingIdx >= 0) {
|
|
244
|
-
if (JSON.stringify(bucket[existingIdx]) === JSON.stringify(entry)) {
|
|
245
|
-
changes.push({
|
|
246
|
-
platform: this.id,
|
|
247
|
-
action: "skip",
|
|
248
|
-
path: hooksPath,
|
|
249
|
-
detail: `hooks.${cursorEvent} already registered`
|
|
250
|
-
});
|
|
251
|
-
continue;
|
|
252
|
-
}
|
|
253
|
-
bucket[existingIdx] = entry;
|
|
254
|
-
changes.push({
|
|
255
|
-
platform: this.id,
|
|
256
|
-
action: "update",
|
|
257
|
-
path: hooksPath,
|
|
258
|
-
detail: `hooks.${cursorEvent}`
|
|
259
|
-
});
|
|
260
|
-
} else {
|
|
261
|
-
bucket.push(entry);
|
|
262
|
-
changes.push({
|
|
263
|
-
platform: this.id,
|
|
264
|
-
action: "create",
|
|
265
|
-
path: hooksPath,
|
|
266
|
-
detail: `hooks.${cursorEvent}`
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
mutated = true;
|
|
270
|
-
}
|
|
271
|
-
for (const event of nativeEvents) {
|
|
272
|
-
if (this.upsertNativeHook(ctx, hooks, event, nativeHooks[event]?.matcher, hooksPath, changes)) {
|
|
273
|
-
mutated = true;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
if (mutated) {
|
|
277
|
-
file.version = CURSOR_HOOKS_VERSION;
|
|
278
|
-
this.writeJson(hooksPath, file, ctx.dryRun);
|
|
279
|
-
}
|
|
280
|
-
return changes;
|
|
214
|
+
const pending = normalizedEvents.map((event) => ({
|
|
215
|
+
event,
|
|
216
|
+
matcher: connector.hooks[event]?.matcher ?? ""
|
|
217
|
+
}));
|
|
218
|
+
const native = nativeEvents.map((event) => ({
|
|
219
|
+
event,
|
|
220
|
+
matcher: nativeHooks[event]?.matcher ?? ""
|
|
221
|
+
}));
|
|
222
|
+
return this.upsertHookEntries(
|
|
223
|
+
ctx,
|
|
224
|
+
this.getHookConfigPath(ctx),
|
|
225
|
+
pending,
|
|
226
|
+
this.hookDescriptor(ctx),
|
|
227
|
+
native
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
uninstallHooks(ctx) {
|
|
231
|
+
return this.removeHookEntries(ctx, this.getHookConfigPath(ctx), this.hookDescriptor(ctx));
|
|
281
232
|
}
|
|
282
233
|
/**
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
234
|
+
* Cursor's hook-merge descriptor (FLAT shape `{ command, matcher? }`):
|
|
235
|
+
* - mapEvent renames canonical → Cursor's lower-camel native key (EVENT_MAP);
|
|
236
|
+
* an unmapped event warn-skips (no Cursor equivalent).
|
|
237
|
+
* - renderEntry omits the `matcher` key when the matcher is falsy — this
|
|
238
|
+
* `{command}` vs `{command,matcher}` distinction is load-bearing on-disk
|
|
239
|
+
* bytes (Cursor's flat entry shape), reproduced exactly here.
|
|
240
|
+
* - install find is connector-generic (ANY of our commands at the flat
|
|
241
|
+
* `entry.command`); uninstall drops whole owned entries (flat — NO
|
|
242
|
+
* stripInner). The version stamp is install-only via onMutate.
|
|
243
|
+
* - the native pass uses EXACT-command ownership so a native key coinciding
|
|
244
|
+
* with a normalized event's mapped key adds a SECOND distinct command
|
|
245
|
+
* rather than clobbering the normalized entry.
|
|
288
246
|
*/
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
bucket.push(entry);
|
|
308
|
-
changes.push({ platform: this.id, action: "create", path: hooksPath, detail: `hooks.${event} (native)` });
|
|
309
|
-
}
|
|
310
|
-
return true;
|
|
311
|
-
}
|
|
312
|
-
uninstallHooks(ctx) {
|
|
313
|
-
const hooksPath = this.getHookConfigPath(ctx);
|
|
314
|
-
const file = this.readJson(hooksPath);
|
|
315
|
-
const hooks = file?.hooks;
|
|
316
|
-
if (!file || !hooks) {
|
|
317
|
-
return [
|
|
318
|
-
{
|
|
319
|
-
platform: this.id,
|
|
320
|
-
action: "skip",
|
|
321
|
-
path: hooksPath,
|
|
322
|
-
detail: "no hooks section present"
|
|
323
|
-
}
|
|
324
|
-
];
|
|
325
|
-
}
|
|
326
|
-
const changes = [];
|
|
327
|
-
let mutated = false;
|
|
328
|
-
for (const cursorEvent of Object.keys(hooks)) {
|
|
329
|
-
const bucket = hooks[cursorEvent];
|
|
330
|
-
if (!Array.isArray(bucket)) continue;
|
|
331
|
-
const before = bucket.length;
|
|
332
|
-
const next = bucket.filter((e) => !this.isOurCommand(e.command, ctx));
|
|
333
|
-
const removed = before - next.length;
|
|
334
|
-
if (removed > 0) {
|
|
335
|
-
if (next.length > 0) hooks[cursorEvent] = next;
|
|
336
|
-
else delete hooks[cursorEvent];
|
|
337
|
-
changes.push({
|
|
338
|
-
platform: this.id,
|
|
339
|
-
action: "remove",
|
|
340
|
-
path: hooksPath,
|
|
341
|
-
detail: `hooks.${cursorEvent} (${removed})`
|
|
342
|
-
});
|
|
343
|
-
mutated = true;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
if (mutated) this.writeJson(hooksPath, file, ctx.dryRun);
|
|
347
|
-
if (changes.length === 0) {
|
|
348
|
-
changes.push({
|
|
349
|
-
platform: this.id,
|
|
350
|
-
action: "skip",
|
|
351
|
-
path: hooksPath,
|
|
352
|
-
detail: "no matching hook entries"
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
return changes;
|
|
247
|
+
hookDescriptor(ctx) {
|
|
248
|
+
return {
|
|
249
|
+
mapEvent: (e) => EVENT_MAP[e],
|
|
250
|
+
unmappedWarnDetail: (e) => `${e} has no Cursor hook equivalent \u2014 skipped`,
|
|
251
|
+
renderEntry: (_event, matcher, command) => matcher ? { command, matcher } : { command },
|
|
252
|
+
entryOwnsCommand: (entry, _command) => this.isOurCommand(entry.command, ctx),
|
|
253
|
+
ownsEntryForRemove: (c) => (entry) => this.isOurCommand(entry.command, c),
|
|
254
|
+
skipDetail: (e) => `hooks.${e} already registered`,
|
|
255
|
+
removeDetail: (e, n) => `hooks.${e} (${n})`,
|
|
256
|
+
absentDetail: "no hooks section present",
|
|
257
|
+
noMatchDetail: "no matching hook entries",
|
|
258
|
+
onMutate: (file) => {
|
|
259
|
+
file.version = CURSOR_HOOKS_VERSION;
|
|
260
|
+
},
|
|
261
|
+
nativeOwnsCommand: (entry, command) => entry.command === command,
|
|
262
|
+
nativeSkipDetail: (e) => `hooks.${e} (native) already registered`,
|
|
263
|
+
nativeMutateDetail: (e) => `hooks.${e} (native)`
|
|
264
|
+
};
|
|
356
265
|
}
|
|
357
266
|
/** True when a hook command references our home binary AND this connector id
|
|
358
267
|
* (anchored so a shared-prefix id can't collide — see isHomeBinHookCommand). */
|
|
@@ -443,7 +352,7 @@ ${cmd.prompt}
|
|
|
443
352
|
for (const skill of connector.skills) {
|
|
444
353
|
const dir = this.skillDir(ctx, skill.name);
|
|
445
354
|
changes.push(
|
|
446
|
-
this.writeContentFile(join(dir, "SKILL.md"),
|
|
355
|
+
this.writeContentFile(join(dir, "SKILL.md"), renderSkillMd(skill), ctx.dryRun)
|
|
447
356
|
);
|
|
448
357
|
for (const [rel, contents] of Object.entries(skill.resources ?? {})) {
|
|
449
358
|
const target = this.resolveWithin(dir, rel);
|
|
@@ -478,25 +387,6 @@ ${cmd.prompt}
|
|
|
478
387
|
}
|
|
479
388
|
return changes;
|
|
480
389
|
}
|
|
481
|
-
/**
|
|
482
|
-
* Render a skill's SKILL.md: frontmatter (name, description + optional model,
|
|
483
|
-
* allowed-tools, disable-model-invocation) + body. Uniform across platforms;
|
|
484
|
-
* only the parent dir differs.
|
|
485
|
-
*/
|
|
486
|
-
renderSkill(skill) {
|
|
487
|
-
const frontmatter = {
|
|
488
|
-
name: skill.name,
|
|
489
|
-
description: skill.description
|
|
490
|
-
};
|
|
491
|
-
if (skill.model !== void 0) frontmatter.model = skill.model;
|
|
492
|
-
const allow = skill.tools?.allow;
|
|
493
|
-
if (allow && allow.length > 0) frontmatter["allowed-tools"] = allow.join(", ");
|
|
494
|
-
if (skill.disableModelInvocation !== void 0) {
|
|
495
|
-
frontmatter["disable-model-invocation"] = skill.disableModelInvocation;
|
|
496
|
-
}
|
|
497
|
-
if (skill.extra) Object.assign(frontmatter, skill.extra);
|
|
498
|
-
return this.renderFrontmatterMd(frontmatter, skill.body);
|
|
499
|
-
}
|
|
500
390
|
// ── Subagents ───────────────────────────────────────────────────────────────
|
|
501
391
|
installSubagents(ctx) {
|
|
502
392
|
const { connector } = ctx;
|
|
@@ -745,18 +635,6 @@ function extractSessionId(input) {
|
|
|
745
635
|
if (typeof input.session_id === "string") return input.session_id;
|
|
746
636
|
return "";
|
|
747
637
|
}
|
|
748
|
-
function normalizeSessionSource(source) {
|
|
749
|
-
switch (source) {
|
|
750
|
-
case "compact":
|
|
751
|
-
return "compact";
|
|
752
|
-
case "resume":
|
|
753
|
-
return "resume";
|
|
754
|
-
case "clear":
|
|
755
|
-
return "clear";
|
|
756
|
-
default:
|
|
757
|
-
return "startup";
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
638
|
var adapter = new CursorAdapter();
|
|
761
639
|
var cursor_default = adapter;
|
|
762
640
|
export {
|
|
@@ -764,4 +642,4 @@ export {
|
|
|
764
642
|
adapter,
|
|
765
643
|
cursor_default as default
|
|
766
644
|
};
|
|
767
|
-
//# sourceMappingURL=cursor-
|
|
645
|
+
//# sourceMappingURL=cursor-GJBSMXI6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/cursor/index.ts"],"sourcesContent":["/**\n * adapters/cursor — Cursor platform adapter for agent-connector.\n *\n * Generalized from context-mode's proven Cursor adapter: the served identity is\n * now `ctx.connector` (not a hardcoded \"context-mode\"), and every hook command\n * points at the single stable home binary (the shared hook-merge engine builds\n * the command) so one framework update propagates everywhere.\n *\n * Cursor is a json-stdio host:\n * - MCP servers: user scope → ~/.cursor/mcp.json (\"mcpServers\"); project scope\n * → <projectDir>/.cursor/mcp.json (\"mcpServers\").\n * - Hooks: <configDir>/hooks.json with shape `{ version, hooks: { <cursorEvent>:\n * [ { command, matcher? } ] } }`. Unlike Claude, each entry is a FLAT command\n * object (no `{ matcher, hooks:[...] }` wrapper).\n * - Reply: a JSON object on stdout (exit 0). deny/ask carry `permission` +\n * `user_message`; modify carries `updated_input`; context injects via\n * `agent_message` (PreToolUse) or `additional_context` (Post/SessionStart).\n *\n * Cursor supports its own `${env:VAR}` native interpolation, so env/header/url\n * values are rewritten to that native token rather than baked into the file.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport { BaseAdapter, type HookMergeDescriptor } from \"../base.js\";\nimport type { Adapter, HookReply, InstallContext, NormalizedEvent } from \"../spi.js\";\nimport type {\n ChangeRecord,\n CommandDef,\n DetectedPlatform,\n HealthCheck,\n HookEventName,\n HookParadigm,\n HookResponse,\n PlatformCapabilities,\n PlatformId,\n PostToolUseEvent,\n PostToolUseFailureEvent,\n PreCompactEvent,\n PreToolUseEvent,\n ServerDef,\n SessionEndEvent,\n SessionStartEvent,\n StopEvent,\n SubagentDef,\n SubagentStartEvent,\n SubagentStopEvent,\n Transport,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport { rewriteEnvRefs } from \"../../core/interpolate.js\";\nimport {\n buildWrappedStdio,\n isHomeBinHookCommand,\n} from \"../../core/spawn.js\";\nimport { renderSkillMd } from \"../claude-code/render.js\";\nimport { normalizeSessionSource } from \"../claude-code/wire.js\";\n\nconst HOST: PlatformId = \"cursor\";\nconst MCP_ROOT_KEY = \"mcpServers\";\n\n/** Native hooks.json version Cursor expects. */\nconst CURSOR_HOOKS_VERSION = 1;\n\n/**\n * Cursor-native hook event names, in the lower-camel form Cursor reads from\n * hooks.json. The first four are the events the proven context-mode adapter\n * registers; postToolUseFailure / subagentStart / subagentStop are Cursor's\n * documented \"Subagent (Task tool) lifecycle\" + tool-failure hooks.\n */\nconst CURSOR_EVENT = {\n PreToolUse: \"preToolUse\",\n PostToolUse: \"postToolUse\",\n SessionStart: \"sessionStart\",\n Stop: \"stop\",\n PostToolUseFailure: \"postToolUseFailure\",\n SubagentStart: \"subagentStart\",\n SubagentStop: \"subagentStop\",\n // Lifecycle/prompt events Cursor 1.7+ documents (cursor.com/docs/hooks):\n // sessionEnd is fire-and-forget; preCompact is observational (cannot block);\n // beforeSubmitPrompt fires before a prompt is sent and CAN prevent submission\n // (Cursor itself matches beforeSubmitPrompt against the value \"UserPromptSubmit\").\n SessionEnd: \"sessionEnd\",\n PreCompact: \"preCompact\",\n UserPromptSubmit: \"beforeSubmitPrompt\",\n} as const;\n\n/**\n * Map our normalized event names to Cursor's native hook event names. Only the\n * events Cursor actually supports are present; everything else has no Cursor\n * equivalent and is reported as a skip/warn at install time.\n *\n * PermissionRequest is deliberately ABSENT: Cursor has no permission-dialog\n * event — its permission gate is the OUTPUT field `permission: \"allow\"|\"deny\"|\n * \"ask\"` of the before* hooks (beforeShellExecution / beforeMCPExecution /\n * beforeReadFile / preToolUse), not an observable event. Install reports the\n * standard skip-warn for it.\n */\nconst EVENT_MAP: Partial<Record<HookEventName, string>> = {\n PreToolUse: CURSOR_EVENT.PreToolUse,\n PostToolUse: CURSOR_EVENT.PostToolUse,\n SessionStart: CURSOR_EVENT.SessionStart,\n Stop: CURSOR_EVENT.Stop,\n PostToolUseFailure: CURSOR_EVENT.PostToolUseFailure,\n SubagentStart: CURSOR_EVENT.SubagentStart,\n SubagentStop: CURSOR_EVENT.SubagentStop,\n SessionEnd: CURSOR_EVENT.SessionEnd,\n PreCompact: CURSOR_EVENT.PreCompact,\n UserPromptSubmit: CURSOR_EVENT.UserPromptSubmit,\n};\n\n/** A single Cursor native hook entry — a flat command object. */\ninterface CursorHookEntry {\n command: string;\n matcher?: string;\n}\n\n/** Native MCP server entry shapes Cursor accepts under `mcpServers`. */\ninterface CursorStdioServer {\n command: string;\n args?: string[];\n env?: Record<string, string>;\n cwd?: string;\n}\ninterface CursorHttpServer {\n url: string;\n headers?: Record<string, string>;\n}\n\n/** Raw Cursor hook stdin payload (snake_case wire fields). */\ninterface CursorWireInput {\n connector?: unknown;\n tool_name?: string;\n tool_input?: Record<string, unknown>;\n tool_output?: string;\n error_message?: string;\n cwd?: string;\n workspace_roots?: string[];\n conversation_id?: string;\n session_id?: string;\n generation_id?: string;\n source?: string;\n trigger?: string;\n status?: string;\n loop_count?: number;\n stop_hook_active?: boolean;\n\n // beforeSubmitPrompt (UserPromptSubmit) — the submitted prompt text.\n // sessionEnd — the documented end reason. Both field names are taken\n // verbatim from cursor.com/docs/hooks (snake_case wire).\n prompt?: string;\n reason?: string;\n\n // postToolUseFailure — Cursor's existing error vocabulary is error_message;\n // the Claude-compatible names are accepted defensively (unverified wire).\n error?: string;\n tool_use_id?: string;\n is_interrupt?: boolean;\n duration_ms?: number;\n\n // subagentStart / subagentStop (Task-tool lifecycle). Both name families are\n // parsed defensively: agent_* (Claude-compatible) and subagent_* (Cursor-ish).\n agent_id?: string;\n agent_type?: string;\n subagent_id?: string;\n subagent_type?: string;\n last_assistant_message?: string;\n}\n\nexport class CursorAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Cursor\";\n readonly paradigm: HookParadigm = \"json-stdio\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block via the BaseAdapter default\n // (memoryTargets: project <projectDir>/AGENTS.md; user scope where documented).\n supportsMemory: true,\n // Cursor natively supports pre/post tool-use, session start/end, prompt\n // submission, context compaction, and stop (cursor.com/docs/hooks, v1.7+).\n preToolUse: true,\n postToolUse: true,\n preCompact: true,\n sessionStart: true,\n sessionEnd: true,\n userPromptSubmit: true,\n stop: true,\n notification: false,\n // Newer events: Cursor has dedicated postToolUseFailure + subagentStart/\n // subagentStop hooks. permissionRequest stays unset — Cursor's permission\n // gate is an OUTPUT field of its before* hooks, not an observable event\n // (see the EVENT_MAP note).\n postToolUseFailure: true,\n subagentStart: true,\n subagentStop: true,\n // Cursor's preToolUse can rewrite tool input (updated_input) but cannot\n // rewrite already-emitted tool output.\n canModifyArgs: true,\n canModifyOutput: false,\n canInjectSessionContext: true,\n transports: [\"stdio\", \"http\"],\n // Content surfaces: Cursor supports all three (commands, skills, subagents).\n supportsCommands: true,\n supportsSkills: true,\n supportsSubagents: true,\n // Native passthrough hooks: Cursor documents many granular hooks with NO\n // canonical analog — beforeShellExecution / afterShellExecution /\n // beforeMCPExecution / afterMCPExecution / beforeReadFile / afterFileEdit /\n // beforeTabFileRead / afterTabFileEdit / workspaceOpen / afterAgentResponse /\n // afterAgentThought (cursor.com/docs/hooks). They are\n // host-specific (below the >=3-host core bar; see\n // docs/research/host-specific-hook-events-design.md). A connector reaches them\n // by declaring platforms[\"cursor\"].nativeHooks; installHooks writes those\n // event-name keys verbatim into hooks.json, and the generic uninstall reverses\n // them.\n supportsNativeHooks: true,\n // Cursor has a command-driven status line (`/statusline` → `statusLine` in\n // ~/.cursor/cli-config.json, GLOBAL scope only) per the Cursor changelog, but\n // the config-key shape + the Claude-parity stdin payload are sourced from a\n // community tool (agent-status-pills), not first-party Cursor docs — payload\n // field names unverified. Deferred pending a live cursor-agent capture; not a\n // permanent gap; user-scope only when wired.\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = join(homedir(), \".cursor\");\n const userMcp = join(userDir, \"mcp.json\");\n const userHooks = join(userDir, \"hooks.json\");\n const projectDirCursor = join(projectDir, \".cursor\");\n const installed =\n existsSync(userDir) ||\n existsSync(userMcp) ||\n existsSync(userHooks) ||\n existsSync(projectDirCursor);\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n configPath: userMcp,\n scope: \"user\",\n reason: installed\n ? `found Cursor config under ${userDir}`\n : `no Cursor config at ${userDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".cursor\")\n : join(homedir(), \".cursor\");\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"mcp.json\");\n }\n\n getHookConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"hooks.json\");\n }\n\n // ── MCP server install / uninstall ───────────────────────────────────────\n\n installServer(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n const override = connector.platforms[HOST]?.server;\n if (!connector.server || override === false) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: connector.server\n ? \"server registration disabled for cursor\"\n : \"connector declares no MCP server\",\n },\n ];\n }\n\n // Shallow-merge any per-platform server override into the base ServerDef.\n const server: ServerDef =\n override && typeof override === \"object\"\n ? { ...connector.server, ...override }\n : connector.server;\n\n const serverPath = this.getServerConfigPath(ctx);\n const entry = this.renderServerEntry(ctx, server);\n\n return [\n this.upsertServerInJson(serverPath, MCP_ROOT_KEY, connector.id, entry, ctx.dryRun),\n ];\n }\n\n uninstallServer(ctx: InstallContext): ChangeRecord[] {\n const serverPath = this.getServerConfigPath(ctx);\n return [\n this.removeServerFromJson(serverPath, MCP_ROOT_KEY, ctx.connector.id, ctx.dryRun),\n ];\n }\n\n /** Render a normalized ServerDef into Cursor's native mcpServers entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): CursorStdioServer | CursorHttpServer {\n const transport: Transport = server.transport;\n\n if (transport === \"stdio\") {\n let command = server.command ?? \"\";\n let args = [...(server.args ?? [])];\n\n // Transparent telemetry wrapping: route the real command through\n // `<homeBin> serve --connector <id> -- <command> <args...>`.\n ({ command, args } = buildWrappedStdio(ctx, server, this.id, command, args));\n\n const entry: CursorStdioServer = { command: this.rewrite(command) };\n if (args.length > 0) entry.args = args.map((a) => this.rewrite(a));\n const env = this.renderEnv(server.env);\n if (env) entry.env = env;\n if (server.cwd) entry.cwd = this.rewrite(server.cwd);\n return entry;\n }\n\n // http (and any other remote transport we surface) — Cursor registers a URL.\n const entry: CursorHttpServer = { url: this.rewrite(server.url ?? \"\") };\n const headers = this.renderEnv(server.headers);\n if (headers) entry.headers = headers;\n return entry;\n }\n\n /**\n * Render env/header values. Cursor supports its own `${env:VAR}` native\n * interpolation, so translate `${env:VAR}` refs to that native token rather\n * than baking secrets into the file. Literals pass through unchanged.\n */\n private renderEnv(\n env: Record<string, string> | undefined,\n ): Record<string, string> | undefined {\n if (!env || Object.keys(env).length === 0) return undefined;\n const out: Record<string, string> = {};\n for (const [k, v] of Object.entries(env)) out[k] = this.rewrite(v);\n return out;\n }\n\n /** Translate `${env:VAR(:-default)}` to Cursor's native `${env:VAR}` token. */\n private rewrite(value: string): string {\n return rewriteEnvRefs(value, cursorEnvToken);\n }\n\n // ── Hook install / uninstall ─────────────────────────────────────────────\n\n installHooks(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n const override = connector.platforms[HOST];\n\n // `hooks: false` disables only the NORMALIZED events. nativeHooks is a\n // sibling, cursor-scoped declaration on the same override and installs\n // regardless.\n const normalizedEvents = override?.hooks === false ? [] : connector.hookEvents;\n const nativeHooks = override?.nativeHooks ?? {};\n const nativeEvents = Object.keys(nativeHooks);\n\n if (normalizedEvents.length === 0 && nativeEvents.length === 0) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: override?.hooks === false ? \"hooks disabled for cursor\" : \"connector declares no hooks\",\n },\n ];\n }\n\n // Normalized events go through the engine's mapEvent/warn path; native\n // event-name keys ride the separate `native` pass (verbatim keys, EXACT\n // command, the `(native)` detail) — see the descriptor + base.upsertHookEntries.\n const pending = normalizedEvents.map((event) => ({\n event,\n matcher: connector.hooks[event]?.matcher ?? \"\",\n }));\n const native = nativeEvents.map((event) => ({\n event,\n matcher: nativeHooks[event]?.matcher ?? \"\",\n }));\n return this.upsertHookEntries(\n ctx,\n this.getHookConfigPath(ctx),\n pending,\n this.hookDescriptor(ctx),\n native,\n );\n }\n\n uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n return this.removeHookEntries(ctx, this.getHookConfigPath(ctx), this.hookDescriptor(ctx));\n }\n\n /**\n * Cursor's hook-merge descriptor (FLAT shape `{ command, matcher? }`):\n * - mapEvent renames canonical → Cursor's lower-camel native key (EVENT_MAP);\n * an unmapped event warn-skips (no Cursor equivalent).\n * - renderEntry omits the `matcher` key when the matcher is falsy — this\n * `{command}` vs `{command,matcher}` distinction is load-bearing on-disk\n * bytes (Cursor's flat entry shape), reproduced exactly here.\n * - install find is connector-generic (ANY of our commands at the flat\n * `entry.command`); uninstall drops whole owned entries (flat — NO\n * stripInner). The version stamp is install-only via onMutate.\n * - the native pass uses EXACT-command ownership so a native key coinciding\n * with a normalized event's mapped key adds a SECOND distinct command\n * rather than clobbering the normalized entry.\n */\n private hookDescriptor(ctx: InstallContext): HookMergeDescriptor<CursorHookEntry> {\n return {\n mapEvent: (e) => EVENT_MAP[e as HookEventName],\n unmappedWarnDetail: (e) => `${e} has no Cursor hook equivalent — skipped`,\n renderEntry: (_event, matcher, command) =>\n matcher ? { command, matcher } : { command },\n entryOwnsCommand: (entry, _command) => this.isOurCommand(entry.command, ctx),\n ownsEntryForRemove: (c) => (entry) => this.isOurCommand(entry.command, c),\n skipDetail: (e) => `hooks.${e} already registered`,\n removeDetail: (e, n) => `hooks.${e} (${n})`,\n absentDetail: \"no hooks section present\",\n noMatchDetail: \"no matching hook entries\",\n onMutate: (file) => {\n (file as { version?: number }).version = CURSOR_HOOKS_VERSION;\n },\n nativeOwnsCommand: (entry, command) => entry.command === command,\n nativeSkipDetail: (e) => `hooks.${e} (native) already registered`,\n nativeMutateDetail: (e) => `hooks.${e} (native)`,\n };\n }\n\n /** True when a hook command references our home binary AND this connector id\n * (anchored so a shared-prefix id can't collide — see isHomeBinHookCommand). */\n private isOurCommand(command: string | undefined, ctx: InstallContext): boolean {\n return isHomeBinHookCommand(command, ctx.homeBinPath, ctx.connector.id);\n }\n\n // ── Content surfaces: commands / skills / subagents ──────────────────────\n // CONTENT-ONLY: pure native-file writers under <configDir>/{commands,skills,\n // agents}. No runtime dispatch, no home-bin pointer, no telemetry wrap. Each\n // method is idempotent (byte-identical → skip) via BaseAdapter.writeContentFile\n // and reversible via removeContentFile. Honors platforms[\"cursor\"] per-surface\n // false to skip. Cursor commands are BODY-ONLY markdown (no frontmatter);\n // skills are the uniform <name>/SKILL.md + resources; subagents are md+fm.\n\n private commandsDir(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"commands\");\n }\n private skillsDir(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"skills\");\n }\n private agentsDir(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"agents\");\n }\n\n /** Native command file path: <configDir>/commands/<name>.md. */\n private commandPath(ctx: InstallContext, name: string): string {\n return join(this.commandsDir(ctx), `${name}.md`);\n }\n /** Native skill dir: <configDir>/skills/<name>. */\n private skillDir(ctx: InstallContext, name: string): string {\n return join(this.skillsDir(ctx), name);\n }\n /** Native subagent file path: <configDir>/agents/<name>.md. */\n private subagentPath(ctx: InstallContext, name: string): string {\n return join(this.agentsDir(ctx), `${name}.md`);\n }\n\n // ── Commands ──────────────────────────────────────────────────────────────\n\n override installCommands(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.commands === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"commands disabled for cursor\" }];\n }\n if (connector.commands.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no commands\" }];\n }\n return connector.commands.map((cmd) =>\n this.writeContentFile(\n this.commandPath(ctx, cmd.name),\n this.renderCommand(cmd),\n ctx.dryRun,\n ),\n );\n }\n\n override uninstallCommands(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.commands.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no commands\" }];\n }\n return connector.commands.map((cmd) =>\n this.removeContentFile(this.commandPath(ctx, cmd.name), ctx.dryRun),\n );\n }\n\n /**\n * Render a Cursor command: BODY-ONLY markdown (no frontmatter). Cursor reads\n * the file as the command prompt verbatim. We prepend the one-line description\n * as an HTML comment header when present so authoring intent survives the\n * round-trip without leaking into the rendered prompt. A description containing\n * \"-->\" would prematurely CLOSE the HTML comment and leak the remainder into\n * the prompt, so we neutralize that sequence before embedding it.\n */\n private renderCommand(cmd: CommandDef): string {\n if (!cmd.description) return `${cmd.prompt}\\n`;\n // Break any literal comment-close so it cannot terminate our header early.\n const safe = cmd.description.replace(/--+>/g, (m) => m.replace(/>/g, \">\"));\n return `<!-- ${safe} -->\\n\\n${cmd.prompt}\\n`;\n }\n\n // ── Skills ────────────────────────────────────────────────────────────────\n\n override installSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.skills === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"skills disabled for cursor\" }];\n }\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n changes.push(\n this.writeContentFile(join(dir, \"SKILL.md\"), renderSkillMd(skill), ctx.dryRun),\n );\n // Bundle any resource files beside SKILL.md (relative path → contents).\n // Defense-in-depth: skip+warn on any key that escapes the skill dir\n // (config-time validation already rejects these, but never trust input).\n for (const [rel, contents] of Object.entries(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail: `skill resource \"${rel}\" escapes the skill dir; skipped`,\n });\n continue;\n }\n changes.push(this.writeContentFile(target, contents, ctx.dryRun));\n }\n }\n return changes;\n }\n\n override uninstallSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n // Remove only the files we wrote (SKILL.md + declared resources), then the\n // skill dir itself when we own its full contents.\n changes.push(this.removeContentFile(join(dir, \"SKILL.md\"), ctx.dryRun));\n for (const rel of Object.keys(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) continue; // never delete outside the skill dir\n changes.push(this.removeContentFile(target, ctx.dryRun));\n }\n // Only remove the skill dir when WE own its full contents — never rm -rf a\n // dir that still holds user-added / sibling-tool / shared files.\n changes.push(this.removeDirIfEmpty(dir, ctx.dryRun));\n }\n return changes;\n }\n\n // ── Subagents ───────────────────────────────────────────────────────────────\n\n override installSubagents(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.subagents === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"subagents disabled for cursor\" }];\n }\n if (connector.subagents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no subagents\" }];\n }\n return connector.subagents.map((agent) =>\n this.writeContentFile(\n this.subagentPath(ctx, agent.name),\n this.renderSubagent(agent),\n ctx.dryRun,\n ),\n );\n }\n\n override uninstallSubagents(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.subagents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no subagents\" }];\n }\n return connector.subagents.map((agent) =>\n this.removeContentFile(this.subagentPath(ctx, agent.name), ctx.dryRun),\n );\n }\n\n /** Render a Cursor subagent to md+frontmatter (name, description, model, readonly) + prompt body. */\n private renderSubagent(agent: SubagentDef): string {\n const frontmatter: Record<string, unknown> = {\n name: agent.name,\n description: agent.description,\n };\n if (agent.model !== undefined) frontmatter.model = agent.model;\n if (agent.readonly !== undefined) frontmatter.readonly = agent.readonly;\n if (agent.extra) Object.assign(frontmatter, agent.extra);\n return this.renderFrontmatterMd(frontmatter, agent.prompt);\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const mcpPath = this.getServerConfigPath(ctx);\n const hooksPath = this.getHookConfigPath(ctx);\n const checks: HealthCheck[] = [\n {\n name: `${this.name}: mcp.json present`,\n check: () =>\n existsSync(mcpPath)\n ? { status: \"OK\", detail: mcpPath }\n : { status: \"FAIL\", detail: `not found: ${mcpPath}` },\n },\n {\n name: `${this.name}: hooks.json present`,\n check: () => {\n // Same \"only assert what the connector declares\" rule as the\n // content-surface checks below: a hookless connector never writes\n // hooks.json, so its absence is healthy, not a failure.\n if (ctx.connector.hookEvents.length === 0) {\n return { status: \"OK\", detail: \"no hooks declared\" };\n }\n return existsSync(hooksPath)\n ? { status: \"OK\", detail: hooksPath }\n : { status: \"FAIL\", detail: `not found: ${hooksPath}` };\n },\n },\n ];\n\n // Content-surface checks: only assert presence of the files this connector\n // declares (skip silently for surfaces it never asked for).\n for (const cmd of ctx.connector.commands) {\n const p = this.commandPath(ctx, cmd.name);\n checks.push({\n name: `${this.name}: command ${cmd.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n for (const skill of ctx.connector.skills) {\n const p = join(this.skillDir(ctx, skill.name), \"SKILL.md\");\n checks.push({\n name: `${this.name}: skill ${skill.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n for (const agent of ctx.connector.subagents) {\n const p = this.subagentPath(ctx, agent.name);\n checks.push({\n name: `${this.name}: subagent ${agent.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n return checks;\n }\n\n // ── Runtime: parse Cursor stdin JSON → normalized event ──────────────────\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as CursorWireInput;\n const connectorId = typeof input.connector === \"string\" ? input.connector : \"\";\n const sessionId = extractSessionId(input);\n const projectDir = this.getProjectDir(input);\n\n const base = {\n hostPlatform: HOST,\n connectorId,\n sessionId,\n raw,\n ...(projectDir !== undefined ? { projectDir } : {}),\n } as const;\n\n switch (event) {\n case \"PreToolUse\": {\n const ev: PreToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n };\n return ev;\n }\n case \"PostToolUse\": {\n const toolOutput = input.tool_output ?? input.error_message;\n const ev: PostToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n ...(toolOutput !== undefined ? { toolOutput } : {}),\n ...(input.error_message ? { isError: true } : {}),\n };\n return ev;\n }\n case \"SessionStart\": {\n const ev: SessionStartEvent = {\n ...base,\n source: normalizeSessionSource(input.source ?? input.trigger),\n };\n return ev;\n }\n case \"Stop\": {\n const ev: StopEvent = {\n ...base,\n ...(typeof input.stop_hook_active === \"boolean\"\n ? { stopHookActive: input.stop_hook_active }\n : {}),\n };\n return ev;\n }\n case \"SessionEnd\": {\n // Cursor sessionEnd: { session_id, reason, duration_ms, ... }. session_id\n // is already folded into base.sessionId via extractSessionId; only the\n // documented `reason` enum maps onto the normalized SessionEnd shape.\n const ev: SessionEndEvent = {\n ...base,\n ...(typeof input.reason === \"string\" ? { reason: input.reason } : {}),\n };\n return ev;\n }\n case \"UserPromptSubmit\": {\n // Cursor beforeSubmitPrompt: { prompt, attachments }. attachments has no\n // normalized field and is preserved via base.raw; only `prompt` maps.\n const ev: UserPromptSubmitEvent = {\n ...base,\n prompt: typeof input.prompt === \"string\" ? input.prompt : \"\",\n };\n return ev;\n }\n case \"PreCompact\": {\n // Cursor preCompact: { trigger: \"auto\"|\"manual\", context_*… }. Only the\n // documented `trigger` enum maps onto the normalized PreCompact shape.\n const ev: PreCompactEvent = {\n ...base,\n ...(input.trigger === \"auto\" || input.trigger === \"manual\"\n ? { trigger: input.trigger }\n : {}),\n };\n return ev;\n }\n case \"PostToolUseFailure\": {\n // Cursor's established error field is error_message; fall back to the\n // Claude-compatible `error` defensively.\n const error = input.error_message ?? input.error ?? \"\";\n const ev: PostToolUseFailureEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n error,\n ...(typeof input.tool_use_id === \"string\"\n ? { toolUseId: input.tool_use_id }\n : {}),\n ...(typeof input.is_interrupt === \"boolean\"\n ? { isInterrupt: input.is_interrupt }\n : {}),\n ...(typeof input.duration_ms === \"number\"\n ? { durationMs: input.duration_ms }\n : {}),\n };\n return ev;\n }\n case \"SubagentStart\": {\n const agentId = input.agent_id ?? input.subagent_id;\n const agentType = input.agent_type ?? input.subagent_type;\n const ev: SubagentStartEvent = {\n ...base,\n ...(typeof agentId === \"string\" ? { agentId } : {}),\n ...(typeof agentType === \"string\" ? { agentType } : {}),\n };\n return ev;\n }\n case \"SubagentStop\": {\n const agentId = input.agent_id ?? input.subagent_id;\n const agentType = input.agent_type ?? input.subagent_type;\n const ev: SubagentStopEvent = {\n ...base,\n ...(typeof agentId === \"string\" ? { agentId } : {}),\n ...(typeof agentType === \"string\" ? { agentType } : {}),\n ...(typeof input.last_assistant_message === \"string\"\n ? { lastAssistantMessage: input.last_assistant_message }\n : {}),\n ...(typeof input.stop_hook_active === \"boolean\"\n ? { stopHookActive: input.stop_hook_active }\n : {}),\n };\n return ev;\n }\n default: {\n // Cursor never delivers Notification / PermissionRequest (no native\n // equivalent — permission is an OUTPUT field of its before* hooks, not\n // an event). If the runtime dispatches one anyway, fail loudly.\n throw new Error(`unsupported cursor hook event: ${String(event)}`);\n }\n }\n }\n\n private getProjectDir(input: CursorWireInput): string | undefined {\n return input.cwd ?? input.workspace_roots?.[0] ?? undefined;\n }\n\n // ── Runtime: normalized response → Cursor native hook reply ──────────────\n\n formatReply(event: HookEventName, response: HookResponse): HookReply {\n const decision = response.decision ?? \"allow\";\n\n // postToolUseFailure (feedback beside the error) and subagentStart (context\n // injected into the SUBAGENT's conversation) are observe/context-only on\n // Cursor: \"context\" emits additional_context, and a \"deny\" DEGRADES to the\n // same shape carrying the reason (the tool already failed / the spawn is\n // not blockable). Everything else is a minimal no-op payload (Cursor\n // rejects empty stdout as \"no valid response\").\n if (event === \"PostToolUseFailure\" || event === \"SubagentStart\") {\n const context =\n decision === \"context\"\n ? response.additionalContext\n : decision === \"deny\"\n ? response.reason ?? response.additionalContext\n : undefined;\n return this.stdout({ additional_context: context ?? \"\" });\n }\n\n // beforeSubmitPrompt (UserPromptSubmit) is a BLOCK gate, not a permission/\n // context surface: its only documented output is { continue, user_message }\n // (cursor.com/docs/hooks). A \"deny\" prevents submission (continue:false +\n // reason); it cannot inject context (no additional_context/agent_message\n // field), so every non-deny decision is a no-op continue:true.\n if (event === \"UserPromptSubmit\") {\n if (decision === \"deny\") {\n return this.stdout({\n continue: false,\n user_message: response.reason ?? \"Blocked by hook\",\n });\n }\n return this.stdout({ continue: true });\n }\n\n // sessionEnd is fire-and-forget (the response is logged but not used) and\n // preCompact is observational (cannot block or modify compaction) per\n // cursor.com/docs/hooks — neither carries a decision Cursor honors, so both\n // are an unconditional no-op passthrough (mirrors Stop).\n if (event === \"SessionEnd\" || event === \"PreCompact\") {\n return { exitCode: 0 };\n }\n\n // deny → block the action with a user-facing message. (On SubagentStop\n // this follows the adapter's Stop idiom — the deny carries Stop semantics.)\n if (decision === \"deny\") {\n return this.stdout({\n permission: \"deny\",\n user_message: response.reason ?? \"Blocked by hook\",\n });\n }\n\n // ask → prompt the user to confirm.\n if (decision === \"ask\") {\n return this.stdout({\n permission: \"ask\",\n user_message: response.reason ?? \"Confirmation required by hook\",\n });\n }\n\n // modify → rewrite PreToolUse input (only where Cursor supports it).\n if (decision === \"modify\") {\n if (event === \"PreToolUse\" && response.updatedInput) {\n return this.stdout({ updated_input: response.updatedInput });\n }\n // Output rewrite is unsupported on Cursor; fall through to allow.\n }\n\n // context → inject soft guidance. PreToolUse uses `agent_message`; Post and\n // SessionStart use `additional_context`.\n if (decision === \"context\" && response.additionalContext) {\n return event === \"PreToolUse\"\n ? this.stdout({ agent_message: response.additionalContext })\n : this.stdout({ additional_context: response.additionalContext });\n }\n\n // SessionStart always emits valid JSON even on a no-op (Cursor rejects empty\n // stdout as \"no valid response\").\n if (event === \"SessionStart\") {\n return this.stdout({ additional_context: response.additionalContext ?? \"\" });\n }\n\n // allow / void → minimal no-op payload (Cursor rejects empty stdout).\n if (event === \"PreToolUse\") return this.stdout({ agent_message: \"\" });\n if (event === \"PostToolUse\") return this.stdout({ additional_context: \"\" });\n return { exitCode: 0 };\n }\n\n private stdout(payload: unknown): HookReply {\n return { exitCode: 0, stdout: JSON.stringify(payload) };\n }\n}\n\n/** Cursor native interpolation token: `${env:VAR}` → `${env:VAR}` (passthrough). */\nfunction cursorEnvToken(name: string): string {\n return `\\${env:${name}}`;\n}\n\nfunction extractSessionId(input: CursorWireInput): string {\n if (typeof input.conversation_id === \"string\") return input.conversation_id;\n if (typeof input.session_id === \"string\") return input.session_id;\n return \"\";\n}\n\nexport const adapter = new CursorAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,YAAY;AAoCrB,IAAM,OAAmB;AACzB,IAAM,eAAe;AAGrB,IAAM,uBAAuB;AAQ7B,IAAM,eAAe;AAAA,EACnB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,cAAc;AAAA,EACd,MAAM;AAAA,EACN,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA,EAKd,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,kBAAkB;AACpB;AAaA,IAAM,YAAoD;AAAA,EACxD,YAAY,aAAa;AAAA,EACzB,aAAa,aAAa;AAAA,EAC1B,cAAc,aAAa;AAAA,EAC3B,MAAM,aAAa;AAAA,EACnB,oBAAoB,aAAa;AAAA,EACj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AS,eAAe,MAAsB;AAC5C,SAAO,UAAU,IAAI;AACvB;AAEA,SAAS,iBAAiB,OAAgC;AACxD,MAAI,OAAO,MAAM,oBAAoB,SAAU,QAAO,MAAM;AAC5D,MAAI,OAAO,MAAM,eAAe,SAAU,QAAO,MAAM;AACvD,SAAO;AACT;AAEO,IAAM,UAAU,IAAI,cAAc;AACzC,IAAO,iBAAQ;","names":["entry"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
print
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-A2T4Q7RM.js";
|
|
5
5
|
import {
|
|
6
6
|
detectInstalledPlatforms
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-NYR55UT7.js";
|
|
8
|
+
import "./chunk-XQUUNAGC.js";
|
|
9
9
|
|
|
10
10
|
// src/cli/commands/detect.ts
|
|
11
11
|
import { parseArgs } from "util";
|
|
@@ -71,4 +71,4 @@ async function run(argv) {
|
|
|
71
71
|
export {
|
|
72
72
|
run
|
|
73
73
|
};
|
|
74
|
-
//# sourceMappingURL=detect-
|
|
74
|
+
//# sourceMappingURL=detect-YDCZNV4W.js.map
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
marketplaceDoctorChecks,
|
|
4
4
|
syncConnector
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-VRKTVCYJ.js";
|
|
6
|
+
import "./chunk-CDVOBKSG.js";
|
|
7
7
|
import {
|
|
8
8
|
readMarketplaceInstalls
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7TVBFRVI.js";
|
|
10
10
|
import {
|
|
11
11
|
fail,
|
|
12
12
|
parseScope,
|
|
13
13
|
parseTargets,
|
|
14
14
|
print
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-A2T4Q7RM.js";
|
|
16
16
|
import {
|
|
17
17
|
LineBuffer,
|
|
18
18
|
idKey,
|
|
@@ -20,28 +20,29 @@ import {
|
|
|
20
20
|
} from "./chunk-OP4KBXUO.js";
|
|
21
21
|
import {
|
|
22
22
|
spawnChild
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-7QRUZAUG.js";
|
|
24
24
|
import {
|
|
25
25
|
detectInstalledPlatforms
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-NYR55UT7.js";
|
|
27
27
|
import "./chunk-KHO5WNTP.js";
|
|
28
28
|
import {
|
|
29
29
|
findConnectorConfig,
|
|
30
30
|
listRegisteredConnectors,
|
|
31
31
|
loadConnectorFromPath,
|
|
32
32
|
readRegisteredMeta
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-MOW2RKHX.js";
|
|
34
34
|
import {
|
|
35
35
|
MCP_PROTOCOL_VERSION
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-HOE2MN36.js";
|
|
37
37
|
import {
|
|
38
38
|
REGISTERED_PLATFORM_IDS,
|
|
39
39
|
loadAdapter
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-XQUUNAGC.js";
|
|
41
41
|
import "./chunk-FAHIMJRU.js";
|
|
42
|
+
import "./chunk-UM5S7DKK.js";
|
|
42
43
|
import "./chunk-OPXAP3AC.js";
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-IEGR4TP3.js";
|
|
45
|
+
import "./chunk-TO57WYBB.js";
|
|
45
46
|
import "./chunk-N6HH7K6P.js";
|
|
46
47
|
import {
|
|
47
48
|
dataRoot,
|
|
@@ -537,4 +538,4 @@ async function run(argv) {
|
|
|
537
538
|
export {
|
|
538
539
|
run
|
|
539
540
|
};
|
|
540
|
-
//# sourceMappingURL=doctor-
|
|
541
|
+
//# sourceMappingURL=doctor-DGC7P3P7.js.map
|