@velaro/cli 1.4.248 → 1.4.250

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/velaro.js CHANGED
@@ -41,6 +41,7 @@ import { appointmentsCommand } from '../lib/commands/appointments.js';
41
41
  import { schedulerCommand } from '../lib/commands/scheduler.js';
42
42
  import { publicApiCommand } from '../lib/commands/public-api.js';
43
43
  import { bookingDefaultsCommand } from '../lib/commands/booking-defaults.js';
44
+ import { reservationBackupCommand } from '../lib/commands/reservation-backup.js';
44
45
  import { bookingCommand } from '../lib/commands/booking.js';
45
46
  import { reportCommand } from '../lib/commands/report.js';
46
47
  import { reportSubscriptionCommand } from '../lib/commands/report-subscription.js';
@@ -137,6 +138,7 @@ import { crmOrderCommand, crmFulfillmentCommand, crmReturnCommand } from '../lib
137
138
  import { crmApprovalCommand, crmScoreCommand } from '../lib/commands/crm-approvals-scoring.js';
138
139
  import { featureDiscoveryGroup } from '../lib/commands/feature-discovery.js';
139
140
  import { billingInsightsGroup } from '../lib/commands/billing-insights.js';
141
+ import { billingMigrationGroup } from '../lib/commands/billing-migration.js';
140
142
  import { supportTicketsCommand } from '../lib/commands/support-tickets.js';
141
143
  import { aiAckGroup } from '../lib/commands/ai-ack.js';
142
144
  import { afterHoursSupportCommand } from '../lib/commands/after-hours-support.js';
@@ -207,6 +209,7 @@ await (registerStaffCommands ? registerStaffCommands(baseYargs) : baseYargs)
207
209
  .command(schedulerCommand)
208
210
  .command(publicApiCommand)
209
211
  .command(bookingDefaultsCommand)
212
+ .command(reservationBackupCommand)
210
213
  .command(bookingCommand)
211
214
  .command(reportCommand)
212
215
  .command(conversationEfficiencyCommand)
@@ -290,6 +293,7 @@ await (registerStaffCommands ? registerStaffCommands(baseYargs) : baseYargs)
290
293
  .command(chatWindowCommand)
291
294
  .command(featureDiscoveryGroup)
292
295
  .command(billingInsightsGroup)
296
+ .command(billingMigrationGroup)
293
297
  .command(supportTicketsCommand)
294
298
  .command(aiAckGroup)
295
299
  .command(afterHoursSupportCommand)
