callkaro-cli-unofficial 0.7.1 → 0.8.0

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.
@@ -15,8 +15,11 @@ exports.waitForBatch = waitForBatch;
15
15
  exports.simRunCommand = simRunCommand;
16
16
  exports.simRunsListCommand = simRunsListCommand;
17
17
  exports.simResultsCommand = simResultsCommand;
18
+ exports.simDraftFromCallCommand = simDraftFromCallCommand;
19
+ exports.simGenerateCommand = simGenerateCommand;
18
20
  const prompts_1 = __importDefault(require("prompts"));
19
21
  const session_1 = require("../lib/session");
22
+ const dashboardApi_1 = require("../lib/dashboardApi");
20
23
  const ui_1 = require("../lib/ui");
21
24
  const jsonInput_1 = require("./jsonInput");
22
25
  /**
@@ -312,3 +315,68 @@ async function simResultsCommand(batchId, opts) {
312
315
  (0, ui_1.handleError)(err);
313
316
  }
314
317
  }
318
+ /** `cku sim draft-from-call <callId>` — AI-draft a test case from a real call. */
319
+ async function simDraftFromCallCommand(callId, opts) {
320
+ try {
321
+ const res = await (0, dashboardApi_1.dashboardApi)().generateSimFromCall({
322
+ callId,
323
+ versionId: opts.version,
324
+ includeMetadata: opts.metadata !== false,
325
+ includeFunctions: opts.functions !== false,
326
+ });
327
+ const draft = res?.draft || res;
328
+ let saved;
329
+ if (opts.save && draft?.agentId) {
330
+ saved = await (0, session_1.requireApi)().createTestCase({
331
+ agentId: draft.agentId,
332
+ testcaseName: draft.testcaseName || `call-${callId}`,
333
+ userPersona: draft.userPersona,
334
+ userPrompt: draft.userPrompt,
335
+ successCriteria: draft.successCriteria,
336
+ testVariables: draft.testVariables || {},
337
+ testFunctions: draft.testFunctions || [],
338
+ });
339
+ }
340
+ if (opts.json)
341
+ return void console.log(JSON.stringify(saved ?? draft, null, 2));
342
+ (0, ui_1.keyValue)({ name: draft?.testcaseName, persona: draft?.userPersona, prompt: draft?.userPrompt, criteria: draft?.successCriteria });
343
+ if (saved)
344
+ (0, ui_1.success)('Test case saved.');
345
+ else if (opts.save)
346
+ (0, ui_1.info)('Draft has no agentId; nothing saved.');
347
+ else
348
+ (0, ui_1.info)('Draft only. Re-run with --save to create it.');
349
+ }
350
+ catch (err) {
351
+ (0, ui_1.handleError)(err);
352
+ }
353
+ }
354
+ /** `cku sim generate <agentId> --hint <text>` — AI-draft a test case from a hint. */
355
+ async function simGenerateCommand(agentId, opts) {
356
+ try {
357
+ const res = await (0, dashboardApi_1.dashboardApi)().generateSimFromPrompt({ agentId, versionId: opts.version, hint: opts.hint });
358
+ const tc = res?.testCase || res;
359
+ let saved;
360
+ if (opts.save) {
361
+ saved = await (0, session_1.requireApi)().createTestCase({
362
+ agentId,
363
+ testcaseName: tc.testcaseName || 'generated-test',
364
+ userPersona: tc.userPersona,
365
+ userPrompt: tc.userPrompt,
366
+ successCriteria: tc.successCriteria,
367
+ testVariables: {},
368
+ testFunctions: [],
369
+ });
370
+ }
371
+ if (opts.json)
372
+ return void console.log(JSON.stringify(saved ?? tc, null, 2));
373
+ (0, ui_1.keyValue)({ name: tc?.testcaseName, persona: tc?.userPersona, prompt: tc?.userPrompt, criteria: tc?.successCriteria });
374
+ if (saved)
375
+ (0, ui_1.success)('Test case saved.');
376
+ else
377
+ (0, ui_1.info)('Draft only. Re-run with --save to create it.');
378
+ }
379
+ catch (err) {
380
+ (0, ui_1.handleError)(err);
381
+ }
382
+ }
package/dist/index.js CHANGED
@@ -34,6 +34,10 @@ const contacts_1 = require("./commands/contacts");
34
34
  const skills_1 = require("./commands/skills");
