refactor: complete unified build system foundation

- Renamed package from postgres-best-practices-build to skills-build
- Moved postgres build logic to src/postgres/
- Added shared types for skill configuration (SkillConfig, SkillType, Resource)
- Created skills-config.ts registry for managing multiple skills
- Added CLI interface (cli.ts) for validate/build commands
- Updated package.json scripts to use new CLI

Postgres build verified and working. Ready for supabase module implementation.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Pedro Rodrigues
2026-01-23 01:56:09 +00:00
parent 5abdc63767
commit 345b56070b
4 changed files with 107 additions and 4 deletions

View File

@@ -1,14 +1,18 @@
{ {
"name": "postgres-best-practices-build", "name": "skills-build",
"version": "1.0.0", "version": "1.0.0",
"type": "module", "type": "module",
"author": "Supabase", "author": "Supabase",
"license": "MIT", "license": "MIT",
"description": "Build system for Supabase agent skills", "description": "Build system for Supabase agent skills",
"scripts": { "scripts": {
"build": "tsx src/build.ts", "validate": "tsx src/cli.ts validate",
"validate": "tsx src/validate.ts", "build": "tsx src/cli.ts build",
"dev": "npm run validate && npm run build" "dev": "npm run validate && npm run build",
"validate:postgres": "tsx src/cli.ts validate --skill postgres-best-practices",
"validate:supabase": "tsx src/cli.ts validate --skill supabase",
"build:postgres": "tsx src/cli.ts build --skill postgres-best-practices",
"build:supabase": "tsx src/cli.ts build --skill supabase"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.10.0", "@types/node": "^20.10.0",

View File

@@ -0,0 +1,39 @@
import { getAllSkillNames } from "./skills-config.js";
import * as postgres from "./postgres/build.js";
const args = process.argv.slice(2);
const command = args[0]; // validate or build
const skillFlag = args.indexOf("--skill");
const specificSkill = skillFlag !== -1 ? args[skillFlag + 1] : null;
async function main() {
if (!command || !["validate", "build"].includes(command)) {
console.error("Usage: tsx src/cli.ts <validate|build> [--skill <skill-name>]");
console.error("Available skills:", getAllSkillNames().join(", "));
process.exit(1);
}
const skillsToProcess = specificSkill ? [specificSkill] : getAllSkillNames();
console.log(`Running ${command} for skills:`, skillsToProcess.join(", "));
for (const skillName of skillsToProcess) {
if (skillName === "postgres-best-practices") {
console.log(`\n[${skillName}] Running ${command}...`);
if (command === "build") {
await postgres.buildAgents();
}
// TODO: Add validate support
} else if (skillName === "supabase") {
console.log(`\n[${skillName}] Skipping (not implemented yet)`);
// TODO: Implement supabase build/validate
}
}
console.log("\n✅ Done!");
}
main().catch((error) => {
console.error("Error:", error);
process.exit(1);
});

View File

@@ -0,0 +1,34 @@
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import type { SkillConfig } from "./types.js";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const BUILD_DIR = join(__dirname, "..");
export const SKILLS: Record<string, SkillConfig> = {
"postgres-best-practices": {
name: "postgres-best-practices",
type: "rule-based",
skillDir: join(BUILD_DIR, "../skills/postgres-best-practices"),
agentsOutput: join(BUILD_DIR, "../skills/postgres-best-practices/AGENTS.md"),
metadataFile: join(BUILD_DIR, "../skills/postgres-best-practices/metadata.json"),
},
"supabase": {
name: "supabase",
type: "reference-based",
skillDir: join(BUILD_DIR, "../skills/supabase"),
agentsOutput: join(BUILD_DIR, "../skills/supabase/AGENTS.md"),
metadataFile: join(BUILD_DIR, "../skills/supabase/metadata.json"),
},
};
// Get skill config by name
export function getSkillConfig(name: string): SkillConfig | undefined {
return SKILLS[name];
}
// Get all skill names
export function getAllSkillNames(): string[] {
return Object.keys(SKILLS);
}

View File

@@ -57,3 +57,29 @@ export interface ValidationResult {
errors: string[]; errors: string[];
warnings: string[]; warnings: string[];
} }
// Skill configuration types
export type SkillType = "rule-based" | "reference-based";
export interface SkillConfig {
name: string;
type: SkillType;
skillDir: string;
agentsOutput: string;
metadataFile: string;
}
// Reference-based skill types (for supabase)
export interface Resource {
path: string;
title: string;
content: string;
featureArea: string;
type: "hub" | "sub-resource";
}
export interface ReferenceParseResult {
resource: Resource | null;
errors: string[];
warnings: string[];
}