Skip to content

Commit 3eac643

Browse files
njb90claude
andcommitted
style: fix quote style and formatting in new install functions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent dc96cf2 commit 3eac643

1 file changed

Lines changed: 59 additions & 35 deletions

File tree

src/aiToolsService.ts

Lines changed: 59 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export type SkillInfo = {
1717
dirName: string;
1818
};
1919

20-
export type PlatformId = 'universal' | 'claude-code' | 'vscode-copilot' | 'windsurf';
20+
export type PlatformId = "universal" | "claude-code" | "vscode-copilot" | "windsurf";
2121

2222
export type PlatformDef = {
2323
id: PlatformId;
@@ -26,10 +26,10 @@ export type PlatformDef = {
2626
};
2727

2828
export const PLATFORMS: PlatformDef[] = [
29-
{ id: 'universal', label: 'Universal', sublabel: 'Cursor, Codex, Amp, Warp + more' },
30-
{ id: 'claude-code', label: 'Claude Code' },
31-
{ id: 'vscode-copilot', label: 'VS Code (Copilot)' },
32-
{ id: 'windsurf', label: 'Windsurf' },
29+
{ id: "universal", label: "Universal", sublabel: "Cursor, Codex, Amp, Warp + more" },
30+
{ id: "claude-code", label: "Claude Code" },
31+
{ id: "vscode-copilot", label: "VS Code (Copilot)" },
32+
{ id: "windsurf", label: "Windsurf" },
3333
];
3434

3535
type GitHubEntry = {
@@ -70,10 +70,10 @@ export function getMcpFilePath(editor: EditorType): string {
7070

7171
export function detectEditorPlatform(): PlatformId {
7272
const editor = detectEditor();
73-
if (editor === 'windsurf') { return 'windsurf'; }
74-
if (editor === 'vscode') { return 'vscode-copilot'; }
75-
if (editor === 'cursor' || editor === 'antigravity') { return 'universal'; }
76-
return 'claude-code'; // claude-code, unknown
73+
if (editor === "windsurf") { return "windsurf"; }
74+
if (editor === "vscode") { return "vscode-copilot"; }
75+
if (editor === "cursor" || editor === "antigravity") { return "universal"; }
76+
return "claude-code"; // claude-code, unknown
7777
}
7878

7979
// ── GitHub API helpers ────────────────────────────────────────────────────────
@@ -325,22 +325,34 @@ export async function installForUniversal(
325325
createdFiles: string[],
326326
errors: string[]
327327
): Promise<void> {
328-
const skillFile = vscode.Uri.joinPath(rootUri, `.agents/skills/${skillName}/SKILL.md`);
329-
const written = await writeWithOverwriteCheck(skillFile, skillContent, `${skillName}/SKILL.md`);
328+
const skillFile = vscode.Uri.joinPath(
329+
rootUri, `.agents/skills/${skillName}/SKILL.md`
330+
);
331+
const written = await writeWithOverwriteCheck(
332+
skillFile, skillContent, `${skillName}/SKILL.md`
333+
);
330334
if (!written) { return; }
331335
createdFiles.push(`.agents/skills/${skillName}/SKILL.md`);
332336

333337
let refs: Array<{ name: string; content: string }>;
334-
try { refs = await fetchReferenceFiles(skillName); } catch (err: any) {
335-
errors.push(`${skillName} references: ${err.message}`); return;
338+
try {
339+
refs = await fetchReferenceFiles(skillName);
340+
} catch (err: any) {
341+
errors.push(`${skillName} references: ${err.message}`);
342+
return;
336343
}
344+
337345
for (const ref of refs) {
338346
try {
339-
const refUri = vscode.Uri.joinPath(rootUri, `.agents/skills/${skillName}/references/${ref.name}`);
340-
await ensureDir(vscode.Uri.joinPath(refUri, '..'));
341-
await vscode.workspace.fs.writeFile(refUri, Buffer.from(ref.content, 'utf-8'));
347+
const refUri = vscode.Uri.joinPath(
348+
rootUri, `.agents/skills/${skillName}/references/${ref.name}`
349+
);
350+
await ensureDir(vscode.Uri.joinPath(refUri, ".."));
351+
await vscode.workspace.fs.writeFile(refUri, Buffer.from(ref.content, "utf-8"));
342352
createdFiles.push(`.agents/skills/${skillName}/references/${ref.name}`);
343-
} catch (err: any) { errors.push(`${skillName}/references/${ref.name}: ${err.message}`); }
353+
} catch (err: any) {
354+
errors.push(`${skillName}/references/${ref.name}: ${err.message}`);
355+
}
344356
}
345357
}
346358

@@ -351,22 +363,34 @@ export async function installForWindsurf(
351363
createdFiles: string[],
352364
errors: string[]
353365
): Promise<void> {
354-
const skillFile = vscode.Uri.joinPath(rootUri, `.windsurf/skills/${skillName}/SKILL.md`);
355-
const written = await writeWithOverwriteCheck(skillFile, skillContent, `${skillName}/SKILL.md`);
366+
const skillFile = vscode.Uri.joinPath(
367+
rootUri, `.windsurf/skills/${skillName}/SKILL.md`
368+
);
369+
const written = await writeWithOverwriteCheck(
370+
skillFile, skillContent, `${skillName}/SKILL.md`
371+
);
356372
if (!written) { return; }
357373
createdFiles.push(`.windsurf/skills/${skillName}/SKILL.md`);
358374

359375
let refs: Array<{ name: string; content: string }>;
360-
try { refs = await fetchReferenceFiles(skillName); } catch (err: any) {
361-
errors.push(`${skillName} references: ${err.message}`); return;
376+
try {
377+
refs = await fetchReferenceFiles(skillName);
378+
} catch (err: any) {
379+
errors.push(`${skillName} references: ${err.message}`);
380+
return;
362381
}
382+
363383
for (const ref of refs) {
364384
try {
365-
const refUri = vscode.Uri.joinPath(rootUri, `.windsurf/skills/${skillName}/references/${ref.name}`);
366-
await ensureDir(vscode.Uri.joinPath(refUri, '..'));
367-
await vscode.workspace.fs.writeFile(refUri, Buffer.from(ref.content, 'utf-8'));
385+
const refUri = vscode.Uri.joinPath(
386+
rootUri, `.windsurf/skills/${skillName}/references/${ref.name}`
387+
);
388+
await ensureDir(vscode.Uri.joinPath(refUri, ".."));
389+
await vscode.workspace.fs.writeFile(refUri, Buffer.from(ref.content, "utf-8"));
368390
createdFiles.push(`.windsurf/skills/${skillName}/references/${ref.name}`);
369-
} catch (err: any) { errors.push(`${skillName}/references/${ref.name}: ${err.message}`); }
391+
} catch (err: any) {
392+
errors.push(`${skillName}/references/${ref.name}: ${err.message}`);
393+
}
370394
}
371395
}
372396

@@ -379,11 +403,11 @@ export async function readInstalledSkillDirNames(
379403
): Promise<Set<string>> {
380404
const installed = new Set<string>();
381405

382-
if (platform === 'vscode-copilot') {
406+
if (platform === "vscode-copilot") {
383407
try {
384-
const uri = vscode.Uri.joinPath(rootUri, '.github/copilot-instructions.md');
408+
const uri = vscode.Uri.joinPath(rootUri, ".github/copilot-instructions.md");
385409
const bytes = await vscode.workspace.fs.readFile(uri);
386-
const content = Buffer.from(bytes).toString('utf-8');
410+
const content = Buffer.from(bytes).toString("utf-8");
387411
for (const skill of skills) {
388412
if (content.includes(`## ${skill.name}`)) {
389413
installed.add(skill.dirName);
@@ -396,9 +420,9 @@ export async function readInstalledSkillDirNames(
396420
}
397421

398422
const pathPrefix =
399-
platform === 'claude-code' ? '.claude/skills' :
400-
platform === 'universal' ? '.agents/skills' :
401-
/* windsurf */ '.windsurf/skills';
423+
platform === "claude-code" ? ".claude/skills" :
424+
platform === "universal" ? ".agents/skills" :
425+
/* windsurf */ ".windsurf/skills";
402426

403427
await Promise.all(
404428
skills.map(async (skill) => {
@@ -417,10 +441,10 @@ export async function readInstalledSkillDirNames(
417441

418442
export async function detectActivePlatforms(rootUri: vscode.Uri): Promise<PlatformId[]> {
419443
const checks: Array<{ id: PlatformId; path: string }> = [
420-
{ id: 'universal', path: '.agents/skills' },
421-
{ id: 'claude-code', path: '.claude/skills' },
422-
{ id: 'vscode-copilot', path: '.github/copilot-instructions.md' },
423-
{ id: 'windsurf', path: '.windsurf/skills' },
444+
{ id: "universal", path: ".agents/skills" },
445+
{ id: "claude-code", path: ".claude/skills" },
446+
{ id: "vscode-copilot", path: ".github/copilot-instructions.md" },
447+
{ id: "windsurf", path: ".windsurf/skills" },
424448
];
425449
const active = new Set<PlatformId>([detectEditorPlatform()]);
426450
await Promise.all(

0 commit comments

Comments
 (0)