35
35
  const update_1 = require("./commands/update");
36
36
  const analytics_1 = require("./commands/analytics");
37
+ const dnd_1 = require("./commands/dnd");
38
+ const feedback_1 = require("./commands/feedback");
39
+ const knowledge_1 = require("./commands/knowledge");
40
+ const aiTools_1 = require("./commands/aiTools");
37
41
  const batches_1 = require("./commands/batches");
38
42
  const simulations_1 = require("./commands/simulations");
39
43
  const simVariables_1 = require("./commands/simVariables");
@@ -342,7 +346,8 @@ kpi
342
346
  .command('assign')
343
347
  .description('assign a card to a person, or to AI FDE')
344
348
  .argument('<taskId>', 'task id — quote it in shells')
345
- .requiredOption('--to <who>', 'team member id or name, or "ai_fde"')
349
+ .option('--to <who>', 'team member id or name, or "ai_fde" (required unless --unassign)')
350
+ .option('--unassign', 'unassign the card')
346
351
  .option('--agent <id>', 'agent to change (required for ai_fde)')
347
352
  .option('--versions <ids>', 'destination version ids (required for ai_fde)')
348
353
  .option('--version-names <names>', 'display names for the version ids')
@@ -361,6 +366,89 @@ kpi
361
366
  .addHelpText('after', '\n The server replaces the whole config at once, so an RCA prompt already set on\n' +
362
367
  ' the account is read back and re-sent rather than cleared.\n')
363
368
  .action(kpi_1.kpiTargetCommand);
369
+ kpi
370
+ .command('config <agentId>')
371
+ .description("show or edit an agent's full KPI Manager config (all fields preserved on write)")
372
+ .option('--set <json>', 'JSON patch of top-level fields, or @file.json')
373
+ .option('--enable-rca', 'turn nightly RCA on')
374
+ .option('--disable-rca', 'turn nightly RCA off')
375
+ .option('--enable-report', 'turn the auto report on')
376
+ .option('--disable-report', 'turn the auto report off')
377
+ .option('--rca-model <id>', 'RCA model')
378
+ .option('--rca-prompt <text>', 'RCA prompt')
379
+ .option('--json', 'output raw JSON')
380
+ .action(kpi_1.kpiConfigCommand);
381
+ const kpiReport = kpi.command('report').description('KPI Report builder, live preview, and PDF export');
382
+ kpiReport.command('schema').description('print the report schema and variable reference').action(kpi_1.kpiReportSchemaCommand);
383
+ kpiReport
384
+ .command('get <agentId>')
385
+ .description("show an agent's report config")
386
+ .option('--json', 'output raw JSON')
387
+ .action(kpi_1.kpiReportGetCommand);
388
+ kpiReport
389
+ .command('set <agentId>')
390
+ .description('edit schedule, recipients, enable flag, or merge a JSON patch')
391
+ .option('--set <json>', 'JSON merged into report_config (or @file.json)')
392
+ .option('--enable', 'enable the auto report')
393
+ .option('--disable', 'disable the auto report')
394
+ .option('--recipients <emails>', 'comma-separated emails (max 10); "" clears')
395
+ .option('--min-trigger <HH:mm>', 'earliest send time, IST')
396
+ .option('--max-trigger <HH:mm>', 'latest send time, IST (forced equal to min when interval >= 24)')
397
+ .option('--interval <hours>', 'one of 1,2,3,4,6,8,12,24,48,72,168')
398
+ .option('--json', 'output raw JSON')
399
+ .action(kpi_1.kpiReportSetCommand);
400
+ kpiReport
401
+ .command('preview <agentId>')
402
+ .description('live-evaluate the report (nothing is sent)')
403
+ .option('--set <json>', 'overlay JSON onto report_config')
404
+ .option('--interval <hours>', 'override interval_hours')
405
+ .option('--json', 'output raw JSON')
406
+ .action(kpi_1.kpiReportPreviewCommand);
407
+ kpiReport
408
+ .command('export <agentId>')
409
+ .description('render the report to a PDF file')
410
+ .option('--file <path>', 'output path')
411
+ .option('--set <json>', 'overlay JSON onto report_config')
412
+ .option('--interval <hours>', 'override interval_hours')
413
+ .action(kpi_1.kpiReportExportCommand);
414
+ kpiReport
415
+ .command('add-var <agentId>')
416
+ .description('add or replace a custom variable')
417
+ .requiredOption('--name <name>', 'lowercase identifier')
418
+ .option('--expression <rule>', 'rule, e.g. "is_connected && post_call.x == \'YES\'"')
419
+ .option('--conditions <json>', 'conditions JSON (or @file.json); makes mode "conditions"')
420
+ .option('--consider-for <list>', 'all and/or unique, comma-separated (default all)')
421
+ .option('--json', 'output raw JSON')
422
+ .action(kpi_1.kpiReportAddVarCommand);
423
+ kpiReport
424
+ .command('remove-var <agentId> <name>')
425
+ .description('remove a custom variable and its chart refs')
426
+ .option('--json', 'output raw JSON')
427
+ .action(kpi_1.kpiReportRemoveVarCommand);
428
+ kpiReport
429
+ .command('add-element <agentId>')
430
+ .description('add a text, table or chart element to the canvas')
431
+ .requiredOption('--type <type>', 'text | table | chart (or tiles | bar | line | pie | funnel)')
432
+ .option('--chart-type <type>', 'tiles | bar | line | pie | funnel | table (default tiles)')
433
+ .option('--title <text>', 'chart title')
434
+ .option('--refs <refs>', 'comma-separated variable refs, e.g. total_calls,custom:foo')
435
+ .option('--x-axis <dim>', 'override x axis')
436
+ .option('--stack-by <dim>', 'override stack/split dimension')
437
+ .option('--content <text>', 'text content; ${total_calls} interpolates')
438
+ .option('--cells <json>', 'table cells as JSON rows (or @file.json)')
439
+ .option('--rows <n>', 'empty table rows (default 2)')
440
+ .option('--cols <n>', 'empty table cols (default 2)')
441
+ .option('--x <px>', 'left (default 40)')
442
+ .option('--y <px>', 'top (default: below existing elements)')
443
+ .option('--w <px>', 'width')
444
+ .option('--h <px>', 'height')
445
+ .option('--json', 'output raw JSON')
446
+ .action(kpi_1.kpiReportAddElementCommand);
447
+ kpiReport
448
+ .command('remove-element <agentId> <elementId>')
449
+ .description('remove a canvas element by id')
450
+ .option('--json', 'output raw JSON')
451
+ .action(kpi_1.kpiReportRemoveElementCommand);
364
452
  kpi
