add migrate agents script

This commit is contained in:
Ramnique Singh 2025-12-18 11:43:42 +05:30
parent e40c767336
commit da20e280f4
3 changed files with 28 additions and 2 deletions

View file

@ -77,7 +77,9 @@ export class FSAgentsRepo implements IAgentsRepo {
}
async create(agent: z.infer<typeof Agent>): Promise<void> {
await fs.writeFile(path.join(this.agentsDir, `${agent.name}.md`), agent.instructions);
const { instructions, ...rest } = agent;
const contents = `---\n${stringify(rest)}\n---\n${instructions}`;
await fs.writeFile(path.join(this.agentsDir, `${agent.name}.md`), contents);
}
async update(id: string, agent: z.infer<typeof UpdateAgentSchema>): Promise<void> {