Skip to content

feat(kiro): map PermissionRequest hooks and keep identityProvider in global MCP - #3939

Merged
dyoshikawa merged 3 commits into
mainfrom
resolve-issue-2408-kiro-permission-request
Nov 22, 2026
Merged

dyoshikawa merged 3 commits into
mainfrom
resolve-issue-2408-kiro-permission-request

Conversation

@dyoshikawa

@dyoshikawa dyoshikawa commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

Follows up on the 2026-11-19 upstream re-check in #2408.

  • hooks (kiro-cli, kiro-ide): canonical permissionRequest now maps to Kiro's PermissionRequest trigger, 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 a prompt hook on permissionRequest is skipped with a warning instead of being written as an agent action Kiro never runs. Import maps PermissionRequest back to permissionRequest, and drops an agent action on that trigger (either spelling) with a warning. A canonical permissionRequest hook plus a hand-written kiro.hooks.PermissionRequest entry produce two hooks (documented). The deprecated kiro alias's hooks are unchanged.

  • mcp (global): generate --global used to replace ~/.kiro/settings/mcp.json with { mcpServers }, deleting the user's identityProvider block for MCP organization sign-in (Kiro reads it only from that user-level file, per MCP configuration). Now in global mode:

    • generated mcpServers are merged into the existing file, and every other top-level key is kept;
    • an unparseable file is refused rather than overwritten;
    • the file is never deleted (isDeletable() returns false), so generate --global --delete leaves it alone.

    This applies to every Kiro target, including the deprecated kiro alias, because they share KiroMcp. Project mode is unchanged. Import still reads only mcpServers. Because the global file is no longer deleted, generate --global --delete without 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) and src/generated/docs-content.ts are updated.

Still open in #2408

  • preCompact / postCompact for 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.json the maintainer still has to decide. (PermissionRequest differs: 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

  • Unit: kiro-ide-hooks.test.ts (PermissionRequest mapping, matcher, round-trip, prompt skipped with a warning) and kiro-mcp.test.ts (global merge keeps identityProvider, missing file, unparseable file refused, project mode not merged, not deletable in global mode).
  • E2E: e2e-mcp.spec.ts for kiro-cli and kiro-ide in global mode checks that identityProvider survives generate and that --delete leaves the file. I confirmed the test fails when the file is deletable.
  • pnpm cicheck passes.

Refs #2408

🤖 Generated with Claude Code

https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4

dyoshikawa and others added 3 commits November 22, 2026 17:51
…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
@dyoshikawa
dyoshikawa merged commit 65e4e58 into main Nov 22, 2026
10 checks passed
@dyoshikawa
dyoshikawa deleted the resolve-issue-2408-kiro-permission-request branch November 22, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant