Skip to content

Commit b03875d

Browse files
committed
修复测试错误
1 parent 34a3301 commit b03875d

5 files changed

Lines changed: 46 additions & 19 deletions

File tree

‎packages/codingcode/src/server/routes/settings.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ import {
2929
resetProjectHookDisabledState,
3030
} from '../../hooks/config.js';
3131
import { setHookRuntimeEnabled } from '../../hooks/executor.js';
32-
import {
33-
discoverGlobalSkillDirs,
34-
discoverProjectSkillDirs,
35-
} from '../../skills/source.js';
32+
import { discoverGlobalSkillDirs, discoverProjectSkillDirs } from '../../skills/source.js';
3633
import {
3734
getMemoryConfig,
3835
getAllTypesWithStatus,

‎packages/codingcode/src/skills/service.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ export class SkillService extends Effect.Service<SkillService>()('Skill', {
2121
}
2222

2323
return {
24-
getAll: (projectPath: string) =>
25-
Effect.sync(() => readAll(projectPath)),
24+
getAll: (projectPath: string) => Effect.sync(() => readAll(projectPath)),
2625

2726
findByName: (projectPath: string, name: string) =>
2827
Effect.sync(() => readAll(projectPath).find((s) => s.name === name)),

‎packages/codingcode/test/skills/index.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,5 +171,4 @@ Testing kebab-case name parsing.
171171
expect(matched!.name).toBe('test-basic');
172172
expect(cleanQuery).toBe('do the refactoring work');
173173
});
174-
175174
});

‎packages/desktop/src/lib/core-api.ts‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,18 @@ export function deleteMcpServer(cwd: string | undefined, name: string): Promise<
198198

199199
// ---- Settings: Skills ----
200200

201-
export function listSkills(
202-
_cwd?: string
203-
): Promise<Array<{ name: string; description: string; skillPath: string; source?: 'global' | 'project'; hasProjectOverride?: boolean }>> {
201+
export function listSkills(_cwd?: string): Promise<
202+
Array<{
203+
name: string;
204+
description: string;
205+
skillPath: string;
206+
source?: 'global' | 'project';
207+
hasProjectOverride?: boolean;
208+
}>
209+
> {
204210
return clients.settings.listSkills() as any;
205211
}
206212

207-
208213
// ---- Settings: Hooks ----
209214

210215
export function listHooks(cwd?: string): Promise<any[]> {

‎packages/desktop/src/settings/SkillPanel.tsx‎

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,49 @@ export default function SkillPanel({ global: isGlobal }: { global?: boolean }) {
2424
.finally(() => setLoading(false));
2525
}, [rootPath, isGlobal]);
2626

27-
if (loading) return <div className="px-6 py-8 text-[14px] text-[var(--text-disabled)]">加载中…</div>;
28-
if (skills.length === 0) return <div className="px-6 py-8 text-[14px] text-[var(--text-disabled)] text-center">未找到 Skill</div>;
27+
if (loading)
28+
return <div className="px-6 py-8 text-[14px] text-[var(--text-disabled)]">加载中…</div>;
29+
if (skills.length === 0)
30+
return (
31+
<div className="px-6 py-8 text-[14px] text-[var(--text-disabled)] text-center">
32+
未找到 Skill
33+
</div>
34+
);
2935

3036
return (
3137
<div className="px-6 py-5">
3238
<div className="space-y-3">
3339
{skills.map((skill) => (
34-
<div key={skill.name} className="px-4 py-3.5 rounded-xl bg-[var(--bg-card)] border border-[var(--border-card)]">
40+
<div
41+
key={skill.name}
42+
className="px-4 py-3.5 rounded-xl bg-[var(--bg-card)] border border-[var(--border-card)]"
43+
>
3544
<div className="flex items-center gap-2">
3645
<span className="text-[15px] text-[var(--text-title)] truncate">{skill.name}</span>
37-
{skill.source === 'global' && <span className="text-[11px] px-2 py-0.5 rounded bg-[var(--tag-info-bg)] text-[var(--tag-info-text)]">全局</span>}
38-
{skill.source === 'project' && <span className="text-[11px] px-2 py-0.5 rounded bg-[var(--tag-action-bg)] text-[var(--tag-action-text)]">项目</span>}
39-
{skill.hasProjectOverride && <span className="text-[11px] px-2 py-0.5 rounded bg-[var(--accent-primary)]/10 text-[var(--accent-primary)]">覆盖全局</span>}
46+
{skill.source === 'global' && (
47+
<span className="text-[11px] px-2 py-0.5 rounded bg-[var(--tag-info-bg)] text-[var(--tag-info-text)]">
48+
全局
49+
</span>
50+
)}
51+
{skill.source === 'project' && (
52+
<span className="text-[11px] px-2 py-0.5 rounded bg-[var(--tag-action-bg)] text-[var(--tag-action-text)]">
53+
项目
54+
</span>
55+
)}
56+
{skill.hasProjectOverride && (
57+
<span className="text-[11px] px-2 py-0.5 rounded bg-[var(--accent-primary)]/10 text-[var(--accent-primary)]">
58+
覆盖全局
59+
</span>
60+
)}
61+
</div>
62+
{skill.description && (
63+
<div className="text-[13px] text-[var(--text-placeholder)] mt-1">
64+
{skill.description}
65+
</div>
66+
)}
67+
<div className="text-[11px] text-[var(--text-disabled)] mt-1 truncate">
68+
{skill.skillPath}
4069
</div>
41-
{skill.description && <div className="text-[13px] text-[var(--text-placeholder)] mt-1">{skill.description}</div>}
42-
<div className="text-[11px] text-[var(--text-disabled)] mt-1 truncate">{skill.skillPath}</div>
4370
</div>
4471
))}
4572
</div>

0 commit comments

Comments
 (0)