UNPKG

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

40 lines • 2 kB
/** * Push command handler */ import { makeClient } from '../../api.js'; import { pushChanged } from '../../sync.js'; import { getValidAccessToken } from '../../auth.js'; import { selectSingleCustomer, interactiveCustomerSelection } from '../customer-selection.js'; export async function handlePushCommand(customerConfig, args, verbose) { const { selectedCustomer, allCustomers, isMultiCustomer } = selectSingleCustomer(customerConfig, args.customer); const shouldPublish = !args['no-publish']; if (selectedCustomer) { // Single customer push const accessToken = await getValidAccessToken(selectedCustomer); const client = await makeClient(verbose, accessToken); await pushChanged(client, selectedCustomer, verbose, shouldPublish); } else if (isMultiCustomer) { // Multiple customers exist with no default, ask user const customersToProcess = await interactiveCustomerSelection(allCustomers); if (customersToProcess.length === 1) { // Single customer selected const customer = customersToProcess[0]; const accessToken = await getValidAccessToken(customer); const client = await makeClient(verbose, accessToken); await pushChanged(client, customer, verbose, shouldPublish); } else { // Multi-customer push (user selected "All customers") console.log(`šŸ”„ Pushing to ${customersToProcess.length} customers...`); for (const customer of customersToProcess) { console.log(`\nšŸ“¤ Pushing for customer: ${customer.idn}`); const accessToken = await getValidAccessToken(customer); const client = await makeClient(verbose, accessToken); await pushChanged(client, customer, verbose, shouldPublish); } console.log(`\nāœ… Push completed for all ${customersToProcess.length} customers`); } } } //# sourceMappingURL=push.js.map