Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

feat(desktop): localize built-in skill creator description

xd-bobo321588758434
diff --git a/apps/desktop/src/renderer/components/chat/SystemCard.tsx b/apps/desktop/src/renderer/components/chat/SystemCard.tsx
index 573beeb79a..1b1bd7e742 100644
--- a/apps/desktop/src/renderer/components/chat/SystemCard.tsx
+++ b/apps/desktop/src/renderer/components/chat/SystemCard.tsx
@@ -44,6 +44,7 @@ import {
} from './activityRowChrome';
import { MarkdownRenderer } from './MarkdownRenderer';
import { CindyMakeDoctorCard } from './CindyMakeDoctorCard';
+import { builtInSkillDescriptionKey } from '@/features/skillhub/lib/builtInSkillPresentation';
interface SystemCardProps {
cardType:
@@ -104,6 +105,7 @@ const codeClass = cn(
);
function HelpCard({ data }: { data?: Record<string, unknown> }) {
+ const { t } = useTranslation();
const commands =
(data?.commands as Array<{ name: string; description?: string; source: string }>) ?? [];
const desktopCmds = commands.filter((c) => c.source === 'desktop');
@@ -117,7 +119,11 @@ function HelpCard({ data }: { data?: Record<string, unknown> }) {
{items.map((c) => (
<div key={c.name} className={rowClass}>
<span className={codeClass}>/{c.name}</span>
- <span className={descClass}>{c.description ?? ''}</span>
+ <span className={descClass}>
+ {builtInSkillDescriptionKey(c)
+ ? t('skillhub.builtIn.skillCreator.description')
+ : c.description ?? ''}
+ </span>
</div>
))}
</div>
diff --git a/apps/desktop/src/renderer/components/new-chat/SlashCommandPalette.tsx b/apps/desktop/src/renderer/components/new-chat/SlashCommandPalette.tsx
index 76bc1a5bdc..2c1860c257 100644
--- a/apps/desktop/src/renderer/components/new-chat/SlashCommandPalette.tsx
+++ b/apps/desktop/src/renderer/components/new-chat/SlashCommandPalette.tsx
@@ -25,6 +25,7 @@ import {
isSlashCommandUnavailable,
type UnifiedCommand,
} from '@/lib/slashCommands';
+import { builtInSkillDescriptionKey } from '@/features/skillhub/lib/builtInSkillPresentation';
const TOOLTIP_W = 280;
const TOOLTIP_GAP = 8;
@@ -126,8 +127,14 @@ export function SlashCommandPalette({
}, [focusedIndex]);
const focusedCmd = filtered[focusedIndex];
+ const focusedDescriptionKey = focusedCmd?.kind === 'agent-skill'
+ ? builtInSkillDescriptionKey(focusedCmd)
+ : undefined;
+ const focusedDescription = focusedDescriptionKey
+ ? t(focusedDescriptionKey)
+ : focusedCmd?.description;
const tooltipKey = focusedCmd
- ? `${focusedCmd.kind}:${focusedCmd.name}:${focusedCmd.description ?? ''}`
+ ? `${focusedCmd.kind}:${focusedCmd.name}:${focusedDescription ?? ''}`
: null;
const tooltipHeight = tooltipMeasure.key === tooltipKey
? tooltipMeasure.height
@@ -322,7 +329,7 @@ export function SlashCommandPalette({
<div className="mt-[8px] text-13 leading-[1.5] text-[var(--cmd-palette-tooltip-body)]">
{isSlashCommandUnavailable(focusedCmd)
? t('commandPalette.projectSkillNotLoaded')
- : focusedCmd.description}
+ : focusedDescription}
</div>
</div>,
document.body,
diff --git a/apps/desktop/src/renderer/components/new-chat/__tests__/SlashCommandPalette.test.tsx b/apps/desktop/src/renderer/components/new-chat/__tests__/SlashCommandPalette.test.tsx
index 750cb7eaaf..32322f743d 100644
--- a/apps/desktop/src/renderer/components/new-chat/__tests__/SlashCommandPalette.test.tsx
+++ b/apps/desktop/src/renderer/components/new-chat/__tests__/SlashCommandPalette.test.tsx
@@ -149,4 +149,52 @@ describe('SlashCommandPalette project Skill rows', () => {
expect(onSelect).toHaveBeenCalledWith(loaded);
});
+
+ it('localizes the built-in Skill Creator description in the input palette', () => {
+ const skillCreator: UnifiedCommand = {
+ kind: 'agent-skill',
+ name: 'skill-creator',
+ description: 'Create or update a Cindy Skill',
+ source: 'skill',
+ scope: 'user',
+ };
+
+ render(
+ <SlashCommandPalette
+ query=""
+ commands={[skillCreator]}
+ focusedIndex={0}
+ onFocusedIndexChange={vi.fn()}
+ onSelect={vi.fn()}
+ onClose={vi.fn()}
+ />,
+ );
+
+ expect(screen.getByText('skillhub.builtIn.skillCreator.description')).toBeTruthy();
+ expect(screen.queryByText(skillCreator.description!)).toBeNull();
+ });
+
+ it('keeps a user-owned Skill Creator description unchanged', () => {
+ const userSkillCreator: UnifiedCommand = {
+ kind: 'agent-skill',
+ name: 'skill-creator',
+ description: 'Create Skills for my private workflow',
+ source: 'skill',
+ scope: 'user',
+ };
+
+ render(
+ <SlashCommandPalette
+ query=""
+ commands={[userSkillCreator]}
+ focusedIndex={0}
+ onFocusedIndexChange={vi.fn()}
+ onSelect={vi.fn()}
+ onClose={vi.fn()}
+ />,
+ );
+
+ expect(screen.getByText(userSkillCreator.description!)).toBeTruthy();
+ expect(screen.queryByText('skillhub.builtIn.skillCreator.description')).toBeNull();
+ });
});
diff --git a/apps/desktop/src/renderer/features/skillhub/SkillhubDetailView.tsx b/apps/desktop/src/renderer/features/skillhub/SkillhubDetailView.tsx
index f234ba4190..a446680bc3 100644
--- a/apps/desktop/src/renderer/features/skillhub/SkillhubDetailView.tsx
+++ b/apps/desktop/src/renderer/features/skillhub/SkillhubDetailView.tsx
@@ -53,6 +53,7 @@ import {
findLocalSkillByPath,
findLocalSkillRouteEntry,
} from './lib/localRoutes';
+import { builtInSkillDescriptionKey } from './lib/builtInSkillPresentation';
import { isMarketDeleted as checkMarketDeleted, getCachedInfo, invalidate as invalidateInfo, refreshInfo } from './lib/infoDedupe';
import {
activePublishedReviewFromVersions,
@@ -227,16 +228,22 @@ function FrontmatterPanel({ entry }: { entry: SkillhubSkill }) {
// description gets the clamp-with-show-more treatment; every
// other field is rendered inline since they're short enough
// (name, version, category, ...).
- const isLongTextField = k === 'description' && typeof v === 'string';
+ const descriptionKey = k === 'description'
+ ? builtInSkillDescriptionKey(entry)
+ : undefined;
+ const displayValue = descriptionKey ? t(descriptionKey) : v;
+ const isLongTextField = k === 'description' && typeof displayValue === 'string';
return (
<div key={k} className="flex flex-col gap-1">
<dt className="text-xs text-[var(--cmd-palette-item-meta)]">{k}</dt>
<dd>
{isLongTextField ? (
- <ClampedText value={v as string} />
+ <ClampedText value={displayValue as string} />
) : (
<span className="whitespace-pre-wrap break-words text-sm text-[var(--msg-assistant-text)]">
- {typeof v === 'string' ? v : JSON.stringify(v)}
+ {typeof displayValue === 'string'
+ ? displayValue
+ : JSON.stringify(displayValue)}
</span>
)}
</dd>
diff --git a/apps/desktop/src/renderer/features/skillhub/SkillhubHomeView.tsx b/apps/desktop/src/renderer/features/skillhub/SkillhubHomeView.tsx
index f99ee8fdc3..347d886e84 100644
--- a/apps/desktop/src/renderer/features/skillhub/SkillhubHomeView.tsx
+++ b/apps/desktop/src/renderer/features/skillhub/SkillhubHomeView.tsx
@@ -29,6 +29,7 @@ import {
PluginManagementPage,
} from '@/features/plugin/PluginManagementLayout';
import { buildLocalSkillRoute, findLocalSkillByPath } from './lib/localRoutes';
+import { builtInSkillDescriptionKey } from './lib/builtInSkillPresentation';
import { refresh as refreshSkillhub, useSkillhub } from './hooks/useSkillhub';
import {
MARKET_PAGE_SIZE,
@@ -52,7 +53,6 @@ import { InstallTargetPicker, type InstallTargetSkill } from './components/Insta
import { SkillCategoryFilterBar } from './components/SkillCategoryFilterBar';
import { HomeMarketCard } from './components/HomeMarketCard';
import { SkillIcon } from './components/SkillIcon';
-import { SkillTagList } from './components/SkillTagList';
import { SkillhubMarketPreviewPanel } from './SkillhubMarketPreviewPanel';
import { useSkillhubIdentityPolicy } from './hooks/useSkillhubIdentityPolicy';
@@ -143,14 +143,19 @@ export function SkillhubHomeView({
const globalSkills = useMemo(
() =>
skills.filter(
- (skill) =>
- skill.scope === 'global' &&
- includesSkillQuery(
- [skill.name, skill.description, skill.kind, skill.engine],
- normalizedQuery,
- ),
+ (skill) => {
+ const descriptionKey = builtInSkillDescriptionKey(skill);
+ const displayDescription = descriptionKey ? t(descriptionKey) : skill.description;
+ return (
+ skill.scope === 'global' &&
+ includesSkillQuery(
+ [skill.name, displayDescription, skill.description, skill.kind, skill.engine],
+ normalizedQuery,
+ )
+ );
+ },
),
- [normalizedQuery, skills],
+ [normalizedQuery, skills, t],
);
const projectGroups = useMemo(() => {
const byRoot = new Map<string, SkillhubSkill[]>();
@@ -167,16 +172,18 @@ export function SkillhubHomeView({
return {
root,
label,
- skills: list.filter((skill) =>
- includesSkillQuery(
- [skill.name, skill.description, skill.kind, skill.engine, label],
+ skills: list.filter((skill) => {
+ const descriptionKey = builtInSkillDescriptionKey(skill);
+ const displayDescription = descriptionKey ? t(descriptionKey) : skill.description;
+ return includesSkillQuery(
+ [skill.name, displayDescription, skill.description, skill.kind, skill.engine, label],
normalizedQuery,
- ),
- ),
+ );
+ }),
};
})
.filter((group) => group.skills.length > 0);
- }, [normalizedQuery, skills, projects]);
+ }, [normalizedQuery, skills, projects, t]);
const visibleLocalCount = useMemo(
() =>
globalSkills.length + projectGroups.reduce((count, group) => count + group.skills.length, 0),
@@ -559,6 +566,8 @@ function LocalGroup({
<div className={cn('plugin-motion-stagger', PLUGIN_MANAGEMENT_CARD_GRID_CLASS)}>
{skills.map((s) => {
const Icon = KIND_ICON[s.kind] ?? Package;
+ const descriptionKey = builtInSkillDescriptionKey(s);
+ const displayDescription = descriptionKey ? t(descriptionKey) : s.description;
// 来源:'skillhub' = 从市场安装的副本(填充徽标);'local' = 自己开发/发布、
// 没走 SkillHub 安装的本地副本(弱化文字,不与 SkillHub 抢视觉)。
// origin 缺失的历史 registry 靠 server isMine 兜底判定(见 deriveSkillSource)。
@@ -603,9 +612,9 @@ function LocalGroup({
: t('skillhub.home.sourceLocal')}
</span>
</span>
- {s.description && (
+ {displayDescription && (
<span className="line-clamp-1 text-12 leading-4 text-[var(--text-secondary)]">
- {s.description}
+ {displayDescription}
</span>
)}
</span>
diff --git a/apps/desktop/src/renderer/features/skillhub/lib/builtInSkillPresentation.ts b/apps/desktop/src/renderer/features/skillhub/lib/builtInSkillPresentation.ts
new file mode 100644
index 0000000000..c399d477d8
--- /dev/null
+++ b/apps/desktop/src/renderer/features/skillhub/lib/builtInSkillPresentation.ts
@@ -0,0 +1,29 @@
+const SKILL_CREATOR_NAME = 'skill-creator';
+const SKILL_CREATOR_SOURCE_DESCRIPTIONS = new Set([
+ 'Create or update a Cindy Skill',
+ 'Create or update a skill',
+ 'Create or update a Cindy Skill with appropriately scoped instructions and any needed supporting resources.',
+]);
+
+export const SKILL_CREATOR_DESCRIPTION_KEY = 'skillhub.builtIn.skillCreator.description' as const;
+
+/**
+ * Built-in Skills keep their canonical metadata in English for agents. Cindy
+ * substitutes localized copy only when it renders a known built-in entry.
+ */
+export function builtInSkillDescriptionKey(
+ skill: {
+ builtIn?: boolean;
+ name: string;
+ description?: string;
+ scope?: string;
+ },
+): typeof SKILL_CREATOR_DESCRIPTION_KEY | undefined {
+ if (skill.name !== SKILL_CREATOR_NAME) return undefined;
+ if (skill.builtIn === true || skill.scope === 'system') {
+ return SKILL_CREATOR_DESCRIPTION_KEY;
+ }
+ return skill.description && SKILL_CREATOR_SOURCE_DESCRIPTIONS.has(skill.description.trim())
+ ? SKILL_CREATOR_DESCRIPTION_KEY
+ : undefined;
+}
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 978d8f8495..fc8c7342e6 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -11134,6 +11134,11 @@
"importSuccess": "{{name}} imported{{suffix}}",
"importFailed": "Failed to import skill"
},
+ "builtIn": {
+ "skillCreator": {
+ "description": "Create or update a Cindy Skill with clear instructions and supporting resources."
+ }
+ },
"common": {
"openFolderFailed": "Failed to open folder",
"close": "Close",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index a65a1c7d11..2dff33e382 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -11118,6 +11118,11 @@
"importSuccess": "{{name}} をインポートしました{{suffix}}",
"importFailed": "スキルのインポートに失敗しました"
},
+ "builtIn": {
+ "skillCreator": {
+ "description": "明確な手順と必要な補助リソースを備えた Cindy スキルを作成または更新します。"
+ }
+ },
"common": {
"openFolderFailed": "フォルダを開けませんでした",
"close": "閉じる",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 7ed9735742..0b45455360 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -11118,6 +11118,11 @@
"importSuccess": "{{name}} 가져오기 완료{{suffix}}",
"importFailed": "스킬 가져오기 실패"
},
+ "builtIn": {
+ "skillCreator": {
+ "description": "명확한 지침과 필요한 지원 리소스를 갖춘 Cindy 스킬을 만들거나 업데이트합니다."
+ }
+ },
"common": {
"openFolderFailed": "폴더 열기 실패",
"close": "닫기",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index 181a2715d2..e34d509cce 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -11118,6 +11118,11 @@
"importSuccess": "{{name}} 已导入{{suffix}}",
"importFailed": "导入技能失败"
},
+ "builtIn": {
+ "skillCreator": {
+ "description": "创建或更新 Cindy 技能,并编写清晰的说明和所需支持资源。"
+ }
+ },
"common": {
"openFolderFailed": "打开文件夹失败",
"close": "关闭",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index 6a0622ec1f..2a8d08443b 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -11118,6 +11118,11 @@
"importSuccess": "{{name}} 已匯入{{suffix}}",
"importFailed": "匯入技能失敗"
},
+ "builtIn": {
+ "skillCreator": {
+ "description": "建立或更新 Cindy 技能,並編寫清楚的說明與所需支援資源。"
+ }
+ },
"common": {
"openFolderFailed": "開啟資料夾失敗",
"close": "關閉",