@@ -0,0 +1,44 @@
1
+ // velaro billing migration: Stax to Velaro mid-cycle migration (owner only). Import Stax CSV exports, plan,
2
+ // verify, and dry run. Every command is read-only toward Stax and QuickBooks: nothing is posted, sent or charged.
3
+ import fs from 'node:fs';
4
+ import { request } from '../api.js';
5
+
6
+ const readJson = (p) => JSON.parse(fs.readFileSync(p, 'utf8'));
7
+
8
+ async function importCsv(args) {
9
+ const csv = fs.readFileSync(args.file, 'utf8');
10
+ console.log(JSON.stringify(await request('POST', 'Billing/StaxMigration/Import', { kind: args.kind, csv }), null, 2));
11
+ }
12
+ async function plan(args) { console.log(JSON.stringify(await request('POST', 'Billing/StaxMigration/Plan', readJson(args.file)), null, 2)); }
13
+ async function verify(args) {
14
+ const r = await request('POST', 'Billing/StaxMigration/Verify', readJson(args.file));
15
+ console.log(args.csv ? r.csv : JSON.stringify(r, null, 2));
16
+ }
17
+ async function dryrun(args) { console.log(JSON.stringify(await request('POST', 'Billing/StaxMigration/DryRun', readJson(args.file)), null, 2)); }
18
+ async function apply(args) {
19
+ const body = readJson(args.file);
20
+ body.confirmed = args.confirm === true;
21
+ console.log(JSON.stringify(await request('POST', 'Billing/StaxMigration/Apply', body), null, 2));
22
+ }
23
+ async function rollback(args) { console.log(JSON.stringify(await request('POST', 'Billing/StaxMigration/Rollback', { billingSubscriptionId: args.id }), null, 2)); }
24
+ async function records(args) { console.log(JSON.stringify(await request('GET', 'Billing/StaxMigration/Records' + (args.id ? `?billingSubscriptionId=${args.id}` : '')), null, 2)); }
25
+ async function qboDeferred(args) { console.log(JSON.stringify(await request('GET', `Billing/StaxMigration/QboDeferred?account=${encodeURIComponent(args.account)}`), null, 2)); }
26
+ async function status() { console.log(JSON.stringify(await request('GET', 'Billing/StaxMigration/Status'), null, 2)); }
27
+
28
+ export function billingMigrationCommand(yargs) {
29
+ return yargs
30
+ .command('import <file>', 'Import a Stax CSV export (idempotent by file hash)', (y) => y
31
+ .positional('file', { type: 'string' }).option('kind', { type: 'string', default: 'Invoices', desc: 'Invoices|Payments|Subscriptions|Drafts' }), (a) => importCsv(a))
32
+ .command('plan <file>', 'Expected numbers for a request JSON (balance)', (y) => y.positional('file', { type: 'string' }), (a) => plan(a))
33
+ .command('verify <file>', 'Per-customer verification report and cutover gate', (y) => y
34
+ .positional('file', { type: 'string' }).option('csv', { type: 'boolean', desc: 'print CSV rule rows' }), (a) => verify(a))
35
+ .command('dryrun <file>', 'Proposed invoice and REVREC journals vs Stax/QBO (zero writes)', (y) => y.positional('file', { type: 'string' }), (a) => dryrun(a))
36
+ .command('apply <file>', 'Preview the mapping onto a BillingSubscription (add --confirm to save)', (y) => y.positional('file', { type: 'string' }).option('confirm', { type: 'boolean', default: false }), (a) => apply(a))
37
+ .command('rollback <id>', 'Restore the pricing fields saved before the last apply', (y) => y.positional('id', { type: 'number' }), (a) => rollback(a))
38
+ .command('records [id]', 'Persisted opening balances and price schedule', (y) => y.positional('id', { type: 'number' }), (a) => records(a))
39
+ .command('qbo-deferred <account>', 'Read-only QBO balance of an account by exact name', (y) => y.positional('account', { type: 'string' }), (a) => qboDeferred(a))
40
+ .command('status', 'Migration mode and the Billing:QboIntuitLive gate', () => {}, () => status())
41
+ .demandCommand(1, 'Specify a subcommand: import | plan | verify | dryrun | apply | rollback | records | qbo-deferred | status');
42
+ }
43
+
44
+ export const billingMigrationGroup = { command: 'billing-migration', desc: 'Stax to Velaro billing migration (owner only, dry run only)', builder: billingMigrationCommand, handler: () => {} };
@@ -0,0 +1,74 @@
1
+ import fs from 'node:fs';
2
+ import { messagingGet, messagingPost, messagingPut, messagingRequest } from '../api.js';
3
+ import { runCommand } from '../run.js';
4
+
5
+ // ── velaro reservation-backup ─────────────────────────────────────────────────
6
+ // CLI surface for reservation export (CSV / ICS / printable) and the emailed backup.
7
+ // Mirrors the reservation_backup_* MCP tools. Routes live in velaro-messaging at
8
+ // /ReservationExport (ReservationExportController); the site always comes from the login.
9
+
10
+ export const reservationBackupCommand = {
11
+ command: 'reservation-backup <subcommand>',
12
+ describe: 'Download reservations and manage the emailed daily/weekly backup',
13
+ builder: yargs => yargs
14
+ .command({
15
+ command: 'get',
16
+ describe: 'Show the backup settings and the last send result',
17
+ handler: runCommand(async () => {
18
+ console.log(JSON.stringify(await messagingGet('/ReservationExport/Settings'), null, 2));
19
+ }),
20
+ })
21
+ .command({
22
+ command: 'set',
23
+ describe: 'Change the backup settings (only the flags you pass change)',
24
+ builder: y => y
25
+ .option('enabled', { type: 'string', describe: 'on | off' })
26
+ .option('frequency', { type: 'string', describe: 'daily | weekly' })
27
+ .option('recipients', { type: 'string', describe: 'Email addresses, separated by commas or semicolons' })
28
+ .option('lookahead', { type: 'number', describe: 'Days ahead to include (1-366)' }),
29
+ handler: runCommand(async argv => {
30
+ const body = {};
31
+ if (argv.enabled !== undefined) {
32
+ if (!['on', 'off'].includes(argv.enabled)) throw new Error('--enabled must be on or off');
33
+ body.enabled = argv.enabled === 'on';
34
+ }
35
+ if (argv.frequency !== undefined) body.frequency = argv.frequency;
36
+ if (argv.recipients !== undefined) body.recipients = argv.recipients;
37
+ if (argv.lookahead !== undefined) body.lookaheadDays = argv.lookahead;
38
+ const saved = await messagingPut('/ReservationExport/Settings', body);
39
+ console.log('\n✓ Reservation backup settings saved');
40
+ console.log(JSON.stringify(saved, null, 2));
41
+ }),
42
+ })
43
+ .command({
44
+ command: 'send-now',
45
+ describe: 'Email the backup to the saved recipients now',
46
+ handler: runCommand(async () => {
47
+ console.log(JSON.stringify(await messagingPost('/ReservationExport/SendNow', {}), null, 2));
48
+ }),
49
+ })
50
+ .command({
51
+ command: 'download',
52
+ describe: 'Download reservations to a file',
53
+ builder: y => y
54
+ .option('format', { type: 'string', choices: ['csv', 'ics', 'print'], default: 'csv' })
55
+ .option('out', { type: 'string', describe: 'Output file (default reservations.<ext>)' })
56
+ .option('from', { type: 'string', describe: 'ISO date-time start' })
57
+ .option('to', { type: 'string', describe: 'ISO date-time end' })
58
+ .option('status', { type: 'string' })
59
+ .option('provider', { type: 'string' })
60
+ .option('resource', { type: 'number', describe: 'Resource id' }),
61
+ handler: runCommand(async argv => {
62
+ const q = new URLSearchParams();
63
+ for (const [k, v] of [['from', argv.from], ['to', argv.to], ['status', argv.status], ['provider', argv.provider], ['resourceId', argv.resource]]) {
64
+ if (v !== undefined && v !== '') q.set(k, String(v));
65
+ }
66
+ const kind = { csv: 'Csv', ics: 'Ics', print: 'Print' }[argv.format];
67
+ const text = await messagingRequest('GET', `/ReservationExport/${kind}${q.toString() ? '?' + q : ''}`, undefined, undefined, {}, { text: true });
68
+ const out = argv.out || `reservations.${argv.format === 'print' ? 'html' : argv.format}`;
69
+ fs.writeFileSync(out, text);
70
+ console.log(`\n✓ Saved ${out}`);
71
+ }),
72
+ })
73
+ .demandCommand(1),
74
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/cli",
3
- "version": "1.4.248",
3
+ "version": "1.4.250",
4
4
  "description": "Velaro Workspace v20 — command-line interface for managing bots, knowledge base ingestion, MCP API keys, search indexes, and ops health.",
5
5
  "type": "module",
6
6
  "bin": {