@cipherly/plane-cli 1.0.0 → 1.0.1

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 (43) hide show
  1. package/package.json +7 -7
  2. package/src/estimates/index.ts +1 -0
  3. package/src/estimates/list.estimates.ts +42 -0
  4. package/src/plane.ts +9 -1
  5. package/src/projects/index.ts +1 -1
  6. package/src/projects/members/index.ts +1 -0
  7. package/src/projects/members/list.members.projects.ts +34 -0
  8. package/src/utils.ts +1 -0
  9. package/src/work-items/create.work-items.ts +3 -3
  10. package/src/work-items/update.work-items.ts +2 -2
  11. package/dist/cycles/create.cycles.js +0 -44
  12. package/dist/cycles/delete.cycles.js +0 -30
  13. package/dist/cycles/index.js +0 -21
  14. package/dist/cycles/list.cycles.js +0 -42
  15. package/dist/cycles/update.cycles.js +0 -46
  16. package/dist/cycles/work-items/index.js +0 -17
  17. package/dist/cycles/work-items/list.cycles.work-items.js +0 -43
  18. package/dist/labels/create.labels.js +0 -34
  19. package/dist/labels/delete.labels.js +0 -30
  20. package/dist/labels/index.js +0 -20
  21. package/dist/labels/list.labels.js +0 -36
  22. package/dist/labels/update.labels.js +0 -36
  23. package/dist/plane.js +0 -60
  24. package/dist/projects/create.projects.js +0 -38
  25. package/dist/projects/delete.projects.js +0 -28
  26. package/dist/projects/index.js +0 -20
  27. package/dist/projects/list.projects.js +0 -35
  28. package/dist/projects/update.projects.js +0 -39
  29. package/dist/states/create.states.js +0 -37
  30. package/dist/states/delete.states.js +0 -30
  31. package/dist/states/index.js +0 -20
  32. package/dist/states/list.states.js +0 -36
  33. package/dist/states/update.states.js +0 -36
  34. package/dist/users/index.js +0 -17
  35. package/dist/users/me.users.js +0 -36
  36. package/dist/utils.js +0 -63
  37. package/dist/work-items/create.work-items.js +0 -51
  38. package/dist/work-items/delete.work-items.js +0 -30
  39. package/dist/work-items/index.js +0 -21
  40. package/dist/work-items/list.work-items.js +0 -44
  41. package/dist/work-items/types/index.js +0 -17
  42. package/dist/work-items/types/list.types.work-items.js +0 -40
  43. package/dist/work-items/update.work-items.js +0 -41
package/package.json CHANGED
@@ -1,15 +1,11 @@
1
1
  {
2
2
  "name": "@cipherly/plane-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "CLI for api.plane.so",
5
5
  "packageManager": "pnpm@8.8.0",
6
6
  "bin": {
7
7
  "plane": "dist/plane.js"
8
8
  },
9
- "scripts": {
10
- "build": "tsc -p tsconfig.json",
11
- "dev": "ts-node src/plane.ts"
12
- },
13
9
  "engines": {
14
10
  "node": ">=18"
15
11
  },
@@ -25,5 +21,9 @@
25
21
  "plane",
26
22
  "cli"
27
23
  ],