365
453
  .command('rca')
366
454
  .description('start an RCA run for one agent over a date range')
@@ -379,8 +467,73 @@ kpi
379
467
  .command('history')
380
468
  .description('metric history for the given agents')
381
469
  .requiredOption('--agents <ids>', 'comma-separated agent ids (see `cku kpi agents`)')
470
+ .option('--since <date>', 'start date')
471
+ .option('--until <date>', 'end date')
382
472
  .option('--json', 'output raw JSON')
383
473
  .action(kpi_1.kpiHistoryCommand);
474
+ kpi.command('import').description('import KPI cards from a JSON file')
475
+ .requiredOption('--file <path>', 'JSON file')
476
+ .option('--json', 'output raw JSON')
477
+ .action(kpi_1.kpiImportCommand);
478
+ kpi.command('detach <taskId> <url>').description('remove an attachment from a card')
479
+ .option('--json', 'output raw JSON')
480
+ .action(kpi_1.kpiDetachCommand);
481
+ kpi.command('rca-reports').description('daywise RCA reports')
482
+ .option('--agent <id>', 'agent id')
483
+ .option('--since <date>', 'start date')
484
+ .option('--until <date>', 'end date')
485
+ .option('--source <src>', 'report source')
486
+ .option('--page <n>', 'page number')
487
+ .option('--limit <n>', 'rows per page')
488
+ .option('--json', 'output raw JSON')
489
+ .action(kpi_1.kpiRcaReportsCommand);
490
+ kpi.command('rca-timeline <agentId>').description('day-by-day RCA execution events')
491
+ .option('--since <date>', 'start date')
492
+ .option('--until <date>', 'end date')
493
+ .option('--json', 'output raw JSON')
494
+ .action(kpi_1.kpiRcaTimelineCommand);
495
+ kpi.command('rca-pdf <agentId> <rcaDate>').description('download one RCA report as PDF')
496
+ .option('--manual', 'the manual-run report')
497
+ .option('--file <path>', 'output path')
498
+ .action(kpi_1.kpiRcaPdfCommand);
499
+ kpi.command('rca-draft <agentId>').description('AI-draft the RCA prompt')
500
+ .requiredOption('--prompt <text>', 'what the RCA should focus on')
501
+ .option('--save', 'save the draft to the agent KPI config')
502
+ .option('--json', 'output raw JSON')
503
+ .action(kpi_1.kpiRcaDraftPromptCommand);
504
+ kpi.command('add-api-source <agentId>').description('add or replace an API data source')
505
+ .requiredOption('--name <name>', 'source name')
506
+ .requiredOption('--url <url>', 'endpoint URL')
507
+ .option('--headers <json>', 'headers JSON or @file')
508
+ .option('--params <json>', 'parameters JSON or @file')
509
+ .option('--json', 'output raw JSON')
510
+ .action(kpi_1.kpiSourceAddApiCommand);
511
+ kpi.command('add-python-source <agentId>').description('add or replace a Python data source')
512
+ .requiredOption('--name <name>', 'source name')
513
+ .requiredOption('--code <code|@file>', 'Python code, or @file')
514
+ .option('--params <json>', 'parameters JSON or @file')
515
+ .option('--skip-verify', 'skip the verification run')
516
+ .option('--json', 'output raw JSON')
517
+ .action(kpi_1.kpiSourceAddPythonCommand);
518
+ kpi.command('add-expr-source <agentId>').description('add or replace an expression data source')
519
+ .requiredOption('--name <name>', 'source name')
520
+ .option('--expression <rule>', 'rule expression')
521
+ .option('--conditions <json>', 'conditions JSON or @file')
522
+ .option('--consider-for <all|unique>', 'count all calls or unique callers')
523
+ .option('--json', 'output raw JSON')
524
+ .action(kpi_1.kpiSourceAddExprCommand);
525
+ kpi.command('remove-source <agentId> <name>').description('remove a data source')
526
+ .option('--json', 'output raw JSON')
527
+ .action(kpi_1.kpiSourceRemoveCommand);
528
+ kpi.command('set-metric <agentId>').description('add or replace a metric')
529
+ .requiredOption('--name <name>', 'metric name')
530
+ .requiredOption('--source <src>', 'data source name')
531
+ .requiredOption('--value <val>', 'value to match')
532
+ .option('--json', 'output raw JSON')
533
+ .action(kpi_1.kpiMetricSetCommand);
534
+ kpi.command('remove-metric <agentId> <name>').description('remove a metric')
535
+ .option('--json', 'output raw JSON')
536
+ .action(kpi_1.kpiMetricRemoveCommand);
384
537
  // Call analyzers and audit reports — also dashboard-side.
