Skip to content

Create dedicated Kiro schema (schemas/kiro.rs) #595

@avifenesh

Description

@avifenesh

Summary

Create dedicated Kiro schemas for structured validation of agent JSON, hook files, power files, and MCP config.

Current state

  • kiro_steering.rs parses YAML frontmatter inline (730 lines)
  • No schemas for other Kiro file types
  • S-tier tools (Codex, OpenCode) have dedicated schema files

Schemas needed (from research)

KiroAgentConfig (schemas/kiro_agent.rs)

struct KiroAgentConfig {
    name: Option<String>,
    description: Option<String>,
    prompt: Option<String>,              // inline text or file:// URI
    model: Option<String>,               // claude-sonnet-4, claude-sonnet4.5, claude-opus4.5, Auto
    tools: Option<Vec<String>>,          // read, write, shell, aws, web, knowledge, @builtin, *, @server
    allowed_tools: Option<Vec<String>>,  // supports */? globs
    tool_aliases: Option<Map<String, String>>,
    tools_settings: Option<Value>,
    resources: Option<Vec<Value>>,       // file://, skill://, { type: "knowledgeBase" }
    mcp_servers: Option<Map<String, McpServer>>,
    include_mcp_json: Option<bool>,      // default false
    hooks: Option<KiroCliHooks>,
    keyboard_shortcut: Option<String>,
    welcome_message: Option<String>,
}

KiroIdeHook (schemas/kiro_hook.rs)

struct KiroIdeHook {
    title: String,
    description: Option<String>,
    event: String,          // fileEdited, fileCreate, fileDelete, promptSubmit, agentStop, preToolUse, postToolUse, manual
    patterns: Option<Vec<String>>,  // file globs for file-based events
    tool_types: Option<Vec<String>>, // tool filters for pre/post tool events
    then: HookAction,       // runCommand { command } or askAgent { prompt }
}

KiroPower (schemas/kiro_power.rs)

struct KiroPowerFrontmatter {
    name: String,           // required
    display_name: Option<String>,
    description: String,    // required
    keywords: Vec<String>,  // required, non-empty
    author: Option<String>,
}

KiroCliHooks (embedded in agent schema)

struct KiroCliHooks {
    agent_spawn: Option<Vec<CliHookEntry>>,
    user_prompt_submit: Option<Vec<CliHookEntry>>,
    pre_tool_use: Option<Vec<CliHookEntry>>,
    post_tool_use: Option<Vec<CliHookEntry>>,
    stop: Option<Vec<CliHookEntry>>,
}

struct CliHookEntry {
    command: String,                    // required
    matcher: Option<String>,           // tool name pattern, default "*"
    timeout_ms: Option<u64>,           // default 30000
    cache_ttl_seconds: Option<u64>,    // default 0
}

Acceptance criteria

  • schemas/kiro_agent.rs created
  • schemas/kiro_hook.rs created
  • schemas/kiro_power.rs created
  • Existing kiro_steering.rs refactored to use schema if beneficial
  • Serde deserialization with proper error handling
  • Tests for schema parsing (valid + invalid)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions