@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,28 +1,27 @@
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 { f as documentUrl, o as openOrPrintUrl } from '../shared/bee.CzKcWSES.mjs';
6
- import 'node:child_process';
7
2
  import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
8
- import { U as UserError } from '../shared/bee.XxOB1Her.mjs';
3
+ import { U as UserError } from '../shared/bee.BYqxm3yG.mjs';
9
4
  import 'node:stream/consumers';
10
5
  import 'valibot';
11
6
  import { f as formatDate } from '../shared/bee.n5MYN4a6.mjs';
12
7
  import { p as printDefinitionList } from '../shared/bee.D6yQ6Pqf.mjs';
8
+ import { g as getClient } from '../shared/bee.BCBBmkOy.mjs';
9
+ import 'backlog-js';
10
+ import 'node:http';
11
+ import { f as documentUrl, o as openOrPrintUrl } from '../shared/bee.CzKcWSES.mjs';
12
+ import 'node:child_process';
13
13
  import { B as BeeCommand, E as ENV_AUTH, a as ENV_PROJECT } from '../shared/bee.CQ3kBgas.mjs';
14
- import { w as web, n as noBrowser, j as json, s as space } from '../shared/bee.DHTPkjMh.mjs';
14
+ import { w as web, n as noBrowser, 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 'open';
19
+ import 'commander';
20
+ import 'consola/utils';
17
21
  import 'node:fs';
18
22
  import 'node:path';
19
23
  import 'node:os';
20
24
  import '../shared/bee.BeQSH2t0.mjs';
21
- import '../shared/bee.-8tk76YJ.mjs';
22
- import 'open';
23
- import '../shared/bee.Ds2l-nTJ.mjs';
24
- import 'commander';
25
- import 'consola/utils';
26
25
 
27
26
  const view = new BeeCommand("view").summary("View a document").description(`Use \`--web\` to open in the browser (\`--project\` is required for \`--web\`).`).argument("<document>", "Document ID").option("-p, --project <id>", "Project ID or project key (required for --web)").addOption(web("document")).addOption(noBrowser()).addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([
28
27
  { description: "View document details", command: "bee document view 12345" },
@@ -1,28 +1,27 @@
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 { h as pullRequestUrl, o as openOrPrintUrl } from '../shared/bee.CzKcWSES.mjs';
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 { 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 printDefinitionList } from '../shared/bee.D6yQ6Pqf.mjs';
8
+ import { g as getClient } from '../shared/bee.BCBBmkOy.mjs';
9
+ import 'backlog-js';
10
+ import 'node:http';
11
+ import { h as pullRequestUrl, o as openOrPrintUrl } from '../shared/bee.CzKcWSES.mjs';
12
+ import 'node:child_process';
12
13
  import { B as BeeCommand, E as ENV_AUTH, a as ENV_PROJECT, b as ENV_REPO } from '../shared/bee.CQ3kBgas.mjs';
13
- import { p as project, q as repo, w as web, n as noBrowser, j as json, s as space, r as resolveOptions } from '../shared/bee.DHTPkjMh.mjs';
14
- import '../shared/bee.XxOB1Her.mjs';
14
+ import { p as project, B as repo, w as web, n as noBrowser, j as json, s as space, r as resolveOptions } 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 'open';
19
+ import 'commander';
20
+ import 'consola/utils';
17
21
  import 'node:fs';
18
22
  import 'node:path';
19
23
  import 'node:os';
20
24
  import '../shared/bee.BeQSH2t0.mjs';
21
- import '../shared/bee.-8tk76YJ.mjs';
22
- import 'open';
23
- import '../shared/bee.Ds2l-nTJ.mjs';
24
- import 'commander';
25
- import 'consola/utils';
26
25
 
27
26
  const view = new BeeCommand("view").summary("View a pull request").description(`Use \`--web\` to open in the browser.`).argument("<number>", "Pull request number").addOption(project()).addOption(repo()).addOption(web("pull request")).addOption(noBrowser()).addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT, ENV_REPO]).examples([
28
27
  { description: "View pull request details", command: "bee pr view 42 -p PROJECT -R repo" },
@@ -34,7 +33,7 @@ const view = new BeeCommand("view").summary("View a pull request").description(`
34
33
  ]).action(async (number, opts, cmd) => {
35
34
  await resolveOptions(cmd);
36
35
  const { client, host } = await getClient(opts.space);
37
- const prNumber = Number(number);
36
+ const prNumber = parseArg(vInteger, number, "number");
38
37
  if (opts.web || opts.browser === false) {
39
38
  const url = pullRequestUrl(host, opts.project, opts.repo, prNumber);
40
39
  await openOrPrintUrl(url, opts.browser === false, consola);
@@ -1,28 +1,27 @@
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 { r as repositoryUrl, o as openOrPrintUrl } from '../shared/bee.CzKcWSES.mjs';
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 { f as formatDate } from '../shared/bee.n5MYN4a6.mjs';
11
7
  import { p as printDefinitionList } from '../shared/bee.D6yQ6Pqf.mjs';
8
+ import { g as getClient } from '../shared/bee.BCBBmkOy.mjs';
9
+ import 'backlog-js';
10
+ import 'node:http';
11
+ import { r as repositoryUrl, o as openOrPrintUrl } from '../shared/bee.CzKcWSES.mjs';
12
+ import 'node:child_process';
12
13
  import { B as BeeCommand, E as ENV_AUTH, a as ENV_PROJECT } from '../shared/bee.CQ3kBgas.mjs';
13
- import { p as project, w as web, n as noBrowser, j as json, s as space, r as resolveOptions } from '../shared/bee.DHTPkjMh.mjs';
14
- import '../shared/bee.XxOB1Her.mjs';
14
+ import { p as project, w as web, n as noBrowser, j as json, s as space, r as resolveOptions } 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 'open';
19
+ import 'commander';
20
+ import 'consola/utils';
17
21
  import 'node:fs';
18
22
  import 'node:path';
19
23
  import 'node:os';
20
24
  import '../shared/bee.BeQSH2t0.mjs';
21
- import '../shared/bee.-8tk76YJ.mjs';
22
- import 'open';
23
- import '../shared/bee.Ds2l-nTJ.mjs';
24
- import 'commander';
25
- import 'consola/utils';
26
25
 
27
26
  const view = new BeeCommand("view").summary("View a repository").description(`Use \`--web\` to open in the browser.`).argument("<repository>", "Repository name or ID").addOption(project()).addOption(web("repository")).addOption(noBrowser()).addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([
28
27
  {
@@ -1,33 +1,32 @@
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 { p as parseArg, v as vInteger } from '../shared/bee.BYqxm3yG.mjs';
10
6
  import { p as printDefinitionList } from '../shared/bee.D6yQ6Pqf.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 view = new BeeCommand("view").summary("View a team").description(`Shows team details and the list of members.`).argument("<team>", "Team ID").addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([
26
25
  { description: "View team details", command: "bee team view 12345" },
27
26
  { description: "Output as JSON", command: "bee team view 12345 --json" }
28
27
  ]).action(async (team, opts) => {
29
28
  const { client } = await getClient(opts.space);
30
- const t = await client.getTeam(Number(team));
29
+ const t = await client.getTeam(parseArg(vInteger, team, "team"));
31
30
  outputResult(t, opts, (data) => {
32
31
  consola.log("");
33
32
  consola.log(` ${data.name}`);
@@ -1,35 +1,34 @@
1
1
  import consola from 'consola';
2
- import { R as ROLE_LABELS } from '../shared/bee.BXiuAfjJ.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';
8
2
  import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
9
3
  import 'node:stream/consumers';
10
4
  import 'valibot';
5
+ import { p as parseArg, v as vInteger } from '../shared/bee.BYqxm3yG.mjs';
11
6
  import { f as formatDate } from '../shared/bee.n5MYN4a6.mjs';
12
7
  import { p as printDefinitionList } from '../shared/bee.D6yQ6Pqf.mjs';
8
+ import { R as ROLE_LABELS } from '../shared/bee.BXiuAfjJ.mjs';
9
+ import { g as getClient } from '../shared/bee.BCBBmkOy.mjs';
10
+ import 'backlog-js';
11
+ import 'node:http';
12
+ import 'open';
13
+ import 'node:child_process';
13
14
  import { B as BeeCommand, E as ENV_AUTH } from '../shared/bee.CQ3kBgas.mjs';
14
- import { j as json, s as space } from '../shared/bee.DHTPkjMh.mjs';
15
- import '../shared/bee.XxOB1Her.mjs';
15
+ import { j as json, s as space } 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 view = new BeeCommand("view").summary("View a user").description(`Use \`bee user me\` as a shortcut to view your own profile.`).argument("<user>", "User ID").addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([
28
27
  { description: "View user details", command: "bee user view 12345" },
29
28
  { description: "Output as JSON", command: "bee user view 12345 --json" }
30
29
  ]).action(async (user, opts) => {
31
30
  const { client } = await getClient(opts.space);
32
- const userData = await client.getUser(Number(user));
31
+ const userData = await client.getUser(parseArg(vInteger, user, "user"));
33
32
  outputResult(userData, opts, (data) => {
34
33
  consola.log("");
35
34
  consola.log(` ${data.name}`);
@@ -1,28 +1,27 @@
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 { o as openOrPrintUrl, w as wikiUrl } from '../shared/bee.CzKcWSES.mjs';
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 { 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 printDefinitionList } from '../shared/bee.D6yQ6Pqf.mjs';
8
+ import { g as getClient } from '../shared/bee.BCBBmkOy.mjs';
9
+ import 'backlog-js';
10
+ import 'node:http';
11
+ import { w as wikiUrl, o as openOrPrintUrl } from '../shared/bee.CzKcWSES.mjs';
12
+ import 'node:child_process';
12
13
  import { B as BeeCommand, E as ENV_AUTH } from '../shared/bee.CQ3kBgas.mjs';
13
- import { w as web, n as noBrowser, j as json, s as space } from '../shared/bee.DHTPkjMh.mjs';
14
- import '../shared/bee.XxOB1Her.mjs';
14
+ import { w as web, n as noBrowser, 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 'open';
19
+ import 'commander';
20
+ import 'consola/utils';
17
21
  import 'node:fs';
18
22
  import 'node:path';
19
23
  import 'node:os';
20
24
  import '../shared/bee.BeQSH2t0.mjs';
21
- import '../shared/bee.-8tk76YJ.mjs';
22
- import 'open';
23
- import '../shared/bee.Ds2l-nTJ.mjs';
24
- import 'commander';
25
- import 'consola/utils';
26
25
 
27
26
  const view = new BeeCommand("view").summary("View a wiki page").description(`Use \`--web\` to open in the browser.`).argument("<wiki>", "Wiki page ID").addOption(web("wiki page")).addOption(noBrowser()).addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([
28
27
  { description: "View a wiki page", command: "bee wiki view 12345" },
@@ -31,11 +30,11 @@ const view = new BeeCommand("view").summary("View a wiki page").description(`Use
31
30
  ]).action(async (wiki, opts) => {
32
31
  const { client, host } = await getClient(opts.space);
33
32
  if (opts.web || opts.browser === false) {
34
- const url = wikiUrl(host, Number(wiki));
33
+ const url = wikiUrl(host, parseArg(vInteger, wiki, "wiki"));
35
34
  await openOrPrintUrl(url, opts.browser === false, consola);
36
35
  return;
37
36
  }
38
- const wikiData = await client.getWiki(Number(wiki));
37
+ const wikiData = await client.getWiki(parseArg(vInteger, wiki, "wiki"));
39
38
  outputResult(wikiData, opts, (data) => {
40
39
  consola.log("");
41
40
  consola.log(` ${data.name}`);
@@ -1,34 +1,33 @@
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 { 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 printDefinitionList } from '../shared/bee.D6yQ6Pqf.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 { 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 view = new BeeCommand("view").summary("View a watching item").description(`Shows the associated issue, note, read status, and timestamps.`).argument("<watching>", "Watching ID").addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([
27
26
  { description: "View a watching item", command: "bee watching view 12345" },
28
27
  { description: "Output as JSON", command: "bee watching view 12345 --json" }
29
28
  ]).action(async (watching, opts) => {
30
29
  const { client } = await getClient(opts.space);
31
- const watchingData = await client.getWatchingListItem(Number(watching));
30
+ const watchingData = await client.getWatchingListItem(parseArg(vInteger, watching, "watching"));
32
31
  outputResult(watchingData, opts, (data) => {
33
32
  consola.log("");
34
33
  consola.log(` ${data.issue.issueKey}: ${data.issue.summary}`);
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
+ import consola, { LogLevels } from 'consola';
1
2
  import { B as BeeCommand } from './shared/bee.CQ3kBgas.mjs';
2
3
  import { CommanderError } from 'commander';
3
- import consola, { LogLevels } from 'consola';
4
- import { U as UserError } from './shared/bee.XxOB1Her.mjs';
4
+ import { U as UserError } from './shared/bee.BYqxm3yG.mjs';
5
5
  import 'node:stream/consumers';
6
6
  import { ValiError, flatten } from 'valibot';
7
7
  import 'backlog-js';
@@ -114,12 +114,13 @@ const handleError = (error) => {
114
114
  process.exit(1);
115
115
  };
116
116
 
117
- const version = "1.0.0-rc.0";
117
+ const version = "1.0.0-rc.2";
118
118
  const description = "Bring Backlog to your command line";
119
119
  const pkg = {
120
120
  version: version,
121
121
  description: description};
122
122
 
123
+ consola.options.formatOptions.date = false;
123
124
  const program = new BeeCommand("bee").version(pkg.version).description(pkg.description);
124
125
  await program.addCommands([
125
126
  import('./chunks/index.mjs'),
@@ -1,11 +1,12 @@
1
1
  import consola from 'consola';
2
- import { U as UserError } from './bee.XxOB1Her.mjs';
2
+ import { U as UserError, p as parseArg, v as vInteger } from './bee.BYqxm3yG.mjs';
3
3
  import 'node:stream/consumers';
4
4
  import * as v from 'valibot';
5
5
  import { existsSync, readFileSync, writeFileSync } from 'node:fs';
6
6
  import { resolve } from 'node:path';
7
7
  import { homedir } from 'node:os';
8
8
  import { R as RcSchema } from './bee.BeQSH2t0.mjs';
9
+ import { Option } from 'commander';
9
10
 
10
11
  const promptRequired = async (label, existing, options) => {
11
12
  if (existing !== void 0) {
@@ -273,4 +274,51 @@ const updateConfig = (updater) => {
273
274
  return updated;
274
275
  };
275
276
 
276
- export { confirmOrExit as c, loadConfig as l, promptRequired as p, updateConfig as u, writeConfig as w };
277
+ class RequiredOption extends Option {
278
+ promptLabel;
279
+ constructor(flags, description, promptLabel) {
280
+ super(flags, `${description} (required)`);
281
+ this.promptLabel = promptLabel ?? description;
282
+ }
283
+ }
284
+ const resolveOptions = async (cmd) => {
285
+ const opts = cmd.opts();
286
+ for (const opt of cmd.options) {
287
+ if (opt instanceof RequiredOption) {
288
+ const key = opt.attributeName();
289
+ opts[key] = await promptRequired(`${opt.promptLabel}:`, opts[key]);
290
+ }
291
+ }
292
+ };
293
+
294
+ const collect = (val, prev) => [...prev, val];
295
+ const collectNum = (val, prev) => [
296
+ ...prev,
297
+ parseArg(vInteger, val, "value")
298
+ ];
299
+ const project = () => new RequiredOption("-p, --project <id>", "Project ID or project key").env("BACKLOG_PROJECT");
300
+ const repo = () => new RequiredOption("-R, --repo <name>", "Repository name or ID").env("BACKLOG_REPO");
301
+ const count = () => new Option("-L, --count <n>", "Number of results (default: 20)");
302
+ const offset = () => new Option("--offset <n>", "Offset for pagination");
303
+ const order = () => new Option("--order <dir>", "Sort order").choices(["asc", "desc"]);
304
+ const minId = () => new Option("--min-id <n>", "Minimum ID for cursor-based pagination");
305
+ const maxId = () => new Option("--max-id <n>", "Maximum ID for cursor-based pagination");
306
+ const keyword = () => new Option("-k, --keyword <text>", "Keyword search");
307
+ const assignee = () => new Option("-a, --assignee <id>", "Assignee user ID. Use @me for yourself.");
308
+ const assigneeList = () => new Option("-a, --assignee <id>", "Assignee user ID (repeatable). Use @me for yourself.").argParser(collect).default([]);
309
+ const issue = () => new Option("--issue <key>", "Issue ID or issue key");
310
+ const notify = () => new Option("--notify <id>", "User IDs to notify (repeatable)").argParser(collectNum).default([]);
311
+ const attachment = () => new Option("--attachment <id>", "Attachment IDs (repeatable)").argParser(collectNum).default([]);
312
+ const category = () => new Option("--category <id>", "Category IDs (repeatable)").argParser(collectNum).default([]);
313
+ const version = () => new Option("--version <id>", "Version IDs (repeatable)").argParser(collectNum).default([]);
314
+ const milestone = () => new Option("--milestone <id>", "Milestone IDs (repeatable)").argParser(collectNum).default([]);
315
+ const comment = () => new Option("-c, --comment <text>", "Comment to add with the update");
316
+ const web = (resource) => new Option("-w, --web", `Open the ${resource} in the browser`);
317
+ const noBrowser = () => new Option("-n, --no-browser", "Print the URL instead of opening the browser");
318
+ const space = () => new Option("-s, --space <hostname>", "Space hostname").env("BACKLOG_SPACE");
319
+ const json = () => new Option(
320
+ "--json [fields]",
321
+ "Output as JSON (optionally filter by field names, comma-separated)"
322
+ ).preset("");
323
+
324
+ export { maxId as A, repo as B, issue as C, RequiredOption as R, promptRequired as a, writeConfig as b, collect as c, confirmOrExit as d, collectNum as e, count as f, assigneeList as g, offset as h, assignee as i, json as j, keyword as k, loadConfig as l, category as m, noBrowser as n, order as o, project as p, milestone as q, resolveOptions as r, space as s, notify as t, updateConfig as u, version as v, web as w, attachment as x, comment as y, minId as z };
@@ -1,11 +1,11 @@
1
1
  import consola from 'consola';
2
- import { U as UserError } from './bee.XxOB1Her.mjs';
2
+ import { U as UserError, a as vFiniteNumber } from './bee.BYqxm3yG.mjs';
3
3
  import 'node:stream/consumers';
4
- import 'valibot';
4
+ import * as v from 'valibot';
5
5
  import { Backlog } from 'backlog-js';
6
6
  import { r as refreshAccessToken } from './bee.CktwmH8R.mjs';
7
- import { l as loadConfig } from './bee.DVTuFf-T.mjs';
8
- import { f as findSpace, u as updateSpaceAuth } from './bee.-8tk76YJ.mjs';
7
+ import { l as loadConfig } from './bee.B4OxR0DJ.mjs';
8
+ import { f as findSpace, u as updateSpaceAuth } from './bee.riolf-_Y.mjs';
9
9
 
10
10
  const formatResetTime = (epochSeconds) => {
11
11
  const date = new Date(epochSeconds * 1e3);
@@ -116,7 +116,8 @@ const isBacklogRateLimitError = (error) => error instanceof Error && error._name
116
116
  const handleRateLimitError = (error) => {
117
117
  if (isBacklogRateLimitError(error)) {
118
118
  const resetEpoch = error._response.headers.get("X-RateLimit-Reset");
119
- const resetMessage = resetEpoch ? `Rate limit resets at ${formatResetTime(Number(resetEpoch))}.` : "Please wait and try again later.";
119
+ const resetTime = resetEpoch ? v.safeParse(vFiniteNumber, resetEpoch) : void 0;
120
+ const resetMessage = resetTime?.success ? `Rate limit resets at ${formatResetTime(resetTime.output)}.` : "Please wait and try again later.";
120
121
  throw new UserError(`API rate limit exceeded. ${resetMessage}`);
121
122
  }
122
123
  };
@@ -0,0 +1,24 @@
1
+ import * as v from 'valibot';
2
+ import consola from 'consola';
3
+
4
+ class UserError extends Error {
5
+ constructor(message) {
6
+ super(message);
7
+ this.name = "UserError";
8
+ }
9
+ }
10
+
11
+ const vFiniteNumber = v.pipe(v.string(), v.transform(Number), v.number(), v.finite());
12
+ const vInteger = v.pipe(v.string(), v.transform(Number), v.number(), v.integer());
13
+ const parseArg = (schema, value, label) => {
14
+ const result = v.safeParse(schema, value);
15
+ if (result.success) {
16
+ return result.output;
17
+ }
18
+ const reason = result.issues[0]?.message;
19
+ const message = reason ? `Invalid value for "${label}": "${value}" \u2014 ${reason}` : `Invalid value for "${label}": "${value}"`;
20
+ consola.debug("parseArg validation issues:", result.issues);
21
+ throw new UserError(message);
22
+ };
23
+
24
+ export { UserError as U, vFiniteNumber as a, parseArg as p, vInteger as v };
@@ -0,0 +1,14 @@
1
+ import 'consola';
2
+ import 'node:stream/consumers';
3
+ import 'valibot';
4
+ import { p as parseArg, v as vInteger } from './bee.BYqxm3yG.mjs';
5
+
6
+ const resolveUserId = async (client, value) => {
7
+ if (value === "@me") {
8
+ const me = await client.getMyself();
9
+ return me.id;
10
+ }
11
+ return parseArg(vInteger, value, "user");
12
+ };
13
+
14
+ export { resolveUserId as r };
@@ -1,12 +1,17 @@
1
+ import 'consola';
2
+ import 'node:stream/consumers';
3
+ import * as v from 'valibot';
4
+ import { v as vInteger } from './bee.BYqxm3yG.mjs';
5
+
1
6
  const resolveProjectIds = async (client, values) => {
2
7
  if (values.length === 0) {
3
8
  return [];
4
9
  }
5
10
  const projects = await client.getProjects();
6
11
  return values.map((value) => {
7
- const asNumber = Number(value);
8
- if (!Number.isNaN(asNumber)) {
9
- const byId = projects.find((p) => p.id === asNumber);
12
+ const numResult = v.safeParse(vInteger, value);
13
+ if (numResult.success) {
14
+ const byId = projects.find((p) => p.id === numResult.output);
10
15
  if (byId) {
11
16
  return byId.id;
12
17
  }
@@ -1,4 +1,4 @@
1
- import { u as updateConfig } from './bee.DVTuFf-T.mjs';
1
+ import { u as updateConfig } from './bee.B4OxR0DJ.mjs';
2
2
 
3
3
  const removeSpace = (host) => {
4
4
  updateConfig((config) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nulab/bee",
3
- "version": "1.0.0-rc.0",
3
+ "version": "1.0.0-rc.2",
4
4
  "description": "Bring Backlog to your command line",
5
5
  "keywords": [
6
6
  "backlog",
@@ -37,18 +37,17 @@
37
37
  "typecheck": "tsc --noEmit"
38
38
  },
39
39
  "dependencies": {
40
- "@repo/backlog-utils": "workspace:*",
41
- "@repo/cli-utils": "workspace:*",
42
- "@repo/config": "workspace:*",
43
40
  "backlog-js": "^0.16.0",
44
41
  "commander": "^14.0.3",
45
42
  "consola": "^3.4.2",
46
43
  "is-unicode-supported": "^2.1.0",
47
44
  "open": "^11.0.0",
48
- "ufo": "^1.5.4",
49
45
  "valibot": "^1.2.0"
50
46
  },
51
47
  "devDependencies": {
48
+ "@repo/backlog-utils": "workspace:*",
49
+ "@repo/cli-utils": "workspace:*",
50
+ "@repo/config": "workspace:*",
52
51
  "@repo/test-utils": "workspace:*",
53
52
  "@repo/tsconfigs": "workspace:*",
54
53
  "tsx": "^4.19.0",
@@ -1,9 +0,0 @@
1
- const resolveUserId = async (client, value) => {
2
- if (value === "@me") {
3
- const me = await client.getMyself();
4
- return me.id;
5
- }
6
- return Number(value);
7
- };
8
-
9
- export { resolveUserId as r };
@@ -1,48 +0,0 @@
1
- import { Option } from 'commander';
2
- import { p as promptRequired } from './bee.DVTuFf-T.mjs';
3
- import 'node:stream/consumers';
4
- import 'valibot';
5
- import 'consola';
6
-
7
- class RequiredOption extends Option {
8
- promptLabel;
9
- constructor(flags, description, promptLabel) {
10
- super(flags, `${description} (required)`);
11
- this.promptLabel = promptLabel ?? description;
12
- }
13
- }
14
- const resolveOptions = async (cmd) => {
15
- const opts = cmd.opts();
16
- for (const opt of cmd.options) {
17
- if (opt instanceof RequiredOption) {
18
- const key = opt.attributeName();
19
- opts[key] = await promptRequired(`${opt.promptLabel}:`, opts[key]);
20
- }
21
- }
22
- };
23
-
24
- const collect = (val, prev) => [...prev, val];
25
- const collectNum = (val, prev) => [...prev, Number(val)];
26
- const project = () => new RequiredOption("-p, --project <id>", "Project ID or project key").env("BACKLOG_PROJECT");
27
- const repo = () => new RequiredOption("-R, --repo <name>", "Repository name or ID").env("BACKLOG_REPO");
28
- const count = () => new Option("-L, --count <n>", "Number of results (default: 20)");
29
- const offset = () => new Option("--offset <n>", "Offset for pagination");
30
- const order = () => new Option("--order <dir>", "Sort order").choices(["asc", "desc"]);
31
- const minId = () => new Option("--min-id <n>", "Minimum ID for cursor-based pagination");
32
- const maxId = () => new Option("--max-id <n>", "Maximum ID for cursor-based pagination");
33
- const keyword = () => new Option("-k, --keyword <text>", "Keyword search");
34
- const assignee = () => new Option("-a, --assignee <id>", "Assignee user ID. Use @me for yourself.");
35
- const assigneeList = () => new Option("-a, --assignee <id>", "Assignee user ID (repeatable). Use @me for yourself.").argParser(collect).default([]);
36
- const issue = () => new Option("--issue <key>", "Issue ID or issue key");
37
- const notify = () => new Option("--notify <id>", "User IDs to notify (repeatable)").argParser(collectNum).default([]);
38
- const attachment = () => new Option("--attachment <id>", "Attachment 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").env("BACKLOG_SPACE");
43
- const json = () => new Option(
44
- "--json [fields]",
45
- "Output as JSON (optionally filter by field names, comma-separated)"
46
- ).preset("");
47
-
48
- export { RequiredOption as R, collectNum as a, count as b, collect as c, assigneeList as d, offset as e, assignee as f, notify as g, attachment as h, comment as i, json as j, keyword as k, maxId as l, minId as m, noBrowser as n, order as o, project as p, repo as q, resolveOptions as r, space as s, issue as t, web as w };
@@ -1,8 +0,0 @@
1
- class UserError extends Error {
2
- constructor(message) {
3
- super(message);
4
- this.name = "UserError";
5
- }
6
- }
7
-
8
- export { UserError as U };