UNPKG

sf-agent-framework

Version:

AI Agent Orchestration Framework for Salesforce Development - Two-phase architecture with 70% context reduction

90 lines (72 loc) 2.32 kB
const inquirer = require('inquirer'); const fs = require('fs'); const path = require('path'); const yaml = require('js-yaml'); async function createAgent() { console.log('Starting interactive agent creation...'); const questions = [ { type: 'input', name: 'name', message: 'What is the name of the agent? (e.g., Jordan Davis)', }, { type: 'input', name: 'id', message: 'What is the ID of the agent? (e.g., sf-developer)', }, { type: 'input', name: 'title', message: 'What is the title of the agent? (e.g., Lead Salesforce Developer)', }, { type: 'input', name: 'role', message: 'What is the role of the agent? (e.g., Lead Salesforce Developer & Technical Implementation Expert)', }, { type: 'input', name: 'style', message: 'What is the communication style of the agent? (e.g., Technical but approachable)', }, { type: 'input', name: 'commands', message: 'Enter a comma-separated list of commands for the agent (e.g., *help, *apex, *lwc)', }, ]; const answers = await inquirer.prompt(questions); const agentDefinition = { agent: { name: answers.name, id: answers.id, title: answers.title, }, persona: { role: answers.role, style: answers.style, }, commands: answers.commands.split(',').map((cmd) => cmd.trim()), }; const yamlString = yaml.dump(agentDefinition); const filePath = path.join('sf-core', 'agents', `${answers.id}.md`); const fileContent = ` # /${answers.id} Command When this command is used, adopt the following agent persona: # ${answers.name} ACTIVATION-NOTICE: This file contains your full agent operating guidelines. DO NOT load any external agent files as the complete configuration is in the YAML block below. CRITICAL: Read the full YAML BLOCK that FOLLOWS IN THIS FILE to understand your operating params, start and follow exactly your activation-instructions to alter your state of being, stay in this being until told to exit this mode: ## COMPLETE AGENT DEFINITION FOLLOWS - NO EXTERNAL FILES NEEDED \ ${yamlString} `; fs.writeFileSync(filePath, fileContent); console.log(`Agent definition file created at: ${filePath}`); } createAgent();