Skip to content

feat: support plugin slash commands#1204

Open
wbxl2000 wants to merge 8 commits into
mainfrom
feat/plugin-commands
Open

feat: support plugin slash commands#1204
wbxl2000 wants to merge 8 commits into
mainfrom
feat/plugin-commands

Conversation

@wbxl2000

@wbxl2000 wbxl2000 commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

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

  • Plugins can now declare a commands field in kimi.plugin.json (a path or list of paths to .md files or a directory of .md files, scoped to the plugin root).
  • Each command file is parsed for frontmatter (name, description) plus a markdown body used as the prompt template. name falls back to the file name; description falls back to the first body line.
  • Commands are registered as <plugin>:<command> and show up in the / autocomplete. Invoking one activates it server-side (mirroring skill activation): the agent receives the body with $ARGUMENTS expanded (appending them when the body has no placeholder), while the TUI renders a compact ▶ /plugin:command card rather than expanding the body into the chat.
  • The plugin summary now carries a commandCount.

This mirrors the existing plugin skills flow end to end (manifest → manager → session → RPC → SDK → TUI) and reuses the skill frontmatter parser.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Plugin-author documentation for the new commands field is not included yet and can follow in a separate docs PR.

@changeset-bot

changeset-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 090d64e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Minor

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

@pkg-pr-new

pkg-pr-new Bot commented Jun 29, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@090d64e
npx https://pkg.pr.new/@moonshot-ai/kimi-code@090d64e

commit: 090d64e

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +362 to +364
return entries
.filter((entry) => entry.isFile() && entry.name.endsWith('.md'))
.map((entry) => path.join(dir, entry.name))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

1 participant