@nulab/bee 1.0.0-rc.0 → 1.0.0-rc.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 (103) hide show
  1. package/dist/chunks/activities.mjs +13 -14
  2. package/dist/chunks/activities2.mjs +16 -17
  3. package/dist/chunks/activities3.mjs +15 -16
  4. package/dist/chunks/add-user.mjs +10 -14
  5. package/dist/chunks/add.mjs +15 -14
  6. package/dist/chunks/add2.mjs +9 -10
  7. package/dist/chunks/api.mjs +14 -13
  8. package/dist/chunks/attachments.mjs +11 -12
  9. package/dist/chunks/attachments2.mjs +11 -12
  10. package/dist/chunks/attachments3.mjs +12 -13
  11. package/dist/chunks/browse.mjs +10 -11
  12. package/dist/chunks/clone.mjs +9 -10
  13. package/dist/chunks/close.mjs +10 -11
  14. package/dist/chunks/comment.mjs +14 -13
  15. package/dist/chunks/comment2.mjs +12 -13
  16. package/dist/chunks/comments.mjs +14 -15
  17. package/dist/chunks/completion.mjs +1 -1
  18. package/dist/chunks/count.mjs +7 -8
  19. package/dist/chunks/count2.mjs +9 -10
  20. package/dist/chunks/count3.mjs +10 -11
  21. package/dist/chunks/count4.mjs +9 -10
  22. package/dist/chunks/count5.mjs +10 -11
  23. package/dist/chunks/create.mjs +9 -10
  24. package/dist/chunks/create2.mjs +18 -13
  25. package/dist/chunks/create3.mjs +10 -11
  26. package/dist/chunks/create4.mjs +14 -14
  27. package/dist/chunks/create5.mjs +10 -11
  28. package/dist/chunks/create6.mjs +9 -10
  29. package/dist/chunks/create7.mjs +9 -10
  30. package/dist/chunks/create8.mjs +9 -10
  31. package/dist/chunks/create9.mjs +9 -10
  32. package/dist/chunks/dashboard.mjs +12 -13
  33. package/dist/chunks/delete.mjs +8 -9
  34. package/dist/chunks/delete2.mjs +8 -9
  35. package/dist/chunks/delete3.mjs +8 -9
  36. package/dist/chunks/delete4.mjs +12 -10
  37. package/dist/chunks/delete5.mjs +12 -10
  38. package/dist/chunks/delete6.mjs +12 -10
  39. package/dist/chunks/delete7.mjs +19 -12
  40. package/dist/chunks/delete8.mjs +10 -11
  41. package/dist/chunks/delete9.mjs +9 -10
  42. package/dist/chunks/edit.mjs +9 -10
  43. package/dist/chunks/edit2.mjs +23 -18
  44. package/dist/chunks/edit3.mjs +15 -15
  45. package/dist/chunks/edit4.mjs +10 -11
  46. package/dist/chunks/edit5.mjs +15 -10
  47. package/dist/chunks/edit6.mjs +20 -17
  48. package/dist/chunks/edit7.mjs +17 -14
  49. package/dist/chunks/edit8.mjs +17 -14
  50. package/dist/chunks/history.mjs +16 -17
  51. package/dist/chunks/list.mjs +11 -12
  52. package/dist/chunks/list10.mjs +11 -12
  53. package/dist/chunks/list11.mjs +11 -12
  54. package/dist/chunks/list12.mjs +11 -12
  55. package/dist/chunks/list13.mjs +11 -12
  56. package/dist/chunks/list14.mjs +12 -13
  57. package/dist/chunks/list15.mjs +11 -12
  58. package/dist/chunks/list2.mjs +29 -16
  59. package/dist/chunks/list3.mjs +19 -20
  60. package/dist/chunks/list4.mjs +15 -16
  61. package/dist/chunks/list5.mjs +15 -16
  62. package/dist/chunks/list6.mjs +11 -12
  63. package/dist/chunks/list7.mjs +14 -15
  64. package/dist/chunks/list8.mjs +11 -12
  65. package/dist/chunks/list9.mjs +11 -12
  66. package/dist/chunks/login.mjs +27 -26
  67. package/dist/chunks/logout.mjs +3 -4
  68. package/dist/chunks/me.mjs +12 -13
  69. package/dist/chunks/read-all.mjs +8 -9
  70. package/dist/chunks/read.mjs +9 -10
  71. package/dist/chunks/read2.mjs +9 -10
  72. package/dist/chunks/refresh.mjs +3 -4
  73. package/dist/chunks/remove-user.mjs +10 -14
  74. package/dist/chunks/remove.mjs +9 -10
  75. package/dist/chunks/reopen.mjs +9 -10
  76. package/dist/chunks/status.mjs +3 -4
  77. package/dist/chunks/status2.mjs +9 -10
  78. package/dist/chunks/status3.mjs +9 -10
  79. package/dist/chunks/switch.mjs +2 -3
  80. package/dist/chunks/tags.mjs +9 -10
  81. package/dist/chunks/token.mjs +3 -4
  82. package/dist/chunks/tree.mjs +9 -10
  83. package/dist/chunks/users.mjs +11 -12
  84. package/dist/chunks/view.mjs +12 -13
  85. package/dist/chunks/view2.mjs +12 -13
  86. package/dist/chunks/view3.mjs +12 -13
  87. package/dist/chunks/view4.mjs +13 -14
  88. package/dist/chunks/view5.mjs +12 -13
  89. package/dist/chunks/view6.mjs +12 -13
  90. package/dist/chunks/view7.mjs +13 -14
  91. package/dist/chunks/view8.mjs +14 -15
  92. package/dist/chunks/view9.mjs +12 -13
  93. package/dist/index.mjs +4 -3
  94. package/dist/shared/{bee.DVTuFf-T.mjs → bee.B4OxR0DJ.mjs} +50 -2
  95. package/dist/shared/{bee.CThuQMit.mjs → bee.BCBBmkOy.mjs} +6 -5
  96. package/dist/shared/bee.BYqxm3yG.mjs +24 -0
  97. package/dist/shared/bee.G4d7izLe.mjs +14 -0
  98. package/dist/shared/{bee.sHWg0IFT.mjs → bee.PF8hrVKn.mjs} +8 -3
  99. package/dist/shared/{bee.-8tk76YJ.mjs → bee.riolf-_Y.mjs} +1 -1
  100. package/package.json +4 -5
  101. package/dist/shared/bee.ChBdZ0cH.mjs +0 -9
  102. package/dist/shared/bee.DHTPkjMh.mjs +0 -48
  103. package/dist/shared/bee.XxOB1Her.mjs +0 -8
