@newpeak/barista-cli 0.2.245 â 0.2.247
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/dist/commands/liberica/system/ai-conversation/get.d.ts.map +1 -1
- package/dist/commands/liberica/system/ai-conversation/get.js +25 -24
- package/dist/commands/liberica/system/ai-conversation/get.js.map +1 -1
- package/dist/commands/liberica/system/ai-conversation/list.d.ts.map +1 -1
- package/dist/commands/liberica/system/ai-conversation/list.js +27 -22
- package/dist/commands/liberica/system/ai-conversation/list.js.map +1 -1
- package/dist/commands/liberica/system/ai-conversation/overview.d.ts.map +1 -1
- package/dist/commands/liberica/system/ai-conversation/overview.js +22 -30
- package/dist/commands/liberica/system/ai-conversation/overview.js.map +1 -1
- package/dist/commands/liberica/teams/issues/create.d.ts.map +1 -1
- package/dist/commands/liberica/teams/issues/create.js +77 -11
- package/dist/commands/liberica/teams/issues/create.js.map +1 -1
- package/dist/core/api/client.d.ts +7 -7
- package/dist/core/api/client.d.ts.map +1 -1
- package/dist/core/api/client.js +14 -6
- package/dist/core/api/client.js.map +1 -1
- package/dist/types/ai-conversation.d.ts +21 -38
- package/dist/types/ai-conversation.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/barista-cli/data/commands.json +3 -3
- package/skills/barista-cli/data/commands.yaml +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../../src/commands/liberica/system/ai-conversation/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../../src/commands/liberica/system/ai-conversation/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,wBAAgB,8BAA8B,IAAI,OAAO,CAgExD"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
+
import Table from 'cli-table3';
|
|
3
4
|
import { configManager } from '../../../../core/config/manager.js';
|
|
4
5
|
import { apiClient } from '../../../../core/api/client.js';
|
|
5
6
|
import { shouldUseJson } from '../../../../utils/output.js';
|
|
6
7
|
export function createAiConversationGetCommand() {
|
|
7
8
|
const cmd = new Command('get');
|
|
8
|
-
cmd.description('Get AI conversation
|
|
9
|
-
cmd.requiredOption('--id <id>', 'Conversation ID (BigInt as string)');
|
|
9
|
+
cmd.description('Get AI conversation messages by conversation ID');
|
|
10
|
+
cmd.requiredOption('--conversation-id <id>', 'Conversation ID (BigInt as string)');
|
|
10
11
|
cmd.option('--json', 'Output as JSON');
|
|
11
12
|
cmd.action(async (options) => {
|
|
12
13
|
const context = configManager.getCurrentContext();
|
|
13
14
|
const environment = options.env || context.environment;
|
|
14
15
|
const tenant = options.tenant || context.tenant;
|
|
15
16
|
const outputJson = shouldUseJson(options);
|
|
16
|
-
const response = await apiClient.getAiConversationDetail(environment, tenant, options.
|
|
17
|
+
const response = await apiClient.getAiConversationDetail(environment, tenant, options.conversationId);
|
|
17
18
|
if (!response.success) {
|
|
18
19
|
const errorMsg = response.error?.message || 'Failed to get AI conversation detail';
|
|
19
20
|
const errorCode = response.error?.code || 'UNKNOWN';
|
|
@@ -24,41 +25,41 @@ export function createAiConversationGetCommand() {
|
|
|
24
25
|
console.error(chalk.red(`\nâ Failed: ${errorMsg}`));
|
|
25
26
|
if (errorCode)
|
|
26
27
|
console.error(chalk.gray(` Error code: ${errorCode}`));
|
|
27
|
-
if (errorCode === 'B0309') {
|
|
28
|
-
console.error(chalk.yellow('\n ðĄ This command requires platform administrator privileges (tenantId=1).'));
|
|
29
|
-
}
|
|
30
28
|
console.error();
|
|
31
29
|
}
|
|
32
30
|
process.exit(1);
|
|
33
31
|
}
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
32
|
+
const items = Array.isArray(response.data) ? response.data : (response.data?.data || response.data?.rows || []);
|
|
33
|
+
if (!items || items.length === 0) {
|
|
36
34
|
if (outputJson) {
|
|
37
|
-
console.log(JSON.stringify({ success:
|
|
35
|
+
console.log(JSON.stringify({ success: true, data: [], note: 'No messages found for this conversation' }));
|
|
38
36
|
}
|
|
39
37
|
else {
|
|
40
|
-
console.log(chalk.yellow('\nâ
|
|
38
|
+
console.log(chalk.yellow('\nâ No messages found for this conversation\n'));
|
|
41
39
|
}
|
|
42
40
|
return;
|
|
43
41
|
}
|
|
44
42
|
if (outputJson) {
|
|
45
|
-
console.log(JSON.stringify({ success: true, data:
|
|
43
|
+
console.log(JSON.stringify({ success: true, data: items }, null, 2));
|
|
46
44
|
return;
|
|
47
45
|
}
|
|
48
|
-
console.log(chalk.bold(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
console.log(chalk.bold(`\nðŽ AI Conversation ${options.conversationId} (${items.length} messages)\n`));
|
|
47
|
+
const table = new Table({
|
|
48
|
+
head: [chalk.bold('#'), chalk.bold('Role'), chalk.bold('Model'), chalk.bold('Tokens'), chalk.bold('Latency'), chalk.bold('Question / Response')],
|
|
49
|
+
style: { head: [] },
|
|
50
|
+
});
|
|
51
|
+
for (const item of items) {
|
|
52
|
+
const content = item.role === 'user' ? String(item.question || '') : String(item.aiResponse || '');
|
|
53
|
+
table.push([
|
|
54
|
+
String(item.messageIndex ?? '-'),
|
|
55
|
+
String(item.role || '-'),
|
|
56
|
+
String(item.model || '-').substring(0, 15),
|
|
57
|
+
String(item.tokenEstimate ?? '-'),
|
|
58
|
+
(item.latencyMs != null ? String(item.latencyMs) : '-') + 'ms',
|
|
59
|
+
content.replace(/\s+/g, ' ').substring(0, 50),
|
|
60
|
+
]);
|
|
60
61
|
}
|
|
61
|
-
console.log(
|
|
62
|
+
console.log(table.toString());
|
|
62
63
|
console.log();
|
|
63
64
|
});
|
|
64
65
|
return cmd;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../../src/commands/liberica/system/ai-conversation/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../../src/commands/liberica/system/ai-conversation/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAI5D,MAAM,UAAU,8BAA8B;IAC5C,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,GAAG,CAAC,WAAW,CAAC,iDAAiD,CAAC,CAAC;IACnE,GAAG,CAAC,cAAc,CAAC,wBAAwB,EAAE,oCAAoC,CAAC,CAAC;IACnF,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;IAEvC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC3B,MAAM,OAAO,GAAG,aAAa,CAAC,iBAAiB,EAAE,CAAC;QAClD,MAAM,WAAW,GAAI,OAAO,CAAC,GAAmB,IAAI,OAAO,CAAC,WAAW,CAAC;QACxE,MAAM,MAA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AAI,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;YACnG,KAAK,CAAC,IAAI,CAAC;gBACT,MAAM,CAAC,IAAI,CAAC,YAAY,IAAI,GAAG,CAAC;gBAChC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC;gBACxB,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC;gBAC1C,MAAM,CAAC,IAAI,CAAC,aAAa,IAAI,GAAG,CAAC;gBACjC,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI;gBAC9D,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC;aAC9C,CAAC,CAAC;QACL,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../src/commands/liberica/system/ai-conversation/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../src/commands/liberica/system/ai-conversation/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,wBAAgB,+BAA+B,IAAI,OAAO,CA6FzD"}
|
|
@@ -4,17 +4,22 @@ import Table from 'cli-table3';
|
|
|
4
4
|
import { configManager } from '../../../../core/config/manager.js';
|
|
5
5
|
import { apiClient } from '../../../../core/api/client.js';
|
|
6
6
|
import { shouldUseJson } from '../../../../utils/output.js';
|
|
7
|
+
function toInstant(input) {
|
|
8
|
+
// Accept yyyy-MM-dd or full ISO-8601; backend binds Instant
|
|
9
|
+
return /^\d{4}-\d{2}-\d{2}$/.test(input) ? `${input}T00:00:00Z` : input;
|
|
10
|
+
}
|
|
7
11
|
export function createAiConversationListCommand() {
|
|
8
12
|
const cmd = new Command('list');
|
|
9
13
|
cmd.description('List AI conversation logs with pagination and filters');
|
|
10
14
|
cmd.option('--page <number>', 'Page number', '1');
|
|
11
15
|
cmd.option('--size <number>', 'Page size', '20');
|
|
12
|
-
cmd.option('--app-id <id>', 'Filter by app ID');
|
|
13
16
|
cmd.option('--user-id <id>', 'Filter by user ID');
|
|
17
|
+
cmd.option('--conversation-id <id>', 'Filter by conversation ID');
|
|
14
18
|
cmd.option('--model <model>', 'Filter by model');
|
|
15
|
-
cmd.option('--
|
|
16
|
-
cmd.option('--
|
|
17
|
-
cmd.option('--
|
|
19
|
+
cmd.option('--role <role>', 'Filter by role (user/ai/tool)');
|
|
20
|
+
cmd.option('--keyword <text>', 'LIKE search on question or AI response');
|
|
21
|
+
cmd.option('--start-time <time>', 'Filter start time (yyyy-MM-dd or ISO-8601)');
|
|
22
|
+
cmd.option('--end-time <time>', 'Filter end time (yyyy-MM-dd or ISO-8601)');
|
|
18
23
|
cmd.option('--json', 'Output as JSON');
|
|
19
24
|
cmd.action(async (options) => {
|
|
20
25
|
const context = configManager.getCurrentContext();
|
|
@@ -25,18 +30,20 @@ export function createAiConversationListCommand() {
|
|
|
25
30
|
pageNo: parseInt(options.page, 10),
|
|
26
31
|
pageSize: parseInt(options.size, 10),
|
|
27
32
|
};
|
|
28
|
-
if (options.appId)
|
|
29
|
-
params.appId = options.appId;
|
|
30
33
|
if (options.userId)
|
|
31
34
|
params.userId = options.userId;
|
|
35
|
+
if (options.conversationId)
|
|
36
|
+
params.conversationId = options.conversationId;
|
|
32
37
|
if (options.model)
|
|
33
38
|
params.model = options.model;
|
|
34
|
-
if (options.
|
|
35
|
-
params.
|
|
36
|
-
if (options.
|
|
37
|
-
params.
|
|
38
|
-
if (options.
|
|
39
|
-
params.
|
|
39
|
+
if (options.role)
|
|
40
|
+
params.role = options.role;
|
|
41
|
+
if (options.keyword)
|
|
42
|
+
params.keyword = options.keyword;
|
|
43
|
+
if (options.startTime)
|
|
44
|
+
params.startTime = toInstant(options.startTime);
|
|
45
|
+
if (options.endTime)
|
|
46
|
+
params.endTime = toInstant(options.endTime);
|
|
40
47
|
const response = await apiClient.getAiConversationPage(environment, tenant, params);
|
|
41
48
|
if (!response.success) {
|
|
42
49
|
const errorMsg = response.error?.message || 'Failed to get AI conversation logs';
|
|
@@ -48,9 +55,6 @@ export function createAiConversationListCommand() {
|
|
|
48
55
|
console.error(chalk.red(`\nâ Failed: ${errorMsg}`));
|
|
49
56
|
if (errorCode)
|
|
50
57
|
console.error(chalk.gray(` Error code: ${errorCode}`));
|
|
51
|
-
if (errorCode === 'B0309') {
|
|
52
|
-
console.error(chalk.yellow('\n ðĄ This command requires platform administrator privileges (tenantId=1).'));
|
|
53
|
-
}
|
|
54
58
|
console.error();
|
|
55
59
|
}
|
|
56
60
|
process.exit(1);
|
|
@@ -79,18 +83,19 @@ export function createAiConversationListCommand() {
|
|
|
79
83
|
}
|
|
80
84
|
console.log(chalk.bold(`\nð AI Conversation Logs (${total} total, page ${options.page})\n`));
|
|
81
85
|
const table = new Table({
|
|
82
|
-
head: [chalk.bold('ID'), chalk.bold('
|
|
86
|
+
head: [chalk.bold('Log ID'), chalk.bold('Conversation'), chalk.bold('Role'), chalk.bold('Model'), chalk.bold('Tokens'), chalk.bold('Latency'), chalk.bold('Question'), chalk.bold('Time')],
|
|
83
87
|
style: { head: [] },
|
|
84
88
|
});
|
|
85
89
|
for (const item of items) {
|
|
86
90
|
table.push([
|
|
87
|
-
String(item.id || '').substring(0, 12) + '...',
|
|
88
|
-
String(item.
|
|
89
|
-
String(item.
|
|
91
|
+
String(item.logId || item.id || '').substring(0, 12) + '...',
|
|
92
|
+
String(item.conversationId || '-').substring(0, 12) + '...',
|
|
93
|
+
String(item.role || '-'),
|
|
90
94
|
String(item.model || '-').substring(0, 15),
|
|
91
|
-
String(item.
|
|
92
|
-
String(item.
|
|
93
|
-
item.
|
|
95
|
+
String(item.tokenEstimate || 0),
|
|
96
|
+
(item.latencyMs != null ? String(item.latencyMs) : '-') + 'ms',
|
|
97
|
+
String((item.question || '').replace(/\s+/g, ' ')).substring(0, 30),
|
|
98
|
+
String(item.createTime || item.createdAt || '-').substring(0, 19),
|
|
94
99
|
]);
|
|
95
100
|
}
|
|
96
101
|
console.log(table.toString());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../../src/commands/liberica/system/ai-conversation/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D,MAAM,UAAU,+BAA+B;IAC7C,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,GAAG,CAAC,WAAW,CAAC,uDAAuD,CAAC,CAAC;IACzE,GAAG,CAAC,MAAM,CAAC,iBAAiB,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC;IAClD,GAAG,CAAC,MAAM,CAAC,iBAAiB,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;IACjD,GAAG,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../../src/commands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G,CAAC;AACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overview.d.ts","sourceRoot":"","sources":["../../../../../src/commands/liberica/system/ai-conversation/overview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"overview.d.ts","sourceRoot":"","sources":["../../../../../src/commands/liberica/system/ai-conversation/overview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,wBAAgB,mCAAmC,IAAI,OAAO,CAyF7D"}
|
|
@@ -6,10 +6,8 @@ import { apiClient } from '../../../../core/api/client.js';
|
|
|
6
6
|
import { shouldUseJson } from '../../../../utils/output.js';
|
|
7
7
|
export function createAiConversationOverviewCommand() {
|
|
8
8
|
const cmd = new Command('overview');
|
|
9
|
-
cmd.description('Get AI
|
|
10
|
-
cmd.option('--
|
|
11
|
-
cmd.option('--end-date <date>', 'End date (yyyy-MM-dd)');
|
|
12
|
-
cmd.option('--days <number>', 'Number of days to look back (e.g. 7 for last 7 days)');
|
|
9
|
+
cmd.description('Get AI dashboard overview statistics');
|
|
10
|
+
cmd.option('--days <number>', 'Number of days to look back (default 7)');
|
|
13
11
|
cmd.option('--json', 'Output as JSON');
|
|
14
12
|
cmd.action(async (options) => {
|
|
15
13
|
const context = configManager.getCurrentContext();
|
|
@@ -17,10 +15,6 @@ export function createAiConversationOverviewCommand() {
|
|
|
17
15
|
const tenant = options.tenant || context.tenant;
|
|
18
16
|
const outputJson = shouldUseJson(options);
|
|
19
17
|
const params = {};
|
|
20
|
-
if (options.startDate)
|
|
21
|
-
params.startDate = options.startDate;
|
|
22
|
-
if (options.endDate)
|
|
23
|
-
params.endDate = options.endDate;
|
|
24
18
|
if (options.days)
|
|
25
19
|
params.days = parseInt(options.days, 10);
|
|
26
20
|
const response = await apiClient.getAiConversationOverview(environment, tenant, params);
|
|
@@ -34,9 +28,6 @@ export function createAiConversationOverviewCommand() {
|
|
|
34
28
|
console.error(chalk.red(`\nâ Failed: ${errorMsg}`));
|
|
35
29
|
if (errorCode)
|
|
36
30
|
console.error(chalk.gray(` Error code: ${errorCode}`));
|
|
37
|
-
if (errorCode === 'B0309') {
|
|
38
|
-
console.error(chalk.yellow('\n ðĄ This command requires platform administrator privileges (tenantId=1).'));
|
|
39
|
-
}
|
|
40
31
|
console.error();
|
|
41
32
|
}
|
|
42
33
|
process.exit(1);
|
|
@@ -55,34 +46,35 @@ export function createAiConversationOverviewCommand() {
|
|
|
55
46
|
console.log(JSON.stringify({ success: true, data: overview }, null, 2));
|
|
56
47
|
return;
|
|
57
48
|
}
|
|
58
|
-
console.log(chalk.bold('\nð AI
|
|
49
|
+
console.log(chalk.bold('\nð AI Dashboard Overview\n'));
|
|
59
50
|
const summaryTable = new Table({ style: { head: [] } });
|
|
60
|
-
summaryTable.push([chalk.gray('Total Conversations:'), String(overview.totalConversations
|
|
51
|
+
summaryTable.push([chalk.gray('Total Conversations:'), String(overview.totalConversations ?? 0)], [chalk.gray('Satisfaction Rate:'), (overview.satisfactionRate != null ? String(overview.satisfactionRate) : '-') + '%'], [chalk.gray('Like Count:'), chalk.green(String(overview.likeCount ?? 0))], [chalk.gray('Dislike Count:'), chalk.red(String(overview.dislikeCount ?? 0))]);
|
|
61
52
|
console.log(summaryTable.toString());
|
|
62
|
-
if (overview.
|
|
63
|
-
console.log(chalk.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
console.log(chalk.bold('\n Top Models:\n'));
|
|
67
|
-
const modelTable = new Table({
|
|
68
|
-
head: [chalk.bold('Model'), chalk.bold('Count'), chalk.bold('Total Tokens')],
|
|
53
|
+
if (overview.topDislikes && overview.topDislikes.length > 0) {
|
|
54
|
+
console.log(chalk.bold('\n Top Dislikes:\n'));
|
|
55
|
+
const dislikeTable = new Table({
|
|
56
|
+
head: [chalk.bold('Question'), chalk.bold('Reason'), chalk.bold('Time')],
|
|
69
57
|
style: { head: [] },
|
|
70
58
|
});
|
|
71
|
-
for (const
|
|
72
|
-
|
|
59
|
+
for (const d of overview.topDislikes.slice(0, 5)) {
|
|
60
|
+
dislikeTable.push([
|
|
61
|
+
String(d.question || '-').replace(/\s+/g, ' ').substring(0, 40),
|
|
62
|
+
String(d.reason || '-').substring(0, 30),
|
|
63
|
+
String(d.createTime || '-').substring(0, 19),
|
|
64
|
+
]);
|
|
73
65
|
}
|
|
74
|
-
console.log(
|
|
66
|
+
console.log(dislikeTable.toString());
|
|
75
67
|
}
|
|
76
|
-
if (overview.
|
|
77
|
-
console.log(chalk.bold('\n
|
|
78
|
-
const
|
|
79
|
-
head: [chalk.bold('
|
|
68
|
+
if (overview.dailyTrend && overview.dailyTrend.length > 0) {
|
|
69
|
+
console.log(chalk.bold('\n Daily Trend:\n'));
|
|
70
|
+
const trendTable = new Table({
|
|
71
|
+
head: [chalk.bold('Date'), chalk.bold('Conversations')],
|
|
80
72
|
style: { head: [] },
|
|
81
73
|
});
|
|
82
|
-
for (const
|
|
83
|
-
|
|
74
|
+
for (const t of overview.dailyTrend) {
|
|
75
|
+
trendTable.push([String(t.date || '-'), String(t.conversationCount ?? 0)]);
|
|
84
76
|
}
|
|
85
|
-
console.log(
|
|
77
|
+
console.log(trendTable.toString());
|
|
86
78
|
}
|
|
87
79
|
console.log();
|
|
88
80
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overview.js","sourceRoot":"","sources":["../../../../../src/commands/liberica/system/ai-conversation/overview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;
|
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;gBACpC,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,iBAAiB,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7E,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../../src/commands/liberica/teams/issues/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../../src/commands/liberica/teams/issues/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+BpC,wBAAgB,4BAA4B,IAAI,OAAO,CA4WtD"}
|
|
@@ -19,6 +19,8 @@ function formatTable(data) {
|
|
|
19
19
|
lines.push(` ${chalk.gray('Priority:')} ${data.priority}`);
|
|
20
20
|
if (data.teamIssueStatus)
|
|
21
21
|
lines.push(` ${chalk.gray('Status:')} ${data.teamIssueStatus}`);
|
|
22
|
+
if (data.reporterAccount)
|
|
23
|
+
lines.push(` ${chalk.gray('Reporter Account:')} ${data.reporterAccount}`);
|
|
22
24
|
if (data.assignTo && data.assignTo.length > 0)
|
|
23
25
|
lines.push(` ${chalk.gray('Assign To:')} ${data.assignTo.join(', ')}`);
|
|
24
26
|
if (data.follower && data.follower.length > 0)
|
|
@@ -48,9 +50,10 @@ export function createTeamIssueCreateCommand() {
|
|
|
48
50
|
.option('--project-name <string>', 'Project name (optional if --project-id or --project-code provided)')
|
|
49
51
|
.option('--reporter-name <string>', 'Reporter name (optional â auto-resolved from current user)')
|
|
50
52
|
.option('--reporter-email <string>', 'Reporter email (optional â auto-resolved from current user)')
|
|
53
|
+
.option('--reporter-account <string>', 'Reporter account / employee number (čåįžį , optional â auto-resolved from current user)')
|
|
51
54
|
.option('--priority <string>', 'Priority: LOW/MEDIUM/HIGH/URGENT', 'MEDIUM')
|
|
52
55
|
.option('--status <string>', 'Status: OPEN/IN_PROGRESS/RESOLVED/CLOSED/PENDING/VERIFIED/WONTFIX/DUPLICATE/REOPEN', 'OPEN')
|
|
53
|
-
.option('--assign-to <string>', 'Assignee
|
|
56
|
+
.option('--assign-to <string>', 'Assignee employee number (čåįžį , e.g. 0001, comma-separated; 19-digit snowflake IDs are auto-resolved)')
|
|
54
57
|
.option('--follower <code...>', 'Follower employee codes (variadic)')
|
|
55
58
|
.option('--tester <code...>', 'Tester employee codes (variadic)')
|
|
56
59
|
.option('--solution <string>', 'Solution description')
|
|
@@ -73,6 +76,7 @@ export function createTeamIssueCreateCommand() {
|
|
|
73
76
|
let projectName = opts.projectName;
|
|
74
77
|
let reporterName = opts.reporterName;
|
|
75
78
|
let reporterEmail = opts.reporterEmail;
|
|
79
|
+
let reporterAccount = opts.reporterAccount;
|
|
76
80
|
const priorityInput = opts.priority;
|
|
77
81
|
const statusInput = opts.status;
|
|
78
82
|
const assignToInput = opts.assignTo;
|
|
@@ -216,14 +220,29 @@ export function createTeamIssueCreateCommand() {
|
|
|
216
220
|
// Resolve reporter fields from current user when not provided
|
|
217
221
|
// Reporter fields are optional â if auto-resolution fails, skip them
|
|
218
222
|
// (the backend will handle missing values with its own validation)
|
|
219
|
-
|
|
223
|
+
const notes = [];
|
|
224
|
+
let currentUserData = null;
|
|
225
|
+
if (!reporterName || !reporterEmail || !reporterAccount) {
|
|
220
226
|
const currentUserResponse = await apiClient.getCurrentUser(context.environment, context.tenant);
|
|
221
227
|
if (currentUserResponse.success && currentUserResponse.data) {
|
|
222
|
-
|
|
228
|
+
currentUserData = currentUserResponse.data;
|
|
223
229
|
if (!reporterName)
|
|
224
|
-
reporterName =
|
|
230
|
+
reporterName = currentUserData.realName || currentUserData.account;
|
|
225
231
|
if (!reporterEmail)
|
|
226
|
-
reporterEmail =
|
|
232
|
+
reporterEmail = currentUserData.email || currentUserData.account;
|
|
233
|
+
if (!reporterAccount)
|
|
234
|
+
reporterAccount = currentUserData.employeeNumber;
|
|
235
|
+
if (!reporterAccount) {
|
|
236
|
+
notes.push('Could not auto-resolve reporterAccount (employeeNumber) from current user â reporterAccount will be omitted');
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
if (!reporterName)
|
|
241
|
+
notes.push('Could not auto-resolve reporterName from current user â reporterName will be omitted');
|
|
242
|
+
if (!reporterEmail)
|
|
243
|
+
notes.push('Could not auto-resolve reporterEmail from current user â reporterEmail will be omitted');
|
|
244
|
+
if (!reporterAccount)
|
|
245
|
+
notes.push('Could not auto-resolve reporterAccount from current user â reporterAccount will be omitted');
|
|
227
246
|
}
|
|
228
247
|
}
|
|
229
248
|
// Validate priority
|
|
@@ -255,14 +274,48 @@ export function createTeamIssueCreateCommand() {
|
|
|
255
274
|
// Parse comma-separated arrays
|
|
256
275
|
let assignToList = assignToInput ? assignToInput.split(',').map(s => s.trim()).filter(s => s.length > 0) : undefined;
|
|
257
276
|
if (!assignToList || assignToList.length === 0) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
277
|
+
if (!currentUserData) {
|
|
278
|
+
const currentUserResponse = await apiClient.getCurrentUser(context.environment, context.tenant);
|
|
279
|
+
if (currentUserResponse.success && currentUserResponse.data) {
|
|
280
|
+
currentUserData = currentUserResponse.data;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (currentUserData) {
|
|
284
|
+
const currentUserId = currentUserData.employeeNumber || currentUserData.employeeId;
|
|
262
285
|
if (currentUserId) {
|
|
263
286
|
assignToList = [currentUserId];
|
|
264
287
|
}
|
|
288
|
+
else {
|
|
289
|
+
notes.push('Could not auto-resolve assignee (employeeNumber/employeeId) from current user â issue will have no assignee');
|
|
290
|
+
}
|
|
265
291
|
}
|
|
292
|
+
else {
|
|
293
|
+
notes.push('Could not auto-resolve assignee from current user â issue will have no assignee');
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
// Resolve 19-digit snowflake IDs in assignTo to employee codes (čåįžį )
|
|
297
|
+
if (assignToList && assignToList.length > 0) {
|
|
298
|
+
const resolvedAssignTo = [];
|
|
299
|
+
for (const id of assignToList) {
|
|
300
|
+
if (/^\d{19}$/.test(id)) {
|
|
301
|
+
const employeeResponse = await apiClient.getEmployee(context.environment, context.tenant, id);
|
|
302
|
+
const employeeCode = employeeResponse.success && employeeResponse.data
|
|
303
|
+
? employeeResponse.data.employeeCode || employeeResponse.data.code
|
|
304
|
+
: undefined;
|
|
305
|
+
if (employeeCode) {
|
|
306
|
+
resolvedAssignTo.push(employeeCode);
|
|
307
|
+
notes.push(`Resolved snowflake ID ${id} â employee code ${employeeCode} for assignee`);
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
resolvedAssignTo.push(id);
|
|
311
|
+
notes.push(`Could not resolve snowflake ID ${id} to employee code â passing through as-is`);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
resolvedAssignTo.push(id);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
assignToList = resolvedAssignTo;
|
|
266
319
|
}
|
|
267
320
|
const data = {
|
|
268
321
|
issueTitle: title,
|
|
@@ -275,6 +328,7 @@ export function createTeamIssueCreateCommand() {
|
|
|
275
328
|
projectName: projectName,
|
|
276
329
|
reporterName: reporterName,
|
|
277
330
|
reporterEmail: reporterEmail,
|
|
331
|
+
reporterAccount: reporterAccount,
|
|
278
332
|
reportDate: new Date().toISOString().slice(0, 10),
|
|
279
333
|
priority: priority,
|
|
280
334
|
teamIssueStatus: teamIssueStatus,
|
|
@@ -286,9 +340,15 @@ export function createTeamIssueCreateCommand() {
|
|
|
286
340
|
};
|
|
287
341
|
if (dryRun) {
|
|
288
342
|
if (jsonOutput) {
|
|
289
|
-
|
|
343
|
+
const output = { success: true, dryRun: true, data };
|
|
344
|
+
if (notes.length > 0)
|
|
345
|
+
output.note = notes.join('; ');
|
|
346
|
+
console.log(JSON.stringify(output));
|
|
290
347
|
}
|
|
291
348
|
else {
|
|
349
|
+
for (const note of notes) {
|
|
350
|
+
console.warn(chalk.yellow(`\nâ ${note}\n`));
|
|
351
|
+
}
|
|
292
352
|
console.log(chalk.bold('\nð Dry-Run Mode: No changes will be made\n'));
|
|
293
353
|
console.log(' Issue to be created:');
|
|
294
354
|
console.log(formatTable(data));
|
|
@@ -318,9 +378,15 @@ export function createTeamIssueCreateCommand() {
|
|
|
318
378
|
if (response.success) {
|
|
319
379
|
const issue = response.data;
|
|
320
380
|
if (jsonOutput) {
|
|
321
|
-
|
|
381
|
+
const output = { success: true, data: issue };
|
|
382
|
+
if (notes.length > 0)
|
|
383
|
+
output.note = notes.join('; ');
|
|
384
|
+
console.log(JSON.stringify(output));
|
|
322
385
|
}
|
|
323
386
|
else {
|
|
387
|
+
for (const note of notes) {
|
|
388
|
+
console.warn(chalk.yellow(`\nâ ${note}\n`));
|
|
389
|
+
}
|
|
324
390
|
console.log(chalk.green('â Team issue created successfully\n'));
|
|
325
391
|
if (issue?.teamIssueId)
|
|
326
392
|
console.log(` ${chalk.gray('Issue ID:')} ${chalk.green(issue.teamIssueId)}`);
|