mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
feat: 为 project 级 skill 添加黄色 [local] 标签区分显示
在斜杠命令列表和 SkillsMenu 中,对 projectSettings/localSettings 来源的 skill 显示黄色 [local] 标签,方便区分项目级和用户级技能。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -163,7 +163,11 @@ const SuggestionItemRow = memo(function SuggestionItemRow({
|
||||
<Text color={textColor} dimColor={shouldDim}>
|
||||
{paddedDisplayText}
|
||||
</Text>
|
||||
{tagText ? <Text dimColor>{tagText}</Text> : null}
|
||||
{tagText ? (
|
||||
<Text color={item.tag === 'local' ? 'yellow' : undefined} dimColor={item.tag !== 'local'}>
|
||||
{tagText}
|
||||
</Text>
|
||||
) : null}
|
||||
<Text
|
||||
color={isSelected ? 'suggestion' : undefined}
|
||||
dimColor={!isSelected}
|
||||
|
||||
@@ -139,6 +139,22 @@ export function SkillsMenu({ onExit, commands }: Props): React.ReactNode {
|
||||
)
|
||||
}
|
||||
|
||||
const getScopeTag = (
|
||||
source: SkillSource,
|
||||
): { label: string; color: string } | undefined => {
|
||||
switch (source) {
|
||||
case 'projectSettings':
|
||||
case 'localSettings':
|
||||
return { label: 'local', color: 'yellow' }
|
||||
case 'userSettings':
|
||||
return { label: 'global', color: 'cyan' }
|
||||
case 'policySettings':
|
||||
return { label: 'managed', color: 'magenta' }
|
||||
default:
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
const renderSkill = (skill: SkillCommand) => {
|
||||
const estimatedTokens = estimateSkillFrontmatterTokens(skill)
|
||||
const tokenDisplay = `~${formatTokens(estimatedTokens)}`
|
||||
@@ -146,10 +162,14 @@ export function SkillsMenu({ onExit, commands }: Props): React.ReactNode {
|
||||
skill.source === 'plugin'
|
||||
? skill.pluginInfo?.pluginManifest.name
|
||||
: undefined
|
||||
const scopeTag = getScopeTag(skill.source as SkillSource)
|
||||
|
||||
return (
|
||||
<Box key={`${skill.name}-${skill.source}`}>
|
||||
<Text>{getCommandName(skill)}</Text>
|
||||
{scopeTag && (
|
||||
<Text color={scopeTag.color}> [{scopeTag.label}]</Text>
|
||||
)}
|
||||
<Text dimColor>
|
||||
{pluginName ? ` · ${pluginName}` : ''} · {tokenDisplay} description
|
||||
tokens
|
||||
@@ -187,7 +207,9 @@ export function SkillsMenu({ onExit, commands }: Props): React.ReactNode {
|
||||
>
|
||||
<Box flexDirection="column" gap={1}>
|
||||
{renderSkillGroup('projectSettings')}
|
||||
{renderSkillGroup('localSettings')}
|
||||
{renderSkillGroup('userSettings')}
|
||||
{renderSkillGroup('flagSettings')}
|
||||
{renderSkillGroup('policySettings')}
|
||||
{renderSkillGroup('plugin')}
|
||||
{renderSkillGroup('mcp')}
|
||||
|
||||
@@ -271,6 +271,15 @@ function createCommandSuggestionItem(
|
||||
const aliasText = matchedAlias ? ` (${matchedAlias})` : ''
|
||||
|
||||
const isWorkflow = cmd.type === 'prompt' && cmd.kind === 'workflow'
|
||||
|
||||
// Show "local" tag for project-scoped prompt commands
|
||||
const scopeTag =
|
||||
cmd.type === 'prompt' &&
|
||||
!isWorkflow &&
|
||||
(cmd.source === 'projectSettings' || cmd.source === 'localSettings')
|
||||
? 'local'
|
||||
: undefined
|
||||
|
||||
const fullDescription =
|
||||
(isWorkflow ? cmd.description : formatDescriptionWithSource(cmd)) +
|
||||
(cmd.type === 'prompt' && cmd.argNames?.length
|
||||
@@ -280,7 +289,7 @@ function createCommandSuggestionItem(
|
||||
return {
|
||||
id: getCommandId(cmd),
|
||||
displayText: `/${commandName}${aliasText}`,
|
||||
tag: isWorkflow ? 'workflow' : undefined,
|
||||
tag: isWorkflow ? 'workflow' : scopeTag,
|
||||
description: fullDescription,
|
||||
metadata: cmd,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user