@velaro/cli 0.1.1 → 0.1.2

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
@@ -8,6 +8,10 @@ import { botCommand } from '../lib/commands/bot.js';
8
8
  import { ingestCommand } from '../lib/commands/ingest.js';
9
9
  import { mcpKeyCommand } from '../lib/commands/mcp-key.js';
10
10
  import { statusCommand } from '../lib/commands/status.js';
11
+ import { siteCommand } from '../lib/commands/site.js';
12
+ import { workflowCommand } from '../lib/commands/workflow.js';
13
+ import { ruleCommand } from '../lib/commands/rule.js';
14
+ import { agentCommand } from '../lib/commands/agent.js';
11
15
 
12
16
  yargs(hideBin(process.argv))
13
17
  .scriptName('velaro')
@@ -15,7 +19,11 @@ yargs(hideBin(process.argv))
15
19
  .command(loginCommand)
16
20
  .command(logoutCommand)
17
21
  .command(whoamiCommand)
22
+ .command(siteCommand)
18
23
  .command(botCommand)
24
+ .command(workflowCommand)
25
+ .command(ruleCommand)
26
+ .command(agentCommand)
19
27
  .command(ingestCommand)
20
28
  .command(mcpKeyCommand)
21
29
  .command(statusCommand)
@@ -0,0 +1,50 @@
1
+ import { get, post } from '../api.js';
2
+ import { runCommand } from '../run.js';
3
+
4
+ const VALID_STATUSES = ['Available', 'Away', 'Offline'];
5
+
6
+ export const agentCommand = {
7
+ command: 'agent <subcommand>',
8
+ describe: 'View and manage agents',
9
+ builder: (yargs) => yargs
10
+ .command({
11
+ command: 'list',
12
+ describe: 'List agents and their current availability',
13
+ handler: runCommand(async () => {
14
+ const [agents, teams] = await Promise.all([
15
+ get('/Users/List'),
16
+ get('/Teams/List'),
17
+ ]);
18
+
19
+ const teamMap = Object.fromEntries(teams.map(t => [t.id, t.name]));
20
+
21
+ if (!agents.length) { console.log('No agents found.'); return; }
22
+
23
+ const rows = agents.map(a => ({
24
+ id: `[${a.id}]`,
25
+ status: (a.status ?? 'Offline').padEnd(9),
26
+ name: a.displayName || `${a.firstName} ${a.lastName}`.trim() || a.email,
27
+ teams: (a.teamIds ?? []).map(id => teamMap[id] ?? `team ${id}`).join(', ') || '—',
28
+ }));
29
+
30
+ const idW = Math.max(...rows.map(r => r.id.length));
31
+
32
+ for (const r of rows) {
33
+ console.log(`${r.id.padStart(idW)} ${r.status} ${r.name.padEnd(30)} ${r.teams}`);
34
+ }
35
+ console.log(`\n${rows.length} agent(s)`);
36
+ }),
37
+ })
38
+ .command({
39
+ command: 'set-status',
40
+ describe: 'Set an agent\'s availability status (admin only)',
41
+ builder: (y) => y
42
+ .option('id', { type: 'number', demandOption: true, describe: 'Agent user ID' })
43
+ .option('status', { type: 'string', demandOption: true, describe: 'Available | Away | Offline', choices: VALID_STATUSES }),
44
+ handler: runCommand(async (argv) => {
45
+ await post('/UserStatus/admin', { userId: argv.id, status: argv.status });
46
+ console.log(`Agent ${argv.id} set to ${argv.status}.`);
47
+ }),
48
+ })
49
+ .demandCommand(1, 'Specify a subcommand: list | set-status'),
50
+ };
@@ -0,0 +1,28 @@
1
+ import { get } from '../api.js';
2
+ import { runCommand } from '../run.js';
3
+
4
+ export const ruleCommand = {
5
+ command: 'rule <subcommand>',
6
+ describe: 'Manage routing rules',
7
+ builder: (yargs) => yargs
8
+ .command({
9
+ command: 'list',
10
+ describe: 'List all routing rules',
11
+ handler: runCommand(async () => {
12
+ const rules = await get('/Rules/List');
13
+ if (!rules.length) { console.log('No routing rules found.'); return; }
14
+
15
+ const sorted = [...rules].sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));
16
+ const idW = Math.max(...sorted.map(r => String(r.id).length + 2));
17
+
18
+ for (const r of sorted) {
19
+ const id = `[${r.id}]`.padStart(idW);
20
+ const pri = `priority ${r.priority ?? 0}`;
21
+ const trigger = r.trigger ?? '—';
22
+ console.log(`${id} ${pri} ${trigger}`);
23
+ }
24
+ console.log(`\n${sorted.length} rule(s)`);
25
+ }),
26
+ })
27
+ .demandCommand(1, 'Specify a subcommand: list'),
28
+ };
@@ -0,0 +1,62 @@
1
+ import { get } from '../api.js';
2
+ import { runCommand } from '../run.js';
3
+
4
+ const FEATURE_MAP = {
5
+ enableWeb: 'Web Chat',
6
+ enableSms: 'SMS',
7
+ enableEmail: 'Email',
8
+ enableWhatsapp: 'WhatsApp',
9
+ enableIvr: 'IVR / Voice',
10
+ enableFacebook: 'Facebook Messenger',
11
+ enableInstagram: 'Instagram',
12
+ enableAI: 'AI Bots',
13
+ enableKnowledgeBase: 'Knowledge Base',
14
+ enableAutomation: 'Workflows',
15
+ enableWorkflowRules: 'Routing Rules',
16
+ enableChatTranslations: 'Chat Translation',
17
+ enableVideoChat: 'Video Chat',
18
+ enableTicketing: 'Ticketing',
19
+ enableAgentDashboard: 'Agent Dashboard',
20
+ enableMcpApi: 'MCP API Gateway',
21
+ enableOutboundCampaigns: 'Email Campaigns',
22
+ enableRcs: 'RCS Messaging',
23
+ enablePageWidgets: 'Page Widgets',
24
+ enableVisitorTracking: 'Visitor Tracking',
25
+ };
26
+
27
+ const STATUS_LABEL = { Available: 'online', Away: 'away', Offline: 'offline' };
28
+
29
+ export const siteCommand = {
30
+ command: 'site',
31
+ describe: 'Show site overview: active features and agent availability',
32
+ handler: runCommand(async () => {
33
+ const [sub, agents] = await Promise.all([
34
+ get('/Subscription'),
35
+ get('/Users/List'),
36
+ ]);
37
+
38
+ // Active features — friendly names only, no internal flag names
39
+ const active = Object.entries(FEATURE_MAP)
40
+ .filter(([key]) => sub[key] === true)
41
+ .map(([, label]) => label);
42
+
43
+ console.log('\nActive features:');
44
+ if (active.length) {
45
+ console.log(' ' + active.join(' · '));
46
+ } else {
47
+ console.log(' (none)');
48
+ }
49
+
50
+ if (sub.maxCreatedUsers) {
51
+ console.log(`\nAgent seats: ${sub.maxCreatedUsers} licensed`);
52
+ }
53
+
54
+ // Agent availability summary
55
+ const counts = { online: 0, away: 0, offline: 0 };
56
+ for (const a of agents) {
57
+ const key = STATUS_LABEL[a.status] ?? 'offline';
58
+ counts[key]++;
59
+ }
60
+ console.log(`Agent status: ${counts.online} online · ${counts.away} away · ${counts.offline} offline\n`);
61
+ }),
62
+ };
@@ -0,0 +1,32 @@
1
+ import { get } from '../api.js';
2
+ import { runCommand } from '../run.js';
3
+
4
+ export const workflowCommand = {
5
+ command: 'workflow <subcommand>',
6
+ describe: 'Manage workflows',
7
+ builder: (yargs) => yargs
8
+ .command({
9
+ command: 'list',
10
+ describe: 'List all workflows',
11
+ handler: runCommand(async () => {
12
+ const workflows = await get('/Workflows/List');
13
+ if (!workflows.length) { console.log('No workflows found.'); return; }
14
+
15
+ const rows = workflows.filter(w => !w.isTemplate).map(w => ({
16
+ id: `[${w.id}]`,
17
+ status: w.enabled ? 'enabled ' : 'disabled',
18
+ trigger: w.triggerType ?? '—',
19
+ name: w.name,
20
+ }));
21
+
22
+ const idW = Math.max(...rows.map(r => r.id.length));
23
+ const triggerW = Math.max(...rows.map(r => r.trigger.length));
24
+
25
+ for (const r of rows) {
26
+ console.log(`${r.id.padStart(idW)} ${r.status} ${r.trigger.padEnd(triggerW)} ${r.name}`);
27
+ }
28
+ console.log(`\n${rows.length} workflow(s)`);
29
+ }),
30
+ })
31
+ .demandCommand(1, 'Specify a subcommand: list'),
32
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Velaro Workspace v20 — command-line interface for managing bots, knowledge base ingestion, and MCP API keys.",
5
5
  "type": "module",
6
6
  "bin": {