newo
Version:
NEWO CLI: Professional command-line tool with modular architecture for NEWO AI Agent development. Features account migration, integration management, webhook automation, AKB knowledge base, project attributes, sandbox testing, IDN-based file management, r
68 lines ⢠3.33 kB
JavaScript
/**
* Migration verification command handler
*/
import { makeClient, listProjects, listAgents, listFlowSkills } from '../../api.js';
import { getValidAccessToken } from '../../auth.js';
import { getCustomer } from '../../customer.js';
export async function handleVerifyMigrationCommand(customerConfig, args, verbose) {
const sourceIdn = args.source;
const destIdn = args.dest;
if (!sourceIdn || !destIdn) {
console.error('ā Usage: newo verify --source <sourceIdn> --dest <destIdn>');
console.error('Example: newo verify --source NEWO_bb5lmJjg --dest NEq9OCwSXw');
process.exit(1);
}
const sourceCustomer = getCustomer(customerConfig, sourceIdn);
const destCustomer = getCustomer(customerConfig, destIdn);
if (!sourceCustomer || !destCustomer) {
console.error('ā Customer not found in configuration');
process.exit(1);
}
console.log('\nš Migration Verification');
console.log(`Source: ${sourceIdn}`);
console.log(`Destination: ${destIdn}\n`);
const sourceToken = await getValidAccessToken(sourceCustomer);
const destToken = await getValidAccessToken(destCustomer);
const sourceClient = await makeClient(verbose, sourceToken);
const destClient = await makeClient(verbose, destToken);
// Count entities
const sourceProjects = await listProjects(sourceClient);
const destProjects = await listProjects(destClient);
let srcAgents = 0, srcFlows = 0, srcSkills = 0;
let dstAgents = 0, dstFlows = 0, dstSkills = 0;
for (const proj of sourceProjects) {
const agents = await listAgents(sourceClient, proj.id);
srcAgents += agents.length;
for (const agent of agents) {
srcFlows += (agent.flows || []).length;
for (const flow of agent.flows || []) {
const skills = await listFlowSkills(sourceClient, flow.id);
srcSkills += skills.length;
}
}
}
for (const proj of destProjects.filter(p => p.idn !== 'test')) {
const agents = await listAgents(destClient, proj.id);
dstAgents += agents.length;
for (const agent of agents) {
dstFlows += (agent.flows || []).length;
for (const flow of agent.flows || []) {
const skills = await listFlowSkills(destClient, flow.id);
dstSkills += skills.length;
}
}
}
console.log('š Entity Counts:\n');
console.log(`Projects: ${sourceProjects.length} ā ${destProjects.filter(p => p.idn !== 'test').length} ${sourceProjects.length === destProjects.filter(p => p.idn !== 'test').length ? 'ā
' : 'ā'}`);
console.log(`Agents: ${srcAgents} ā ${dstAgents} ${srcAgents === dstAgents ? 'ā
' : 'ā'}`);
console.log(`Flows: ${srcFlows} ā ${dstFlows} ${srcFlows === dstFlows ? 'ā
' : 'ā'}`);
console.log(`Skills: ${srcSkills} ā ${dstSkills} ${srcSkills === dstSkills ? 'ā
' : 'ā'}\n`);
if (srcAgents === dstAgents && srcFlows === dstFlows && srcSkills === dstSkills) {
console.log('ā
All entity counts match - Migration successful!\n');
}
else {
console.log('ā ļø Entity counts differ - Migration may be incomplete\n');
process.exit(1);
}
}
//# sourceMappingURL=verify-migration.js.map