feat(agents): add Kiro CLI and Kiro IDE support#21
Conversation
Add two new agents for Kiro's CLI tool and IDE, bringing the total to 11 supported AI assistants. Kiro CLI generates plain markdown prompts at ~/.kiro/prompts/, while Kiro IDE generates custom subagent files with YAML frontmatter at ~/.kiro/agents/. Key changes: - KIRO and KIRO_IDE command formats with dedicated generators - Command cross-reference rewriting (/SDD-N-name → @name) - SDD ordering prefix stripping for clean filenames and invocation names - Tracking metadata via trailing HTML comments for cleanup detection - Documentation for /tools trust-all workaround (Kiro CLI permissions)
📝 WalkthroughWalkthroughAdds Kiro support: two new command formats ( Changes
Sequence Diagram(s)sequenceDiagram
participant Source as Source (repo / local)
participant Generator as Kiro Generator
participant Writer as Writer
participant FS as Filesystem
Source->>Generator: load prompt + metadata
Generator->>Generator: strip ordering prefix\nrewrite /SDD-N-name -> `@name`\napply placeholders\nbuild frontmatter (IDE) or body (CLI)\nappend tracking comment
Generator->>Writer: provide filename suggestion & content
Writer->>Writer: compute output name (agent rules)\nsanitize filename\nis_generated check via tracking comment
Writer->>FS: write file to agent-specific dir (`~/.kiro/...` or project target)
FS-->>Writer: write confirmation
Writer-->>Source: return generated path/info
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
Verify each finding against the current code and only fix it if needed.
In `@docs/slash-command-generator.md`:
- Around line 226-228: The fenced code block containing the snippet "> /tools
trust-all" triggers MD040/fenced-code-language; update that Markdown block in
docs/slash-command-generator.md to include a language identifier (e.g., change
the opening fence to ```text or ```bash) so the block becomes a fenced code
block with an explicit language and the CI lint will pass.
In `@slash_commands/generators.py`:
- Around line 344-353: The metadata writer in the generator is checking the
wrong key ("github_repo") so the repo never gets appended; update the
conditional in the generator that builds meta_lines to check for "source_repo"
instead of "github_repo" (do this in the function that constructs meta_lines and
also in KiroIdeCommandGenerator.generate), and update the corresponding tests in
test_generators.py to assert on "source_repo" being used in the tracking
comment.
- Around line 358-412: Extract the duplicated trailing HTML tracking comment
construction from KiroIdeCommandGenerator.generate and KiroCommandGenerator into
a small helper (e.g., _build_kiro_tracking_comment(prompt_name: str,
source_metadata: dict | None) -> str) that builds the meta_lines list, appends
repo when present, formats the comment string ("<!-- slash-command-manager: ...
-->\n"), and returns it; then call this helper from both
KiroIdeCommandGenerator.generate (replace the block that builds meta_lines and
appends the comment) and KiroCommandGenerator (replace its equivalent block) and
keep the existing call to _normalize_output(output) intact.
In `@slash_commands/writer.py`:
- Around line 287-302: Move the lazy import of _strip_ordering_prefix out of
_get_output_name and add a top-level import from slash_commands.generators (e.g.
import or from slash_commands.generators import _strip_ordering_prefix) near the
existing imports; then remove the in-function import and let _get_output_name
call _strip_ordering_prefix directly when agent.command_format.value is "kiro"
or "kiro-ide" to avoid repeated import overhead and keep imports consistent with
the rest of the module.
In `@tests/test_generators.py`:
- Around line 385-396: Update the tests to use the same metadata key the writer
uses: replace the "github_repo" key with "source_repo" in
test_kiro_generator_github_source_metadata and
test_kiro_ide_generator_github_source_metadata so they mirror the runtime shape
constructed by the writer (the KiroCommandGenerator.generate flow expects
"source_repo"); keep the assertion unchanged (e.g., assert "repo:
liatrio-labs/spec-driven-workflow" in generated) so the tests validate output
using the correct metadata key.
🧹 Nitpick comments (2)
🤖 Fix all nitpicks with AI agents
Verify each finding against the current code and only fix it if needed. In `@slash_commands/generators.py`: - Around line 358-412: Extract the duplicated trailing HTML tracking comment construction from KiroIdeCommandGenerator.generate and KiroCommandGenerator into a small helper (e.g., _build_kiro_tracking_comment(prompt_name: str, source_metadata: dict | None) -> str) that builds the meta_lines list, appends repo when present, formats the comment string ("<!-- slash-command-manager: ... -->\n"), and returns it; then call this helper from both KiroIdeCommandGenerator.generate (replace the block that builds meta_lines and appends the comment) and KiroCommandGenerator (replace its equivalent block) and keep the existing call to _normalize_output(output) intact. In `@slash_commands/writer.py`: - Around line 287-302: Move the lazy import of _strip_ordering_prefix out of _get_output_name and add a top-level import from slash_commands.generators (e.g. import or from slash_commands.generators import _strip_ordering_prefix) near the existing imports; then remove the in-function import and let _get_output_name call _strip_ordering_prefix directly when agent.command_format.value is "kiro" or "kiro-ide" to avoid repeated import overhead and keep imports consistent with the rest of the module.slash_commands/writer.py (1)
287-302: Consider promoting the lazy import to a top-level import.
_strip_ordering_prefixis imported lazily inside_get_output_name, butslash_commands.generatorsis already partially imported at Line 20. Since there's no circular dependency risk, this can be a top-level import for consistency and to avoid repeated import overhead on every call.♻️ Suggested change
At the top of the file (around line 20):
from slash_commands.generators import CommandGenerator +from slash_commands.generators import _strip_ordering_prefixThen simplify the method:
def _get_output_name(self, prompt_name: str, agent: AgentConfig) -> str: name = prompt_name if agent.command_format.value in ("kiro", "kiro-ide"): - from slash_commands.generators import _strip_ordering_prefix - name = _strip_ordering_prefix(name) return name🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@slash_commands/writer.py` around lines 287 - 302, Move the lazy import of _strip_ordering_prefix out of _get_output_name and add a top-level import from slash_commands.generators (e.g. import or from slash_commands.generators import _strip_ordering_prefix) near the existing imports; then remove the in-function import and let _get_output_name call _strip_ordering_prefix directly when agent.command_format.value is "kiro" or "kiro-ide" to avoid repeated import overhead and keep imports consistent with the rest of the module.slash_commands/generators.py (1)
358-412: Consider extracting the shared tracking-comment logic to reduce duplication.The trailing HTML comment block (Lines 401–410) is nearly identical to the one in
KiroCommandGenerator(Lines 344–353). A small helper like_build_kiro_tracking_comment(prompt_name, source_metadata)would reduce duplication across both generators.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@slash_commands/generators.py` around lines 358 - 412, Extract the duplicated trailing HTML tracking comment construction from KiroIdeCommandGenerator.generate and KiroCommandGenerator into a small helper (e.g., _build_kiro_tracking_comment(prompt_name: str, source_metadata: dict | None) -> str) that builds the meta_lines list, appends repo when present, formats the comment string ("<!-- slash-command-manager: ... -->\n"), and returns it; then call this helper from both KiroIdeCommandGenerator.generate (replace the block that builds meta_lines and appends the comment) and KiroCommandGenerator (replace its equivalent block) and keep the existing call to _normalize_output(output) intact.
Fixes markdownlint MD040 violation in Kiro CLI permissions section.
There was a problem hiding this comment.
🤖 Fix all issues with AI agents
Verify each finding against the current code and only fix it if needed.
In `@docs/slash-command-generator.md`:
- Around line 220-230: Add a brief safety caution immediately after the "/tools
trust-all" workaround in the "Kiro CLI Tool Permissions" section: explicitly
warn that running /tools trust-all disables write/shell confirmations and should
not be used in untrusted repositories or shared sessions, recommend using it
only in trusted, ephemeral sessions, and optionally suggest revoking trust by
restarting the CLI session; reference the exact command "/tools trust-all" and
the "Kiro CLI Tool Permissions" heading so reviewers can find and insert a
one-sentence caution.
🧹 Nitpick comments (1)
🤖 Fix all nitpicks with AI agents
Verify each finding against the current code and only fix it if needed. In `@docs/slash-command-generator.md`: - Around line 220-230: Add a brief safety caution immediately after the "/tools trust-all" workaround in the "Kiro CLI Tool Permissions" section: explicitly warn that running /tools trust-all disables write/shell confirmations and should not be used in untrusted repositories or shared sessions, recommend using it only in trusted, ephemeral sessions, and optionally suggest revoking trust by restarting the CLI session; reference the exact command "/tools trust-all" and the "Kiro CLI Tool Permissions" heading so reviewers can find and insert a one-sentence caution.docs/slash-command-generator.md (1)
220-230: Add a brief safety caution for/tools trust-all.Since this disables confirmations for write/shell, add a warning to avoid using it in untrusted repos or shared sessions.
✍️ Suggested doc tweak
-Kiro CLI prompts are plain markdown files and do not support declaring tool permissions. By default, Kiro CLI will prompt you to confirm every `write` and `shell` operation, which interrupts workflows like SDD that need to create files automatically. +Kiro CLI prompts are plain markdown files and do not support declaring tool permissions. By default, Kiro CLI will prompt you to confirm every `write` and `shell` operation, which interrupts workflows like SDD that need to create files automatically. Use the trust-all workaround only in trusted repos/sessions.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/slash-command-generator.md` around lines 220 - 230, Add a brief safety caution immediately after the "/tools trust-all" workaround in the "Kiro CLI Tool Permissions" section: explicitly warn that running /tools trust-all disables write/shell confirmations and should not be used in untrusted repositories or shared sessions, recommend using it only in trusted, ephemeral sessions, and optionally suggest revoking trust by restarting the CLI session; reference the exact command "/tools trust-all" and the "Kiro CLI Tool Permissions" heading so reviewers can find and insert a one-sentence caution.
The writer sends source_metadata with key "source_repo" but both Kiro generators were checking for "github_repo", so the repo line was never appended in the real pipeline. Fixed key and updated tests to match.
Replaces the minimal permissions note with a full Kiro section covering CLI vs IDE differences, quick start commands, automatic command reference rewriting, and ordering prefix stripping.
* feat: adding in support for kiro ide * fix: formatting of the test_writer * chore: fix comment to / command --------- Co-authored-by: Morgan Snow <msnow@digitalaviationservices.com>
…nces Kiro IDE steering files are invoked with /command-name, not @command-name. Parameterize the rewriter so CLI keeps @ and IDE uses /. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
slash_commands/generators.py (1)
361-363: Update the Kiro IDE generator docstring path to match current target directory.The docstring says
~/.kiro/steering/*.md, but this PR’s docs/config use~/.kiro/agents/*.md. Please align the comment to avoid future maintenance confusion.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@slash_commands/generators.py` around lines 361 - 363, Update the Kiro IDE generator docstring path string in slash_commands/generators.py (the docstring around the Kiro IDE generator description near the Kiro-related functions or class) to use "~/.kiro/agents/*.md" instead of "~/.kiro/steering/*.md" so it matches the PR’s docs/config; locate the docstring text referenced in the generator (search for "Kiro IDE" or the existing "~/.kiro/steering/*.md" literal) and change that path only.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@slash_commands/generators.py`:
- Around line 361-363: Update the Kiro IDE generator docstring path string in
slash_commands/generators.py (the docstring around the Kiro IDE generator
description near the Kiro-related functions or class) to use
"~/.kiro/agents/*.md" instead of "~/.kiro/steering/*.md" so it matches the PR’s
docs/config; locate the docstring text referenced in the generator (search for
"Kiro IDE" or the existing "~/.kiro/steering/*.md" literal) and change that path
only.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
docs/slash-command-generator.mdslash_commands/config.pyslash_commands/generators.pytests/test_config.pytests/test_generators.pytests/test_writer.py
🚧 Files skipped from review as they are similar to previous changes (2)
- slash_commands/config.py
- tests/test_writer.py
Fix README and docs to reflect .kiro/steering/ path, correct CLI flags, and differentiate @ (CLI) vs / (IDE) command reference syntax. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
slash_commands/generators.py (1)
347-359: Consolidate duplicated tracking-comment construction.The same metadata/comment assembly is implemented twice; extracting a shared helper will reduce drift risk between CLI and IDE generators.
♻️ Proposed refactor
+def _build_tracking_comment( + prompt_name: str, source_metadata: dict[str, Any] | None = None +) -> str: + meta_lines = [ + f"source: {prompt_name}", + f"version: {__version__}", + f"updated: {datetime.now(UTC).strftime('%Y-%m-%d')}", + ] + if source_metadata and "source_repo" in source_metadata: + meta_lines.append(f"repo: {source_metadata['source_repo']}") + return "<!-- slash-command-manager: " + " | ".join(meta_lines) + " -->" + class KiroCommandGenerator: @@ - meta_lines = [ - f"source: {prompt.name}", - f"version: {__version__}", - f"updated: {datetime.now(UTC).strftime('%Y-%m-%d')}", - ] - if source_metadata: - if "source_repo" in source_metadata: - meta_lines.append(f"repo: {source_metadata['source_repo']}") - - output += "\n<!-- slash-command-manager: " + " | ".join(meta_lines) + " -->\n" + output += "\n" + _build_tracking_comment(prompt.name, source_metadata) + "\n" @@ - meta_lines = [ - f"source: {prompt.name}", - f"version: {__version__}", - f"updated: {datetime.now(UTC).strftime('%Y-%m-%d')}", - ] - if source_metadata: - if "source_repo" in source_metadata: - meta_lines.append(f"repo: {source_metadata['source_repo']}") - - output += "\n<!-- slash-command-manager: " + " | ".join(meta_lines) + " -->\n" + output += "\n" + _build_tracking_comment(prompt.name, source_metadata) + "\n"Also applies to: 405-415
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@slash_commands/generators.py` around lines 347 - 359, Duplicate logic building the trailing HTML tracking comment (meta_lines population and appending to output) appears in generators.py (meta_lines, source_metadata checks, and output += "...slash-command-manager..."), so extract a single helper function (e.g., format_tracking_comment or build_tracking_comment) that accepts prompt.name, source_metadata and returns the full "<!-- slash-command-manager: ... -->" string using __version__, datetime.now(UTC).strftime('%Y-%m-%d'), and optional repo entry; then replace both duplicated blocks (the current one around meta_lines and the similar block at the other location around lines 405-415) to call that helper and append its return to output to remove duplication and keep behavior identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@slash_commands/generators.py`:
- Around line 314-315: Update the docstrings in slash_commands/generators.py
that reference the old prompt and path syntax: replace occurrences of the string
"@prompt_name" with "@prompt-name" and "~/.kiro/steering/*.md" with
"~/.kiro/agents/*.md" (also update the duplicate mentions around the block that
previously appeared at the later location). Search for these literal strings in
the module's docstrings/comments and update them to the current conventions so
the text in the functions/classes that document prompt invocation and file
locations is accurate.
---
Nitpick comments:
In `@slash_commands/generators.py`:
- Around line 347-359: Duplicate logic building the trailing HTML tracking
comment (meta_lines population and appending to output) appears in generators.py
(meta_lines, source_metadata checks, and output +=
"...slash-command-manager..."), so extract a single helper function (e.g.,
format_tracking_comment or build_tracking_comment) that accepts prompt.name,
source_metadata and returns the full "<!-- slash-command-manager: ... -->"
string using __version__, datetime.now(UTC).strftime('%Y-%m-%d'), and optional
repo entry; then replace both duplicated blocks (the current one around
meta_lines and the similar block at the other location around lines 405-415) to
call that helper and append its return to output to remove duplication and keep
behavior identical.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-command-manager into feat/kiro-cli-support
Summary
~/.kiro/prompts/*.mdwith@prompt-nameinvocationname,description,tools: ["*"]) at~/.kiro/agents/*.md/SDD-N-command-nameto@command-namefor Kiro's invocation syntaxSDD-1-generate-spec→generate-spec) for clean filenames and invocation names<!-- slash-command-manager: ... -->) for cleanup detection/tools trust-allworkaround for Kiro CLI tool permissionsTest plan
uv run slash-man generate --agent kiro-cli --github-repo liatrio-labs/spec-driven-workflow --github-branch main --github-path promptsand verify SDD prompts at~/.kiro/prompts/uv run slash-man generate --agent kiro-ide --github-repo liatrio-labs/spec-driven-workflow --github-branch main --github-path promptsand verify SDD agents at~/.kiro/agents/@namereferences in generated files (no/SDD-N-references remain)name,description,tools: ['*']/tools trust-allSummary by CodeRabbit
New Features
Documentation
Tests