@@ -1,26 +1,25 @@
1
1
  import consola from 'consola';
2
- import { g as getClient } from '../shared/bee.CThuQMit.mjs';
3
- import 'backlog-js';
4
- import 'node:http';
5
- import 'open';
6
- import 'node:child_process';
7
2
  import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
8
3
  import 'node:stream/consumers';
9
4
  import 'valibot';
5
+ import '../shared/bee.BYqxm3yG.mjs';
10
6
  import { p as printTable } from '../shared/bee.IM3QELRf.mjs';
7
+ import { g as getClient } from '../shared/bee.BCBBmkOy.mjs';
8
+ import 'backlog-js';
9
+ import 'node:http';
10
+ import 'open';
11
+ import 'node:child_process';
11
12
  import { B as BeeCommand, E as ENV_AUTH } from '../shared/bee.CQ3kBgas.mjs';
12
- import { j as json, s as space } from '../shared/bee.DHTPkjMh.mjs';
13
- import '../shared/bee.XxOB1Her.mjs';
13
+ import { j as json, s as space } from '../shared/bee.B4OxR0DJ.mjs';
14
+ import '../shared/bee.Ds2l-nTJ.mjs';
14
15
  import '../shared/bee.CktwmH8R.mjs';
15
- import '../shared/bee.DVTuFf-T.mjs';
16
+ import '../shared/bee.riolf-_Y.mjs';
17
+ import 'commander';
18
+ import 'consola/utils';
16
19
  import 'node:fs';
17
20
  import 'node:path';
18
21
  import 'node:os';
19
22
  import '../shared/bee.BeQSH2t0.mjs';
20
- import '../shared/bee.-8tk76YJ.mjs';
21
- import '../shared/bee.Ds2l-nTJ.mjs';
22
- import 'commander';
23
- import 'consola/utils';
24
23
 
