@nulab/bee 1.1.0 → 1.1.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 (253) hide show
  1. package/README.md +6 -3
  2. package/dist/activities-BPTHt_MD.mjs +69 -0
  3. package/dist/activities-CRiEq51-.mjs +72 -0
  4. package/dist/activities-DyOMqdsM.mjs +69 -0
  5. package/dist/activity-labels-CLFpxp8o.mjs +34 -0
  6. package/dist/add-Br-_TLRp.mjs +55 -0
  7. package/dist/add-CTmmy2t9.mjs +26 -0
  8. package/dist/add-user-BVWFcbH7.mjs +26 -0
  9. package/dist/api-kJR0fRPw.mjs +143 -0
  10. package/dist/attachments-CnL8t9tK.mjs +50 -0
  11. package/dist/attachments-D8IoJjYE.mjs +50 -0
  12. package/dist/attachments-DfgEkAY2.mjs +46 -0
  13. package/dist/auth-5TJGBPxi.mjs +13 -0
  14. package/dist/bee-command-v0qvZeth.mjs +57 -0
  15. package/dist/browse-vgF6nz7X.mjs +304 -0
  16. package/dist/category-BZ7XdVgx.mjs +11 -0
  17. package/dist/clone-DAWVtVbZ.mjs +43 -0
  18. package/dist/close-cTyZPv77.mjs +37 -0
  19. package/dist/comment-CkYJYFrF.mjs +115 -0
  20. package/dist/comment-DzRBQNv8.mjs +102 -0
  21. package/dist/comments-SnOZ-EUJ.mjs +47 -0
  22. package/dist/common-options-BuYWxYdO.mjs +45 -0
  23. package/dist/completion-yfcnEl7k.mjs +113 -0
  24. package/dist/count-BI7ld4k5.mjs +50 -0
  25. package/dist/count-Bw0mVlxC.mjs +40 -0
  26. package/dist/count-CH_LN4k6.mjs +51 -0
  27. package/dist/count-CHzDiMV3.mjs +25 -0
  28. package/dist/count-DvmYzPD_.mjs +46 -0
  29. package/dist/create-BHjwacOk.mjs +47 -0
  30. package/dist/create-BXWATibN.mjs +41 -0
  31. package/dist/create-BtLVFmbR.mjs +29 -0
  32. package/dist/create-CoF2bahH.mjs +29 -0
  33. package/dist/create-DhAOhro9.mjs +60 -0
  34. package/dist/create-DtMLv7Wq.mjs +26 -0
  35. package/dist/create-PtahSFdG.mjs +66 -0
  36. package/dist/create-Y4vo2zwX.mjs +44 -0
  37. package/dist/create-vwRKZ3Lm.mjs +31 -0
  38. package/dist/dashboard-CYYU5Yii.mjs +97 -0
  39. package/dist/delete-BCAPHs-g.mjs +25 -0
  40. package/dist/delete-BHNt5SWa.mjs +24 -0
  41. package/dist/delete-BlmanW0H.mjs +25 -0
  42. package/dist/delete-Bxk14ntp.mjs +24 -0
  43. package/dist/delete-C05oMZEW.mjs +24 -0
  44. package/dist/delete-CMwkcSiA.mjs +25 -0
  45. package/dist/delete-CTeH7nzL.mjs +29 -0
  46. package/dist/delete-D2yDBhZc.mjs +24 -0
  47. package/dist/delete-HMOfvtv3.mjs +25 -0
  48. package/dist/document-CiIzSyoS.mjs +13 -0
  49. package/dist/edit-BBvSbt0m.mjs +22 -0
  50. package/dist/edit-CN1gdpjd.mjs +37 -0
  51. package/dist/edit-C_KbKopB.mjs +36 -0
  52. package/dist/edit-D5Z45NVj.mjs +27 -0
  53. package/dist/edit-DKQw-XXP.mjs +27 -0
  54. package/dist/edit-DRxr4r-r.mjs +60 -0
  55. package/dist/edit-DxsP-aPX.mjs +43 -0
  56. package/dist/edit-Otc7XHU7.mjs +52 -0
  57. package/dist/format-DHAR0n3J.mjs +9 -0
  58. package/dist/history-DpjqxFkX.mjs +55 -0
  59. package/dist/index.mjs +35 -207
  60. package/dist/issue-BRzJy3k1.mjs +18 -0
  61. package/dist/issue-type-Byzh4yLx.mjs +11 -0
  62. package/dist/list-B3A5SDEm.mjs +35 -0
  63. package/dist/list-BMKaJoe_.mjs +64 -0
  64. package/dist/list-BOMbpS4m.mjs +46 -0
  65. package/dist/list-BmZ_JbLB.mjs +104 -0
  66. package/dist/list-BpUUxxwQ.mjs +46 -0
  67. package/dist/list-CgIebllW.mjs +94 -0
  68. package/dist/list-D0Z__0nw.mjs +42 -0
  69. package/dist/list-D3FkO9gb.mjs +56 -0
  70. package/dist/list-D7WLdHvX.mjs +42 -0
  71. package/dist/list-DAr3urtu.mjs +53 -0
  72. package/dist/list-DqpWd9aR.mjs +59 -0
  73. package/dist/list-VO_PbRjC.mjs +50 -0
  74. package/dist/list-b6ByzUFt.mjs +79 -0
  75. package/dist/list-jpQ28gU2.mjs +56 -0
  76. package/dist/list-y93EXyDj.mjs +42 -0
  77. package/dist/login-BnJYzdR3.mjs +228 -0
  78. package/dist/logout-YMnSRLLF.mjs +56 -0
  79. package/dist/me-CLPAe7X2.mjs +36 -0
  80. package/dist/milestone-Dc3alfp9.mjs +11 -0
  81. package/dist/notification-CsOuC8Uk.mjs +11 -0
  82. package/dist/output-DBvfyU1J.mjs +39 -0
  83. package/dist/pr-BBe07JUp.mjs +15 -0
  84. package/dist/project-Dilo1T5e.mjs +16 -0
  85. package/dist/read-BS2G4sNq.mjs +17 -0
  86. package/dist/read-CyCASx6U.mjs +17 -0
  87. package/dist/read-all-CjgMJ2to.mjs +16 -0
  88. package/dist/refresh-DDU2ZLnc.mjs +54 -0
  89. package/dist/registry-B0ZQfBD5.mjs +35 -0
  90. package/dist/registry-RATsKPUm.mjs +2 -0
  91. package/dist/remove-BSDJvkVJ.mjs +17 -0
  92. package/dist/remove-user-CShNCvf8.mjs +26 -0
  93. package/dist/reopen-BIRhcmsI.mjs +28 -0
  94. package/dist/repo-B2K8y0mD.mjs +10 -0
  95. package/dist/role-labels-CLA2wmjO.mjs +11 -0
  96. package/dist/space-BgZeUqoH.mjs +6 -0
  97. package/dist/{shared/bee.B3N0WBdU.mjs → src-BWaxjrq_.mjs} +143 -176
  98. package/dist/src-CP4YLIAh.mjs +1008 -0
  99. package/dist/src-CTD9-bSB.mjs +22760 -0
  100. package/dist/star-Sgb-e2CQ.mjs +11 -0
  101. package/dist/status-BkFMW8Jh.mjs +53 -0
  102. package/dist/status-CaGqMXh7.mjs +64 -0
  103. package/dist/status-DDFyQrRZ.mjs +11 -0
  104. package/dist/status-nI4Dpcoo.mjs +58 -0
  105. package/dist/stdin-C-vjNi9T.mjs +17 -0
  106. package/dist/switch-CMLfVGDN.mjs +34 -0
  107. package/dist/tags-DuMJZyBL.mjs +29 -0
  108. package/dist/team-DfQn8Tf5.mjs +6 -0
  109. package/dist/token-BmkUX9vc.mjs +28 -0
  110. package/dist/tree-CozBqPbN.mjs +46 -0
  111. package/dist/user-DMyFmoP3.mjs +11 -0
  112. package/dist/users-BSGqsGSy.mjs +51 -0
  113. package/dist/view-Bj99sk7O.mjs +48 -0
  114. package/dist/view-Bs8o0c7i.mjs +36 -0
  115. package/dist/view-C1ECwTMN.mjs +54 -0
  116. package/dist/view-COBYBfu7.mjs +38 -0
  117. package/dist/view-CZHT-HiE.mjs +36 -0
  118. package/dist/view-D1RuQJV6.mjs +76 -0
  119. package/dist/view-DBO75WzR.mjs +54 -0
  120. package/dist/view-DJHrnN8j.mjs +62 -0
  121. package/dist/view-DLx6qQt9.mjs +51 -0
  122. package/dist/watching-D22YYxOT.mjs +12 -0
  123. package/dist/wiki-B-DQUuIX.mjs +16 -0
  124. package/package.json +12 -7
  125. package/dist/chunks/activities.mjs +0 -77
  126. package/dist/chunks/activities2.mjs +0 -77
  127. package/dist/chunks/activities3.mjs +0 -77
  128. package/dist/chunks/add-user.mjs +0 -40
  129. package/dist/chunks/add.mjs +0 -65
  130. package/dist/chunks/add2.mjs +0 -41
  131. package/dist/chunks/api.mjs +0 -176
  132. package/dist/chunks/attachments.mjs +0 -49
  133. package/dist/chunks/attachments2.mjs +0 -49
  134. package/dist/chunks/attachments3.mjs +0 -50
  135. package/dist/chunks/browse.mjs +0 -271
  136. package/dist/chunks/clone.mjs +0 -62
  137. package/dist/chunks/close.mjs +0 -52
  138. package/dist/chunks/comment.mjs +0 -127
  139. package/dist/chunks/comment2.mjs +0 -113
  140. package/dist/chunks/comments.mjs +0 -59
  141. package/dist/chunks/completion.mjs +0 -118
  142. package/dist/chunks/count.mjs +0 -70
  143. package/dist/chunks/count2.mjs +0 -71
  144. package/dist/chunks/count3.mjs +0 -61
  145. package/dist/chunks/count4.mjs +0 -37
  146. package/dist/chunks/count5.mjs +0 -54
  147. package/dist/chunks/create.mjs +0 -62
  148. package/dist/chunks/create2.mjs +0 -90
  149. package/dist/chunks/create3.mjs +0 -66
  150. package/dist/chunks/create4.mjs +0 -76
  151. package/dist/chunks/create5.mjs +0 -58
  152. package/dist/chunks/create6.mjs +0 -39
  153. package/dist/chunks/create7.mjs +0 -47
  154. package/dist/chunks/create8.mjs +0 -51
  155. package/dist/chunks/create9.mjs +0 -51
  156. package/dist/chunks/dashboard.mjs +0 -86
  157. package/dist/chunks/delete.mjs +0 -50
  158. package/dist/chunks/delete2.mjs +0 -48
  159. package/dist/chunks/delete3.mjs +0 -48
  160. package/dist/chunks/delete4.mjs +0 -51
  161. package/dist/chunks/delete5.mjs +0 -52
  162. package/dist/chunks/delete6.mjs +0 -52
  163. package/dist/chunks/delete7.mjs +0 -64
  164. package/dist/chunks/delete8.mjs +0 -55
  165. package/dist/chunks/delete9.mjs +0 -50
  166. package/dist/chunks/edit.mjs +0 -58
  167. package/dist/chunks/edit2.mjs +0 -80
  168. package/dist/chunks/edit3.mjs +0 -67
  169. package/dist/chunks/edit4.mjs +0 -53
  170. package/dist/chunks/edit5.mjs +0 -45
  171. package/dist/chunks/edit6.mjs +0 -56
  172. package/dist/chunks/edit7.mjs +0 -52
  173. package/dist/chunks/edit8.mjs +0 -52
  174. package/dist/chunks/history.mjs +0 -58
  175. package/dist/chunks/index.mjs +0 -15
  176. package/dist/chunks/index10.mjs +0 -18
  177. package/dist/chunks/index11.mjs +0 -13
  178. package/dist/chunks/index12.mjs +0 -13
  179. package/dist/chunks/index13.mjs +0 -13
  180. package/dist/chunks/index14.mjs +0 -8
  181. package/dist/chunks/index15.mjs +0 -13
  182. package/dist/chunks/index16.mjs +0 -13
  183. package/dist/chunks/index17.mjs +0 -14
  184. package/dist/chunks/index2.mjs +0 -18
  185. package/dist/chunks/index3.mjs +0 -20
  186. package/dist/chunks/index4.mjs +0 -15
  187. package/dist/chunks/index5.mjs +0 -13
  188. package/dist/chunks/index6.mjs +0 -17
  189. package/dist/chunks/index7.mjs +0 -8
  190. package/dist/chunks/index8.mjs +0 -8
  191. package/dist/chunks/index9.mjs +0 -13
  192. package/dist/chunks/list.mjs +0 -54
  193. package/dist/chunks/list10.mjs +0 -46
  194. package/dist/chunks/list11.mjs +0 -51
  195. package/dist/chunks/list12.mjs +0 -47
  196. package/dist/chunks/list13.mjs +0 -47
  197. package/dist/chunks/list14.mjs +0 -56
  198. package/dist/chunks/list15.mjs +0 -48
  199. package/dist/chunks/list2.mjs +0 -105
  200. package/dist/chunks/list3.mjs +0 -87
  201. package/dist/chunks/list4.mjs +0 -81
  202. package/dist/chunks/list5.mjs +0 -79
  203. package/dist/chunks/list6.mjs +0 -47
  204. package/dist/chunks/list7.mjs +0 -50
  205. package/dist/chunks/list8.mjs +0 -48
  206. package/dist/chunks/list9.mjs +0 -55
  207. package/dist/chunks/login.mjs +0 -220
  208. package/dist/chunks/logout.mjs +0 -72
  209. package/dist/chunks/me.mjs +0 -50
  210. package/dist/chunks/read-all.mjs +0 -31
  211. package/dist/chunks/read.mjs +0 -31
  212. package/dist/chunks/read2.mjs +0 -29
  213. package/dist/chunks/refresh.mjs +0 -78
  214. package/dist/chunks/remove-user.mjs +0 -40
  215. package/dist/chunks/remove.mjs +0 -29
  216. package/dist/chunks/reopen.mjs +0 -44
  217. package/dist/chunks/status.mjs +0 -61
  218. package/dist/chunks/status2.mjs +0 -63
  219. package/dist/chunks/status3.mjs +0 -68
  220. package/dist/chunks/switch.mjs +0 -51
  221. package/dist/chunks/tags.mjs +0 -43
  222. package/dist/chunks/token.mjs +0 -38
  223. package/dist/chunks/tree.mjs +0 -63
  224. package/dist/chunks/users.mjs +0 -50
  225. package/dist/chunks/view.mjs +0 -60
  226. package/dist/chunks/view2.mjs +0 -96
  227. package/dist/chunks/view3.mjs +0 -70
  228. package/dist/chunks/view4.mjs +0 -72
  229. package/dist/chunks/view5.mjs +0 -63
  230. package/dist/chunks/view6.mjs +0 -54
  231. package/dist/chunks/view7.mjs +0 -50
  232. package/dist/chunks/view8.mjs +0 -63
  233. package/dist/chunks/view9.mjs +0 -50
  234. package/dist/shared/bee.BImw1HZl.mjs +0 -28
  235. package/dist/shared/bee.BTBGpv4K.mjs +0 -34
  236. package/dist/shared/bee.BXiuAfjJ.mjs +0 -10
  237. package/dist/shared/bee.BYqxm3yG.mjs +0 -24
  238. package/dist/shared/bee.Btmq3TXs.mjs +0 -19
  239. package/dist/shared/bee.C--ZWPxf.mjs +0 -14
  240. package/dist/shared/bee.C4p7W8_P.mjs +0 -18
  241. package/dist/shared/bee.CirccSk2.mjs +0 -51
  242. package/dist/shared/bee.CktwmH8R.mjs +0 -25
  243. package/dist/shared/bee.CzKcWSES.mjs +0 -42
  244. package/dist/shared/bee.DFnSWb6q.mjs +0 -396
  245. package/dist/shared/bee.DessOtkV.mjs +0 -132
  246. package/dist/shared/bee.DfqnFet4.mjs +0 -49
  247. package/dist/shared/bee.DoTvz3uW.mjs +0 -13
  248. package/dist/shared/bee.G4d7izLe.mjs +0 -14
  249. package/dist/shared/bee.KteAW2rM.mjs +0 -73
  250. package/dist/shared/bee.PF8hrVKn.mjs +0 -27
  251. package/dist/shared/bee.a05kNWpn.mjs +0 -32
  252. package/dist/shared/bee.n5MYN4a6.mjs +0 -12
  253. package/dist/shared/bee.x-FvgDW2.mjs +0 -37660
