Skip to content

feat(permissions): map Kiro grep/glob categories to toolsSettings - #2170

Merged
dyoshikawa merged 1 commit into
mainfrom
resolve-issue-2132-kiro-permissions
Jul 7, 2026
Merged

feat(permissions): map Kiro grep/glob categories to toolsSettings#2170
dyoshikawa merged 1 commit into
mainfrom
resolve-issue-2132-kiro-permissions

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Problem

rulesync already carries canonical grep/glob permission categories, but the Kiro translator dropped them with an "unsupported category" warning — even though Kiro documents toolsSettings.grep/toolsSettings.glob with allowedPaths/deniedPaths.

Fix

  • Map greptoolsSettings.grep.{allowedPaths,deniedPaths} and globtoolsSettings.glob.{allowedPaths,deniedPaths}, mirroring the existing read mapping.
  • Emit each table only when a rule is present, so existing configs do not gain empty grep/glob tables.
  • Round-trip both on import.
  • Refactored the path-category handling into shared helpers (rulesFromArrays, pathTable, applyKiroWebPermission) to keep the translator under the complexity limit.

Scope

This is item 1 of #2132 — the straightforward, override-independent fix. The kiro-scoped override namespace for the Kiro-specific keys (item 2: aws tool, shell auto-trust flags, domain-scoped web trusted/blocked, MCP autoApprove/disabledTools) is intentionally left as a follow-up: it carries several unresolved design questions (what counts as a permission vs. config in the shared .kiro/agents/default.json, how MCP autoApprove/disabledTools reconcile with the canonical mcp__* allow/ask/deny model, whether aws/subagent/introspect belong under a permissions override) that warrant a maintainer design call before implementing. The issue is left open for that part.

Source: https://kiro.dev/docs/cli/custom-agents/configuration-reference/

Refs #2132

🤖 Generated with Claude Code

rulesync already carries canonical grep/glob categories, but the Kiro
translator dropped them with an "unsupported category" warning even
though Kiro documents toolsSettings.grep/glob.{allowedPaths,deniedPaths}.

Map grep -> toolsSettings.grep and glob -> toolsSettings.glob (mirroring
the read mapping), emitting each table only when a rule is present so
existing configs do not gain empty tables, and round-trip both on import.
Refactored the path-category handling into shared helpers to keep the
translator under the complexity limit.

This is item 1 of #2132 (the straightforward, override-independent fix).
The kiro-scoped override namespace for aws/shell-auto-trust/web-domain/
MCP keys (item 2) is left as a follow-up: it carries several open design
questions and touches the shared .kiro/agents/default.json round-trip.

Source: https://kiro.dev/docs/cli/custom-agents/configuration-reference/

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dyoshikawa
dyoshikawa merged commit 1563382 into main Jul 7, 2026
9 checks passed
@dyoshikawa

Copy link
Copy Markdown
Owner Author

@dyoshikawa Thank you!

@dyoshikawa
dyoshikawa deleted the resolve-issue-2132-kiro-permissions branch July 7, 2026 11:36
hirossyi73 pushed a commit to hirossyi73/rulesync that referenced this pull request Jul 10, 2026
…s, aws services, and web_fetch domain trust

Kiro's agent config (.kiro/agents/<name>.json) exposes per-tool toolsSettings
knobs with no canonical allow/ask/deny category. Add a tool-scoped kiro override
(per dyoshikawa#2127) authoring the ones that live in the agent config this permissions
translator already writes:
- shell auto-trust flags: toolsSettings.shell.autoAllowReadonly / denyByDefault
- aws built-in tool: toolsSettings.aws.allowedServices / deniedServices (+ autoAllowReadonly)
- web_fetch domain trust: toolsSettings.web_fetch.trusted / blocked (regex host
  patterns; documented for web_fetch only, so web_search is not modeled)

Wiring:
- Generate: deep-merge the override per toolsSettings key (override wins at the
  leaf) so authoring shell.autoAllowReadonly keeps the canonical-generated
  shell.allowedCommands. Non-canonical shell flags already in the file are also
  preserved across regenerate even without an override. Prototype-pollution keys
  are guarded before being used as object keys.
- Import: lift the kiro-specific surfaces into the kiro override so they
  round-trip and become authorable; canonical shell command lists / read / write
  / grep / glob / web allowedTools toggles are unchanged.

All shapes were verified against Kiro's primary docs (built-in-tools and
configuration-reference, rendered via a browser since kiro.dev is a SPA).

Out of scope (deferred): Kiro's MCP autoApprove / disabledTools live in a
separate file (.kiro/settings/mcp.json, under mcpServers.<name>), not the agent
config this translator writes, and reconciling them with the canonical mcp__*
model is a distinct design question. Item 1 of the issue (grep/glob mapping)
already shipped in dyoshikawa#2170.

Closes dyoshikawa#2132

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants