feat(skill): add skill file browsing capability

- Add API endpoints for listing/reading/writing skill files
- Add FileTree component in SkillForm for directory browsing
- Users can now view scripts/, references/, assets/ directories
- Files can be selected and edited in the instructions textarea
- Add translations for new file browsing features

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
huanghuoguoguo
2026-05-13 21:26:03 +08:00
parent 892556da2a
commit 77a85c5c23
5 changed files with 279 additions and 18 deletions
+46
View File
@@ -1272,6 +1272,52 @@ export class BackendClient extends BaseHttpClient {
}> {
return this.get('/api/v1/skills/scan', { path });
}
public listSkillFiles(
skillName: string,
path: string = '.',
includeHidden: boolean = false,
): Promise<{
skill: { name: string };
base_path: string;
entries: Array<{
path: string;
name: string;
is_dir: boolean;
size: number | null;
}>;
truncated: boolean;
}> {
return this.get(`/api/v1/skills/${skillName}/files`, {
path,
include_hidden: includeHidden,
});
}
public readSkillFile(
skillName: string,
filePath: string,
): Promise<{
skill: { name: string };
path: string;
content: string;
}> {
return this.get(`/api/v1/skills/${skillName}/files/${filePath}`);
}
public writeSkillFile(
skillName: string,
filePath: string,
content: string,
): Promise<{
skill: { name: string };
path: string;
bytes_written: number;
}> {
return this.put(`/api/v1/skills/${skillName}/files/${filePath}`, {
content,
});
}
}
export interface SurveyQuestion {