@velaro/cli 1.4.242 → 1.4.244
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 +343 -360
- package/lib/commands/billing.js +3 -71
- package/lib/commands/booking.js +59 -7
- package/lib/commands/endpoint-parity.js +53 -58
- package/lib/commands/index.js +1 -43
- package/lib/commands/ingest.js +63 -36
- package/lib/commands/ingest.test.js +22 -0
- package/lib/commands/mcp-key.js +11 -1
- package/lib/commands/mcp-key.test.js +11 -0
- package/lib/commands/package-builder-my.js +13 -0
- package/lib/public-help.test.js +35 -0
- package/package.json +40 -40
- package/lib/commands/billing-agents.js +0 -51
- package/lib/commands/billing-automation.js +0 -184
- package/lib/commands/billing-email-preference.js +0 -64
- package/lib/commands/billing-subscription.js +0 -909
- package/lib/commands/order-form.js +0 -112
- package/lib/commands/package-builder.js +0 -35
- package/lib/commands/price-increase.js +0 -93
- package/lib/commands/sign.js +0 -253
- package/lib/commands/status-notify.js +0 -98
- package/lib/sign-fields.js +0 -49
- package/lib/sign-fields.test.js +0 -27
- package/lib/sign-versions.js +0 -58
- package/lib/sign-versions.test.js +0 -50
- package/lib/sign.test.js +0 -19
package/lib/commands/billing.js
CHANGED
|
@@ -58,81 +58,13 @@ async function planStatus() {
|
|
|
58
58
|
console.log('');
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
async function listContracts() {
|
|
64
|
-
const contracts = await request('GET', '/api/Contract');
|
|
65
|
-
if (!Array.isArray(contracts) || !contracts.length) {
|
|
66
|
-
console.log('No contracts found.');
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
console.log(`\nContracts (${contracts.length})\n${'─'.repeat(60)}`);
|
|
70
|
-
for (const c of contracts) {
|
|
71
|
-
const monthly = c.totalMonthlyValue ? ` $${Number(c.totalMonthlyValue).toFixed(2)}/mo` : '';
|
|
72
|
-
const signed = c.signedAt ? ` signed ${fmtDate(c.signedAt)}` : '';
|
|
73
|
-
console.log(` [${c.id}] ${c.status.padEnd(8)} "${c.title}" ${c.customerEmail || ''}${monthly}${signed}`);
|
|
74
|
-
}
|
|
75
|
-
console.log('');
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async function showContract(id) {
|
|
79
|
-
const c = await request('GET', `/api/Contract/${id}`);
|
|
80
|
-
console.log(`\nContract ${c.id}: "${c.title}"\n${'─'.repeat(50)}`);
|
|
81
|
-
console.log(` Status: ${c.status}`);
|
|
82
|
-
console.log(` Customer: ${c.customerName || '—'} <${c.customerEmail || '—'}>`);
|
|
83
|
-
if (c.customerCompany) console.log(` Company: ${c.customerCompany}`);
|
|
84
|
-
console.log(` Monthly: $${Number(c.totalMonthlyValue || 0).toFixed(2)}/mo Setup: $${Number(c.setupFee || 0).toFixed(2)}`);
|
|
85
|
-
console.log(` Service: ${fmtDate(c.serviceStartDate)} → ${fmtDate(c.serviceEndDate)}`);
|
|
86
|
-
console.log(` Activation: ${c.subscriptionActivationMode} activated: ${fmtDate(c.subscriptionActivatedAt)}`);
|
|
87
|
-
console.log(` QB Customer: ${c.qboCustomerId || 'not synced'}`);
|
|
88
|
-
console.log(` QB Invoice: ${c.qboInvoiceId || '—'}`);
|
|
89
|
-
if (c.signedAt) console.log(` Signed: ${fmtDate(c.signedAt)} by ${c.signedByEmail}`);
|
|
90
|
-
if (c.cancellationRequestedAt) console.log(` ⚠️ Cancelled: ${fmtDate(c.cancellationRequestedAt)} by ${c.cancellationRequestedBy}`);
|
|
91
|
-
if (c.amendments?.length) console.log(` Amendments: ${c.amendments.length}`);
|
|
92
|
-
console.log('');
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
async function sendContract(id) {
|
|
96
|
-
await request('POST', `/api/Contract/${id}/send`);
|
|
97
|
-
console.log(`✅ Contract ${id} sent — signing link dispatched to customer.`);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// ── invoices ──────────────────────────────────────────────────────────────────
|
|
101
|
-
|
|
102
|
-
async function listInvoices() {
|
|
103
|
-
const invoices = await request('GET', '/api/BillingInvoiceRecord');
|
|
104
|
-
if (!Array.isArray(invoices) || !invoices.length) {
|
|
105
|
-
console.log('No invoices found.');
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
console.log(`\nInvoices (${invoices.length})\n${'─'.repeat(70)}`);
|
|
109
|
-
for (const i of invoices) {
|
|
110
|
-
const qb = `QB:${(i.qboSyncStatus || 'not pushed').padEnd(10)}`;
|
|
111
|
-
const attempts = i.qboSyncAttempts > 0 ? ` (${i.qboSyncAttempts}x)` : '';
|
|
112
|
-
console.log(` [${i.id}] ${(i.invoiceNumber || '').padEnd(16)} ${fmtCents(i.totalCents).padEnd(10)} ${i.status.padEnd(8)} ${qb}${attempts} ${fmtDate(i.createdAt)}`);
|
|
113
|
-
if (i.qboLastSyncError) console.log(` QB error: ${i.qboLastSyncError.slice(0, 80)}`);
|
|
114
|
-
}
|
|
115
|
-
console.log('');
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
async function dispatchInvoice(id) {
|
|
119
|
-
await request('POST', `/api/BillingInvoiceRecord/${id}/dispatch`);
|
|
120
|
-
console.log(`✅ Invoice ${id} dispatched — email sent and status set to open.`);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// ── command export ────────────────────────────────────────────────────────────
|
|
124
|
-
|
|
61
|
+
// Customer-safe: plan-status is scoped to the caller site. Contract and invoice subcommands are staff-gated server side and live only in the unpublished staff folder.
|
|
125
62
|
export const billingCommand = {
|
|
126
63
|
command: 'billing <subcommand>',
|
|
127
|
-
describe: '
|
|
64
|
+
describe: 'Your plan status',
|
|
128
65
|
builder: (yargs) =>
|
|
129
66
|
yargs
|
|
130
67
|
.command('plan-status', 'Show current plan flags, seats, QB sync state, and deferred revenue', {}, () => planStatus())
|
|
131
|
-
.
|
|
132
|
-
.command('contract <id>', 'Show a specific contract', {}, (args) => showContract(args.id))
|
|
133
|
-
.command('contract-send <id>', 'Send a contract to the customer for signing', {}, (args) => sendContract(args.id))
|
|
134
|
-
.command('invoices', 'List invoice records with QB sync status', {}, () => listInvoices())
|
|
135
|
-
.command('invoice-dispatch <id>', 'Email an invoice to the customer (sets status to open)', {}, (args) => dispatchInvoice(args.id))
|
|
136
|
-
.demandCommand(1, 'Specify a subcommand: plan-status | contracts | contract <id> | contract-send <id> | invoices | invoice-dispatch <id>'),
|
|
68
|
+
.demandCommand(1, 'Specify a subcommand: plan-status'),
|
|
137
69
|
handler: () => {},
|
|
138
70
|
};
|
package/lib/commands/booking.js
CHANGED
|
@@ -13,7 +13,31 @@ import { runCommand } from '../run.js';
|
|
|
13
13
|
// Mirrors the booking_* MCP tools. SiteId always derives from the caller's
|
|
14
14
|
// JWT server-side -- never accepted as a CLI argument.
|
|
15
15
|
|
|
16
|
-
const RESOURCE_TYPES = ['Staff', 'Room', 'Equipment', 'Virtual'];
|
|
16
|
+
const RESOURCE_TYPES = ['Staff', 'Room', 'Equipment', 'Virtual', 'Table'];
|
|
17
|
+
const BOOKING_MODES = ['StaffSchedule', 'TableCapacity', 'SeatCapacity'];
|
|
18
|
+
|
|
19
|
+
// Booking modes (velaro-messaging docs/design/booking-modes.md section 4.5): every field is
|
|
20
|
+
// optional and sent only when supplied (apply-if-present on PUT).
|
|
21
|
+
function parseBySize(v) {
|
|
22
|
+
if (v == null) return undefined;
|
|
23
|
+
if (v === '') return '';
|
|
24
|
+
try { return JSON.parse(v); } catch { throw new Error('--turn-minutes-by-size must be JSON, e.g. {"1-2":60,"3-5":90,"6+":120}'); }
|
|
25
|
+
}
|
|
26
|
+
function resourceModeBody(argv) {
|
|
27
|
+
return { minParty: argv.minParty, maxParty: argv.maxParty, turnMinutes: argv.turnMinutes, combineGroup: argv.combineGroup };
|
|
28
|
+
}
|
|
29
|
+
function serviceModeBody(argv) {
|
|
30
|
+
return {
|
|
31
|
+
bookingMode: argv.bookingMode,
|
|
32
|
+
turnMinutes: argv.turnMinutes,
|
|
33
|
+
turnMinutesBySize: parseBySize(argv.turnMinutesBySize),
|
|
34
|
+
bufferBeforeMinutes: argv.bufferBefore,
|
|
35
|
+
bufferAfterMinutes: argv.bufferAfter,
|
|
36
|
+
allowTableCombining: argv.allowTableCombining,
|
|
37
|
+
minParty: argv.minParty,
|
|
38
|
+
maxParty: argv.maxParty,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
17
41
|
|
|
18
42
|
function fmtDate(d) { return d ? new Date(d).toISOString().replace('T', ' ').slice(0, 16) : '-'; }
|
|
19
43
|
function fmtTime(t) { return t == null ? '-' : String(t); }
|
|
@@ -59,7 +83,7 @@ export const bookingCommand = {
|
|
|
59
83
|
}
|
|
60
84
|
console.log('\nBookable Resources\n');
|
|
61
85
|
for (const r of resources) {
|
|
62
|
-
console.log(` id:${r.id} ${r.name} type:${RESOURCE_TYPES[r.resourceType] ?? r.resourceType} active:${r.isActive}`);
|
|
86
|
+
console.log(` id:${r.id} ${r.name} type:${RESOURCE_TYPES[r.resourceType] ?? r.resourceType} party:${r.minParty ?? '-'}-${r.maxParty ?? '-'} active:${r.isActive}`);
|
|
63
87
|
}
|
|
64
88
|
console.log('');
|
|
65
89
|
}),
|
|
@@ -79,12 +103,17 @@ export const bookingCommand = {
|
|
|
79
103
|
builder: y2 => y2
|
|
80
104
|
.option('name', { type: 'string', demandOption: true, describe: 'Resource name -- required' })
|
|
81
105
|
.option('type', { type: 'string', choices: RESOURCE_TYPES, describe: 'Resource type (Staff | Room | Equipment | Virtual, default Staff)' })
|
|
82
|
-
.option('active', { type: 'boolean', describe: 'Whether the resource is active (default true)' })
|
|
106
|
+
.option('active', { type: 'boolean', describe: 'Whether the resource is active (default true)' })
|
|
107
|
+
.option('min-party', { type: 'number', describe: 'Smallest party this table seats' })
|
|
108
|
+
.option('max-party', { type: 'number', describe: 'Largest party this table seats' })
|
|
109
|
+
.option('turn-minutes', { type: 'number', describe: 'Minutes a party occupies this table (overrides the service default)' })
|
|
110
|
+
.option('combine-group', { type: 'string', describe: 'Group name; tables in one group can be combined for larger parties' }),
|
|
83
111
|
handler: runCommand(async argv => {
|
|
84
112
|
const resource = await messagingPost('/BookableResources', {
|
|
85
113
|
name: argv.name,
|
|
86
114
|
resourceType: argv.type,
|
|
87
115
|
isActive: argv.active,
|
|
116
|
+
...resourceModeBody(argv),
|
|
88
117
|
});
|
|
89
118
|
console.log(`\n✓ Created resource id:${resource.id} "${resource.name}"\n`);
|
|
90
119
|
}),
|
|
@@ -96,12 +125,17 @@ export const bookingCommand = {
|
|
|
96
125
|
.positional('id', { type: 'number', describe: 'Resource id' })
|
|
97
126
|
.option('name', { type: 'string', describe: 'New name' })
|
|
98
127
|
.option('type', { type: 'string', choices: RESOURCE_TYPES, describe: 'New resource type' })
|
|
99
|
-
.option('active', { type: 'boolean', describe: 'New active state' })
|
|
128
|
+
.option('active', { type: 'boolean', describe: 'New active state' })
|
|
129
|
+
.option('min-party', { type: 'number', describe: 'Smallest party this table seats' })
|
|
130
|
+
.option('max-party', { type: 'number', describe: 'Largest party this table seats' })
|
|
131
|
+
.option('turn-minutes', { type: 'number', describe: 'Minutes a party occupies this table (overrides the service default)' })
|
|
132
|
+
.option('combine-group', { type: 'string', describe: 'Group name; tables in one group can be combined for larger parties' }),
|
|
100
133
|
handler: runCommand(async argv => {
|
|
101
134
|
const resource = await messagingPut(`/BookableResources/${argv.id}`, {
|
|
102
135
|
name: argv.name,
|
|
103
136
|
resourceType: argv.type,
|
|
104
137
|
isActive: argv.active,
|
|
138
|
+
...resourceModeBody(argv),
|
|
105
139
|
});
|
|
106
140
|
console.log(`\n✓ Updated resource id:${resource.id} "${resource.name}"\n`);
|
|
107
141
|
}),
|
|
@@ -133,7 +167,7 @@ export const bookingCommand = {
|
|
|
133
167
|
}
|
|
134
168
|
console.log('\nBookable Services\n');
|
|
135
169
|
for (const s of services) {
|
|
136
|
-
console.log(` id:${s.id} ${s.name} ${s.durationMinutes}min capacity:${s.defaultCapacity} requiresResource:${s.requiresResource} category:${s.category ?? '-'} active:${s.isActive}`);
|
|
170
|
+
console.log(` id:${s.id} ${s.name} ${s.durationMinutes}min mode:${s.bookingMode ?? 'default'} capacity:${s.defaultCapacity} requiresResource:${s.requiresResource} category:${s.category ?? '-'} active:${s.isActive}`);
|
|
137
171
|
}
|
|
138
172
|
console.log('');
|
|
139
173
|
}),
|
|
@@ -156,9 +190,18 @@ export const bookingCommand = {
|
|
|
156
190
|
.option('capacity', { type: 'number', describe: 'Default seats per slot (default 1)' })
|
|
157
191
|
.option('requires-resource', { type: 'boolean', describe: 'Whether a slot must be tied to a specific resource (default true)' })
|
|
158
192
|
.option('category', { type: 'string', describe: 'Free-text grouping, e.g. "Hair" or "Fitness Classes"' })
|
|
159
|
-
.option('active', { type: 'boolean', describe: 'Whether the service is active (default true)' })
|
|
193
|
+
.option('active', { type: 'boolean', describe: 'Whether the service is active (default true)' })
|
|
194
|
+
.option('booking-mode', { type: 'string', choices: BOOKING_MODES, describe: 'StaffSchedule | TableCapacity | SeatCapacity' })
|
|
195
|
+
.option('turn-minutes', { type: 'number', describe: 'Default minutes a party occupies a table' })
|
|
196
|
+
.option('turn-minutes-by-size', { type: 'string', describe: 'JSON turn time by party size, e.g. {"1-2":60,"3-5":90,"6+":120} (pass "" to clear on update)' })
|
|
197
|
+
.option('buffer-before', { type: 'number', describe: 'Minutes held free before each booking' })
|
|
198
|
+
.option('buffer-after', { type: 'number', describe: 'Minutes held free after each booking' })
|
|
199
|
+
.option('allow-table-combining', { type: 'boolean', describe: 'Allow combining tables in a combine group' })
|
|
200
|
+
.option('min-party', { type: 'number', describe: 'Smallest party accepted' })
|
|
201
|
+
.option('max-party', { type: 'number', describe: 'Largest party accepted' }),
|
|
160
202
|
handler: runCommand(async argv => {
|
|
161
203
|
const service = await messagingPost('/BookableServices', {
|
|
204
|
+
...serviceModeBody(argv),
|
|
162
205
|
name: argv.name,
|
|
163
206
|
durationMinutes: argv.duration,
|
|
164
207
|
defaultCapacity: argv.capacity,
|
|
@@ -179,9 +222,18 @@ export const bookingCommand = {
|
|
|
179
222
|
.option('capacity', { type: 'number', describe: 'New default seats per slot' })
|
|
180
223
|
.option('requires-resource', { type: 'boolean', describe: 'New requires-resource flag' })
|
|
181
224
|
.option('category', { type: 'string', describe: 'New category (pass "" to clear)' })
|
|
182
|
-
.option('active', { type: 'boolean', describe: 'New active state' })
|
|
225
|
+
.option('active', { type: 'boolean', describe: 'New active state' })
|
|
226
|
+
.option('booking-mode', { type: 'string', choices: BOOKING_MODES, describe: 'StaffSchedule | TableCapacity | SeatCapacity' })
|
|
227
|
+
.option('turn-minutes', { type: 'number', describe: 'Default minutes a party occupies a table' })
|
|
228
|
+
.option('turn-minutes-by-size', { type: 'string', describe: 'JSON turn time by party size, e.g. {"1-2":60,"3-5":90,"6+":120} (pass "" to clear on update)' })
|
|
229
|
+
.option('buffer-before', { type: 'number', describe: 'Minutes held free before each booking' })
|
|
230
|
+
.option('buffer-after', { type: 'number', describe: 'Minutes held free after each booking' })
|
|
231
|
+
.option('allow-table-combining', { type: 'boolean', describe: 'Allow combining tables in a combine group' })
|
|
232
|
+
.option('min-party', { type: 'number', describe: 'Smallest party accepted' })
|
|
233
|
+
.option('max-party', { type: 'number', describe: 'Largest party accepted' }),
|
|
183
234
|
handler: runCommand(async argv => {
|
|
184
235
|
const service = await messagingPut(`/BookableServices/${argv.id}`, {
|
|
236
|
+
...serviceModeBody(argv),
|
|
185
237
|
name: argv.name,
|
|
186
238
|
durationMinutes: argv.duration,
|
|
187
239
|
defaultCapacity: argv.capacity,
|
|
@@ -1,58 +1,53 @@
|
|
|
1
|
-
// CLI halves of the MCP parity tools in mcp/parity/endpoints.customer.js and endpoints.staff.js.
|
|
2
|
-
// Each handler names the controller action it calls.
|
|
3
|
-
import { request } from '../api.js';
|
|
4
|
-
|
|
5
|
-
const show = (r) => console.log(JSON.stringify(r, null, 2));
|
|
6
|
-
const int = (y, k, d) => y.option(k, { type: 'number', demandOption: true, describe: d });
|
|
7
|
-
|
|
8
|
-
export const recycleBinCommand = {
|
|
9
|
-
command: 'recycle-bin',
|
|
10
|
-
describe: 'List and restore soft-deleted contact lists, members, segments and KB articles/topics (one id at a time)',
|
|
11
|
-
builder: (y) => y
|
|
12
|
-
.command({ command: 'contact-lists', describe: 'List deleted contact lists', handler: async () => show(await request('GET', '/ContactLists/deleted')) }) // controller action: GetDeletedLists
|
|
13
|
-
.command({ command: 'restore-contact-list', describe: 'Restore one contact list', builder: (z) => int(z, 'id', 'List id'), handler: async (a) => show(await request('POST', `/ContactLists/${a.id}/restore`)) }) // controller action: RestoreList
|
|
14
|
-
.command({ command: 'members', describe: 'List deleted members of a list', builder: (z) => int(z, 'list', 'List id'), handler: async (a) => show(await request('GET', `/ContactLists/${a.list}/Members/deleted`)) }) // controller action: GetDeletedMembers
|
|
15
|
-
.command({ command: 'restore-member', describe: 'Restore one list member', builder: (z) => int(int(z, 'list', 'List id'), 'member', 'Member id'), handler: async (a) => show(await request('POST', `/ContactLists/${a.list}/Members/${a.member}/restore`)) }) // controller action: RestoreMember
|
|
16
|
-
.command({ command: 'segments', describe: 'List deleted segments', handler: async () => show(await request('GET', '/ContactSegments/deleted')) }) // controller action: ListDeleted (ContactSegments)
|
|
17
|
-
.command({ command: 'kb-articles', describe: 'List deleted KB articles', handler: async () => show(await request('GET', '/api/kb/articles/deleted')) }) // controller action: ListDeleted (KBArticles)
|
|
18
|
-
.command({ command: 'restore-kb-article', describe: 'Restore one KB article', builder: (z) => int(z, 'id', 'Article id'), handler: async (a) => show(await request('POST', `/api/kb/articles/${a.id}/restore`)) }) // controller action: RestoreDeleted (KBArticles)
|
|
19
|
-
.command({ command: 'kb-topics', describe: 'List deleted KB topics', handler: async () => show(await request('GET', '/api/kb/topics/deleted')) }) // controller action: ListDeleted (KBTopics)
|
|
20
|
-
.command({ command: 'restore-kb-topic', describe: 'Restore one KB topic', builder: (z) => int(z, 'id', 'Topic id'), handler: async (a) => show(await request('POST', `/api/kb/topics/${a.id}/restore`)) }) // controller action: RestoreDeleted (KBTopics)
|
|
21
|
-
.demandCommand(1),
|
|
22
|
-
handler: () => {},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const aiUsageCommand = {
|
|
26
|
-
command: 'ai-usage',
|
|
27
|
-
describe: 'Your site AI usage summary and budget alert',
|
|
28
|
-
builder: (y) => y
|
|
29
|
-
.command({ command: 'summary', describe: 'AI usage summary', handler: async () => show(await request('GET', '/AiUsageReport/summary')) }) // controller action: GetSummary
|
|
30
|
-
.command({
|
|
31
|
-
command: 'budget-alert-set', describe: 'Update the budget alert',
|
|
32
|
-
builder: (z) => z.option('enabled', { type: 'boolean' }).option('threshold-percent', { type: 'number' }).option('recipients', { type: 'string', describe: 'Comma-separated emails' }),
|
|
33
|
-
handler: async (a) => show(await request('PUT', '/AiUsageReport/budget-alert', { enabled: a.enabled, thresholdPercent: a.thresholdPercent, recipientEmails: a.recipients })), // controller action: UpdateBudgetAlert
|
|
34
|
-
})
|
|
35
|
-
.command({ command: 'budget-alert-delete', describe: 'Delete the budget alert', handler: async () => show(await request('DELETE', '/AiUsageReport/budget-alert')) }) // controller action: DeleteBudgetAlert
|
|
36
|
-
.demandCommand(1),
|
|
37
|
-
handler: () => {},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const siteInfoCommand = {
|
|
41
|
-
command: 'site-info',
|
|
42
|
-
describe: 'Read-only site settings, entitlements and platform uptime for your site',
|
|
43
|
-
builder: (y) => y
|
|
44
|
-
.command({ command: 'settings', describe: 'Site settings', handler: async () => show(await request('GET', '/api/SiteSettings')) }) // controller action: GetSiteSettings
|
|
45
|
-
.command({ command: 'entitlements', describe: 'Your resolved entitlements', handler: async () => show(await request('GET', '/Entitlements/my')) }) // controller action: GetMyEntitlements
|
|
46
|
-
.command({ command: 'uptime', describe: 'Platform uptime', handler: async () => show(await request('GET', '/PlatformUptime')) }) // controller action: GetAsync (PlatformUptime)
|
|
47
|
-
.command({ command: 'last-copilot-session', describe: 'Your last Copilot session summary', handler: async () => show(await request('GET', '/Copilot/LastSession')) }) // controller action: LastSession
|
|
48
|
-
.command({ command: 'sender-domain-health', describe: 'Sender domain health', handler: async () => show(await request('GET', '/SenderDomains/Health')) }) // controller action: GetHealth
|
|
49
|
-
.command({ command: 'netsuite-interaction-summary', describe: 'NetSuite AI interaction summary for a conversation', builder: (z) => int(z, 'conversation', 'Conversation id'), handler: async (a) => show(await request('POST', `/NetSuite/interaction-summary?conversationId=${a.conversation}`)) }) // controller action: GetInteractionSummary
|
|
50
|
-
.demandCommand(1),
|
|
51
|
-
handler: () => {},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const billingReceiptsCommand = {
|
|
55
|
-
command: 'billing-receipts-run',
|
|
56
|
-
describe: 'Staff only: run the payment receipt job now',
|
|
57
|
-
handler: async () => show(await request('POST', '/api/BillingNotifications/receipts/run-now')), // controller action: RunReceiptsNow
|
|
58
|
-
};
|
|
1
|
+
// CLI halves of the MCP parity tools in mcp/parity/endpoints.customer.js and endpoints.staff.js.
|
|
2
|
+
// Each handler names the controller action it calls.
|
|
3
|
+
import { request } from '../api.js';
|
|
4
|
+
|
|
5
|
+
const show = (r) => console.log(JSON.stringify(r, null, 2));
|
|
6
|
+
const int = (y, k, d) => y.option(k, { type: 'number', demandOption: true, describe: d });
|
|
7
|
+
|
|
8
|
+
export const recycleBinCommand = {
|
|
9
|
+
command: 'recycle-bin',
|
|
10
|
+
describe: 'List and restore soft-deleted contact lists, members, segments and KB articles/topics (one id at a time)',
|
|
11
|
+
builder: (y) => y
|
|
12
|
+
.command({ command: 'contact-lists', describe: 'List deleted contact lists', handler: async () => show(await request('GET', '/ContactLists/deleted')) }) // controller action: GetDeletedLists
|
|
13
|
+
.command({ command: 'restore-contact-list', describe: 'Restore one contact list', builder: (z) => int(z, 'id', 'List id'), handler: async (a) => show(await request('POST', `/ContactLists/${a.id}/restore`)) }) // controller action: RestoreList
|
|
14
|
+
.command({ command: 'members', describe: 'List deleted members of a list', builder: (z) => int(z, 'list', 'List id'), handler: async (a) => show(await request('GET', `/ContactLists/${a.list}/Members/deleted`)) }) // controller action: GetDeletedMembers
|
|
15
|
+
.command({ command: 'restore-member', describe: 'Restore one list member', builder: (z) => int(int(z, 'list', 'List id'), 'member', 'Member id'), handler: async (a) => show(await request('POST', `/ContactLists/${a.list}/Members/${a.member}/restore`)) }) // controller action: RestoreMember
|
|
16
|
+
.command({ command: 'segments', describe: 'List deleted segments', handler: async () => show(await request('GET', '/ContactSegments/deleted')) }) // controller action: ListDeleted (ContactSegments)
|
|
17
|
+
.command({ command: 'kb-articles', describe: 'List deleted KB articles', handler: async () => show(await request('GET', '/api/kb/articles/deleted')) }) // controller action: ListDeleted (KBArticles)
|
|
18
|
+
.command({ command: 'restore-kb-article', describe: 'Restore one KB article', builder: (z) => int(z, 'id', 'Article id'), handler: async (a) => show(await request('POST', `/api/kb/articles/${a.id}/restore`)) }) // controller action: RestoreDeleted (KBArticles)
|
|
19
|
+
.command({ command: 'kb-topics', describe: 'List deleted KB topics', handler: async () => show(await request('GET', '/api/kb/topics/deleted')) }) // controller action: ListDeleted (KBTopics)
|
|
20
|
+
.command({ command: 'restore-kb-topic', describe: 'Restore one KB topic', builder: (z) => int(z, 'id', 'Topic id'), handler: async (a) => show(await request('POST', `/api/kb/topics/${a.id}/restore`)) }) // controller action: RestoreDeleted (KBTopics)
|
|
21
|
+
.demandCommand(1),
|
|
22
|
+
handler: () => {},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const aiUsageCommand = {
|
|
26
|
+
command: 'ai-usage',
|
|
27
|
+
describe: 'Your site AI usage summary and budget alert',
|
|
28
|
+
builder: (y) => y
|
|
29
|
+
.command({ command: 'summary', describe: 'AI usage summary', handler: async () => show(await request('GET', '/AiUsageReport/summary')) }) // controller action: GetSummary
|
|
30
|
+
.command({
|
|
31
|
+
command: 'budget-alert-set', describe: 'Update the budget alert',
|
|
32
|
+
builder: (z) => z.option('enabled', { type: 'boolean' }).option('threshold-percent', { type: 'number' }).option('recipients', { type: 'string', describe: 'Comma-separated emails' }),
|
|
33
|
+
handler: async (a) => show(await request('PUT', '/AiUsageReport/budget-alert', { enabled: a.enabled, thresholdPercent: a.thresholdPercent, recipientEmails: a.recipients })), // controller action: UpdateBudgetAlert
|
|
34
|
+
})
|
|
35
|
+
.command({ command: 'budget-alert-delete', describe: 'Delete the budget alert', handler: async () => show(await request('DELETE', '/AiUsageReport/budget-alert')) }) // controller action: DeleteBudgetAlert
|
|
36
|
+
.demandCommand(1),
|
|
37
|
+
handler: () => {},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const siteInfoCommand = {
|
|
41
|
+
command: 'site-info',
|
|
42
|
+
describe: 'Read-only site settings, entitlements and platform uptime for your site',
|
|
43
|
+
builder: (y) => y
|
|
44
|
+
.command({ command: 'settings', describe: 'Site settings', handler: async () => show(await request('GET', '/api/SiteSettings')) }) // controller action: GetSiteSettings
|
|
45
|
+
.command({ command: 'entitlements', describe: 'Your resolved entitlements', handler: async () => show(await request('GET', '/Entitlements/my')) }) // controller action: GetMyEntitlements
|
|
46
|
+
.command({ command: 'uptime', describe: 'Platform uptime', handler: async () => show(await request('GET', '/PlatformUptime')) }) // controller action: GetAsync (PlatformUptime)
|
|
47
|
+
.command({ command: 'last-copilot-session', describe: 'Your last Copilot session summary', handler: async () => show(await request('GET', '/Copilot/LastSession')) }) // controller action: LastSession
|
|
48
|
+
.command({ command: 'sender-domain-health', describe: 'Sender domain health', handler: async () => show(await request('GET', '/SenderDomains/Health')) }) // controller action: GetHealth
|
|
49
|
+
.command({ command: 'netsuite-interaction-summary', describe: 'NetSuite AI interaction summary for a conversation', builder: (z) => int(z, 'conversation', 'Conversation id'), handler: async (a) => show(await request('POST', `/NetSuite/interaction-summary?conversationId=${a.conversation}`)) }) // controller action: GetInteractionSummary
|
|
50
|
+
.demandCommand(1),
|
|
51
|
+
handler: () => {},
|
|
52
|
+
};
|
|
53
|
+
|
package/lib/commands/index.js
CHANGED
|
@@ -119,46 +119,6 @@ const listCommand = {
|
|
|
119
119
|
},
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
-
// ── site (restricted, enforced server-side) ──────────────────────────────────────────────────
|
|
123
|
-
|
|
124
|
-
const siteCommand = {
|
|
125
|
-
command: 'site <siteId>',
|
|
126
|
-
describe: 'Show index breakdown for a specific site (restricted, enforced server-side)',
|
|
127
|
-
handler: async (argv) => {
|
|
128
|
-
const creds = await getCredentials();
|
|
129
|
-
if (!isVelaroAdmin(creds)) {
|
|
130
|
-
console.error('This command is restricted, enforced server-side.');
|
|
131
|
-
process.exit(1);
|
|
132
|
-
}
|
|
133
|
-
const data = await get(`/DatabaseTool/SearchIndexSite?siteId=${argv.siteId}`);
|
|
134
|
-
console.log(`\nSite ${argv.siteId} → \x1b[36m${data.physicalIndex}\x1b[0m [${data.assignmentType}]`);
|
|
135
|
-
console.log(`Total docs: ${data.totalDocuments.toLocaleString()}\n`);
|
|
136
|
-
for (const t of data.indexTypes) {
|
|
137
|
-
console.log(` ${t.indexName.padEnd(40)} ${t.count.toLocaleString()} docs`);
|
|
138
|
-
}
|
|
139
|
-
console.log('');
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
// ── provision (restricted, enforced server-side) ─────────────────────────────────────────────
|
|
144
|
-
|
|
145
|
-
const provisionCommand = {
|
|
146
|
-
command: 'provision <siteId>',
|
|
147
|
-
describe: 'Provision a dedicated physical index for a site (restricted, enforced server-side)',
|
|
148
|
-
handler: async (argv) => {
|
|
149
|
-
const creds = await getCredentials();
|
|
150
|
-
if (!isVelaroAdmin(creds)) {
|
|
151
|
-
console.error('This command is restricted, enforced server-side.');
|
|
152
|
-
process.exit(1);
|
|
153
|
-
}
|
|
154
|
-
console.log(`Provisioning dedicated index for site ${argv.siteId}...`);
|
|
155
|
-
const result = await post('/DatabaseTool/ProvisionDedicatedIndex', { SiteId: argv.siteId });
|
|
156
|
-
console.log(`\x1b[32m✓ ${result.message}\x1b[0m`);
|
|
157
|
-
console.log(` Index: \x1b[36m${result.indexName}\x1b[0m`);
|
|
158
|
-
console.log('\nNote: Re-ingest content to populate the new index.');
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
|
|
162
122
|
// ── reingest (customer-facing, credit-gated) ──────────────────────────────────
|
|
163
123
|
|
|
164
124
|
const reingestCommand = {
|
|
@@ -248,12 +208,10 @@ export const indexCommand = {
|
|
|
248
208
|
builder: (yargs) =>
|
|
249
209
|
yargs
|
|
250
210
|
.command(listCommand)
|
|
251
|
-
.command(siteCommand)
|
|
252
|
-
.command(provisionCommand)
|
|
253
211
|
.command(reingestCommand)
|
|
254
212
|
.command(testCommand)
|
|
255
213
|
// Restricted subcommands (create, profile) exist only in the unpublished staff build.
|
|
256
214
|
.command(staffIndex?.restrictedCommands ? staffIndex.restrictedCommands() : [])
|
|
257
|
-
.demandCommand(1, 'Specify a subcommand: list,
|
|
215
|
+
.demandCommand(1, 'Specify a subcommand: list, reingest, test'),
|
|
258
216
|
handler: () => {},
|
|
259
217
|
};
|
package/lib/commands/ingest.js
CHANGED
|
@@ -1,36 +1,63 @@
|
|
|
1
|
-
import { getCredentials, messagingPost } from '../api.js';
|
|
2
|
-
import { runCommand } from '../run.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
import { getCredentials, messagingPost, request } from '../api.js';
|
|
2
|
+
import { runCommand } from '../run.js';
|
|
3
|
+
|
|
4
|
+
const JOB_ID_RE = /^[A-Za-z0-9][A-Za-z0-9_-]{5,}$/;
|
|
5
|
+
|
|
6
|
+
/** Resolve the job id from `ingest status <id>`, `ingest <id>` or --job-id. */
|
|
7
|
+
export function resolveJobId(argv) {
|
|
8
|
+
const positional = [argv.action, argv.jobId].filter((v) => v !== undefined && v !== null && v !== '' && v !== 'status' && v !== 'start');
|
|
9
|
+
return String(argv['job-id'] ?? positional[0] ?? '');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Look the job up on the scraper before doing anything with it. A 404 (or empty body) means the job does not
|
|
14
|
+
* exist for this site and is reported as not found. `fetcher` is injectable for tests.
|
|
15
|
+
*/
|
|
16
|
+
export async function assertJobExists(jobId, fetcher = request) {
|
|
17
|
+
let res;
|
|
18
|
+
try {
|
|
19
|
+
res = await fetcher('GET', `/ScraperJobs/Jobs/${encodeURIComponent(jobId)}/Results`);
|
|
20
|
+
} catch (e) {
|
|
21
|
+
if (/→ (404|400)\b/.test(String(e.message))) throw new Error(`Job ${jobId} was not found for your site; nothing was started.`);
|
|
22
|
+
throw e;
|
|
23
|
+
}
|
|
24
|
+
if (res === null || res === undefined) throw new Error(`Job ${jobId} was not found for your site; nothing was started.`);
|
|
25
|
+
return res;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const ingestCommand = {
|
|
29
|
+
command: 'ingest [action] [jobId]',
|
|
30
|
+
describe: 'Trigger knowledge base ingestion for a completed scraper job (ingest status <jobId> only checks the job)',
|
|
31
|
+
builder: (y) =>
|
|
32
|
+
y.positional('action', { describe: '"status" to only check a job, omit to start ingestion', type: 'string' })
|
|
33
|
+
.positional('jobId', { describe: 'Scraper job ID', type: 'string' })
|
|
34
|
+
.option('job-id', { describe: 'Scraper job ID to ingest', type: 'string' }),
|
|
35
|
+
|
|
36
|
+
handler: runCommand(async (argv) => {
|
|
37
|
+
const jobId = resolveJobId(argv);
|
|
38
|
+
if (!jobId) throw new Error('A scraper job id is required: velaro ingest <jobId> or velaro ingest status <jobId>.');
|
|
39
|
+
if (!JOB_ID_RE.test(jobId)) throw new Error(`"${jobId}" is not a valid scraper job id.`);
|
|
40
|
+
const statusOnly = argv.action === 'status';
|
|
41
|
+
|
|
42
|
+
const creds = await getCredentials();
|
|
43
|
+
|
|
44
|
+
// Unknown ids fail here with a non-zero exit, never "Ingestion started".
|
|
45
|
+
const job = await assertJobExists(jobId);
|
|
46
|
+
if (statusOnly) {
|
|
47
|
+
console.log(`Job ${jobId} found for site ${creds.siteId}.`);
|
|
48
|
+
console.log(JSON.stringify(job, null, 2).slice(0, 2000));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
console.log(`Triggering ingestion for job ${jobId} on site ${creds.siteId}...`);
|
|
53
|
+
|
|
54
|
+
// AzureIndexesController (IngestJobDirect) lives on the MESSAGING api; the admin api has no such route.
|
|
55
|
+
const result = await messagingPost('/AzureIndexes/IngestJobDirect', { siteId: creds.siteId, jobId });
|
|
56
|
+
|
|
57
|
+
if (!result?.jobId) throw new Error(`Job ${jobId} was not found or could not be ingested; nothing was started.`);
|
|
58
|
+
console.log('Ingestion started.');
|
|
59
|
+
console.log(` Job ID: ${result.jobId}`);
|
|
60
|
+
console.log(` Index: ${result.physicalIndex}`);
|
|
61
|
+
console.log('\nEmbedding runs in the background. Check logs for completion.');
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { assertJobExists, resolveJobId } from './ingest.js';
|
|
4
|
+
|
|
5
|
+
test('unknown job (404) is reported as not found', async () => {
|
|
6
|
+
const f = async () => { throw new Error('GET /x → 404: {}'); };
|
|
7
|
+
await assert.rejects(() => assertJobExists('fake-id-123', f), /was not found/);
|
|
8
|
+
});
|
|
9
|
+
test('empty body is not found', async () => {
|
|
10
|
+
await assert.rejects(() => assertJobExists('fake-id-123', async () => null), /was not found/);
|
|
11
|
+
});
|
|
12
|
+
test('other errors propagate unchanged', async () => {
|
|
13
|
+
await assert.rejects(() => assertJobExists('abcdef', async () => { throw new Error('GET /x → 500: boom'); }), /500/);
|
|
14
|
+
});
|
|
15
|
+
test('existing job passes', async () => {
|
|
16
|
+
assert.deepEqual(await assertJobExists('abcdef', async () => ({ ok: 1 })), { ok: 1 });
|
|
17
|
+
});
|
|
18
|
+
test('resolveJobId handles status positional and --job-id', () => {
|
|
19
|
+
assert.equal(resolveJobId({ action: 'status', jobId: 'abc123' }), 'abc123');
|
|
20
|
+
assert.equal(resolveJobId({ action: 'abc123' }), 'abc123');
|
|
21
|
+
assert.equal(resolveJobId({ 'job-id': 'zzz999' }), 'zzz999');
|
|
22
|
+
});
|
package/lib/commands/mcp-key.js
CHANGED
|
@@ -6,6 +6,16 @@ import { getActiveEnv, ENVS } from '../config.js';
|
|
|
6
6
|
import { runCommand } from '../run.js';
|
|
7
7
|
import { confirmDestructive } from '../confirm.js';
|
|
8
8
|
|
|
9
|
+
// Scopes the server grants on key creation (McpApiKeysController.GrantableScopes).
|
|
10
|
+
export const GRANTABLE_SCOPES = ['admin'];
|
|
11
|
+
|
|
12
|
+
export function parseScopes(value) {
|
|
13
|
+
const scopes = String(value).split(',').map((s) => s.trim().toLowerCase()).filter(Boolean);
|
|
14
|
+
const bad = scopes.filter((s) => !GRANTABLE_SCOPES.includes(s));
|
|
15
|
+
if (bad.length) throw new Error(`Unknown scope: ${bad.join(', ')}. Allowed scopes: ${GRANTABLE_SCOPES.join(', ')}.`);
|
|
16
|
+
return [...new Set(scopes)];
|
|
17
|
+
}
|
|
18
|
+
|
|
9
19
|
// The API returns { keys, monthlyLimit }; older deployments returned an array.
|
|
10
20
|
// Fail on any other shape so a contract change cannot appear as an empty list.
|
|
11
21
|
export function normalizeMcpKeysResponse(response) {
|
|
@@ -76,7 +86,7 @@ const mcpKeyCreateCommand = {
|
|
|
76
86
|
if (when.getTime() <= Date.now()) throw new Error(`--expires "${argv.expires}" is in the past. Choose a future date.`);
|
|
77
87
|
payload.expiresAt = when.toISOString();
|
|
78
88
|
}
|
|
79
|
-
if (argv.scopes) payload.scopes =
|
|
89
|
+
if (argv.scopes) payload.scopes = parseScopes(argv.scopes);
|
|
80
90
|
|
|
81
91
|
const result = await post('/McpApiKeys', payload);
|
|
82
92
|
console.log(`MCP key created: ${result.label}`);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { parseScopes, GRANTABLE_SCOPES } from './mcp-key.js';
|
|
4
|
+
|
|
5
|
+
test('parseScopes accepts admin, trims, lowercases and de-duplicates', () => {
|
|
6
|
+
assert.deepEqual(parseScopes(' Admin , admin '), ['admin']);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test('parseScopes rejects an unknown scope with the allowed list', () => {
|
|
10
|
+
assert.throws(() => parseScopes('admin,root'), (e) => /Unknown scope: root/.test(e.message) && e.message.includes(GRANTABLE_SCOPES.join(', ')));
|
|
11
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// velaro package-builder my: customer-safe read of the caller's own package and what it includes.
|
|
2
|
+
// Server: PackageBuilderController.My (server/Velaro.Admin/Controllers/PackageBuilderController.cs) takes the site from the
|
|
3
|
+
// authenticated session and returns no prices, keys or staff data. All other package-builder actions are staff-gated and live in cli/staff.
|
|
4
|
+
import { request } from '../api.js';
|
|
5
|
+
|
|
6
|
+
export const packageBuilderMyCommand = {
|
|
7
|
+
command: 'package-builder',
|
|
8
|
+
describe: 'Your own package and what it includes',
|
|
9
|
+
builder: (y) => y
|
|
10
|
+
.command('my', 'Your own package and what it includes', () => {}, async () => console.log(JSON.stringify(await request('GET', '/PackageBuilder/my'), null, 2)))
|
|
11
|
+
.demandCommand(1, 'Specify a subcommand: my'),
|
|
12
|
+
handler: () => {},
|
|
13
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Gate: the public @velaro/cli (cli/ minus cli/staff) may only expose top-level commands on the explicit customer-safe allowlist
|
|
2
|
+
// scripts/cli-customer-command-allowlist.json, and never a staff command name. A new command defaults to cli/staff until allowlisted.
|
|
3
|
+
// Regenerate the allowlist deliberately: CLI_ALLOWLIST_PRINT=1 node --test lib/public-help.test.js (prints the current names).
|
|
4
|
+
import { test } from 'node:test';
|
|
5
|
+
import assert from 'node:assert/strict';
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { execFileSync } from 'node:child_process';
|
|
10
|
+
|
|
11
|
+
const cli = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
12
|
+
const root = path.resolve(cli, '..');
|
|
13
|
+
|
|
14
|
+
export function publicCommandNames() {
|
|
15
|
+
const tmp = path.join(cli, '.pubcheck-test');
|
|
16
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
17
|
+
fs.mkdirSync(tmp);
|
|
18
|
+
try {
|
|
19
|
+
for (const d of ['bin', 'lib', 'scripts']) fs.cpSync(path.join(cli, d), path.join(tmp, d), { recursive: true });
|
|
20
|
+
fs.copyFileSync(path.join(cli, 'package.json'), path.join(tmp, 'package.json'));
|
|
21
|
+
const out = execFileSync(process.execPath, [path.join(tmp, 'bin', 'velaro.js'), '--help'], { encoding: 'utf8' });
|
|
22
|
+
return [...new Set(out.split('\n').map((l) => /^ {2}velaro (\S+)/.exec(l)?.[1]).filter(Boolean))].sort();
|
|
23
|
+
} finally { fs.rmSync(tmp, { recursive: true, force: true }); }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
test('public velaro --help exposes only allowlisted, non-staff commands', () => {
|
|
27
|
+
const names = publicCommandNames();
|
|
28
|
+
if (process.env.CLI_ALLOWLIST_PRINT) console.log(JSON.stringify(names));
|
|
29
|
+
const allow = JSON.parse(fs.readFileSync(path.join(root, 'scripts', 'cli-customer-command-allowlist.json'), 'utf8')).commands;
|
|
30
|
+
const staff = JSON.parse(fs.readFileSync(path.join(root, 'scripts', 'cli-staff-command-names.json'), 'utf8')).staffCommandNames;
|
|
31
|
+
assert.ok(names.length > 50, 'could not parse help output');
|
|
32
|
+
for (const n of names) assert.ok(!staff.includes(n), `staff command "${n}" is in the public help`);
|
|
33
|
+
const extra = names.filter((n) => !allow.includes(n));
|
|
34
|
+
assert.deepEqual(extra, [], `commands not on cli-customer-command-allowlist.json (put staff commands in cli/staff, or allowlist with a documented server gate): ${extra.join(', ')}`);
|
|
35
|
+
});
|