feat: support plugin slash commands#1204
Conversation
🦋 Changeset detectedLatest commit: 090d64e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0b3c62e66
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| return entries | ||
| .filter((entry) => entry.isFile() && entry.name.endsWith('.md')) | ||
| .map((entry) => path.join(dir, entry.name)) |
There was a problem hiding this comment.
Recurse into nested plugin command directories
When a plugin declares commands: "./commands", this only registers .md files that are direct children of that directory. Claude-style command trees support subdirectories for namespaced commands (for example commands/frontend/component.md), so those valid plugin commands are silently omitted from autocomplete and cannot be invoked. Please walk the directory recursively and preserve the relative path namespace when building command names.
Useful? React with 👍 / 👎.
Related Issue
No related issue. This is a follow-up to the plugin-hooks work: it lets plugins contribute slash commands, which is one of the pieces needed to run Claude-Code-style plugins (for example
vercel/vercel-plugin) in Kimi Code.Problem
Plugins can already provide skills, hooks, and MCP servers, but they cannot provide slash commands. A Claude-Code-style plugin that ships a
commands/directory (for example/vercel-plugin:deploy) has no way to register those commands in Kimi Code, so users cannot invoke them.What changed
commandsfield inkimi.plugin.json(a path or list of paths to.mdfiles or a directory of.mdfiles, scoped to the plugin root).name,description) plus a markdown body used as the prompt template.namefalls back to the file name;descriptionfalls back to the first body line.<plugin>:<command>and show up in the/autocomplete. Invoking one activates it server-side (mirroring skill activation): the agent receives the body with$ARGUMENTSexpanded (appending them when the body has no placeholder), while the TUI renders a compact▶ /plugin:commandcard rather than expanding the body into the chat.commandCount.This mirrors the existing plugin skills flow end to end (manifest → manager → session → RPC → SDK → TUI) and reuses the skill frontmatter parser.
Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.Plugin-author documentation for the new
commandsfield is not included yet and can follow in a separate docs PR.