Skip to content

feat(cli): support slash commands from installed plugins#155

Open
Fdcode6 wants to merge 5 commits intotiann:mainfrom
Fdcode6:main
Open

feat(cli): support slash commands from installed plugins#155
Fdcode6 wants to merge 5 commits intotiann:mainfrom
Fdcode6:main

Conversation

@Fdcode6
Copy link

@Fdcode6 Fdcode6 commented Feb 3, 2026

This PR adds support for slash commands provided by installed plugins (e.g. Claude plugins). It automatically scans the ~/.claude/plugins/installed_plugins.json file, registers commands with their plugin namespace prefix, and ensures the web UI correctly renders them. Verified working with the superpowers plugin.

Allows HAPI to automatically scan and load slash commands from installed Claude plugins (e.g. superpowers). Commands are indexed with their plugin namespace prefix.
return [...builtin, ...userCommands]
const extraCommands = query.data.commands.filter(
cmd => cmd.source === 'user' || cmd.source === 'plugin'
)
Copy link

Choose a reason for hiding this comment

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

[MAJOR] Type union missing plugin

Why this is a problem: cmd.source === 'plugin' now relies on a source variant that is not in SlashCommand.source, which makes this condition invalid under TS strict and will fail typecheck.

Suggested fix:

export type SlashCommand = {
    name: string
    description?: string
    source: 'builtin' | 'user' | 'plugin'
    content?: string  // Expanded content for Codex user prompts
    pluginName?: string
}

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Findings

  • [Major] Web SlashCommand type missing plugin variant; new filter compares against plugin and will fail TS strict unless the union is updated. Evidence web/src/hooks/queries/useSlashCommands.ts:90, web/src/types/api.ts:138.
    Suggested fix:
    export type SlashCommand = {
        name: string
        description?: string
        source: 'builtin' | 'user' | 'plugin'
        content?: string  // Expanded content for Codex user prompts
        pluginName?: string
    }

Summary

  • 1 major issue; type mismatch in web API types

Testing

  • Not run (automation); suggest bun typecheck

@tiann
Copy link
Owner

tiann commented Feb 3, 2026

@tiann review again

@github-actions
Copy link

github-actions bot commented Feb 3, 2026

Review again — findings.

  • Scoped plugin name bug risk: pluginKey.split('@')[0] drops leading scope (@org/plugin@marketplace => empty), producing :command and "undefined command" description. Prefer last @ split or handle leading @. cli/src/modules/common/slashCommands.ts:195-203, cli/src/modules/common/slashCommands.ts:121-141
  • Multiple installs ignored: installations[0] picked without scope/recency selection; could point at stale install. Consider choosing by scope or newest lastUpdated. cli/src/modules/common/slashCommands.ts:194-203

Question: actual installed_plugins.json key format for plugin names? If scoped, need adjust parsing.


HAPI Bot

Fdcode6 and others added 2 commits February 4, 2026 00:18
- 使用 lastIndexOf('@') 替代 split('@')[0] 以正确解析带 scope 的插件名
- 按 lastUpdated 降序排序选择最新的安装实例
- 增加 installations 空数组边界检查
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