@velaro/cli 1.4.61 → 1.4.63
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
|
@@ -39,6 +39,8 @@ import { integrationCommand } from '../lib/commands/integration.js';
|
|
|
39
39
|
import { appointmentsCommand } from '../lib/commands/appointments.js';
|
|
40
40
|
import { bookingCommand } from '../lib/commands/booking.js';
|
|
41
41
|
import { reportCommand } from '../lib/commands/report.js';
|
|
42
|
+
import { scheduleAdherenceCommand } from '../lib/commands/schedule-adherence.js';
|
|
43
|
+
import { experienceImpactCommand } from '../lib/commands/experience-impact.js';
|
|
42
44
|
import { conversationEfficiencyCommand } from '../lib/commands/conversation-efficiency.js';
|
|
43
45
|
import { dbCommand } from '../lib/commands/db.js';
|
|
44
46
|
import { focusCommand } from '../lib/commands/focus.js';
|
|
@@ -139,6 +141,8 @@ await yargs(hideBin(process.argv))
|
|
|
139
141
|
.command(bookingCommand)
|
|
140
142
|
.command(reportCommand)
|
|
141
143
|
.command(conversationEfficiencyCommand)
|
|
144
|
+
.command(scheduleAdherenceCommand)
|
|
145
|
+
.command(experienceImpactCommand)
|
|
142
146
|
.command(dbCommand)
|
|
143
147
|
.command(focusCommand)
|
|
144
148
|
.command(automationDraftCommand)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { messagingGet } from '../api.js';
|
|
2
|
+
import { runCommand } from '../run.js';
|
|
3
|
+
|
|
4
|
+
// -- velaro experience-impact ---------------------------------------------------
|
|
5
|
+
// Backend: velaro-messaging GET /Reports/experience-impact?from=&to=&teamId=
|
|
6
|
+
// Site scope comes from the caller's auth, never an argument.
|
|
7
|
+
|
|
8
|
+
export const experienceImpactCommand = {
|
|
9
|
+
command: 'experience-impact',
|
|
10
|
+
describe: 'Experience index (0-100) tying schedule adherence, service level, missed chats and CSAT together',
|
|
11
|
+
builder: (y) => y
|
|
12
|
+
.option('from', { type: 'string', describe: 'yyyy-MM-dd (default: 7 days ago)' })
|
|
13
|
+
.option('to', { type: 'string', describe: 'yyyy-MM-dd (default: today)' })
|
|
14
|
+
.option('team-id', { type: 'number', describe: 'Narrow to one team' })
|
|
15
|
+
.option('json', { type: 'boolean', default: false, describe: 'Raw JSON output' }),
|
|
16
|
+
handler: runCommand(async (argv) => {
|
|
17
|
+
const qs = new URLSearchParams();
|
|
18
|
+
if (argv.from) qs.set('from', argv.from);
|
|
19
|
+
if (argv.to) qs.set('to', argv.to);
|
|
20
|
+
if (argv.teamId) qs.set('teamId', String(argv.teamId));
|
|
21
|
+
const q = qs.toString();
|
|
22
|
+
const d = await messagingGet(`/Reports/experience-impact${q ? `?${q}` : ''}`);
|
|
23
|
+
if (argv.json) { console.log(JSON.stringify(d, null, 2)); return; }
|
|
24
|
+
const s = d.summary ?? {};
|
|
25
|
+
console.log(`\nExperience Impact ${d.range?.from}..${d.range?.to}`);
|
|
26
|
+
console.log(` Experience index: ${s.experienceIndex} / 100`);
|
|
27
|
+
console.log(` Adherence ${s.adherencePct}% | Service level ${s.serviceLevelPct}% | Missed chats ${s.missedChats} | Avg wait ${s.avgWaitSec}s | CSAT ${s.csatAvg ?? '-'} (${s.csatResponses ?? 0})`);
|
|
28
|
+
for (const i of d.insights ?? []) console.log(` [${i.severity}] ${i.text}`);
|
|
29
|
+
for (const a of d.agents ?? []) {
|
|
30
|
+
console.log(` [${a.agentId}] ${a.name}: index ${a.experienceIndex} adherence ${a.adherencePct}% CSAT ${a.csatAvg ?? '-'} handled ${a.handled}`);
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { messagingGet } from '../api.js';
|
|
2
|
+
import { runCommand } from '../run.js';
|
|
3
|
+
|
|
4
|
+
// -- velaro schedule-adherence --------------------------------------------------
|
|
5
|
+
// Staff-only. siteId is an EXPLICIT argument (SupportTools-style), never derived from the caller.
|
|
6
|
+
// Backend: velaro-messaging GET /Reports/sites/{siteId}/schedule-adherence-diagnostics
|
|
7
|
+
// (IsSuperAdminAsync allowSupport gate; role=agent requires agentId, fails closed).
|
|
8
|
+
|
|
9
|
+
export const scheduleAdherenceCommand = {
|
|
10
|
+
command: 'schedule-adherence <siteId>',
|
|
11
|
+
describe: 'Staff: schedule adherence overview/breakdown/intraday/timeline for a site as manager or agent',
|
|
12
|
+
builder: (y) => y
|
|
13
|
+
.positional('siteId', { type: 'number', describe: 'Target customer site ID' })
|
|
14
|
+
.option('role', { type: 'string', choices: ['manager', 'agent'], default: 'manager', describe: 'Scope to apply' })
|
|
15
|
+
.option('agent-id', { type: 'number', describe: 'WorkspaceUser id (required for --role agent)' })
|
|
16
|
+
.option('start', { type: 'string', describe: 'yyyy-MM-dd' })
|
|
17
|
+
.option('end', { type: 'string', describe: 'yyyy-MM-dd' })
|
|
18
|
+
.option('tz', { type: 'string', describe: 'IANA time zone override' })
|
|
19
|
+
.option('json', { type: 'boolean', default: false, describe: 'Raw JSON output' }),
|
|
20
|
+
handler: runCommand(async (argv) => {
|
|
21
|
+
if (argv.role === 'agent' && !argv.agentId) throw new Error('--agent-id is required with --role agent');
|
|
22
|
+
const qs = new URLSearchParams({ detail: 'true', role: argv.role });
|
|
23
|
+
if (argv.agentId) qs.set('agentId', String(argv.agentId));
|
|
24
|
+
for (const k of ['start', 'end', 'tz']) if (argv[k]) qs.set(k, argv[k]);
|
|
25
|
+
const d = await messagingGet(`/Reports/sites/${argv.siteId}/schedule-adherence-diagnostics?${qs}`);
|
|
26
|
+
if (argv.json) { console.log(JSON.stringify(d, null, 2)); return; }
|
|
27
|
+
console.log(`\nSite ${d.siteId} scope=${d.scope} ${d.range?.start}..${d.range?.end} tz=${d.timeZone} invariantsPass=${d.invariantsPass}`);
|
|
28
|
+
console.log(` Totals: sched ${d.totals?.scheduledMinutes}m adherent ${d.totals?.adherentMinutes}m avg ${d.totals?.avgAdherencePercent}%`);
|
|
29
|
+
for (const a of d.agents ?? []) {
|
|
30
|
+
console.log(` [${a.agentId}] ${a.agentName}: ${a.adherencePercent}% status=${a.currentStatus ?? '-'} days=${a.days?.length ?? 0} shiftsToday=${a.timeline?.shifts?.length ?? 0}`);
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
};
|
package/package.json
CHANGED