@bussolabs/closeyourit-cli 0.0.2

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.
Files changed (99) hide show
  1. package/README.md +99 -0
  2. package/bin/run.js +2 -0
  3. package/dist/base.d.ts +34 -0
  4. package/dist/base.js +85 -0
  5. package/dist/commands/errors/list.d.ts +11 -0
  6. package/dist/commands/errors/list.js +36 -0
  7. package/dist/commands/errors/mute.d.ts +12 -0
  8. package/dist/commands/errors/mute.js +22 -0
  9. package/dist/commands/errors/reopen.d.ts +12 -0
  10. package/dist/commands/errors/reopen.js +22 -0
  11. package/dist/commands/errors/resolve.d.ts +12 -0
  12. package/dist/commands/errors/resolve.js +22 -0
  13. package/dist/commands/errors/show.d.ts +12 -0
  14. package/dist/commands/errors/show.js +23 -0
  15. package/dist/commands/errors/unmute.d.ts +12 -0
  16. package/dist/commands/errors/unmute.js +22 -0
  17. package/dist/commands/groups/create.d.ts +12 -0
  18. package/dist/commands/groups/create.js +31 -0
  19. package/dist/commands/groups/list.d.ts +9 -0
  20. package/dist/commands/groups/list.js +19 -0
  21. package/dist/commands/invitations/create.d.ts +12 -0
  22. package/dist/commands/invitations/create.js +38 -0
  23. package/dist/commands/invitations/list.d.ts +9 -0
  24. package/dist/commands/invitations/list.js +24 -0
  25. package/dist/commands/invitations/revoke.d.ts +9 -0
  26. package/dist/commands/invitations/revoke.js +20 -0
  27. package/dist/commands/login.d.ts +9 -0
  28. package/dist/commands/login.js +63 -0
  29. package/dist/commands/logout.d.ts +6 -0
  30. package/dist/commands/logout.js +17 -0
  31. package/dist/commands/members/list.d.ts +9 -0
  32. package/dist/commands/members/list.js +24 -0
  33. package/dist/commands/metrics/list.d.ts +11 -0
  34. package/dist/commands/metrics/list.js +36 -0
  35. package/dist/commands/metrics/show.d.ts +12 -0
  36. package/dist/commands/metrics/show.js +23 -0
  37. package/dist/commands/projects/create.d.ts +15 -0
  38. package/dist/commands/projects/create.js +49 -0
  39. package/dist/commands/projects/list.d.ts +9 -0
  40. package/dist/commands/projects/list.js +19 -0
  41. package/dist/commands/projects/set-environments.d.ts +11 -0
  42. package/dist/commands/projects/set-environments.js +42 -0
  43. package/dist/commands/projects/show.d.ts +9 -0
  44. package/dist/commands/projects/show.js +22 -0
  45. package/dist/commands/roles/create.d.ts +13 -0
  46. package/dist/commands/roles/create.js +36 -0
  47. package/dist/commands/roles/delete.d.ts +9 -0
  48. package/dist/commands/roles/delete.js +21 -0
  49. package/dist/commands/roles/list.d.ts +9 -0
  50. package/dist/commands/roles/list.js +23 -0
  51. package/dist/commands/roles/show.d.ts +9 -0
  52. package/dist/commands/roles/show.js +25 -0
  53. package/dist/commands/roles/update.d.ts +14 -0
  54. package/dist/commands/roles/update.js +44 -0
  55. package/dist/commands/teams/add-member.d.ts +10 -0
  56. package/dist/commands/teams/add-member.js +26 -0
  57. package/dist/commands/teams/create.d.ts +16 -0
  58. package/dist/commands/teams/create.js +50 -0
  59. package/dist/commands/teams/delete.d.ts +9 -0
  60. package/dist/commands/teams/delete.js +21 -0
  61. package/dist/commands/teams/list.d.ts +9 -0
  62. package/dist/commands/teams/list.js +27 -0
  63. package/dist/commands/teams/remove-member.d.ts +10 -0
  64. package/dist/commands/teams/remove-member.js +26 -0
  65. package/dist/commands/teams/show.d.ts +9 -0
  66. package/dist/commands/teams/show.js +27 -0
  67. package/dist/commands/teams/update.d.ts +17 -0
  68. package/dist/commands/teams/update.js +54 -0
  69. package/dist/commands/tickets/create.d.ts +18 -0
  70. package/dist/commands/tickets/create.js +51 -0
  71. package/dist/commands/tickets/list.d.ts +10 -0
  72. package/dist/commands/tickets/list.js +24 -0
  73. package/dist/commands/tickets/show.d.ts +12 -0
  74. package/dist/commands/tickets/show.js +23 -0
  75. package/dist/commands/tokens/create.d.ts +11 -0
  76. package/dist/commands/tokens/create.js +34 -0
  77. package/dist/commands/tokens/list.d.ts +9 -0
  78. package/dist/commands/tokens/list.js +25 -0
  79. package/dist/commands/tokens/revoke.d.ts +12 -0
  80. package/dist/commands/tokens/revoke.js +22 -0
  81. package/dist/commands/tokens/rotate.d.ts +12 -0
  82. package/dist/commands/tokens/rotate.js +28 -0
  83. package/dist/commands/whoami.d.ts +6 -0
  84. package/dist/commands/whoami.js +19 -0
  85. package/dist/errors/error-codes.d.ts +35 -0
  86. package/dist/errors/error-codes.js +40 -0
  87. package/dist/lib/api.d.ts +28 -0
  88. package/dist/lib/api.js +81 -0
  89. package/dist/lib/browser.d.ts +2 -0
  90. package/dist/lib/browser.js +32 -0
  91. package/dist/lib/config.d.ts +20 -0
  92. package/dist/lib/config.js +93 -0
  93. package/dist/lib/device-flow.d.ts +28 -0
  94. package/dist/lib/device-flow.js +62 -0
  95. package/dist/lib/output.d.ts +4 -0
  96. package/dist/lib/output.js +21 -0
  97. package/oclif.manifest.json +1954 -0
  98. package/opencli.json +229 -0
  99. package/package.json +34 -0
