Skip to content
    ↑↓ select↵ openesc close
    English中文
    pnz1990

    Open Krode

    v0.2.0Observability
    @pnz1990/open-krode

    OpenCode plugin for kro RGD visualization and live instance observability

    GitHub stars

    1

    Monthly installs

    11

    Composite scoreSCORE

    20.9

    Multi-signal model

    Last commit

    5 months ago

    2026-03-20

    Install and configure

    opencode.json

    Writes to this project's opencode.json — applies to this repository only.

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["@pnz1990/open-krode@0.2.0"]
    }

    opencode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.

    open-krode logo

    An OpenCode plugin that adds a specialized krode agent for exploring and troubleshooting kro ResourceGraphDefinitions (RGDs) and their live instances — directly in your browser.

    npm version

    What it does

    • DAG visualization — renders the full resource dependency graph for any RGD: nodes, edges, CEL expressions, includeWhen conditions, forEach fan-outs, specPatch state nodes. Click any node or edge to inspect its CEL and concept explanation.
    • Live observability — watches a live CR instance with 5-second auto-refresh: spec/status diff, Kubernetes events, readiness conditions, live YAML. Click any node to inspect its YAML directly from the cluster.
    • Deep instance graph — recursively expands sub-RGDs, forEach instances, and all child resources up to 4 levels deep. Click any node to see its live YAML.

    Installation

    Add to your OpenCode config (~/.config/opencode/opencode.json for global, or opencode.json in your project):

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["@pnz1990/open-krode"]
    }
    

    OpenCode installs it automatically via Bun on next startup. No separate npm install needed.

    Local development

    {
      "plugin": ["/path/to/open-krode"]
    }
    

    Requirements

    • OpenCode with plugin support
    • kubectl configured with access to a cluster running kro
    • A browser (opens automatically)

    Usage

    Select the krode agent in OpenCode, then ask things like:

    • "Show me the my-app-graph RGD"
    • "What instances of my-app-graph exist in namespace prod?"
    • "Why isn't the database resource being created?"
    • "Explain the specPatch nodes in my-app-graph"
    • "Open a deep view for instance my-app in namespace default"

    Tools

    Tool Description
    open_krode_session Opens the browser UI and lists all RGDs from the cluster
    show_rgd_graph Renders the DAG for an RGD in the browser
    list_rgd_instances Lists all live CR instances of an RGD
    show_instance Opens a live view with 5s auto-refresh for a CR instance
    show_deep_instance Opens the full multi-level instance graph
    show_instance_events Shows Kubernetes events for a CR instance
    show_instance_yaml Shows raw YAML for a CR instance
    close_krode_session Closes the browser and stops all watchers

    Architecture

    src/
    ├── index.ts              # Plugin entry point — registers tools + krode agent config
    ├── agent/
    │   └── prompt.ts         # System prompt for the krode agent
    ├── kro/
    │   ├── types.ts          # RGD/instance/graph TypeScript types
    │   ├── kubectl.ts        # kubectl wrappers: listRGDs, getInstance, buildRGDGraph, etc.
    │   └── index.ts
    ├── session/
    │   ├── types.ts          # KrodeSession, View, ViewMode, cache types
    │   ├── manager.ts        # SessionManager: create/end sessions, views, watchers
    │   ├── server.ts         # Bun HTTP+WebSocket server (one per session, random port)
    │   ├── browser.ts        # Cross-platform browser opener
    │   └── index.ts
    ├── tools/
    │   └── index.ts          # MCP tool definitions
    └── ui/
        └── bundle.ts         # Self-contained HTML/CSS/JS UI (no external dependencies)
    

    Tech stack

    • Runtime: Bun (HTTP + WebSocket server)
    • Language: TypeScript 5 (strict)
    • Plugin SDK: @opencode-ai/plugin
    • UI: Vanilla HTML/CSS/JS with inline SVG DAG renderer — no external dependencies, no build step for the UI
    • k8s access: kubectl CLI — runs from your local kubeconfig, no in-cluster SDK

    Development

    bun install
    bun run build           # build dist/index.js + write dist/ui.html
    bun run typecheck       # type-check without emitting
    bun run install:plugin  # build + copy to ~/.cache/opencode for local testing
    

    UI changes (src/ui/bundle.ts) only need bun run build + browser refresh — no OpenCode restart required.

    Logic changes (anything else in src/) require an OpenCode restart after bun run install:plugin.

    License

    MIT

    Requirements

    • OpenCode with plugin support
    • kubectl configured with access to a cluster running kro
    • A browser (opens automatically)

    Usage

    Select the krode agent in OpenCode, then ask things like:

    • "Show me the my-app-graph RGD"
    • "What instances of my-app-graph exist in namespace prod?"
    • "Why isn't the database resource being created?"
    • "Explain the specPatch nodes in my-app-graph"
    • "Open a deep view for instance my-app in namespace default"

    Tools

    Tool Description
    open_krode_session Opens the browser UI and lists all RGDs from the cluster
    show_rgd_graph Renders the DAG for an RGD in the browser
    list_rgd_instances Lists all live CR instances of an RGD
    show_instance Opens a live view with 5s auto-refresh for a CR instance
    show_deep_instance Opens the full multi-level instance graph
    show_instance_events Shows Kubernetes events for a CR instance
    show_instance_yaml Shows raw YAML for a CR instance
    close_krode_session Closes the browser and stops all watchers

    Architecture

    src/
    ├── index.ts              # Plugin entry point — registers tools + krode agent config
    ├── agent/
    │   └── prompt.ts         # System prompt for the krode agent
    ├── kro/
    │   ├── types.ts          # RGD/instance/graph TypeScript types
    │   ├── kubectl.ts        # kubectl wrappers: listRGDs, getInstance, buildRGDGraph, etc.
    │   └── index.ts
    ├── session/
    │   ├── types.ts          # KrodeSession, View, ViewMode, cache types
    │   ├── manager.ts        # SessionManager: create/end sessions, views, watchers
    │   ├── server.ts         # Bun HTTP+WebSocket server (one per session, random port)
    │   ├── browser.ts        # Cross-platform browser opener
    │   └── index.ts
    ├── tools/
    │   └── index.ts          # MCP tool definitions
    └── ui/
        └── bundle.ts         # Self-contained HTML/CSS/JS UI (no external dependencies)
    

    Tech stack

    • Runtime: Bun (HTTP + WebSocket server)
    • Language: TypeScript 5 (strict)
    • Plugin SDK: @opencode-ai/plugin
    • UI: Vanilla HTML/CSS/JS with inline SVG DAG renderer — no external dependencies, no build step for the UI
    • k8s access: kubectl CLI — runs from your local kubeconfig, no in-cluster SDK

    Development

    bun install
    bun run build           # build dist/index.js + write dist/ui.html
    bun run typecheck       # type-check without emitting
    bun run install:plugin  # build + copy to ~/.cache/opencode for local testing
    

    UI changes (src/ui/bundle.ts) only need bun run build + browser refresh — no OpenCode restart required.

    Logic changes (anything else in src/) require an OpenCode restart after bun run install:plugin.

    License

    MIT