mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 14:25:51 +00:00
@@ -35,6 +35,7 @@ import {
|
||||
isPluginEnabledAtProjectScope,
|
||||
uninstallPluginOp,
|
||||
updatePluginOp,
|
||||
type InstallableScope,
|
||||
} from '../../services/plugins/pluginOperations.js';
|
||||
import { useAppState } from '../../state/AppState.js';
|
||||
import type { Tool } from '../../Tool.js';
|
||||
@@ -76,7 +77,7 @@ import { PluginOptionsDialog } from './PluginOptionsDialog.js';
|
||||
import { PluginOptionsFlow } from './PluginOptionsFlow.js';
|
||||
import type { ViewState as ParentViewState } from './types.js';
|
||||
import { UnifiedInstalledCell } from './UnifiedInstalledCell.js';
|
||||
import type { UnifiedInstalledItem } from './unifiedTypes.js';
|
||||
import type { UnifiedInstalledItem, UnifiedInstalledScope } from './unifiedTypes.js';
|
||||
import { usePagination } from './usePagination.js';
|
||||
|
||||
type Props = {
|
||||
@@ -103,7 +104,7 @@ type FailedPluginInfo = {
|
||||
name: string;
|
||||
marketplace: string;
|
||||
errors: PluginError[];
|
||||
scope: PersistablePluginScope;
|
||||
scope: UnifiedInstalledScope;
|
||||
};
|
||||
|
||||
type ViewState =
|
||||
@@ -1253,7 +1254,7 @@ export function ManagePlugins({
|
||||
const isEnabled = mergedSettings?.enabledPlugins?.[pluginId] !== false;
|
||||
const pluginScope = item.scope;
|
||||
const isBuiltin = pluginScope === 'builtin';
|
||||
if (isBuiltin || isInstallableScope(pluginScope)) {
|
||||
if (isBuiltin || isInstallableScope(pluginScope as PersistablePluginScope)) {
|
||||
const newPending = new Map(pendingToggles);
|
||||
// Omit scope — see handleSingleOperation's enable/disable comment.
|
||||
if (currentPending) {
|
||||
@@ -1579,8 +1580,8 @@ export function ManagePlugins({
|
||||
// is a recovery path for a plugin that failed to load — it may
|
||||
// be reinstallable, so don't nuke ${CLAUDE_PLUGIN_DATA} silently.
|
||||
// The normal uninstall path prompts; this one preserves.
|
||||
const result = isInstallableScope(pluginScope)
|
||||
? await uninstallPluginOp(pluginId, pluginScope, false)
|
||||
const result = isInstallableScope(pluginScope as PersistablePluginScope)
|
||||
? await uninstallPluginOp(pluginId, pluginScope as InstallableScope, false)
|
||||
: await uninstallPluginOp(pluginId, 'user', false);
|
||||
let success = result.success;
|
||||
if (!success) {
|
||||
|
||||
@@ -1,3 +1,37 @@
|
||||
// Auto-generated stub — replace with real implementation
|
||||
export type ViewState = any
|
||||
export type PluginSettingsProps = any
|
||||
import type { LocalJSXCommandOnDone } from 'src/types/command.js'
|
||||
|
||||
/**
|
||||
* `/plugin` 根视图在子面板之间的导航状态。
|
||||
* 各分支对应不同子界面或从 CLI 参数解析出的初始路由。
|
||||
*/
|
||||
export type ViewState =
|
||||
| { type: 'menu' } // 返回插件功能总菜单
|
||||
| { type: 'help' } // 展示帮助说明
|
||||
| { type: 'validate'; path?: string } // 校验指定路径下的插件包
|
||||
| {
|
||||
type: 'browse-marketplace' // 在指定市场中浏览/安装插件
|
||||
targetMarketplace: string // 目标市场标识
|
||||
targetPlugin?: string // 可选:预选插件名
|
||||
}
|
||||
| { type: 'discover-plugins'; targetPlugin?: string } // 发现页;可预选搜索插件名
|
||||
| {
|
||||
type: 'manage-plugins' // 已安装插件管理(启用/禁用/卸载)
|
||||
targetPlugin?: string // 可选:聚焦某插件
|
||||
targetMarketplace?: string // 可选:与 targetPlugin 联用的市场
|
||||
action?: 'uninstall' | 'enable' | 'disable' // 可选:打开时直接执行的操作
|
||||
}
|
||||
| { type: 'marketplace-list' } // 列出已配置市场
|
||||
| { type: 'marketplace-menu' } // 市场相关子菜单
|
||||
| { type: 'add-marketplace'; initialValue?: string } // 添加市场;可预填 URL/名称
|
||||
| {
|
||||
type: 'manage-marketplaces' // 管理已保存的市场源
|
||||
targetMarketplace?: string // 可选:聚焦某市场
|
||||
action?: 'remove' | 'update' // 可选:移除或刷新该市场
|
||||
}
|
||||
|
||||
/** `/plugin` Ink 命令入口的 props。 */
|
||||
export type PluginSettingsProps = {
|
||||
onComplete: LocalJSXCommandOnDone // 子流程结束回调(可带结果文案与展示方式)
|
||||
args?: string // CLI 透传的子命令参数字符串
|
||||
showMcpRedirectMessage?: boolean // 从 `/mcp` 跳转时展示 MCP 相关提示
|
||||
}
|
||||
|
||||
@@ -1,2 +1,68 @@
|
||||
// Auto-generated stub — replace with real implementation
|
||||
export type UnifiedInstalledItem = any
|
||||
import type {
|
||||
ConfigScope,
|
||||
MCPServerConnection,
|
||||
} from '../../services/mcp/types.js'
|
||||
import type { LoadedPlugin, PluginError } from '../../types/plugin.js'
|
||||
|
||||
import type { PersistablePluginScope } from '../../utils/plugins/pluginIdentifier.js'
|
||||
|
||||
/** 列表项作用域:含 MCP 的 `builtin` 与已下架插件的 `flagged`。 */
|
||||
export type UnifiedInstalledScope = ConfigScope | 'builtin' | 'flagged'
|
||||
|
||||
/** 插件管理列表中 MCP 连接行的连接状态摘要。 */
|
||||
export type McpRowStatus =
|
||||
| 'connected' // 已连接且可用
|
||||
| 'disabled' // 用户或策略禁用
|
||||
| 'pending' // 正在连接或重连
|
||||
| 'needs-auth' // 需 OAuth 等鉴权
|
||||
| 'failed' // 连接或握手失败
|
||||
|
||||
/**
|
||||
* 「已安装」统一列表中的一行:插件、失败占位、下架标记或 MCP 服务器。
|
||||
* 用于分页与键盘导航的同一数据源。
|
||||
*/
|
||||
export type UnifiedInstalledItem =
|
||||
| {
|
||||
type: 'plugin' // 正常加载的插件
|
||||
id: string // `name@marketplace` 唯一键
|
||||
name: string // 插件短名
|
||||
description: string | undefined // manifest 描述
|
||||
marketplace: string // 所属市场
|
||||
scope: PersistablePluginScope | 'builtin' // 安装/展示作用域(内置单独标)
|
||||
isEnabled: boolean // 是否在 merged settings 中启用
|
||||
errorCount: number // 与该插件关联的错误条数
|
||||
errors: PluginError[] // 结构化错误列表
|
||||
plugin: LoadedPlugin // 已解析的 manifest 与路径等
|
||||
pendingEnable?: boolean // UI:等待启用完成
|
||||
pendingUpdate?: boolean // UI:等待更新完成
|
||||
pendingToggle?: 'will-enable' | 'will-disable' // 用户已选、尚未落盘的启用切换
|
||||
}
|
||||
| {
|
||||
type: 'failed-plugin' // 未能加载的插件占位行
|
||||
id: string // 与错误 source 对齐的 id
|
||||
name: string // 展示用名称
|
||||
marketplace: string // 推断或 unknown
|
||||
scope: UnifiedInstalledScope // 推断的安装作用域
|
||||
errorCount: number
|
||||
errors: PluginError[]
|
||||
}
|
||||
| {
|
||||
type: 'flagged-plugin' // 市场已下架但仍出现在设置中的插件
|
||||
id: string
|
||||
name: string
|
||||
marketplace: string
|
||||
scope: 'flagged' // 固定为下架分组
|
||||
reason: string // 下架原因码(如 delisted)
|
||||
text: string // 面向用户的说明文案
|
||||
flaggedAt: string // 标记时间(ISO 等)
|
||||
}
|
||||
| {
|
||||
type: 'mcp' // 独立 MCP 或插件子 MCP 行
|
||||
id: string // 列表稳定 id(如 mcp:name)
|
||||
name: string // 展示名(子 MCP 可为 server 段)
|
||||
description: string | undefined // 可选副标题
|
||||
scope: UnifiedInstalledScope // 来自 server config 或父插件推导
|
||||
status: McpRowStatus // 连接态摘要
|
||||
client: MCPServerConnection // 底层连接对象(供详情/工具视图)
|
||||
indented?: boolean // true 表示挂在某插件下的子 MCP
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user