@@ -0,0 +1,44 @@
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 RolesUpdate extends base_1.BaseCommand {
7
+ static args = {
8
+ role: core_1.Args.string({ description: 'Role id (UUID) or name', required: true }),
9
+ };
10
+ static description = 'Update a role (rename, recolor, or replace its permission keys)';
11
+ static examples = [
12
+ '<%= config.bin %> roles update Client --permission tickets.edit --permission tickets.assign',
13
+ '<%= config.bin %> roles update Client --name "Client manager"',
14
+ ];
15
+ static flags = {
16
+ color: core_1.Flags.string({ description: 'Color label' }),
17
+ name: core_1.Flags.string({ description: 'New name' }),
18
+ permission: core_1.Flags.string({
19
+ description: 'Permission key (repeatable); when given, REPLACES the whole set',
20
+ multiple: true,
21
+ }),
22
+ };
23
+ async run() {
24
+ const { args, flags } = await this.parse(RolesUpdate);
25
+ const id = await this.resolveRoleId(args.role);
26
+ const body = {};
27
+ if (flags.name !== undefined)
28
+ body.name = flags.name;
29
+ if (flags.color !== undefined)
30
+ body.color = flags.color;
31
+ if (flags.permission !== undefined)
32
+ body.permission_keys = flags.permission;
33
+ const res = await this.api.put(`/cli/v1/roles/${id}`, body);
34
+ if (!this.jsonEnabled()) {
35
+ const data = res.data ?? {};
36
+ this.log('Role updated:');
37
+ this.log((0, output_1.renderRecord)(data));
38
+ const keys = Array.isArray(data.permission_keys) ? data.permission_keys : [];
39
+ this.log(`permissions: ${keys.length > 0 ? keys.join(', ') : '-'}`);
40
+ }
41
+ return res;
42
+ }
43
+ }
44
+ exports.default = RolesUpdate;
@@ -0,0 +1,10 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class TeamsAddMember extends BaseCommand {
3
+ static args: {
4
+ team: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
5
+ member: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ run(): Promise<unknown>;
10
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const base_1 = require("../../base");
5
+ class TeamsAddMember extends base_1.BaseCommand {
6
+ static args = {
7
+ team: core_1.Args.string({ description: 'Team id (UUID) or name', required: true }),
8
+ member: core_1.Args.string({ description: 'Member account id or email (must be an org member)', required: true }),
9
+ };
10
+ static description = 'Add a person to a team, keeping the existing members';
11
+ static examples = ['<%= config.bin %> teams add-member DriverOne client@acme.com'];
12
+ async run() {
13
+ const { args } = await this.parse(TeamsAddMember);
14
+ const teamId = await this.resolveTeamId(args.team);
15
+ const memberId = await this.resolveMemberId(args.member);
16
+ const current = await this.api.get(`/cli/v1/teams/${teamId}`);
17
+ const existing = Array.isArray(current.data.member_ids) ? current.data.member_ids : [];
18
+ const memberIds = [...new Set([...existing, memberId])];
19
+ const res = await this.api.put(`/cli/v1/teams/${teamId}`, { member_ids: memberIds });
20
+ if (!this.jsonEnabled()) {
21
+ this.log(`Added ${args.member} to team ${args.team} (${memberIds.length} members total).`);
22
+ }
23
+ return res;
24
+ }
25
+ }
26
+ exports.default = TeamsAddMember;
@@ -0,0 +1,16 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class TeamsCreate extends BaseCommand {
3
+ static args: {
4
+ name: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ color: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ group: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ member: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ project: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ role: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
14
+ };
15
+ run(): Promise<unknown>;
16
+ }
@@ -0,0 +1,50 @@
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 TeamsCreate extends base_1.BaseCommand {
7
+ static args = {
8
+ name: core_1.Args.string({ description: 'Team name', required: true }),
9
+ };
10
+ static description = 'Create a team and (optionally) set its roles, group/project scope and members';
11
+ static examples = [
12
+ '<%= config.bin %> teams create DriverOne --role Client --group DriverOne',
13
+ '<%= config.bin %> teams create DriverOne --role Client --group DriverOne --member client@acme.com',
14
+ ];
15
+ static flags = {
16
+ color: core_1.Flags.string({ description: 'Color label' }),
17
+ group: core_1.Flags.string({ description: 'Group id or name to scope the team to (repeatable)', multiple: true }),
18
+ member: core_1.Flags.string({ description: 'Member account id or email (repeatable; must be an org member)', multiple: true }),
19
+ project: core_1.Flags.string({ description: 'Project id or key to scope the team to (repeatable)', multiple: true }),
20
+ role: core_1.Flags.string({ description: 'Role id or name to grant to the team (repeatable)', multiple: true }),
21
+ };
22
+ async run() {
23
+ const { args, flags } = await this.parse(TeamsCreate);
24
+ const body = { name: args.name };
25
+ if (flags.color !== undefined)
26
+ body.color = flags.color;
27
+ if (flags.role !== undefined)
28
+ body.role_ids = await this.resolveAll(flags.role, (v) => this.resolveRoleId(v));
29
+ if (flags.group !== undefined)
30
+ body.group_ids = await this.resolveAll(flags.group, (v) => this.resolveGroupId(v));
31
+ if (flags.project !== undefined) {
32
+ body.project_ids = await this.resolveAll(flags.project, (v) => this.resolveProjectId(v));
33
+ }
34
+ if (flags.member !== undefined) {
35
+ body.member_ids = await this.resolveAll(flags.member, (v) => this.resolveMemberId(v));
36
+ }
37
+ const res = await this.api.post('/cli/v1/teams', body);
38
+ if (!this.jsonEnabled()) {
39
+ const data = res.data ?? {};
40
+ this.log('Team created:');
41
+ this.log((0, output_1.renderRecord)(data));
42
+ for (const field of ['role_ids', 'group_ids', 'project_ids', 'member_ids']) {
43
+ const ids = Array.isArray(data[field]) ? data[field] : [];
44
+ this.log(`${field}: ${ids.length > 0 ? ids.join(', ') : '-'}`);
45
+ }
46
+ }
47
+ return res;
48
+ }
49
+ }
50
+ exports.default = TeamsCreate;
@@ -0,0 +1,9 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class TeamsDelete extends BaseCommand {
3
+ static args: {
4
+ team: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ run(): Promise<unknown>;
9
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const base_1 = require("../../base");
5
+ class TeamsDelete extends base_1.BaseCommand {
6
+ static args = {
7
+ team: core_1.Args.string({ description: 'Team id (UUID) or name', required: true }),
8
+ };
9
+ static description = 'Delete a team (its members lose the access this team granted)';
10
+ static examples = ['<%= config.bin %> teams delete DriverOne'];
11
+ async run() {
12
+ const { args } = await this.parse(TeamsDelete);
13
+ const id = await this.resolveTeamId(args.team);
14
+ await this.api.delete(`/cli/v1/teams/${id}`);
15
+ if (!this.jsonEnabled()) {
16
+ this.log(`Team deleted: ${args.team}`);
17
+ }
18
+ return { deleted: id };
19
+ }
20
+ }
21
+ exports.default = TeamsDelete;
@@ -0,0 +1,9 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class TeamsList extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ page: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ };
8
+ run(): Promise<unknown>;
9
+ }
@@ -0,0 +1,27 @@
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 TeamsList extends base_1.BaseCommand {
6
+ static description = 'List the teams (people with scope) in your organization';
7
+ static examples = ['<%= config.bin %> teams list', '<%= config.bin %> teams list --json'];
8
+ static flags = { ...base_1.pageFlag };
9
+ async run() {
10
+ const { flags } = await this.parse(TeamsList);
11
+ const res = await this.api.get(`/cli/v1/teams?page=${flags.page}`);
12
+ const teams = res.data ?? [];
13
+ const count = (value) => String((Array.isArray(value) ? value : []).length);
14
+ if (!this.jsonEnabled()) {
15
+ this.log((0, output_1.renderTable)(['NAME', 'ROLES', 'GROUPS', 'PROJECTS', 'MEMBERS', 'ID'], teams.map((team) => [
16
+ String(team.name ?? ''),
17
+ count(team.role_ids),
18
+ count(team.group_ids),
19
+ count(team.project_ids),
20
+ count(team.member_ids),
21
+ String(team.id ?? ''),
22
+ ])));
23
+ }
24
+ return res;
25
+ }
26
+ }
27
+ exports.default = TeamsList;
@@ -0,0 +1,10 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class TeamsRemoveMember extends BaseCommand {
3
+ static args: {
4
+ team: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
5
+ member: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ run(): Promise<unknown>;
10
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const base_1 = require("../../base");
5
+ class TeamsRemoveMember extends base_1.BaseCommand {
6
+ static args = {
7
+ team: core_1.Args.string({ description: 'Team id (UUID) or name', required: true }),
8
+ member: core_1.Args.string({ description: 'Member account id or email', required: true }),
9
+ };
10
+ static description = 'Remove a person from a team, keeping the other members';
11
+ static examples = ['<%= config.bin %> teams remove-member DriverOne client@acme.com'];
12
+ async run() {
13
+ const { args } = await this.parse(TeamsRemoveMember);
14
+ const teamId = await this.resolveTeamId(args.team);
15
+ const memberId = await this.resolveMemberId(args.member);
16
+ const current = await this.api.get(`/cli/v1/teams/${teamId}`);
17
+ const existing = Array.isArray(current.data.member_ids) ? current.data.member_ids : [];
18
+ const memberIds = existing.filter((id) => id !== memberId);
19
+ const res = await this.api.put(`/cli/v1/teams/${teamId}`, { member_ids: memberIds });
20
+ if (!this.jsonEnabled()) {
21
+ this.log(`Removed ${args.member} from team ${args.team} (${memberIds.length} members left).`);
22
+ }
23
+ return res;
24
+ }
25
+ }
26
+ exports.default = TeamsRemoveMember;
@@ -0,0 +1,9 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class TeamsShow extends BaseCommand {
3
+ static args: {
4
+ team: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ run(): Promise<unknown>;
9
+ }
@@ -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 TeamsShow extends base_1.BaseCommand {
7
+ static args = {
8
+ team: core_1.Args.string({ description: 'Team id (UUID) or name', required: true }),
9
+ };
10
+ static description = 'Show a team by id or name (roles, group/project scope, members)';
11
+ static examples = ['<%= config.bin %> teams show DriverOne'];
12
+ async run() {
13
+ const { args } = await this.parse(TeamsShow);
14
+ const id = await this.resolveTeamId(args.team);
15
+ const res = await this.api.get(`/cli/v1/teams/${id}`);
16
+ if (!this.jsonEnabled()) {
17
+ const data = res.data ?? {};
18
+ this.log((0, output_1.renderRecord)(data));
19
+ for (const field of ['role_ids', 'group_ids', 'project_ids', 'member_ids']) {
20
+ const ids = Array.isArray(data[field]) ? data[field] : [];
21
+ this.log(`${field}: ${ids.length > 0 ? ids.join(', ') : '-'}`);
22
+ }
23
+ }
24
+ return res;
25
+ }
26
+ }
27
+ exports.default = TeamsShow;
@@ -0,0 +1,17 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class TeamsUpdate extends BaseCommand {
3
+ static args: {
4
+ team: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ color: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ group: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ member: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ project: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
14
+ role: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
15
+ };
16
+ run(): Promise<unknown>;
17
+ }
@@ -0,0 +1,54 @@
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 TeamsUpdate extends base_1.BaseCommand {
7
+ static args = {
8
+ team: core_1.Args.string({ description: 'Team id (UUID) or name', required: true }),
9
+ };
10
+ static description = 'Update a team. Each given dimension REPLACES the whole set for that dimension.';
11
+ static examples = [
12
+ '<%= config.bin %> teams update DriverOne --role Client --group DriverOne',
13
+ '<%= config.bin %> teams update DriverOne --name "DriverOne clients"',
14
+ ];
15
+ static flags = {
16
+ color: core_1.Flags.string({ description: 'Color label' }),
17
+ group: core_1.Flags.string({ description: 'Group id or name (repeatable; replaces the group scope)', multiple: true }),
18
+ member: core_1.Flags.string({ description: 'Member account id or email (repeatable; replaces the members)', multiple: true }),
19
+ name: core_1.Flags.string({ description: 'New name' }),
20
+ project: core_1.Flags.string({ description: 'Project id or key (repeatable; replaces the project scope)', multiple: true }),
21
+ role: core_1.Flags.string({ description: 'Role id or name (repeatable; replaces the roles)', multiple: true }),
22
+ };
23
+ async run() {
24
+ const { args, flags } = await this.parse(TeamsUpdate);
25
+ const id = await this.resolveTeamId(args.team);
26
+ const body = {};
27
+ if (flags.name !== undefined)
28
+ body.name = flags.name;
29
+ if (flags.color !== undefined)
30
+ body.color = flags.color;
31
+ if (flags.role !== undefined)
32
+ body.role_ids = await this.resolveAll(flags.role, (v) => this.resolveRoleId(v));
33
+ if (flags.group !== undefined)
34
+ body.group_ids = await this.resolveAll(flags.group, (v) => this.resolveGroupId(v));
35
+ if (flags.project !== undefined) {
36
+ body.project_ids = await this.resolveAll(flags.project, (v) => this.resolveProjectId(v));
37
+ }
38
+ if (flags.member !== undefined) {
39
+ body.member_ids = await this.resolveAll(flags.member, (v) => this.resolveMemberId(v));
40
+ }
41
+ const res = await this.api.put(`/cli/v1/teams/${id}`, body);
42
+ if (!this.jsonEnabled()) {
43
+ const data = res.data ?? {};
44
+ this.log('Team updated:');
45
+ this.log((0, output_1.renderRecord)(data));
46
+ for (const field of ['role_ids', 'group_ids', 'project_ids', 'member_ids']) {
47
+ const ids = Array.isArray(data[field]) ? data[field] : [];
48
+ this.log(`${field}: ${ids.length > 0 ? ids.join(', ') : '-'}`);
49
+ }
50
+ }
51
+ return res;
52
+ }
53
+ }
54
+ exports.default = TeamsUpdate;
@@ -0,0 +1,18 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class TicketsCreate extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
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
+ description: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ 'step-given': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ 'step-when': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ 'step-then': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ 'step-expected': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ 'status-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
14
+ 'priority-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
15
+ project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
16
+ };
17
+ run(): Promise<unknown>;
18
+ }
@@ -0,0 +1,51 @@
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 TicketsCreate extends base_1.BaseCommand {
7
+ static description = 'Create a ticket';
8
+ static examples = [
9
+ '<%= config.bin %> tickets create --project acme-api --title "Checkout fails"',
10
+ '<%= config.bin %> tickets create -p acme-api --title "Login bug" --kind bug --step-given "logged out" --step-when "I submit" --step-then "it 500s"',
11
+ ];
12
+ static flags = {
13
+ ...base_1.projectFlag,
14
+ title: core_1.Flags.string({ description: 'Ticket title', required: true }),
15
+ kind: core_1.Flags.string({ description: 'Ticket kind', default: 'bug' }),
16
+ description: core_1.Flags.string({ description: 'Free-form description' }),
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' }),
23
+ };
24
+ async run() {
25
+ const { flags } = await this.parse(TicketsCreate);
26
+ const projectId = await this.resolveProjectId(flags.project);
27
+ const body = { title: flags.title, kind: flags.kind };
28
+ if (flags.description !== undefined)
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'];
42
+ const res = await this.api.post(`/cli/v1/projects/${projectId}/tickets`, body);
43
+ if (!this.jsonEnabled()) {
44
+ const ticket = res.data ?? {};
45
+ this.log('Ticket created:');
46
+ this.log((0, output_1.renderRecord)(ticket));
47
+ }
48
+ return res;
49
+ }
50
+ }
51
+ exports.default = TicketsCreate;
@@ -0,0 +1,10 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class TicketsList extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ page: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ };
9
+ run(): Promise<unknown>;
10
+ }
@@ -0,0 +1,24 @@
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 TicketsList extends base_1.BaseCommand {
6
+ static description = 'List tickets for a project';
7
+ static examples = ['<%= config.bin %> tickets list --project acme-api', '<%= config.bin %> tickets list -p acme-api --json'];
8
+ static flags = { ...base_1.projectFlag, ...base_1.pageFlag };
9
+ async run() {
10
+ const { flags } = await this.parse(TicketsList);
11
+ const projectId = await this.resolveProjectId(flags.project);
12
+ const res = await this.api.get(`/cli/v1/projects/${projectId}/tickets?page=${flags.page}`);
13
+ const tickets = res.data ?? [];
14
+ if (!this.jsonEnabled()) {
15
+ this.log((0, output_1.renderTable)(['CODE', 'TITLE', 'STATUS'], tickets.map((ticket) => [
16
+ String(ticket.code ?? ''),
17
+ String(ticket.title ?? ''),
18
+ String(ticket.status ?? ''),
19
+ ])));
20
+ }
21
+ return res;
22
+ }
23
+ }
24
+ exports.default = TicketsList;
@@ -0,0 +1,12 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class TicketsShow extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
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,23 @@
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 TicketsShow extends base_1.BaseCommand {
7
+ static description = 'Show a single ticket';
8
+ static examples = ['<%= config.bin %> tickets show <ticket-id> --project acme-api'];
9
+ static args = {
10
+ id: core_1.Args.string({ description: 'Ticket id or code', required: true }),
11
+ };
12
+ static flags = { ...base_1.projectFlag };
13
+ async run() {
14
+ const { args, flags } = await this.parse(TicketsShow);
15
+ const projectId = await this.resolveProjectId(flags.project);
16
+ const res = await this.api.get(`/cli/v1/projects/${projectId}/tickets/${args.id}`);
17
+ if (!this.jsonEnabled()) {
18
+ this.log((0, output_1.renderRecord)(res.data ?? {}));
19
+ }
20
+ return res;
21
+ }
22
+ }
23
+ exports.default = TicketsShow;
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class TokensCreate extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ name: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ 'environment-id': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ };
10
+ run(): Promise<unknown>;
11
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const base_1 = require("../../base");
5
+ class TokensCreate extends base_1.BaseCommand {
6
+ static description = 'Create an ingest token (the secret is shown only once)';
7
+ static examples = [
8
+ '<%= config.bin %> tokens create --project acme-api --name "CI prod" --environment-id <env-id>',
9
+ ];
10
+ static flags = {
11
+ ...base_1.projectFlag,
12
+ name: core_1.Flags.string({ description: 'Human-readable token name', required: true }),
13
+ 'environment-id': core_1.Flags.string({ description: 'Environment id the token is scoped to', required: true }),
14
+ };
15
+ async run() {
16
+ const { flags } = await this.parse(TokensCreate);
17
+ const projectId = await this.resolveProjectId(flags.project);
18
+ const res = await this.api.post(`/cli/v1/projects/${projectId}/tokens`, {
19
+ name: flags.name,
20
+ environment_id: flags['environment-id'],
21
+ });
22
+ const token = res.data ?? {};
23
+ if (!this.jsonEnabled()) {
24
+ this.log('Token created. Store these credentials now — they are shown only once:');
25
+ this.log('');
26
+ this.log(` secret: ${token.secret ?? '-'}`);
27
+ this.log(` dsn: ${token.dsn ?? '-'}`);
28
+ this.log('');
29
+ this.warn('The secret cannot be retrieved again. If you lose it, rotate the token.');
30
+ }
31
+ return res;
32
+ }
33
+ }
34
+ exports.default = TokensCreate;
@@ -0,0 +1,9 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class TokensList 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,25 @@
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 TokensList extends base_1.BaseCommand {
6
+ static description = 'List ingest tokens for a project';
7
+ static examples = ['<%= config.bin %> tokens list --project acme-api', '<%= config.bin %> tokens list -p acme-api --json'];
8
+ static flags = { ...base_1.projectFlag };
9
+ async run() {
10
+ const { flags } = await this.parse(TokensList);
11
+ const projectId = await this.resolveProjectId(flags.project);
12
+ const res = await this.api.get(`/cli/v1/projects/${projectId}/tokens`);
13
+ const tokens = res.data ?? [];
14
+ if (!this.jsonEnabled()) {
15
+ this.log((0, output_1.renderTable)(['ID', 'NAME', 'PREFIX', 'STATUS'], tokens.map((token) => [
16
+ String(token.id ?? ''),
17
+ String(token.name ?? ''),
18
+ String(token.token_prefix ?? ''),
19
+ String(token.status ?? ''),
20
+ ])));
21
+ }
22
+ return res;
23
+ }
24
+ }
25
+ exports.default = TokensList;
@@ -0,0 +1,12 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class TokensRevoke extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<unknown>;
12
+ }