@nathapp/koda-cli 0.2.4 → 0.3.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.
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +14 -20
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/comment.d.ts.map +1 -1
- package/dist/commands/comment.js +10 -6
- package/dist/commands/comment.js.map +1 -1
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +9 -7
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/kb.d.ts.map +1 -1
- package/dist/commands/kb.js +25 -9
- package/dist/commands/kb.js.map +1 -1
- package/dist/commands/label.d.ts.map +1 -1
- package/dist/commands/label.js +22 -29
- package/dist/commands/label.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +7 -5
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/project.d.ts.map +1 -1
- package/dist/commands/project.js +34 -26
- package/dist/commands/project.js.map +1 -1
- package/dist/commands/ticket.d.ts.map +1 -1
- package/dist/commands/ticket.js +166 -201
- package/dist/commands/ticket.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/generated/core/ApiError.d.ts +11 -0
- package/dist/generated/core/ApiError.d.ts.map +1 -0
- package/dist/generated/core/ApiError.js +21 -0
- package/dist/generated/core/ApiError.js.map +1 -0
- package/dist/generated/core/ApiRequestOptions.d.ts +14 -0
- package/dist/generated/core/ApiRequestOptions.d.ts.map +1 -0
- package/dist/generated/core/ApiRequestOptions.js +3 -0
- package/dist/generated/core/ApiRequestOptions.js.map +1 -0
- package/dist/generated/core/ApiResult.d.ts +8 -0
- package/dist/generated/core/ApiResult.d.ts.map +1 -0
- package/dist/generated/core/ApiResult.js +3 -0
- package/dist/generated/core/ApiResult.js.map +1 -0
- package/dist/generated/core/CancelablePromise.d.ts +27 -0
- package/dist/generated/core/CancelablePromise.d.ts.map +1 -0
- package/dist/generated/core/CancelablePromise.js +101 -0
- package/dist/generated/core/CancelablePromise.js.map +1 -0
- package/dist/generated/core/OpenAPI.d.ts +29 -0
- package/dist/generated/core/OpenAPI.d.ts.map +1 -0
- package/dist/generated/core/OpenAPI.js +35 -0
- package/dist/generated/core/OpenAPI.js.map +1 -0
- package/dist/generated/core/request.d.ts +33 -0
- package/dist/generated/core/request.d.ts.map +1 -0
- package/dist/generated/core/request.js +310 -0
- package/dist/generated/core/request.js.map +1 -0
- package/dist/generated/index.d.ts +7 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +29 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/generated/schemas.gen.d.ts +723 -0
- package/dist/generated/schemas.gen.d.ts.map +1 -0
- package/dist/generated/schemas.gen.js +731 -0
- package/dist/generated/schemas.gen.js.map +1 -0
- package/dist/generated/services.gen.d.ts +474 -0
- package/dist/generated/services.gen.d.ts.map +1 -0
- package/dist/generated/services.gen.js +1218 -0
- package/dist/generated/services.gen.js.map +1 -0
- package/dist/generated/types.gen.d.ts +1586 -0
- package/dist/generated/types.gen.d.ts.map +1 -0
- package/dist/generated/types.gen.js +4 -0
- package/dist/generated/types.gen.js.map +1 -0
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/dist/utils/api.d.ts +1 -9
- package/dist/utils/api.d.ts.map +1 -1
- package/dist/utils/api.js +5 -4
- package/dist/utils/api.js.map +1 -1
- package/dist/utils/error.d.ts +5 -3
- package/dist/utils/error.d.ts.map +1 -1
- package/dist/utils/error.js +31 -16
- package/dist/utils/error.js.map +1 -1
- package/dist/utils/output.d.ts +1 -1
- package/dist/utils/output.js +2 -2
- package/dist/utils/output.js.map +1 -1
- package/package.json +10 -5
- package/dist/client.d.ts +0 -9
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -23
- package/dist/client.js.map +0 -1
- package/dist/generated.d.ts +0 -200
- package/dist/generated.d.ts.map +0 -1
- package/dist/generated.js +0 -131
- package/dist/generated.js.map +0 -1
package/dist/commands/ticket.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ticketCommand = ticketCommand;
|
|
4
4
|
const config_1 = require("../config");
|
|
5
|
-
const
|
|
5
|
+
const OpenAPI_1 = require("../generated/core/OpenAPI");
|
|
6
6
|
const generated_1 = require("../generated");
|
|
7
7
|
const output_1 = require("../utils/output");
|
|
8
8
|
const api_1 = require("../utils/api");
|
|
@@ -23,38 +23,32 @@ function ticketCommand(program) {
|
|
|
23
23
|
try {
|
|
24
24
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
25
25
|
if (!ctx.projectSlug) {
|
|
26
|
-
(0,
|
|
27
|
-
process.exit(2);
|
|
28
|
-
return;
|
|
26
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
29
27
|
}
|
|
30
28
|
if (!ctx.apiKey) {
|
|
31
|
-
(0,
|
|
32
|
-
process.exit(2);
|
|
33
|
-
return;
|
|
29
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
34
30
|
}
|
|
35
|
-
// Validate required options
|
|
36
31
|
if (!options.type || !options.title) {
|
|
37
|
-
(0,
|
|
38
|
-
process.exit(3);
|
|
32
|
+
(0, error_1.handleApiError)(new Error('Missing required options: --type and --title are required'), { validationError: true });
|
|
39
33
|
}
|
|
40
34
|
const validTypes = ['BUG', 'ENHANCEMENT', 'TASK', 'QUESTION'];
|
|
41
35
|
if (!validTypes.includes(options.type)) {
|
|
42
|
-
(0,
|
|
43
|
-
process.exit(3);
|
|
44
|
-
return;
|
|
36
|
+
(0, error_1.handleApiError)(new Error(`Invalid type ${options.type}. Valid values: ${validTypes.join(', ')}`), { validationError: true });
|
|
45
37
|
}
|
|
46
38
|
const validPriorities = ['LOW', 'MEDIUM', 'HIGH', 'CRITICAL'];
|
|
47
39
|
if (options.priority && !validPriorities.includes(options.priority)) {
|
|
48
|
-
(0,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
40
|
+
(0, error_1.handleApiError)(new Error(`Invalid priority ${options.priority}. Valid values: ${validPriorities.join(', ')}`), { validationError: true });
|
|
41
|
+
}
|
|
42
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
43
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
44
|
+
const response = await (0, generated_1.ticketsControllerCreate)({
|
|
45
|
+
slug: ctx.projectSlug,
|
|
46
|
+
requestBody: {
|
|
47
|
+
type: options.type,
|
|
48
|
+
title: options.title,
|
|
49
|
+
description: options.desc,
|
|
50
|
+
priority: options.priority,
|
|
51
|
+
},
|
|
58
52
|
});
|
|
59
53
|
const ticketData = (0, api_1.unwrap)(response);
|
|
60
54
|
if (options.json) {
|
|
@@ -86,18 +80,15 @@ function ticketCommand(program) {
|
|
|
86
80
|
try {
|
|
87
81
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
88
82
|
if (!ctx.projectSlug) {
|
|
89
|
-
(0,
|
|
90
|
-
process.exit(2);
|
|
91
|
-
return;
|
|
83
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
92
84
|
}
|
|
93
85
|
if (!ctx.apiKey) {
|
|
94
|
-
(0,
|
|
95
|
-
process.exit(2);
|
|
96
|
-
return;
|
|
86
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
97
87
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
88
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
89
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
90
|
+
const response = await (0, generated_1.ticketsControllerFindAll)({
|
|
91
|
+
slug: ctx.projectSlug,
|
|
101
92
|
status: options.status,
|
|
102
93
|
type: options.type,
|
|
103
94
|
priority: options.priority,
|
|
@@ -107,13 +98,13 @@ function ticketCommand(program) {
|
|
|
107
98
|
page: parseInt(options.page, 10),
|
|
108
99
|
});
|
|
109
100
|
const data = (0, api_1.unwrap)(response);
|
|
110
|
-
const items = Array.isArray(data) ? data : data.items
|
|
101
|
+
const items = Array.isArray(data) ? data : (data.items ?? []);
|
|
111
102
|
if (options.json) {
|
|
112
103
|
console.log(JSON.stringify(items, null, 2));
|
|
113
104
|
}
|
|
114
105
|
else {
|
|
115
106
|
const rows = items.map((t) => [
|
|
116
|
-
`KODA-${t.number}
|
|
107
|
+
String(t.ref ?? `KODA-${t.number}`),
|
|
117
108
|
String(t.type),
|
|
118
109
|
String(t.priority || ''),
|
|
119
110
|
String(t.status),
|
|
@@ -138,29 +129,26 @@ function ticketCommand(program) {
|
|
|
138
129
|
try {
|
|
139
130
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
140
131
|
if (!ctx.projectSlug) {
|
|
141
|
-
(0,
|
|
142
|
-
process.exit(2);
|
|
143
|
-
return;
|
|
132
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
144
133
|
}
|
|
145
134
|
if (!ctx.apiKey) {
|
|
146
|
-
(0,
|
|
147
|
-
process.exit(2);
|
|
148
|
-
return;
|
|
135
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
149
136
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
137
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
138
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
139
|
+
const response = await (0, generated_1.ticketsControllerFindAll)({
|
|
140
|
+
slug: ctx.projectSlug,
|
|
153
141
|
status: options.status,
|
|
154
142
|
assignedTo: 'self',
|
|
155
143
|
});
|
|
156
144
|
const data = (0, api_1.unwrap)(response);
|
|
157
|
-
const items = Array.isArray(data) ? data : data.items
|
|
145
|
+
const items = Array.isArray(data) ? data : (data.items ?? []);
|
|
158
146
|
if (options.json) {
|
|
159
147
|
console.log(JSON.stringify(items, null, 2));
|
|
160
148
|
}
|
|
161
149
|
else {
|
|
162
150
|
const rows = items.map((t) => [
|
|
163
|
-
`KODA-${t.number}
|
|
151
|
+
String(t.ref ?? `KODA-${t.number}`),
|
|
164
152
|
String(t.type),
|
|
165
153
|
String(t.priority || ''),
|
|
166
154
|
String(t.status),
|
|
@@ -184,17 +172,14 @@ function ticketCommand(program) {
|
|
|
184
172
|
try {
|
|
185
173
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
186
174
|
if (!ctx.projectSlug) {
|
|
187
|
-
(0,
|
|
188
|
-
process.exit(2);
|
|
189
|
-
return;
|
|
175
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
190
176
|
}
|
|
191
177
|
if (!ctx.apiKey) {
|
|
192
|
-
(0,
|
|
193
|
-
process.exit(2);
|
|
194
|
-
return;
|
|
178
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
195
179
|
}
|
|
196
|
-
|
|
197
|
-
|
|
180
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
181
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
182
|
+
const response = await (0, generated_1.ticketsControllerFindByRef)({ slug: ctx.projectSlug, ref });
|
|
198
183
|
const ticketData = (0, api_1.unwrap)(response);
|
|
199
184
|
if (options.json) {
|
|
200
185
|
console.log(JSON.stringify(ticketData, null, 2));
|
|
@@ -232,28 +217,25 @@ function ticketCommand(program) {
|
|
|
232
217
|
.description('Verify a ticket (CREATED → VERIFIED)')
|
|
233
218
|
.option('--project <slug>', 'Project slug')
|
|
234
219
|
.option('--comment <text>', 'Verification comment')
|
|
220
|
+
.option('--json', 'Output as JSON')
|
|
235
221
|
.action(async (ref, options) => {
|
|
236
222
|
try {
|
|
237
223
|
if (!options.comment) {
|
|
238
|
-
(0,
|
|
239
|
-
process.exit(3);
|
|
240
|
-
return;
|
|
224
|
+
(0, error_1.handleApiError)(new Error('Comment is required'), { validationError: true });
|
|
241
225
|
}
|
|
242
226
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
243
227
|
if (!ctx.projectSlug) {
|
|
244
|
-
(0,
|
|
245
|
-
process.exit(2);
|
|
246
|
-
return;
|
|
228
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
247
229
|
}
|
|
248
230
|
if (!ctx.apiKey) {
|
|
249
|
-
(0,
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
231
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
232
|
+
}
|
|
233
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
234
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
235
|
+
await (0, generated_1.ticketsControllerVerify)({
|
|
236
|
+
slug: ctx.projectSlug,
|
|
237
|
+
ref,
|
|
238
|
+
requestBody: { body: options.comment },
|
|
257
239
|
});
|
|
258
240
|
console.log(`✓ Ticket verified successfully`);
|
|
259
241
|
process.exit(0);
|
|
@@ -273,18 +255,14 @@ function ticketCommand(program) {
|
|
|
273
255
|
try {
|
|
274
256
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
275
257
|
if (!ctx.projectSlug) {
|
|
276
|
-
(0,
|
|
277
|
-
process.exit(2);
|
|
278
|
-
return;
|
|
258
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
279
259
|
}
|
|
280
260
|
if (!ctx.apiKey) {
|
|
281
|
-
(0,
|
|
282
|
-
process.exit(2);
|
|
283
|
-
return;
|
|
261
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
284
262
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
const response = await generated_1.
|
|
263
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
264
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
265
|
+
const response = await (0, generated_1.ticketsControllerAssign)({ slug: ctx.projectSlug, ref });
|
|
288
266
|
const ticketData = (0, api_1.unwrap)(response);
|
|
289
267
|
if (options.json) {
|
|
290
268
|
console.log(JSON.stringify(ticketData, null, 2));
|
|
@@ -302,21 +280,19 @@ function ticketCommand(program) {
|
|
|
302
280
|
.command('start <ref>')
|
|
303
281
|
.description('Start a ticket (CREATED or VERIFIED → IN_PROGRESS)')
|
|
304
282
|
.option('--project <slug>', 'Project slug')
|
|
283
|
+
.option('--json', 'Output as JSON')
|
|
305
284
|
.action(async (ref, options) => {
|
|
306
285
|
try {
|
|
307
286
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
308
287
|
if (!ctx.projectSlug) {
|
|
309
|
-
(0,
|
|
310
|
-
process.exit(2);
|
|
311
|
-
return;
|
|
288
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
312
289
|
}
|
|
313
290
|
if (!ctx.apiKey) {
|
|
314
|
-
(0,
|
|
315
|
-
process.exit(2);
|
|
316
|
-
return;
|
|
291
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
317
292
|
}
|
|
318
|
-
|
|
319
|
-
|
|
293
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
294
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
295
|
+
await (0, generated_1.ticketsControllerStart)({ slug: ctx.projectSlug, ref });
|
|
320
296
|
console.log(`✓ Ticket started successfully`);
|
|
321
297
|
process.exit(0);
|
|
322
298
|
}
|
|
@@ -330,33 +306,26 @@ function ticketCommand(program) {
|
|
|
330
306
|
.option('--project <slug>', 'Project slug')
|
|
331
307
|
.option('--comment <text>', 'Fix report comment')
|
|
332
308
|
.option('--git-ref <ref>', 'Git reference (e.g. branch or commit)')
|
|
309
|
+
.option('--json', 'Output as JSON')
|
|
333
310
|
.action(async (ref, options) => {
|
|
334
311
|
try {
|
|
335
312
|
if (!options.comment) {
|
|
336
|
-
(0,
|
|
337
|
-
process.exit(3);
|
|
338
|
-
return;
|
|
313
|
+
(0, error_1.handleApiError)(new Error('Comment is required'), { validationError: true });
|
|
339
314
|
}
|
|
340
315
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
341
316
|
if (!ctx.projectSlug) {
|
|
342
|
-
(0,
|
|
343
|
-
process.exit(2);
|
|
344
|
-
return;
|
|
317
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
345
318
|
}
|
|
346
319
|
if (!ctx.apiKey) {
|
|
347
|
-
(0,
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
};
|
|
356
|
-
if (options.gitRef) {
|
|
357
|
-
payload.gitRef = options.gitRef;
|
|
358
|
-
}
|
|
359
|
-
await generated_1.TicketsService.fix(client, ctx.projectSlug, ref, payload);
|
|
320
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
321
|
+
}
|
|
322
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
323
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
324
|
+
await (0, generated_1.ticketsControllerFix)({
|
|
325
|
+
slug: ctx.projectSlug,
|
|
326
|
+
ref,
|
|
327
|
+
requestBody: { body: options.comment },
|
|
328
|
+
});
|
|
360
329
|
console.log(`✓ Fix submitted successfully`);
|
|
361
330
|
process.exit(0);
|
|
362
331
|
}
|
|
@@ -371,32 +340,41 @@ function ticketCommand(program) {
|
|
|
371
340
|
.option('--comment <text>', 'Review comment')
|
|
372
341
|
.option('--pass', 'Mark fix as passing (closes ticket)')
|
|
373
342
|
.option('--fail', 'Mark fix as failing (returns to IN_PROGRESS)')
|
|
343
|
+
.option('--json', 'Output as JSON')
|
|
374
344
|
.action(async (ref, options) => {
|
|
375
345
|
try {
|
|
376
346
|
if (!options.comment) {
|
|
377
|
-
(0,
|
|
378
|
-
|
|
379
|
-
|
|
347
|
+
(0, error_1.handleApiError)(new Error('Comment is required'), { validationError: true });
|
|
348
|
+
}
|
|
349
|
+
if (!options.pass && !options.fail) {
|
|
350
|
+
(0, error_1.handleApiError)(new Error('Specify exactly one of --pass or --fail'), { validationError: true });
|
|
351
|
+
}
|
|
352
|
+
if (options.pass && options.fail) {
|
|
353
|
+
(0, error_1.handleApiError)(new Error('Specify only one of --pass or --fail'), { validationError: true });
|
|
380
354
|
}
|
|
381
355
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
382
356
|
if (!ctx.projectSlug) {
|
|
383
|
-
(0,
|
|
384
|
-
process.exit(2);
|
|
385
|
-
return;
|
|
357
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
386
358
|
}
|
|
387
359
|
if (!ctx.apiKey) {
|
|
388
|
-
(0,
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
body: options.comment,
|
|
396
|
-
type: 'REVIEW',
|
|
397
|
-
status,
|
|
360
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
361
|
+
}
|
|
362
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
363
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
364
|
+
await (0, generated_1.ticketsControllerVerifyFix)({
|
|
365
|
+
slug: ctx.projectSlug,
|
|
366
|
+
ref,
|
|
367
|
+
requestBody: { body: options.comment },
|
|
398
368
|
});
|
|
399
|
-
|
|
369
|
+
// The generated client currently does not expose the approve query param.
|
|
370
|
+
// Preserve expected CLI semantics: --pass should conclude with CLOSED.
|
|
371
|
+
if (options.pass) {
|
|
372
|
+
await (0, generated_1.ticketsControllerClose)({ slug: ctx.projectSlug, ref });
|
|
373
|
+
console.log(`✓ Fix verified and ticket closed successfully`);
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
console.log(`✓ Fix verification submitted successfully`);
|
|
377
|
+
}
|
|
400
378
|
process.exit(0);
|
|
401
379
|
}
|
|
402
380
|
catch (err) {
|
|
@@ -407,21 +385,19 @@ function ticketCommand(program) {
|
|
|
407
385
|
.command('close <ref>')
|
|
408
386
|
.description('Close a ticket')
|
|
409
387
|
.option('--project <slug>', 'Project slug')
|
|
388
|
+
.option('--json', 'Output as JSON')
|
|
410
389
|
.action(async (ref, options) => {
|
|
411
390
|
try {
|
|
412
391
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
413
392
|
if (!ctx.projectSlug) {
|
|
414
|
-
(0,
|
|
415
|
-
process.exit(2);
|
|
416
|
-
return;
|
|
393
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
417
394
|
}
|
|
418
395
|
if (!ctx.apiKey) {
|
|
419
|
-
(0,
|
|
420
|
-
process.exit(2);
|
|
421
|
-
return;
|
|
396
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
422
397
|
}
|
|
423
|
-
|
|
424
|
-
|
|
398
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
399
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
400
|
+
await (0, generated_1.ticketsControllerClose)({ slug: ctx.projectSlug, ref });
|
|
425
401
|
console.log(`✓ Ticket closed successfully`);
|
|
426
402
|
process.exit(0);
|
|
427
403
|
}
|
|
@@ -434,28 +410,25 @@ function ticketCommand(program) {
|
|
|
434
410
|
.description('Reject a ticket')
|
|
435
411
|
.option('--project <slug>', 'Project slug')
|
|
436
412
|
.option('--comment <text>', 'Rejection reason')
|
|
413
|
+
.option('--json', 'Output as JSON')
|
|
437
414
|
.action(async (ref, options) => {
|
|
438
415
|
try {
|
|
439
416
|
if (!options.comment) {
|
|
440
|
-
(0,
|
|
441
|
-
process.exit(3);
|
|
442
|
-
return;
|
|
417
|
+
(0, error_1.handleApiError)(new Error('Comment is required'), { validationError: true });
|
|
443
418
|
}
|
|
444
419
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
445
420
|
if (!ctx.projectSlug) {
|
|
446
|
-
(0,
|
|
447
|
-
process.exit(2);
|
|
448
|
-
return;
|
|
421
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
449
422
|
}
|
|
450
423
|
if (!ctx.apiKey) {
|
|
451
|
-
(0,
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
424
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
425
|
+
}
|
|
426
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
427
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
428
|
+
await (0, generated_1.ticketsControllerReject)({
|
|
429
|
+
slug: ctx.projectSlug,
|
|
430
|
+
ref,
|
|
431
|
+
requestBody: { body: options.comment },
|
|
459
432
|
});
|
|
460
433
|
console.log(`✓ Ticket rejected successfully`);
|
|
461
434
|
process.exit(0);
|
|
@@ -476,24 +449,21 @@ function ticketCommand(program) {
|
|
|
476
449
|
try {
|
|
477
450
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
478
451
|
if (!ctx.projectSlug) {
|
|
479
|
-
(0,
|
|
480
|
-
process.exit(2);
|
|
481
|
-
return;
|
|
452
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
482
453
|
}
|
|
483
454
|
if (!ctx.apiKey) {
|
|
484
|
-
(0,
|
|
485
|
-
process.exit(2);
|
|
486
|
-
return;
|
|
455
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
487
456
|
}
|
|
488
|
-
|
|
489
|
-
|
|
457
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
458
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
459
|
+
const requestBody = {};
|
|
490
460
|
if (options.title)
|
|
491
|
-
|
|
461
|
+
requestBody.title = options.title;
|
|
492
462
|
if (options.desc)
|
|
493
|
-
|
|
463
|
+
requestBody.description = options.desc;
|
|
494
464
|
if (options.priority)
|
|
495
|
-
|
|
496
|
-
const response = await generated_1.
|
|
465
|
+
requestBody.priority = options.priority;
|
|
466
|
+
const response = await (0, generated_1.ticketsControllerUpdate)({ slug: ctx.projectSlug, ref, requestBody });
|
|
497
467
|
const ticketData = (0, api_1.unwrap)(response);
|
|
498
468
|
if (options.json) {
|
|
499
469
|
console.log(JSON.stringify(ticketData, null, 2));
|
|
@@ -515,22 +485,18 @@ function ticketCommand(program) {
|
|
|
515
485
|
.action(async (ref, options) => {
|
|
516
486
|
try {
|
|
517
487
|
if (!options.force) {
|
|
518
|
-
(0,
|
|
519
|
-
process.exit(1);
|
|
488
|
+
(0, error_1.handleApiError)(new Error('Deletion requires --force flag.'), { validationError: true });
|
|
520
489
|
}
|
|
521
490
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
522
491
|
if (!ctx.projectSlug) {
|
|
523
|
-
(0,
|
|
524
|
-
process.exit(2);
|
|
525
|
-
return;
|
|
492
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
526
493
|
}
|
|
527
494
|
if (!ctx.apiKey) {
|
|
528
|
-
(0,
|
|
529
|
-
process.exit(2);
|
|
530
|
-
return;
|
|
495
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
531
496
|
}
|
|
532
|
-
|
|
533
|
-
|
|
497
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
498
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
499
|
+
await (0, generated_1.ticketsControllerSoftDelete)({ slug: ctx.projectSlug, ref });
|
|
534
500
|
console.log(`✓ Ticket deleted successfully`);
|
|
535
501
|
process.exit(0);
|
|
536
502
|
}
|
|
@@ -548,17 +514,18 @@ function ticketCommand(program) {
|
|
|
548
514
|
try {
|
|
549
515
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
550
516
|
if (!ctx.projectSlug) {
|
|
551
|
-
(0,
|
|
552
|
-
process.exit(2);
|
|
553
|
-
return;
|
|
517
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
554
518
|
}
|
|
555
519
|
if (!ctx.apiKey) {
|
|
556
|
-
(0,
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
const
|
|
561
|
-
|
|
520
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
521
|
+
}
|
|
522
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
523
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
524
|
+
const response = await (0, generated_1.ticketLinksControllerCreate)({
|
|
525
|
+
slug: ctx.projectSlug,
|
|
526
|
+
ref,
|
|
527
|
+
requestBody: { url: options.url },
|
|
528
|
+
});
|
|
562
529
|
const linkData = (0, api_1.unwrap)(response);
|
|
563
530
|
if (options.json) {
|
|
564
531
|
console.log(JSON.stringify(linkData, null, 2));
|
|
@@ -582,25 +549,21 @@ function ticketCommand(program) {
|
|
|
582
549
|
try {
|
|
583
550
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
584
551
|
if (!ctx.projectSlug) {
|
|
585
|
-
(0,
|
|
586
|
-
process.exit(2);
|
|
587
|
-
return;
|
|
552
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
588
553
|
}
|
|
589
554
|
if (!ctx.apiKey) {
|
|
590
|
-
(0,
|
|
591
|
-
process.exit(2);
|
|
592
|
-
return;
|
|
555
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
593
556
|
}
|
|
594
|
-
|
|
595
|
-
|
|
557
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
558
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
559
|
+
const listResponse = await (0, generated_1.ticketLinksControllerFindAll)({ slug: ctx.projectSlug, ref });
|
|
596
560
|
const links = (0, api_1.unwrap)(listResponse);
|
|
597
561
|
const match = links.find((l) => l.url === options.url);
|
|
598
562
|
if (!match) {
|
|
599
563
|
console.log(`No link found for ${options.url}`);
|
|
600
564
|
process.exit(1);
|
|
601
|
-
return;
|
|
602
565
|
}
|
|
603
|
-
await generated_1.
|
|
566
|
+
await (0, generated_1.ticketLinksControllerRemove)({ slug: ctx.projectSlug, ref, linkId: match.id });
|
|
604
567
|
process.exit(0);
|
|
605
568
|
}
|
|
606
569
|
catch (err) {
|
|
@@ -617,17 +580,18 @@ function ticketCommand(program) {
|
|
|
617
580
|
try {
|
|
618
581
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
619
582
|
if (!ctx.projectSlug) {
|
|
620
|
-
(0,
|
|
621
|
-
process.exit(2);
|
|
622
|
-
return;
|
|
583
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
623
584
|
}
|
|
624
585
|
if (!ctx.apiKey) {
|
|
625
|
-
(0,
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
586
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
587
|
+
}
|
|
588
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
589
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
590
|
+
await (0, generated_1.labelsControllerAssignLabelFromHttp)({
|
|
591
|
+
slug: ctx.projectSlug,
|
|
592
|
+
ref,
|
|
593
|
+
requestBody: { labelId: options.label },
|
|
594
|
+
});
|
|
631
595
|
console.log(`✓ Label attached to ticket ${ref}`);
|
|
632
596
|
process.exit(0);
|
|
633
597
|
}
|
|
@@ -645,17 +609,18 @@ function ticketCommand(program) {
|
|
|
645
609
|
try {
|
|
646
610
|
const ctx = await (0, config_1.resolveContext)({ projectSlug: options.project });
|
|
647
611
|
if (!ctx.projectSlug) {
|
|
648
|
-
(0,
|
|
649
|
-
process.exit(2);
|
|
650
|
-
return;
|
|
612
|
+
(0, error_1.handleApiError)(new Error('Project not configured. Run: koda init'), { configError: true });
|
|
651
613
|
}
|
|
652
614
|
if (!ctx.apiKey) {
|
|
653
|
-
(0,
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
615
|
+
(0, error_1.handleApiError)(new Error('API key or URL not configured. Run: koda login --api-key <key>'), { configError: true });
|
|
616
|
+
}
|
|
617
|
+
OpenAPI_1.OpenAPI.BASE = ctx.apiUrl.replace(/\/api\/?$/, '');
|
|
618
|
+
OpenAPI_1.OpenAPI.TOKEN = ctx.apiKey;
|
|
619
|
+
await (0, generated_1.labelsControllerRemoveLabelFromHttp)({
|
|
620
|
+
slug: ctx.projectSlug,
|
|
621
|
+
ref,
|
|
622
|
+
labelId: options.label,
|
|
623
|
+
});
|
|
659
624
|
console.log(`✓ Label detached from ticket ${ref}`);
|
|
660
625
|
process.exit(0);
|
|
661
626
|
}
|