@ken-jo/agent-connector 0.4.79 → 0.4.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +302 -561
- package/dist/{action-OHGFVKMC.js → action-CVIEPX4U.js} +14 -14
- package/dist/{amazon-q-B52EY2SV.js → amazon-q-TIT7FIW3.js} +5 -5
- package/dist/{amp-UXABVUKC.js → amp-NF3OAAUG.js} +5 -5
- package/dist/{antigravity-RZHN53VB.js → antigravity-7LPK7QOY.js} +6 -6
- package/dist/antigravity-cli-MDEMPPAH.js +467 -0
- package/dist/antigravity-cli-MDEMPPAH.js.map +1 -0
- package/dist/{chunk-QKLJU4JX.js → chunk-2Y2MZRLP.js} +56 -2
- package/dist/chunk-2Y2MZRLP.js.map +1 -0
- package/dist/{chunk-UBB7T54N.js → chunk-3C5AASHM.js} +3 -3
- package/dist/{chunk-LKAVD4HP.js → chunk-447JWFZO.js} +12 -12
- package/dist/{chunk-HORHRHNG.js → chunk-4NHXLXSD.js} +2 -2
- package/dist/chunk-5Z36KVU2.js +590 -0
- package/dist/chunk-5Z36KVU2.js.map +1 -0
- package/dist/{chunk-AY3RGRTT.js → chunk-6TF7MHG5.js} +2 -2
- package/dist/{chunk-AMK2K6XZ.js → chunk-7UT6OB52.js} +2 -2
- package/dist/{chunk-PZHB5TVA.js → chunk-AY3VFNOH.js} +5 -5
- package/dist/{chunk-4HVQ7IUM.js → chunk-DI5S6TXJ.js} +17 -4
- package/dist/chunk-DI5S6TXJ.js.map +1 -0
- package/dist/{chunk-ZXX5DVSE.js → chunk-FBCBHEGB.js} +8 -8
- package/dist/{chunk-4NSU3KWX.js → chunk-FJCUKXGX.js} +2 -2
- package/dist/{chunk-S4E6QQEM.js → chunk-FO5CEXXN.js} +7 -2
- package/dist/chunk-FO5CEXXN.js.map +1 -0
- package/dist/{chunk-IXOQDZWC.js → chunk-GZGLCCEE.js} +5 -1
- package/dist/chunk-GZGLCCEE.js.map +1 -0
- package/dist/{chunk-UYZ53KWS.js → chunk-IBLYVAWH.js} +31 -9
- package/dist/chunk-IBLYVAWH.js.map +1 -0
- package/dist/{chunk-4FWETID5.js → chunk-IVAWP6HH.js} +2 -2
- package/dist/{chunk-NBUEL74R.js → chunk-JFXL4HYA.js} +3 -3
- package/dist/{chunk-VD4EG6SG.js → chunk-JO2IM2JL.js} +538 -226
- package/dist/chunk-JO2IM2JL.js.map +1 -0
- package/dist/{chunk-7NXEHZAK.js → chunk-JVO6NBTT.js} +3 -3
- package/dist/{chunk-X457NOFE.js → chunk-KA55FISM.js} +116 -36
- package/dist/chunk-KA55FISM.js.map +1 -0
- package/dist/{chunk-YJP3KGLM.js → chunk-L26PSQTY.js} +4 -4
- package/dist/{chunk-YYNXIUR2.js → chunk-M2H7JURF.js} +2 -2
- package/dist/{chunk-56R2ER7K.js → chunk-NBYKLUF6.js} +2 -2
- package/dist/{chunk-IRUYJD23.js → chunk-NLE2J5P4.js} +1 -1
- package/dist/{chunk-VVFDU4IX.js → chunk-WFEHWTLM.js} +12 -5
- package/dist/{chunk-VVFDU4IX.js.map → chunk-WFEHWTLM.js.map} +1 -1
- package/dist/{chunk-LN76OGNR.js → chunk-Z2MRSS2I.js} +2 -2
- package/dist/{claude-code-T6ZRCMA7.js → claude-code-7RS4YVGZ.js} +9 -9
- package/dist/cli/sdk.js +7 -7
- package/dist/cli.js +1 -1
- package/dist/{cline-NNMVCECA.js → cline-BZQAUYPC.js} +5 -5
- package/dist/codebuddy-G42IKGKB.js +643 -0
- package/dist/codebuddy-G42IKGKB.js.map +1 -0
- package/dist/{codebuff-RJIDSEU3.js → codebuff-5RLTLZAU.js} +5 -5
- package/dist/{codex-RHKQKNNG.js → codex-XHAMJILX.js} +14 -8
- package/dist/{codex-RHKQKNNG.js.map → codex-XHAMJILX.js.map} +1 -1
- package/dist/{continue-MNM7YVJY.js → continue-JLIB7R7X.js} +6 -6
- package/dist/{copilot-cli-SMTX5F65.js → copilot-cli-XZSUYNQZ.js} +5 -5
- package/dist/{crush-NYDBHIJE.js → crush-ESERLVLT.js} +5 -5
- package/dist/{cursor-AOELDNZU.js → cursor-FUDOV5VK.js} +6 -6
- package/dist/{detect-ALAKE54S.js → detect-Z5BDTY6B.js} +4 -4
- package/dist/devin-Y7PWKVHY.js +510 -0
- package/dist/devin-Y7PWKVHY.js.map +1 -0
- package/dist/{doctor-UNF7FCF4.js → doctor-GAP27PP2.js} +27 -23
- package/dist/doctor-GAP27PP2.js.map +1 -0
- package/dist/{droid-PTCH2K7Y.js → droid-DTO5POTK.js} +5 -5
- package/dist/{gemini-cli-QGLN2UMS.js → gemini-cli-RBIG6U2F.js} +5 -5
- package/dist/{goose-DQ6GSZ5O.js → goose-VGNOP5J2.js} +6 -6
- package/dist/grok-cli-2RFBK6J3.js +482 -0
- package/dist/grok-cli-2RFBK6J3.js.map +1 -0
- package/dist/{hermes-E47IG63A.js → hermes-NUKFWZI5.js} +6 -6
- package/dist/{hook-GM2IDA3C.js → hook-XPR3AHDI.js} +14 -14
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/install-O32TDIZP.js +382 -0
- package/dist/install-O32TDIZP.js.map +1 -0
- package/dist/{introspect-5o5ick0_.d.ts → introspect-BkId4LGP.d.ts} +1 -1
- package/dist/{jetbrains-copilot-4IOT3I2Y.js → jetbrains-copilot-FXZ5AOTS.js} +31 -9
- package/dist/jetbrains-copilot-FXZ5AOTS.js.map +1 -0
- package/dist/junie-TSXIZSCE.js +227 -0
- package/dist/junie-TSXIZSCE.js.map +1 -0
- package/dist/{kilo-TAHOPT2Q.js → kilo-JLH3KVZJ.js} +8 -8
- package/dist/{kilo-cli-X4NPJWGX.js → kilo-cli-5W36VJQZ.js} +8 -8
- package/dist/{kimi-Z7L2LEEI.js → kimi-R62W7HKZ.js} +5 -5
- package/dist/{kiro-YZ4TTZGD.js → kiro-AUJMGIBL.js} +81 -6
- package/dist/kiro-AUJMGIBL.js.map +1 -0
- package/dist/{leaderboard-DVW4WYJ6.js → leaderboard-YWMOSJBC.js} +7 -7
- package/dist/{mimo-code-G2CBZ4M6.js → mimo-code-PGLFFVER.js} +5 -5
- package/dist/mistral-vibe-36CZVQNQ.js +300 -0
- package/dist/mistral-vibe-36CZVQNQ.js.map +1 -0
- package/dist/{mux-JNM3F2NW.js → mux-HWL4N5KH.js} +5 -5
- package/dist/{nemoclaw-SHA4IUML.js → nemoclaw-QPHETUXM.js} +6 -6
- package/dist/{omp-OOVUNXME.js → omp-3TFMTJ5U.js} +5 -5
- package/dist/open-interpreter-UTBKE2EH.js +264 -0
- package/dist/open-interpreter-UTBKE2EH.js.map +1 -0
- package/dist/openclaw-RYFO5TLY.js +17 -0
- package/dist/{opencode-W2RK4M7G.js → opencode-JX7GBE5Q.js} +5 -5
- package/dist/openhands-AZW4PXJ3.js +384 -0
- package/dist/openhands-AZW4PXJ3.js.map +1 -0
- package/dist/{package-H5V3AZHR.js → package-2KKUGZFS.js} +13 -13
- package/dist/{pi-I7BLL4EI.js → pi-MRI3EBWU.js} +143 -6
- package/dist/pi-MRI3EBWU.js.map +1 -0
- package/dist/{qwen-code-JG7AF442.js → qwen-code-ISR6BEET.js} +9 -9
- package/dist/{roo-code-L5F7S6QH.js → roo-code-6TSCME4R.js} +5 -5
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +12 -12
- package/dist/sdk/index.d.ts +3 -3
- package/dist/sdk/index.js +6 -6
- package/dist/sdk/test.d.ts +2 -2
- package/dist/sdk/test.js +10 -10
- package/dist/{serve-WMO2TUW3.js → serve-EPRN7F2X.js} +14 -14
- package/dist/{status-WRLBTBRE.js → status-B2PG6YKR.js} +11 -11
- package/dist/{statusline-EUD4DMIP.js → statusline-5ERFMYSM.js} +13 -13
- package/dist/{telemetry-U3LGMR3D.js → telemetry-ZMCAWBWB.js} +10 -10
- package/dist/{trae-Z7CQ2A2Q.js → trae-7KDCYIMN.js} +5 -5
- package/dist/{types-D6RWGXm1.d.ts → types-D0RqWxT8.d.ts} +53 -9
- package/dist/{uninstall-TWPUEJEC.js → uninstall-M76BHLTH.js} +37 -27
- package/dist/uninstall-M76BHLTH.js.map +1 -0
- package/dist/{upgrade-EM6Y7QLH.js → upgrade-JLSCNAQA.js} +25 -19
- package/dist/upgrade-JLSCNAQA.js.map +1 -0
- package/dist/{usage-3HQDTXGY.js → usage-5I72HWCR.js} +3 -3
- package/dist/{usage-event-DWIGKO7V.js → usage-event-HIX4ZI45.js} +13 -13
- package/dist/{vscode-copilot-LU5NC4ZS.js → vscode-copilot-LILHAPJI.js} +20 -5
- package/dist/vscode-copilot-LILHAPJI.js.map +1 -0
- package/dist/{warp-4PPG5LOM.js → warp-KJUCWEA3.js} +5 -5
- package/dist/{windsurf-3T3RVXKM.js → windsurf-5TGGQR5I.js} +5 -5
- package/dist/{zed-LLOAUXSA.js → zed-EL3JCZ25.js} +123 -7
- package/dist/zed-EL3JCZ25.js.map +1 -0
- package/package.json +1 -1
- package/dist/antigravity-cli-KODEKUTM.js +0 -87
- package/dist/antigravity-cli-KODEKUTM.js.map +0 -1
- package/dist/chunk-4HVQ7IUM.js.map +0 -1
- package/dist/chunk-IXOQDZWC.js.map +0 -1
- package/dist/chunk-QKLJU4JX.js.map +0 -1
- package/dist/chunk-S4E6QQEM.js.map +0 -1
- package/dist/chunk-UYZ53KWS.js.map +0 -1
- package/dist/chunk-VD4EG6SG.js.map +0 -1
- package/dist/chunk-VKRGQLY4.js +0 -201
- package/dist/chunk-VKRGQLY4.js.map +0 -1
- package/dist/chunk-X457NOFE.js.map +0 -1
- package/dist/doctor-UNF7FCF4.js.map +0 -1
- package/dist/install-7O4XWH7T.js +0 -96
- package/dist/install-7O4XWH7T.js.map +0 -1
- package/dist/jetbrains-copilot-4IOT3I2Y.js.map +0 -1
- package/dist/kiro-YZ4TTZGD.js.map +0 -1
- package/dist/openclaw-BD56E5MV.js +0 -17
- package/dist/pi-I7BLL4EI.js.map +0 -1
- package/dist/uninstall-TWPUEJEC.js.map +0 -1
- package/dist/upgrade-EM6Y7QLH.js.map +0 -1
- package/dist/vscode-copilot-LU5NC4ZS.js.map +0 -1
- package/dist/zed-LLOAUXSA.js.map +0 -1
- /package/dist/{action-OHGFVKMC.js.map → action-CVIEPX4U.js.map} +0 -0
- /package/dist/{amazon-q-B52EY2SV.js.map → amazon-q-TIT7FIW3.js.map} +0 -0
- /package/dist/{amp-UXABVUKC.js.map → amp-NF3OAAUG.js.map} +0 -0
- /package/dist/{antigravity-RZHN53VB.js.map → antigravity-7LPK7QOY.js.map} +0 -0
- /package/dist/{chunk-UBB7T54N.js.map → chunk-3C5AASHM.js.map} +0 -0
- /package/dist/{chunk-LKAVD4HP.js.map → chunk-447JWFZO.js.map} +0 -0
- /package/dist/{chunk-HORHRHNG.js.map → chunk-4NHXLXSD.js.map} +0 -0
- /package/dist/{chunk-AY3RGRTT.js.map → chunk-6TF7MHG5.js.map} +0 -0
- /package/dist/{chunk-AMK2K6XZ.js.map → chunk-7UT6OB52.js.map} +0 -0
- /package/dist/{chunk-PZHB5TVA.js.map → chunk-AY3VFNOH.js.map} +0 -0
- /package/dist/{chunk-ZXX5DVSE.js.map → chunk-FBCBHEGB.js.map} +0 -0
- /package/dist/{chunk-4NSU3KWX.js.map → chunk-FJCUKXGX.js.map} +0 -0
- /package/dist/{chunk-4FWETID5.js.map → chunk-IVAWP6HH.js.map} +0 -0
- /package/dist/{chunk-NBUEL74R.js.map → chunk-JFXL4HYA.js.map} +0 -0
- /package/dist/{chunk-7NXEHZAK.js.map → chunk-JVO6NBTT.js.map} +0 -0
- /package/dist/{chunk-YJP3KGLM.js.map → chunk-L26PSQTY.js.map} +0 -0
- /package/dist/{chunk-YYNXIUR2.js.map → chunk-M2H7JURF.js.map} +0 -0
- /package/dist/{chunk-56R2ER7K.js.map → chunk-NBYKLUF6.js.map} +0 -0
- /package/dist/{chunk-IRUYJD23.js.map → chunk-NLE2J5P4.js.map} +0 -0
- /package/dist/{chunk-LN76OGNR.js.map → chunk-Z2MRSS2I.js.map} +0 -0
- /package/dist/{claude-code-T6ZRCMA7.js.map → claude-code-7RS4YVGZ.js.map} +0 -0
- /package/dist/{cline-NNMVCECA.js.map → cline-BZQAUYPC.js.map} +0 -0
- /package/dist/{codebuff-RJIDSEU3.js.map → codebuff-5RLTLZAU.js.map} +0 -0
- /package/dist/{continue-MNM7YVJY.js.map → continue-JLIB7R7X.js.map} +0 -0
- /package/dist/{copilot-cli-SMTX5F65.js.map → copilot-cli-XZSUYNQZ.js.map} +0 -0
- /package/dist/{crush-NYDBHIJE.js.map → crush-ESERLVLT.js.map} +0 -0
- /package/dist/{cursor-AOELDNZU.js.map → cursor-FUDOV5VK.js.map} +0 -0
- /package/dist/{detect-ALAKE54S.js.map → detect-Z5BDTY6B.js.map} +0 -0
- /package/dist/{droid-PTCH2K7Y.js.map → droid-DTO5POTK.js.map} +0 -0
- /package/dist/{gemini-cli-QGLN2UMS.js.map → gemini-cli-RBIG6U2F.js.map} +0 -0
- /package/dist/{goose-DQ6GSZ5O.js.map → goose-VGNOP5J2.js.map} +0 -0
- /package/dist/{hermes-E47IG63A.js.map → hermes-NUKFWZI5.js.map} +0 -0
- /package/dist/{hook-GM2IDA3C.js.map → hook-XPR3AHDI.js.map} +0 -0
- /package/dist/{kilo-TAHOPT2Q.js.map → kilo-JLH3KVZJ.js.map} +0 -0
- /package/dist/{kilo-cli-X4NPJWGX.js.map → kilo-cli-5W36VJQZ.js.map} +0 -0
- /package/dist/{kimi-Z7L2LEEI.js.map → kimi-R62W7HKZ.js.map} +0 -0
- /package/dist/{leaderboard-DVW4WYJ6.js.map → leaderboard-YWMOSJBC.js.map} +0 -0
- /package/dist/{mimo-code-G2CBZ4M6.js.map → mimo-code-PGLFFVER.js.map} +0 -0
- /package/dist/{mux-JNM3F2NW.js.map → mux-HWL4N5KH.js.map} +0 -0
- /package/dist/{nemoclaw-SHA4IUML.js.map → nemoclaw-QPHETUXM.js.map} +0 -0
- /package/dist/{omp-OOVUNXME.js.map → omp-3TFMTJ5U.js.map} +0 -0
- /package/dist/{openclaw-BD56E5MV.js.map → openclaw-RYFO5TLY.js.map} +0 -0
- /package/dist/{opencode-W2RK4M7G.js.map → opencode-JX7GBE5Q.js.map} +0 -0
- /package/dist/{package-H5V3AZHR.js.map → package-2KKUGZFS.js.map} +0 -0
- /package/dist/{qwen-code-JG7AF442.js.map → qwen-code-ISR6BEET.js.map} +0 -0
- /package/dist/{roo-code-L5F7S6QH.js.map → roo-code-6TSCME4R.js.map} +0 -0
- /package/dist/{serve-WMO2TUW3.js.map → serve-EPRN7F2X.js.map} +0 -0
- /package/dist/{status-WRLBTBRE.js.map → status-B2PG6YKR.js.map} +0 -0
- /package/dist/{statusline-EUD4DMIP.js.map → statusline-5ERFMYSM.js.map} +0 -0
- /package/dist/{telemetry-U3LGMR3D.js.map → telemetry-ZMCAWBWB.js.map} +0 -0
- /package/dist/{trae-Z7CQ2A2Q.js.map → trae-7KDCYIMN.js.map} +0 -0
- /package/dist/{usage-3HQDTXGY.js.map → usage-5I72HWCR.js.map} +0 -0
- /package/dist/{usage-event-DWIGKO7V.js.map → usage-event-HIX4ZI45.js.map} +0 -0
- /package/dist/{warp-4PPG5LOM.js.map → warp-KJUCWEA3.js.map} +0 -0
- /package/dist/{windsurf-3T3RVXKM.js.map → windsurf-5TGGQR5I.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/jetbrains-copilot/index.ts"],"sourcesContent":["/**\n * adapters/jetbrains-copilot — JetBrains Copilot platform adapter for agent-connector.\n *\n * JetBrains Copilot shares the Copilot hook paradigm with VS Code Copilot\n * (Claude-compatible json-stdio), but diverges on MCP registration:\n *\n * - MCP servers: JetBrains stores MCP server registration via the IDE Settings\n * UI (Settings > Tools > GitHub Copilot > MCP > Configure), NOT in any file\n * we can reliably write — the runtime owns the `servers` key behind the UI.\n * So `installServer` writes NOTHING and returns a \"warn\" ChangeRecord telling\n * the user to add the server via the JetBrains MCP settings UI. Writing a\n * bogus file would be ignored at best and corrupt real UI state at worst.\n * `getHealthChecks` surfaces this as a WARN (not FAIL).\n *\n * - Hooks (Copilot Preview hooks): file-based and identical in shape to VS Code\n * Copilot. We write one per-connector file at\n * <projectDir>/.github/hooks/<connector-id>.json shaped as:\n * { \"version\": 1, \"hooks\": { <Event>: [ { \"type\": \"command\", \"command\" } ] } }\n * The top-level `version: 1` is REQUIRED — the Copilot hooks runtime rejects a\n * version-less file and no hooks fire. Each entry is a FLAT { type, command }\n * object (no Claude-style { matcher, hooks:[...] } wrapper). JetBrains parses\n * matchers but IGNORES them — ALL hooks fire on ALL tools — so we omit the\n * matcher entirely rather than persist an advisory one that never applies.\n *\n * - Reply: Claude-compatible JSON on stdout (exit 0), a `hookSpecificOutput`\n * object keyed by the PascalCase `hookEventName` carrying permissionDecision\n * (deny|ask) + permissionDecisionReason and additionalContext. This mirrors\n * vscode-copilot/claude-code exactly EXCEPT JetBrains cannot rewrite tool\n * input (canModifyArgs:false), so a \"modify\" decision degrades to allow.\n *\n * Env interpolation: GitHub Copilot does not document a portable native env\n * token for the hooks file, and the hooks file only ever carries our home-bin\n * hook command (no secrets), so there is nothing to interpolate here. MCP env\n * interpolation is moot because we never write the MCP file.\n */\n\nimport { existsSync } from \"node:fs\";\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 CommandDef,\n DetectedPlatform,\n HealthCheck,\n HookEventName,\n HookParadigm,\n HookResponse,\n NotificationEvent,\n PlatformCapabilities,\n PlatformId,\n PostToolUseEvent,\n PostCompactEvent,\n PreCompactEvent,\n PreToolUseEvent,\n SessionEndEvent,\n SessionStartEvent,\n StopEvent,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport {\n buildHomeBinHookCommand,\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 = \"jetbrains-copilot\";\n\n/** Top-level version the Copilot hooks runtime requires; a version-less file is rejected. */\nconst JETBRAINS_HOOKS_VERSION = 1;\n\n/**\n * JetBrains Copilot reads PascalCase hook event names from its hooks file —\n * identical to VS Code Copilot / Claude Code. Only the events JetBrains actually\n * delivers are registered; everything else has no Copilot equivalent and is\n * reported as a warn/skip at install time.\n */\nconst EVENT_MAP: Partial<Record<HookEventName, string>> = {\n PreToolUse: \"PreToolUse\",\n PostToolUse: \"PostToolUse\",\n PreCompact: \"PreCompact\",\n SessionStart: \"SessionStart\",\n SessionEnd: \"SessionEnd\",\n UserPromptSubmit: \"UserPromptSubmit\",\n};\n\nconst WORKSPACE_SCOPE_DETAIL =\n \"JetBrains Copilot hooks and content are workspace-scoped (.github); rerun with --scope project to install them.\";\n\n/** A single JetBrains Copilot native hook entry — a flat command object. */\ninterface JetBrainsHookEntry {\n type: \"command\";\n command: string;\n}\n\n/** The shape of a JetBrains Copilot .github/hooks/<connector>.json file. */\ninterface JetBrainsHooksFile {\n version?: number;\n hooks?: Record<string, JetBrainsHookEntry[]>;\n}\n\n/**\n * Raw JetBrains Copilot hook stdin payload (Claude-compatible snake_case fields).\n *\n * Common input fields (every event): session_id, transcript_path, cwd,\n * hook_event_name. There is NO `workspace_roots` field — JetBrains aliases the\n * VS Code `.github/hooks` surface which sends only `cwd` (workspace_roots was a\n * dead fallback; removed — getProjectDir now relies on `cwd` only, matching\n * vscode-copilot #211).\n */\ninterface JetBrainsWireInput {\n session_id?: string;\n transcript_path?: string;\n cwd?: string;\n hook_event_name?: string;\n\n // tool events. PostToolUse fires ONLY after a tool completes SUCCESSFULLY and\n // sends { tool_name, tool_input, tool_use_id, tool_response } — the VS Code\n // `.github/hooks` dialect this host ALIASES (vscode-copilot), NOT copilot-cli's\n // `tool_result`. `tool_response` is the sole result field; there is NO\n // `tool_output` and NO `error_message`, so those reads are dead here.\n tool_name?: string;\n tool_input?: Record<string, unknown>;\n tool_response?: unknown;\n\n // SessionStart\n source?: string;\n // SessionEnd\n reason?: string;\n // UserPromptSubmit\n prompt?: string;\n // PreCompact\n trigger?: string;\n // Stop\n stop_hook_active?: boolean;\n // Notification\n message?: string;\n\n /** Injected by the entrypoint so the runtime knows which connector to dispatch. */\n connector?: string;\n}\n\nexport class JetBrainsCopilotAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"JetBrains Copilot\";\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 // JetBrains Copilot's Preview hooks runtime delivers Pre/PostToolUse,\n // PreCompact, SessionStart, SessionEnd, and UserPromptSubmit (GitHub's\n // hooks-reference) — same surface as VS Code Copilot, whose reply contract\n // this adapter mirrors exactly (see formatReply: UserPromptSubmit/PostToolUse\n // deny → top-level {decision:block}). Stop stays unwired (refuted for\n // JetBrains: an unimplemented feature request, not in the documented schema).\n preToolUse: true,\n postToolUse: true,\n preCompact: true,\n sessionStart: true,\n sessionEnd: true,\n userPromptSubmit: true,\n stop: false,\n notification: false,\n // Newer events: the JetBrains Copilot Preview hooks runtime documents no\n // permission-dialog, tool-failure, or subagent lifecycle events, so\n // permissionRequest / postToolUseFailure / subagentStart / subagentStop\n // stay unset — install reports the standard skip-warn for them.\n // Per the JetBrains spec this host is deny/ask-only: a PreToolUse hook\n // CANNOT rewrite tool input, and PostToolUse cannot rewrite tool output.\n canModifyArgs: false,\n canModifyOutput: false,\n canInjectSessionContext: true,\n // MCP is managed via the IDE Settings UI (Settings > Tools > GitHub Copilot\n // > MCP). The UI accepts local stdio servers AND remote Streamable HTTP / SSE\n // servers; AC writes no file, so this list only describes what the UI accepts\n // (install reports a UI-managed warn for every transport).\n transports: [\"stdio\", \"http\", \"sse\"],\n // Content surfaces: JetBrains Copilot consumes the GitHub Copilot .github/\n // files (it has no distinct authoring location), so it is an ALIAS of the\n // vscode-copilot writer for prompt files and Agent Skills. It has no native\n // subagent/chat-mode surface, so subagents stay unsupported (BaseAdapter\n // returns the skip/warn default).\n supportsCommands: true,\n supportsSkills: true,\n supportsSubagents: false,\n // Native passthrough: GitHub's JetBrains-Copilot changelog documents an\n // errorOccurred / ErrorOccurred lifecycle event with NO canonical\n // HookEventName analog (PostToolUseFailure is tool-scoped, not a session-wide\n // error event). A connector reaches it via platforms[\"jetbrains-copilot\"].\n // nativeHooks; installHooks files the event-name key VERBATIM and the generic\n // uninstall reverses it. PascalCase ErrorOccurred matches the adapter's\n // Claude-compatible payload dialect (GitHub hooks-reference accepts both).\n supportsNativeHooks: true,\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n // JetBrains Copilot integration is observable through two markers:\n // • the project hooks tree (<projectDir>/.github/hooks) we write to, and\n // • our per-connector hooks file specifically.\n // There is no reliable user-profile MCP file to probe (the UI owns it), so\n // detection is project-scoped and keyed on the hooks footprint.\n const githubDir = join(projectDir, \".github\");\n const hooksDir = join(githubDir, \"hooks\");\n const installed = existsSync(hooksDir) || existsSync(githubDir);\n const configPath = hooksDir;\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n configPath,\n scope: \"project\",\n reason: installed\n ? `found JetBrains Copilot hooks tree at ${hooksDir}`\n : `no JetBrains Copilot hooks tree at ${hooksDir}`,\n confidence: installed ? \"medium\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n /** Hooks live under the workspace .github tree for both scopes. */\n getConfigDir(ctx: InstallContext): string {\n return join(ctx.projectDir, \".github\");\n }\n\n /**\n * MCP server registration has NO writable file on JetBrains — the IDE owns it\n * behind the Settings UI. We still return a stable path (the hooks file) so the\n * base-adapter `doctor`/`backupSettings` helpers have a sensible target rather\n * than a nonexistent/bogus MCP path. `installServer` never writes here.\n */\n getServerConfigPath(ctx: InstallContext): string {\n return this.getHookConfigPath(ctx);\n }\n\n /**\n * Hook registration lives in the workspace-discovered .github/hooks tree, which\n * JetBrains Copilot scans for *.json hook files. We write one file per connector\n * so installs/uninstalls never clobber another connector's hooks. Anchored on\n * projectDir for both scopes — .github/hooks is a workspace concept (there is no\n * user-profile equivalent in the Copilot hooks schema).\n */\n getHookConfigPath(ctx: InstallContext): string {\n return join(ctx.projectDir, \".github\", \"hooks\", `${ctx.connector.id}.json`);\n }\n\n // ── MCP server install / uninstall ───────────────────────────────────────\n\n /**\n * JetBrains MCP registration is UI-only. We never write a file: a bogus file is\n * ignored at best and corrupts real UI-managed state at worst. Emit a \"warn\"\n * ChangeRecord that tells the user exactly where to add the server by hand.\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 jetbrains-copilot\"\n : \"connector declares no MCP server\",\n },\n ];\n }\n\n return [\n {\n platform: this.id,\n action: \"warn\",\n detail:\n `JetBrains Copilot manages MCP servers via the IDE Settings UI — ` +\n `add \"${connector.id}\" manually under Settings > Tools > GitHub Copilot ` +\n `> MCP > Configure (no file is written here).`,\n },\n ];\n }\n\n /**\n * Nothing was written for the MCP server, so there is nothing to remove. Mirror\n * the install-time guidance as a \"warn\" so an uninstall report is honest about\n * the UI-managed entry the user may still want to remove by hand.\n */\n uninstallServer(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (!connector.server || connector.platforms[HOST]?.server === false) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"no MCP server was registered for jetbrains-copilot\",\n },\n ];\n }\n return [\n {\n platform: this.id,\n action: \"warn\",\n detail:\n `JetBrains Copilot MCP servers are UI-managed — if \"${connector.id}\" was ` +\n `added manually, remove it under Settings > Tools > GitHub Copilot > MCP.`,\n },\n ];\n }\n\n // ── Hook install / uninstall ─────────────────────────────────────────────\n\n installHooks(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n const override = connector.platforms[HOST];\n const hooksDisabled = override?.hooks === false;\n // `hooks: false` disables only the NORMALIZED events; nativeHooks is a\n // sibling, jetbrains-copilot-scoped declaration that installs regardless.\n const normalizedEvents = hooksDisabled ? [] : 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: hooksDisabled\n ? \"hooks disabled for jetbrains-copilot\"\n : \"connector declares no hooks\",\n },\n ];\n }\n if (ctx.scope === \"user\") {\n return [{ platform: this.id, action: \"warn\", detail: WORKSPACE_SCOPE_DETAIL }];\n }\n\n const hooksPath = this.getHookConfigPath(ctx);\n const symlink = this.symlinkPathWarning(hooksPath);\n if (symlink) return [symlink];\n\n const file = this.readJson<JetBrainsHooksFile>(hooksPath) ?? {};\n const __skip = this.malformedHookRootSkip(hooksPath, (file as Record<string, unknown>).hooks);\n if (__skip) return [__skip];\n const hooks = (file.hooks ??= {});\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const event of normalizedEvents) {\n const jetbrainsEvent = EVENT_MAP[event];\n if (!jetbrainsEvent) {\n // No JetBrains Copilot equivalent for this normalized event — report+skip.\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: hooksPath,\n detail: `${event} has no JetBrains Copilot hook equivalent — skipped`,\n });\n continue;\n }\n\n const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, event, connector.id);\n // Matchers are IGNORED by JetBrains (all hooks fire on all tools), so we omit\n // the matcher entirely — a flat { type, command } entry.\n const entry: JetBrainsHookEntry = { type: \"command\", command };\n\n const bucket = (hooks[jetbrainsEvent] ??= []);\n const existingIdx = bucket.findIndex((e) => this.isOurCommand(e.command, 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: hooksPath,\n detail: `hooks.${jetbrainsEvent} already registered`,\n });\n continue;\n }\n bucket[existingIdx] = entry;\n changes.push({\n platform: this.id,\n action: \"update\",\n path: hooksPath,\n detail: `hooks.${jetbrainsEvent}`,\n });\n } else {\n bucket.push(entry);\n changes.push({\n platform: this.id,\n action: \"create\",\n path: hooksPath,\n detail: `hooks.${jetbrainsEvent}`,\n });\n }\n mutated = true;\n }\n\n // NATIVE passthrough events: jetbrains-copilot-native event-name keys (e.g.\n // ErrorOccurred) filed VERBATIM into the hooks map — no EVENT_MAP, since they\n // ARE Copilot events. Flat { type, command } entry (matchers are ignored);\n // matched by EXACT command so a native key coinciding with a normalized one\n // never clobbers it.\n for (const nativeEvent of nativeEvents) {\n const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, nativeEvent, connector.id);\n const entry: JetBrainsHookEntry = { type: \"command\", command };\n const bucket = (hooks[nativeEvent] ??= []);\n const existingIdx = bucket.findIndex((e) => e.command === command);\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: hooksPath,\n detail: `hooks.${nativeEvent} (native) already registered`,\n });\n continue;\n }\n bucket[existingIdx] = entry;\n changes.push({\n platform: this.id,\n action: \"update\",\n path: hooksPath,\n detail: `hooks.${nativeEvent} (native)`,\n });\n } else {\n bucket.push(entry);\n changes.push({\n platform: this.id,\n action: \"create\",\n path: hooksPath,\n detail: `hooks.${nativeEvent} (native)`,\n });\n }\n mutated = true;\n }\n\n if (mutated) {\n // The top-level version is REQUIRED — a version-less file is rejected and\n // no hooks fire. Always (re)assert it when we write.\n file.version = JETBRAINS_HOOKS_VERSION;\n this.writeJson(hooksPath, file, ctx.dryRun);\n }\n return changes;\n }\n\n uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n const hooksPath = this.getHookConfigPath(ctx);\n const symlink = this.symlinkPathWarning(hooksPath);\n if (symlink) return [symlink];\n\n const file = this.readJson<JetBrainsHooksFile>(hooksPath);\n const hooks = file?.hooks;\n if (!file || !hooks) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path: hooksPath,\n detail: \"no hooks section present\",\n },\n ];\n }\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const jetbrainsEvent of Object.keys(hooks)) {\n const bucket = hooks[jetbrainsEvent];\n if (!Array.isArray(bucket)) continue;\n\n const before = bucket.length;\n // Only strip OUR connector's home-bin commands — never another connector's\n // (isHomeBinHookCommand is id-anchored against a shared-prefix collision).\n const next = bucket.filter((e) => !this.isOurCommand(e.command, ctx));\n const removed = before - next.length;\n if (removed > 0) {\n if (next.length > 0) hooks[jetbrainsEvent] = next;\n else delete hooks[jetbrainsEvent];\n changes.push({\n platform: this.id,\n action: \"remove\",\n path: hooksPath,\n detail: `hooks.${jetbrainsEvent} (${removed})`,\n });\n mutated = true;\n }\n }\n\n if (mutated) {\n // The hooks file is connector-OWNED (<connector-id>.json), so when our\n // strip leaves it with NO hooks we must DELETE the whole file rather than\n // rewrite a `{ \"hooks\": {}, \"version\": 1 }` shell — an empty shell is an\n // orphan per-connector file that lingers after uninstall. A non-empty\n // result still belongs to us, so we rewrite it as before. dryRun reports\n // the would-be remove without mutating the filesystem.\n if (Object.keys(hooks).length === 0) {\n changes.push(\n this.removeManagedFile(\n hooksPath,\n ctx.dryRun,\n \"removed empty connector hooks file\",\n \"no hooks file present\",\n ),\n );\n // Clean up the parent .github/hooks dir only when it is now empty (it is\n // a per-connector tree; leave it in place if other connectors' files\n // remain).\n changes.push(this.removeDirIfEmpty(dirname(hooksPath), ctx.dryRun));\n } else {\n this.writeJson(hooksPath, file, ctx.dryRun);\n }\n }\n if (changes.length === 0) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: hooksPath,\n detail: \"no matching hook entries\",\n });\n }\n return changes;\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 ──────────────────────────────────\n // CONTENT-ONLY: pure native-file writers under the workspace .github/ tree\n // ({prompts,skills}). No runtime dispatch, no home-bin pointer, no telemetry\n // wrap. Each method is idempotent (byte-identical → skip) via\n // BaseAdapter.writeContentFile and reversible via removeContentFile. Honors\n // platforms[\"jetbrains-copilot\"] per-surface false to skip.\n //\n // ALIAS of vscode-copilot: JetBrains consumes the GitHub Copilot .github/\n // files and has no distinct authoring location, so the rendered content +\n // paths here are IDENTICAL to the vscode-copilot writer.\n //\n // SHARED .github TREE: vscode-copilot, copilot-cli, and jetbrains-copilot all\n // write under the SAME project <projectDir>/.github tree. The rendered content\n // is identical and idempotent across those connectors, and uninstall here only\n // removes the files THIS connector declared — never another writer's files.\n //\n // SCOPE NOTE: .github is a workspace concept and this adapter is project-\n // scoped (no user-profile .github authoring location exists in the Copilot\n // prompt/skill discovery), so the content root is always the project .github\n // tree — the same dir getConfigDir already anchors on.\n\n /** Root of the content tree — the project .github tree (see getConfigDir). */\n private contentRootDir(ctx: InstallContext): string {\n return this.getConfigDir(ctx);\n }\n\n private promptsDir(ctx: InstallContext): string {\n return join(this.contentRootDir(ctx), \"prompts\");\n }\n private skillsDir(ctx: InstallContext): string {\n return join(this.contentRootDir(ctx), \"skills\");\n }\n\n /** Native command file path: <ghDir>/prompts/<name>.prompt.md. */\n private commandPath(ctx: InstallContext, name: string): string {\n return join(this.promptsDir(ctx), `${name}.prompt.md`);\n }\n /** Native skill dir: <ghDir>/skills/<name>. */\n private skillDir(ctx: InstallContext, name: string): string {\n return join(this.skillsDir(ctx), name);\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 jetbrains-copilot\" }];\n }\n if (connector.commands.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no commands\" }];\n }\n if (ctx.scope === \"user\") {\n return [{ platform: this.id, action: \"warn\", detail: WORKSPACE_SCOPE_DETAIL }];\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 /** Render a Copilot prompt file: md+frontmatter(description, tools, model, argument-hint). */\n private renderCommand(cmd: CommandDef): string {\n const frontmatter: Record<string, unknown> = {};\n if (cmd.description !== undefined) frontmatter.description = cmd.description;\n // Copilot prompt files express tool access as a `tools` array, sourced from\n // the portable tools.allow policy.\n const allow = cmd.tools?.allow;\n if (allow && allow.length > 0) frontmatter.tools = [...allow];\n if (cmd.model !== undefined) frontmatter.model = cmd.model;\n if (cmd.argumentHint !== undefined) frontmatter[\"argument-hint\"] = cmd.argumentHint;\n if (cmd.extra) Object.assign(frontmatter, cmd.extra);\n return this.renderFrontmatterMd(frontmatter, cmd.prompt);\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 jetbrains-copilot\" }];\n }\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n if (ctx.scope === \"user\") {\n return [{ platform: this.id, action: \"warn\", detail: WORKSPACE_SCOPE_DETAIL }];\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 // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const hooksPath = this.getHookConfigPath(ctx);\n const connectorId = ctx.connector.id;\n const homeBin = ctx.homeBinPath;\n const hookEvents = ctx.connector.hookEvents;\n const hasServer =\n ctx.connector.server != null &&\n ctx.connector.platforms[HOST]?.server !== false;\n const checks: HealthCheck[] = [\n {\n // MCP cannot be verified from disk — JetBrains owns it behind the UI.\n // BaseAdapter.doctor maps != OK to a hard FAIL, but an unverifiable\n // UI-managed surface must NOT hard-fail doctor (that contradicts the\n // install-time WARN). Return OK with a verify-in-UI detail instead.\n name: `${this.name}: MCP server (UI-managed)`,\n check: () =>\n hasServer\n ? {\n status: \"OK\",\n detail:\n \"MCP is UI-managed — verify in Settings > Tools > GitHub Copilot > MCP\",\n }\n : { status: \"OK\", detail: \"connector declares no MCP server\" },\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 if (ctx.scope === \"user\") {\n return {\n status: \"OK\",\n detail: \"hooks are workspace-scoped; install them with --scope project\",\n };\n }\n const file = this.readJson<JetBrainsHooksFile>(hooksPath);\n if (!file) return { status: \"FAIL\", detail: `not found: ${hooksPath}` };\n if (file.version !== JETBRAINS_HOOKS_VERSION) {\n return {\n status: \"FAIL\",\n detail: `${hooksPath} missing required \"version\": ${JETBRAINS_HOOKS_VERSION} — Copilot rejects it`,\n };\n }\n const registered = Object.values(file.hooks ?? {}).some((entries) =>\n (entries ?? []).some((e) =>\n isHomeBinHookCommand(e.command, homeBin, connectorId),\n ),\n );\n return registered\n ? { status: \"OK\", detail: \"hook command present\" }\n : { status: \"FAIL\", detail: `no hook for ${connectorId} in ${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). Subagents are\n // unsupported here, so they are never checked.\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 ctx.scope === \"user\"\n ? { status: \"OK\", detail: \"commands are workspace-scoped; install them with --scope project\" }\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 ctx.scope === \"user\"\n ? { status: \"OK\", detail: \"skills are workspace-scoped; install them with --scope project\" }\n : existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n return checks;\n }\n\n // ── Runtime: parse JetBrains Copilot stdin JSON → normalized event ────────\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as JetBrainsWireInput;\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 // PRIMARY SOURCE (VS Code Copilot hooks docs, \"PostToolUse input\"):\n // JetBrains aliases the VS Code `.github/hooks` surface, which fires\n // PostToolUse only after a tool completes SUCCESSFULLY and serializes a\n // single result field, `tool_response`. There is NO `tool_output` and NO\n // `error_message` in this dialect, so the old fallback legs read\n // host-nonexistent fields and the `error_message`-driven `isError` could\n // never become true. Read only `tool_response`; a tool-failure event\n // (PostToolUseFailure) is not part of this surface and is not wired.\n const toolOutput = toolResponseToString(input.tool_response);\n const ev: PostToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n ...(toolOutput !== undefined ? { toolOutput } : {}),\n };\n return ev;\n }\n case \"PreCompact\": {\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 \"PostCompact\": {\n // JetBrains Copilot does not fire PostCompact natively (postCompact\n // unset → warn-skip at install). Parsed defensively, mirroring\n // PreCompact, so a manual/mis-routed dispatch normalizes instead of\n // hitting the guard.\n const ev: PostCompactEvent = {\n ...base,\n ...(input.trigger === \"auto\" || input.trigger === \"manual\"\n ? { trigger: input.trigger }\n : {}),\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 \"SessionEnd\": {\n const ev: SessionEndEvent = {\n ...base,\n ...(typeof input.reason === \"string\" ? { reason: input.reason } : {}),\n };\n return ev;\n }\n case \"UserPromptSubmit\": {\n const ev: UserPromptSubmitEvent = {\n ...base,\n prompt: typeof input.prompt === \"string\" ? input.prompt : \"\",\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 \"Notification\": {\n const ev: NotificationEvent = {\n ...base,\n message: typeof input.message === \"string\" ? input.message : \"\",\n };\n return ev;\n }\n case \"PermissionRequest\":\n case \"PostToolUseFailure\":\n case \"SubagentStart\":\n case \"SubagentStop\": {\n // No JetBrains Copilot analog — its Preview hooks runtime documents no\n // permission-dialog, tool-failure, or subagent lifecycle events.\n // Install already skip-warns these via EVENT_MAP; a runtime dispatch is\n // a mis-route — fail loudly.\n throw new Error(`unsupported jetbrains-copilot hook event: ${String(event)}`);\n }\n default: {\n // Exhaustive guard — every HookEventName is handled above. (JetBrains only\n // delivers the four it declares; the rest are handled defensively so a\n // mis-dispatch stays inert rather than crashing.)\n const _never: never = event;\n throw new Error(`unsupported jetbrains-copilot hook event: ${String(_never)}`);\n }\n }\n }\n\n /**\n * Resolve the project dir from the wire payload. PRIMARY SOURCE (VS Code\n * `.github/hooks` dialect this host aliases): the only working-directory field\n * sent is `cwd`. There is no `workspace_roots` field — the old\n * `?? workspace_roots[0]` fallback read a host-nonexistent field and is removed\n * (parity with vscode-copilot #211).\n */\n private getProjectDir(input: JetBrainsWireInput): string | undefined {\n return typeof input.cwd === \"string\" ? input.cwd : undefined;\n }\n\n // ── Runtime: normalized response → JetBrains Copilot native hook reply ────\n\n formatReply(event: HookEventName, response: HookResponse): HookReply {\n const hookEventName = event;\n const decision = response.decision ?? \"allow\";\n\n // deny → block the action with a reason (exit 0; JSON carries the decision).\n // JetBrains Copilot's reply is Claude-compatible, identical to vscode-copilot:\n // `hookSpecificOutput.permissionDecision` is read ONLY for the pre-execution\n // PreToolUse permission event. The post-execution / turn-control events —\n // PostToolUse, UserPromptSubmit, Stop, SubagentStop — block via the TOP-LEVEL\n // {\"decision\":\"block\",\"reason\"} instead (PostToolUse runs AFTER the tool, so a\n // permissionDecision there is silently ignored). Mirrors vscode-copilot #56/#58.\n if (decision === \"deny\") {\n if (\n event === \"PostToolUse\" ||\n event === \"UserPromptSubmit\" ||\n event === \"Stop\" ||\n event === \"SubagentStop\"\n ) {\n return this.stdout({\n decision: \"block\",\n reason: response.reason ?? \"Blocked by hook\",\n });\n }\n return this.stdout({\n hookSpecificOutput: {\n hookEventName,\n permissionDecision: \"deny\",\n permissionDecisionReason: response.reason ?? \"Blocked by hook\",\n },\n });\n }\n\n // ask → prompt the user to confirm.\n if (decision === \"ask\") {\n return this.stdout({\n hookSpecificOutput: {\n hookEventName,\n permissionDecision: \"ask\",\n permissionDecisionReason:\n response.reason ?? \"Confirmation required by hook\",\n },\n });\n }\n\n // modify → unsupported on JetBrains (canModifyArgs:false): a PreToolUse hook\n // cannot rewrite tool input here, so degrade to allow rather than emit an\n // updatedInput the host will ignore.\n\n // context → inject soft guidance (also the SessionStart context path).\n if (decision === \"context\" && response.additionalContext) {\n return this.stdout({\n hookSpecificOutput: { hookEventName, additionalContext: response.additionalContext },\n });\n }\n\n // allow / void / modify-degradation / unsupported → pass through with exit 0.\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 * Extract a stable session id from a JetBrains Copilot wire payload. Priority\n * mirrors the Claude-compatible wire: transcript UUID > session_id > \"\" (the\n * framework uses \"\" when no id is available — no ppid fabrication here).\n */\nfunction extractSessionId(input: JetBrainsWireInput): string {\n if (typeof input.transcript_path === \"string\") {\n const m = input.transcript_path.match(/([a-f0-9-]{36})\\.jsonl$/);\n if (m && m[1]) return m[1];\n }\n if (typeof input.session_id === \"string\" && input.session_id !== \"\") {\n return input.session_id;\n }\n return \"\";\n}\n\n/** Coerce a Claude-compatible PostToolUse `tool_response` into a string. */\nfunction toolResponseToString(value: unknown): string | undefined {\n if (value == null) return undefined;\n if (typeof value === \"string\") return value;\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}\n\nexport const adapter = new JetBrainsCopilotAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;AAoCA,SAAS,kBAAkB;AAC3B,SAAS,SAAS,YAAY;AA+B9B,IAAM,OAAmB;AAGzB,IAAM,0BAA0B;AAQhC,IAAM,YAAoD;AAAA,EACxD,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,kBAAkB;AACpB;AAEA,IAAM,yBACJ;AAuDK,IAAM,0BAAN,cAAsC,YAA+B;AAAA,EACjE,KAAiB;AAAA,EACjB,OAAO;AAAA,EACP,WAAyB;AAAA,EAEzB,eAAqC;AAAA;AAAA;AAAA,IAG5C,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOhB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOd,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA,IAKzB,YAAY,CAAC,SAAS,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA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AA,UAClB;AAAA,UACA,oBAAoB;AAAA,UACpB,0BACE,SAAS,UAAU;AAAA,QACvB;AAAA,MACF,CAAC;AAAA,IACH;AAOA,QAAI,aAAa,aAAa,SAAS,mBAAmB;AACxD,aAAO,KAAK,OAAO;AAAA,QACjB,oBAAoB,EAAE,eAAe,mBAAmB,SAAS,kBAAkB;AAAA,MACrF,CAAC;AAAA,IACH;AAGA,WAAO,EAAE,UAAU,EAAE;AAAA,EACvB;AAAA,EAEQ,OAAO,SAA6B;AAC1C,WAAO,EAAE,UAAU,GAAG,QAAQ,KAAK,UAAU,OAAO,EAAE;AAAA,EACxD;AACF;AAOA,SAAS,iBAAiB,OAAmC;AAC3D,MAAI,OAAO,MAAM,oBAAoB,UAAU;AAC7C,UAAM,IAAI,MAAM,gBAAgB,MAAM,yBAAyB;AAC/D,QAAI,KAAK,EAAE,CAAC,EAAG,QAAO,EAAE,CAAC;AAAA,EAC3B;AACA,MAAI,OAAO,MAAM,eAAe,YAAY,MAAM,eAAe,IAAI;AACnE,WAAO,MAAM;AAAA,EACf;AACA,SAAO;AACT;AAGA,SAAS,qBAAqB,OAAoC;AAChE,MAAI,SAAS,KAAM,QAAO;AAC1B,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,MAAI;AACF,WAAO,KAAK,UAAU,KAAK;AAAA,EAC7B,QAAQ;AACN,WAAO,OAAO,KAAK;AAAA,EACrB;AACF;AAEO,IAAM,UAAU,IAAI,wBAAwB;AACnD,IAAO,4BAAQ;","names":[]}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
resolveEnvRefsDeep
|
|
4
|
+
} from "./chunk-BEFVJ2OE.js";
|
|
5
|
+
import {
|
|
6
|
+
BaseAdapter
|
|
7
|
+
} from "./chunk-WFEHWTLM.js";
|
|
8
|
+
import {
|
|
9
|
+
buildWrappedStdio
|
|
10
|
+
} from "./chunk-4NHXLXSD.js";
|
|
11
|
+
import "./chunk-M2H7JURF.js";
|
|
12
|
+
import "./chunk-GZGLCCEE.js";
|
|
13
|
+
|
|
14
|
+
// src/adapters/junie/index.ts
|
|
15
|
+
import { existsSync } from "fs";
|
|
16
|
+
import { homedir } from "os";
|
|
17
|
+
import { join } from "path";
|
|
18
|
+
var HOST = "junie";
|
|
19
|
+
var MCP_ROOT_KEY = "mcpServers";
|
|
20
|
+
var JunieAdapter = class extends BaseAdapter {
|
|
21
|
+
id = HOST;
|
|
22
|
+
name = "Junie";
|
|
23
|
+
paradigm = "mcp-only";
|
|
24
|
+
capabilities = {
|
|
25
|
+
// Memory surface: BaseAdapter AGENTS.md-first default. Junie documents its
|
|
26
|
+
// own guidelines/memory surface; AC's AGENTS.md default lands in the open
|
|
27
|
+
// standard file Junie also reads. (Junie-specific guideline files are not
|
|
28
|
+
// wired here — the AGENTS.md default is the host-agnostic baseline.)
|
|
29
|
+
supportsMemory: true,
|
|
30
|
+
//
|
|
31
|
+
// mcp-only: Junie documents NO user-installable lifecycle hook / event-
|
|
32
|
+
// callback surface (junie.jetbrains.com/docs). Every hook flag is false.
|
|
33
|
+
preToolUse: false,
|
|
34
|
+
postToolUse: false,
|
|
35
|
+
preCompact: false,
|
|
36
|
+
sessionStart: false,
|
|
37
|
+
sessionEnd: false,
|
|
38
|
+
userPromptSubmit: false,
|
|
39
|
+
stop: false,
|
|
40
|
+
notification: false,
|
|
41
|
+
// No hook layer → no arg/output rewrite, no context injection.
|
|
42
|
+
canModifyArgs: false,
|
|
43
|
+
canModifyOutput: false,
|
|
44
|
+
canInjectSessionContext: false,
|
|
45
|
+
// Junie registers stdio MCP servers (Local: Docker/npx/binary) and remote
|
|
46
|
+
// (HTTP/HTTPS) servers — the remote entry is distinguished by `url` (vs
|
|
47
|
+
// stdio's `command`).
|
|
48
|
+
transports: ["stdio", "http"]
|
|
49
|
+
// Content surfaces (Agent Skills, subagents, custom slash commands) exist
|
|
50
|
+
// natively in Junie but are NOT wired by this adapter — the initial scope is
|
|
51
|
+
// MCP-only. They stay UNSET so the base skip-warns; this is an honest
|
|
52
|
+
// CEILING, not a host gap.
|
|
53
|
+
};
|
|
54
|
+
// ── Detection ────────────────────────────────────────────────────────────
|
|
55
|
+
detectInstalled(projectDir) {
|
|
56
|
+
const userDir = join(homedir(), ".junie");
|
|
57
|
+
const userMcp = join(userDir, "mcp", "mcp.json");
|
|
58
|
+
const projectDirJunie = join(projectDir, ".junie");
|
|
59
|
+
const installed = existsSync(userDir) || existsSync(projectDirJunie);
|
|
60
|
+
return {
|
|
61
|
+
id: this.id,
|
|
62
|
+
name: this.name,
|
|
63
|
+
installed,
|
|
64
|
+
paradigm: this.paradigm,
|
|
65
|
+
capabilities: this.capabilities,
|
|
66
|
+
configPath: userMcp,
|
|
67
|
+
scope: "user",
|
|
68
|
+
reason: installed ? `found Junie config under ${userDir}` : `no Junie config at ${userDir}`,
|
|
69
|
+
confidence: installed ? "high" : "low"
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// ── Native paths ─────────────────────────────────────────────────────────
|
|
73
|
+
/**
|
|
74
|
+
* Junie's MCP config dir is `<scope-root>/.junie/mcp`: project scope at
|
|
75
|
+
* <projectDir>/.junie/mcp, user scope at ~/.junie/mcp (BYTE-CONFIRMED —
|
|
76
|
+
* junie.jetbrains.com/docs/junie-cli-mcp-configuration.html).
|
|
77
|
+
*/
|
|
78
|
+
getConfigDir(ctx) {
|
|
79
|
+
return ctx.scope === "project" ? join(ctx.projectDir, ".junie", "mcp") : join(homedir(), ".junie", "mcp");
|
|
80
|
+
}
|
|
81
|
+
getServerConfigPath(ctx) {
|
|
82
|
+
return join(this.getConfigDir(ctx), "mcp.json");
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Junie has no separate hook file — the hook config path aliases the MCP file
|
|
86
|
+
* so the generic doctor/backup helpers behave sensibly (windsurf/cline idiom).
|
|
87
|
+
*/
|
|
88
|
+
getHookConfigPath(ctx) {
|
|
89
|
+
return this.getServerConfigPath(ctx);
|
|
90
|
+
}
|
|
91
|
+
// ── MCP server install / uninstall ───────────────────────────────────────
|
|
92
|
+
installServer(ctx) {
|
|
93
|
+
const { connector } = ctx;
|
|
94
|
+
const override = connector.platforms[HOST]?.server;
|
|
95
|
+
if (!connector.server || override === false) {
|
|
96
|
+
return [
|
|
97
|
+
{
|
|
98
|
+
platform: this.id,
|
|
99
|
+
action: "skip",
|
|
100
|
+
detail: connector.server ? "server registration disabled for junie" : "connector declares no MCP server"
|
|
101
|
+
}
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
const server = override && typeof override === "object" ? { ...connector.server, ...override } : connector.server;
|
|
105
|
+
const serverPath = this.getServerConfigPath(ctx);
|
|
106
|
+
const malformed = this.malformedRootKey(serverPath);
|
|
107
|
+
if (malformed) return [malformed];
|
|
108
|
+
const entry = this.renderServerEntry(ctx, server);
|
|
109
|
+
return [
|
|
110
|
+
this.upsertServerInJson(serverPath, MCP_ROOT_KEY, connector.id, entry, ctx.dryRun)
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
uninstallServer(ctx) {
|
|
114
|
+
const serverPath = this.getServerConfigPath(ctx);
|
|
115
|
+
const malformed = this.malformedRootKey(serverPath);
|
|
116
|
+
if (malformed) return [malformed];
|
|
117
|
+
return [
|
|
118
|
+
this.removeServerFromJson(serverPath, MCP_ROOT_KEY, ctx.connector.id, ctx.dryRun)
|
|
119
|
+
];
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Guard for a PRESENT-but-non-object `mcpServers` root key: returns a
|
|
123
|
+
* skip-warn ChangeRecord when the existing config parses but its `mcpServers`
|
|
124
|
+
* value is not a plain object (an array / string / number / null). Returns
|
|
125
|
+
* undefined when the file is absent, unparseable (the base upsert's own
|
|
126
|
+
* overwrite guard handles that), or `mcpServers` is absent / a plain object.
|
|
127
|
+
*/
|
|
128
|
+
malformedRootKey(configPath) {
|
|
129
|
+
const cfg = this.readJson(configPath);
|
|
130
|
+
if (!cfg || !(MCP_ROOT_KEY in cfg)) return void 0;
|
|
131
|
+
const root = cfg[MCP_ROOT_KEY];
|
|
132
|
+
if (root !== null && typeof root === "object" && !Array.isArray(root)) {
|
|
133
|
+
return void 0;
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
platform: this.id,
|
|
137
|
+
action: "warn",
|
|
138
|
+
path: configPath,
|
|
139
|
+
detail: `existing ${MCP_ROOT_KEY} in ${configPath} is not an object map; left untouched (back it up / fix it, then re-run)`
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/** Render a normalized ServerDef into Junie's native mcpServers entry. */
|
|
143
|
+
renderServerEntry(ctx, server) {
|
|
144
|
+
const transport = server.transport;
|
|
145
|
+
if (transport === "stdio") {
|
|
146
|
+
let command = server.command ?? "";
|
|
147
|
+
let args = [...server.args ?? []];
|
|
148
|
+
({ command, args } = buildWrappedStdio(ctx, server, this.id, command, args));
|
|
149
|
+
const entry2 = {
|
|
150
|
+
command: resolveEnvRefsDeep(command)
|
|
151
|
+
};
|
|
152
|
+
if (args.length > 0) entry2.args = resolveEnvRefsDeep(args);
|
|
153
|
+
const env = this.renderEnv(server.env);
|
|
154
|
+
if (env) entry2.env = env;
|
|
155
|
+
return entry2;
|
|
156
|
+
}
|
|
157
|
+
const entry = {
|
|
158
|
+
url: resolveEnvRefsDeep(server.url ?? "")
|
|
159
|
+
};
|
|
160
|
+
const headers = this.renderEnv(server.headers);
|
|
161
|
+
if (headers) entry.headers = headers;
|
|
162
|
+
return entry;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Render env/header values. Junie documents no native interpolation token, so
|
|
166
|
+
* resolve `${env:VAR}` references to literals at install time.
|
|
167
|
+
*/
|
|
168
|
+
renderEnv(env) {
|
|
169
|
+
if (!env || Object.keys(env).length === 0) return void 0;
|
|
170
|
+
return resolveEnvRefsDeep({ ...env });
|
|
171
|
+
}
|
|
172
|
+
// ── Hooks (unavailable — Junie is mcp-only) ──────────────────────────────
|
|
173
|
+
installHooks(_ctx) {
|
|
174
|
+
return [
|
|
175
|
+
{
|
|
176
|
+
platform: this.id,
|
|
177
|
+
action: "skip",
|
|
178
|
+
detail: "hooks unavailable (Junie is mcp-only)"
|
|
179
|
+
}
|
|
180
|
+
];
|
|
181
|
+
}
|
|
182
|
+
uninstallHooks(_ctx) {
|
|
183
|
+
return [
|
|
184
|
+
{
|
|
185
|
+
platform: this.id,
|
|
186
|
+
action: "skip",
|
|
187
|
+
detail: "hooks unavailable (Junie is mcp-only)"
|
|
188
|
+
}
|
|
189
|
+
];
|
|
190
|
+
}
|
|
191
|
+
// ── Diagnostics ──────────────────────────────────────────────────────────
|
|
192
|
+
getHealthChecks(ctx) {
|
|
193
|
+
const mcpPath = this.getServerConfigPath(ctx);
|
|
194
|
+
const connectorId = ctx.connector.id;
|
|
195
|
+
return [
|
|
196
|
+
{
|
|
197
|
+
name: `${this.name}: mcp.json present`,
|
|
198
|
+
check: () => existsSync(mcpPath) ? { status: "OK", detail: mcpPath } : { status: "FAIL", detail: `not found: ${mcpPath}` }
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: `${this.name}: server entry registered`,
|
|
202
|
+
check: () => {
|
|
203
|
+
if (!ctx.connector.server) {
|
|
204
|
+
return { status: "OK", detail: "no MCP server declared" };
|
|
205
|
+
}
|
|
206
|
+
const cfg = this.readJson(mcpPath);
|
|
207
|
+
const bucket = cfg?.[MCP_ROOT_KEY];
|
|
208
|
+
if (!cfg || !bucket) {
|
|
209
|
+
return { status: "FAIL", detail: `no ${MCP_ROOT_KEY} in ${mcpPath}` };
|
|
210
|
+
}
|
|
211
|
+
return connectorId in bucket ? { status: "OK", detail: `${MCP_ROOT_KEY}.${connectorId} present` } : {
|
|
212
|
+
status: "FAIL",
|
|
213
|
+
detail: `no ${MCP_ROOT_KEY}.${connectorId} in ${mcpPath}`
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
var adapter = new JunieAdapter();
|
|
221
|
+
var junie_default = adapter;
|
|
222
|
+
export {
|
|
223
|
+
JunieAdapter,
|
|
224
|
+
adapter,
|
|
225
|
+
junie_default as default
|
|
226
|
+
};
|
|
227
|
+
//# sourceMappingURL=junie-TSXIZSCE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/junie/index.ts"],"sourcesContent":["/**\n * adapters/junie — Junie (JetBrains' own LLM-agnostic coding agent) adapter.\n *\n * Junie is JetBrains' OWN coding agent (\"An LLM-agnostic coding agent built for\n * real-world development — by JetBrains\", github.com/JetBrains/junie). It is\n * DISTINCT from the `jetbrains-copilot` adapter, which targets GitHub Copilot\n * running inside JetBrains IDEs. Junie ships as a terminal CLI (`junie`,\n * installed via junie.jetbrains.com/install.sh, Homebrew, or\n * `npm i -g @jetbrains/junie`) and also runs inside JetBrains IDEs / CI.\n *\n * From agent-connector's hook-paradigm perspective Junie is **mcp-only**: the\n * first-party docs (junie.jetbrains.com/docs) document NO user-installable\n * lifecycle hook / event-callback surface — only MCP server registration,\n * Agent Skills, subagents, custom slash commands, and guidelines/memory. So MCP\n * registration is the only runtime surface this adapter installs and every hook\n * capability is reported false. (Content surfaces exist natively but are not\n * wired here — see the capabilities note.)\n *\n * MCP config (BYTE-CONFIRMED — junie.jetbrains.com/docs/junie-cli-mcp-configuration.html,\n * \"Junie CLI uses the same MCP JSON configuration as Junie in JetBrains IDEs\"):\n * - PROJECT scope → <projectDir>/.junie/mcp/mcp.json (\"can be checked into\n * version control and shared across all team members\").\n * - USER scope → ~/.junie/mcp/mcp.json (\"available across all projects on\n * your machine while remaining private to your user account\").\n * - root key \"mcpServers\" — a JSON object/map keyed by server name.\n *\n * Server entry shapes (BYTE-CONFIRMED from the docs' verbatim JSON example):\n * - stdio: { command, args?, env? }\n * - remote: { url, headers? } — the key is `url` (NOT `serverUrl`); there is\n * NO `type` discriminator and NO `disabled` field. stdio vs remote is\n * distinguished by `command` vs `url`. `headers` is emitted only when the\n * connector's remote server provides them.\n *\n * Env interpolation: the docs example carries literal `env` values and document\n * no portable native `${env:VAR}` token for the MCP file, so every `${env:VAR}`\n * reference is resolved to a literal at install time (the safe path, same as\n * cline / windsurf / droid).\n *\n * The hook \"config path\" is aliased to the MCP file (no separate hook file) so\n * the generic doctor/backup helpers behave sensibly (the windsurf/cline idiom).\n */\n\nimport { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport { BaseAdapter } from \"../base.js\";\nimport type { Adapter, InstallContext } from \"../spi.js\";\nimport type {\n ChangeRecord,\n DetectedPlatform,\n HealthCheck,\n HookParadigm,\n PlatformCapabilities,\n PlatformId,\n ServerDef,\n Transport,\n} from \"../../core/types.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport { buildWrappedStdio } from \"../../core/spawn.js\";\n\nconst HOST: PlatformId = \"junie\";\nconst MCP_ROOT_KEY = \"mcpServers\";\n\n/**\n * Native MCP server entry shapes Junie accepts under `mcpServers` (an OBJECT map\n * keyed by server name):\n * - stdio: { command, args?, env? } — transport inferred from `command`.\n * - remote: { url, headers? } — `url` (NOT `serverUrl`); NO `type`\n * discriminator and NO `disabled` flag. `headers` only when provided.\n */\ninterface JunieStdioServer {\n command: string;\n args?: string[];\n env?: Record<string, string>;\n}\ninterface JunieRemoteServer {\n url: string;\n headers?: Record<string, string>;\n}\n\nexport class JunieAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Junie\";\n readonly paradigm: HookParadigm = \"mcp-only\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: BaseAdapter AGENTS.md-first default. Junie documents its\n // own guidelines/memory surface; AC's AGENTS.md default lands in the open\n // standard file Junie also reads. (Junie-specific guideline files are not\n // wired here — the AGENTS.md default is the host-agnostic baseline.)\n supportsMemory: true,\n //\n // mcp-only: Junie documents NO user-installable lifecycle hook / event-\n // callback surface (junie.jetbrains.com/docs). Every hook flag is false.\n preToolUse: false,\n postToolUse: false,\n preCompact: false,\n sessionStart: false,\n sessionEnd: false,\n userPromptSubmit: false,\n stop: false,\n notification: false,\n // No hook layer → no arg/output rewrite, no context injection.\n canModifyArgs: false,\n canModifyOutput: false,\n canInjectSessionContext: false,\n // Junie registers stdio MCP servers (Local: Docker/npx/binary) and remote\n // (HTTP/HTTPS) servers — the remote entry is distinguished by `url` (vs\n // stdio's `command`).\n transports: [\"stdio\", \"http\"],\n // Content surfaces (Agent Skills, subagents, custom slash commands) exist\n // natively in Junie but are NOT wired by this adapter — the initial scope is\n // MCP-only. They stay UNSET so the base skip-warns; this is an honest\n // CEILING, not a host gap.\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = join(homedir(), \".junie\");\n const userMcp = join(userDir, \"mcp\", \"mcp.json\");\n // ~/.junie/allowlist.json is Junie CLI's action-allowlist file\n // (byte-confirmed — junie.jetbrains.com/docs/junie-cli.html), so the dir's\n // presence is a strong CLI-installed marker.\n const projectDirJunie = join(projectDir, \".junie\");\n const installed = existsSync(userDir) || existsSync(projectDirJunie);\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 Junie config under ${userDir}`\n : `no Junie config at ${userDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n /**\n * Junie's MCP config dir is `<scope-root>/.junie/mcp`: project scope at\n * <projectDir>/.junie/mcp, user scope at ~/.junie/mcp (BYTE-CONFIRMED —\n * junie.jetbrains.com/docs/junie-cli-mcp-configuration.html).\n */\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".junie\", \"mcp\")\n : join(homedir(), \".junie\", \"mcp\");\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"mcp.json\");\n }\n\n /**\n * Junie has no separate hook file — the hook config path aliases the MCP file\n * so the generic doctor/backup helpers behave sensibly (windsurf/cline idiom).\n */\n getHookConfigPath(ctx: InstallContext): string {\n return this.getServerConfigPath(ctx);\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 junie\"\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\n // NEVER clobber a malformed `mcpServers`. The base upsert tolerates a\n // missing file / missing key (it creates the object), but a PRESENT-but-\n // non-object `mcpServers` (e.g. an array or string from a hand-edit) would\n // get a named property bolted on and silently corrupted — so skip-and-warn.\n const malformed = this.malformedRootKey(serverPath);\n if (malformed) return [malformed];\n\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 const malformed = this.malformedRootKey(serverPath);\n if (malformed) return [malformed];\n return [\n this.removeServerFromJson(serverPath, MCP_ROOT_KEY, ctx.connector.id, ctx.dryRun),\n ];\n }\n\n /**\n * Guard for a PRESENT-but-non-object `mcpServers` root key: returns a\n * skip-warn ChangeRecord when the existing config parses but its `mcpServers`\n * value is not a plain object (an array / string / number / null). Returns\n * undefined when the file is absent, unparseable (the base upsert's own\n * overwrite guard handles that), or `mcpServers` is absent / a plain object.\n */\n private malformedRootKey(configPath: string): ChangeRecord | undefined {\n const cfg = this.readJson<Record<string, unknown>>(configPath);\n if (!cfg || !(MCP_ROOT_KEY in cfg)) return undefined;\n const root = cfg[MCP_ROOT_KEY];\n if (root !== null && typeof root === \"object\" && !Array.isArray(root)) {\n return undefined;\n }\n return {\n platform: this.id,\n action: \"warn\",\n path: configPath,\n detail: `existing ${MCP_ROOT_KEY} in ${configPath} is not an object map; left untouched (back it up / fix it, then re-run)`,\n };\n }\n\n /** Render a normalized ServerDef into Junie's native mcpServers entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): JunieStdioServer | JunieRemoteServer {\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 // Junie documents no native interpolation token for the MCP file, so\n // resolve every ${env:VAR} to a literal at install time.\n const entry: JunieStdioServer = {\n command: resolveEnvRefsDeep(command),\n };\n if (args.length > 0) entry.args = resolveEnvRefsDeep(args);\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) — Junie registers a\n // remote URL under `url` (NOT `serverUrl`). NO `type` discriminator, NO\n // `disabled`. `headers` only when the connector's remote server provides them.\n const entry: JunieRemoteServer = {\n url: resolveEnvRefsDeep(server.url ?? \"\"),\n };\n const headers = this.renderEnv(server.headers);\n if (headers) entry.headers = headers;\n return entry;\n }\n\n /**\n * Render env/header values. Junie documents no native interpolation token, so\n * resolve `${env:VAR}` references to literals at install time.\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 return resolveEnvRefsDeep({ ...env });\n }\n\n // ── Hooks (unavailable — Junie is mcp-only) ──────────────────────────────\n\n installHooks(_ctx: InstallContext): ChangeRecord[] {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"hooks unavailable (Junie is mcp-only)\",\n },\n ];\n }\n\n uninstallHooks(_ctx: InstallContext): ChangeRecord[] {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"hooks unavailable (Junie is mcp-only)\",\n },\n ];\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const mcpPath = this.getServerConfigPath(ctx);\n const connectorId = ctx.connector.id;\n return [\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}: server entry registered`,\n check: () => {\n // Only assert what the connector declares: a server-less connector\n // never writes an mcpServers entry, so its absence is healthy.\n if (!ctx.connector.server) {\n return { status: \"OK\", detail: \"no MCP server declared\" };\n }\n const cfg = this.readJson<{ [k: string]: Record<string, unknown> }>(mcpPath);\n const bucket = cfg?.[MCP_ROOT_KEY];\n if (!cfg || !bucket) {\n return { status: \"FAIL\", detail: `no ${MCP_ROOT_KEY} in ${mcpPath}` };\n }\n return connectorId in bucket\n ? { status: \"OK\", detail: `${MCP_ROOT_KEY}.${connectorId} present` }\n : {\n status: \"FAIL\",\n detail: `no ${MCP_ROOT_KEY}.${connectorId} in ${mcpPath}`,\n };\n },\n },\n ];\n }\n}\n\nexport const adapter = new JunieAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;AA0CA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,YAAY;AAiBrB,IAAM,OAAmB;AACzB,IAAM,eAAe;AAmBd,IAAM,eAAN,cAA2B,YAA+B;AAAA,EACtD,KAAiB;AAAA,EACjB,OAAO;AAAA,EACP,WAAyB;AAAA,EAEzB,eAAqC;AAAA;AAAA;AAAA;AAAA;AAAA,IAK5C,gBAAgB;AAAA;AAAA;AAAA;AAAA,IAIhB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,cAAc;AAA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QAAQ,QAAQ,IAChC,EAAE,QAAQ,QAAQ,QAAQ,cAAc,OAAO,GAAG;AAAA,MAC1D;AAAA,MACA;AAAA,QACE,MAAM,GAAG,KAAK,IAAI;AAAA,QAClB,OAAO,MAAM;AAGX,cAAI,CAAC,IAAI,UAAU,QAAQ;AACzB,mBAAO,EAAE,QAAQ,MAAM,QAAQ,yBAAyB;AAAA,UAC1D;AACA,gBAAM,MAAM,KAAK,SAAmD,OAAO;AAC3E,gBAAM,SAAS,MAAM,YAAY;AACjC,cAAI,CAAC,OAAO,CAAC,QAAQ;AACnB,mBAAO,EAAE,QAAQ,QAAQ,QAAQ,MAAM,YAAY,OAAO,OAAO,GAAG;AAAA,UACtE;AACA,iBAAO,eAAe,SAClB,EAAE,QAAQ,MAAM,QAAQ,GAAG,YAAY,IAAI,WAAW,WAAW,IACjE;AAAA,YACE,QAAQ;AAAA,YACR,QAAQ,MAAM,YAAY,IAAI,WAAW,OAAO,OAAO;AAAA,UACzD;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,UAAU,IAAI,aAAa;AACxC,IAAO,gBAAQ;","names":["entry"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
renderBridgePrelude
|
|
4
|
-
} from "./chunk-FBJQGRET.js";
|
|
5
2
|
import {
|
|
6
3
|
xdgConfigHome
|
|
7
4
|
} from "./chunk-UM5S7DKK.js";
|
|
5
|
+
import {
|
|
6
|
+
renderBridgePrelude
|
|
7
|
+
} from "./chunk-FBJQGRET.js";
|
|
8
8
|
import {
|
|
9
9
|
resolveEnvRefsDeep
|
|
10
10
|
} from "./chunk-BEFVJ2OE.js";
|
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
BaseAdapter,
|
|
13
13
|
renderOpenCodeSubagentMd,
|
|
14
14
|
renderSkillMd
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WFEHWTLM.js";
|
|
16
16
|
import {
|
|
17
17
|
buildWrappedStdio
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-4NHXLXSD.js";
|
|
19
|
+
import "./chunk-M2H7JURF.js";
|
|
20
|
+
import "./chunk-GZGLCCEE.js";
|
|
21
21
|
|
|
22
22
|
// src/adapters/kilo/index.ts
|
|
23
23
|
import { existsSync } from "fs";
|
|
@@ -842,4 +842,4 @@ export {
|
|
|
842
842
|
adapter,
|
|
843
843
|
kilo_default as default
|
|
844
844
|
};
|
|
845
|
-
//# sourceMappingURL=kilo-
|
|
845
|
+
//# sourceMappingURL=kilo-JLH3KVZJ.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
renderBridgePrelude
|
|
4
|
-
} from "./chunk-FBJQGRET.js";
|
|
5
2
|
import {
|
|
6
3
|
xdgConfigHome
|
|
7
4
|
} from "./chunk-UM5S7DKK.js";
|
|
5
|
+
import {
|
|
6
|
+
renderBridgePrelude
|
|
7
|
+
} from "./chunk-FBJQGRET.js";
|
|
8
8
|
import {
|
|
9
9
|
resolveEnvRefsDeep
|
|
10
10
|
} from "./chunk-BEFVJ2OE.js";
|
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
BaseAdapter,
|
|
13
13
|
renderCommandMd,
|
|
14
14
|
renderSkillMd
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WFEHWTLM.js";
|
|
16
16
|
import {
|
|
17
17
|
buildWrappedStdio
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-4NHXLXSD.js";
|
|
19
|
+
import "./chunk-M2H7JURF.js";
|
|
20
|
+
import "./chunk-GZGLCCEE.js";
|
|
21
21
|
|
|
22
22
|
// src/adapters/kilo-cli/index.ts
|
|
23
23
|
import { existsSync } from "fs";
|
|
@@ -795,4 +795,4 @@ export {
|
|
|
795
795
|
adapter,
|
|
796
796
|
kilo_cli_default as default
|
|
797
797
|
};
|
|
798
|
-
//# sourceMappingURL=kilo-cli-
|
|
798
|
+
//# sourceMappingURL=kilo-cli-5W36VJQZ.js.map
|
|
@@ -8,16 +8,16 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
BaseAdapter,
|
|
10
10
|
renderSkillMd
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WFEHWTLM.js";
|
|
12
12
|
import {
|
|
13
13
|
buildHomeBinHookCommand,
|
|
14
14
|
buildWrappedStdio,
|
|
15
15
|
isHomeBinHookCommand
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-4NHXLXSD.js";
|
|
17
|
+
import "./chunk-M2H7JURF.js";
|
|
18
18
|
import {
|
|
19
19
|
ensureDir
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-GZGLCCEE.js";
|
|
21
21
|
|
|
22
22
|
// src/adapters/kimi/index.ts
|
|
23
23
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -680,4 +680,4 @@ export {
|
|
|
680
680
|
adapter,
|
|
681
681
|
kimi_default as default
|
|
682
682
|
};
|
|
683
|
-
//# sourceMappingURL=kimi-
|
|
683
|
+
//# sourceMappingURL=kimi-R62W7HKZ.js.map
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
BaseAdapter,
|
|
10
10
|
renderSkillMd
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WFEHWTLM.js";
|
|
12
12
|
import {
|
|
13
13
|
buildHomeBinHookCommand,
|
|
14
14
|
buildWrappedStdio,
|
|
15
15
|
isHomeBinHookCommand
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-4NHXLXSD.js";
|
|
17
|
+
import "./chunk-M2H7JURF.js";
|
|
18
|
+
import "./chunk-GZGLCCEE.js";
|
|
19
19
|
|
|
20
20
|
// src/adapters/kiro/index.ts
|
|
21
21
|
import { existsSync } from "fs";
|
|
@@ -75,7 +75,13 @@ var KiroAdapter = class extends BaseAdapter {
|
|
|
75
75
|
transports: ["stdio", "http"],
|
|
76
76
|
// Skills: Kiro reads SKILL.md from .kiro/skills/<name>/SKILL.md (project)
|
|
77
77
|
// and ~/.kiro/skills/<name>/SKILL.md (user).
|
|
78
|
-
supportsSkills: true
|
|
78
|
+
supportsSkills: true,
|
|
79
|
+
// Actions: Kiro reads `.kiro/hooks/<id>.kiro.hook` Manual-Trigger +
|
|
80
|
+
// Shell-Command hooks (when.type "manual" + then.type "runCommand"),
|
|
81
|
+
// user-invokable from the Agent Hooks panel / Command Palette. WORKSPACE
|
|
82
|
+
// (project) scope ONLY — Kiro does not scan ~/.kiro/hooks/ — so user scope
|
|
83
|
+
// warn-skips (see installActions).
|
|
84
|
+
supportsActions: true
|
|
79
85
|
};
|
|
80
86
|
// ── Detection ────────────────────────────────────────────────────────────
|
|
81
87
|
detectInstalled(projectDir) {
|
|
@@ -252,6 +258,75 @@ var KiroAdapter = class extends BaseAdapter {
|
|
|
252
258
|
renderSkill(skill) {
|
|
253
259
|
return renderSkillMd(skill);
|
|
254
260
|
}
|
|
261
|
+
// ── Action surface (one owned .kiro.hook per action; PROJECT scope only) ──
|
|
262
|
+
// Kiro reads `<projectDir>/.kiro/hooks/<id>.kiro.hook` (JSON): a Manual-Trigger
|
|
263
|
+
// (`when.type "manual"`) + Shell-Command (`then.type "runCommand"`, `command`)
|
|
264
|
+
// hook, user-invokable from the Agent Hooks panel / Command Palette
|
|
265
|
+
// (kiro.dev/docs/hooks). The command execs `<homeBin> action kiro <id>
|
|
266
|
+
// --connector <id>`. Each file is FULLY OWNED → uninstall removes it.
|
|
267
|
+
// SCOPE: Kiro discovers hooks ONLY from the workspace `.kiro/hooks/` dir
|
|
268
|
+
// (~/.kiro/hooks/ is NOT scanned), so user scope warn-skips (mirrors warp's
|
|
269
|
+
// project-only precedent) rather than writing a file Kiro would never load.
|
|
270
|
+
actionHookPath(ctx, id) {
|
|
271
|
+
return join(ctx.projectDir, ".kiro", "hooks", `${id}.kiro.hook`);
|
|
272
|
+
}
|
|
273
|
+
installActions(ctx) {
|
|
274
|
+
const { connector } = ctx;
|
|
275
|
+
if (connector.platforms[HOST]?.actions === false) {
|
|
276
|
+
return [{ platform: this.id, action: "skip", detail: "actions disabled for kiro" }];
|
|
277
|
+
}
|
|
278
|
+
const triggers = this.actionTriggers(ctx);
|
|
279
|
+
if (triggers.length === 0) {
|
|
280
|
+
return [{ platform: this.id, action: "skip", detail: "connector declares no actions" }];
|
|
281
|
+
}
|
|
282
|
+
if (ctx.scope !== "project") {
|
|
283
|
+
return [
|
|
284
|
+
{
|
|
285
|
+
platform: this.id,
|
|
286
|
+
action: "warn",
|
|
287
|
+
detail: `kiro actions are project-scoped only (Kiro does not scan ~/.kiro/hooks/); ${triggers.length} skipped`
|
|
288
|
+
}
|
|
289
|
+
];
|
|
290
|
+
}
|
|
291
|
+
return triggers.map(
|
|
292
|
+
(trigger) => this.writeContentFile(
|
|
293
|
+
this.actionHookPath(ctx, trigger.id),
|
|
294
|
+
this.renderActionHook(trigger.label, trigger.description, trigger.command),
|
|
295
|
+
ctx.dryRun
|
|
296
|
+
)
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
uninstallActions(ctx) {
|
|
300
|
+
const { connector } = ctx;
|
|
301
|
+
if (connector.actions.length === 0) {
|
|
302
|
+
return [{ platform: this.id, action: "skip", detail: "connector declares no actions" }];
|
|
303
|
+
}
|
|
304
|
+
if (ctx.scope !== "project") {
|
|
305
|
+
return [{ platform: this.id, action: "skip", detail: "kiro actions are project-scoped only" }];
|
|
306
|
+
}
|
|
307
|
+
return connector.actions.map(
|
|
308
|
+
(action) => this.removeContentFile(this.actionHookPath(ctx, action.id), ctx.dryRun)
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Render a Kiro `.kiro.hook` JSON: a Manual-Trigger (`when.type "manual"`) +
|
|
313
|
+
* Shell-Command (`then.type "runCommand"`) hook. The key order matches the
|
|
314
|
+
* files Kiro itself emits (enabled, name, description, version, when, then).
|
|
315
|
+
*/
|
|
316
|
+
renderActionHook(name, description, command) {
|
|
317
|
+
return JSON.stringify(
|
|
318
|
+
{
|
|
319
|
+
enabled: true,
|
|
320
|
+
name,
|
|
321
|
+
description,
|
|
322
|
+
version: "1",
|
|
323
|
+
when: { type: "manual" },
|
|
324
|
+
then: { type: "runCommand", command }
|
|
325
|
+
},
|
|
326
|
+
null,
|
|
327
|
+
2
|
|
328
|
+
) + "\n";
|
|
329
|
+
}
|
|
255
330
|
// ── Hook install / uninstall (merge into the agent file) ─────────────────
|
|
256
331
|
installHooks(ctx) {
|
|
257
332
|
const { connector } = ctx;
|
|
@@ -518,4 +593,4 @@ export {
|
|
|
518
593
|
adapter,
|
|
519
594
|
kiro_default as default
|
|
520
595
|
};
|
|
521
|
-
//# sourceMappingURL=kiro-
|
|
596
|
+
//# sourceMappingURL=kiro-AUJMGIBL.js.map
|