feat(cli): support slash commands from installed plugins#155
Open
Fdcode6 wants to merge 5 commits intotiann:mainfrom
Open
feat(cli): support slash commands from installed plugins#155Fdcode6 wants to merge 5 commits intotiann:mainfrom
Fdcode6 wants to merge 5 commits intotiann:mainfrom
Conversation
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' | ||
| ) |
There was a problem hiding this comment.
[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
}There was a problem hiding this comment.
Findings
- [Major] Web SlashCommand type missing
pluginvariant; new filter compares againstpluginand will fail TS strict unless the union is updated. Evidenceweb/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
This fixes the typecheck error identified by the PR review bot.
Owner
|
@tiann review again |
|
Review again — findings.
Question: actual HAPI Bot |
- 使用 lastIndexOf('@') 替代 split('@')[0] 以正确解析带 scope 的插件名
- 按 lastUpdated 降序排序选择最新的安装实例
- 增加 installations 空数组边界检查
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.