Skip to content

feat(cli): add command file management parity with skills - #12825

Merged
kirillk merged 6 commits into
mainfrom
rune-polo
Aug 6, 2026
Merged

feat(cli): add command file management parity with skills#12825
kirillk merged 6 commits into
mainfrom
rune-polo

Conversation

@kirillk

@kirillk kirillk commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Context

Brings file-backed commands/workflows to CLI API parity with skills. GET /command is built for slash-command execution and does not expose file locations or deletion, so editor clients could not safely manage command/workflow files the same way they manage skills.

This PR adds Kilo-owned command-file endpoints that expose editable file locations, content, and command execution metadata (agent, model, variant, subtask). That lets clients preserve model/variant settings and distinguish editable .md files from built-in, MCP, skill-backed, or inline commands.

Capability Skills Commands
List with file location + content GET /skill GET /kilocode/command/files
Delete file POST /kilocode/skill/remove POST /kilocode/command/remove
Save/edit direct file write direct file write
Reload POST /instance/reload POST /instance/reload

Implementation

Added GET /kilocode/command/files and POST /kilocode/command/remove. Discovery maps runtime commands back to command/workflow .md files where possible, marks non-file commands read-only, follows the same symlink-aware command glob as runtime loading, and preserves command-file precedence over same-named legacy workflows. Remove validates the location and unlinks only the command .md file, mirroring skill removal.

Regenerated SDK/OpenAPI output for the new CommandFile shape and added a CLI changeset.

Updated JetBrains shared/backend RPC contracts, DTOs, parsers, and tests so the plugin can list/save/delete/reload command files and receive command metadata through both workspace command lists and command-file lists. New command saves now accept the CLI discovery roots for project .kilo/.kilocode command directories plus global/home config command roots. No JetBrains settings UI is included.

Added HttpApi exerciser coverage for both new endpoints and stabilized a Windows cleanup-runner test that timed out in CI.

Verification

  • bun run typecheck in packages/opencode
  • bun test ./test/kilocode/command-files.test.ts in packages/opencode
  • bun run script/httpapi-exercise.ts --mode coverage --fail-on-missing --fail-on-skip in packages/opencode
  • bun test ./test/kilocode/test-runner-cleanup.test.ts in packages/opencode
  • ./gradlew :backend:test --tests ai.kilocode.backend.rpc.KiloAgentBehaviorRpcApiImplTest --tests ai.kilocode.backend.cli.KiloCliDataParserTest in packages/kilo-jetbrains
  • ./gradlew typecheck in packages/kilo-jetbrains
  • Pre-push typechecks passed for JS and JetBrains filters

Checklist

  • Tests/verification described
  • Changeset considered for user-facing changes
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

kirillk added 3 commits August 3, 2026 13:25
…gement

Add GET /kilocode/command/files and POST /kilocode/command/remove, backed by a
Kilo-owned discovery module that lists commands with editable file locations
(and marks non-file commands as read-only built-ins). Wire the matching shared
RPC contract, backend RPC implementation, DTO, and parser in the JetBrains
plugin so clients can consume the endpoints. Regenerate the SDK.
Comment thread packages/opencode/src/kilocode/command-files.ts
Comment thread packages/opencode/src/kilocode/command-files.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental review of commit 65d678b7ff (relax Windows cleanup runner deadline). The change is test-only: it raises the process-exit deadline to 30s on Windows (15s elsewhere) and the surrounding test timeout to 45s, which still covers the worst-case 30s exit wait + 5s pid poll with headroom. Cleanup logic (SIGKILL in finally) is unchanged.

Re-verified against current HEAD: the previous workflow-precedence warning on command-files.ts remains resolved (workflows are appended before directory scans, so last-wins attribution matches runtime merge order), and scan() still uses Glob.scan(..., { symlink: true }), keeping the symlink gap closed.

Files Reviewed (1 file)
  • packages/opencode/test/kilocode/test-runner-cleanup.test.ts
Previous Review Summaries (3 snapshots, latest commit 5231fe5)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 5231fe5)

Status: No Issues Found | Recommendation: Merge

Incremental review of commit 5231fe55c5 (test coverage for command file endpoints). The new httpapi-exercise scenarios mirror the established skill/agent patterns, use supported frontmatter keys (description, model, variant), correct operation IDs, and fixture init runs before instance boot so discovery assertions are sound.

Re-verified against current HEAD: the previous workflow-precedence warning on command-files.ts is resolved — commit fa9f4a5a52 moved workflow discovery before directory scans so last-wins attribution matches runtime merge order, and the symlink gap was closed by switching scan() to the same Glob.scan(..., { symlink: true }) used by the config loader.

Files Reviewed (1 file)
  • packages/opencode/test/kilocode/server/httpapi-exercise-scenarios.ts