@@ -1,81 +0,0 @@
1
- import consola from 'consola';
2
- import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
3
- import 'node:stream/consumers';
4
- import * as v from 'valibot';
5
- import { p as parseArg, v as vInteger } from '../shared/bee.BYqxm3yG.mjs';
6
- import { f as formatDate } from '../shared/bee.n5MYN4a6.mjs';
7
- import { p as printTable } from '../shared/bee.a05kNWpn.mjs';
8
- import { g as getClient } from '../shared/bee.DessOtkV.mjs';
9
- import 'backlog-js';
10
- import 'node:http';
11
- import 'open';
12
- import 'node:child_process';
13
- import '../shared/bee.x-FvgDW2.mjs';
14
- import { B as BeeCommand, E as ENV_AUTH } from '../shared/bee.KteAW2rM.mjs';
15
- import { g as count, A as minId, B as maxId, o as order, j as json, s as space } from '../shared/bee.B3N0WBdU.mjs';
16
- import '../shared/bee.DFnSWb6q.mjs';
17
- import '../shared/bee.CktwmH8R.mjs';
18
- import '../shared/bee.DfqnFet4.mjs';
19
- import '../shared/bee.BImw1HZl.mjs';
20
- import 'node:module';
21
- import 'commander';
22
- import 'consola/utils';
23
- import 'node:fs';
24
- import 'node:path';
25
- import 'node:os';
26
-
27
- const NOTIFICATION_REASON_LABELS = {
28
- 1: "Assigned",
29
- 2: "Commented",
30
- 3: "Issue created",
31
- 4: "Issue updated",
32
- 5: "File attached",
33
- 6: "Project user added",
34
- 9: "Other",
35
- 10: "Pull request assigned",
36
- 11: "Pull request commented",
37
- 12: "Pull request added",
38
- 13: "Pull request updated",
39
- 14: "Comment mentioned",
40
- 15: "Pull request comment mentioned",
41
- 16: "Team mentioned",
42
- 17: "Team mentioned in PR"
43
- };
44
-
45
- const list = new BeeCommand("list").summary("List notifications").description(
46
- `Unread notifications are marked with \`*\`. Use \`--min-id\` / \`--max-id\` for cursor-based pagination.`
47
- ).addOption(count()).addOption(minId()).addOption(maxId()).addOption(order()).addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([
48
- { description: "List recent notifications", command: "bee notification list" },
49
- { description: "List the last 5 notifications", command: "bee notification list --count 5" },
50
- {
51
- description: "List notifications in ascending order",
52
- command: "bee notification list --order asc"
53
- },
54
- { description: "Output as JSON", command: "bee notification list --json" }
55
- ]).action(async (opts) => {
56
- const { client } = await getClient(opts.space);
57
- const notifications = await client.getNotifications({
58
- count: parseArg(v.optional(vInteger), opts.count, "--count"),
59
- minId: parseArg(v.optional(vInteger), opts.minId, "--min-id"),
60
- maxId: parseArg(v.optional(vInteger), opts.maxId, "--max-id"),
61
- order: opts.order
62
- });
63
- outputResult(notifications, opts, (data) => {
64
- if (data.length === 0) {
65
- consola.info("No notifications found.");
66
- return;
67
- }
68
- const rows = data.map((n) => [
69
- { header: "", value: n.alreadyRead ? " " : "*" },
70
- { header: "ID", value: String(n.id) },
71
- { header: "REASON", value: NOTIFICATION_REASON_LABELS[n.reason] ?? String(n.reason) },
72
- { header: "ISSUE", value: n.issue?.issueKey ?? "-" },
73
- { header: "SUMMARY", value: n.issue?.summary ?? "-" },
74
- { header: "SENDER", value: n.sender.name },
75
- { header: "DATE", value: formatDate(n.created) }
76
- ]);
77
- printTable(rows);
78
- });
79
- });
80
-
81
- export { list as default };
@@ -1,79 +0,0 @@
1
- import consola from 'consola';
2
- import { P as PrStatusName, a as PR_STATUS_NAMES } from '../shared/bee.DoTvz3uW.mjs';
3
- import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
4
- import 'node:stream/consumers';
5
- import * as v from 'valibot';
6
- import { p as parseArg, v as vInteger } from '../shared/bee.BYqxm3yG.mjs';
7
- import { p as printTable } from '../shared/bee.a05kNWpn.mjs';
8
- import { r as resolveUserId } from '../shared/bee.G4d7izLe.mjs';
9
- import { g as getClient } from '../shared/bee.DessOtkV.mjs';
10
- import 'backlog-js';
11
- import 'node:http';
12
- import 'open';
13
- import 'node:child_process';
14
- import '../shared/bee.x-FvgDW2.mjs';
15
- import { B as BeeCommand, E as ENV_AUTH, a as ENV_PROJECT, b as ENV_REPO } from '../shared/bee.KteAW2rM.mjs';
16
- import { d as project, C as repo, c as collect, h as assigneeList, f as collectNum, g as count, i as offset, j as json, s as space, r as resolveOptions } from '../shared/bee.B3N0WBdU.mjs';
17
- import '../shared/bee.DFnSWb6q.mjs';
18
- import '../shared/bee.CktwmH8R.mjs';
19
- import '../shared/bee.DfqnFet4.mjs';
20
- import '../shared/bee.BImw1HZl.mjs';
21
- import 'node:module';
22
- import 'commander';
23
- import 'consola/utils';
24
- import 'node:fs';
25
- import 'node:path';
26
- import 'node:os';
27
-
28
- const resolveStatusIds = (statuses) => statuses.map((name) => {
29
- const id = PrStatusName[name.toLowerCase()];
30
- if (id === void 0) {
31
- throw new Error(`Unknown status "${name}". Valid values: ${PR_STATUS_NAMES.join(", ")}`);
32
- }
33
- return id;
34
- });
35
- const list = new BeeCommand("list").summary("List pull requests").description(`Use \`--status\` to filter by status (open, closed, merged).`).addOption(project()).addOption(repo()).option("-S, --status <name>", "Status name (repeatable)", collect, []).addOption(assigneeList()).option("--issue <id>", "Issue ID (repeatable)", collectNum, []).option("--created-user <id>", "Created user ID (repeatable)", collectNum, []).addOption(count()).addOption(offset()).addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT, ENV_REPO]).examples([
36
- { description: "List pull requests", command: "bee pr list -p PROJECT -R repo" },
37
- {
38
- description: "List open pull requests only",
39
- command: "bee pr list -p PROJECT -R repo --status open"
40
- },
41
- {
42
- description: "List your assigned pull requests",
43
- command: "bee pr list -p PROJECT -R repo --assignee @me"
44
- },
45
- { description: "Output as JSON", command: "bee pr list -p PROJECT -R repo --json" }
46
- ]).action(async (opts, cmd) => {
47
- await resolveOptions(cmd);
48
- const { client } = await getClient(opts.space);
49
- const statusId = opts.status.length > 0 ? resolveStatusIds(opts.status) : void 0;
50
- const assigneeId = await Promise.all(
51
- (opts.assignee ?? []).map((id) => resolveUserId(client, id))
52
- );
53
- const issueId = opts.issue;
54
- const createdUserId = opts.createdUser;
55
- const pullRequests = await client.getPullRequests(opts.project, opts.repo, {
56
- statusId,
57
- assigneeId: assigneeId.length > 0 ? assigneeId : void 0,
58
- issueId: issueId.length > 0 ? issueId : void 0,
59
- createdUserId: createdUserId.length > 0 ? createdUserId : void 0,
60
- count: parseArg(v.optional(vInteger), opts.count, "--count"),
61
- offset: parseArg(v.optional(vInteger), opts.offset, "--offset")
62
- });
63
- const json = opts.json === true ? "" : opts.json;
64
- outputResult(pullRequests, { json }, (data) => {
65
- if (data.length === 0) {
66
- consola.info("No pull requests found.");
67
- return;
68
- }
69
- const rows = data.map((pr) => [
70
- { header: "#", value: String(pr.number) },
71
- { header: "STATUS", value: pr.status?.name ?? "" },
72
- { header: "ASSIGNEE", value: pr.assignee?.name ?? "Unassigned" },
73
- { header: "SUMMARY", value: pr.summary }
74
- ]);
75
- printTable(rows);
76
- });
77
- });
78
-
79
- export { list as default };
@@ -1,47 +0,0 @@
1
- import consola from 'consola';
2
- import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
3
- import 'node:stream/consumers';
4
- import 'valibot';
5
- import '../shared/bee.BYqxm3yG.mjs';
6
- import { p as printTable } from '../shared/bee.a05kNWpn.mjs';
7
- import { g as getClient } from '../shared/bee.DessOtkV.mjs';
8
- import 'backlog-js';
9
- import 'node:http';
10
- import 'open';
11
- import 'node:child_process';
12
- import '../shared/bee.x-FvgDW2.mjs';
13
- import { B as BeeCommand, E as ENV_AUTH, a as ENV_PROJECT } from '../shared/bee.KteAW2rM.mjs';
14
- import { d as project, j as json, s as space, r as resolveOptions } from '../shared/bee.B3N0WBdU.mjs';
15
- import '../shared/bee.DFnSWb6q.mjs';
16
- import '../shared/bee.CktwmH8R.mjs';
17
- import '../shared/bee.DfqnFet4.mjs';
18
- import '../shared/bee.BImw1HZl.mjs';
19
- import 'node:module';
20
- import 'commander';
21
- import 'consola/utils';
22
- import 'node:fs';
23
- import 'node:path';
24
- import 'node:os';
25
-
26
- const list = new BeeCommand("list").summary("List repositories in a project").description(`Repositories are listed in the configured display order.`).addOption(project()).addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([
27
- { description: "List repositories in a project", command: "bee repo list -p PROJECT_KEY" },
28
- { description: "Output as JSON", command: "bee repo list -p PROJECT_KEY --json" }
29
- ]).action(async (opts, cmd) => {
30
- await resolveOptions(cmd);
31
- const { client } = await getClient(opts.space);
32
- const repos = await client.getGitRepositories(opts.project);
33
- outputResult(repos, opts, (data) => {
34
- if (data.length === 0) {
35
- consola.info("No repositories found.");
36
- return;
37
- }
38
- const rows = data.map((repo) => [
39
- { header: "NAME", value: repo.name },
40
- { header: "DESCRIPTION", value: repo.description ?? "" },
41
- { header: "LAST PUSHED", value: repo.pushedAt?.slice(0, 10) ?? "" }
42
- ]);
43
- printTable(rows);
44
- });
45
- });
46
-
47
- export { list as default };
@@ -1,50 +0,0 @@
1
- import consola from 'consola';
2
- import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
3
- import 'node:stream/consumers';
4
- import * as v from 'valibot';
5
- import { p as parseArg, v as vInteger } from '../shared/bee.BYqxm3yG.mjs';
6
- import { p as printTable } from '../shared/bee.a05kNWpn.mjs';
7
- import { g as getClient } from '../shared/bee.DessOtkV.mjs';
8
- import 'backlog-js';
9
- import 'node:http';
10
- import 'open';
11
- import 'node:child_process';
12
- import '../shared/bee.x-FvgDW2.mjs';
13
- import { B as BeeCommand, E as ENV_AUTH } from '../shared/bee.KteAW2rM.mjs';
14
- import { j as json, o as order, i as offset, g as count, s as space } from '../shared/bee.B3N0WBdU.mjs';
15
- import '../shared/bee.DFnSWb6q.mjs';
16
- import '../shared/bee.CktwmH8R.mjs';
17
- import '../shared/bee.DfqnFet4.mjs';
18
- import '../shared/bee.BImw1HZl.mjs';
19
- import 'node:module';
20
- import 'commander';
21
- import 'consola/utils';
22
- import 'node:fs';
23
- import 'node:path';
24
- import 'node:os';
25
-
26
- const list = new BeeCommand("list").summary("List teams").description(`Teams are groups of users that can be assigned to projects collectively.`).addOption(json()).addOption(order()).addOption(offset()).addOption(count()).addOption(space()).envVars([...ENV_AUTH]).examples([
27
- { description: "List all teams", command: "bee team list" },
28
- { description: "List teams in descending order", command: "bee team list --order desc" },
29
- { description: "Output as JSON", command: "bee team list --json" }
30
- ]).action(async (opts) => {
31
- const { client } = await getClient(opts.space);
32
- const order = parseArg(v.optional(v.picklist(["asc", "desc"])), opts.order, "--order");
33
- const offset = parseArg(v.optional(vInteger), opts.offset, "--offset");
34
- const count = parseArg(v.optional(vInteger), opts.count, "--count");
35
- const teams = await client.getTeams({ order, offset, count });
36
- outputResult(teams, opts, (data) => {
37
- if (data.length === 0) {
38
- consola.info("No teams found.");
39
- return;
40
- }
41
- const rows = data.map((t) => [
42
- { header: "ID", value: String(t.id) },
43
- { header: "NAME", value: t.name },
44
- { header: "MEMBERS", value: String(t.members.length) }
45
- ]);
46
- printTable(rows);
47
- });
48
- });
49
-
50
- export { list as default };
@@ -1,48 +0,0 @@
1
- import consola from 'consola';
2
- import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
3
- import 'node:stream/consumers';
4
- import 'valibot';
5
- import '../shared/bee.BYqxm3yG.mjs';
6
- import { p as printTable } from '../shared/bee.a05kNWpn.mjs';
7
- import { R as ROLE_LABELS } from '../shared/bee.BXiuAfjJ.mjs';
8
- import { g as getClient } from '../shared/bee.DessOtkV.mjs';
9
- import 'backlog-js';
10
- import 'node:http';
11
- import 'open';
12
- import 'node:child_process';
13
- import '../shared/bee.x-FvgDW2.mjs';
14
- import { B as BeeCommand, E as ENV_AUTH } from '../shared/bee.KteAW2rM.mjs';
15
- import { j as json, s as space } from '../shared/bee.B3N0WBdU.mjs';
16
- import '../shared/bee.DFnSWb6q.mjs';
17
- import '../shared/bee.CktwmH8R.mjs';
18
- import '../shared/bee.DfqnFet4.mjs';
19
- import '../shared/bee.BImw1HZl.mjs';
20
- import 'node:module';
21
- import 'commander';
22
- import 'consola/utils';
23
- import 'node:fs';
24
- import 'node:path';
25
- import 'node:os';
26
-
27
- const list = new BeeCommand("list").summary("List users").description(`Only space administrators can see the full list of users.`).addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([
28
- { description: "List all users", command: "bee user list" },
29
- { description: "Output as JSON", command: "bee user list --json" }
30
- ]).action(async (opts) => {
31
- const { client } = await getClient(opts.space);
32
- const users = await client.getUsers();
33
- outputResult(users, opts, (data) => {
34
- if (data.length === 0) {
35
- consola.info("No users found.");
36
- return;
37
- }
38
- const rows = data.map((u) => [
39
- { header: "ID", value: String(u.id) },
40
- { header: "USER ID", value: u.userId ?? "" },
41
- { header: "NAME", value: u.name },
42
- { header: "ROLE", value: ROLE_LABELS[u.roleType] ?? `Unknown (${u.roleType})` }
43
- ]);
44
- printTable(rows);
45
- });
46
- });
47
-
48
- export { list as default };
@@ -1,55 +0,0 @@
1
- import consola from 'consola';
2
- import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
3
- import 'node:stream/consumers';
4
- import 'valibot';
5
- import '../shared/bee.BYqxm3yG.mjs';
6
- import { p as printTable } from '../shared/bee.a05kNWpn.mjs';
7
- import { g as getClient } from '../shared/bee.DessOtkV.mjs';
8
- import 'backlog-js';
9
- import 'node:http';
10
- import 'open';
11
- import 'node:child_process';
12
- import '../shared/bee.x-FvgDW2.mjs';
13
- import { B as BeeCommand, E as ENV_AUTH, a as ENV_PROJECT } from '../shared/bee.KteAW2rM.mjs';
14
- import { d as project, k as keyword, j as json, s as space, r as resolveOptions } from '../shared/bee.B3N0WBdU.mjs';
15
- import '../shared/bee.DFnSWb6q.mjs';
16
- import '../shared/bee.CktwmH8R.mjs';
17
- import '../shared/bee.DfqnFet4.mjs';
18
- import '../shared/bee.BImw1HZl.mjs';
19
- import 'node:module';
20
- import 'commander';
21
- import 'consola/utils';
22
- import 'node:fs';
23
- import 'node:path';
24
- import 'node:os';
25
-
26
- const list = new BeeCommand("list").summary("List wiki pages").description(`Use \`--keyword\` to filter pages by name or content.`).addOption(project()).addOption(keyword()).addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([
27
- { description: "List all wiki pages in a project", command: "bee wiki list -p PROJECT" },
28
- {
29
- description: "Search wiki pages by keyword",
30
- command: 'bee wiki list -p PROJECT --keyword "setup"'
31
- },
32
- { description: "Output as JSON", command: "bee wiki list -p PROJECT --json" }
33
- ]).action(async (opts, cmd) => {
34
- await resolveOptions(cmd);
35
- const { client } = await getClient(opts.space);
36
- const wikis = await client.getWikis({
37
- projectIdOrKey: opts.project,
38
- keyword: opts.keyword
39
- });
40
- const json = opts.json === true ? "" : opts.json;
41
- outputResult(wikis, { json }, (data) => {
42
- if (data.length === 0) {
43
- consola.info("No wiki pages found.");
44
- return;
45
- }
46
- const rows = data.map((wiki) => [
47
- { header: "ID", value: String(wiki.id) },
48
- { header: "NAME", value: wiki.name },
49
- { header: "UPDATED", value: wiki.updated.slice(0, 10) }
50
- ]);
51
- printTable(rows);
52
- });
53
- });
54
-
55
- export { list as default };
@@ -1,220 +0,0 @@
1
- import consola from 'consola';
2
- import { s as space, a as promptRequired, u as updateConfig } from '../shared/bee.B3N0WBdU.mjs';
3
- import { r as readStdin } from '../shared/bee.C--ZWPxf.mjs';
4
- import * as v from 'valibot';
5
- import { U as UserError } from '../shared/bee.BYqxm3yG.mjs';
6
- import { Backlog, OAuth2 } from 'backlog-js';
7
- import { e as exchangeAuthorizationCode } from '../shared/bee.CktwmH8R.mjs';
8
- import { R as RcHostSchema } from '../shared/bee.BImw1HZl.mjs';
9
- import { createServer } from 'node:http';
10
- import { e as openUrl } from '../shared/bee.CzKcWSES.mjs';
11
- import 'node:child_process';
12
- import '../shared/bee.x-FvgDW2.mjs';
13
- import { B as BeeCommand } from '../shared/bee.KteAW2rM.mjs';
14
- import 'node:fs';
15
- import 'node:path';
16
- import 'node:os';
17
- import 'node:stream/consumers';
18
- import 'commander';
19
- import 'open';
20
- import 'node:module';
21
- import 'consola/utils';
22
-
23
- const CALLBACK_TIMEOUT_MS = 3e5;
24
- const DEFAULT_CALLBACK_PORT = 5033;
25
- const SUCCESS_HTML = `<!DOCTYPE html>
26
- <html><head><meta charset="utf-8"><title>Authentication Successful</title></head>
27
- <body style="font-family:system-ui;text-align:center;padding:2em">
28
- <h1>Authentication Successful</h1>
29
- <p>You can close this window and return to the terminal.</p>
30
- </body></html>`;
31
- const ERROR_HTML = `<!DOCTYPE html>
32
- <html><head><meta charset="utf-8"><title>Authentication Failed</title></head>
33
- <body style="font-family:system-ui;text-align:center;padding:2em">
34
- <h1>Authentication Failed</h1>
35
- <p>Something went wrong. Please try again.</p>
36
- </body></html>`;
37
- const respondHtml = (res, html, statusCode = 200) => {
38
- res.writeHead(statusCode, { "Content-Type": "text/html" });
39
- res.end(html);
40
- };
41
- const startCallbackServer = (port = DEFAULT_CALLBACK_PORT) => {
42
- let resolveCode = null;
43
- let rejectCode = null;
44
- const server = createServer((req, res) => {
45
- const url = new URL(req.url ?? "/", `http://localhost:${actualPort}`);
46
- if (url.pathname !== "/callback") {
47
- res.writeHead(404);
48
- res.end("Not Found");
49
- return;
50
- }
51
- const code = url.searchParams.get("code");
52
- const state = url.searchParams.get("state");
53
- const error = url.searchParams.get("error");
54
- if (error) {
55
- rejectCode?.(new Error(`OAuth error: ${error}`));
56
- respondHtml(res, ERROR_HTML);
57
- return;
58
- }
59
- if (!code || !state) {
60
- rejectCode?.(new Error("Missing code or state parameter"));
61
- respondHtml(res, ERROR_HTML);
62
- return;
63
- }
64
- resolveCode?.({ code, state });
65
- respondHtml(res, SUCCESS_HTML);
66
- });
67
- server.listen(port);
68
- const actualPort = server.address().port;
69
- return {
70
- port: actualPort,
71
- waitForCallback(expectedState) {
72
- return new Promise((resolve, reject) => {
73
- const timeout = setTimeout(() => {
74
- reject(new Error("OAuth callback timed out after 5 minutes"));
75
- server.close();
76
- }, CALLBACK_TIMEOUT_MS);
77
- resolveCode = (result) => {
78
- clearTimeout(timeout);
79
- if (result.state === expectedState) {
80
- resolve(result.code);
81
- } else {
82
- reject(new Error("OAuth state mismatch \u2014 possible CSRF attack"));
83
- }
84
- };
85
- rejectCode = (error) => {
86
- clearTimeout(timeout);
87
- reject(error);
88
- };
89
- });
90
- },
91
- stop() {
92
- server.close();
93
- }
94
- };
95
- };
96
-
97
- const login = new BeeCommand("login").summary("Authenticate with a Backlog space").description(
98
- `The default mode is API key with interactive prompts.
99
-
100
- Use \`--with-token\` to pass an API key on standard input.
101
- Use \`--method oauth\` for OAuth authentication via the browser.`
102
- ).addOption(space()).option("-m, --method <method>", "The authentication method to use", "api-key").option("--with-token", "Read token from standard input").envVars([
103
- ["BACKLOG_OAUTH_CLIENT_ID", "OAuth Client ID"],
104
- ["BACKLOG_OAUTH_CLIENT_SECRET", "OAuth Client Secret"],
105
- ["BACKLOG_OAUTH_PORT", "OAuth callback port (default: 5033)"]
106
- ]).examples([
107
- { description: "Start interactive setup", command: "bee auth login" },
108
- {
109
- description: "Login with API key from stdin",
110
- command: "echo 'your-api-key' | bee auth login --with-token"
111
- },
112
- { description: "Login with OAuth", command: "bee auth login -m oauth" }
113
- ]).action(async (opts) => {
114
- const { method } = opts;
115
- if (method !== "api-key" && method !== "oauth") {
116
- throw new UserError('Invalid auth method. Use "api-key" or "oauth".');
117
- }
118
- const hostname = parseHostname(
119
- await promptRequired("Backlog space hostname:", opts.space, {
120
- placeholder: "xxx.backlog.com"
121
- })
122
- );
123
- await (method === "api-key" ? loginWithApiKey(hostname, opts) : loginWithOAuth(hostname));
124
- });
125
- const parseHostname = (input) => {
126
- const result = v.safeParse(RcHostSchema, input.trim());
127
- if (!result.success) {
128
- throw new UserError(
129
- `"${input}" is not a valid hostname. Pass the space's bare hostname, without a scheme or path (e.g. xxx.backlog.com).`
130
- );
131
- }
132
- return result.output;
133
- };
134
- const loginWithApiKey = async (hostname, opts) => {
135
- if (!opts.withToken) {
136
- consola.info(`Tip: you can generate an API key at https://${hostname}/EditApiSettings.action`);
137
- }
138
- const apiKey = opts.withToken ? await readStdin() : await promptRequired("API key:");
139
- consola.start(`Authenticating with ${hostname}...`);
140
- let user;
141
- try {
142
- const client = new Backlog({ host: hostname, apiKey });
143
- user = await client.getMyself();
144
- } catch {
145
- throw new UserError(
146
- `Authentication failed. Could not connect to ${hostname} with the provided API key.`
147
- );
148
- }
149
- saveSpace(hostname, { method: "api-key", apiKey });
150
- consola.success(`Logged in to ${hostname} as ${user.name} (${user.userId})`);
151
- };
152
- const loginWithOAuth = async (hostname) => {
153
- const clientId = process.env.BACKLOG_OAUTH_CLIENT_ID;
154
- const clientSecret = process.env.BACKLOG_OAUTH_CLIENT_SECRET;
155
- if (!clientId || !clientSecret) {
156
- throw new UserError(
157
- "BACKLOG_OAUTH_CLIENT_ID and BACKLOG_OAUTH_CLIENT_SECRET must be set as environment variables."
158
- );
159
- }
160
- const port = process.env.BACKLOG_OAUTH_PORT ? Number(process.env.BACKLOG_OAUTH_PORT) : void 0;
161
- if (port !== void 0 && (!Number.isInteger(port) || port < 0 || port > 65535)) {
162
- throw new UserError("BACKLOG_OAUTH_PORT must be an integer between 0 and 65535.");
163
- }
164
- const callbackServer = startCallbackServer(port);
165
- const redirectUri = `http://localhost:${callbackServer.port}/callback`;
166
- const state = crypto.randomUUID();
167
- const oauth2 = new OAuth2({ clientId, clientSecret });
168
- const authUrl = oauth2.getAuthorizationURL({ host: hostname, redirectUri, state });
169
- consola.info("Opening browser for authorization...");
170
- consola.info(`If the browser doesn't open, visit: ${authUrl}`);
171
- await openUrl(authUrl);
172
- let code;
173
- try {
174
- code = await callbackServer.waitForCallback(state);
175
- } catch (error) {
176
- callbackServer.stop();
177
- throw new UserError(
178
- `OAuth authorization failed: ${error instanceof Error ? error.message : String(error)}`
179
- );
180
- } finally {
181
- callbackServer.stop();
182
- }
183
- consola.start("Exchanging authorization code for tokens...");
184
- let tokenResponse;
185
- try {
186
- tokenResponse = await exchangeAuthorizationCode(hostname, {
187
- code,
188
- clientId,
189
- clientSecret,
190
- redirectUri
191
- });
192
- } catch {
193
- throw new UserError("Failed to exchange authorization code for tokens.");
194
- }
195
- let user;
196
- try {
197
- const client = new Backlog({ host: hostname, accessToken: tokenResponse.access_token });
198
- user = await client.getMyself();
199
- } catch {
200
- throw new UserError("Authentication verification failed.");
201
- }
202
- saveSpace(hostname, {
203
- method: "oauth",
204
- accessToken: tokenResponse.access_token,
205
- refreshToken: tokenResponse.refresh_token,
206
- clientId,
207
- clientSecret
208
- });
209
- consola.success(`Logged in to ${hostname} as ${user.name} (${user.userId})`);
210
- };
211
- const saveSpace = (hostname, auth) => {
212
- updateConfig((config) => {
213
- const index = config.spaces.findIndex((s) => s.host === hostname);
214
- const spaces = index === -1 ? [...config.spaces, { host: hostname, auth }] : config.spaces.with(index, { ...config.spaces[index], auth });
215
- const defaultSpace = config.defaultSpace ?? hostname;
216
- return { ...config, spaces, defaultSpace };
217
- });
218
- };
219
-
220
- export { login as default };
@@ -1,72 +0,0 @@
1
- import consola from 'consola';
2
- import { U as UserError } from '../shared/bee.BYqxm3yG.mjs';
3
- import 'node:stream/consumers';
4
- import 'valibot';
5
- import { s as space, l as loadConfig } from '../shared/bee.B3N0WBdU.mjs';
6
- import { r as removeAllSpaces, a as removeSpace } from '../shared/bee.DfqnFet4.mjs';
7
- import '../shared/bee.BImw1HZl.mjs';
8
- import { B as BeeCommand } from '../shared/bee.KteAW2rM.mjs';
9
- import 'node:fs';
10
- import 'node:path';
11
- import 'node:os';
12
- import 'commander';
13
- import 'consola/utils';
14
-
15
- const logout = new BeeCommand("logout").summary("Remove authentication for a Backlog space").description(
16
- `Removes stored credentials locally. Does not revoke API keys or OAuth tokens on the server.`
17
- ).addOption(space()).option("--all", "Log out of all spaces").examples([
18
- { description: "Select space via prompt", command: "bee auth logout" },
19
- {
20
- description: "Log out of a specific space",
21
- command: "bee auth logout -s xxx.backlog.com"
22
- },
23
- {
24
- description: "Log out of all spaces",
25
- command: "bee auth logout --all"
26
- }
27
- ]).action(async (opts) => {
28
- if (opts.all && opts.space) {
29
- throw new UserError("Cannot use --all with --space.");
30
- }
31
- const config = loadConfig();
32
- if (opts.all) {
33
- if (config.spaces.length === 0) {
34
- consola.info("No spaces are currently authenticated.");
35
- return;
36
- }
37
- removeAllSpaces();
38
- consola.success(`Logged out of ${config.spaces.length} space(s).`);
39
- return;
40
- }
41
- let hostname = opts.space;
42
- if (!hostname) {
43
- if (config.spaces.length === 0) {
44
- consola.info("No spaces are currently authenticated.");
45
- return;
46
- }
47
- const [firstSpace] = config.spaces;
48
- if (config.spaces.length === 1) {
49
- hostname = firstSpace.host;
50
- } else if (process.stdin.isTTY) {
51
- hostname = await consola.prompt("Select a space to log out from:", {
52
- type: "select",
53
- options: config.spaces.map((s) => s.host)
54
- });
55
- if (typeof hostname !== "string" || !hostname) {
56
- throw new UserError("No space selected.");
57
- }
58
- } else {
59
- throw new UserError(
60
- "Hostname is required. Use --space to provide it in non-interactive mode."
61
- );
62
- }
63
- }
64
- try {
65
- removeSpace(hostname);
66
- } catch {
67
- throw new UserError(`Space "${hostname}" is not configured.`);
68
- }
69
- consola.success(`Logged out of ${hostname}.`);
70
- });
71
-
72
- export { logout as default };