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
+1 -48
View File
@@ -1,5 +1,5 @@
import { NextRequest, NextResponse } from 'next/server';
import { readSkill, writeSkill, deleteSkill } from '@/services/skills/skillService';
import { readSkill, deleteSkill } from '@/services/skills/skillService';
export const runtime = 'nodejs';
@@ -50,50 +50,3 @@ export async function DELETE(
);
}
}
export async function PUT(
request: NextRequest,
{ params }: { params: Promise<{ name: string }> }
) {
try {
const { name } = await params;
const body = await request.json();
const description = typeof body?.description === 'string' ? body.description.trim() : '';
const content = typeof body?.content === 'string' ? body.content : '';
const safeName = name.trim();
if (!safeName) {
return NextResponse.json(
{ success: false, error: 'Skill name is required' },
{ status: 400 }
);
}
const safeDescription = description.replace(/\r?\n/g, ' ').trim();
const frontmatter = [
'---',
`name: ${safeName}`,
`description: ${safeDescription}`,
'---',
'',
content.trim(),
'',
].join('\n');
const result = writeSkill(safeName, frontmatter);
if (!result.success) {
return NextResponse.json(
{ success: false, error: result.error },
{ status: 400 }
);
}
return NextResponse.json({ success: true, message: `Skill "${safeName}" saved` });
} catch (error) {
console.error('[API /skills/[name] PUT] error:', error);
return NextResponse.json(
{ success: false, error: error instanceof Error ? error.message : 'Failed to save skill' },
{ status: 500 }
);
}
}