mirror of
https://github.com/supabase/agent-skills.git
synced 2026-03-27 10:09:26 +08:00
Revert "fix: remove CLAUDE.md symlink generation from build"
This reverts commit c07c234601.
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import {
|
||||
existsSync,
|
||||
lstatSync,
|
||||
readdirSync,
|
||||
readFileSync,
|
||||
statSync,
|
||||
symlinkSync,
|
||||
unlinkSync,
|
||||
writeFileSync,
|
||||
} from "node:fs";
|
||||
import { basename, join } from "node:path";
|
||||
@@ -243,6 +246,25 @@ function skillNameToTitle(skillName: string): string {
|
||||
.join(" ");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create CLAUDE.md symlink pointing to AGENTS.md
|
||||
*/
|
||||
function createClaudeSymlink(paths: SkillPaths): void {
|
||||
const symlinkPath = paths.claudeSymlink;
|
||||
|
||||
// Remove existing symlink or file if it exists
|
||||
if (existsSync(symlinkPath)) {
|
||||
const stat = lstatSync(symlinkPath);
|
||||
if (stat.isSymbolicLink() || stat.isFile()) {
|
||||
unlinkSync(symlinkPath);
|
||||
}
|
||||
}
|
||||
|
||||
// Create symlink (relative path so it works across environments)
|
||||
symlinkSync("AGENTS.md", symlinkPath);
|
||||
console.log(` Created symlink: CLAUDE.md -> AGENTS.md`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build AGENTS.md for a specific skill
|
||||
*
|
||||
@@ -271,6 +293,7 @@ function buildSkill(paths: SkillPaths): void {
|
||||
|
||||
// Header
|
||||
output.push(`# ${paths.name}\n`);
|
||||
output.push(`> **Note:** \`CLAUDE.md\` is a symlink to this file.\n`);
|
||||
|
||||
// Brief description
|
||||
output.push(`## Overview\n`);
|
||||
@@ -282,6 +305,7 @@ function buildSkill(paths: SkillPaths): void {
|
||||
output.push(`${paths.name}/`);
|
||||
output.push(` SKILL.md # Main skill file - read this first`);
|
||||
output.push(` AGENTS.md # This navigation guide`);
|
||||
output.push(` CLAUDE.md # Symlink to AGENTS.md`);
|
||||
if (existsSync(paths.referencesDir)) {
|
||||
output.push(` references/ # Detailed reference files`);
|
||||
}
|
||||
@@ -347,6 +371,9 @@ function buildSkill(paths: SkillPaths): void {
|
||||
writeFileSync(paths.agentsOutput, output.join("\n"));
|
||||
console.log(` Generated: ${paths.agentsOutput}`);
|
||||
console.log(` Total references: ${referenceFiles.length}`);
|
||||
|
||||
// Create CLAUDE.md symlink
|
||||
createClaudeSymlink(paths);
|
||||
}
|
||||
|
||||
// Run build when executed directly
|
||||
|
||||
@@ -17,6 +17,7 @@ export interface SkillPaths {
|
||||
skillDir: string;
|
||||
referencesDir: string;
|
||||
agentsOutput: string;
|
||||
claudeSymlink: string;
|
||||
skillFile: string;
|
||||
}
|
||||
|
||||
@@ -38,6 +39,7 @@ export function getSkillPaths(skillName: string): SkillPaths {
|
||||
skillDir,
|
||||
referencesDir: join(skillDir, "references"),
|
||||
agentsOutput: join(skillDir, "AGENTS.md"),
|
||||
claudeSymlink: join(skillDir, "CLAUDE.md"),
|
||||
skillFile: join(skillDir, "SKILL.md"),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user