@bussolabs/closeyourit-cli 0.0.17 → 0.0.19
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/README.md +8 -0
- package/dist/commands/agents/assign.d.ts +13 -0
- package/dist/commands/agents/assign.js +25 -0
- package/dist/commands/agents/create.d.ts +22 -0
- package/dist/commands/agents/create.js +58 -0
- package/dist/commands/agents/delete.d.ts +12 -0
- package/dist/commands/agents/delete.js +25 -0
- package/dist/commands/agents/list.d.ts +10 -0
- package/dist/commands/agents/list.js +34 -0
- package/dist/commands/agents/runs/list.d.ts +12 -0
- package/dist/commands/agents/runs/list.js +32 -0
- package/dist/commands/agents/runs/show.d.ts +10 -0
- package/dist/commands/agents/runs/show.js +21 -0
- package/dist/commands/agents/show.d.ts +9 -0
- package/dist/commands/agents/show.js +20 -0
- package/dist/commands/agents/update.d.ts +23 -0
- package/dist/commands/agents/update.js +59 -0
- package/dist/commands/tickets/create.d.ts +10 -2
- package/dist/commands/tickets/create.js +6 -24
- package/dist/commands/tickets/show.d.ts +2 -0
- package/dist/commands/tickets/show.js +33 -7
- package/dist/commands/tickets/update.d.ts +7 -3
- package/dist/commands/tickets/update.js +4 -34
- package/dist/lib/ticket-body.d.ts +24 -0
- package/dist/lib/ticket-body.js +91 -0
- package/oclif.manifest.json +2318 -1679
- package/package.json +1 -1
|
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const base_1 = require("../../base");
|
|
5
5
|
const output_1 = require("../../lib/output");
|
|
6
|
+
const ticket_body_1 = require("../../lib/ticket-body");
|
|
6
7
|
class TicketsUpdate extends base_1.BaseCommand {
|
|
7
8
|
// PUT /cli/v1/projects/:p/tickets/:id maps to Ticketing::UpdateTicket, a full replace:
|
|
8
9
|
// fields you omit are cleared server-side. Pass the complete desired state, not a partial patch.
|
|
9
10
|
static description = 'Update a ticket (full replace — fields you omit are cleared server-side)';
|
|
10
11
|
static examples = [
|
|
11
12
|
'<%= config.bin %> tickets update <ticket-id> --project acme-api --title "New title"',
|
|
12
|
-
'<%= config.bin %> tickets update <ticket-id> -p acme-api --title "Login bug" --
|
|
13
|
+
'<%= config.bin %> tickets update <ticket-id> -p acme-api --title "Login bug" --scenarios \'[{"step_given":"logged out","step_when":"I submit","step_then":"it 500s","step_expected":"dashboard loads"}]\' --condition "login works"',
|
|
13
14
|
];
|
|
14
15
|
static args = {
|
|
15
16
|
id: core_1.Args.string({ description: 'Ticket id', required: true }),
|
|
@@ -18,17 +19,7 @@ class TicketsUpdate extends base_1.BaseCommand {
|
|
|
18
19
|
...base_1.projectFlag,
|
|
19
20
|
title: core_1.Flags.string({ description: 'Ticket title' }),
|
|
20
21
|
kind: core_1.Flags.string({ description: 'Ticket kind (bug, feature, improvement)' }),
|
|
21
|
-
|
|
22
|
-
weight: core_1.Flags.string({ description: 'Story points (positive integer)' }),
|
|
23
|
-
'step-given': core_1.Flags.string({ description: 'Given (precondition)' }),
|
|
24
|
-
'step-when': core_1.Flags.string({ description: 'When (action)' }),
|
|
25
|
-
'step-then': core_1.Flags.string({ description: 'Then (outcome)' }),
|
|
26
|
-
'step-expected': core_1.Flags.string({ description: 'Expected result' }),
|
|
27
|
-
'status-id': core_1.Flags.string({ description: 'Status lookup id' }),
|
|
28
|
-
'priority-id': core_1.Flags.string({ description: 'Priority lookup id' }),
|
|
29
|
-
'assignee-id': core_1.Flags.string({ description: 'Assignee account id' }),
|
|
30
|
-
'milestone-id': core_1.Flags.string({ description: 'Milestone id (of this project)' }),
|
|
31
|
-
'platform-id': core_1.Flags.string({ description: 'Affected platform id (repeatable)', multiple: true }),
|
|
22
|
+
...ticket_body_1.ticketBodyFlags,
|
|
32
23
|
};
|
|
33
24
|
async run() {
|
|
34
25
|
const { args, flags } = await this.parse(TicketsUpdate);
|
|
@@ -38,28 +29,7 @@ class TicketsUpdate extends base_1.BaseCommand {
|
|
|
38
29
|
body.title = flags.title;
|
|
39
30
|
if (flags.kind !== undefined)
|
|
40
31
|
body.kind = flags.kind;
|
|
41
|
-
|
|
42
|
-
body.description = flags.description;
|
|
43
|
-
if (flags.weight !== undefined)
|
|
44
|
-
body.weight = flags.weight;
|
|
45
|
-
if (flags['step-given'] !== undefined)
|
|
46
|
-
body.step_given = flags['step-given'];
|
|
47
|
-
if (flags['step-when'] !== undefined)
|
|
48
|
-
body.step_when = flags['step-when'];
|
|
49
|
-
if (flags['step-then'] !== undefined)
|
|
50
|
-
body.step_then = flags['step-then'];
|
|
51
|
-
if (flags['step-expected'] !== undefined)
|
|
52
|
-
body.step_expected = flags['step-expected'];
|
|
53
|
-
if (flags['status-id'] !== undefined)
|
|
54
|
-
body.status_id = flags['status-id'];
|
|
55
|
-
if (flags['priority-id'] !== undefined)
|
|
56
|
-
body.priority_id = flags['priority-id'];
|
|
57
|
-
if (flags['assignee-id'] !== undefined)
|
|
58
|
-
body.assignee_id = flags['assignee-id'];
|
|
59
|
-
if (flags['milestone-id'] !== undefined)
|
|
60
|
-
body.milestone_id = flags['milestone-id'];
|
|
61
|
-
if (flags['platform-id'] !== undefined)
|
|
62
|
-
body.platform_ids = flags['platform-id'];
|
|
32
|
+
(0, ticket_body_1.applyTicketBody)(body, flags);
|
|
63
33
|
const res = await this.api.put(`/cli/v1/projects/${projectId}/tickets/${args.id}`, body);
|
|
64
34
|
if (!this.jsonEnabled()) {
|
|
65
35
|
this.log('Ticket updated:');
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const ticketBodyFlags: {
|
|
2
|
+
description: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
3
|
+
'technical-analysis': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
4
|
+
scenarios: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
5
|
+
'step-given': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
|
+
'step-when': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
'step-then': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
'step-expected': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
condition: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
weight: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
'due-at': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
'status-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
'priority-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
'assignee-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
'milestone-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
+
'platform-id': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
|
+
};
|
|
18
|
+
type BodyFlags = Record<string, unknown>;
|
|
19
|
+
export declare function scenariosFromFlags(flags: BodyFlags): Array<Record<string, unknown>> | undefined;
|
|
20
|
+
export declare function conditionsFromFlags(flags: BodyFlags): Array<{
|
|
21
|
+
text: string;
|
|
22
|
+
}> | undefined;
|
|
23
|
+
export declare function applyTicketBody(body: BodyFlags, flags: BodyFlags): void;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ticketBodyFlags = void 0;
|
|
4
|
+
exports.scenariosFromFlags = scenariosFromFlags;
|
|
5
|
+
exports.conditionsFromFlags = conditionsFromFlags;
|
|
6
|
+
exports.applyTicketBody = applyTicketBody;
|
|
7
|
+
const core_1 = require("@oclif/core");
|
|
8
|
+
// Flag del corpo ticket condivisi da `tickets create` e `tickets update`: descrizione (sommario
|
|
9
|
+
// human-simple) + N scenari BDD + N condizioni DoD + analisi tecnica (registro tecnico separato) +
|
|
10
|
+
// metadati. Gli scenari si passano come JSON (--scenarios) oppure, per un SINGOLO scenario, con le
|
|
11
|
+
// scorciatoie --step-*. Le condizioni DoD sono --condition (ripetibile). Parità piena col form web.
|
|
12
|
+
exports.ticketBodyFlags = {
|
|
13
|
+
description: core_1.Flags.string({ description: 'Free-form description (human-simple summary)' }),
|
|
14
|
+
'technical-analysis': core_1.Flags.string({ description: 'Technical analysis (stack, cause) — kept out of the human-simple body' }),
|
|
15
|
+
scenarios: core_1.Flags.string({
|
|
16
|
+
description: 'BDD scenarios as a JSON array: [{"title","step_given","step_when","step_then","step_expected"}]',
|
|
17
|
+
}),
|
|
18
|
+
'step-given': core_1.Flags.string({ description: 'Shorthand for a single scenario: Given (precondition)' }),
|
|
19
|
+
'step-when': core_1.Flags.string({ description: 'Shorthand for a single scenario: When (action)' }),
|
|
20
|
+
'step-then': core_1.Flags.string({ description: 'Shorthand for a single scenario: Then (outcome)' }),
|
|
21
|
+
'step-expected': core_1.Flags.string({ description: 'Shorthand for a single scenario: Expected result' }),
|
|
22
|
+
condition: core_1.Flags.string({ description: 'Definition-of-Done line (repeatable)', multiple: true }),
|
|
23
|
+
weight: core_1.Flags.string({ description: 'Story points (positive integer)' }),
|
|
24
|
+
'due-at': core_1.Flags.string({ description: 'Due date (ISO 8601)' }),
|
|
25
|
+
'status-id': core_1.Flags.string({ description: 'Status lookup id' }),
|
|
26
|
+
'priority-id': core_1.Flags.string({ description: 'Priority lookup id' }),
|
|
27
|
+
'assignee-id': core_1.Flags.string({ description: 'Assignee account id' }),
|
|
28
|
+
'milestone-id': core_1.Flags.string({ description: 'Milestone id (of this project)' }),
|
|
29
|
+
'platform-id': core_1.Flags.string({ description: 'Affected platform id (repeatable)', multiple: true }),
|
|
30
|
+
};
|
|
31
|
+
const STEP_KEYS = [
|
|
32
|
+
['step-given', 'step_given'],
|
|
33
|
+
['step-when', 'step_when'],
|
|
34
|
+
['step-then', 'step_then'],
|
|
35
|
+
['step-expected', 'step_expected'],
|
|
36
|
+
];
|
|
37
|
+
// Scenari da --scenarios (JSON) OPPURE dalle scorciatoie --step-* (un solo scenario). undefined se assenti.
|
|
38
|
+
function scenariosFromFlags(flags) {
|
|
39
|
+
if (flags.scenarios !== undefined) {
|
|
40
|
+
let parsed;
|
|
41
|
+
try {
|
|
42
|
+
parsed = JSON.parse(flags.scenarios);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
throw new Error('--scenarios must be a valid JSON array');
|
|
46
|
+
}
|
|
47
|
+
if (!Array.isArray(parsed))
|
|
48
|
+
throw new Error('--scenarios must be a JSON array');
|
|
49
|
+
return parsed;
|
|
50
|
+
}
|
|
51
|
+
const scenario = {};
|
|
52
|
+
for (const [flagKey, bodyKey] of STEP_KEYS) {
|
|
53
|
+
if (flags[flagKey] !== undefined)
|
|
54
|
+
scenario[bodyKey] = flags[flagKey];
|
|
55
|
+
}
|
|
56
|
+
return Object.keys(scenario).length > 0 ? [scenario] : undefined;
|
|
57
|
+
}
|
|
58
|
+
// Condizioni DoD da --condition (ripetibile). undefined se assenti.
|
|
59
|
+
function conditionsFromFlags(flags) {
|
|
60
|
+
const conditions = flags.condition;
|
|
61
|
+
if (conditions === undefined)
|
|
62
|
+
return undefined;
|
|
63
|
+
return conditions.map((text) => ({ text }));
|
|
64
|
+
}
|
|
65
|
+
// Popola `body` coi campi del corpo presenti nei flag (chiavi snake_case attese dall'API CLI).
|
|
66
|
+
function applyTicketBody(body, flags) {
|
|
67
|
+
if (flags.description !== undefined)
|
|
68
|
+
body.description = flags.description;
|
|
69
|
+
if (flags['technical-analysis'] !== undefined)
|
|
70
|
+
body.technical_analysis = flags['technical-analysis'];
|
|
71
|
+
if (flags.weight !== undefined)
|
|
72
|
+
body.weight = flags.weight;
|
|
73
|
+
if (flags['due-at'] !== undefined)
|
|
74
|
+
body.due_at = flags['due-at'];
|
|
75
|
+
if (flags['status-id'] !== undefined)
|
|
76
|
+
body.status_id = flags['status-id'];
|
|
77
|
+
if (flags['priority-id'] !== undefined)
|
|
78
|
+
body.priority_id = flags['priority-id'];
|
|
79
|
+
if (flags['assignee-id'] !== undefined)
|
|
80
|
+
body.assignee_id = flags['assignee-id'];
|
|
81
|
+
if (flags['milestone-id'] !== undefined)
|
|
82
|
+
body.milestone_id = flags['milestone-id'];
|
|
83
|
+
if (flags['platform-id'] !== undefined)
|
|
84
|
+
body.platform_ids = flags['platform-id'];
|
|
85
|
+
const scenarios = scenariosFromFlags(flags);
|
|
86
|
+
if (scenarios !== undefined)
|
|
87
|
+
body.scenarios_attributes = scenarios;
|
|
88
|
+
const conditions = conditionsFromFlags(flags);
|
|
89
|
+
if (conditions !== undefined)
|
|
90
|
+
body.conditions_attributes = conditions;
|
|
91
|
+
}
|