@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
@@ -0,0 +1,47 @@
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 { t as formatDate } from "./format-DHAR0n3J.mjs";
5
+ import { i as ENV_REPO, n as ENV_AUTH, r as ENV_PROJECT, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
6
+ import { E as resolveOptions, S as space, c as count, f as maxId, m as minId, u as json, v as order, x as repo, y as project } from "./common-options-BuYWxYdO.mjs";
7
+ import consola from "consola";
8
+ import { getPullRequestComments } from "backlog-js";
9
+ import * as v from "valibot";
10
+ //#region src/commands/pr/comments.ts
11
+ const comments = new BeeCommand("comments").summary("List comments on a pull request").description(`Displays all comments in chronological order.`).argument("<number>", "Pull request number").addOption(project()).addOption(repo()).addOption(minId()).addOption(maxId()).addOption(count()).addOption(order()).addOption(json()).addOption(space()).envVars([
12
+ ...ENV_AUTH,
13
+ ENV_PROJECT,
14
+ ENV_REPO
15
+ ]).examples([{
16
+ description: "List pull request comments",
17
+ command: "bee pr comments 42 -p PROJECT -R repo"
18
+ }, {
19
+ description: "Output as JSON",
20
+ command: "bee pr comments 42 -p PROJECT -R repo --json"
21
+ }]).action(async (number, opts, cmd) => {
22
+ await resolveOptions(cmd);
23
+ const { client } = await getClient(opts.space);
24
+ const prNumber = parseArg(vInteger, number, "number");
25
+ const prComments = await getPullRequestComments(client, opts.project, opts.repo, prNumber, {
26
+ minId: parseArg(v.optional(vInteger), opts.minId, "--min-id"),
27
+ maxId: parseArg(v.optional(vInteger), opts.maxId, "--max-id"),
28
+ order: opts.order ?? "asc",
29
+ count: parseArg(v.optional(vInteger), opts.count, "--count")
30
+ });
31
+ const json = opts.json === true ? "" : opts.json;
32
+ outputResult(prComments, { json }, (data) => {
33
+ const contentComments = data.filter((c) => c.content);
34
+ if (contentComments.length === 0) {
35
+ consola.info("No comments found.");
36
+ return;
37
+ }
38
+ consola.log("");
39
+ for (const comment of contentComments) {
40
+ consola.log(` ${comment.createdUser.name} (${formatDate(comment.created)}):`);
41
+ consola.log(comment.content.split("\n").map((line) => ` ${line}`).join("\n"));
42
+ consola.log("");
43
+ }
44
+ });
45
+ });
46
+ //#endregion
47
+ export { comments as default };
@@ -0,0 +1,45 @@
1
+ import { a as parseArg, l as promptRequired, s as vInteger } from "./src-CP4YLIAh.mjs";
2
+ import { Option } from "commander";
3
+ //#region src/lib/required-option.ts
4
+ var RequiredOption = class extends Option {
5
+ promptLabel;
6
+ constructor(flags, description, promptLabel) {
7
+ super(flags, `${description} (required)`);
8
+ this.promptLabel = promptLabel ?? description;
9
+ }
10
+ };
11
+ const resolveOptions = async (cmd) => {
12
+ const opts = cmd.opts();
13
+ for (const opt of cmd.options) if (opt instanceof RequiredOption) {
14
+ const key = opt.attributeName();
15
+ opts[key] = await promptRequired(`${opt.promptLabel}:`, opts[key]);
16
+ }
17
+ };
18
+ //#endregion
19
+ //#region src/lib/common-options.ts
20
+ const collect = (val, prev) => [...prev, val];
21
+ const collectNum = (val, prev) => [...prev, parseArg(vInteger, val, "value")];
22
+ const project = () => new RequiredOption("-p, --project <id>", "Project ID or project key").env("BACKLOG_PROJECT");
23
+ const projectOptional = (description = "Project ID or project key") => new Option("-p, --project <id>", description).env("BACKLOG_PROJECT");
24
+ const repo = () => new RequiredOption("-R, --repo <name>", "Repository name or ID").env("BACKLOG_REPO");
25
+ const count = () => new Option("-L, --count <n>", "Number of results (default: 20)");
26
+ const offset = () => new Option("--offset <n>", "Offset for pagination");
27
+ const order = () => new Option("--order <dir>", "Sort order").choices(["asc", "desc"]);
28
+ const minId = () => new Option("--min-id <n>", "Minimum ID for cursor-based pagination");
29
+ const maxId = () => new Option("--max-id <n>", "Maximum ID for cursor-based pagination");
30
+ const keyword = () => new Option("-k, --keyword <text>", "Keyword search");
31
+ const assignee = () => new Option("-a, --assignee <id>", "Assignee user ID. Use @me for yourself.");
32
+ const assigneeList = () => new Option("-a, --assignee <id>", "Assignee user ID (repeatable). Use @me for yourself.").argParser(collect).default([]);
33
+ const issue = () => new Option("--issue <key>", "Issue ID or issue key");
34
+ const notify = () => new Option("--notify <id>", "User IDs to notify (repeatable)").argParser(collectNum).default([]);
35
+ const attachment = () => new Option("--attachment <id>", "Attachment IDs (repeatable)").argParser(collectNum).default([]);
36
+ const category = () => new Option("--category <id>", "Category IDs (repeatable)").argParser(collectNum).default([]);
37
+ const version = () => new Option("--version <id>", "Version IDs (repeatable)").argParser(collectNum).default([]);
38
+ const milestone = () => new Option("--milestone <id>", "Milestone IDs (repeatable)").argParser(collectNum).default([]);
39
+ const comment = () => new Option("-c, --comment <text>", "Comment to add with the update");
40
+ const web = (resource) => new Option("-w, --web", `Open the ${resource} in the browser`);
41
+ const noBrowser = () => new Option("-n, --no-browser", "Print the URL instead of opening the browser");
42
+ const space = () => new Option("-s, --space <hostname>", "Space hostname (e.g. xxx.backlog.com, or your own domain)").env("BACKLOG_SPACE");
43
+ const json = () => new Option("--json [fields]", "Output as JSON (optionally filter by field names, comma-separated)").preset("");
44
+ //#endregion
45
+ export { version as C, resolveOptions as E, space as S, RequiredOption as T, offset as _, collect as a, projectOptional as b, count as c, keyword as d, maxId as f, notify as g, noBrowser as h, category as i, issue as l, minId as m, assigneeList as n, collectNum as o, milestone as p, attachment as r, comment as s, assignee as t, json as u, order as v, web as w, repo as x, project as y };
@@ -0,0 +1,113 @@
1
+ import { u as UserError } from "./src-CP4YLIAh.mjs";
2
+ import { t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
3
+ import "commander";
4
+ //#region src/lib/completion-script.ts
5
+ /**
6
+ * Commander lists `help` as a subcommand of every parent. Completing it would
7
+ * offer a command users reach through `--help`, so it never reaches a script.
8
+ */
9
+ const isListable = (cmd) => cmd.name() !== "help";
10
+ const toEntry = (cmd) => ({
11
+ name: cmd.name(),
12
+ summary: cmd.summary() || cmd.description()
13
+ });
14
+ const commandEntries = (program) => program.commands.filter(isListable).map(toEntry);
15
+ /**
16
+ * zsh's `_describe` takes `name:description` pairs, so a colon inside a summary
17
+ * would end the name early and truncate the completion label.
18
+ */
19
+ const escapeZsh = (text) => text.replaceAll(":", String.raw`\:`);
20
+ const escapeDoubleQuoted = (text) => text.replaceAll(/(["$`\\])/g, String.raw`\$1`);
21
+ const renderBash = (entries) => `# bash completion for bee
22
+ # Add to ~/.bashrc:
23
+ # eval "$(bee completion bash)"
24
+
25
+ _bee_completions() {
26
+ local cur="\${COMP_WORDS[COMP_CWORD]}"
27
+ local commands="${entries.map((entry) => entry.name).join(" ")}"
28
+
29
+ if [ "\${COMP_CWORD}" -eq 1 ]; then
30
+ COMPREPLY=( $(compgen -W "\${commands}" -- "\${cur}") )
31
+ fi
32
+ }
33
+
34
+ complete -F _bee_completions bee
35
+ `;
36
+ const renderZsh = (entries) => {
37
+ return `#compdef bee
38
+ # zsh completion for bee
39
+ # Add to ~/.zshrc:
40
+ # eval "$(bee completion zsh)"
41
+
42
+ _bee() {
43
+ local -a commands
44
+ commands=(
45
+ ${entries.map((entry) => ` '${escapeZsh(entry.name)}:${escapeZsh(entry.summary)}'`).join(" \\\n")}
46
+ )
47
+
48
+ _arguments '1: :->command' '*:: :->args'
49
+
50
+ case $state in
51
+ command)
52
+ _describe 'command' commands
53
+ ;;
54
+ esac
55
+ }
56
+
57
+ compdef _bee bee
58
+ `;
59
+ };
60
+ const renderFish = (entries) => {
61
+ return `# fish completion for bee
62
+ # Add to ~/.config/fish/completions/bee.fish:
63
+ # bee completion fish > ~/.config/fish/completions/bee.fish
64
+
65
+ complete -c bee -e
66
+ ${entries.map((entry) => `complete -c bee -n "__fish_use_subcommand" -a "${entry.name}" -d "${escapeDoubleQuoted(entry.summary)}"`).join("\n")}
67
+ `;
68
+ };
69
+ /**
70
+ * Null-prototyped so a shell name that collides with an inherited property
71
+ * ("toString") fails validation instead of resolving to a non-renderer.
72
+ */
73
+ const RENDERERS = Object.assign(Object.create(null), {
74
+ bash: renderBash,
75
+ zsh: renderZsh,
76
+ fish: renderFish
77
+ });
78
+ const SUPPORTED_SHELLS = Object.keys(RENDERERS);
79
+ const isSupportedShell = (shell) => shell in RENDERERS;
80
+ /** Render the completion script for `shell` from the program's top-level commands. */
81
+ const renderCompletionScript = (shell, program) => RENDERERS[shell](commandEntries(program));
82
+ //#endregion
83
+ //#region src/commands/completion.ts
84
+ /**
85
+ * The registry imports this module, so importing it back at the top level would
86
+ * close a cycle and leave `loadCommands` undefined here. Loading it inside the
87
+ * action defers the lookup until every module has finished evaluating.
88
+ */
89
+ const buildProgram = async () => {
90
+ const { loadCommands } = await import("./registry-RATsKPUm.mjs");
91
+ const program = new BeeCommand("bee");
92
+ await program.addCommands(loadCommands());
93
+ return program;
94
+ };
95
+ const completion = new BeeCommand("completion").summary("Generate shell completion scripts").description(`Supported shells: bash, zsh, fish. Source the output in your shell configuration.`).argument("<shell>", "Shell to generate completions for").examples([
96
+ {
97
+ description: "Set up completions for bash (add to ~/.bashrc)",
98
+ command: "echo 'eval \"$(bee completion bash)\"' >> ~/.bashrc"
99
+ },
100
+ {
101
+ description: "Set up completions for zsh (add to ~/.zshrc)",
102
+ command: "echo 'eval \"$(bee completion zsh)\"' >> ~/.zshrc"
103
+ },
104
+ {
105
+ description: "Set up completions for fish",
106
+ command: "bee completion fish > ~/.config/fish/completions/bee.fish"
107
+ }
108
+ ]).action(async (shell) => {
109
+ if (!isSupportedShell(shell)) throw new UserError(`Unsupported shell: "${shell}". Supported shells: ${SUPPORTED_SHELLS.join(", ")}.`);
110
+ process.stdout.write(renderCompletionScript(shell, await buildProgram()));
111
+ });
112
+ //#endregion
113
+ export { completion as default };
@@ -0,0 +1,50 @@
1
+ import { E as PrStatusName, S as resolveUserId, w as PR_STATUS_NAMES, y as getClient } from "./src-CTD9-bSB.mjs";
2
+ import { t as outputResult } from "./output-DBvfyU1J.mjs";
3
+ import "./src-CP4YLIAh.mjs";
4
+ import { i as ENV_REPO, n as ENV_AUTH, r as ENV_PROJECT, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
5
+ import { E as resolveOptions, S as space, a as collect, n as assigneeList, o as collectNum, u as json, x as repo, y as project } from "./common-options-BuYWxYdO.mjs";
6
+ import consola from "consola";
7
+ import { getPullRequestsCount } from "backlog-js";
8
+ //#region src/commands/pr/count.ts
9
+ const resolveStatusIds = (statuses) => statuses.map((name) => {
10
+ const id = PrStatusName[name.toLowerCase()];
11
+ if (id === void 0) throw new Error(`Unknown status "${name}". Valid values: ${PR_STATUS_NAMES.join(", ")}`);
12
+ return id;
13
+ });
14
+ const count = new BeeCommand("count").summary("Count pull requests").description(`Accepts the same filter flags as \`bee pr list\`.`).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(json()).addOption(space()).envVars([
15
+ ...ENV_AUTH,
16
+ ENV_PROJECT,
17
+ ENV_REPO
18
+ ]).examples([
19
+ {
20
+ description: "Count all pull requests",
21
+ command: "bee pr count -p PROJECT -R repo"
22
+ },
23
+ {
24
+ description: "Count open pull requests",
25
+ command: "bee pr count -p PROJECT -R repo --status open"
26
+ },
27
+ {
28
+ description: "Output as JSON",
29
+ command: "bee pr count -p PROJECT -R repo --json"
30
+ }
31
+ ]).action(async (opts, cmd) => {
32
+ await resolveOptions(cmd);
33
+ const { client } = await getClient(opts.space);
34
+ const statusId = opts.status.length > 0 ? resolveStatusIds(opts.status) : void 0;
35
+ const assigneeId = await Promise.all((opts.assignee ?? []).map((id) => resolveUserId(client, id)));
36
+ const issueId = opts.issue;
37
+ const createdUserId = opts.createdUser;
38
+ const result = await getPullRequestsCount(client, opts.project, opts.repo, {
39
+ statusId,
40
+ assigneeId: assigneeId.length > 0 ? assigneeId : void 0,
41
+ issueId: issueId.length > 0 ? issueId : void 0,
42
+ createdUserId: createdUserId.length > 0 ? createdUserId : void 0
43
+ });
44
+ const json = opts.json === true ? "" : opts.json;
45
+ outputResult(result, { json }, (data) => {
46
+ consola.log(data.count);
47
+ });
48
+ });
49
+ //#endregion
50
+ export { count as default };
@@ -0,0 +1,40 @@
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, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
5
+ import { S as space, u as json } from "./common-options-BuYWxYdO.mjs";
6
+ import consola from "consola";
7
+ import { getMyself, getUserStarsCount } from "backlog-js";
8
+ //#region src/commands/star/count.ts
9
+ const count = new BeeCommand("count").summary("Count received stars").description(`Defaults to the authenticated user if no user ID is given.`).argument("[user]", "User ID").option("--since <yyyy-MM-dd>", "Count stars received on or after this date").option("--until <yyyy-MM-dd>", "Count stars received on or before this date").addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([
10
+ {
11
+ description: "Count your stars",
12
+ command: "bee star count"
13
+ },
14
+ {
15
+ description: "Count stars for a specific user",
16
+ command: "bee star count 12345"
17
+ },
18
+ {
19
+ description: "Count stars in a date range",
20
+ command: "bee star count --since 2025-01-01 --until 2025-12-31"
21
+ },
22
+ {
23
+ description: "Output as JSON",
24
+ command: "bee star count --json"
25
+ }
26
+ ]).action(async (user, opts) => {
27
+ const { client } = await getClient(opts.space);
28
+ let userId;
29
+ if (user) userId = parseArg(vInteger, user, "user");
30
+ else userId = (await getMyself(client)).id;
31
+ const params = {};
32
+ if (opts.since) params.since = opts.since;
33
+ if (opts.until) params.until = opts.until;
34
+ const result = await getUserStarsCount(client, userId, params);
35
+ outputResult(result, opts, (data) => {
36
+ consola.log(String(data.count));
37
+ });
38
+ });
39
+ //#endregion
40
+ export { count as default };
@@ -0,0 +1,51 @@
1
+ import { C as resolveProjectIds, O as PRIORITY_NAMES, S as resolveUserId, k as PriorityId, 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, r as ENV_PROJECT, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
5
+ import { S as space, a as collect, b as projectOptional, d as keyword, n as assigneeList, o as collectNum, u as json } from "./common-options-BuYWxYdO.mjs";
6
+ import consola from "consola";
7
+ import { getIssuesCount } from "backlog-js";
8
+ //#region src/commands/issue/count.ts
9
+ const resolvePriorityIds = (priorities) => priorities.map((name) => {
10
+ const id = PriorityId[name.toLowerCase()];
11
+ if (id === void 0) throw new Error(`Unknown priority "${name}". Valid values: ${PRIORITY_NAMES.join(", ")}`);
12
+ return id;
13
+ });
14
+ const count = new BeeCommand("count").summary("Count issues").description(`Accepts the same filter flags as \`bee issue list\`.`).addOption(projectOptional("Project ID or project key (comma-separated for multiple)")).addOption(assigneeList()).option("-S, --status <id>", "Status ID (repeatable)", collectNum, []).option("-P, --priority <name>", "Priority name (repeatable)", collect, []).addOption(keyword()).option("--created-since <date>", "Show issues created on or after this date").option("--created-until <date>", "Show issues created on or before this date").option("--updated-since <date>", "Show issues updated on or after this date").option("--updated-until <date>", "Show issues updated on or before this date").option("--due-since <date>", "Show issues due on or after this date").option("--due-until <date>", "Show issues due on or before this date").addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([
15
+ {
16
+ description: "Count all issues in a project",
17
+ command: "bee issue count -p PROJECT"
18
+ },
19
+ {
20
+ description: "Count open bugs assigned to you",
21
+ command: "bee issue count -p PROJECT -a @me -k \"bug\""
22
+ },
23
+ {
24
+ description: "Output as JSON",
25
+ command: "bee issue count -p PROJECT --json"
26
+ }
27
+ ]).action(async (opts) => {
28
+ const { client } = await getClient(opts.space);
29
+ const projectId = opts.project ? await resolveProjectIds(client, opts.project.split(",").map((s) => s.trim()).filter(Boolean)) : [];
30
+ const assigneeId = await Promise.all((opts.assignee ?? []).map((id) => resolveUserId(client, id)));
31
+ const statusId = opts.status;
32
+ const priorityId = opts.priority.length > 0 ? resolvePriorityIds(opts.priority) : [];
33
+ const result = await getIssuesCount(client, {
34
+ projectId,
35
+ assigneeId,
36
+ statusId,
37
+ priorityId,
38
+ keyword: opts.keyword,
39
+ createdSince: opts.createdSince,
40
+ createdUntil: opts.createdUntil,
41
+ updatedSince: opts.updatedSince,
42
+ updatedUntil: opts.updatedUntil,
43
+ dueDateSince: opts.dueSince,
44
+ dueDateUntil: opts.dueUntil
45
+ });
46
+ outputResult(result, { json: opts.json }, (data) => {
47
+ consola.log(data.count);
48
+ });
49
+ });
50
+ //#endregion
51
+ export { count as default };
@@ -0,0 +1,25 @@
1
+ import { 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, r as ENV_PROJECT, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
5
+ import { E as resolveOptions, S as space, u as json, y as project } from "./common-options-BuYWxYdO.mjs";
6
+ import consola from "consola";
7
+ import { getWikisCount } from "backlog-js";
8
+ //#region src/commands/wiki/count.ts
9
+ const count = new BeeCommand("count").summary("Count wiki pages").description(`Counts all wiki pages regardless of tag or keyword.`).addOption(project()).addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([{
10
+ description: "Count wiki pages",
11
+ command: "bee wiki count -p PROJECT"
12
+ }, {
13
+ description: "Output as JSON",
14
+ command: "bee wiki count -p PROJECT --json"
15
+ }]).action(async (opts, cmd) => {
16
+ await resolveOptions(cmd);
17
+ const { client } = await getClient(opts.space);
18
+ const result = await getWikisCount(client, opts.project);
19
+ const json = opts.json === true ? "" : opts.json;
20
+ outputResult(result, { json }, (data) => {
21
+ consola.log(String(data.count));
22
+ });
23
+ });
24
+ //#endregion
25
+ export { count as default };
@@ -0,0 +1,46 @@
1
+ import { 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, u as json } from "./common-options-BuYWxYdO.mjs";
6
+ import consola from "consola";
7
+ import { getNotificationsCount } from "backlog-js";
8
+ //#region src/commands/notification/count.ts
9
+ const parseReadFilter = (value) => {
10
+ if (value === void 0 || value === "all") return;
11
+ return value === "read";
12
+ };
13
+ const count = new BeeCommand("count").summary("Count notifications").description(`By default, counts all notifications regardless of read status.
14
+
15
+ For details, see:
16
+ https://developer.nulab.com/docs/backlog/api/2/count-notification/`).option("--already-read <value>", "Filter by read status. If omitted, count all. {read|unread|all}").option("--resource-already-read <value>", "Filter by resource read status. If omitted, count all. {read|unread|all}").addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([
17
+ {
18
+ description: "Count all notifications",
19
+ command: "bee notification count"
20
+ },
21
+ {
22
+ description: "Count only unread notifications",
23
+ command: "bee notification count --already-read unread"
24
+ },
25
+ {
26
+ description: "Count only read notifications",
27
+ command: "bee notification count --already-read read"
28
+ },
29
+ {
30
+ description: "Output as JSON",
31
+ command: "bee notification count --json"
32
+ }
33
+ ]).action(async (opts) => {
34
+ const { client } = await getClient(opts.space);
35
+ const alreadyRead = parseReadFilter(opts.alreadyRead);
36
+ const resourceAlreadyRead = parseReadFilter(opts.resourceAlreadyRead);
37
+ const params = {};
38
+ if (alreadyRead !== void 0) params.alreadyRead = alreadyRead;
39
+ if (resourceAlreadyRead !== void 0) params.resourceAlreadyRead = resourceAlreadyRead;
40
+ const result = await getNotificationsCount(client, params);
41
+ outputResult(result, opts, (data) => {
42
+ consola.log(String(data.count));
43
+ });
44
+ });
45
+ //#endregion
46
+ export { count as default };
@@ -0,0 +1,47 @@
1
+ import { C as resolveProjectIds, a as documentUrl, y as getClient } from "./src-CTD9-bSB.mjs";
2
+ import { t as outputResult } from "./output-DBvfyU1J.mjs";
3
+ import { l as promptRequired } from "./src-CP4YLIAh.mjs";
4
+ import { n as resolveStdinArg } from "./stdin-C-vjNi9T.mjs";
5
+ import { n as ENV_AUTH, r as ENV_PROJECT, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
6
+ import { S as space, b as projectOptional, u as json } from "./common-options-BuYWxYdO.mjs";
7
+ import consola from "consola";
8
+ import { addDocument } from "backlog-js";
9
+ //#region src/commands/document/create.ts
10
+ const create = new BeeCommand("create").summary("Create a document").description(`Omitted required fields will be prompted interactively. When input is piped, it is used as the body automatically.`).addOption(projectOptional()).option("-t, --title <text>", "Document title").option("-b, --body <text>", "Document body content").option("--emoji <emoji>", "Emoji for the document").option("--parent-id <id>", "Parent document ID for creating as a child document").option("--add-last", "Add document to the end of the list").addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([
11
+ {
12
+ description: "Create a document with title and body",
13
+ command: "bee document create -p PROJECT -t \"Meeting Notes\" -b \"Content here\""
14
+ },
15
+ {
16
+ description: "Create a document from stdin",
17
+ command: "echo \"Content\" | bee document create -p PROJECT -t \"Notes\""
18
+ },
19
+ {
20
+ description: "Create a child document",
21
+ command: "bee document create -p PROJECT -t \"Sub Page\" --parent-id 12345"
22
+ },
23
+ {
24
+ description: "Output as JSON",
25
+ command: "bee document create -p PROJECT -t \"Title\" --json"
26
+ }
27
+ ]).action(async (opts) => {
28
+ const { client, host } = await getClient(opts.space);
29
+ const project = await promptRequired("Project:", opts.project);
30
+ const title = await promptRequired("Title:", opts.title);
31
+ const [projectId] = await resolveProjectIds(client, [project]);
32
+ const body = await resolveStdinArg(opts.body);
33
+ const doc = await addDocument(client, {
34
+ projectId,
35
+ title,
36
+ content: body,
37
+ emoji: opts.emoji,
38
+ parentId: opts.parentId,
39
+ addLast: opts.addLast
40
+ });
41
+ outputResult(doc, opts, (data) => {
42
+ consola.success(`Created document ${data.title} (ID: ${data.id})`);
43
+ consola.info(documentUrl(host, project, data.id));
44
+ });
45
+ });
46
+ //#endregion
47
+ export { create as default };
@@ -0,0 +1,41 @@
1
+ import { C as resolveProjectIds, v as wikiUrl, y as getClient } from "./src-CTD9-bSB.mjs";
2
+ import { t as outputResult } from "./output-DBvfyU1J.mjs";
3
+ import { l as promptRequired } from "./src-CP4YLIAh.mjs";
4
+ import { n as resolveStdinArg } from "./stdin-C-vjNi9T.mjs";
5
+ import { n as ENV_AUTH, r as ENV_PROJECT, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
6
+ import { S as space, b as projectOptional, u as json } from "./common-options-BuYWxYdO.mjs";
7
+ import consola from "consola";
8
+ import { postWiki } from "backlog-js";
9
+ //#region src/commands/wiki/create.ts
10
+ const create = new BeeCommand("create").summary("Create a wiki page").description(`When input is piped, it is used as the body automatically.`).addOption(projectOptional()).option("-n, --name <name>", "Wiki page name").option("-b, --body <text>", "Wiki page content").option("--mail-notify", "Send notification email").addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([
11
+ {
12
+ description: "Create a wiki page",
13
+ command: "bee wiki create -p PROJECT -n \"Page Name\" -b \"Content\""
14
+ },
15
+ {
16
+ description: "Create a wiki page from stdin",
17
+ command: "echo \"Body\" | bee wiki create -p PROJECT -n \"Name\""
18
+ },
19
+ {
20
+ description: "Create and send notification email",
21
+ command: "bee wiki create -p PROJECT -n \"Name\" -b \"Content\" --mail-notify"
22
+ }
23
+ ]).action(async (opts) => {
24
+ const { client, host } = await getClient(opts.space);
25
+ const project = await promptRequired("Project:", opts.project);
26
+ const name = await promptRequired("Page name:", opts.name);
27
+ const body = await resolveStdinArg(opts.body) ?? "";
28
+ const [projectId] = await resolveProjectIds(client, [project]);
29
+ const wiki = await postWiki(client, {
30
+ projectId,
31
+ name,
32
+ content: body,
33
+ mailNotify: opts.mailNotify
34
+ });
35
+ outputResult(wiki, opts, (data) => {
36
+ consola.success(`Created wiki page ${data.id}: ${data.name}`);
37
+ consola.info(wikiUrl(host, data.id));
38
+ });
39
+ });
40
+ //#endregion
41
+ export { create as default };
@@ -0,0 +1,29 @@
1
+ import { _ as statusUrl, y as getClient } from "./src-CTD9-bSB.mjs";
2
+ import { t as outputResult } from "./output-DBvfyU1J.mjs";
3
+ import { l as promptRequired } 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, u as json, y as project } from "./common-options-BuYWxYdO.mjs";
6
+ import consola from "consola";
7
+ import { postProjectStatus } from "backlog-js";
8
+ //#region src/commands/status/create.ts
9
+ const create = new BeeCommand("create").summary("Create a status").description(`Omitted fields will be prompted interactively.`).addOption(project()).option("-n, --name <value>", "Status name").requiredOption("--color <value>", "Display color {#ea2c00|#e87758|#e07b9a|#868cb7|#3b9dbd|#4caf93|#b0be3c|#eda62a|#f42858|#393939}").addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([{
10
+ description: "Create a status",
11
+ command: "bee status create -p PROJECT -n \"In Review\" --color \"#3b9dbd\""
12
+ }, {
13
+ description: "Create interactively",
14
+ command: "bee status create -p PROJECT --color \"#3b9dbd\""
15
+ }]).action(async (opts, cmd) => {
16
+ await resolveOptions(cmd);
17
+ const { client, host } = await getClient(opts.space);
18
+ const name = await promptRequired("Status name:", opts.name);
19
+ const status = await postProjectStatus(client, opts.project, {
20
+ name,
21
+ color: opts.color
22
+ });
23
+ outputResult(status, opts, (data) => {
24
+ consola.success(`Created status ${data.name} (ID: ${data.id})`);
25
+ consola.info(statusUrl(host, opts.project, data.id));
26
+ });
27
+ });
28
+ //#endregion
29
+ export { create as default };
@@ -0,0 +1,29 @@
1
+ import { l as issueTypeUrl, y as getClient } from "./src-CTD9-bSB.mjs";
2
+ import { t as outputResult } from "./output-DBvfyU1J.mjs";
3
+ import { l as promptRequired } 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, u as json, y as project } from "./common-options-BuYWxYdO.mjs";
6
+ import consola from "consola";
7
+ import { postIssueType } from "backlog-js";
8
+ //#region src/commands/issue-type/create.ts
9
+ const create = new BeeCommand("create").summary("Create an issue type").description(`Omitted fields will be prompted interactively.`).addOption(project()).option("-n, --name <value>", "Issue type name").requiredOption("--color <value>", "Display color {#e30000|#990000|#934981|#814fbc|#2779ca|#007e9a|#7ea800|#ff9200|#ff3265|#666665}").addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([{
10
+ description: "Create an issue type",
11
+ command: "bee issue-type create -p PROJECT -n \"Enhancement\" --color \"#2779ca\""
12
+ }, {
13
+ description: "Create interactively",
14
+ command: "bee issue-type create -p PROJECT --color \"#2779ca\""
15
+ }]).action(async (opts, cmd) => {
16
+ await resolveOptions(cmd);
17
+ const { client, host } = await getClient(opts.space);
18
+ const name = await promptRequired("Issue type name:", opts.name);
19
+ const issueType = await postIssueType(client, opts.project, {
20
+ name,
21
+ color: opts.color
22
+ });
23
+ outputResult(issueType, opts, (data) => {
24
+ consola.success(`Created issue type ${data.name} (ID: ${data.id})`);
25
+ consola.info(issueTypeUrl(host, data.id, data.projectId));
26
+ });
27
+ });
28
+ //#endregion
29
+ export { create as default };
@@ -0,0 +1,60 @@
1
+ import { S as resolveUserId, h as pullRequestUrl, y as getClient } from "./src-CTD9-bSB.mjs";
2
+ import { t as outputResult } from "./output-DBvfyU1J.mjs";
3
+ import { l as promptRequired, s as vInteger } from "./src-CP4YLIAh.mjs";
4
+ import { i as ENV_REPO, n as ENV_AUTH, r as ENV_PROJECT, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
5
+ import { E as resolveOptions, S as space, g as notify, r as attachment, t as assignee, u as json, x as repo, y as project } from "./common-options-BuYWxYdO.mjs";
6
+ import consola from "consola";
7
+ import { getIssue, postPullRequest } from "backlog-js";
8
+ import * as v from "valibot";
9
+ //#region src/commands/pr/create.ts
10
+ const create = new BeeCommand("create").summary("Create a pull request").description(`Omitted required fields will be prompted interactively.`).addOption(project()).addOption(repo()).option("--base <branch>", "Base branch name").option("--head <branch>", "Head branch name").option("-t, --title <text>", "Pull request title").option("-b, --body <text>", "Pull request description").addOption(assignee()).option("--issue <key>", "Related issue ID or issue key").addOption(notify()).addOption(attachment()).addOption(json()).addOption(space()).envVars([
11
+ ...ENV_AUTH,
12
+ ENV_PROJECT,
13
+ ENV_REPO
14
+ ]).examples([
15
+ {
16
+ description: "Create a pull request",
17
+ command: "bee pr create -p PROJECT -R repo --base main --head feature -t \"Add login\" -b \"Details\""
18
+ },
19
+ {
20
+ description: "Create a pull request assigned to yourself",
21
+ command: "bee pr create -p PROJECT -R repo --base main --head feature -t \"Title\" -b \"Desc\" --assignee @me"
22
+ },
23
+ {
24
+ description: "Create a pull request linked to an issue",
25
+ command: "bee pr create -p PROJECT -R repo --base main --head feature -t \"Title\" -b \"Desc\" --issue 123"
26
+ }
27
+ ]).action(async (opts, cmd) => {
28
+ await resolveOptions(cmd);
29
+ const { client, host } = await getClient(opts.space);
30
+ const base = await promptRequired("Base branch:", opts.base);
31
+ const head = await promptRequired("Head branch:", opts.head);
32
+ const summary = await promptRequired("Summary:", opts.title);
33
+ const description = await promptRequired("Body:", opts.body);
34
+ const assigneeId = opts.assignee ? await resolveUserId(client, opts.assignee) : void 0;
35
+ const notifiedUserId = opts.notify ?? [];
36
+ const attachmentId = opts.attachment ?? [];
37
+ let issueId;
38
+ if (opts.issue) {
39
+ const parsed = v.safeParse(vInteger, opts.issue);
40
+ if (parsed.success) issueId = parsed.output;
41
+ else issueId = (await getIssue(client, opts.issue)).id;
42
+ }
43
+ const pullRequest = await postPullRequest(client, opts.project, opts.repo, {
44
+ summary,
45
+ description,
46
+ base,
47
+ branch: head,
48
+ issueId,
49
+ assigneeId,
50
+ notifiedUserId,
51
+ attachmentId
52
+ });
53
+ const json = opts.json === true ? "" : opts.json;
54
+ outputResult(pullRequest, { json }, (data) => {
55
+ consola.success(`Created pull request #${data.number}: ${data.summary}`);
56
+ consola.info(pullRequestUrl(host, opts.project, opts.repo, data.number));
57
+ });
58
+ });
59
+ //#endregion
60
+ export { create as default };