385
538
  const analyzers = program
386
539
  .command('analyzers')
@@ -407,6 +560,31 @@ analyzers
407
560
  .description('per-strategy audit rollup')
408
561
  .option('--json', 'output raw JSON')
409
562
  .action(analyzers_1.analyzersAuditStrategiesCommand);
563
+ analyzers.command('summary <id>').description('analyzer summary rollup')
564
+ .option('--batch', 'id is a batch audit, not a call analyzer')
565
+ .option('--severity <sev>', 'filter by severity')
566
+ .option('--dimension <dim>', 'filter by dimension')
567
+ .option('--since <date>', 'start date')
568
+ .option('--until <date>', 'end date')
569
+ .option('--json', 'output raw JSON')
570
+ .action(analyzers_1.analyzersSummaryCommand);
571
+ analyzers.command('calls <id>').description('audited calls for an analyzer')
572
+ .option('--batch', 'id is a batch audit')
573
+ .option('--below-80', 'only calls scoring under 80')
574
+ .option('--severity <sev>', 'filter by severity')
575
+ .option('--dimension <dim>', 'filter by dimension')
576
+ .option('--category <cat>', 'filter by category')
577
+ .option('--var-name <name>', 'filter by call variable name')
578
+ .option('--var-value <val>', 'filter by call variable value')
579
+ .option('--sort <sort>', 'sort order')
580
+ .option('--page <n>', 'page number')
581
+ .option('--limit <n>', 'rows per page')
582
+ .option('--json', 'output raw JSON')
583
+ .action(analyzers_1.analyzersCallsCommand);
584
+ analyzers.command('call <id> <callId>').description('one call audit in full')
585
+ .option('--batch', 'id is a batch audit')
586
+ .option('--json', 'output raw JSON')
587
+ .action(analyzers_1.analyzersCallDetailCommand);
410
588
  program
