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
34 lines ⢠1.69 kB
JavaScript
/**
* Pull command handler
*/
import { makeClient } from '../../api.js';
import { pullAll } from '../../sync.js';
import { getValidAccessToken } from '../../auth.js';
import { selectSingleCustomer } from '../customer-selection.js';
export async function handlePullCommand(customerConfig, args, verbose) {
const { selectedCustomer, allCustomers, isMultiCustomer } = selectSingleCustomer(customerConfig, args.customer);
// Check for force/silent overwrite flag
const silentOverwrite = Boolean(args.force || args.f);
if (selectedCustomer) {
// Single customer pull
const accessToken = await getValidAccessToken(selectedCustomer);
const client = await makeClient(verbose, accessToken);
const projectId = selectedCustomer.projectId || null;
await pullAll(client, selectedCustomer, projectId, verbose, silentOverwrite);
}
else if (isMultiCustomer) {
// Multi-customer pull
if (verbose)
console.log(`š„ No default customer specified, pulling from all ${allCustomers.length} customers`);
console.log(`š Pulling from ${allCustomers.length} customers...`);
for (const customer of allCustomers) {
console.log(`\nš„ Pulling from customer: ${customer.idn}`);
const accessToken = await getValidAccessToken(customer);
const client = await makeClient(verbose, accessToken);
const projectId = customer.projectId || null;
await pullAll(client, customer, projectId, verbose, silentOverwrite);
}
console.log(`\nā
Pull completed for all ${allCustomers.length} customers`);
}
}
//# sourceMappingURL=pull.js.map