Repository navigation
feat(kiro): map PermissionRequest hooks and keep identityProvider in global MCP - #3939
Merged
Merged
Conversation
…global MCP - Map canonical permissionRequest to Kiro's PermissionRequest trigger (Kiro IDE 1.4.236+, CLI V3 3.4.0+) for kiro-cli and kiro-ide, keeping the tool matcher. Prompt hooks on it are skipped with a warning because Kiro runs only command actions there. - In global mode, merge generated mcpServers into the existing ~/.kiro/settings/mcp.json so the identityProvider block (organization sign-in, read only from that file) and other top-level keys survive. Refuse an unparseable file, and never delete the user-level file. Refs #2408 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…review notes - Import skips an `agent` action on Kiro's command-only PermissionRequest trigger (either spelling) with a warning, symmetric with generate, so a hook Kiro never runs does not become an LLM permission hook elsewhere. - Document that the global MCP merge also applies to the deprecated `kiro` alias, that `generate --global --delete` without a source leaves the generated servers in place (an empty `mcpServers` source retracts them), and that a canonical permissionRequest plus a hand-written `kiro.hooks.PermissionRequest` yields two hooks. - E2E: an empty source empties `mcpServers` and keeps `identityProvider`. Refs #2408 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…ro-permission-request # Conflicts: # src/generated/docs-content.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follows up on the 2026-11-19 upstream re-check in #2408.
hooks (
kiro-cli,kiro-ide): canonicalpermissionRequestnow maps to Kiro'sPermissionRequesttrigger, which the hook types page documents by that ID for both Kiro IDE 1.4.236+ and Kiro CLI 3.4.0+. The matcher is kept (it works like Pre Tool Use's). The page also says only command actions run on this trigger, so aprompthook onpermissionRequestis skipped with a warning instead of being written as anagentaction Kiro never runs. Import mapsPermissionRequestback topermissionRequest, and drops anagentaction on that trigger (either spelling) with a warning. A canonicalpermissionRequesthook plus a hand-writtenkiro.hooks.PermissionRequestentry produce two hooks (documented). The deprecatedkiroalias's hooks are unchanged.mcp (global):
generate --globalused to replace~/.kiro/settings/mcp.jsonwith{ mcpServers }, deleting the user'sidentityProviderblock for MCP organization sign-in (Kiro reads it only from that user-level file, per MCP configuration). Now in global mode:mcpServersare merged into the existing file, and every other top-level key is kept;isDeletable()returns false), sogenerate --global --deleteleaves it alone.This applies to every Kiro target, including the deprecated
kiroalias, because they shareKiroMcp. Project mode is unchanged. Import still reads onlymcpServers. Because the global file is no longer deleted,generate --global --deletewithout a source leaves the earlier generated servers in place. The orphan sweep cannot rewrite a file in place, so this is documented instead: an empty{ "mcpServers": {} }source removes them and keeps the other keys (covered by e2e).Docs (README,
docs/reference/supported-tools.md,docs/reference/file-formats.md) andsrc/generated/docs-content.tsare updated.Still open in #2408
preCompact/postCompactfor Kiro: the 2026-11-19 comment says the IDE trigger IDs are now documented. I re-checked the hook types page (raw HTML) on 2026-11-22 and it still gives only the CLI IDs (PreCompact/PostCompact, CLI 3.1.0+). For the IDE it gives only the editor labels ("Pre Compaction" / "Post Compaction" under "Compaction Hooks"). So the IDE JSON ID is still undocumented, and with the shared.kiro/hooks/rulesync.jsonthe maintainer still has to decide. (PermissionRequestdiffers: its ID is stated for both products.)sessionEnd(CLI-only, shared-file question), the universal V2+V3 agent format,KIRO_HOME/KIRO_AGENT_CONFIG_DIR, and the other items left for the maintainer in earlier status comments.Tests
kiro-ide-hooks.test.ts(PermissionRequest mapping, matcher, round-trip, prompt skipped with a warning) andkiro-mcp.test.ts(global merge keepsidentityProvider, missing file, unparseable file refused, project mode not merged, not deletable in global mode).e2e-mcp.spec.tsforkiro-cliandkiro-idein global mode checks thatidentityProvidersurvives generate and that--deleteleaves the file. I confirmed the test fails when the file is deletable.pnpm cicheckpasses.Refs #2408
🤖 Generated with Claude Code
https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4