@nulab/bee 1.1.1 → 1.2.0

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 (251) hide show
  1. package/dist/activities-BPTHt_MD.mjs +69 -0
  2. package/dist/activities-CRiEq51-.mjs +72 -0
  3. package/dist/activities-DyOMqdsM.mjs +69 -0
  4. package/dist/activity-labels-CLFpxp8o.mjs +34 -0
  5. package/dist/add-Br-_TLRp.mjs +55 -0
  6. package/dist/add-CTmmy2t9.mjs +26 -0
  7. package/dist/add-user-BVWFcbH7.mjs +26 -0
  8. package/dist/api-DhA8avDD.mjs +134 -0
  9. package/dist/attachments-CnL8t9tK.mjs +50 -0
  10. package/dist/attachments-D8IoJjYE.mjs +50 -0
  11. package/dist/attachments-DfgEkAY2.mjs +46 -0
  12. package/dist/auth-5TJGBPxi.mjs +13 -0
  13. package/dist/bee-command-v0qvZeth.mjs +57 -0
  14. package/dist/browse-vgF6nz7X.mjs +304 -0
  15. package/dist/category-BZ7XdVgx.mjs +11 -0
  16. package/dist/clone-DAWVtVbZ.mjs +43 -0
  17. package/dist/close-cTyZPv77.mjs +37 -0
  18. package/dist/comment-CkYJYFrF.mjs +115 -0
  19. package/dist/comment-DzRBQNv8.mjs +102 -0
  20. package/dist/comments-SnOZ-EUJ.mjs +47 -0
  21. package/dist/common-options-BuYWxYdO.mjs +45 -0
  22. package/dist/completion-yX2VOQSl.mjs +113 -0
  23. package/dist/count-BI7ld4k5.mjs +50 -0
  24. package/dist/count-Bw0mVlxC.mjs +40 -0
  25. package/dist/count-CH_LN4k6.mjs +51 -0
  26. package/dist/count-CHzDiMV3.mjs +25 -0
  27. package/dist/count-DvmYzPD_.mjs +46 -0
  28. package/dist/create-BHjwacOk.mjs +47 -0
  29. package/dist/create-BXWATibN.mjs +41 -0
  30. package/dist/create-BtLVFmbR.mjs +29 -0
  31. package/dist/create-CoF2bahH.mjs +29 -0
  32. package/dist/create-DhAOhro9.mjs +60 -0
  33. package/dist/create-DtMLv7Wq.mjs +26 -0
  34. package/dist/create-PtahSFdG.mjs +66 -0
  35. package/dist/create-Y4vo2zwX.mjs +44 -0
  36. package/dist/create-vwRKZ3Lm.mjs +31 -0
  37. package/dist/dashboard-CYYU5Yii.mjs +97 -0
  38. package/dist/delete-BCAPHs-g.mjs +25 -0
  39. package/dist/delete-BHNt5SWa.mjs +24 -0
  40. package/dist/delete-BlmanW0H.mjs +25 -0
  41. package/dist/delete-Bxk14ntp.mjs +24 -0
  42. package/dist/delete-C05oMZEW.mjs +24 -0
  43. package/dist/delete-CMwkcSiA.mjs +25 -0
  44. package/dist/delete-CTeH7nzL.mjs +29 -0
  45. package/dist/delete-D2yDBhZc.mjs +24 -0
  46. package/dist/delete-HMOfvtv3.mjs +25 -0
  47. package/dist/document-vTiqLew9.mjs +14 -0
  48. package/dist/edit-BBvSbt0m.mjs +22 -0
  49. package/dist/edit-BfCZ2Abi.mjs +50 -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/file-DwPTUKOI.mjs +17 -0
  58. package/dist/format-DHAR0n3J.mjs +9 -0
  59. package/dist/history-DpjqxFkX.mjs +55 -0
  60. package/dist/index.mjs +33 -37918
  61. package/dist/issue-BRzJy3k1.mjs +18 -0
  62. package/dist/issue-type-Byzh4yLx.mjs +11 -0
  63. package/dist/list-B3A5SDEm.mjs +35 -0
  64. package/dist/list-BMKaJoe_.mjs +64 -0
  65. package/dist/list-BOMbpS4m.mjs +46 -0
  66. package/dist/list-BmZ_JbLB.mjs +104 -0
  67. package/dist/list-BpUUxxwQ.mjs +46 -0
  68. package/dist/list-CgIebllW.mjs +94 -0
  69. package/dist/list-D0Z__0nw.mjs +42 -0
  70. package/dist/list-D3FkO9gb.mjs +56 -0
  71. package/dist/list-D7WLdHvX.mjs +42 -0
  72. package/dist/list-DAr3urtu.mjs +53 -0
  73. package/dist/list-DqpWd9aR.mjs +59 -0
  74. package/dist/list-VO_PbRjC.mjs +50 -0
  75. package/dist/list-b6ByzUFt.mjs +79 -0
  76. package/dist/list-jpQ28gU2.mjs +56 -0
  77. package/dist/list-y93EXyDj.mjs +42 -0
  78. package/dist/login-BnJYzdR3.mjs +228 -0
  79. package/dist/logout-YMnSRLLF.mjs +56 -0
  80. package/dist/me-CLPAe7X2.mjs +36 -0
  81. package/dist/milestone-Dc3alfp9.mjs +11 -0
  82. package/dist/notification-CsOuC8Uk.mjs +11 -0
  83. package/dist/output-DBvfyU1J.mjs +39 -0
  84. package/dist/pr-BBe07JUp.mjs +15 -0
  85. package/dist/project-Dilo1T5e.mjs +16 -0
  86. package/dist/read-BS2G4sNq.mjs +17 -0
  87. package/dist/read-CyCASx6U.mjs +17 -0
  88. package/dist/read-all-CjgMJ2to.mjs +16 -0
  89. package/dist/refresh-DDU2ZLnc.mjs +54 -0
  90. package/dist/registry-D8DfbunX.mjs +2 -0
  91. package/dist/registry-PlBmfTR4.mjs +35 -0
  92. package/dist/remove-BSDJvkVJ.mjs +17 -0
  93. package/dist/remove-user-CShNCvf8.mjs +26 -0
  94. package/dist/reopen-BIRhcmsI.mjs +28 -0
  95. package/dist/repo-B2K8y0mD.mjs +10 -0
  96. package/dist/role-labels-CLA2wmjO.mjs +11 -0
  97. package/dist/space-BgZeUqoH.mjs +6 -0
  98. package/dist/{shared/bee.CHtg3F43.mjs → src-BWaxjrq_.mjs} +143 -175
  99. package/dist/src-CP4YLIAh.mjs +1008 -0
  100. package/dist/src-CTD9-bSB.mjs +22760 -0
  101. package/dist/star-Sgb-e2CQ.mjs +11 -0
  102. package/dist/status-BkFMW8Jh.mjs +53 -0
  103. package/dist/status-CaGqMXh7.mjs +64 -0
  104. package/dist/status-DDFyQrRZ.mjs +11 -0
  105. package/dist/status-nI4Dpcoo.mjs +58 -0
  106. package/dist/stdin-C-vjNi9T.mjs +17 -0
  107. package/dist/switch-CMLfVGDN.mjs +34 -0
  108. package/dist/tags-DuMJZyBL.mjs +29 -0
  109. package/dist/team-DfQn8Tf5.mjs +6 -0
  110. package/dist/token-BmkUX9vc.mjs +28 -0
  111. package/dist/tree-CozBqPbN.mjs +46 -0
  112. package/dist/user-DMyFmoP3.mjs +11 -0
  113. package/dist/users-BSGqsGSy.mjs +51 -0
  114. package/dist/view-Bj99sk7O.mjs +48 -0
  115. package/dist/view-Bs8o0c7i.mjs +36 -0
  116. package/dist/view-C1ECwTMN.mjs +54 -0
  117. package/dist/view-COBYBfu7.mjs +38 -0
  118. package/dist/view-CZHT-HiE.mjs +36 -0
  119. package/dist/view-D1RuQJV6.mjs +76 -0
  120. package/dist/view-DBO75WzR.mjs +54 -0
  121. package/dist/view-DJHrnN8j.mjs +62 -0
  122. package/dist/view-DLx6qQt9.mjs +51 -0
  123. package/dist/watching-D22YYxOT.mjs +12 -0
  124. package/dist/wiki-B-DQUuIX.mjs +16 -0
  125. package/package.json +14 -11
  126. package/dist/chunks/activities.mjs +0 -75
  127. package/dist/chunks/activities2.mjs +0 -75
  128. package/dist/chunks/activities3.mjs +0 -75
  129. package/dist/chunks/add-user.mjs +0 -38
  130. package/dist/chunks/add.mjs +0 -63
  131. package/dist/chunks/add2.mjs +0 -39
  132. package/dist/chunks/api.mjs +0 -174
  133. package/dist/chunks/attachments.mjs +0 -47
  134. package/dist/chunks/attachments2.mjs +0 -47
  135. package/dist/chunks/attachments3.mjs +0 -48
  136. package/dist/chunks/browse.mjs +0 -269
  137. package/dist/chunks/clone.mjs +0 -60
  138. package/dist/chunks/close.mjs +0 -50
  139. package/dist/chunks/comment.mjs +0 -125
  140. package/dist/chunks/comment2.mjs +0 -111
  141. package/dist/chunks/comments.mjs +0 -57
  142. package/dist/chunks/completion.mjs +0 -113
  143. package/dist/chunks/count.mjs +0 -68
  144. package/dist/chunks/count2.mjs +0 -69
  145. package/dist/chunks/count3.mjs +0 -59
  146. package/dist/chunks/count4.mjs +0 -35
  147. package/dist/chunks/count5.mjs +0 -52
  148. package/dist/chunks/create.mjs +0 -60
  149. package/dist/chunks/create2.mjs +0 -88
  150. package/dist/chunks/create3.mjs +0 -64
  151. package/dist/chunks/create4.mjs +0 -74
  152. package/dist/chunks/create5.mjs +0 -56
  153. package/dist/chunks/create6.mjs +0 -37
  154. package/dist/chunks/create7.mjs +0 -45
  155. package/dist/chunks/create8.mjs +0 -49
  156. package/dist/chunks/create9.mjs +0 -49
  157. package/dist/chunks/dashboard.mjs +0 -84
  158. package/dist/chunks/delete.mjs +0 -48
  159. package/dist/chunks/delete2.mjs +0 -46
  160. package/dist/chunks/delete3.mjs +0 -46
  161. package/dist/chunks/delete4.mjs +0 -49
  162. package/dist/chunks/delete5.mjs +0 -50
  163. package/dist/chunks/delete6.mjs +0 -50
  164. package/dist/chunks/delete7.mjs +0 -62
  165. package/dist/chunks/delete8.mjs +0 -53
  166. package/dist/chunks/delete9.mjs +0 -48
  167. package/dist/chunks/edit.mjs +0 -56
  168. package/dist/chunks/edit2.mjs +0 -78
  169. package/dist/chunks/edit3.mjs +0 -65
  170. package/dist/chunks/edit4.mjs +0 -51
  171. package/dist/chunks/edit5.mjs +0 -43
  172. package/dist/chunks/edit6.mjs +0 -54
  173. package/dist/chunks/edit7.mjs +0 -50
  174. package/dist/chunks/edit8.mjs +0 -50
  175. package/dist/chunks/history.mjs +0 -56
  176. package/dist/chunks/index.mjs +0 -15
  177. package/dist/chunks/index10.mjs +0 -18
  178. package/dist/chunks/index11.mjs +0 -13
  179. package/dist/chunks/index12.mjs +0 -13
  180. package/dist/chunks/index13.mjs +0 -13
  181. package/dist/chunks/index14.mjs +0 -8
  182. package/dist/chunks/index15.mjs +0 -13
  183. package/dist/chunks/index16.mjs +0 -13
  184. package/dist/chunks/index17.mjs +0 -14
  185. package/dist/chunks/index2.mjs +0 -18
  186. package/dist/chunks/index3.mjs +0 -20
  187. package/dist/chunks/index4.mjs +0 -15
  188. package/dist/chunks/index5.mjs +0 -13
  189. package/dist/chunks/index6.mjs +0 -17
  190. package/dist/chunks/index7.mjs +0 -8
  191. package/dist/chunks/index8.mjs +0 -8
  192. package/dist/chunks/index9.mjs +0 -13
  193. package/dist/chunks/list.mjs +0 -52
  194. package/dist/chunks/list10.mjs +0 -44
  195. package/dist/chunks/list11.mjs +0 -49
  196. package/dist/chunks/list12.mjs +0 -45
  197. package/dist/chunks/list13.mjs +0 -45
  198. package/dist/chunks/list14.mjs +0 -54
  199. package/dist/chunks/list15.mjs +0 -46
  200. package/dist/chunks/list2.mjs +0 -103
  201. package/dist/chunks/list3.mjs +0 -85
  202. package/dist/chunks/list4.mjs +0 -79
  203. package/dist/chunks/list5.mjs +0 -77
  204. package/dist/chunks/list6.mjs +0 -45
  205. package/dist/chunks/list7.mjs +0 -48
  206. package/dist/chunks/list8.mjs +0 -46
  207. package/dist/chunks/list9.mjs +0 -53
  208. package/dist/chunks/login.mjs +0 -218
  209. package/dist/chunks/logout.mjs +0 -76
  210. package/dist/chunks/me.mjs +0 -48
  211. package/dist/chunks/read-all.mjs +0 -29
  212. package/dist/chunks/read.mjs +0 -29
  213. package/dist/chunks/read2.mjs +0 -27
  214. package/dist/chunks/refresh.mjs +0 -76
  215. package/dist/chunks/remove-user.mjs +0 -38
  216. package/dist/chunks/remove.mjs +0 -27
  217. package/dist/chunks/reopen.mjs +0 -42
  218. package/dist/chunks/status.mjs +0 -64
  219. package/dist/chunks/status2.mjs +0 -61
  220. package/dist/chunks/status3.mjs +0 -66
  221. package/dist/chunks/switch.mjs +0 -55
  222. package/dist/chunks/tags.mjs +0 -41
  223. package/dist/chunks/token.mjs +0 -42
  224. package/dist/chunks/tree.mjs +0 -61
  225. package/dist/chunks/users.mjs +0 -48
  226. package/dist/chunks/view.mjs +0 -58
  227. package/dist/chunks/view2.mjs +0 -95
  228. package/dist/chunks/view3.mjs +0 -68
  229. package/dist/chunks/view4.mjs +0 -70
  230. package/dist/chunks/view5.mjs +0 -61
  231. package/dist/chunks/view6.mjs +0 -52
  232. package/dist/chunks/view7.mjs +0 -48
  233. package/dist/chunks/view8.mjs +0 -61
  234. package/dist/chunks/view9.mjs +0 -48
  235. package/dist/shared/bee.084B_7FC.mjs +0 -27
  236. package/dist/shared/bee.BTBGpv4K.mjs +0 -34
  237. package/dist/shared/bee.BXiuAfjJ.mjs +0 -10
  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.CAARNIp6.mjs +0 -49
  242. package/dist/shared/bee.CirccSk2.mjs +0 -51
  243. package/dist/shared/bee.CktwmH8R.mjs +0 -25
  244. package/dist/shared/bee.CzKcWSES.mjs +0 -42
  245. package/dist/shared/bee.DFnSWb6q.mjs +0 -396
  246. package/dist/shared/bee.DoTvz3uW.mjs +0 -13
  247. package/dist/shared/bee.KteAW2rM.mjs +0 -73
  248. package/dist/shared/bee.RsR9yniy.mjs +0 -131
  249. package/dist/shared/bee.a05kNWpn.mjs +0 -32
  250. package/dist/shared/bee.n5MYN4a6.mjs +0 -12
  251. package/dist/shared/bee.q93n012-.mjs +0 -14