Previous review (commit fa9f4a5)

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 3
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/command-files.ts 80 Workflow files win location attribution over same-named command files, inverting runtime precedence — remove would delete the workflow while the command stays active

SUGGESTION

File Line Issue
packages/opencode/src/kilocode/command-files.ts 47 scan() misses symlinked command files/dirs that the runtime loader follows
packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/KiloAgentBehaviorRpcApiImpl.kt 148 hasActiveSession log messages are skill-labeled on the new command-reload path
packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/KiloAgentBehaviorRpcApiImpl.kt 344 New-file saves restricted to .kilo/command, narrower than CLI discovery roots
Files Reviewed (19 files)
  • .changeset/commands-settings-jetbrains.md
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/cli/KiloCliDataParser.kt
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/KiloAgentBehaviorRpcApiImpl.kt - 2 issues
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/KiloWorkspaceDtoMapper.kt
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/workspace/KiloWorkspaceState.kt
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/cli/KiloCliDataParserTest.kt
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/rpc/KiloAgentBehaviorRpcApiImplTest.kt
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/testing/MockCliServer.kt
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/testing/FakeAgentBehaviorRpcApi.kt
  • packages/kilo-jetbrains/shared/src/main/kotlin/ai/kilocode/rpc/KiloAgentBehaviorRpcApi.kt
  • packages/kilo-jetbrains/shared/src/main/kotlin/ai/kilocode/rpc/dto/CommandDto.kt
  • packages/kilo-jetbrains/shared/src/main/kotlin/ai/kilocode/rpc/dto/CommandFileDto.kt
  • packages/opencode/src/kilocode/command-files.ts - 2 issues
  • packages/opencode/src/kilocode/server/httpapi/groups/kilocode.ts
  • packages/opencode/src/kilocode/server/httpapi/handlers/kilocode.ts
  • packages/opencode/test/kilocode/command-files.test.ts
  • packages/sdk/js/src/v2/gen/sdk.gen.ts
  • packages/sdk/js/src/v2/gen/types.gen.ts
  • packages/sdk/openapi.json

Fix these issues in Kilo Cloud

Previous review (commit c7fd843)

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 3
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/command-files.ts 80 Workflow files win location attribution over same-named command files, inverting runtime precedence — remove would delete the workflow while the command stays active

SUGGESTION

File Line Issue
packages/opencode/src/kilocode/command-files.ts 47 scan() misses symlinked command files/dirs that the runtime loader follows
packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/KiloAgentBehaviorRpcApiImpl.kt 148 hasActiveSession log messages are skill-labeled on the new command-reload path
packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/KiloAgentBehaviorRpcApiImpl.kt 344 New-file saves restricted to .kilo/command, narrower than CLI discovery roots
Files Reviewed (19 files)
  • .changeset/commands-settings-jetbrains.md
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/cli/KiloCliDataParser.kt
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/KiloAgentBehaviorRpcApiImpl.kt - 2 issues
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/KiloWorkspaceDtoMapper.kt
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/workspace/KiloWorkspaceState.kt
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/cli/KiloCliDataParserTest.kt
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/rpc/KiloAgentBehaviorRpcApiImplTest.kt
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/testing/MockCliServer.kt
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/testing/FakeAgentBehaviorRpcApi.kt
  • packages/kilo-jetbrains/shared/src/main/kotlin/ai/kilocode/rpc/KiloAgentBehaviorRpcApi.kt
  • packages/kilo-jetbrains/shared/src/main/kotlin/ai/kilocode/rpc/dto/CommandDto.kt
  • packages/kilo-jetbrains/shared/src/main/kotlin/ai/kilocode/rpc/dto/CommandFileDto.kt
  • packages/opencode/src/kilocode/command-files.ts - 2 issues
  • packages/opencode/src/kilocode/server/httpapi/groups/kilocode.ts
  • packages/opencode/src/kilocode/server/httpapi/handlers/kilocode.ts
  • packages/opencode/test/kilocode/command-files.test.ts
  • packages/sdk/js/src/v2/gen/sdk.gen.ts
  • packages/sdk/js/src/v2/gen/types.gen.ts
  • packages/sdk/openapi.json

Fix these issues in Kilo Cloud


Reviewed by kimi-k3 · Input: 41.8K · Output: 4.4K · Cached: 244.7K

Review guidance: REVIEW.md from base branch main

@kirillk kirillk changed the title feat(cli): expose command file management endpoints feat(cli): add command file management parity with skills Aug 4, 2026
@kirillk
kirillk merged commit 978c44f into main Aug 6, 2026
32 checks passed
@kirillk
kirillk deleted the rune-polo branch August 6, 2026 15:52
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
feat(cli): add command file management parity with skills
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