411
589
  .command('config')
412
590
  .description('show effective CLI settings and session status')
@@ -666,6 +844,39 @@ agents.command('ab-advanced <agentId>').description('rule-based A/B: if/elseif/e
666
844
  .option('--disable', 'turn off advanced A/B testing')
667
845
  .option('--json', 'raw JSON (with --show)')
668
846
  .action(agentVersions_1.agentsAbAdvancedCommand);
847
+ agents.command('commits <agentId>').description('commit history of an agent (needs `cku dashboard login`)')
848
+ .option('--versions <id>', 'limit to one version')
849
+ .option('--page <n>', 'page number')
850
+ .option('--limit <n>', 'rows per page')
851
+ .option('--json', 'raw JSON')
852
+ .action(agentVersions_1.agentsCommitsCommand);
853
+ agents.command('commit <commitId>').description('show one commit')
854
+ .option('--json', 'raw JSON')
855
+ .action(agentVersions_1.agentsCommitShowCommand);
856
+ agents.command('diff <agentId>').description('diff two commits or two versions')
857
+ .option('--commits <idA,idB>', 'two commit ids')
858
+ .option('--versions <vA,vB>', 'two version ids')
859
+ .option('--json', 'raw JSON')
860
+ .action(agentVersions_1.agentsDiffCommand);
861
+ agents.command('revert <agentId> <commitId>').description('revert a version to a commit')
862
+ .option('--yes', 'skip confirmation')
863
+ .option('--json', 'raw JSON')
864
+ .action(agentVersions_1.agentsRevertCommand);
865
+ agents.command('save-v2 <agentId>').description('save a version with a commit message')
866
+ .option('--versions <v>', 'version id')
867
+ .requiredOption('--set <json|@file>', 'fields to save, JSON or @file')
868
+ .option('--message <msg>', 'commit message')
869
+ .option('--json', 'raw JSON')
870
+ .action(agentVersions_1.agentsSaveV2Command);
871
+ agents.command('delete-version <agentId> <versionId>').description('delete a version')
872
+ .option('--yes', 'skip confirmation')
873
+ .option('--json', 'raw JSON')
874
+ .action(agentVersions_1.agentsDeleteVersionCommand);
875
+ agents.command('duplicate <agentId>').description('duplicate an agent under a new name')
876
+ .requiredOption('--name <name>', 'name of the copy')
877
+ .option('--versions <ids>', 'version ids to copy')
878
+ .option('--json', 'raw JSON')
879
+ .action(agentVersions_1.agentsDuplicateCommand);
669
880
  // --- chat agents -----------------------------------------------------------
670
881
  const chatAgents = program.command('chat-agents').description('manage chat agents');
671
882
  chatAgents.command('models').description('list models available for chat agents')
@@ -892,6 +1103,26 @@ analytics.command('version <agentId>').description('per-version analytics for an
892
1103
  .option('--end <date>', 'end date')
893
1104
  .option('--json', 'raw JSON')
894
1105
  .action(analytics_1.analyticsVersionCommand);
1106
+ analytics.command('failed-responses').description('failed-response buckets (needs `cku dashboard login`)')
1107
+ .option('--agent <ids>', 'agent id(s), comma-separated')
1108
+ .option('--start <YYYY-MM-DD>', 'start date')
1109
+ .option('--end <YYYY-MM-DD>', 'end date')
1110
+ .option('--response <bucket>', 'drill into one bucket')
1111
+ .option('--limit <n>', 'rows')
1112
+ .option('--json', 'raw JSON')
1113
+ .action(analytics_1.analyticsFailedResponsesCommand);
1114
+ analytics.command('functions').description('function-call stats (needs `cku dashboard login`)')
1115
+ .option('--agent <ids>', 'agent id(s), comma-separated')
1116
+ .option('--start <YYYY-MM-DD>', 'start date')
1117
+ .option('--end <YYYY-MM-DD>', 'end date')
1118
+ .option('--json', 'raw JSON')
1119
+ .action(analytics_1.analyticsFunctionsCommand);
1120
+ analytics.command('chat').description('chat agent analytics (needs `cku dashboard login`)')
1121
+ .option('--agent <id>', 'chat agent id')
1122
+ .option('--start <YYYY-MM-DD>', 'start date')
1123
+ .option('--end <YYYY-MM-DD>', 'end date')
1124
+ .option('--json', 'raw JSON')
1125
+ .action(analytics_1.analyticsChatCommand);
895
1126
  // --- batches ---------------------------------------------------------------
896
1127
  const batches = program.command('batches').description('batch calls');
897
1128
  batches.command('create').description('create a batch from a local CSV (uploads + starts dialing)')
@@ -969,6 +1200,19 @@ sim.command('results <batchId>').description('results of a simulation run').opti
969
1200
  .option('--agent <agentId>', 'with --wait, the agent the batch belongs to')
970
1201
  .option('--timeout <seconds>', 'with --wait, give up after this long (default 600)')
971
1202
  .action(simulations_1.simResultsCommand);
1203
+ sim.command('draft-from-call <callId>').description('AI-draft a test case from a real call (needs `cku dashboard login`)')
1204
+ .requiredOption('--version <versionId>', 'agent version the call ran on')
1205
+ .option('--no-metadata', 'leave out call metadata')
1206
+ .option('--no-functions', 'leave out function mocks')
1207
+ .option('--save', 'save the draft as a test case')
1208
+ .option('--json', 'raw JSON')
1209
+ .action(simulations_1.simDraftFromCallCommand);
1210
+ sim.command('generate <agentId>').description('AI-draft a test case from a hint (needs `cku dashboard login`)')
1211
+ .requiredOption('--hint <text>', 'scenario to test')
1212
+ .option('--version <versionId>', 'agent version')
1213
+ .option('--save', 'save the draft as a test case')
1214
+ .option('--json', 'raw JSON')
1215
+ .action(simulations_1.simGenerateCommand);
972
1216
  // Saved variable sets are dashboard-only (cookie-authed): they need `cku dashboard login`.
973
1217
  const simVars = sim.command('variables').description('saved variable sets for test cases (needs `cku dashboard login`)');
974
1218
  simVars.command('list <agentId>').description('list saved variable sets').option('--json', 'raw JSON')
@@ -1091,6 +1335,71 @@ ${chalk_1.default.bold('Examples:')}
1091
1335
  ${chalk_1.default.cyan(`${name} agents update <agentId> --set '{"name":"New"}' --commit "rename"`)}
1092
1336
  ${chalk_1.default.cyan(`${name} calls make --agent <id> --to <number> --test`)} place a test call
1093
1337
  `);
1338
+ // --- DND, feedback, knowledge, AI helpers (dashboard session) ---------------
1339
+ const dnd = program.command('dnd').description('do-not-disturb list (needs `cku dashboard login`)');
1340
+ dnd.command('list').description('list DND numbers')
1341
+ .option('--page <n>', 'page').option('--limit <n>', 'rows').option('--search <text>', 'search')
1342
+ .option('--since <date>', 'from').option('--until <date>', 'to').option('--json', 'raw JSON')
1343
+ .action(dnd_1.dndListCommand);
1344
+ dnd.command('add <phone>').description('add a number').option('--json', 'raw JSON').action(dnd_1.dndAddCommand);
1345
+ dnd.command('update <id> <phone>').description('change a number').option('--json', 'raw JSON').action(dnd_1.dndUpdateCommand);
1346
+ dnd.command('remove <ids>').description('remove entries (comma-separated ids)')
1347
+ .option('--yes', 'skip confirmation').option('--json', 'raw JSON').action(dnd_1.dndRemoveCommand);
1348
+ dnd.command('import').description('bulk add numbers')
1349
+ .option('--phones <csv>', 'comma-separated numbers')
1350
+ .option('--file <path>', 'file with numbers (comma/newline list or JSON array)')
1351
+ .option('--json', 'raw JSON').action(dnd_1.dndImportCommand);
1352
+ const feedback = program.command('feedback').description('call feedback tickets (needs `cku dashboard login`)');
1353
+ feedback.command('list').description('list tickets')
1354
+ .option('--status <status>', 'ticket status (default processing)').option('--page <n>', 'page').option('--json', 'raw JSON')
1355
+ .action(feedback_1.feedbackListCommand);
1356
+ feedback.command('create').description('open a ticket about a call')
1357
+ .option('--call <callId>', 'call with the issue')
1358
+ .option('--version <versionId>', 'agent version')
1359
+ .option('--engineer <id>', 'engineer to assign')
1360
+ .option('--name <title>', 'ticket title')
1361
+ .option('--issue <text>', 'what went wrong')
1362
+ .option('--json', 'raw JSON')
1363
+ .action(feedback_1.feedbackCreateCommand);
1364
+ feedback.command('comment <id> <text>').description('comment on a ticket').option('--json', 'raw JSON').action(feedback_1.feedbackCommentCommand);
1365
+ feedback.command('submit-review <id>').description('submit a ticket for review')
1366
+ .option('--calls <urls>', 'resolved call URLs, comma-separated')
1367
+ .option('--version-url <url>', 'resolved version URL')
1368
+ .option('--comment <text>', 'comment')
1369
+ .option('--json', 'raw JSON')
1370
+ .action(feedback_1.feedbackSubmitReviewCommand);
1371
+ feedback.command('reopen <id>').description('reopen a ticket')
1372
+ .option('--comment <text>', 'why').option('--json', 'raw JSON').action(feedback_1.feedbackReopenCommand);
1373
+ feedback.command('resolve <id>').description('resolve a ticket')
1374
+ .option('--comment <text>', 'comment').option('--json', 'raw JSON').action(feedback_1.feedbackResolveCommand);
1375
+ const knowledge = program.command('knowledge').description('knowledge base (needs `cku dashboard login`)');
1376
+ knowledge.command('list').description('list knowledge documents').option('--json', 'raw JSON').action(knowledge_1.knowledgeListCommand);
1377
+ knowledge.command('delete <id>').description('delete a document')
1378
+ .option('--yes', 'skip confirmation').option('--json', 'raw JSON').action(knowledge_1.knowledgeDeleteCommand);
1379
+ const ai = program.command('ai').description('AI drafting helpers (needs `cku dashboard login`)');
1380
+ ai.command('function').description('draft function code from a prompt')
1381
+ .option('--prompt <text>', 'what the function should do')
1382
+ .option('--name <name>', 'function name').option('--description <desc>', 'function description')
1383
+ .option('--type <type>', 'function type')
1384
+ .option('--code <code|@file>', 'existing code to edit')
1385
+ .option('--vars <csv>', 'prompt variables, comma-separated')
1386
+ .option('--chat', 'chat-agent function')
1387
+ .option('--json', 'raw JSON')
1388
+ .action(aiTools_1.aiGenerateFunctionCommand);
1389
+ ai.command('postcall').description('draft post-call config')
1390
+ .option('--set <json|@file>', 'request body, JSON or @file').option('--json', 'raw JSON')
1391
+ .action(aiTools_1.aiGeneratePostcallCommand);
1392
+ ai.command('audit-strategy <agentId>').description('draft an audit strategy for an agent')
1393
+ .option('--prompt <text>', 'guidance').option('--existing <text>', 'existing strategy to refine').option('--json', 'raw JSON')
1394
+ .action(aiTools_1.aiGenerateAuditStrategyCommand);
1395
+ ai.command('callflow-summary <agentId>').description('draft a call-flow summary for an agent')
1396
+ .option('--prompt <text>', 'guidance').option('--existing <text>', 'existing summary to refine').option('--json', 'raw JSON')
1397
+ .action(aiTools_1.aiGenerateCallflowSummaryCommand);
1398
+ ai.command('workflow-code').description('draft workflow step code')
1399
+ .option('--prompt <text>', 'what the step should do').option('--name <name>', 'step name')
1400
+ .option('--key <key>', 'step key').option('--existing <code|@file>', 'existing code')
1401
+ .option('--json', 'raw JSON')
1402
+ .action(aiTools_1.aiGenerateWorkflowCodeCommand);
1094
1403
  // Bare invocation → show help instead of an error.
1095
1404
  if (process.argv.length <= 2) {
1096
1405
  program.outputHelp();