@nulab/bee 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activities-BPTHt_MD.mjs +69 -0
- package/dist/activities-CRiEq51-.mjs +72 -0
- package/dist/activities-DyOMqdsM.mjs +69 -0
- package/dist/activity-labels-CLFpxp8o.mjs +34 -0
- package/dist/add-Br-_TLRp.mjs +55 -0
- package/dist/add-CTmmy2t9.mjs +26 -0
- package/dist/add-user-BVWFcbH7.mjs +26 -0
- package/dist/api-DhA8avDD.mjs +134 -0
- package/dist/attachments-CnL8t9tK.mjs +50 -0
- package/dist/attachments-D8IoJjYE.mjs +50 -0
- package/dist/attachments-DfgEkAY2.mjs +46 -0
- package/dist/auth-5TJGBPxi.mjs +13 -0
- package/dist/bee-command-v0qvZeth.mjs +57 -0
- package/dist/browse-vgF6nz7X.mjs +304 -0
- package/dist/category-BZ7XdVgx.mjs +11 -0
- package/dist/clone-DAWVtVbZ.mjs +43 -0
- package/dist/close-cTyZPv77.mjs +37 -0
- package/dist/comment-CkYJYFrF.mjs +115 -0
- package/dist/comment-DzRBQNv8.mjs +102 -0
- package/dist/comments-SnOZ-EUJ.mjs +47 -0
- package/dist/common-options-BuYWxYdO.mjs +45 -0
- package/dist/completion-yX2VOQSl.mjs +113 -0
- package/dist/count-BI7ld4k5.mjs +50 -0
- package/dist/count-Bw0mVlxC.mjs +40 -0
- package/dist/count-CH_LN4k6.mjs +51 -0
- package/dist/count-CHzDiMV3.mjs +25 -0
- package/dist/count-DvmYzPD_.mjs +46 -0
- package/dist/create-BHjwacOk.mjs +47 -0
- package/dist/create-BXWATibN.mjs +41 -0
- package/dist/create-BtLVFmbR.mjs +29 -0
- package/dist/create-CoF2bahH.mjs +29 -0
- package/dist/create-DhAOhro9.mjs +60 -0
- package/dist/create-DtMLv7Wq.mjs +26 -0
- package/dist/create-PtahSFdG.mjs +66 -0
- package/dist/create-Y4vo2zwX.mjs +44 -0
- package/dist/create-vwRKZ3Lm.mjs +31 -0
- package/dist/dashboard-CYYU5Yii.mjs +97 -0
- package/dist/delete-BCAPHs-g.mjs +25 -0
- package/dist/delete-BHNt5SWa.mjs +24 -0
- package/dist/delete-BlmanW0H.mjs +25 -0
- package/dist/delete-Bxk14ntp.mjs +24 -0
- package/dist/delete-C05oMZEW.mjs +24 -0
- package/dist/delete-CMwkcSiA.mjs +25 -0
- package/dist/delete-CTeH7nzL.mjs +29 -0
- package/dist/delete-D2yDBhZc.mjs +24 -0
- package/dist/delete-HMOfvtv3.mjs +25 -0
- package/dist/document-vTiqLew9.mjs +14 -0
- package/dist/edit-BBvSbt0m.mjs +22 -0
- package/dist/edit-BfCZ2Abi.mjs +50 -0
- package/dist/edit-CN1gdpjd.mjs +37 -0
- package/dist/edit-C_KbKopB.mjs +36 -0
- package/dist/edit-D5Z45NVj.mjs +27 -0
- package/dist/edit-DKQw-XXP.mjs +27 -0
- package/dist/edit-DRxr4r-r.mjs +60 -0
- package/dist/edit-DxsP-aPX.mjs +43 -0
- package/dist/edit-Otc7XHU7.mjs +52 -0
- package/dist/file-DwPTUKOI.mjs +17 -0
- package/dist/format-DHAR0n3J.mjs +9 -0
- package/dist/history-DpjqxFkX.mjs +55 -0
- package/dist/index.mjs +33 -37918
- package/dist/issue-BRzJy3k1.mjs +18 -0
- package/dist/issue-type-Byzh4yLx.mjs +11 -0
- package/dist/list-B3A5SDEm.mjs +35 -0
- package/dist/list-BMKaJoe_.mjs +64 -0
- package/dist/list-BOMbpS4m.mjs +46 -0
- package/dist/list-BmZ_JbLB.mjs +104 -0
- package/dist/list-BpUUxxwQ.mjs +46 -0
- package/dist/list-CgIebllW.mjs +94 -0
- package/dist/list-D0Z__0nw.mjs +42 -0
- package/dist/list-D3FkO9gb.mjs +56 -0
- package/dist/list-D7WLdHvX.mjs +42 -0
- package/dist/list-DAr3urtu.mjs +53 -0
- package/dist/list-DqpWd9aR.mjs +59 -0
- package/dist/list-VO_PbRjC.mjs +50 -0
- package/dist/list-b6ByzUFt.mjs +79 -0
- package/dist/list-jpQ28gU2.mjs +56 -0
- package/dist/list-y93EXyDj.mjs +42 -0
- package/dist/login-BnJYzdR3.mjs +228 -0
- package/dist/logout-YMnSRLLF.mjs +56 -0
- package/dist/me-CLPAe7X2.mjs +36 -0
- package/dist/milestone-Dc3alfp9.mjs +11 -0
- package/dist/notification-CsOuC8Uk.mjs +11 -0
- package/dist/output-DBvfyU1J.mjs +39 -0
- package/dist/pr-BBe07JUp.mjs +15 -0
- package/dist/project-Dilo1T5e.mjs +16 -0
- package/dist/read-BS2G4sNq.mjs +17 -0
- package/dist/read-CyCASx6U.mjs +17 -0
- package/dist/read-all-CjgMJ2to.mjs +16 -0
- package/dist/refresh-DDU2ZLnc.mjs +54 -0
- package/dist/registry-D8DfbunX.mjs +2 -0
- package/dist/registry-PlBmfTR4.mjs +35 -0
- package/dist/remove-BSDJvkVJ.mjs +17 -0
- package/dist/remove-user-CShNCvf8.mjs +26 -0
- package/dist/reopen-BIRhcmsI.mjs +28 -0
- package/dist/repo-B2K8y0mD.mjs +10 -0
- package/dist/role-labels-CLA2wmjO.mjs +11 -0
- package/dist/space-BgZeUqoH.mjs +6 -0
- package/dist/{shared/bee.CHtg3F43.mjs → src-BWaxjrq_.mjs} +143 -175
- package/dist/src-CP4YLIAh.mjs +1008 -0
- package/dist/src-CTD9-bSB.mjs +22760 -0
- package/dist/star-Sgb-e2CQ.mjs +11 -0
- package/dist/status-BkFMW8Jh.mjs +53 -0
- package/dist/status-CaGqMXh7.mjs +64 -0
- package/dist/status-DDFyQrRZ.mjs +11 -0
- package/dist/status-nI4Dpcoo.mjs +58 -0
- package/dist/stdin-C-vjNi9T.mjs +17 -0
- package/dist/switch-CMLfVGDN.mjs +34 -0
- package/dist/tags-DuMJZyBL.mjs +29 -0
- package/dist/team-DfQn8Tf5.mjs +6 -0
- package/dist/token-BmkUX9vc.mjs +28 -0
- package/dist/tree-CozBqPbN.mjs +46 -0
- package/dist/user-DMyFmoP3.mjs +11 -0
- package/dist/users-BSGqsGSy.mjs +51 -0
- package/dist/view-Bj99sk7O.mjs +48 -0
- package/dist/view-Bs8o0c7i.mjs +36 -0
- package/dist/view-C1ECwTMN.mjs +54 -0
- package/dist/view-COBYBfu7.mjs +38 -0
- package/dist/view-CZHT-HiE.mjs +36 -0
- package/dist/view-D1RuQJV6.mjs +76 -0
- package/dist/view-DBO75WzR.mjs +54 -0
- package/dist/view-DJHrnN8j.mjs +62 -0
- package/dist/view-DLx6qQt9.mjs +51 -0
- package/dist/watching-D22YYxOT.mjs +12 -0
- package/dist/wiki-B-DQUuIX.mjs +16 -0
- package/package.json +14 -11
- package/dist/chunks/activities.mjs +0 -75
- package/dist/chunks/activities2.mjs +0 -75
- package/dist/chunks/activities3.mjs +0 -75
- package/dist/chunks/add-user.mjs +0 -38
- package/dist/chunks/add.mjs +0 -63
- package/dist/chunks/add2.mjs +0 -39
- package/dist/chunks/api.mjs +0 -174
- package/dist/chunks/attachments.mjs +0 -47
- package/dist/chunks/attachments2.mjs +0 -47
- package/dist/chunks/attachments3.mjs +0 -48
- package/dist/chunks/browse.mjs +0 -269
- package/dist/chunks/clone.mjs +0 -60
- package/dist/chunks/close.mjs +0 -50
- package/dist/chunks/comment.mjs +0 -125
- package/dist/chunks/comment2.mjs +0 -111
- package/dist/chunks/comments.mjs +0 -57
- package/dist/chunks/completion.mjs +0 -113
- package/dist/chunks/count.mjs +0 -68
- package/dist/chunks/count2.mjs +0 -69
- package/dist/chunks/count3.mjs +0 -59
- package/dist/chunks/count4.mjs +0 -35
- package/dist/chunks/count5.mjs +0 -52
- package/dist/chunks/create.mjs +0 -60
- package/dist/chunks/create2.mjs +0 -88
- package/dist/chunks/create3.mjs +0 -64
- package/dist/chunks/create4.mjs +0 -74
- package/dist/chunks/create5.mjs +0 -56
- package/dist/chunks/create6.mjs +0 -37
- package/dist/chunks/create7.mjs +0 -45
- package/dist/chunks/create8.mjs +0 -49
- package/dist/chunks/create9.mjs +0 -49
- package/dist/chunks/dashboard.mjs +0 -84
- package/dist/chunks/delete.mjs +0 -48
- package/dist/chunks/delete2.mjs +0 -46
- package/dist/chunks/delete3.mjs +0 -46
- package/dist/chunks/delete4.mjs +0 -49
- package/dist/chunks/delete5.mjs +0 -50
- package/dist/chunks/delete6.mjs +0 -50
- package/dist/chunks/delete7.mjs +0 -62
- package/dist/chunks/delete8.mjs +0 -53
- package/dist/chunks/delete9.mjs +0 -48
- package/dist/chunks/edit.mjs +0 -56
- package/dist/chunks/edit2.mjs +0 -78
- package/dist/chunks/edit3.mjs +0 -65
- package/dist/chunks/edit4.mjs +0 -51
- package/dist/chunks/edit5.mjs +0 -43
- package/dist/chunks/edit6.mjs +0 -54
- package/dist/chunks/edit7.mjs +0 -50
- package/dist/chunks/edit8.mjs +0 -50
- package/dist/chunks/history.mjs +0 -56
- package/dist/chunks/index.mjs +0 -15
- package/dist/chunks/index10.mjs +0 -18
- package/dist/chunks/index11.mjs +0 -13
- package/dist/chunks/index12.mjs +0 -13
- package/dist/chunks/index13.mjs +0 -13
- package/dist/chunks/index14.mjs +0 -8
- package/dist/chunks/index15.mjs +0 -13
- package/dist/chunks/index16.mjs +0 -13
- package/dist/chunks/index17.mjs +0 -14
- package/dist/chunks/index2.mjs +0 -18
- package/dist/chunks/index3.mjs +0 -20
- package/dist/chunks/index4.mjs +0 -15
- package/dist/chunks/index5.mjs +0 -13
- package/dist/chunks/index6.mjs +0 -17
- package/dist/chunks/index7.mjs +0 -8
- package/dist/chunks/index8.mjs +0 -8
- package/dist/chunks/index9.mjs +0 -13
- package/dist/chunks/list.mjs +0 -52
- package/dist/chunks/list10.mjs +0 -44
- package/dist/chunks/list11.mjs +0 -49
- package/dist/chunks/list12.mjs +0 -45
- package/dist/chunks/list13.mjs +0 -45
- package/dist/chunks/list14.mjs +0 -54
- package/dist/chunks/list15.mjs +0 -46
- package/dist/chunks/list2.mjs +0 -103
- package/dist/chunks/list3.mjs +0 -85
- package/dist/chunks/list4.mjs +0 -79
- package/dist/chunks/list5.mjs +0 -77
- package/dist/chunks/list6.mjs +0 -45
- package/dist/chunks/list7.mjs +0 -48
- package/dist/chunks/list8.mjs +0 -46
- package/dist/chunks/list9.mjs +0 -53
- package/dist/chunks/login.mjs +0 -218
- package/dist/chunks/logout.mjs +0 -76
- package/dist/chunks/me.mjs +0 -48
- package/dist/chunks/read-all.mjs +0 -29
- package/dist/chunks/read.mjs +0 -29
- package/dist/chunks/read2.mjs +0 -27
- package/dist/chunks/refresh.mjs +0 -76
- package/dist/chunks/remove-user.mjs +0 -38
- package/dist/chunks/remove.mjs +0 -27
- package/dist/chunks/reopen.mjs +0 -42
- package/dist/chunks/status.mjs +0 -64
- package/dist/chunks/status2.mjs +0 -61
- package/dist/chunks/status3.mjs +0 -66
- package/dist/chunks/switch.mjs +0 -55
- package/dist/chunks/tags.mjs +0 -41
- package/dist/chunks/token.mjs +0 -42
- package/dist/chunks/tree.mjs +0 -61
- package/dist/chunks/users.mjs +0 -48
- package/dist/chunks/view.mjs +0 -58
- package/dist/chunks/view2.mjs +0 -95
- package/dist/chunks/view3.mjs +0 -68
- package/dist/chunks/view4.mjs +0 -70
- package/dist/chunks/view5.mjs +0 -61
- package/dist/chunks/view6.mjs +0 -52
- package/dist/chunks/view7.mjs +0 -48
- package/dist/chunks/view8.mjs +0 -61
- package/dist/chunks/view9.mjs +0 -48
- package/dist/shared/bee.084B_7FC.mjs +0 -27
- package/dist/shared/bee.BTBGpv4K.mjs +0 -34
- package/dist/shared/bee.BXiuAfjJ.mjs +0 -10
- package/dist/shared/bee.Btmq3TXs.mjs +0 -19
- package/dist/shared/bee.C--ZWPxf.mjs +0 -14
- package/dist/shared/bee.C4p7W8_P.mjs +0 -18
- package/dist/shared/bee.CAARNIp6.mjs +0 -49
- package/dist/shared/bee.CirccSk2.mjs +0 -51
- package/dist/shared/bee.CktwmH8R.mjs +0 -25
- package/dist/shared/bee.CzKcWSES.mjs +0 -42
- package/dist/shared/bee.DFnSWb6q.mjs +0 -396
- package/dist/shared/bee.DoTvz3uW.mjs +0 -13
- package/dist/shared/bee.KteAW2rM.mjs +0 -73
- package/dist/shared/bee.RsR9yniy.mjs +0 -131
- package/dist/shared/bee.a05kNWpn.mjs +0 -32
- package/dist/shared/bee.n5MYN4a6.mjs +0 -12
- package/dist/shared/bee.q93n012-.mjs +0 -14
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { j as getActivitySummary, y as getClient } from "./src-CTD9-bSB.mjs";
|
|
2
|
+
import { t as ACTIVITY_LABELS } from "./activity-labels-CLFpxp8o.mjs";
|
|
3
|
+
import { t as outputResult } from "./output-DBvfyU1J.mjs";
|
|
4
|
+
import { a as parseArg, r as printTable, s as vInteger } from "./src-CP4YLIAh.mjs";
|
|
5
|
+
import { t as formatDate } from "./format-DHAR0n3J.mjs";
|
|
6
|
+
import { n as ENV_AUTH, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
7
|
+
import { S as space, c as count, f as maxId, m as minId, o as collectNum, u as json, v as order } from "./common-options-BuYWxYdO.mjs";
|
|
8
|
+
import consola from "consola";
|
|
9
|
+
import { getUserActivities } from "backlog-js";
|
|
10
|
+
import * as v from "valibot";
|
|
11
|
+
//#region src/commands/user/activities.ts
|
|
12
|
+
const activities = new BeeCommand("activities").summary("List user activities").description(`Results are ordered by most recent first. Use \`--activity-type\` to filter by type.
|
|
13
|
+
|
|
14
|
+
For activity type IDs, see:
|
|
15
|
+
https://developer.nulab.com/docs/backlog/api/2/get-user-recent-updates/#response-description`).argument("<user>", "User ID").option("--activity-type <id>", "Filter by activity type IDs (repeatable)", collectNum, []).addOption(count()).addOption(order()).addOption(minId()).addOption(maxId()).addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([
|
|
16
|
+
{
|
|
17
|
+
description: "List user activities",
|
|
18
|
+
command: "bee user activities 12345"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
description: "Show only issue-related activities",
|
|
22
|
+
command: "bee user activities 12345 --activity-type 1 --activity-type 2 --activity-type 3"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
description: "Show last 50 activities",
|
|
26
|
+
command: "bee user activities 12345 --count 50"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
description: "Output as JSON",
|
|
30
|
+
command: "bee user activities 12345 --json"
|
|
31
|
+
}
|
|
32
|
+
]).action(async (user, opts) => {
|
|
33
|
+
const { client } = await getClient(opts.space);
|
|
34
|
+
const activityTypeId = opts.activityType;
|
|
35
|
+
const activityList = await getUserActivities(client, parseArg(vInteger, user, "user"), {
|
|
36
|
+
activityTypeId,
|
|
37
|
+
count: parseArg(v.optional(vInteger), opts.count, "--count"),
|
|
38
|
+
order: opts.order,
|
|
39
|
+
minId: parseArg(v.optional(vInteger), opts.minId, "--min-id"),
|
|
40
|
+
maxId: parseArg(v.optional(vInteger), opts.maxId, "--max-id")
|
|
41
|
+
});
|
|
42
|
+
outputResult(activityList, opts, (data) => {
|
|
43
|
+
if (data.length === 0) {
|
|
44
|
+
consola.info("No activities found.");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const rows = data.map((activity) => [
|
|
48
|
+
{
|
|
49
|
+
header: "DATE",
|
|
50
|
+
value: formatDate(activity.created)
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
header: "TYPE",
|
|
54
|
+
value: ACTIVITY_LABELS[activity.type] ?? `Type ${activity.type}`
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
header: "PROJECT",
|
|
58
|
+
value: activity.project?.name ?? ""
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
header: "SUMMARY",
|
|
62
|
+
value: getActivitySummary(activity)
|
|
63
|
+
}
|
|
64
|
+
]);
|
|
65
|
+
printTable(rows);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
//#endregion
|
|
69
|
+
export { activities as default };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { j as getActivitySummary, y as getClient } from "./src-CTD9-bSB.mjs";
|
|
2
|
+
import { t as ACTIVITY_LABELS } from "./activity-labels-CLFpxp8o.mjs";
|
|
3
|
+
import { t as outputResult } from "./output-DBvfyU1J.mjs";
|
|
4
|
+
import { a as parseArg, r as printTable, s as vInteger } from "./src-CP4YLIAh.mjs";
|
|
5
|
+
import { t as formatDate } from "./format-DHAR0n3J.mjs";
|
|
6
|
+
import { n as ENV_AUTH, r as ENV_PROJECT, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
7
|
+
import { E as resolveOptions, S as space, c as count, o as collectNum, u as json, v as order, y as project } from "./common-options-BuYWxYdO.mjs";
|
|
8
|
+
import consola from "consola";
|
|
9
|
+
import { getProjectActivities } from "backlog-js";
|
|
10
|
+
import * as v from "valibot";
|
|
11
|
+
//#region src/commands/project/activities.ts
|
|
12
|
+
const activities = new BeeCommand("activities").summary("List project activities").description(`Results are ordered by most recent first. Use \`--activity-type\` to filter by type.
|
|
13
|
+
|
|
14
|
+
For activity type IDs, see:
|
|
15
|
+
https://developer.nulab.com/docs/backlog/api/2/get-project-recent-updates/#response-description`).addOption(project()).option("--activity-type <id>", "Filter by activity type IDs (repeatable)", collectNum, []).addOption(count()).addOption(order()).addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([
|
|
16
|
+
{
|
|
17
|
+
description: "List recent activities",
|
|
18
|
+
command: "bee project activities -p PROJECT_KEY"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
description: "Show only issue-related activities",
|
|
22
|
+
command: "bee project activities -p PROJECT_KEY --activity-type 1 --activity-type 2 --activity-type 3"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
description: "Show last 50 activities",
|
|
26
|
+
command: "bee project activities -p PROJECT_KEY --count 50"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
description: "Output as JSON",
|
|
30
|
+
command: "bee project activities -p PROJECT_KEY --json"
|
|
31
|
+
}
|
|
32
|
+
]).action(async (opts, cmd) => {
|
|
33
|
+
await resolveOptions(cmd);
|
|
34
|
+
const { client } = await getClient(opts.space);
|
|
35
|
+
const activityTypeId = opts.activityType;
|
|
36
|
+
const activityList = await getProjectActivities(client, opts.project, {
|
|
37
|
+
activityTypeId,
|
|
38
|
+
count: parseArg(v.optional(vInteger), opts.count, "--count"),
|
|
39
|
+
order: opts.order
|
|
40
|
+
});
|
|
41
|
+
const jsonArg = opts.json === true ? "" : opts.json;
|
|
42
|
+
outputResult(activityList, {
|
|
43
|
+
...opts,
|
|
44
|
+
json: jsonArg
|
|
45
|
+
}, (data) => {
|
|
46
|
+
if (data.length === 0) {
|
|
47
|
+
consola.info("No activities found.");
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const rows = data.map((activity) => [
|
|
51
|
+
{
|
|
52
|
+
header: "DATE",
|
|
53
|
+
value: formatDate(activity.created)
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
header: "TYPE",
|
|
57
|
+
value: ACTIVITY_LABELS[activity.type] ?? `Type ${activity.type}`
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
header: "USER",
|
|
61
|
+
value: activity.createdUser?.name ?? "Unknown"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
header: "SUMMARY",
|
|
65
|
+
value: getActivitySummary(activity)
|
|
66
|
+
}
|
|
67
|
+
]);
|
|
68
|
+
printTable(rows);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
//#endregion
|
|
72
|
+
export { activities as default };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { j as getActivitySummary, y as getClient } from "./src-CTD9-bSB.mjs";
|
|
2
|
+
import { t as ACTIVITY_LABELS } from "./activity-labels-CLFpxp8o.mjs";
|
|
3
|
+
import { t as outputResult } from "./output-DBvfyU1J.mjs";
|
|
4
|
+
import { a as parseArg, r as printTable, s as vInteger } from "./src-CP4YLIAh.mjs";
|
|
5
|
+
import { t as formatDate } from "./format-DHAR0n3J.mjs";
|
|
6
|
+
import { n as ENV_AUTH, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
7
|
+
import { S as space, c as count, f as maxId, m as minId, o as collectNum, u as json, v as order } from "./common-options-BuYWxYdO.mjs";
|
|
8
|
+
import consola from "consola";
|
|
9
|
+
import { getSpaceActivities } from "backlog-js";
|
|
10
|
+
import * as v from "valibot";
|
|
11
|
+
//#region src/commands/space/activities.ts
|
|
12
|
+
const activities = new BeeCommand("activities").summary("List space activities").description(`Results are ordered by most recent first. Use \`--activity-type\` to filter by type.
|
|
13
|
+
|
|
14
|
+
For activity type IDs, see:
|
|
15
|
+
https://developer.nulab.com/docs/backlog/api/2/get-recent-updates/#response-description`).option("--activity-type <id>", "Filter by activity type IDs (repeatable)", collectNum, []).addOption(count()).addOption(order()).addOption(minId()).addOption(maxId()).addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([
|
|
16
|
+
{
|
|
17
|
+
description: "List space activities",
|
|
18
|
+
command: "bee space activities"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
description: "Show only issue-related activities",
|
|
22
|
+
command: "bee space activities --activity-type 1 --activity-type 2 --activity-type 3"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
description: "Show last 50 activities",
|
|
26
|
+
command: "bee space activities --count 50"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
description: "Output as JSON",
|
|
30
|
+
command: "bee space activities --json"
|
|
31
|
+
}
|
|
32
|
+
]).action(async (opts) => {
|
|
33
|
+
const { client } = await getClient(opts.space);
|
|
34
|
+
const activityTypeId = opts.activityType;
|
|
35
|
+
const activityList = await getSpaceActivities(client, {
|
|
36
|
+
activityTypeId,
|
|
37
|
+
count: parseArg(v.optional(vInteger), opts.count, "--count"),
|
|
38
|
+
order: opts.order,
|
|
39
|
+
minId: parseArg(v.optional(vInteger), opts.minId, "--min-id"),
|
|
40
|
+
maxId: parseArg(v.optional(vInteger), opts.maxId, "--max-id")
|
|
41
|
+
});
|
|
42
|
+
outputResult(activityList, opts, (data) => {
|
|
43
|
+
if (data.length === 0) {
|
|
44
|
+
consola.info("No activities found.");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const rows = data.map((activity) => [
|
|
48
|
+
{
|
|
49
|
+
header: "DATE",
|
|
50
|
+
value: formatDate(activity.created)
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
header: "TYPE",
|
|
54
|
+
value: ACTIVITY_LABELS[activity.type] ?? `Type ${activity.type}`
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
header: "PROJECT",
|
|
58
|
+
value: activity.project?.name ?? ""
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
header: "SUMMARY",
|
|
62
|
+
value: getActivitySummary(activity)
|
|
63
|
+
}
|
|
64
|
+
]);
|
|
65
|
+
printTable(rows);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
//#endregion
|
|
69
|
+
export { activities as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region ../../packages/backlog-utils/src/activity-labels.ts
|
|
2
|
+
const ACTIVITY_LABELS = {
|
|
3
|
+
1: "Issue Created",
|
|
4
|
+
2: "Issue Updated",
|
|
5
|
+
3: "Issue Commented",
|
|
6
|
+
4: "Issue Deleted",
|
|
7
|
+
5: "Wiki Created",
|
|
8
|
+
6: "Wiki Updated",
|
|
9
|
+
7: "Wiki Deleted",
|
|
10
|
+
8: "File Added",
|
|
11
|
+
9: "File Updated",
|
|
12
|
+
10: "File Deleted",
|
|
13
|
+
11: "SVN Committed",
|
|
14
|
+
12: "Git Pushed",
|
|
15
|
+
13: "Git Repo Created",
|
|
16
|
+
14: "Issue Multi-Updated",
|
|
17
|
+
15: "Project User Added",
|
|
18
|
+
16: "Project User Removed",
|
|
19
|
+
17: "Notification Added",
|
|
20
|
+
18: "Pull Request Added",
|
|
21
|
+
19: "Pull Request Updated",
|
|
22
|
+
20: "Pull Request Commented",
|
|
23
|
+
21: "Pull Request Deleted",
|
|
24
|
+
22: "Milestone Added",
|
|
25
|
+
23: "Milestone Updated",
|
|
26
|
+
24: "Milestone Deleted",
|
|
27
|
+
25: "Project Team Added",
|
|
28
|
+
26: "Project Team Deleted",
|
|
29
|
+
34: "Status Deleted",
|
|
30
|
+
35: "Issues Dates Updated",
|
|
31
|
+
47: "Issue Multi-Created"
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { ACTIVITY_LABELS as t };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { y as getClient } from "./src-CTD9-bSB.mjs";
|
|
2
|
+
import { a as parseArg, s as vInteger, u as UserError } from "./src-CP4YLIAh.mjs";
|
|
3
|
+
import { n as ENV_AUTH, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
4
|
+
import { S as space, l as issue } from "./common-options-BuYWxYdO.mjs";
|
|
5
|
+
import consola from "consola";
|
|
6
|
+
import { getIssue, postStar } from "backlog-js";
|
|
7
|
+
//#region src/commands/star/add.ts
|
|
8
|
+
const add = new BeeCommand("add").summary("Add a star").description(`Specify exactly one target: \`--issue\` (accepts key or ID), \`--comment\`, \`--wiki\`, or \`--pr-comment\`.`).addOption(issue()).option("--comment <number>", "Comment ID to star").option("--wiki <number>", "Wiki page ID to star").option("--pr-comment <number>", "Pull request comment ID to star").addOption(space()).envVars([...ENV_AUTH]).examples([
|
|
9
|
+
{
|
|
10
|
+
description: "Star an issue by key",
|
|
11
|
+
command: "bee star add --issue PROJECT-123"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
description: "Star an issue by ID",
|
|
15
|
+
command: "bee star add --issue 12345"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
description: "Star a comment",
|
|
19
|
+
command: "bee star add --comment 67890"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
description: "Star a wiki page",
|
|
23
|
+
command: "bee star add --wiki 111"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
description: "Star a pull request comment",
|
|
27
|
+
command: "bee star add --pr-comment 222"
|
|
28
|
+
}
|
|
29
|
+
]).action(async (opts) => {
|
|
30
|
+
const flags = [
|
|
31
|
+
opts.issue,
|
|
32
|
+
opts.comment,
|
|
33
|
+
opts.wiki,
|
|
34
|
+
opts.prComment
|
|
35
|
+
].filter((val) => val !== void 0);
|
|
36
|
+
if (flags.length === 0) throw new UserError("Exactly one of --issue, --comment, --wiki, or --pr-comment must be provided.");
|
|
37
|
+
if (flags.length > 1) throw new UserError("Only one of --issue, --comment, --wiki, or --pr-comment can be provided at a time.");
|
|
38
|
+
const { client } = await getClient(opts.space);
|
|
39
|
+
if (opts.issue) {
|
|
40
|
+
const issueId = (/^\d+$/.test(opts.issue) ? { id: parseArg(vInteger, opts.issue, "--issue") } : await getIssue(client, opts.issue)).id;
|
|
41
|
+
await postStar(client, { issueId });
|
|
42
|
+
consola.success(`Starred issue ${opts.issue}.`);
|
|
43
|
+
} else if (opts.comment) {
|
|
44
|
+
await postStar(client, { commentId: parseArg(vInteger, opts.comment, "--comment") });
|
|
45
|
+
consola.success(`Starred comment ${opts.comment}.`);
|
|
46
|
+
} else if (opts.wiki) {
|
|
47
|
+
await postStar(client, { wikiId: parseArg(vInteger, opts.wiki, "--wiki") });
|
|
48
|
+
consola.success(`Starred wiki ${opts.wiki}.`);
|
|
49
|
+
} else if (opts.prComment) {
|
|
50
|
+
await postStar(client, { pullRequestCommentId: parseArg(vInteger, opts.prComment, "--pr-comment") });
|
|
51
|
+
consola.success(`Starred pull request comment ${opts.prComment}.`);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
//#endregion
|
|
55
|
+
export { add as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { y as getClient } from "./src-CTD9-bSB.mjs";
|
|
2
|
+
import { t as outputResult } from "./output-DBvfyU1J.mjs";
|
|
3
|
+
import "./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 { postWatchingListItem } from "backlog-js";
|
|
8
|
+
//#region src/commands/watching/add.ts
|
|
9
|
+
const add = new BeeCommand("add").summary("Add a watching item").description(`Subscribe to an issue to receive update notifications.`).requiredOption("--issue <key>", "Issue ID or issue key").option("--note <text>", "Note to attach to the watching item").addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([{
|
|
10
|
+
description: "Watch an issue",
|
|
11
|
+
command: "bee watching add --issue PROJECT-123"
|
|
12
|
+
}, {
|
|
13
|
+
description: "Watch an issue with a note",
|
|
14
|
+
command: "bee watching add --issue PROJECT-123 --note \"Track progress\""
|
|
15
|
+
}]).action(async (opts) => {
|
|
16
|
+
const { client } = await getClient(opts.space);
|
|
17
|
+
const result = await postWatchingListItem(client, {
|
|
18
|
+
issueIdOrKey: opts.issue,
|
|
19
|
+
note: opts.note ?? ""
|
|
20
|
+
});
|
|
21
|
+
outputResult(result, opts, (data) => {
|
|
22
|
+
consola.success(`Added watching for issue ${data.issue.issueKey} (ID: ${data.id}).`);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
//#endregion
|
|
26
|
+
export { add as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { y as getClient } from "./src-CTD9-bSB.mjs";
|
|
2
|
+
import { t as outputResult } from "./output-DBvfyU1J.mjs";
|
|
3
|
+
import { a as parseArg, s as vInteger } from "./src-CP4YLIAh.mjs";
|
|
4
|
+
import { n as ENV_AUTH, r as ENV_PROJECT, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
5
|
+
import { E as resolveOptions, S as space, T as RequiredOption, u as json, y as project } from "./common-options-BuYWxYdO.mjs";
|
|
6
|
+
import consola from "consola";
|
|
7
|
+
import { postProjectUser } from "backlog-js";
|
|
8
|
+
//#region src/commands/project/add-user.ts
|
|
9
|
+
const addUser = new BeeCommand("add-user").summary("Add a user to a project").description(`Use \`bee project users\` to look up user IDs.`).addOption(project()).addOption(new RequiredOption("--user-id <id>", "User ID")).addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([{
|
|
10
|
+
description: "Add a user to a project",
|
|
11
|
+
command: "bee project add-user -p PROJECT_KEY --user-id 12345"
|
|
12
|
+
}]).action(async (opts, cmd) => {
|
|
13
|
+
await resolveOptions(cmd);
|
|
14
|
+
const userId = parseArg(vInteger, opts.userId, "--user-id");
|
|
15
|
+
const { client } = await getClient(opts.space);
|
|
16
|
+
const user = await postProjectUser(client, opts.project, String(userId));
|
|
17
|
+
const jsonArg = opts.json === true ? "" : opts.json;
|
|
18
|
+
outputResult(user, {
|
|
19
|
+
...opts,
|
|
20
|
+
json: jsonArg
|
|
21
|
+
}, (data) => {
|
|
22
|
+
consola.success(`Added user ${data.name} to project ${opts.project}.`);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
//#endregion
|
|
26
|
+
export { addUser as default };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { y as getClient } from "./src-CTD9-bSB.mjs";
|
|
2
|
+
import { t as outputResult } from "./output-DBvfyU1J.mjs";
|
|
3
|
+
import { o as vFiniteNumber, u as UserError } from "./src-CP4YLIAh.mjs";
|
|
4
|
+
import { t as readFileOrStdin } from "./file-DwPTUKOI.mjs";
|
|
5
|
+
import { n as ENV_AUTH, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
6
|
+
import { S as space, a as collect } from "./common-options-BuYWxYdO.mjs";
|
|
7
|
+
import * as v from "valibot";
|
|
8
|
+
//#region src/commands/api.ts
|
|
9
|
+
const api = new BeeCommand("api").summary("Make an authenticated API request").description(`The endpoint is a Backlog API path (e.g. \`users/myself\`). A leading \`/api/v2/\` prefix is stripped automatically.
|
|
10
|
+
|
|
11
|
+
\`-f\` infers types (number, boolean, string); \`-F\` always sends strings. A value is only inferred as a number when the number prints back identically, so \`1.0\`, \`0042\` and \`0x10\` stay strings. Repeated keys become arrays. Append \`[]\` for a single-element array (e.g. \`-f projectId[]=12345\`).
|
|
12
|
+
|
|
13
|
+
If a \`-f\` value starts with \`@\`, the rest of the value is interpreted as a filename to read the value from. Pass \`-\` to read from standard input (e.g. \`-f 'key=@-'\`). File and stdin content is always sent as a string, without type inference.
|
|
14
|
+
|
|
15
|
+
For GET, fields are query parameters. For POST/PUT/PATCH/DELETE, fields are the request body.`).argument("<endpoint>", "API endpoint path").option("-X, --method <method>", "HTTP method", "GET").option("-f, --field <key=value>", "Add a typed parameter (use \"@<path>\" or \"@-\" to read value from file or stdin)", collect, []).option("-F, --raw-field <key=value>", "Add a string parameter (key=value, repeatable)", collect, []).option("--json [fields]", "Output as JSON (optionally filter by field names, comma-separated)").option("--silent", "Do not print the response body").addOption(space()).envVars([...ENV_AUTH]).examples([
|
|
16
|
+
{
|
|
17
|
+
description: "Get your user profile",
|
|
18
|
+
command: "bee api users/myself"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
description: "List issues in a project",
|
|
22
|
+
command: "bee api issues -f 'projectId[]=12345' -f count=5"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
description: "Filter by multiple statuses",
|
|
26
|
+
command: "bee api issues -f 'projectId[]=12345' -f statusId=1 -f statusId=2"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
description: "Create an issue",
|
|
30
|
+
command: "bee api issues -X POST -f projectId=12345 -f summary=\"Test issue\" -f issueTypeId=1 -f priorityId=3"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
description: "Set a field value from a file",
|
|
34
|
+
command: "bee api issues/PROJECT-1 -X PATCH -f 'description=@desc.md'"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
description: "Pipe content from stdin",
|
|
38
|
+
command: "echo 'Hello' | bee api issues/PROJECT-1/comments -X POST -f 'content=@-'"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
description: "Select specific fields",
|
|
42
|
+
command: "bee api users/myself --json id,name,mailAddress"
|
|
43
|
+
}
|
|
44
|
+
]).action(async (endpoint, opts) => {
|
|
45
|
+
const { client } = await getClient(opts.space);
|
|
46
|
+
const method = opts.method.toUpperCase();
|
|
47
|
+
const normalizedEndpoint = normalizeEndpoint(endpoint);
|
|
48
|
+
const params = await buildParams(opts.field, opts.rawField);
|
|
49
|
+
const data = await makeRequest(client, method, normalizedEndpoint, params);
|
|
50
|
+
if (opts.silent) return;
|
|
51
|
+
const jsonVal = typeof opts.json === "string" ? opts.json : "";
|
|
52
|
+
outputResult(data, { json: jsonVal }, () => {});
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Normalize API endpoint path for backlog-js client methods.
|
|
56
|
+
* backlog-js prepends `restBaseURL` (which includes `/api/v2`), so
|
|
57
|
+
* the path passed to `client.get()` etc. must be relative (e.g. `users/myself`).
|
|
58
|
+
* This function strips a leading `/api/v2/` prefix if the user supplied one.
|
|
59
|
+
*/
|
|
60
|
+
const normalizeEndpoint = (endpoint) => {
|
|
61
|
+
return endpoint.replace(/^\/?(api\/v2\/?)/, "");
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Read a field value from a file (`@path`) or stdin (`@-`) reference.
|
|
65
|
+
* The content is sent as-is: no trimming, and no type inference — gh's
|
|
66
|
+
* magicFieldValue does the same. Inferring here would coerce content that
|
|
67
|
+
* only looks numeric: a file holding just a newline became `0`, because
|
|
68
|
+
* Number("\n") is 0.
|
|
69
|
+
*/
|
|
70
|
+
const readFieldValue = async (ref) => {
|
|
71
|
+
if (ref === "") throw new UserError("Invalid file reference: \"@\". Provide a file path after @ or use @- for stdin.");
|
|
72
|
+
return readFileOrStdin(ref);
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Build params object from --field and --raw-field values.
|
|
76
|
+
* --field infers types (number, boolean, string) and supports @file references.
|
|
77
|
+
* --raw-field always uses literal strings.
|
|
78
|
+
* When the same key appears multiple times, values are collected into an array.
|
|
79
|
+
*/
|
|
80
|
+
const buildParams = async (fields, rawFields) => {
|
|
81
|
+
const params = {};
|
|
82
|
+
const addParam = (rawKey, value) => {
|
|
83
|
+
const isArray = rawKey.endsWith("[]");
|
|
84
|
+
const key = isArray ? rawKey.slice(0, -2) : rawKey;
|
|
85
|
+
const existing = params[key];
|
|
86
|
+
if (existing === void 0) params[key] = isArray ? [value] : value;
|
|
87
|
+
else params[key] = Array.isArray(existing) ? [...existing, value] : [existing, value];
|
|
88
|
+
};
|
|
89
|
+
for (const pair of fields) {
|
|
90
|
+
const eqIndex = pair.indexOf("=");
|
|
91
|
+
if (eqIndex === -1) throw new UserError(`Invalid field format: "${pair}". Expected key=value.`);
|
|
92
|
+
const rawValue = pair.slice(eqIndex + 1);
|
|
93
|
+
const value = rawValue.startsWith("@") ? await readFieldValue(rawValue.slice(1)) : inferType(rawValue);
|
|
94
|
+
addParam(pair.slice(0, eqIndex), value);
|
|
95
|
+
}
|
|
96
|
+
for (const pair of rawFields) {
|
|
97
|
+
const eqIndex = pair.indexOf("=");
|
|
98
|
+
if (eqIndex === -1) throw new UserError(`Invalid field format: "${pair}". Expected key=value.`);
|
|
99
|
+
addParam(pair.slice(0, eqIndex), pair.slice(eqIndex + 1));
|
|
100
|
+
}
|
|
101
|
+
return params;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Infer type from a string value.
|
|
105
|
+
*
|
|
106
|
+
* A value is only treated as a number when it survives the round trip through
|
|
107
|
+
* one — `String(Number(value)) === value`. Everything `Number()` accepts is a
|
|
108
|
+
* wider set than the spellings it can reproduce, and the difference is sent
|
|
109
|
+
* over the wire: `1.0` became `1`, `0042` became `42`, `0x10` became `16`, and
|
|
110
|
+
* an id past 2^53 lost digits, all without an error. Since the API takes
|
|
111
|
+
* form-encoded params, an inferred number is stringified again anyway, so
|
|
112
|
+
* declining to infer here costs nothing and keeps the value intact.
|
|
113
|
+
*/
|
|
114
|
+
const inferType = (value) => {
|
|
115
|
+
if (value === "true") return true;
|
|
116
|
+
if (value === "false") return false;
|
|
117
|
+
if (value !== "") {
|
|
118
|
+
const result = v.safeParse(vFiniteNumber, value);
|
|
119
|
+
if (result.success && String(result.output) === value) return result.output;
|
|
120
|
+
}
|
|
121
|
+
return value;
|
|
122
|
+
};
|
|
123
|
+
const makeRequest = async (client, method, endpoint, params) => {
|
|
124
|
+
switch (method) {
|
|
125
|
+
case "GET": return client.get(endpoint, params);
|
|
126
|
+
case "POST": return client.post(endpoint, params);
|
|
127
|
+
case "PUT": return client.put(endpoint, params);
|
|
128
|
+
case "PATCH": return client.patch(endpoint, params);
|
|
129
|
+
case "DELETE": return client.delete(endpoint, params);
|
|
130
|
+
default: throw new UserError(`Unsupported HTTP method: ${method}`);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
//#endregion
|
|
134
|
+
export { api as default };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { y as getClient } from "./src-CTD9-bSB.mjs";
|
|
2
|
+
import { t as outputResult } from "./output-DBvfyU1J.mjs";
|
|
3
|
+
import { r as printTable } from "./src-CP4YLIAh.mjs";
|
|
4
|
+
import { n as formatSize, t as formatDate } from "./format-DHAR0n3J.mjs";
|
|
5
|
+
import { n as ENV_AUTH, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
6
|
+
import { S as space, u as json } from "./common-options-BuYWxYdO.mjs";
|
|
7
|
+
import consola from "consola";
|
|
8
|
+
import { getDocument } from "backlog-js";
|
|
9
|
+
//#region src/commands/document/attachments.ts
|
|
10
|
+
const attachments = new BeeCommand("attachments").summary("List document attachments").description(`Shows file name, size, creator, and creation date.`).argument("<document>", "Document ID").addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([{
|
|
11
|
+
description: "List attachments",
|
|
12
|
+
command: "bee document attachments 12345"
|
|
13
|
+
}, {
|
|
14
|
+
description: "Output as JSON",
|
|
15
|
+
command: "bee document attachments 12345 --json"
|
|
16
|
+
}]).action(async (document, opts) => {
|
|
17
|
+
const { client } = await getClient(opts.space);
|
|
18
|
+
const doc = await getDocument(client, document);
|
|
19
|
+
outputResult(doc.attachments, opts, (data) => {
|
|
20
|
+
if (data.length === 0) {
|
|
21
|
+
consola.info("No attachments found.");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const rows = data.map((file) => [
|
|
25
|
+
{
|
|
26
|
+
header: "ID",
|
|
27
|
+
value: String(file.id)
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
header: "NAME",
|
|
31
|
+
value: file.name
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
header: "SIZE",
|
|
35
|
+
value: formatSize(file.size)
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
header: "CREATED BY",
|
|
39
|
+
value: file.createdUser?.name ?? "Unknown"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
header: "CREATED",
|
|
43
|
+
value: formatDate(file.created)
|
|
44
|
+
}
|
|
45
|
+
]);
|
|
46
|
+
printTable(rows);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
//#endregion
|
|
50
|
+
export { attachments as default };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { y as getClient } from "./src-CTD9-bSB.mjs";
|
|
2
|
+
import { t as outputResult } from "./output-DBvfyU1J.mjs";
|
|
3
|
+
import { r as printTable } from "./src-CP4YLIAh.mjs";
|
|
4
|
+
import { n as formatSize, t as formatDate } from "./format-DHAR0n3J.mjs";
|
|
5
|
+
import { n as ENV_AUTH, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
6
|
+
import { S as space, u as json } from "./common-options-BuYWxYdO.mjs";
|
|
7
|
+
import consola from "consola";
|
|
8
|
+
import { getIssueAttachments } from "backlog-js";
|
|
9
|
+
//#region src/commands/issue/attachments.ts
|
|
10
|
+
const attachments = new BeeCommand("attachments").summary("List issue attachments").description(`Shows file name, size, creator, and creation date.`).argument("<issue>", "Issue ID or issue key").addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([{
|
|
11
|
+
description: "List attachments",
|
|
12
|
+
command: "bee issue attachments PROJECT-123"
|
|
13
|
+
}, {
|
|
14
|
+
description: "Output as JSON",
|
|
15
|
+
command: "bee issue attachments PROJECT-123 --json"
|
|
16
|
+
}]).action(async (issue, opts) => {
|
|
17
|
+
const { client } = await getClient(opts.space);
|
|
18
|
+
const files = await getIssueAttachments(client, issue);
|
|
19
|
+
outputResult(files, opts, (data) => {
|
|
20
|
+
if (data.length === 0) {
|
|
21
|
+
consola.info("No attachments found.");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const rows = data.map((file) => [
|
|
25
|
+
{
|
|
26
|
+
header: "ID",
|
|
27
|
+
value: String(file.id)
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
header: "NAME",
|
|
31
|
+
value: file.name
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
header: "SIZE",
|
|
35
|
+
value: formatSize(file.size)
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
header: "CREATED BY",
|
|
39
|
+
value: file.createdUser?.name ?? "Unknown"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
header: "CREATED",
|
|
43
|
+
value: formatDate(file.created)
|
|
44
|
+
}
|
|
45
|
+
]);
|
|
46
|
+
printTable(rows);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
//#endregion
|
|
50
|
+
export { attachments 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 { a as parseArg, r as printTable, s as vInteger } from "./src-CP4YLIAh.mjs";
|
|
4
|
+
import { t as formatDate } from "./format-DHAR0n3J.mjs";
|
|
5
|
+
import { n as ENV_AUTH, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
6
|
+
import { S as space, u as json } from "./common-options-BuYWxYdO.mjs";
|
|
7
|
+
import consola from "consola";
|
|
8
|
+
import { getWikisAttachments } from "backlog-js";
|
|
9
|
+
//#region src/commands/wiki/attachments.ts
|
|
10
|
+
const attachments = new BeeCommand("attachments").summary("List wiki page attachments").description(`Shows file name, size, creator, and creation date.`).argument("<wiki>", "Wiki page ID").addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([{
|
|
11
|
+
description: "List wiki attachments",
|
|
12
|
+
command: "bee wiki attachments 12345"
|
|
13
|
+
}, {
|
|
14
|
+
description: "Output as JSON",
|
|
15
|
+
command: "bee wiki attachments 12345 --json"
|
|
16
|
+
}]).action(async (wiki, opts) => {
|
|
17
|
+
const { client } = await getClient(opts.space);
|
|
18
|
+
const files = await getWikisAttachments(client, parseArg(vInteger, wiki, "wiki"));
|
|
19
|
+
outputResult(files, opts, (data) => {
|
|
20
|
+
if (data.length === 0) {
|
|
21
|
+
consola.info("No attachments found.");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const rows = data.map((f) => [
|
|
25
|
+
{
|
|
26
|
+
header: "NAME",
|
|
27
|
+
value: f.name
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
header: "SIZE",
|
|
31
|
+
value: String(f.size)
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
header: "CREATED BY",
|
|
35
|
+
value: f.createdUser.name
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
header: "CREATED",
|
|
39
|
+
value: formatDate(f.created)
|
|
40
|
+
}
|
|
41
|
+
]);
|
|
42
|
+
printTable(rows);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
//#endregion
|
|
46
|
+
export { attachments as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
2
|
+
//#region src/commands/auth/index.ts
|
|
3
|
+
const auth = new BeeCommand("auth").summary("Authenticate bee with Backlog");
|
|
4
|
+
await auth.addCommands([
|
|
5
|
+
import("./login-BnJYzdR3.mjs"),
|
|
6
|
+
import("./logout-YMnSRLLF.mjs"),
|
|
7
|
+
import("./status-nI4Dpcoo.mjs"),
|
|
8
|
+
import("./token-BmkUX9vc.mjs"),
|
|
9
|
+
import("./refresh-DDU2ZLnc.mjs"),
|
|
10
|
+
import("./switch-CMLfVGDN.mjs")
|
|
11
|
+
]);
|
|
12
|
+
//#endregion
|
|
13
|
+
export { auth as default };
|