feat: sync shared skills contract and graph-first discipline

This commit is contained in:
“BeeRad”
2026-04-17 20:58:21 +10:00
parent 5f4d1f61c2
commit 7e663abfb0
64 changed files with 1924 additions and 1902 deletions
+43 -2
View File
@@ -1,5 +1,5 @@
import { NextResponse } from 'next/server';
import { listSkills } from '@/services/skills/skillService';
import { NextRequest, NextResponse } from 'next/server';
import { listSkills, writeSkill } from '@/services/skills/skillService';
export const runtime = 'nodejs';
@@ -15,3 +15,44 @@ export async function GET() {
);
}
}
export async function POST(request: NextRequest) {
try {
const body = await request.json();
const name = typeof body?.name === 'string' ? body.name.trim() : '';
const content = typeof body?.content === 'string' ? body.content : '';
if (!name) {
return NextResponse.json(
{ success: false, error: 'Skill name is required' },
{ status: 400 }
);
}
if (!content.trim()) {
return NextResponse.json(
{ success: false, error: 'Skill content is required' },
{ status: 400 }
);
}
const result = writeSkill(name, content);
if (!result.success) {
return NextResponse.json(
{ success: false, error: result.error || 'Failed to write skill' },
{ status: 400 }
);
}
return NextResponse.json({
success: true,
message: `Skill "${name}" saved`,
});
} catch (error) {
console.error('[API /skills POST] error:', error);
return NextResponse.json(
{ success: false, error: error instanceof Error ? error.message : 'Failed to write skill' },
{ status: 500 }
);
}
}