28
- "license": "Apache-2.0"
29
- }
24
+ "license": "Apache-2.0",
25
+ "scripts": {
26
+ "build": "tsc -p tsconfig.json",
27
+ "dev": "ts-node src/plane.ts"
28
+ }
29
+ }
@@ -0,0 +1 @@
1
+ export * from "./list.estimates";
@@ -0,0 +1,42 @@
1
+ import { Command } from "commander";
2
+ import { checkRequiredOptionsAndReturn, requestPlaneAPI } from "../utils";
3
+
4
+ // WARN: THIS ENDPOINT IS WIP
5
+ export const listEstimates = new Command("list")
6
+ .description("List estimates")
7
+ .requiredOption("-p, --project-id <projectId>", "Project's ID")
8
+ .action(async (__, cmd: Command) => {
9
+ if (cmd.parent == null) return;
10
+ const { apiKey, apiBase, workspaceSlug, json } =
11
+ checkRequiredOptionsAndReturn(cmd);
12
+ const projectId = cmd.getOptionValue("projectId");
13
+ const { result, status } = await requestPlaneAPI({
14
+ apiBase,
15
+ apiKey,
16
+ endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/estimates/`,
17
+ method: "GET",
18
+ no_v1: true,
19
+ params: {
20
+ expand: "points",
21
+ },
22
+ });
23
+ if (json) console.log(JSON.stringify(result));
24
+ else {
25
+ if (status !== 200) console.table(result);
26
+ else console.table(result.results.map(renderEstimate));
27
+ }
28
+ });
29
+
30
+ export const renderEstimate = (estimate: any) => {
31
+ return {
32
+ id: estimate.id,
33
+ name: estimate.name,
34
+ points:
35
+ (estimate.points &&
36
+ estimate.map((point: any) => ({
37
+ id: point.id,
38
+ value: point.value,
39
+ }))) ||
40
+ [],
41
+ };
42
+ };
package/src/plane.ts CHANGED
@@ -3,6 +3,7 @@ import { Command } from "commander";
3
3
  import {
4
4
  createProject,
5
5
  deleteProject,
6
+ listProjectMembers,
6
7
  listProjects,
7
8
  updateProject,
8
9
  } from "./projects";
@@ -23,6 +24,7 @@ import {
23
24
  updateCycle,
24
25
  } from "./cycles";
25
26
  import { getCurrentUser } from "./users";
27
+ import { listEstimates } from "./estimates";
26
28
 
27
29
  const program = new Command();
28
30
  program.name("plane").description("CLI for api.plane.so").version("1.0.0");
@@ -33,7 +35,8 @@ program
33
35
  .addCommand(listProjects)
34
36
  .addCommand(createProject)
35
37
  .addCommand(updateProject)
36
- .addCommand(deleteProject);
38
+ .addCommand(deleteProject)
39
+ .addCommand(listProjectMembers);
37
40
 
38
41
  program
39
42
  .command("work-items")
@@ -75,6 +78,11 @@ program
75
78
 
76
79
  program.command("users").description("Manage users").addCommand(getCurrentUser);
77
80
 
81
+ program
82
+ .command("estimates")
83
+ .description("Manage estimates")
84
+ .addCommand(listEstimates);
85
+
78
86
  program.commands.forEach((cmd) => {
79
87
  cmd.requiredOption(
80
88
  "--api-key <key>",
@@ -2,4 +2,4 @@ export * from "./list.projects";
2
2
  export * from "./create.projects";
3
3
  export * from "./update.projects";
4
4
  export * from "./delete.projects";
5
-
5
+ export * from "./members";
@@ -0,0 +1 @@
1
+ export * from "./list.members.projects";
@@ -0,0 +1,34 @@
1
+ import { Command } from "commander";
2
+ import { checkRequiredOptionsAndReturn, requestPlaneAPI } from "../../utils";
3
+
4
+ export const listProjectMembers = new Command("list-members")
5
+ .description("List project's members")
6
+ .requiredOption("-p, --project-id <projectId>", "Project's ID")
7
+ .action(async (__, cmd: Command) => {
8
+ if (cmd.parent == null) return;
9
+ const { apiKey, apiBase, workspaceSlug, json } =
10
+ checkRequiredOptionsAndReturn(cmd);
11
+ const projectId = cmd.getOptionValue("projectId");
12
+ const { result, status } = await requestPlaneAPI({
13
+ apiBase,
14
+ apiKey,
15
+ endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/members/`,
16
+ method: "GET",
17
+ params: {
18
+ expand: "member",
19
+ },
20
+ });
21
+ if (json) console.log(JSON.stringify(result));
22
+ else {
23
+ if (status !== 200) console.table(result);
24
+ else console.table(result.map(renderProjectMember));
25
+ }
26
+ });
27
+
28
+ export const renderProjectMember = (member: any) => {
29
+ return {
30
+ id: member.id,
31
+ name: `${member.first_name} ${member.last_name}`,
32
+ display_name: member.display_name,
33
+ };
34
+ };
package/src/utils.ts CHANGED
@@ -67,6 +67,7 @@ export const requestPlaneAPI = async ({
67
67
  }
68
68
  const headers = {
69
69
  "X-API-Key": apiKey,
70
+ Authorization: `Bearer ${apiKey}`,
70
71
  "Content-Type": "application/json",
71
72
  };
72
73
  const opts = { method, headers, body };
@@ -55,10 +55,10 @@ export const createWorkItem = new Command("create")
55
55
  description_html,
56
56
  project_id: projectId,
57
57
  state,
58
- assignees,
58
+ assignee_ids: (assignees && assignees.split(",")) || [],
59
59
  priority,
60
- labels,
61
- parent: parent_id,
60
+ label_ids: (labels && labels.split(",")) || [],
61
+ parent_id,
62
62
  estimate_point,
63
63
  start_date,
64
64
  target_date,
@@ -48,9 +48,9 @@ export const updateWorkItem = new Command("update")
48
48
  if (name !== undefined) body.name = name;
49
49
  if (description !== undefined) body.description = description;
50
50
  if (state !== undefined) body.state = state;
51
- if (assignees !== undefined) body.assignees = assignees;
51
+ if (assignees !== undefined) body.assignees = assignees.split(",");
52
52
  if (priority !== undefined) body.priority = priority;
53
- if (labels !== undefined) body.labels = labels;
53
+ if (labels !== undefined) body.labels = labels.split(",");
54
54
  if (parent_id !== undefined) body.parent = parent_id;
55
55
  if (estimate_point !== undefined) body.estimate_point = estimate_point;
56
56
  if (start_date !== undefined) body.start_date = start_date;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createCycle = void 0;
4
- const commander_1 = require("commander");
5
- const utils_1 = require("../utils");
6
- const list_cycles_1 = require("./list.cycles");
7
- exports.createCycle = new commander_1.Command("create")
8
- .description("Create a new cycle")
9
- .requiredOption("-p, --project-id <projectId>", "Project's ID")
10
- .requiredOption("-n, --name <name>", "Cycle's name")
11
- .option("-d, --description [description]", "Cycle's description")
12
- .option("-sd, --start-date [startDate]", "Cycle's start date")
13
- .option("-ed, --end-date [endDate]", "Cycle's end date")
14
- .action(async (__, cmd) => {
15
- if (cmd.parent == null)
16
- return;
17
- const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
18
- const projectId = cmd.getOptionValue("projectId");
19
- const name = cmd.getOptionValue("name");
20
- const description = cmd.getOptionValue("description");
21
- const startDate = cmd.getOptionValue("startDate");
22
- const endDate = cmd.getOptionValue("endDate");
23
- const { result, status } = await (0, utils_1.requestPlaneAPI)({
24
- apiBase,
25
- apiKey,
26
- endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/cycles/`,
27
- method: "POST",
28
- body: {
29
- name,
30
- description,
31
- project_id: projectId,
32
- start_date: startDate,
33
- end_date: endDate,
34
- },
35
- });
36
- if (json)
37
- console.log(JSON.stringify(result));
38
- else {
39
- if (status !== 201)
40
- console.table(result);
41
- else
42
- console.table((0, list_cycles_1.renderCycle)(result));
43
- }
44
- });
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteCycle = void 0;
4
- const commander_1 = require("commander");
5
- const utils_1 = require("../utils");
6
- exports.deleteCycle = new commander_1.Command("delete")
7
- .description("Delete a cycle")
8
- .requiredOption("-p, --project-id <projectId>", "Project's ID")
9
- .requiredOption("-c, --cycle-id <cycleId>", "Cycle's ID")
10
- .action(async (__, cmd) => {
11
- if (cmd.parent == null)
12
- return;
13
- const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
14
- const projectId = cmd.getOptionValue("projectId");
15
- const cycleId = cmd.getOptionValue("cycleId");
16
- const { result, status } = await (0, utils_1.requestPlaneAPI)({
17
- apiBase,
18
- apiKey,
19
- endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/`,
20
- method: "DELETE",
21
- });
22
- if (json)
23
- console.log(JSON.stringify(result));
24
- else {
25
- if (status !== 204)
26
- console.table(result);
27
- else
28
- console.table(result);
29
- }
30
- });
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./list.cycles"), exports);
18
- __exportStar(require("./work-items"), exports);
19
- __exportStar(require("./create.cycles"), exports);
20
- __exportStar(require("./update.cycles"), exports);
21
- __exportStar(require("./delete.cycles"), exports);
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderCycle = exports.listCycles = void 0;
4
- const commander_1 = require("commander");
5
- const utils_1 = require("../utils");
6
- exports.listCycles = new commander_1.Command("list")
7
- .description("List cycles")
8
- .requiredOption("-p, --project-id <projectId>", "Project's ID")
9
- .action(async (__, cmd) => {
10
- if (cmd.parent == null)
11
- return;
12
- const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
13
- const projectId = cmd.getOptionValue("projectId");
14
- const { result, status } = await (0, utils_1.requestPlaneAPI)({
15
- apiBase,
16
- apiKey,
17
- endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/cycles/`,
18
- method: "GET",
19
- });
20
- if (json)
21
- console.log(JSON.stringify(result));
22
- else {
23
- if (status !== 200)
24
- console.table(result);
25
- else
26
- console.table(result.results.map(exports.renderCycle));
27
- }
28
- });
29
- const renderCycle = (cycle) => {
30
- return {
31
- id: cycle.id,
32
- name: cycle.name,
33
- description: cycle.description,
34
- total_issues: cycle.total_issues,
35
- cancelled_issues: cycle.cancelled_issues,
36
- completed_issues: cycle.completed_issues,
37
- started_issues: cycle.started_issues,
38
- unstarted_issues: cycle.unstarted_issues,
39
- backlog_issues: cycle.backlog_issues,
40
- };
41
- };
42
- exports.renderCycle = renderCycle;
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateCycle = void 0;
4
- const commander_1 = require("commander");
5
- const utils_1 = require("../utils");
6
- const list_cycles_1 = require("./list.cycles");
7
- exports.updateCycle = new commander_1.Command("update")
8
- .description("Update a cycle")
9
- .requiredOption("-p, --project-id <projectId>", "Project's ID")
10
- .requiredOption("-c, --cycle-id <cycleId>", "Cycle's ID")
11
- .option("-n, --name [name]", "Cycle's name")
12
- .option("-d, --description [description]", "Cycle's description")
13
- .option("-sd, --start-date [startDate]", "Cycle's start date")
14
- .option("-ed, --end-date [endDate]", "Cycle's end date")
15
- .action(async (__, cmd) => {
16
- if (cmd.parent == null)
17
- return;
18
- const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
19
- const projectId = cmd.getOptionValue("projectId");
20
- const cycleId = cmd.getOptionValue("cycleId");
21
- const name = cmd.getOptionValue("name");
22
- const description = cmd.getOptionValue("description");
23
- const startDate = cmd.getOptionValue("startDate");
24
- const endDate = cmd.getOptionValue("endDate");
25
- const { result, status } = await (0, utils_1.requestPlaneAPI)({
26
- apiBase,
27
- apiKey,
28
- endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/`,
29
- method: "PATCH",
30
- body: {
31
- name,
32
- description,
33
- project_id: projectId,
34
- start_date: startDate,
35
- end_date: endDate,
36
- },
37
- });
38
- if (json)
39
- console.log(JSON.stringify(result));
40
- else {
41
- if (status !== 200)
42
- console.table(result);
43
- else
44
- console.table((0, list_cycles_1.renderCycle)(result));
45
- }
46
- });
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./list.cycles.work-items"), exports);
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderCycleWorkItem = exports.listCyclesWorkItems = void 0;
4
- const commander_1 = require("commander");
5
- const utils_1 = require("../../utils");
6
- exports.listCyclesWorkItems = new commander_1.Command("list-work-items")
7
- .description("List cycle work items")
8
- .requiredOption("-p, --project-id <projectId>", "Project's ID")
9
- .requiredOption("-c, --cycle-id <cycleId>", "Cycle's ID")
10
- .action(async (__, cmd) => {
11
- if (cmd.parent == null)
12
- return;
13
- const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
14
- const projectId = cmd.getOptionValue("projectId");
15
- const cycleId = cmd.getOptionValue("cycleId");
16
- const { result, status } = await (0, utils_1.requestPlaneAPI)({
17
- apiBase,
18
- apiKey,
19
- endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/cycle-issues/`,
20
- method: "GET",
21
- params: {
22
- expand: "state,labels,assignees",
23
- },
24
- });
25
- if (json)
26
- console.log(JSON.stringify(result));
27
- else {
28
- if (status !== 200)
29
- console.table(result);
30
- else
31
- console.table(result.results.map(exports.renderCycleWorkItem));
32
- }
33
- });
34
- const renderCycleWorkItem = (workItem) => {
35
- return {
36
- id: workItem.id,
37
- name: workItem.name,
38
- state: workItem.state.name,
39
- labels: workItem.labels.map((label) => label.name),
40
- assignees: workItem.assignees.map((user) => `${user.first_name} ${user.last_name}`.trim()),
41
- };
42
- };
43
- exports.renderCycleWorkItem = renderCycleWorkItem;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLabel = void 0;
4
- const commander_1 = require("commander");
5
- const utils_1 = require("../utils");
6
- const list_labels_1 = require("./list.labels");
7
- exports.createLabel = new commander_1.Command("create")
8
- .description("Create a new label")
9
- .requiredOption("-p, --project-id <projectId>", "Project's ID")
10
- .requiredOption("-n, --name <name>", "Label's name")
11
- .action(async (__, cmd) => {
12
- if (cmd.parent == null)
13
- return;
14
- const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
15
- const projectId = cmd.getOptionValue("projectId");
16
- const name = cmd.getOptionValue("name");
17
- const { result, status } = await (0, utils_1.requestPlaneAPI)({
18
- apiBase,
19
- apiKey,
20
- endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/labels/`,
21
- method: "POST",
22
- body: {
23
- name,
24
- },
25
- });
26
- if (json)
27
- console.log(JSON.stringify(result));
28
- else {
29
- if (status !== 201)
30
- console.table(result);
31
- else
32
- console.table((0, list_labels_1.renderLabel)(result));
33
- }
34
- });
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteLabel = void 0;
4
- const commander_1 = require("commander");
5
- const utils_1 = require("../utils");
6
- exports.deleteLabel = new commander_1.Command("delete")
7
- .description("Delete a label")
8
- .requiredOption("-p, --project-id <projectId>", "Project's ID")
9
- .requiredOption("-l, --label-id <labelId>", "Label's ID")
10
- .action(async (__, cmd) => {
11
- if (cmd.parent == null)
12
- return;
13
- const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
14
- const projectId = cmd.getOptionValue("projectId");
15
- const labelId = cmd.getOptionValue("labelId");
16
- const { result, status } = await (0, utils_1.requestPlaneAPI)({
17
- apiBase,
18
- apiKey,
19
- endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/labels/${labelId}/`,
20
- method: "DELETE",
21
- });
22
- if (json)
23
- console.log(JSON.stringify(result));
24
- else {
25
- if (status !== 204)
26
- console.table(result);
27
- else
28
- console.table(result);
29
- }
30
- });
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./list.labels"), exports);
18
- __exportStar(require("./create.labels"), exports);
19
- __exportStar(require("./update.labels"), exports);
20
- __exportStar(require("./delete.labels"), exports);
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderLabel = exports.listLabels = void 0;
4
- const commander_1 = require("commander");
5
- const utils_1 = require("../utils");
6
- exports.listLabels = new commander_1.Command("list")
7
- .description("List labels")
8
- .requiredOption("-p, --project-id <projectId>", "Project's ID")
9
- .action(async (__, cmd) => {
10
- if (cmd.parent == null)
11
- return;
12
- const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
13
- const projectId = cmd.getOptionValue("projectId");
14
- const { result, status } = await (0, utils_1.requestPlaneAPI)({
15
- apiBase,
16
- apiKey,
17
- endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/labels/`,
18
- method: "GET",
19
- });
20
- if (json)
21
- console.log(JSON.stringify(result));
22
- else {
23
- if (status !== 200)
24
- console.table(result);
25
- else
26
- console.table(result.results.map(exports.renderLabel));
27
- }
28
- });
29
- const renderLabel = (label) => {
30
- return {
31
- id: label.id,
32
- name: label.name,
33
- description: label.description,
34
- };
35
- };
36
- exports.renderLabel = renderLabel;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateLabel = void 0;
4
- const commander_1 = require("commander");
5
- const utils_1 = require("../utils");
6
- const list_labels_1 = require("./list.labels");
7
- exports.updateLabel = new commander_1.Command("update")
8
- .description("Update a label")
9
- .requiredOption("-p, --project-id <projectId>", "Project's ID")
10
- .requiredOption("-l, --label-id <labelId>", "Label's ID")
11
- .requiredOption("-n, --name <name>", "Label's name")
12
- .action(async (__, cmd) => {
13
- if (cmd.parent == null)
14
- return;
15
- const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
16
- const projectId = cmd.getOptionValue("projectId");
17
- const labelId = cmd.getOptionValue("labelId");
18
- const name = cmd.getOptionValue("name");
19
- const { result, status } = await (0, utils_1.requestPlaneAPI)({
20
- apiBase,
21
- apiKey,
22
- endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/labels/${labelId}/`,
23
- method: "PATCH",
24
- body: {
25
- name,
26
- },
27
- });
28
- if (json)
29
- console.log(JSON.stringify(result));
30
- else {
31
- if (status !== 200)
32
- console.table(result);
33
- else
34
- console.table((0, list_labels_1.renderLabel)(result));
35
- }
36
- });
package/dist/plane.js DELETED
@@ -1,60 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const commander_1 = require("commander");
5
- const projects_1 = require("./projects");
6
- const work_items_1 = require("./work-items");
7
- const states_1 = require("./states");
8
- const labels_1 = require("./labels");
9
- const cycles_1 = require("./cycles");
10
- const users_1 = require("./users");
11
- const program = new commander_1.Command();
12
- program.name("plane").description("CLI for api.plane.so").version("1.0.0");
13
- program
14
- .command("projects")
15
- .description("Manage projects")
16
- .addCommand(projects_1.listProjects)
17
- .addCommand(projects_1.createProject)
18
- .addCommand(projects_1.updateProject)
19
- .addCommand(projects_1.deleteProject);
20
- program
21
- .command("work-items")
22
- .description("Manage work items")
23
- .addCommand(work_items_1.listWorkItems)
24
- .addCommand(work_items_1.createWorkItem)
25
- .addCommand(work_items_1.updateWorkItem)
26
- .addCommand(work_items_1.deleteWorkItem);
27
- program
28
- .command("work-item-types")
29
- .description("Manage work item types")
30
- .addCommand(work_items_1.listWorkItemTypes);
31
- program
32
- .command("states")
33
- .description("Manage states")
34
- .addCommand(states_1.listStates)
35
- .addCommand(states_1.createState)
36
- .addCommand(states_1.updateState)
37
- .addCommand(states_1.deleteState);
38
- program
39
- .command("labels")
40
- .description("Manage labels")
41
- .addCommand(labels_1.listLabels)
42
- .addCommand(labels_1.createLabel)
43
- .addCommand(labels_1.updateLabel)
44
- .addCommand(labels_1.deleteLabel);
45
- program
46
- .command("cycles")
47
- .description("Manage cycles")
48
- .addCommand(cycles_1.listCycles)
49
- .addCommand(cycles_1.listCyclesWorkItems)
50
- .addCommand(cycles_1.createCycle)
51
- .addCommand(cycles_1.updateCycle)
52
- .addCommand(cycles_1.deleteCycle);
53
- program.command("users").description("Manage users").addCommand(users_1.getCurrentUser);
54
- program.commands.forEach((cmd) => {
55
- cmd.requiredOption("--api-key <key>", "Plane API key", process.env.PLANE_API_KEY);
56
- cmd.requiredOption("--api-base <url>", "Plane API base", process.env.PLANE_API_BASE || "api.plane.so");
57
- cmd.requiredOption("--workspace-slug <slug>", "Workspace slug", process.env.PLANE_WORKSPACE_SLUG);
58
- cmd.option("-j, --json", "Print in JSON format");
59
- });
60
- program.parse();