@@ -0,0 +1,17 @@
1
+ import { y as getClient } from "./src-CTD9-bSB.mjs";
2
+ import { a as parseArg, s as vInteger } from "./src-CP4YLIAh.mjs";
3
+ import { n as ENV_AUTH, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
4
+ import { S as space } from "./common-options-BuYWxYdO.mjs";
5
+ import consola from "consola";
6
+ import { markAsReadNotification } from "backlog-js";
7
+ //#region src/commands/notification/read.ts
8
+ const read = new BeeCommand("read").summary("Mark a notification as read").description(`Use \`bee notification list\` to find notification IDs.`).argument("<id>", "Notification ID").addOption(space()).envVars([...ENV_AUTH]).examples([{
9
+ description: "Mark a notification as read",
10
+ command: "bee notification read 12345"
11
+ }]).action(async (id, opts) => {
12
+ const { client } = await getClient(opts.space);
13
+ await markAsReadNotification(client, parseArg(vInteger, id, "id"));
14
+ consola.success(`Marked notification ${id} as read.`);
15
+ });
16
+ //#endregion
17
+ export { read as default };
@@ -0,0 +1,16 @@
1
+ import { y as getClient } from "./src-CTD9-bSB.mjs";
2
+ import { n as ENV_AUTH, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
3
+ import { S as space } from "./common-options-BuYWxYdO.mjs";
4
+ import consola from "consola";
5
+ import { resetNotificationsMarkAsRead } from "backlog-js";
6
+ //#region src/commands/notification/read-all.ts
7
+ const readAll = new BeeCommand("read-all").summary("Mark all notifications as read").description(`Resets the unread notification count to zero.`).addOption(space()).envVars([...ENV_AUTH]).examples([{
8
+ description: "Mark all notifications as read",
9
+ command: "bee notification read-all"
10
+ }]).action(async (opts) => {
11
+ const { client } = await getClient(opts.space);
12
+ await resetNotificationsMarkAsRead(client);
13
+ consola.success("Marked all notifications as read.");
14
+ });
15
+ //#endregion
16
+ export { readAll as default };
@@ -0,0 +1,54 @@
1
+ import { x as refreshAccessToken } from "./src-CTD9-bSB.mjs";
2
+ import { u as UserError } from "./src-CP4YLIAh.mjs";
3
+ import { a as loadConfig, i as updateSpaceAuth, t as findSpace } from "./src-BWaxjrq_.mjs";
4
+ import { t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
5
+ import { S as space } from "./common-options-BuYWxYdO.mjs";
6
+ import consola from "consola";
7
+ import { createClient, getMyself } from "backlog-js";
8
+ //#region src/commands/auth/refresh.ts
9
+ const refresh = new BeeCommand("refresh").summary("Refresh OAuth token").description(`Only available for spaces authenticated with OAuth. If the refresh token is expired, re-authenticate with \`bee auth login -m oauth\`.`).addOption(space()).examples([{
10
+ description: "Refresh token for default space",
11
+ command: "bee auth refresh"
12
+ }, {
13
+ description: "Refresh token for specific space",
14
+ command: "bee auth refresh -s xxx.backlog.com"
15
+ }]).action(async (opts) => {
16
+ const config = loadConfig();
17
+ const host = opts.space ?? config.defaultSpace;
18
+ const space = host ? findSpace(config.spaces, host) : null;
19
+ if (!space) throw new UserError("No space configured. Run `bee auth login` to authenticate.");
20
+ if (space.auth.method !== "oauth") throw new UserError("Token refresh is only available for OAuth authentication. Current space uses API key.");
21
+ const { clientId, clientSecret } = space.auth;
22
+ if (!clientId || !clientSecret) throw new UserError("Client ID and Client Secret are missing from the stored OAuth configuration. Please re-authenticate with `bee auth login -m oauth`.");
23
+ consola.start(`Refreshing OAuth token for ${space.host}...`);
24
+ let tokenResponse;
25
+ try {
26
+ tokenResponse = await refreshAccessToken(space.host, {
27
+ clientId,
28
+ clientSecret,
29
+ refreshToken: space.auth.refreshToken
30
+ });
31
+ } catch {
32
+ throw new UserError("Failed to refresh OAuth token. Please re-authenticate with `bee auth login -m oauth`.");
33
+ }
34
+ let user;
35
+ try {
36
+ const client = createClient({
37
+ host: space.host,
38
+ accessToken: tokenResponse.access_token
39
+ });
40
+ user = await getMyself(client);
41
+ } catch {
42
+ throw new UserError("Token verification failed after refresh.");
43
+ }
44
+ updateSpaceAuth(space.host, {
45
+ method: "oauth",
46
+ accessToken: tokenResponse.access_token,
47
+ refreshToken: tokenResponse.refresh_token,
48
+ clientId,
49
+ clientSecret
50
+ });
51
+ consola.success(`Token refreshed for ${space.host} (${user.name})`);
52
+ });
53
+ //#endregion
54
+ export { refresh as default };
@@ -0,0 +1,2 @@
1
+ import { t as loadCommands } from "./registry-PlBmfTR4.mjs";
2
+ export { loadCommands };
@@ -0,0 +1,35 @@
1
+ import "commander";
2
+ //#region src/commands/registry.ts
3
+ /**
4
+ * Every top-level command, in the order they are presented to users.
5
+ *
6
+ * Imports stay lazy so `bee <command>` only pays for the module it runs, and so
7
+ * the Skill generator can load the whole tree without executing the CLI entry
8
+ * point (which parses argv on import).
9
+ */
10
+ const commandModules = [
11
+ () => import("./auth-5TJGBPxi.mjs"),
12
+ () => import("./project-Dilo1T5e.mjs"),
13
+ () => import("./issue-BRzJy3k1.mjs"),
14
+ () => import("./document-vTiqLew9.mjs"),
15
+ () => import("./notification-CsOuC8Uk.mjs"),
16
+ () => import("./pr-BBe07JUp.mjs"),
17
+ () => import("./repo-B2K8y0mD.mjs"),
18
+ () => import("./team-DfQn8Tf5.mjs"),
19
+ () => import("./user-DMyFmoP3.mjs"),
20
+ () => import("./wiki-B-DQUuIX.mjs"),
21
+ () => import("./category-BZ7XdVgx.mjs"),
22
+ () => import("./milestone-Dc3alfp9.mjs"),
23
+ () => import("./issue-type-Byzh4yLx.mjs"),
24
+ () => import("./space-BgZeUqoH.mjs"),
25
+ () => import("./status-DDFyQrRZ.mjs"),
26
+ () => import("./star-Sgb-e2CQ.mjs"),
27
+ () => import("./watching-D22YYxOT.mjs"),
28
+ () => import("./dashboard-CYYU5Yii.mjs"),
29
+ () => import("./browse-vgF6nz7X.mjs"),
30
+ () => import("./api-DhA8avDD.mjs"),
31
+ () => import("./completion-yX2VOQSl.mjs")
32
+ ];
33
+ const loadCommands = () => commandModules.map((load) => load());
34
+ //#endregion
35
+ export { loadCommands as t };
@@ -0,0 +1,17 @@
1
+ import { y as getClient } from "./src-CTD9-bSB.mjs";
2
+ import { a as parseArg, s as vInteger } from "./src-CP4YLIAh.mjs";
3
+ import { n as ENV_AUTH, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
4
+ import { S as space } from "./common-options-BuYWxYdO.mjs";
5
+ import consola from "consola";
6
+ import { removeStar } from "backlog-js";
7
+ //#region src/commands/star/remove.ts
8
+ const remove = new BeeCommand("remove").summary("Remove a star").description(`Use \`bee star list\` to find star IDs.`).argument("<star>", "Star ID").addOption(space()).envVars([...ENV_AUTH]).examples([{
9
+ description: "Remove a star",
10
+ command: "bee star remove 12345"
11
+ }]).action(async (star, opts) => {
12
+ const { client } = await getClient(opts.space);
13
+ await removeStar(client, parseArg(vInteger, star, "star"));
14
+ consola.success(`Removed star ${star}.`);
15
+ });
16
+ //#endregion
17
+ export { remove as default };
@@ -0,0 +1,26 @@
1
+ import { y as getClient } from "./src-CTD9-bSB.mjs";
2
+ import { t as outputResult } from "./output-DBvfyU1J.mjs";
3
+ import { a as parseArg, s as vInteger } from "./src-CP4YLIAh.mjs";
4
+ import { n as ENV_AUTH, r as ENV_PROJECT, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
5
+ import { E as resolveOptions, S as space, T as RequiredOption, u as json, y as project } from "./common-options-BuYWxYdO.mjs";
6
+ import consola from "consola";
7
+ import { deleteProjectUsers } from "backlog-js";
8
+ //#region src/commands/project/remove-user.ts
9
+ const removeUser = new BeeCommand("remove-user").summary("Remove a user from a project").description(`Use \`bee project users\` to look up user IDs.`).addOption(project()).addOption(new RequiredOption("--user-id <id>", "User ID")).addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([{
10
+ description: "Remove a user from a project",
11
+ command: "bee project remove-user -p PROJECT_KEY --user-id 12345"
12
+ }]).action(async (opts, cmd) => {
13
+ await resolveOptions(cmd);
14
+ const userId = parseArg(vInteger, opts.userId, "--user-id");
15
+ const { client } = await getClient(opts.space);
16
+ const user = await deleteProjectUsers(client, opts.project, { userId });
17
+ const jsonArg = opts.json === true ? "" : opts.json;
18
+ outputResult(user, {
19
+ ...opts,
20
+ json: jsonArg
21
+ }, (data) => {
22
+ consola.success(`Removed user ${data.name} from project ${opts.project}.`);
23
+ });
24
+ });
25
+ //#endregion
26
+ export { removeUser as default };
@@ -0,0 +1,28 @@
1
+ import { D as IssueStatusId, y as getClient } from "./src-CTD9-bSB.mjs";
2
+ import { t as outputResult } from "./output-DBvfyU1J.mjs";
3
+ import "./src-CP4YLIAh.mjs";
4
+ import { n as ENV_AUTH, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
5
+ import { S as space, g as notify, u as json } from "./common-options-BuYWxYdO.mjs";
6
+ import consola from "consola";
7
+ import { patchIssue } from "backlog-js";
8
+ //#region src/commands/issue/reopen.ts
9
+ const reopen = new BeeCommand("reopen").summary("Reopen an issue").description(`Sets the status back to Open.`).argument("<issue>", "Issue ID or issue key").option("-c, --comment <text>", "Comment to add when reopening").addOption(notify()).addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([{
10
+ description: "Reopen an issue",
11
+ command: "bee issue reopen PROJECT-123"
12
+ }, {
13
+ description: "Reopen with a comment",
14
+ command: "bee issue reopen PROJECT-123 -c \"Reopening due to regression\""
15
+ }]).action(async (issue, opts) => {
16
+ const { client } = await getClient(opts.space);
17
+ const notifiedUserId = opts.notify ?? [];
18
+ const issueData = await patchIssue(client, issue, {
19
+ statusId: IssueStatusId.Open,
20
+ comment: opts.comment,
21
+ notifiedUserId
22
+ });
23
+ outputResult(issueData, opts, (data) => {
24
+ consola.success(`Reopened issue ${data.issueKey}: ${data.summary}`);
25
+ });
26
+ });
27
+ //#endregion
28
+ export { reopen as default };
@@ -0,0 +1,10 @@
1
+ import { t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
2
+ //#region src/commands/repo/index.ts
3
+ const repo = new BeeCommand("repo").summary("Manage Backlog Git repositories");
4
+ await repo.addCommands([
5
+ import("./list-D7WLdHvX.mjs"),
6
+ import("./view-Bj99sk7O.mjs"),
7
+ import("./clone-DAWVtVbZ.mjs")
8
+ ]);
9
+ //#endregion
10
+ export { repo as default };
@@ -0,0 +1,11 @@
1
+ //#region ../../packages/backlog-utils/src/role-labels.ts
2
+ const ROLE_LABELS = {
3
+ 1: "Administrator",
4
+ 2: "Normal User",
5
+ 3: "Reporter",
6
+ 4: "Viewer",
7
+ 5: "Guest Reporter",
8
+ 6: "Guest Viewer"
9
+ };
10
+ //#endregion
11
+ export { ROLE_LABELS as t };
@@ -0,0 +1,6 @@
1
+ import { t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
2
+ //#region src/commands/space/index.ts
3
+ const space = new BeeCommand("space").summary("Manage space information");
4
+ await space.addCommands([import("./activities-DyOMqdsM.mjs")]);
5
+ //#endregion
6
+ export { space as default };
@@ -1,55 +1,16 @@
1
- import { existsSync, readFileSync, writeFileSync, chmodSync } from 'node:fs';
2
- import { resolve } from 'node:path';
3
- import { homedir } from 'node:os';
4
- import consola from 'consola';
5
- import { U as UserError, b as RcSchema, p as parseArg, v as vInteger } from '../index.mjs';
6
- import 'node:stream/consumers';
7
- import * as v from 'valibot';
8
- import { Option } from 'commander';
9
-
10
- const promptRequired = async (label, existing, options) => {
11
- if (existing !== void 0) {
12
- if (existing) {
13
- return existing;
14
- }
15
- throw new UserError(`${label.replace(/:$/, "")} is required.`);
16
- }
17
- if (!process.stdin.isTTY) {
18
- throw new UserError(
19
- `${label.replace(/:$/, "")} is required. Use arguments to provide it in non-interactive mode.`
20
- );
21
- }
22
- const displayLabel = options?.valueHint ? label.replace(/:$/, ` ${options.valueHint}:`) : label;
23
- const { valueHint: _, ...promptOptions } = options ?? {};
24
- const value = await consola.prompt(displayLabel, { type: "text", ...promptOptions });
25
- if (typeof value !== "string" || !value) {
26
- throw new UserError(`${label.replace(/:$/, "")} is required.`);
27
- }
28
- return value;
29
- };
30
- const confirmOrExit = async (message, skipConfirm) => {
31
- if (skipConfirm) {
32
- return true;
33
- }
34
- if (!process.stdin.isTTY) {
35
- throw new UserError("Confirmation required. Use --yes to skip in non-interactive mode.");
36
- }
37
- const confirmed = await consola.prompt(message, { type: "confirm" });
38
- if (!confirmed) {
39
- consola.info("Cancelled.");
40
- return false;
41
- }
42
- return true;
43
- };
44
-
45
- //#region node_modules/.pnpm/flat@6.0.1/node_modules/flat/index.js
1
+ import { u as UserError } from "./src-CP4YLIAh.mjs";
2
+ import * as v from "valibot";
3
+ import { chmodSync, existsSync, readFileSync, writeFileSync } from "node:fs";
4
+ import { resolve } from "node:path";
5
+ import { homedir } from "node:os";
6
+ //#region ../../node_modules/.pnpm/rc9@3.0.1/node_modules/rc9/dist/_chunks/libs/flat.mjs
46
7
  function isBuffer(obj) {
47
8
  return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
48
9
  }
49
10
  function keyIdentity(key) {
50
11
  return key;
51
12
  }
52
- function flatten(target, opts) {
13
+ function flatten$1(target, opts) {
53
14
  opts = opts || {};
54
15
  const delimiter = opts.delimiter || ".";
55
16
  const maxDepth = opts.maxDepth;
@@ -101,7 +62,7 @@ function unflatten(target, opts) {
101
62
  if (!(type === "[object Object]" || type === "[object Array]") || isEmpty(target[key])) {
102
63
  result[key] = target[key];
103
64
  return result;
104
- } else return addKeys(key, result, flatten(target[key], opts));
65
+ } else return addKeys(key, result, flatten$1(target[key], opts));
105
66
  }, {});
106
67
  Object.keys(target).forEach(function(key) {
107
68
  const split = key.split(delimiter).map(transformKey);
@@ -124,76 +85,51 @@ function unflatten(target, opts) {
124
85
  });
125
86
  return result;
126
87
  }
127
-
88
+ //#endregion
89
+ //#region ../../node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs
128
90
  const suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
129
91
  const suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
130
92
  const JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
131
93
  function jsonParseTransform(key, value) {
132
- if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
133
- warnKeyDropped(key);
134
- return;
135
- }
136
- return value;
94
+ if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
95
+ warnKeyDropped(key);
96
+ return;
97
+ }
98
+ return value;
137
99
  }
138
100
  function warnKeyDropped(key) {
139
- console.warn(`[destr] Dropping "${key}" key to prevent prototype pollution.`);
101
+ console.warn(`[destr] Dropping "${key}" key to prevent prototype pollution.`);
140
102
  }
141
103
  function destr(value, options = {}) {
142
- if (typeof value !== "string") {
143
- return value;
144
- }
145
- if (value[0] === '"' && value[value.length - 1] === '"' && value.indexOf("\\") === -1) {
146
- return value.slice(1, -1);
147
- }
148
- const _value = value.trim();
149
- if (_value.length <= 9) {
150
- switch (_value.toLowerCase()) {
151
- case "true": {
152
- return true;
153
- }
154
- case "false": {
155
- return false;
156
- }
157
- case "undefined": {
158
- return void 0;
159
- }
160
- case "null": {
161
- return null;
162
- }
163
- case "nan": {
164
- return Number.NaN;
165
- }
166
- case "infinity": {
167
- return Number.POSITIVE_INFINITY;
168
- }
169
- case "-infinity": {
170
- return Number.NEGATIVE_INFINITY;
171
- }
172
- }
173
- }
174
- if (!JsonSigRx.test(value)) {
175
- if (options.strict) {
176
- throw new SyntaxError("[destr] Invalid JSON");
177
- }
178
- return value;
179
- }
180
- try {
181
- if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) {
182
- if (options.strict) {
183
- throw new Error("[destr] Possible prototype pollution");
184
- }
185
- return JSON.parse(value, jsonParseTransform);
186
- }
187
- return JSON.parse(value);
188
- } catch (error) {
189
- if (options.strict) {
190
- throw error;
191
- }
192
- return value;
193
- }
104
+ if (typeof value !== "string") return value;
105
+ if (value[0] === "\"" && value[value.length - 1] === "\"" && value.indexOf("\\") === -1) return value.slice(1, -1);
106
+ const _value = value.trim();
107
+ if (_value.length <= 9) switch (_value.toLowerCase()) {
108
+ case "true": return true;
109
+ case "false": return false;
110
+ case "undefined": return;
111
+ case "null": return null;
112
+ case "nan": return NaN;
113
+ case "infinity": return Number.POSITIVE_INFINITY;
114
+ case "-infinity": return Number.NEGATIVE_INFINITY;
115
+ }
116
+ if (!JsonSigRx.test(value)) {
117
+ if (options.strict) throw new SyntaxError("[destr] Invalid JSON");
118
+ return value;
119
+ }
120
+ try {
121
+ if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) {
122
+ if (options.strict) throw new Error("[destr] Possible prototype pollution");
123
+ return JSON.parse(value, jsonParseTransform);
124
+ }
125
+ return JSON.parse(value);
126
+ } catch (error) {
127
+ if (options.strict) throw error;
128
+ return value;
129
+ }
194
130
  }
195
-
196
- //#region src/index.ts
131
+ //#endregion
132
+ //#region ../../node_modules/.pnpm/rc9@3.0.1/node_modules/rc9/dist/index.mjs
197
133
  const RE_KEY_VAL = /^\s*([^\s=]+)\s*=\s*(.*)?\s*$/;
198
134
  const RE_LINES = /\n|\r|\r\n/;
199
135
  /**
@@ -265,7 +201,7 @@ function readUser(options) {
265
201
  * @returns {string} - The serialised configuration string.
266
202
  */
267
203
  function serialize(config) {
268
- return Object.entries(flatten(config)).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join("\n");
204
+ return Object.entries(flatten$1(config)).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join("\n");
269
205
  }
270
206
  /**
271
207
  * Writes a configuration object to a file in a default or specified location.
@@ -287,79 +223,111 @@ function writeUser(config, options) {
287
223
  options.dir = process.env.XDG_CONFIG_HOME || homedir();
288
224
  write(config, options);
289
225
  }
290
-
226
+ //#endregion
227
+ //#region ../../packages/config/src/schema.ts
228
+ const ApiKeyAuthSchema = v.object({
229
+ method: v.literal("api-key"),
230
+ apiKey: v.string()
231
+ });
232
+ const OAuthAuthSchema = v.object({
233
+ method: v.literal("oauth"),
234
+ accessToken: v.string(),
235
+ refreshToken: v.string(),
236
+ clientId: v.optional(v.string()),
237
+ clientSecret: v.optional(v.string())
238
+ });
239
+ const RcAuthSchema = v.variant("method", [ApiKeyAuthSchema, OAuthAuthSchema]);
240
+ /**
241
+ * A Backlog space hostname.
242
+ *
243
+ * Any domain is accepted so that self-hosted spaces work, but the value must be
244
+ * a bare hostname: it is interpolated into `https://${host}` by both
245
+ * `buildBacklogUrl` and backlog-js, so a value carrying userinfo, a path, or a
246
+ * scheme (e.g. `example.backlog.com@evil.com`) would silently redirect requests
247
+ * — and the credentials in them — to another origin.
248
+ */
249
+ const RcHostSchema = v.pipe(v.string(), v.toLowerCase(), v.domain());
250
+ const RcSpaceSchema = v.object({
251
+ host: RcHostSchema,
252
+ auth: RcAuthSchema
253
+ });
254
+ const RcSchema = v.object({
255
+ defaultSpace: v.optional(v.pipe(v.string(), v.toLowerCase())),
256
+ spaces: v.optional(v.array(RcSpaceSchema), []),
257
+ aliases: v.optional(v.record(v.string(), v.string()), {})
258
+ });
259
+ //#endregion
260
+ //#region ../../packages/config/src/config.ts
291
261
  const CONFIG_FILE_NAME = ".beerc";
292
262
  const parseConfig = (raw) => {
293
- const result = v.safeParse(RcSchema, raw);
294
- if (!result.success) {
295
- const details = result.issues.map((issue) => issue.message).join("\n");
296
- throw new UserError(`Configuration Error:
297
- ${details}`);
298
- }
299
- return result.output;
263
+ const result = v.safeParse(RcSchema, raw);
264
+ if (!result.success) {
265
+ const details = result.issues.map((issue) => issue.message).join("\n");
266
+ throw new UserError(`Configuration Error:\n${details}`);
267
+ }
268
+ return result.output;
300
269
  };
301
270
  const loadConfig = () => parseConfig(readUser(CONFIG_FILE_NAME));
302
271
  const configFilePath = () => resolve(process.env.XDG_CONFIG_HOME || homedir(), CONFIG_FILE_NAME);
272
+ /**
273
+ * Validates before writing rather than trusting the caller, so an invalid host
274
+ * cannot be persisted by a command that writes the rc file directly (such as
275
+ * `bee auth login`) only to break every later read.
276
+ */
303
277
  const writeConfig = (config) => {
304
- writeUser(parseConfig(config), CONFIG_FILE_NAME);
305
- chmodSync(configFilePath(), 384);
278
+ writeUser(parseConfig(config), CONFIG_FILE_NAME);
279
+ chmodSync(configFilePath(), 384);
306
280
  };
307
281
  const updateConfig = (updater) => {
308
- const config = loadConfig();
309
- const updated = updater(config);
310
- writeConfig(updated);
311
- return updated;
282
+ const updated = updater(loadConfig());
283
+ writeConfig(updated);
284
+ return updated;
312
285
  };
313
-
314
- class RequiredOption extends Option {
315
- promptLabel;
316
- constructor(flags, description, promptLabel) {
317
- super(flags, `${description} (required)`);
318
- this.promptLabel = promptLabel ?? description;
319
- }
320
- }
321
- const resolveOptions = async (cmd) => {
322
- const opts = cmd.opts();
323
- for (const opt of cmd.options) {
324
- if (opt instanceof RequiredOption) {
325
- const key = opt.attributeName();
326
- opts[key] = await promptRequired(`${opt.promptLabel}:`, opts[key]);
327
- }
328
- }
286
+ //#endregion
287
+ //#region ../../packages/config/src/space.ts
288
+ const removeSpace = (host) => {
289
+ updateConfig((config) => {
290
+ if (!config.spaces.some((space) => space.host === host)) throw new Error(`Space with host "${host}" not found in configuration.`);
291
+ const spaces = config.spaces.filter((space) => space.host !== host);
292
+ const defaultSpace = config.defaultSpace === host ? void 0 : config.defaultSpace;
293
+ return {
294
+ ...config,
295
+ spaces,
296
+ defaultSpace
297
+ };
298
+ });
299
+ };
300
+ const removeAllSpaces = () => {
301
+ updateConfig((config) => ({
302
+ ...config,
303
+ spaces: [],
304
+ defaultSpace: void 0
305
+ }));
306
+ };
307
+ const updateSpaceAuth = (host, auth) => {
308
+ updateConfig((config) => {
309
+ const index = config.spaces.findIndex((space) => space.host === host);
310
+ if (index === -1) throw new Error(`Space with host "${host}" not found in configuration.`);
311
+ return {
312
+ ...config,
313
+ spaces: config.spaces.with(index, {
314
+ ...config.spaces[index],
315
+ auth
316
+ })
317
+ };
318
+ });
319
+ };
320
+ const findSpace = (spaces, host) => {
321
+ const exactMatch = spaces.find((s) => s.host === host);
322
+ if (exactMatch) return exactMatch;
323
+ const prefixMatches = spaces.filter((s) => s.host.startsWith(`${host}.`));
324
+ const [singleMatch] = prefixMatches;
325
+ if (prefixMatches.length === 1) return singleMatch;
326
+ if (prefixMatches.length > 1) {
327
+ const candidates = prefixMatches.map((s) => s.host).join(", ");
328
+ throw new Error(`Ambiguous space name "${host}". Matching spaces: ${candidates}`);
329
+ }
330
+ return null;
329
331
  };
330
-
331
- const collect = (val, prev) => [...prev, val];
332
- const collectNum = (val, prev) => [
333
- ...prev,
334
- parseArg(vInteger, val, "value")
335
- ];
336
- const project = () => new RequiredOption("-p, --project <id>", "Project ID or project key").env("BACKLOG_PROJECT");
337
- const projectOptional = (description = "Project ID or project key") => new Option("-p, --project <id>", description).env("BACKLOG_PROJECT");
338
- const repo = () => new RequiredOption("-R, --repo <name>", "Repository name or ID").env("BACKLOG_REPO");
339
- const count = () => new Option("-L, --count <n>", "Number of results (default: 20)");
340
- const offset = () => new Option("--offset <n>", "Offset for pagination");
341
- const order = () => new Option("--order <dir>", "Sort order").choices(["asc", "desc"]);
342
- const minId = () => new Option("--min-id <n>", "Minimum ID for cursor-based pagination");
343
- const maxId = () => new Option("--max-id <n>", "Maximum ID for cursor-based pagination");
344
- const keyword = () => new Option("-k, --keyword <text>", "Keyword search");
345
- const assignee = () => new Option("-a, --assignee <id>", "Assignee user ID. Use @me for yourself.");
346
- const assigneeList = () => new Option("-a, --assignee <id>", "Assignee user ID (repeatable). Use @me for yourself.").argParser(collect).default([]);
347
- const issue = () => new Option("--issue <key>", "Issue ID or issue key");
348
- const notify = () => new Option("--notify <id>", "User IDs to notify (repeatable)").argParser(collectNum).default([]);
349
- const attachment = () => new Option("--attachment <id>", "Attachment IDs (repeatable)").argParser(collectNum).default([]);
350
- const category = () => new Option("--category <id>", "Category IDs (repeatable)").argParser(collectNum).default([]);
351
- const version = () => new Option("--version <id>", "Version IDs (repeatable)").argParser(collectNum).default([]);
352
- const milestone = () => new Option("--milestone <id>", "Milestone IDs (repeatable)").argParser(collectNum).default([]);
353
- const comment = () => new Option("-c, --comment <text>", "Comment to add with the update");
354
- const web = (resource) => new Option("-w, --web", `Open the ${resource} in the browser`);
355
- const noBrowser = () => new Option("-n, --no-browser", "Print the URL instead of opening the browser");
356
- const space = () => new Option(
357
- "-s, --space <hostname>",
358
- "Space hostname (e.g. xxx.backlog.com, or your own domain)"
359
- ).env("BACKLOG_SPACE");
360
- const json = () => new Option(
361
- "--json [fields]",
362
- "Output as JSON (optionally filter by field names, comma-separated)"
363
- ).preset("");
364
-
365
- export { minId as A, maxId as B, repo as C, issue as D, RequiredOption as R, promptRequired as a, writeConfig as b, collect as c, project as d, confirmOrExit as e, collectNum as f, count as g, assigneeList as h, offset as i, json as j, keyword as k, loadConfig as l, assignee as m, noBrowser as n, order as o, projectOptional as p, category as q, resolveOptions as r, space as s, milestone as t, updateConfig as u, version as v, web as w, notify as x, attachment as y, comment as z };
332
+ //#endregion
333
+ export { loadConfig as a, RcHostSchema as c, updateSpaceAuth as i, removeAllSpaces as n, updateConfig as o, removeSpace as r, writeConfig as s, findSpace as t };