25
24
  const list = new BeeCommand("list").summary("List watching items").description(`Unread items are marked with an asterisk (\`*\`).`).addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([
26
25
  { description: "List your watching items", command: "bee watching list" },
@@ -1,29 +1,28 @@
1
1
  import consola from 'consola';
2
2
  import { P as PriorityId, a as PRIORITY_NAMES } from '../shared/bee.Btmq3TXs.mjs';
3
- import { r as resolveProjectIds } from '../shared/bee.sHWg0IFT.mjs';
4
- import { r as resolveUserId } from '../shared/bee.ChBdZ0cH.mjs';
5
- import { g as getClient } from '../shared/bee.CThuQMit.mjs';
3
+ import { r as resolveProjectIds } from '../shared/bee.PF8hrVKn.mjs';
4
+ import { r as resolveUserId } from '../shared/bee.G4d7izLe.mjs';
5
+ import { g as getClient } from '../shared/bee.BCBBmkOy.mjs';
6
6
  import 'backlog-js';
7
7
  import 'node:http';
8
8
  import 'open';
9
9
  import 'node:child_process';
10
10
  import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
11
11
  import 'node:stream/consumers';
12
- import 'valibot';
12
+ import * as v from 'valibot';
13
+ import { p as parseArg, v as vInteger } from '../shared/bee.BYqxm3yG.mjs';
13
14
  import { p as printTable } from '../shared/bee.IM3QELRf.mjs';
14
15
  import { Option } from 'commander';
15
16
  import { B as BeeCommand, E as ENV_AUTH, a as ENV_PROJECT } from '../shared/bee.CQ3kBgas.mjs';
16
- import { d as assigneeList, a as collectNum, c as collect, k as keyword, o as order, b as count, e as offset, j as json, s as space } from '../shared/bee.DHTPkjMh.mjs';
17
- import '../shared/bee.XxOB1Her.mjs';
17
+ import { g as assigneeList, e as collectNum, c as collect, k as keyword, o as order, f as count, h as offset, j as json, s as space } from '../shared/bee.B4OxR0DJ.mjs';
18
18
  import '../shared/bee.CktwmH8R.mjs';
19
- import '../shared/bee.DVTuFf-T.mjs';
19
+ import '../shared/bee.riolf-_Y.mjs';
20
+ import '../shared/bee.Ds2l-nTJ.mjs';
21
+ import 'consola/utils';
20
22
  import 'node:fs';
21
23
  import 'node:path';
22
24
  import 'node:os';
23
25
  import '../shared/bee.BeQSH2t0.mjs';
24
- import '../shared/bee.-8tk76YJ.mjs';
25
- import '../shared/bee.Ds2l-nTJ.mjs';
26
- import 'consola/utils';
27
26
 
28
27
  const resolvePriorityIds = (priorities) => priorities.map((name) => {
29
28
  const id = PriorityId[name.toLowerCase()];
@@ -39,7 +38,7 @@ const list = new BeeCommand("list").summary("List issues").description(
39
38
  "-p, --project <id>",
40
39
  "Project ID or project key (comma-separated for multiple)"
41
40
  ).env("BACKLOG_PROJECT")
42
- ).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").option("--sort <field>", "Sort field").addOption(order()).addOption(count()).addOption(offset()).addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([
41
+ ).addOption(assigneeList()).option("-S, --status <id>", "Status ID (repeatable)", collectNum, []).option("-P, --priority <name>", "Priority name (repeatable)", collect, []).option("-T, --type <id>", "Issue type ID (repeatable)", collectNum, []).option("--category <id>", "Category ID (repeatable)", collectNum, []).option("--version <id>", "Version ID (repeatable)", collectNum, []).option("--milestone <id>", "Milestone ID (repeatable)", collectNum, []).option("--resolution <id>", "Resolution ID (repeatable)", collectNum, []).option("--parent-issue <id>", "Parent issue ID (repeatable)", collectNum, []).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("--start-since <date>", "Show issues starting on or after this date").option("--start-until <date>", "Show issues starting 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").option("--sort <field>", "Sort field").addOption(order()).addOption(count()).addOption(offset()).addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([
43
42
  { description: "List issues in a project", command: "bee issue list -p PROJECT" },
44
43
  { description: "List your assigned issues", command: "bee issue list -p PROJECT -a @me" },
45
44
  {
@@ -58,20 +57,34 @@ const list = new BeeCommand("list").summary("List issues").description(
58
57
  );
59
58
  const statusId = opts.status;
60
59
  const priorityId = opts.priority.length > 0 ? resolvePriorityIds(opts.priority) : [];
60
+ const issueTypeId = opts.type;
61
+ const categoryId = opts.category;
62
+ const versionId = opts.version;
63
+ const milestoneId = opts.milestone;
64
+ const resolutionId = opts.resolution;
65
+ const parentIssueId = opts.parentIssue;
61
66
  const issues = await client.getIssues({
62
67
  projectId,
63
68
  assigneeId,
64
69
  statusId,
65
70
  priorityId,
71
+ issueTypeId,
72
+ categoryId,
73
+ versionId,
74
+ milestoneId,
75
+ resolutionId,
76
+ parentIssueId,
66
77
  keyword: opts.keyword,
67
78
  sort: opts.sort,
68
79
  order: opts.order,
69
- count: opts.count ? Number(opts.count) : void 0,
70
- offset: opts.offset ? Number(opts.offset) : void 0,
80
+ count: parseArg(v.optional(vInteger), opts.count, "--count"),
81
+ offset: parseArg(v.optional(vInteger), opts.offset, "--offset"),
71
82
  createdSince: opts.createdSince,
72
83
  createdUntil: opts.createdUntil,
73
84
  updatedSince: opts.updatedSince,
74
85
  updatedUntil: opts.updatedUntil,
86
+ startDateSince: opts.startSince,
87
+ startDateUntil: opts.startUntil,
75
88
  dueDateSince: opts.dueSince,
76
89
  dueDateUntil: opts.dueUntil
77
90
  });
@@ -82,9 +95,9 @@ const list = new BeeCommand("list").summary("List issues").description(
82
95
  }
83
96
  const rows = data.map((issue) => [
84
97
  { header: "KEY", value: issue.issueKey },
85
- { header: "STATUS", value: issue.status.name },
86
- { header: "TYPE", value: issue.issueType.name },
87
- { header: "PRIORITY", value: issue.priority.name },
98
+ { header: "STATUS", value: issue.status?.name ?? "" },
99
+ { header: "TYPE", value: issue.issueType?.name ?? "" },
100
+ { header: "PRIORITY", value: issue.priority?.name ?? "" },
88
101
  { header: "ASSIGNEE", value: issue.assignee?.name ?? "Unassigned" },
89
102
  { header: "SUMMARY", value: issue.summary }
90
103
  ]);
@@ -1,29 +1,28 @@
1
1
  import consola from 'consola';
2
- import { r as resolveProjectIds } from '../shared/bee.sHWg0IFT.mjs';
3
- import { g as getClient } from '../shared/bee.CThuQMit.mjs';
4
- import 'backlog-js';
5
- import 'node:http';
6
- import 'open';
7
- import 'node:child_process';
2
+ import { r as resolveProjectIds } from '../shared/bee.PF8hrVKn.mjs';
8
3
  import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
9
4
  import 'node:stream/consumers';
10
5
  import * as v from 'valibot';
11
6
  import { safeParse } from 'valibot';
7
+ import { a as vFiniteNumber, p as parseArg, v as vInteger } from '../shared/bee.BYqxm3yG.mjs';
12
8
  import { f as formatDate } from '../shared/bee.n5MYN4a6.mjs';
13
9
  import { p as printTable } from '../shared/bee.IM3QELRf.mjs';
10
+ import { g as getClient } from '../shared/bee.BCBBmkOy.mjs';
11
+ import 'backlog-js';
12
+ import 'node:http';
13
+ import 'open';
14
+ import 'node:child_process';
14
15
  import { B as BeeCommand, E as ENV_AUTH, a as ENV_PROJECT } from '../shared/bee.CQ3kBgas.mjs';
15
- import { p as project, k as keyword, o as order, b as count, e as offset, j as json, s as space, r as resolveOptions } from '../shared/bee.DHTPkjMh.mjs';
16
- import '../shared/bee.XxOB1Her.mjs';
16
+ import { p as project, k as keyword, o as order, f as count, h as offset, j as json, s as space, r as resolveOptions } from '../shared/bee.B4OxR0DJ.mjs';
17
+ import '../shared/bee.Ds2l-nTJ.mjs';
17
18
  import '../shared/bee.CktwmH8R.mjs';
18
- import '../shared/bee.DVTuFf-T.mjs';
19
+ import '../shared/bee.riolf-_Y.mjs';
20
+ import 'commander';
21
+ import 'consola/utils';
19
22
  import 'node:fs';
20
23
  import 'node:path';
21
24
  import 'node:os';
22
25
  import '../shared/bee.BeQSH2t0.mjs';
23
- import '../shared/bee.-8tk76YJ.mjs';
24
- import '../shared/bee.Ds2l-nTJ.mjs';
25
- import 'commander';
26
- import 'consola/utils';
27
26
 
28
27
  const splitArg = (input, schema) => {
29
28
  if (!input) {
@@ -37,11 +36,11 @@ const splitArg = (input, schema) => {
37
36
  results.push(result.output);
38
37
  continue;
39
38
  }
40
- const num = Number(part);
41
- if (!Number.isNaN(num)) {
42
- const numResult = safeParse(schema, num);
43
- if (numResult.success) {
44
- results.push(numResult.output);
39
+ const numResult = safeParse(vFiniteNumber, part);
40
+ if (numResult.success) {
41
+ const schemaResult = safeParse(schema, numResult.output);
42
+ if (schemaResult.success) {
43
+ results.push(schemaResult.output);
45
44
  }
46
45
  }
47
46
  }
@@ -64,8 +63,8 @@ const list = new BeeCommand("list").summary("List documents").description(`Use \
64
63
  keyword: opts.keyword,
65
64
  sort: opts.sort,
66
65
  order: opts.order,
67
- count: opts.count ? Number(opts.count) : void 0,
68
- offset: opts.offset ? Number(opts.offset) : 0
66
+ count: parseArg(v.optional(vInteger), opts.count, "--count"),
67
+ offset: parseArg(v.optional(vInteger), opts.offset, "--offset") ?? 0
69
68
  });
70
69
  const json = opts.json === true ? "" : opts.json;
71
70
  outputResult(documents, { json }, (data) => {
@@ -1,27 +1,26 @@
1
1
  import consola from 'consola';
2
- import { g as getClient } from '../shared/bee.CThuQMit.mjs';
3
- import 'backlog-js';
4
- import 'node:http';
5
- import 'open';
6
- import 'node:child_process';
7
2
  import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
8
3
  import 'node:stream/consumers';
9
- import 'valibot';
4
+ import * as v from 'valibot';
5
+ import { p as parseArg, v as vInteger } from '../shared/bee.BYqxm3yG.mjs';
10
6
  import { f as formatDate } from '../shared/bee.n5MYN4a6.mjs';
11
7
  import { p as printTable } from '../shared/bee.IM3QELRf.mjs';
8
+ import { g as getClient } from '../shared/bee.BCBBmkOy.mjs';
9
+ import 'backlog-js';
10
+ import 'node:http';
11
+ import 'open';
12
+ import 'node:child_process';
12
13
  import { B as BeeCommand, E as ENV_AUTH } from '../shared/bee.CQ3kBgas.mjs';
13
- import { b as count, m as minId, l as maxId, o as order, j as json, s as space } from '../shared/bee.DHTPkjMh.mjs';
14
- import '../shared/bee.XxOB1Her.mjs';
14
+ import { f as count, z as minId, A as maxId, o as order, j as json, s as space } from '../shared/bee.B4OxR0DJ.mjs';
15
+ import '../shared/bee.Ds2l-nTJ.mjs';
15
16
  import '../shared/bee.CktwmH8R.mjs';
16
- import '../shared/bee.DVTuFf-T.mjs';
17
+ import '../shared/bee.riolf-_Y.mjs';
18
+ import 'commander';
19
+ import 'consola/utils';
17
20
  import 'node:fs';
18
21
  import 'node:path';
19
22
  import 'node:os';
20
23
  import '../shared/bee.BeQSH2t0.mjs';
21
- import '../shared/bee.-8tk76YJ.mjs';
22
- import '../shared/bee.Ds2l-nTJ.mjs';
23
- import 'commander';
24
- import 'consola/utils';
25
24
 
26
25
  const NOTIFICATION_REASON_LABELS = {
27
26
  1: "Assigned",
@@ -54,9 +53,9 @@ const list = new BeeCommand("list").summary("List notifications").description(
54
53
  ]).action(async (opts) => {
55
54
  const { client } = await getClient(opts.space);
56
55
  const notifications = await client.getNotifications({
57
- count: opts.count ? Number(opts.count) : void 0,
58
- minId: opts.minId ? Number(opts.minId) : void 0,
59
- maxId: opts.maxId ? Number(opts.maxId) : void 0,
56
+ count: parseArg(v.optional(vInteger), opts.count, "--count"),
57
+ minId: parseArg(v.optional(vInteger), opts.minId, "--min-id"),
58
+ maxId: parseArg(v.optional(vInteger), opts.maxId, "--max-id"),
60
59
  order: opts.order
61
60
  });
62
61
  outputResult(notifications, opts, (data) => {
@@ -1,28 +1,27 @@
1
1
  import consola from 'consola';
2
2
  import { P as PrStatusName, a as PR_STATUS_NAMES } from '../shared/bee.DoTvz3uW.mjs';
3
- import { r as resolveUserId } from '../shared/bee.ChBdZ0cH.mjs';
4
- import { g as getClient } from '../shared/bee.CThuQMit.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.IM3QELRf.mjs';
8
+ import { r as resolveUserId } from '../shared/bee.G4d7izLe.mjs';
9
+ import { g as getClient } from '../shared/bee.BCBBmkOy.mjs';
5
10
  import 'backlog-js';
6
11
  import 'node:http';
7
12
  import 'open';
8
13
  import 'node:child_process';
9
- import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
10
- import 'node:stream/consumers';
11
- import 'valibot';
12
- import { p as printTable } from '../shared/bee.IM3QELRf.mjs';
13
14
  import { B as BeeCommand, E as ENV_AUTH, a as ENV_PROJECT, b as ENV_REPO } from '../shared/bee.CQ3kBgas.mjs';
14
- import { p as project, q as repo, c as collect, d as assigneeList, a as collectNum, b as count, e as offset, j as json, s as space, r as resolveOptions } from '../shared/bee.DHTPkjMh.mjs';
15
- import '../shared/bee.XxOB1Her.mjs';
15
+ import { p as project, B as repo, c as collect, g as assigneeList, e as collectNum, f as count, h as offset, j as json, s as space, r as resolveOptions } from '../shared/bee.B4OxR0DJ.mjs';
16
+ import '../shared/bee.Ds2l-nTJ.mjs';
16
17
  import '../shared/bee.CktwmH8R.mjs';
17
- import '../shared/bee.DVTuFf-T.mjs';
18
+ import '../shared/bee.riolf-_Y.mjs';
19
+ import 'commander';
20
+ import 'consola/utils';
18
21
  import 'node:fs';
19
22
  import 'node:path';
20
23
  import 'node:os';
21
24
  import '../shared/bee.BeQSH2t0.mjs';
22
- import '../shared/bee.-8tk76YJ.mjs';
23
- import '../shared/bee.Ds2l-nTJ.mjs';
24
- import 'commander';
25
- import 'consola/utils';
26
25
 
27
26
  const resolveStatusIds = (statuses) => statuses.map((name) => {
28
27
  const id = PrStatusName[name.toLowerCase()];
@@ -56,8 +55,8 @@ const list = new BeeCommand("list").summary("List pull requests").description(`U
56
55
  assigneeId: assigneeId.length > 0 ? assigneeId : void 0,
57
56
  issueId: issueId.length > 0 ? issueId : void 0,
58
57
  createdUserId: createdUserId.length > 0 ? createdUserId : void 0,
59
- count: opts.count ? Number(opts.count) : void 0,
60
- offset: opts.offset ? Number(opts.offset) : void 0
58
+ count: parseArg(v.optional(vInteger), opts.count, "--count"),
59
+ offset: parseArg(v.optional(vInteger), opts.offset, "--offset")
61
60
  });
62
61
  const json = opts.json === true ? "" : opts.json;
63
62
  outputResult(pullRequests, { json }, (data) => {
@@ -67,7 +66,7 @@ const list = new BeeCommand("list").summary("List pull requests").description(`U
67
66
  }
68
67
  const rows = data.map((pr) => [
69
68
  { header: "#", value: String(pr.number) },
70
- { header: "STATUS", value: pr.status.name },
69
+ { header: "STATUS", value: pr.status?.name ?? "" },
71
70
  { header: "ASSIGNEE", value: pr.assignee?.name ?? "Unassigned" },
72
71
  { header: "SUMMARY", value: pr.summary }
73
72
  ]);
@@ -1,26 +1,25 @@
1
1
  import consola from 'consola';
2
- import { g as getClient } from '../shared/bee.CThuQMit.mjs';
3
- import 'backlog-js';
4
- import 'node:http';
5
- import 'open';
6
- import 'node:child_process';
7
2
  import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
8
3
  import 'node:stream/consumers';
9
4
  import 'valibot';
5
+ import '../shared/bee.BYqxm3yG.mjs';
10
6
  import { p as printTable } from '../shared/bee.IM3QELRf.mjs';
7
+ import { g as getClient } from '../shared/bee.BCBBmkOy.mjs';
8
+ import 'backlog-js';
9
+ import 'node:http';
10
+ import 'open';
11
+ import 'node:child_process';
11
12
  import { B as BeeCommand, E as ENV_AUTH, a as ENV_PROJECT } from '../shared/bee.CQ3kBgas.mjs';
12
- import { j as json, s as space } from '../shared/bee.DHTPkjMh.mjs';
13
- import '../shared/bee.XxOB1Her.mjs';
13
+ import { j as json, s as space } from '../shared/bee.B4OxR0DJ.mjs';
14
+ import '../shared/bee.Ds2l-nTJ.mjs';
14
15
  import '../shared/bee.CktwmH8R.mjs';
15
- import '../shared/bee.DVTuFf-T.mjs';
16
+ import '../shared/bee.riolf-_Y.mjs';
17
+ import 'commander';
18
+ import 'consola/utils';
16
19
  import 'node:fs';
17
20
  import 'node:path';
18
21
  import 'node:os';
19
22
  import '../shared/bee.BeQSH2t0.mjs';
20
- import '../shared/bee.-8tk76YJ.mjs';
21
- import '../shared/bee.Ds2l-nTJ.mjs';
22
- import 'commander';
23
- import 'consola/utils';
24
23
 
25
24
  const list = new BeeCommand("list").summary("List repositories in a project").description(`Repositories are listed in the configured display order.`).argument("<project>", "Project ID or project key").addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([
26
25
  { description: "List repositories in a project", command: "bee repo list PROJECT_KEY" },
@@ -1,26 +1,25 @@
1
1
  import consola from 'consola';
2
- import { g as getClient } from '../shared/bee.CThuQMit.mjs';
3
- import 'backlog-js';
4
- import 'node:http';
5
- import 'open';
6
- import 'node:child_process';
7
2
  import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
8
3
  import 'node:stream/consumers';
9
4
  import * as v from 'valibot';
5
+ import { p as parseArg, v as vInteger } from '../shared/bee.BYqxm3yG.mjs';
10
6
  import { p as printTable } from '../shared/bee.IM3QELRf.mjs';
7
+ import { g as getClient } from '../shared/bee.BCBBmkOy.mjs';
8
+ import 'backlog-js';
9
+ import 'node:http';
10
+ import 'open';
11
+ import 'node:child_process';
11
12
  import { B as BeeCommand, E as ENV_AUTH } from '../shared/bee.CQ3kBgas.mjs';
12
- import { j as json, o as order, e as offset, b as count, s as space } from '../shared/bee.DHTPkjMh.mjs';
13
- import '../shared/bee.XxOB1Her.mjs';
13
+ import { j as json, o as order, h as offset, f as count, s as space } from '../shared/bee.B4OxR0DJ.mjs';
14
+ import '../shared/bee.Ds2l-nTJ.mjs';
14
15
  import '../shared/bee.CktwmH8R.mjs';
15
- import '../shared/bee.DVTuFf-T.mjs';
16
+ import '../shared/bee.riolf-_Y.mjs';
17
+ import 'commander';
18
+ import 'consola/utils';
16
19
  import 'node:fs';
17
20
  import 'node:path';
18
21
  import 'node:os';
19
22
  import '../shared/bee.BeQSH2t0.mjs';
20
- import '../shared/bee.-8tk76YJ.mjs';
21
- import '../shared/bee.Ds2l-nTJ.mjs';
22
- import 'commander';
23
- import 'consola/utils';
24
23
 
25
24
  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([
26
25
  { description: "List all teams", command: "bee team list" },
@@ -28,9 +27,9 @@ const list = new BeeCommand("list").summary("List teams").description(`Teams are
28
27
  { description: "Output as JSON", command: "bee team list --json" }
29
28
  ]).action(async (opts) => {
30
29
  const { client } = await getClient(opts.space);
31
- const order = v.parse(v.optional(v.picklist(["asc", "desc"])), opts.order);
32
- const offset = v.parse(v.optional(v.pipe(v.string(), v.transform(Number))), opts.offset);
33
- const count = v.parse(v.optional(v.pipe(v.string(), v.transform(Number))), opts.count);
30
+ const order = parseArg(v.optional(v.picklist(["asc", "desc"])), opts.order, "--order");
31
+ const offset = parseArg(v.optional(vInteger), opts.offset, "--offset");
32
+ const count = parseArg(v.optional(vInteger), opts.count, "--count");
34
33
  const teams = await client.getTeams({ order, offset, count });
35
34
  outputResult(teams, opts, (data) => {
36
35
  if (data.length === 0) {
@@ -1,27 +1,26 @@
1
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.IM3QELRf.mjs';
2
7
  import { R as ROLE_LABELS } from '../shared/bee.BXiuAfjJ.mjs';
3
- import { g as getClient } from '../shared/bee.CThuQMit.mjs';
8
+ import { g as getClient } from '../shared/bee.BCBBmkOy.mjs';
4
9
  import 'backlog-js';
5
10
  import 'node:http';
6
11
  import 'open';
7
12
  import 'node:child_process';
8
- import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
9
- import 'node:stream/consumers';
10
- import 'valibot';
11
- import { p as printTable } from '../shared/bee.IM3QELRf.mjs';
12
13
  import { B as BeeCommand, E as ENV_AUTH } from '../shared/bee.CQ3kBgas.mjs';
13
- import { j as json, s as space } from '../shared/bee.DHTPkjMh.mjs';
14
- import '../shared/bee.XxOB1Her.mjs';
14
+ import { j as json, s as space } from '../shared/bee.B4OxR0DJ.mjs';
15
+ import '../shared/bee.Ds2l-nTJ.mjs';
15
16
  import '../shared/bee.CktwmH8R.mjs';
16
- import '../shared/bee.DVTuFf-T.mjs';
17
+ import '../shared/bee.riolf-_Y.mjs';
18
+ import 'commander';
19
+ import 'consola/utils';
17
20
  import 'node:fs';
18
21
  import 'node:path';
19
22
  import 'node:os';
20
23
  import '../shared/bee.BeQSH2t0.mjs';
21
- import '../shared/bee.-8tk76YJ.mjs';
22
- import '../shared/bee.Ds2l-nTJ.mjs';
23
- import 'commander';
24
- import 'consola/utils';
25
24
 
26
25
  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([
27
26
  { description: "List all users", command: "bee user list" },
@@ -1,26 +1,25 @@
1
1
  import consola from 'consola';
2
- import { g as getClient } from '../shared/bee.CThuQMit.mjs';
3
- import 'backlog-js';
4
- import 'node:http';
5
- import 'open';
6
- import 'node:child_process';
7
2
  import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
8
3
  import 'node:stream/consumers';
9
4
  import 'valibot';
5
+ import '../shared/bee.BYqxm3yG.mjs';
10
6
  import { p as printTable } from '../shared/bee.IM3QELRf.mjs';
7
+ import { g as getClient } from '../shared/bee.BCBBmkOy.mjs';
8
+ import 'backlog-js';
9
+ import 'node:http';
10
+ import 'open';
11
+ import 'node:child_process';
11
12
  import { B as BeeCommand, E as ENV_AUTH, a as ENV_PROJECT } from '../shared/bee.CQ3kBgas.mjs';
12
- import { k as keyword, j as json, s as space } from '../shared/bee.DHTPkjMh.mjs';
13
- import '../shared/bee.XxOB1Her.mjs';
13
+ import { k as keyword, j as json, s as space } from '../shared/bee.B4OxR0DJ.mjs';
14
+ import '../shared/bee.Ds2l-nTJ.mjs';
14
15
  import '../shared/bee.CktwmH8R.mjs';
15
- import '../shared/bee.DVTuFf-T.mjs';
16
+ import '../shared/bee.riolf-_Y.mjs';
17
+ import 'commander';
18
+ import 'consola/utils';
16
19
  import 'node:fs';
17
20
  import 'node:path';
18
21
  import 'node:os';
19
22
  import '../shared/bee.BeQSH2t0.mjs';
20
- import '../shared/bee.-8tk76YJ.mjs';
21
- import '../shared/bee.Ds2l-nTJ.mjs';
22
- import 'commander';
23
- import 'consola/utils';
24
23
 
25
24
  const list = new BeeCommand("list").summary("List wiki pages").description(`Use \`--keyword\` to filter pages by name or content.`).argument("<project>", "Project ID or project key").addOption(keyword()).addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([
26
25
  { description: "List all wiki pages in a project", command: "bee wiki list PROJECT" },
@@ -1,8 +1,8 @@
1
1
  import consola from 'consola';
2
- import { p as promptRequired, u as updateConfig } from '../shared/bee.DVTuFf-T.mjs';
2
+ import { s as space, a as promptRequired, u as updateConfig } from '../shared/bee.B4OxR0DJ.mjs';
3
3
  import { r as readStdin } from '../shared/bee.C--ZWPxf.mjs';
4
4
  import 'valibot';
5
- import { U as UserError } from '../shared/bee.XxOB1Her.mjs';
5
+ import { U as UserError } from '../shared/bee.BYqxm3yG.mjs';
6
6
  import { Backlog, OAuth2 } from 'backlog-js';
7
7
  import { e as exchangeAuthorizationCode } from '../shared/bee.CktwmH8R.mjs';
8
8
  import { createServer } from 'node:http';
@@ -14,12 +14,12 @@ import 'node:fs';
14
14
  import 'node:path';
15
15
  import 'node:os';
16
16
  import '../shared/bee.BeQSH2t0.mjs';
17
- import 'open';
18
17
  import 'commander';
18
+ import 'open';
19
19
  import 'consola/utils';
20
20
 
21
21
  const CALLBACK_TIMEOUT_MS = 3e5;
22
- const CALLBACK_PORT = 5033;
22
+ const DEFAULT_CALLBACK_PORT = 5033;
23
23
  const SUCCESS_HTML = `<!DOCTYPE html>
24
24
  <html><head><meta charset="utf-8"><title>Authentication Successful</title></head>
25
25
  <body style="font-family:system-ui;text-align:center;padding:2em">
@@ -36,11 +36,11 @@ const respondHtml = (res, html, statusCode = 200) => {
36
36
  res.writeHead(statusCode, { "Content-Type": "text/html" });
37
37
  res.end(html);
38
38
  };
39
- const startCallbackServer = () => {
39
+ const startCallbackServer = (port = DEFAULT_CALLBACK_PORT) => {
40
40
  let resolveCode = null;
41
41
  let rejectCode = null;
42
42
  const server = createServer((req, res) => {
43
- const url = new URL(req.url ?? "/", `http://localhost:${CALLBACK_PORT}`);
43
+ const url = new URL(req.url ?? "/", `http://localhost:${actualPort}`);
44
44
  if (url.pathname !== "/callback") {
45
45
  res.writeHead(404);
46
46
  res.end("Not Found");
@@ -62,9 +62,10 @@ const startCallbackServer = () => {
62
62
  resolveCode?.({ code, state });
63
63
  respondHtml(res, SUCCESS_HTML);
64
64
  });
65
- server.listen(CALLBACK_PORT);
65
+ server.listen(port);
66
+ const actualPort = server.address().port;
66
67
  return {
67
- port: CALLBACK_PORT,
68
+ port: actualPort,
68
69
  waitForCallback(expectedState) {
69
70
  return new Promise((resolve, reject) => {
70
71
  const timeout = setTimeout(() => {
@@ -96,13 +97,10 @@ const login = new BeeCommand("login").summary("Authenticate with a Backlog space
96
97
 
97
98
  Use \`--with-token\` to pass an API key on standard input.
98
99
  Use \`--method oauth\` for OAuth authentication via the browser.`
99
- ).option("-m, --method <method>", "The authentication method to use", "api-key").option("--with-token", "Read token from standard input").option("--client-id <id>", "The OAuth Client ID to use when authenticating with Backlog").option(
100
- "--client-secret <secret>",
101
- "The OAuth Client Secret to use when authenticating with Backlog"
102
- ).envVars([
103
- ["BACKLOG_SPACE", "Default space hostname"],
100
+ ).addOption(space()).option("-m, --method <method>", "The authentication method to use", "api-key").option("--with-token", "Read token from standard input").envVars([
104
101
  ["BACKLOG_OAUTH_CLIENT_ID", "OAuth Client ID"],
105
- ["BACKLOG_OAUTH_CLIENT_SECRET", "OAuth Client Secret"]
102
+ ["BACKLOG_OAUTH_CLIENT_SECRET", "OAuth Client Secret"],
103
+ ["BACKLOG_OAUTH_PORT", "OAuth callback port (default: 5033)"]
106
104
  ]).examples([
107
105
  { description: "Start interactive setup", command: "bee auth login" },
108
106
  {
@@ -115,10 +113,10 @@ Use \`--method oauth\` for OAuth authentication via the browser.`
115
113
  if (method !== "api-key" && method !== "oauth") {
116
114
  throw new UserError('Invalid auth method. Use "api-key" or "oauth".');
117
115
  }
118
- const hostname = await promptRequired("Backlog space hostname:", process.env.BACKLOG_SPACE, {
116
+ const hostname = await promptRequired("Backlog space hostname:", opts.space, {
119
117
  placeholder: "xxx.backlog.com"
120
118
  });
121
- await (method === "api-key" ? loginWithApiKey(hostname, opts) : loginWithOAuth(hostname, opts));
119
+ await (method === "api-key" ? loginWithApiKey(hostname, opts) : loginWithOAuth(hostname));
122
120
  });
123
121
  const loginWithApiKey = async (hostname, opts) => {
124
122
  if (!opts.withToken) {
@@ -138,16 +136,19 @@ const loginWithApiKey = async (hostname, opts) => {
138
136
  saveSpace(hostname, { method: "api-key", apiKey });
139
137
  consola.success(`Logged in to ${hostname} as ${user.name} (${user.userId})`);
140
138
  };
141
- const loginWithOAuth = async (hostname, opts) => {
142
- const clientId = await promptRequired(
143
- "OAuth Client ID:",
144
- opts.clientId ?? process.env.BACKLOG_OAUTH_CLIENT_ID
145
- );
146
- const clientSecret = await promptRequired(
147
- "OAuth Client Secret:",
148
- opts.clientSecret ?? process.env.BACKLOG_OAUTH_CLIENT_SECRET
149
- );
150
- const callbackServer = startCallbackServer();
139
+ const loginWithOAuth = async (hostname) => {
140
+ const clientId = process.env.BACKLOG_OAUTH_CLIENT_ID;
141
+ const clientSecret = process.env.BACKLOG_OAUTH_CLIENT_SECRET;
142
+ if (!clientId || !clientSecret) {
143
+ throw new UserError(
144
+ "BACKLOG_OAUTH_CLIENT_ID and BACKLOG_OAUTH_CLIENT_SECRET must be set as environment variables."
145
+ );
146
+ }
147
+ const port = process.env.BACKLOG_OAUTH_PORT ? Number(process.env.BACKLOG_OAUTH_PORT) : void 0;
148
+ if (port !== void 0 && (!Number.isInteger(port) || port < 0 || port > 65535)) {
149
+ throw new UserError("BACKLOG_OAUTH_PORT must be an integer between 0 and 65535.");
150
+ }
151
+ const callbackServer = startCallbackServer(port);
151
152
  const redirectUri = `http://localhost:${callbackServer.port}/callback`;
152
153
  const state = crypto.randomUUID();
153
154
  const oauth2 = new OAuth2({ clientId, clientSecret });
@@ -1,11 +1,10 @@
1
1
  import consola from 'consola';
2
- import { U as UserError } from '../shared/bee.XxOB1Her.mjs';
2
+ import { U as UserError } from '../shared/bee.BYqxm3yG.mjs';
3
3
  import 'node:stream/consumers';
4
4
  import 'valibot';
5
- import { l as loadConfig } from '../shared/bee.DVTuFf-T.mjs';
6
- import { r as removeSpace } from '../shared/bee.-8tk76YJ.mjs';
5
+ import { s as space, l as loadConfig } from '../shared/bee.B4OxR0DJ.mjs';
6
+ import { r as removeSpace } from '../shared/bee.riolf-_Y.mjs';
7
7
  import { B as BeeCommand } from '../shared/bee.CQ3kBgas.mjs';
8
- import { s as space } from '../shared/bee.DHTPkjMh.mjs';
9
8
  import 'node:fs';
10
9
  import 'node:path';
11
10
  import 'node:os';