@bussolabs/closeyourit-cli 0.0.18 → 0.0.20
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 +4 -0
- package/dist/commands/projects/github-update.d.ts +15 -0
- package/dist/commands/projects/github-update.js +55 -0
- package/dist/commands/projects/github.d.ts +9 -0
- package/dist/commands/projects/github.js +38 -0
- package/dist/commands/tickets/branch.d.ts +12 -0
- package/dist/commands/tickets/branch.js +27 -0
- package/dist/commands/tickets/create.d.ts +10 -2
- package/dist/commands/tickets/create.js +6 -24
- package/dist/commands/tickets/pr.d.ts +12 -0
- package/dist/commands/tickets/pr.js +27 -0
- 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 +3223 -2917
- package/opencli.json +150 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,6 +39,8 @@ organization are stored locally.
|
|
|
39
39
|
| `projects unlink-server <link-id> --project <id\|key> --confirm` | Unlink a server host from the project. |
|
|
40
40
|
| `projects settings show --project <id\|key>` | Show a project's settings (log/analytics retention + feature flags). |
|
|
41
41
|
| `projects settings update --project <id\|key> [--logs-retention-days] [--analytics-retention-days] [--roadmap-enabled] [--quick-bug-report-enabled] [--analytics-enabled]` | Update a project's settings (only the passed fields change). |
|
|
42
|
+
| `projects github --project <id\|key>` | Show a project's GitHub integration (repo link + tag→release binding rules). |
|
|
43
|
+
| `projects github-update --project <id\|key> [--default-branch] [--production-environment-id] [--staging-environment-id] [--sync-enabled] [--tag-binding-enabled] [--autoclose-on-merge]` | Update a project's GitHub binding rules (only the passed fields change). |
|
|
42
44
|
| `groups list [--page]` | List groups (macro-projects) in your org. |
|
|
43
45
|
| `groups create <name> [--color] [--roadmap-enabled]` | Create a group (container of related projects, e.g. "DriverOne"). |
|
|
44
46
|
| `groups update <id\|name> [--name] [--color] [--roadmap-enabled]` | Update a group (rename, recolor, toggle roadmap). |
|
|
@@ -78,6 +80,8 @@ organization are stored locally.
|
|
|
78
80
|
| `tickets reviewer <id> --project <id\|key> --reviewer-id <account-id>` | Set the reviewer of a ticket (requires tickets.assign). |
|
|
79
81
|
| `tickets unreviewer <id> --project <id\|key>` | Remove the reviewer of a ticket. |
|
|
80
82
|
| `tickets watch\|unwatch <id> --project <id\|key>` | Watch / stop watching a ticket (its notifications). |
|
|
83
|
+
| `tickets branch <id\|code> --project <id\|key>` | Create a GitHub branch from a ticket (name prefixed with the ticket code). |
|
|
84
|
+
| `tickets pr <id\|code> --project <id\|key>` | Open a GitHub pull request from a ticket (head = the ticket branch). |
|
|
81
85
|
| `ideas delete <id> --project <id\|key> --confirm` | Delete an idea (author always allowed; others need ideas.delete). |
|
|
82
86
|
| `ideas archive\|unarchive <id> --project <id\|key>` | Archive an idea (open → archived) / reopen it. |
|
|
83
87
|
| `ideas case-update <idea-id> <case-id> --project <id\|key> [--title] [--description]` | Update a case (example) of an idea. |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class ProjectsGithubUpdate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
'default-branch': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
'production-environment-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
'staging-environment-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
'sync-enabled': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
'tag-binding-enabled': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
'autoclose-on-merge': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<unknown>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../base");
|
|
5
|
+
const output_1 = require("../../lib/output");
|
|
6
|
+
class ProjectsGithubUpdate extends base_1.BaseCommand {
|
|
7
|
+
static description = 'Update a project GitHub binding rules (environment mapping + sync/binding/autoclose flags); only the passed fields change';
|
|
8
|
+
static examples = [
|
|
9
|
+
'<%= config.bin %> projects github-update -p LBRA --production-environment-id <env-uuid>',
|
|
10
|
+
'<%= config.bin %> projects github-update -p LBRA --no-tag-binding-enabled',
|
|
11
|
+
'<%= config.bin %> projects github-update -p LBRA --default-branch main --autoclose-on-merge',
|
|
12
|
+
];
|
|
13
|
+
static flags = {
|
|
14
|
+
...base_1.projectFlag,
|
|
15
|
+
'default-branch': core_1.Flags.string({ description: 'Default base branch used to create branches/PRs' }),
|
|
16
|
+
'production-environment-id': core_1.Flags.string({
|
|
17
|
+
description: 'Environment id mapped to STABLE tags (production target)',
|
|
18
|
+
}),
|
|
19
|
+
'staging-environment-id': core_1.Flags.string({
|
|
20
|
+
description: 'Environment id mapped to PRE-RELEASE tags (staging target)',
|
|
21
|
+
}),
|
|
22
|
+
'sync-enabled': core_1.Flags.boolean({ allowNo: true, description: 'Enable/disable processing of webhook events' }),
|
|
23
|
+
'tag-binding-enabled': core_1.Flags.boolean({ allowNo: true, description: 'Enable/disable tag→release live binding' }),
|
|
24
|
+
'autoclose-on-merge': core_1.Flags.boolean({
|
|
25
|
+
allowNo: true,
|
|
26
|
+
description: 'Enable/disable moving the ticket to done on PR merge',
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
async run() {
|
|
30
|
+
const { flags } = await this.parse(ProjectsGithubUpdate);
|
|
31
|
+
const projectId = await this.resolveProjectId(flags.project);
|
|
32
|
+
const body = {};
|
|
33
|
+
if (flags['default-branch'] !== undefined)
|
|
34
|
+
body.default_branch = flags['default-branch'];
|
|
35
|
+
if (flags['production-environment-id'] !== undefined)
|
|
36
|
+
body.production_environment_id = flags['production-environment-id'];
|
|
37
|
+
if (flags['staging-environment-id'] !== undefined)
|
|
38
|
+
body.staging_environment_id = flags['staging-environment-id'];
|
|
39
|
+
if (flags['sync-enabled'] !== undefined)
|
|
40
|
+
body.sync_enabled = flags['sync-enabled'];
|
|
41
|
+
if (flags['tag-binding-enabled'] !== undefined)
|
|
42
|
+
body.tag_binding_enabled = flags['tag-binding-enabled'];
|
|
43
|
+
if (flags['autoclose-on-merge'] !== undefined)
|
|
44
|
+
body.autoclose_on_merge = flags['autoclose-on-merge'];
|
|
45
|
+
// The GitHub action responds to both PATCH and PUT (Rails singleton `resource` update); the CLI
|
|
46
|
+
// transport speaks PUT — the backend applies only the keys present in the body either way.
|
|
47
|
+
const res = await this.api.put(`/cli/v1/projects/${encodeURIComponent(projectId)}/github`, body);
|
|
48
|
+
if (!this.jsonEnabled()) {
|
|
49
|
+
this.log('GitHub integration updated:');
|
|
50
|
+
this.log((0, output_1.renderRecord)(res.data ?? {}));
|
|
51
|
+
}
|
|
52
|
+
return res;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.default = ProjectsGithubUpdate;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class ProjectsGithub extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<unknown>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const base_1 = require("../../base");
|
|
4
|
+
const output_1 = require("../../lib/output");
|
|
5
|
+
class ProjectsGithub extends base_1.BaseCommand {
|
|
6
|
+
static description = 'Show a project GitHub integration (repo link + tag→release binding rules)';
|
|
7
|
+
static examples = [
|
|
8
|
+
'<%= config.bin %> projects github --project legalbloom-rails',
|
|
9
|
+
'<%= config.bin %> projects github -p LBRA',
|
|
10
|
+
'<%= config.bin %> projects github -p LBRA --json',
|
|
11
|
+
];
|
|
12
|
+
static flags = { ...base_1.projectFlag };
|
|
13
|
+
async run() {
|
|
14
|
+
const { flags } = await this.parse(ProjectsGithub);
|
|
15
|
+
const projectId = await this.resolveProjectId(flags.project);
|
|
16
|
+
const res = await this.api.get(`/cli/v1/projects/${encodeURIComponent(projectId)}/github`);
|
|
17
|
+
if (!this.jsonEnabled()) {
|
|
18
|
+
const data = res.data ?? {};
|
|
19
|
+
// Flatten the repository block into a single record: unset fields render as `-` when not connected.
|
|
20
|
+
const repo = (data.repository ?? {});
|
|
21
|
+
this.log('GitHub integration:');
|
|
22
|
+
this.log((0, output_1.renderRecord)({
|
|
23
|
+
project_id: data.project_id,
|
|
24
|
+
installed: data.installed,
|
|
25
|
+
connected: data.connected,
|
|
26
|
+
full_name: repo.full_name,
|
|
27
|
+
default_branch: repo.default_branch,
|
|
28
|
+
sync_enabled: repo.sync_enabled,
|
|
29
|
+
tag_binding_enabled: repo.tag_binding_enabled,
|
|
30
|
+
autoclose_on_merge: repo.autoclose_on_merge,
|
|
31
|
+
production_environment_id: repo.production_environment_id,
|
|
32
|
+
staging_environment_id: repo.staging_environment_id,
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
return res;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.default = ProjectsGithub;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class TicketsBranch extends BaseCommand {
|
|
3
|
+
static args: {
|
|
4
|
+
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<unknown>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../base");
|
|
5
|
+
const output_1 = require("../../lib/output");
|
|
6
|
+
class TicketsBranch extends base_1.BaseCommand {
|
|
7
|
+
static args = {
|
|
8
|
+
id: core_1.Args.string({ description: 'Ticket id or code (e.g. DRFL-3)', required: true }),
|
|
9
|
+
};
|
|
10
|
+
static description = 'Create a GitHub branch from a ticket (name prefixed with the ticket code)';
|
|
11
|
+
static examples = [
|
|
12
|
+
'<%= config.bin %> tickets branch DRFL-3 --project driverone-flutter',
|
|
13
|
+
'<%= config.bin %> tickets branch DRFL-3 -p driverone-flutter --json',
|
|
14
|
+
];
|
|
15
|
+
static flags = { ...base_1.projectFlag };
|
|
16
|
+
async run() {
|
|
17
|
+
const { args, flags } = await this.parse(TicketsBranch);
|
|
18
|
+
const projectId = await this.resolveProjectId(flags.project);
|
|
19
|
+
const res = await this.api.post(`/cli/v1/projects/${encodeURIComponent(projectId)}/tickets/${encodeURIComponent(args.id)}/github/branch`);
|
|
20
|
+
if (!this.jsonEnabled()) {
|
|
21
|
+
this.log('Branch created:');
|
|
22
|
+
this.log((0, output_1.renderRecord)(res.data ?? {}));
|
|
23
|
+
}
|
|
24
|
+
return res;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.default = TicketsBranch;
|
|
@@ -3,15 +3,23 @@ export default class TicketsCreate extends BaseCommand {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
-
title: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
-
kind: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
6
|
description: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
'technical-analysis': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
scenarios: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
9
|
'step-given': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
10
|
'step-when': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
11
|
'step-then': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
12
|
'step-expected': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
condition: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
weight: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
'due-at': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
16
|
'status-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
17
|
'priority-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
+
'assignee-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
|
+
'milestone-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
20
|
+
'platform-id': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
21
|
+
title: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
22
|
+
kind: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
23
|
project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
24
|
};
|
|
17
25
|
run(): Promise<unknown>;
|
|
@@ -3,47 +3,29 @@ 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 TicketsCreate extends base_1.BaseCommand {
|
|
7
8
|
static description = 'Create a ticket';
|
|
8
9
|
static examples = [
|
|
9
10
|
'<%= config.bin %> tickets create --project acme-api --title "Checkout fails"',
|
|
10
11
|
'<%= config.bin %> tickets create -p acme-api --title "Login bug" --kind bug --step-given "logged out" --step-when "I submit" --step-then "it 500s"',
|
|
12
|
+
'<%= config.bin %> tickets create -p acme-api --title "Checkout" --scenarios \'[{"title":"Happy","step_given":"logged in","step_when":"I pay","step_then":"order created"}]\' --condition "confirmation email is sent"',
|
|
11
13
|
];
|
|
12
14
|
static flags = {
|
|
13
15
|
...base_1.projectFlag,
|
|
14
16
|
title: core_1.Flags.string({ description: 'Ticket title', required: true }),
|
|
15
|
-
kind: core_1.Flags.string({ description: 'Ticket kind', default: 'bug' }),
|
|
16
|
-
|
|
17
|
-
'step-given': core_1.Flags.string({ description: 'Given (precondition)' }),
|
|
18
|
-
'step-when': core_1.Flags.string({ description: 'When (action)' }),
|
|
19
|
-
'step-then': core_1.Flags.string({ description: 'Then (outcome)' }),
|
|
20
|
-
'step-expected': core_1.Flags.string({ description: 'Expected result' }),
|
|
21
|
-
'status-id': core_1.Flags.string({ description: 'Status lookup id' }),
|
|
22
|
-
'priority-id': core_1.Flags.string({ description: 'Priority lookup id' }),
|
|
17
|
+
kind: core_1.Flags.string({ description: 'Ticket kind (bug, feature, improvement)', default: 'bug' }),
|
|
18
|
+
...ticket_body_1.ticketBodyFlags,
|
|
23
19
|
};
|
|
24
20
|
async run() {
|
|
25
21
|
const { flags } = await this.parse(TicketsCreate);
|
|
26
22
|
const projectId = await this.resolveProjectId(flags.project);
|
|
27
23
|
const body = { title: flags.title, kind: flags.kind };
|
|
28
|
-
|
|
29
|
-
body.description = flags.description;
|
|
30
|
-
if (flags['step-given'] !== undefined)
|
|
31
|
-
body.step_given = flags['step-given'];
|
|
32
|
-
if (flags['step-when'] !== undefined)
|
|
33
|
-
body.step_when = flags['step-when'];
|
|
34
|
-
if (flags['step-then'] !== undefined)
|
|
35
|
-
body.step_then = flags['step-then'];
|
|
36
|
-
if (flags['step-expected'] !== undefined)
|
|
37
|
-
body.step_expected = flags['step-expected'];
|
|
38
|
-
if (flags['status-id'] !== undefined)
|
|
39
|
-
body.status_id = flags['status-id'];
|
|
40
|
-
if (flags['priority-id'] !== undefined)
|
|
41
|
-
body.priority_id = flags['priority-id'];
|
|
24
|
+
(0, ticket_body_1.applyTicketBody)(body, flags);
|
|
42
25
|
const res = await this.api.post(`/cli/v1/projects/${projectId}/tickets`, body);
|
|
43
26
|
if (!this.jsonEnabled()) {
|
|
44
|
-
const ticket = res.data ?? {};
|
|
45
27
|
this.log('Ticket created:');
|
|
46
|
-
this.log((0, output_1.renderRecord)(
|
|
28
|
+
this.log((0, output_1.renderRecord)(res.data ?? {}));
|
|
47
29
|
}
|
|
48
30
|
return res;
|
|
49
31
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class TicketsPr extends BaseCommand {
|
|
3
|
+
static args: {
|
|
4
|
+
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<unknown>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../base");
|
|
5
|
+
const output_1 = require("../../lib/output");
|
|
6
|
+
class TicketsPr extends base_1.BaseCommand {
|
|
7
|
+
static args = {
|
|
8
|
+
id: core_1.Args.string({ description: 'Ticket id or code (e.g. DRFL-3)', required: true }),
|
|
9
|
+
};
|
|
10
|
+
static description = 'Open a GitHub pull request from a ticket (head = the ticket branch, title prefixed with the code)';
|
|
11
|
+
static examples = [
|
|
12
|
+
'<%= config.bin %> tickets pr DRFL-3 --project driverone-flutter',
|
|
13
|
+
'<%= config.bin %> tickets pr DRFL-3 -p driverone-flutter --json',
|
|
14
|
+
];
|
|
15
|
+
static flags = { ...base_1.projectFlag };
|
|
16
|
+
async run() {
|
|
17
|
+
const { args, flags } = await this.parse(TicketsPr);
|
|
18
|
+
const projectId = await this.resolveProjectId(flags.project);
|
|
19
|
+
const res = await this.api.post(`/cli/v1/projects/${encodeURIComponent(projectId)}/tickets/${encodeURIComponent(args.id)}/github/pull_request`);
|
|
20
|
+
if (!this.jsonEnabled()) {
|
|
21
|
+
this.log('Pull request opened:');
|
|
22
|
+
this.log((0, output_1.renderRecord)(res.data ?? {}));
|
|
23
|
+
}
|
|
24
|
+
return res;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.default = TicketsPr;
|
|
@@ -88,20 +88,46 @@ class TicketsShow extends base_1.BaseCommand {
|
|
|
88
88
|
created_at: ticket.created_at,
|
|
89
89
|
updated_at: ticket.updated_at,
|
|
90
90
|
}));
|
|
91
|
-
//
|
|
92
|
-
const
|
|
91
|
+
// Body: description + technical analysis (only if present).
|
|
92
|
+
const scalarBlocks = [
|
|
93
93
|
['Description', ticket.description],
|
|
94
|
-
['
|
|
95
|
-
['When', ticket.step_when],
|
|
96
|
-
['Then', ticket.step_then],
|
|
97
|
-
['Expected', ticket.step_expected],
|
|
94
|
+
['Technical analysis', ticket.technical_analysis],
|
|
98
95
|
];
|
|
99
|
-
for (const [label, value] of
|
|
96
|
+
for (const [label, value] of scalarBlocks) {
|
|
100
97
|
if (value === null || value === undefined || String(value).trim() === '')
|
|
101
98
|
continue;
|
|
102
99
|
this.log(`\n${label}\n${'-'.repeat(label.length)}`);
|
|
103
100
|
this.log((0, output_1.sanitizeMultiline)(value));
|
|
104
101
|
}
|
|
102
|
+
this.renderScenarios(Array.isArray(ticket.scenarios) ? ticket.scenarios : []);
|
|
103
|
+
this.renderConditions(Array.isArray(ticket.conditions) ? ticket.conditions : []);
|
|
104
|
+
}
|
|
105
|
+
// BDD scenarios: one block per scenario, only the steps present.
|
|
106
|
+
renderScenarios(scenarios) {
|
|
107
|
+
const steps = [
|
|
108
|
+
['Given', 'step_given'],
|
|
109
|
+
['When', 'step_when'],
|
|
110
|
+
['Then', 'step_then'],
|
|
111
|
+
['Expected', 'step_expected'],
|
|
112
|
+
];
|
|
113
|
+
scenarios.forEach((scenario, index) => {
|
|
114
|
+
const title = scenario.title ? `Scenario ${index + 1}: ${(0, output_1.sanitize)(scenario.title)}` : `Scenario ${index + 1}`;
|
|
115
|
+
this.log(`\n${title}\n${'-'.repeat(title.length)}`);
|
|
116
|
+
for (const [label, key] of steps) {
|
|
117
|
+
const value = scenario[key];
|
|
118
|
+
if (value === null || value === undefined || String(value).trim() === '')
|
|
119
|
+
continue;
|
|
120
|
+
this.log(`${label}: ${(0, output_1.sanitizeMultiline)(value)}`);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
// Definition of Done: one bullet per condition.
|
|
125
|
+
renderConditions(conditions) {
|
|
126
|
+
if (conditions.length === 0)
|
|
127
|
+
return;
|
|
128
|
+
this.log('\nDefinition of Done\n------------------');
|
|
129
|
+
for (const condition of conditions)
|
|
130
|
+
this.log(`- ${(0, output_1.sanitizeMultiline)(condition.text ?? '')}`);
|
|
105
131
|
}
|
|
106
132
|
}
|
|
107
133
|
exports.default = TicketsShow;
|
|
@@ -6,19 +6,23 @@ export default class TicketsUpdate extends BaseCommand {
|
|
|
6
6
|
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
7
|
};
|
|
8
8
|
static flags: {
|
|
9
|
-
title: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
-
kind: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
9
|
description: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
-
|
|
10
|
+
'technical-analysis': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
scenarios: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
12
|
'step-given': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
13
|
'step-when': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
14
|
'step-then': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
15
|
'step-expected': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
+
condition: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
|
+
weight: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
+
'due-at': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
19
|
'status-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
20
|
'priority-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
21
|
'assignee-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
20
22
|
'milestone-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
21
23
|
'platform-id': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
24
|
+
title: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
25
|
+
kind: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
22
26
|
project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
23
27
|
};
|
|
24
28
|
run(): Promise<unknown>;
|
|
@@ -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
|
+
}
|