@nulab/bee 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-kJR0fRPw.mjs +143 -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-yfcnEl7k.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-CiIzSyoS.mjs +13 -0
- package/dist/edit-BBvSbt0m.mjs +22 -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/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-B0ZQfBD5.mjs +35 -0
- package/dist/registry-RATsKPUm.mjs +2 -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 +13 -10
- 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
package/dist/chunks/add2.mjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
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 '../index.mjs';
|
|
6
|
-
import { g as getClient } from '../shared/bee.RsR9yniy.mjs';
|
|
7
|
-
import 'backlog-js';
|
|
8
|
-
import 'node:http';
|
|
9
|
-
import 'open';
|
|
10
|
-
import 'node:child_process';
|
|
11
|
-
import { B as BeeCommand, E as ENV_AUTH } from '../shared/bee.KteAW2rM.mjs';
|
|
12
|
-
import { j as json, s as space } from '../shared/bee.CHtg3F43.mjs';
|
|
13
|
-
import 'node:fs';
|
|
14
|
-
import 'node:path';
|
|
15
|
-
import 'node:os';
|
|
16
|
-
import 'node:module';
|
|
17
|
-
import 'commander';
|
|
18
|
-
import 'consola/utils';
|
|
19
|
-
import '../shared/bee.CktwmH8R.mjs';
|
|
20
|
-
import '../shared/bee.CAARNIp6.mjs';
|
|
21
|
-
|
|
22
|
-
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([
|
|
23
|
-
{ description: "Watch an issue", command: "bee watching add --issue PROJECT-123" },
|
|
24
|
-
{
|
|
25
|
-
description: "Watch an issue with a note",
|
|
26
|
-
command: 'bee watching add --issue PROJECT-123 --note "Track progress"'
|
|
27
|
-
}
|
|
28
|
-
]).action(async (opts) => {
|
|
29
|
-
const { client } = await getClient(opts.space);
|
|
30
|
-
const result = await client.postWatchingListItem({
|
|
31
|
-
issueIdOrKey: opts.issue,
|
|
32
|
-
note: opts.note ?? ""
|
|
33
|
-
});
|
|
34
|
-
outputResult(result, opts, (data) => {
|
|
35
|
-
consola.success(`Added watching for issue ${data.issue.issueKey} (ID: ${data.id}).`);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export { add as default };
|
package/dist/chunks/api.mjs
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { text } from 'node:stream/consumers';
|
|
3
|
-
import 'consola';
|
|
4
|
-
import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
|
|
5
|
-
import { U as UserError, a as vFiniteNumber } from '../index.mjs';
|
|
6
|
-
import * as v from 'valibot';
|
|
7
|
-
import { g as getClient } from '../shared/bee.RsR9yniy.mjs';
|
|
8
|
-
import 'backlog-js';
|
|
9
|
-
import 'node:http';
|
|
10
|
-
import 'open';
|
|
11
|
-
import 'node:child_process';
|
|
12
|
-
import { B as BeeCommand, E as ENV_AUTH } from '../shared/bee.KteAW2rM.mjs';
|
|
13
|
-
import { c as collect, s as space } from '../shared/bee.CHtg3F43.mjs';
|
|
14
|
-
import 'node:fs';
|
|
15
|
-
import 'node:path';
|
|
16
|
-
import 'node:os';
|
|
17
|
-
import 'node:module';
|
|
18
|
-
import 'commander';
|
|
19
|
-
import 'consola/utils';
|
|
20
|
-
import '../shared/bee.CktwmH8R.mjs';
|
|
21
|
-
import '../shared/bee.CAARNIp6.mjs';
|
|
22
|
-
|
|
23
|
-
const api = new BeeCommand("api").summary("Make an authenticated API request").description(
|
|
24
|
-
`The endpoint is a Backlog API path (e.g. \`users/myself\`). A leading \`/api/v2/\` prefix is stripped automatically.
|
|
25
|
-
|
|
26
|
-
\`-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\`).
|
|
27
|
-
|
|
28
|
-
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.
|
|
29
|
-
|
|
30
|
-
For GET, fields are query parameters. For POST/PUT/PATCH/DELETE, fields are the request body.`
|
|
31
|
-
).argument("<endpoint>", "API endpoint path").option("-X, --method <method>", "HTTP method", "GET").option(
|
|
32
|
-
"-f, --field <key=value>",
|
|
33
|
-
'Add a typed parameter (use "@<path>" or "@-" to read value from file or stdin)',
|
|
34
|
-
collect,
|
|
35
|
-
[]
|
|
36
|
-
).option(
|
|
37
|
-
"-F, --raw-field <key=value>",
|
|
38
|
-
"Add a string parameter (key=value, repeatable)",
|
|
39
|
-
collect,
|
|
40
|
-
[]
|
|
41
|
-
).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([
|
|
42
|
-
{ description: "Get your user profile", command: "bee api users/myself" },
|
|
43
|
-
{
|
|
44
|
-
description: "List issues in a project",
|
|
45
|
-
command: "bee api issues -f 'projectId[]=12345' -f count=5"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
description: "Filter by multiple statuses",
|
|
49
|
-
command: "bee api issues -f 'projectId[]=12345' -f statusId=1 -f statusId=2"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
description: "Create an issue",
|
|
53
|
-
command: 'bee api issues -X POST -f projectId=12345 -f summary="Test issue" -f issueTypeId=1 -f priorityId=3'
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
description: "Set a field value from a file",
|
|
57
|
-
command: "bee api issues/PROJECT-1 -X PATCH -f 'description=@desc.md'"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
description: "Pipe content from stdin",
|
|
61
|
-
command: "echo 'Hello' | bee api issues/PROJECT-1/comments -X POST -f 'content=@-'"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
description: "Select specific fields",
|
|
65
|
-
command: "bee api users/myself --json id,name,mailAddress"
|
|
66
|
-
}
|
|
67
|
-
]).action(async (endpoint, opts) => {
|
|
68
|
-
const { client } = await getClient(opts.space);
|
|
69
|
-
const method = opts.method.toUpperCase();
|
|
70
|
-
const normalizedEndpoint = normalizeEndpoint(endpoint);
|
|
71
|
-
const params = await buildParams(opts.field, opts.rawField);
|
|
72
|
-
const data = await makeRequest(client, method, normalizedEndpoint, params);
|
|
73
|
-
if (opts.silent) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const jsonVal = typeof opts.json === "string" ? opts.json : "";
|
|
77
|
-
outputResult(data, { json: jsonVal }, () => {
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
const normalizeEndpoint = (endpoint) => {
|
|
81
|
-
const stripped = endpoint.replace(/^\/?(api\/v2\/?)/, "");
|
|
82
|
-
return stripped;
|
|
83
|
-
};
|
|
84
|
-
const readFieldValue = async (ref) => {
|
|
85
|
-
if (ref === "-") {
|
|
86
|
-
return text(process.stdin);
|
|
87
|
-
}
|
|
88
|
-
if (ref === "") {
|
|
89
|
-
throw new UserError(
|
|
90
|
-
'Invalid file reference: "@". Provide a file path after @ or use @- for stdin.'
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
try {
|
|
94
|
-
return await readFile(ref, "utf8");
|
|
95
|
-
} catch (error) {
|
|
96
|
-
const { code } = error;
|
|
97
|
-
if (code === "ENOENT") {
|
|
98
|
-
throw new UserError(`File not found: ${ref}`);
|
|
99
|
-
}
|
|
100
|
-
if (code === "EISDIR") {
|
|
101
|
-
throw new UserError(`Expected a file but got a directory: ${ref}`);
|
|
102
|
-
}
|
|
103
|
-
throw error;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
const buildParams = async (fields, rawFields) => {
|
|
107
|
-
const params = {};
|
|
108
|
-
const addParam = (rawKey, value) => {
|
|
109
|
-
const isArray = rawKey.endsWith("[]");
|
|
110
|
-
const key = isArray ? rawKey.slice(0, -2) : rawKey;
|
|
111
|
-
const existing = params[key];
|
|
112
|
-
if (existing === void 0) {
|
|
113
|
-
params[key] = isArray ? [value] : value;
|
|
114
|
-
} else {
|
|
115
|
-
params[key] = Array.isArray(existing) ? [...existing, value] : [existing, value];
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
for (const pair of fields) {
|
|
119
|
-
const eqIndex = pair.indexOf("=");
|
|
120
|
-
if (eqIndex === -1) {
|
|
121
|
-
throw new UserError(`Invalid field format: "${pair}". Expected key=value.`);
|
|
122
|
-
}
|
|
123
|
-
const rawValue = pair.slice(eqIndex + 1);
|
|
124
|
-
const value = rawValue.startsWith("@") ? await readFieldValue(rawValue.slice(1)) : inferType(rawValue);
|
|
125
|
-
addParam(pair.slice(0, eqIndex), value);
|
|
126
|
-
}
|
|
127
|
-
for (const pair of rawFields) {
|
|
128
|
-
const eqIndex = pair.indexOf("=");
|
|
129
|
-
if (eqIndex === -1) {
|
|
130
|
-
throw new UserError(`Invalid field format: "${pair}". Expected key=value.`);
|
|
131
|
-
}
|
|
132
|
-
addParam(pair.slice(0, eqIndex), pair.slice(eqIndex + 1));
|
|
133
|
-
}
|
|
134
|
-
return params;
|
|
135
|
-
};
|
|
136
|
-
const inferType = (value) => {
|
|
137
|
-
if (value === "true") {
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
if (value === "false") {
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
if (value !== "") {
|
|
144
|
-
const result = v.safeParse(vFiniteNumber, value);
|
|
145
|
-
if (result.success && String(result.output) === value) {
|
|
146
|
-
return result.output;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return value;
|
|
150
|
-
};
|
|
151
|
-
const makeRequest = async (client, method, endpoint, params) => {
|
|
152
|
-
switch (method) {
|
|
153
|
-
case "GET": {
|
|
154
|
-
return client.get(endpoint, params);
|
|
155
|
-
}
|
|
156
|
-
case "POST": {
|
|
157
|
-
return client.post(endpoint, params);
|
|
158
|
-
}
|
|
159
|
-
case "PUT": {
|
|
160
|
-
return client.put(endpoint, params);
|
|
161
|
-
}
|
|
162
|
-
case "PATCH": {
|
|
163
|
-
return client.patch(endpoint, params);
|
|
164
|
-
}
|
|
165
|
-
case "DELETE": {
|
|
166
|
-
return client.delete(endpoint, params);
|
|
167
|
-
}
|
|
168
|
-
default: {
|
|
169
|
-
throw new UserError(`Unsupported HTTP method: ${method}`);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
export { api as default };
|
|
@@ -1,47 +0,0 @@
|
|
|
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 '../index.mjs';
|
|
6
|
-
import { a as formatSize, f as formatDate } from '../shared/bee.n5MYN4a6.mjs';
|
|
7
|
-
import { p as printTable } from '../shared/bee.a05kNWpn.mjs';
|
|
8
|
-
import { g as getClient } from '../shared/bee.RsR9yniy.mjs';
|
|
9
|
-
import 'backlog-js';
|
|
10
|
-
import 'node:http';
|
|
11
|
-
import 'open';
|
|
12
|
-
import 'node:child_process';
|
|
13
|
-
import { B as BeeCommand, E as ENV_AUTH } from '../shared/bee.KteAW2rM.mjs';
|
|
14
|
-
import { j as json, s as space } from '../shared/bee.CHtg3F43.mjs';
|
|
15
|
-
import 'node:fs';
|
|
16
|
-
import 'node:path';
|
|
17
|
-
import 'node:os';
|
|
18
|
-
import 'node:module';
|
|
19
|
-
import 'commander';
|
|
20
|
-
import 'consola/utils';
|
|
21
|
-
import '../shared/bee.DFnSWb6q.mjs';
|
|
22
|
-
import '../shared/bee.CktwmH8R.mjs';
|
|
23
|
-
import '../shared/bee.CAARNIp6.mjs';
|
|
24
|
-
|
|
25
|
-
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([
|
|
26
|
-
{ description: "List attachments", command: "bee issue attachments PROJECT-123" },
|
|
27
|
-
{ description: "Output as JSON", command: "bee issue attachments PROJECT-123 --json" }
|
|
28
|
-
]).action(async (issue, opts) => {
|
|
29
|
-
const { client } = await getClient(opts.space);
|
|
30
|
-
const files = await client.getIssueAttachments(issue);
|
|
31
|
-
outputResult(files, opts, (data) => {
|
|
32
|
-
if (data.length === 0) {
|
|
33
|
-
consola.info("No attachments found.");
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const rows = data.map((file) => [
|
|
37
|
-
{ header: "ID", value: String(file.id) },
|
|
38
|
-
{ header: "NAME", value: file.name },
|
|
39
|
-
{ header: "SIZE", value: formatSize(file.size) },
|
|
40
|
-
{ header: "CREATED BY", value: file.createdUser?.name ?? "Unknown" },
|
|
41
|
-
{ header: "CREATED", value: formatDate(file.created) }
|
|
42
|
-
]);
|
|
43
|
-
printTable(rows);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export { attachments as default };
|
|
@@ -1,47 +0,0 @@
|
|
|
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 '../index.mjs';
|
|
6
|
-
import { a as formatSize, f as formatDate } from '../shared/bee.n5MYN4a6.mjs';
|
|
7
|
-
import { p as printTable } from '../shared/bee.a05kNWpn.mjs';
|
|
8
|
-
import { g as getClient } from '../shared/bee.RsR9yniy.mjs';
|
|
9
|
-
import 'backlog-js';
|
|
10
|
-
import 'node:http';
|
|
11
|
-
import 'open';
|
|
12
|
-
import 'node:child_process';
|
|
13
|
-
import { B as BeeCommand, E as ENV_AUTH } from '../shared/bee.KteAW2rM.mjs';
|
|
14
|
-
import { j as json, s as space } from '../shared/bee.CHtg3F43.mjs';
|
|
15
|
-
import 'node:fs';
|
|
16
|
-
import 'node:path';
|
|
17
|
-
import 'node:os';
|
|
18
|
-
import 'node:module';
|
|
19
|
-
import 'commander';
|
|
20
|
-
import 'consola/utils';
|
|
21
|
-
import '../shared/bee.DFnSWb6q.mjs';
|
|
22
|
-
import '../shared/bee.CktwmH8R.mjs';
|
|
23
|
-
import '../shared/bee.CAARNIp6.mjs';
|
|
24
|
-
|
|
25
|
-
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([
|
|
26
|
-
{ description: "List attachments", command: "bee document attachments 12345" },
|
|
27
|
-
{ description: "Output as JSON", command: "bee document attachments 12345 --json" }
|
|
28
|
-
]).action(async (document, opts) => {
|
|
29
|
-
const { client } = await getClient(opts.space);
|
|
30
|
-
const doc = await client.getDocument(document);
|
|
31
|
-
outputResult(doc.attachments, opts, (data) => {
|
|
32
|
-
if (data.length === 0) {
|
|
33
|
-
consola.info("No attachments found.");
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const rows = data.map((file) => [
|
|
37
|
-
{ header: "ID", value: String(file.id) },
|
|
38
|
-
{ header: "NAME", value: file.name },
|
|
39
|
-
{ header: "SIZE", value: formatSize(file.size) },
|
|
40
|
-
{ header: "CREATED BY", value: file.createdUser?.name ?? "Unknown" },
|
|
41
|
-
{ header: "CREATED", value: formatDate(file.created) }
|
|
42
|
-
]);
|
|
43
|
-
printTable(rows);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export { attachments as default };
|
|
@@ -1,48 +0,0 @@
|
|
|
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 { p as parseArg, v as vInteger } from '../index.mjs';
|
|
6
|
-
import { f as formatDate } from '../shared/bee.n5MYN4a6.mjs';
|
|
7
|
-
import { p as printTable } from '../shared/bee.a05kNWpn.mjs';
|
|
8
|
-
import { g as getClient } from '../shared/bee.RsR9yniy.mjs';
|
|
9
|
-
import 'backlog-js';
|
|
10
|
-
import 'node:http';
|
|
11
|
-
import 'open';
|
|
12
|
-
import 'node:child_process';
|
|
13
|
-
import { B as BeeCommand, E as ENV_AUTH } from '../shared/bee.KteAW2rM.mjs';
|
|
14
|
-
import { j as json, s as space } from '../shared/bee.CHtg3F43.mjs';
|
|
15
|
-
import 'node:fs';
|
|
16
|
-
import 'node:path';
|
|
17
|
-
import 'node:os';
|
|
18
|
-
import 'node:module';
|
|
19
|
-
import 'commander';
|
|
20
|
-
import 'consola/utils';
|
|
21
|
-
import '../shared/bee.DFnSWb6q.mjs';
|
|
22
|
-
import '../shared/bee.CktwmH8R.mjs';
|
|
23
|
-
import '../shared/bee.CAARNIp6.mjs';
|
|
24
|
-
|
|
25
|
-
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([
|
|
26
|
-
{ description: "List wiki attachments", command: "bee wiki attachments 12345" },
|
|
27
|
-
{ description: "Output as JSON", command: "bee wiki attachments 12345 --json" }
|
|
28
|
-
]).action(async (wiki, opts) => {
|
|
29
|
-
const { client } = await getClient(opts.space);
|
|
30
|
-
const files = await client.getWikisAttachments(parseArg(vInteger, wiki, "wiki"));
|
|
31
|
-
outputResult(files, opts, (data) => {
|
|
32
|
-
if (data.length === 0) {
|
|
33
|
-
consola.info("No attachments found.");
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const rows = data.map(
|
|
37
|
-
(f) => [
|
|
38
|
-
{ header: "NAME", value: f.name },
|
|
39
|
-
{ header: "SIZE", value: String(f.size) },
|
|
40
|
-
{ header: "CREATED BY", value: f.createdUser.name },
|
|
41
|
-
{ header: "CREATED", value: formatDate(f.created) }
|
|
42
|
-
]
|
|
43
|
-
);
|
|
44
|
-
printTable(rows);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export { attachments as default };
|
package/dist/chunks/browse.mjs
DELETED
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import consola from 'consola';
|
|
2
|
-
import { p as parseArg, v as vInteger, U as UserError } from '../index.mjs';
|
|
3
|
-
import 'node:stream/consumers';
|
|
4
|
-
import 'valibot';
|
|
5
|
-
import { g as getClient } from '../shared/bee.RsR9yniy.mjs';
|
|
6
|
-
import 'backlog-js';
|
|
7
|
-
import 'node:http';
|
|
8
|
-
import { i as issueUrl, b as buildBacklogUrl, p as projectUrl, r as repositoryUrl, d as dashboardUrl, g as gitCommitUrl, a as gitTreeUrl, c as gitBlobUrl, o as openOrPrintUrl } from '../shared/bee.CzKcWSES.mjs';
|
|
9
|
-
import { execFile } from 'node:child_process';
|
|
10
|
-
import { B as BeeCommand, E as ENV_AUTH, a as ENV_PROJECT } from '../shared/bee.KteAW2rM.mjs';
|
|
11
|
-
import { p as projectOptional, n as noBrowser, s as space } from '../shared/bee.CHtg3F43.mjs';
|
|
12
|
-
import 'node:fs';
|
|
13
|
-
import 'node:path';
|
|
14
|
-
import 'node:os';
|
|
15
|
-
import 'open';
|
|
16
|
-
import 'node:module';
|
|
17
|
-
import 'commander';
|
|
18
|
-
import 'consola/utils';
|
|
19
|
-
import '../shared/bee.CktwmH8R.mjs';
|
|
20
|
-
import '../shared/bee.CAARNIp6.mjs';
|
|
21
|
-
|
|
22
|
-
const parseBacklogRemoteUrl = (url) => {
|
|
23
|
-
const sshUrlMatch = url.match(
|
|
24
|
-
/^ssh:\/\/[^@]+@([^.]+)\.git\.(backlog\.(?:com|jp))\/([^/]+)\/([^/.]+?)(?:\.git)?$/
|
|
25
|
-
);
|
|
26
|
-
if (sshUrlMatch) {
|
|
27
|
-
const [, space, domain, projectKey, repoName] = sshUrlMatch;
|
|
28
|
-
return {
|
|
29
|
-
host: `${space}.${domain}`,
|
|
30
|
-
projectKey,
|
|
31
|
-
repoName
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
const scpMatch = url.match(
|
|
35
|
-
/^[^@]+@([^.]+)\.git\.(backlog\.(?:com|jp)):\/?([^/]+)\/([^/.]+?)(?:\.git)?$/
|
|
36
|
-
);
|
|
37
|
-
if (scpMatch) {
|
|
38
|
-
const [, space, domain, projectKey, repoName] = scpMatch;
|
|
39
|
-
return {
|
|
40
|
-
host: `${space}.${domain}`,
|
|
41
|
-
projectKey,
|
|
42
|
-
repoName
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
const httpsMatch = url.match(
|
|
46
|
-
/^https?:\/\/(.+\.backlog\.(?:com|jp))\/git\/([^/]+)\/([^/]+?)(?:\.git)?$/
|
|
47
|
-
);
|
|
48
|
-
if (httpsMatch) {
|
|
49
|
-
const [, host, projectKey, repoName] = httpsMatch;
|
|
50
|
-
return {
|
|
51
|
-
host,
|
|
52
|
-
projectKey,
|
|
53
|
-
repoName
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
return void 0;
|
|
57
|
-
};
|
|
58
|
-
const execGit = (args, cwd) => new Promise((resolve, reject) => {
|
|
59
|
-
execFile("git", args, { cwd }, (error, stdout) => {
|
|
60
|
-
if (error) {
|
|
61
|
-
reject(error);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
resolve(stdout.trim());
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
const detectGitContext = async (cwd) => {
|
|
68
|
-
try {
|
|
69
|
-
const remoteUrl = await execGit(["remote", "get-url", "origin"], cwd);
|
|
70
|
-
return parseBacklogRemoteUrl(remoteUrl);
|
|
71
|
-
} catch {
|
|
72
|
-
return void 0;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
const getCurrentBranch = async (cwd) => {
|
|
76
|
-
try {
|
|
77
|
-
return await execGit(["rev-parse", "--abbrev-ref", "HEAD"], cwd);
|
|
78
|
-
} catch {
|
|
79
|
-
return void 0;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
const getLatestCommit = async (cwd) => {
|
|
83
|
-
try {
|
|
84
|
-
return await execGit(["rev-parse", "HEAD"], cwd);
|
|
85
|
-
} catch {
|
|
86
|
-
return void 0;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
const getRepoRelativePath = async (cwd) => {
|
|
90
|
-
try {
|
|
91
|
-
const prefix = await execGit(["rev-parse", "--show-prefix"], cwd);
|
|
92
|
-
return prefix || void 0;
|
|
93
|
-
} catch {
|
|
94
|
-
return void 0;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const ISSUE_KEY_PATTERN = /^[A-Z][A-Z0-9_]+-\d+$/;
|
|
99
|
-
const ISSUE_NUMBER_PATTERN = /^\d+$/;
|
|
100
|
-
const FILE_LINE_PATTERN = /^(.+):(\d+)$/;
|
|
101
|
-
const resolveUrl = (host, args, git) => {
|
|
102
|
-
if (args.target && ISSUE_KEY_PATTERN.test(args.target)) {
|
|
103
|
-
return { ok: true, url: issueUrl(host, args.target) };
|
|
104
|
-
}
|
|
105
|
-
if (args.target && ISSUE_NUMBER_PATTERN.test(args.target)) {
|
|
106
|
-
const projectKey2 = args.project ?? git.context?.projectKey;
|
|
107
|
-
if (projectKey2) {
|
|
108
|
-
return { ok: true, url: issueUrl(host, `${projectKey2}-${args.target}`) };
|
|
109
|
-
}
|
|
110
|
-
return {
|
|
111
|
-
ok: false,
|
|
112
|
-
error: "Cannot resolve issue number without a project. Use --project or run inside a Backlog repository."
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
if (args.target && isFilePath(args.target)) {
|
|
116
|
-
return resolveFileUrl(host, args, git);
|
|
117
|
-
}
|
|
118
|
-
const projectKey = args.target ?? args.project ?? git.context?.projectKey;
|
|
119
|
-
if (projectKey) {
|
|
120
|
-
if (args.issues) {
|
|
121
|
-
return { ok: true, url: buildBacklogUrl(host, `/find/${projectKey}`) };
|
|
122
|
-
}
|
|
123
|
-
if (args.board) {
|
|
124
|
-
return { ok: true, url: buildBacklogUrl(host, `/board/${projectKey}`) };
|
|
125
|
-
}
|
|
126
|
-
if (args.gantt) {
|
|
127
|
-
return { ok: true, url: buildBacklogUrl(host, `/gantt/${projectKey}`) };
|
|
128
|
-
}
|
|
129
|
-
if (args.wiki) {
|
|
130
|
-
return { ok: true, url: buildBacklogUrl(host, `/wiki/${projectKey}`) };
|
|
131
|
-
}
|
|
132
|
-
if (args.documents) {
|
|
133
|
-
return { ok: true, url: buildBacklogUrl(host, `/document/${projectKey}`) };
|
|
134
|
-
}
|
|
135
|
-
if (args.files) {
|
|
136
|
-
return { ok: true, url: buildBacklogUrl(host, `/file/${projectKey}`) };
|
|
137
|
-
}
|
|
138
|
-
if (args.git) {
|
|
139
|
-
return { ok: true, url: buildBacklogUrl(host, `/git/${projectKey}`) };
|
|
140
|
-
}
|
|
141
|
-
if (args.svn) {
|
|
142
|
-
return { ok: true, url: buildBacklogUrl(host, `/subversion/${projectKey}`) };
|
|
143
|
-
}
|
|
144
|
-
if (args.settings) {
|
|
145
|
-
return {
|
|
146
|
-
ok: true,
|
|
147
|
-
url: buildBacklogUrl(host, `/EditProject.action?project.id=${projectKey}`)
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (args.branch || args.commit) {
|
|
152
|
-
return resolveFileUrl(host, args, git);
|
|
153
|
-
}
|
|
154
|
-
if (args.target) {
|
|
155
|
-
return { ok: true, url: projectUrl(host, args.target) };
|
|
156
|
-
}
|
|
157
|
-
if (git.context) {
|
|
158
|
-
return {
|
|
159
|
-
ok: true,
|
|
160
|
-
url: repositoryUrl(host, git.context.projectKey, git.context.repoName)
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
return { ok: true, url: dashboardUrl(host) };
|
|
164
|
-
};
|
|
165
|
-
const isFilePath = (target) => {
|
|
166
|
-
if (target.includes("/")) {
|
|
167
|
-
return true;
|
|
168
|
-
}
|
|
169
|
-
if (FILE_LINE_PATTERN.test(target)) {
|
|
170
|
-
return true;
|
|
171
|
-
}
|
|
172
|
-
if (target.includes(".") && !ISSUE_KEY_PATTERN.test(target)) {
|
|
173
|
-
return true;
|
|
174
|
-
}
|
|
175
|
-
return false;
|
|
176
|
-
};
|
|
177
|
-
const resolveFileUrl = (host, args, git) => {
|
|
178
|
-
if (!git.context) {
|
|
179
|
-
return {
|
|
180
|
-
ok: false,
|
|
181
|
-
error: "Not inside a Backlog Git repository. Cannot resolve file path."
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
let ref;
|
|
185
|
-
if (args.commit) {
|
|
186
|
-
if (!git.latestCommit) {
|
|
187
|
-
return { ok: false, error: "Could not determine the latest commit." };
|
|
188
|
-
}
|
|
189
|
-
if (!args.target) {
|
|
190
|
-
return {
|
|
191
|
-
ok: true,
|
|
192
|
-
url: gitCommitUrl(host, git.context.projectKey, git.context.repoName, git.latestCommit)
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
ref = git.latestCommit;
|
|
196
|
-
} else if (args.branch) {
|
|
197
|
-
ref = args.branch;
|
|
198
|
-
} else {
|
|
199
|
-
ref = git.currentBranch ?? "main";
|
|
200
|
-
}
|
|
201
|
-
if (!args.target) {
|
|
202
|
-
return {
|
|
203
|
-
ok: true,
|
|
204
|
-
url: gitTreeUrl(host, git.context.projectKey, git.context.repoName, ref)
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
const lineMatch = args.target.match(FILE_LINE_PATTERN);
|
|
208
|
-
const filePath = lineMatch ? lineMatch[1] : args.target;
|
|
209
|
-
const line = lineMatch ? parseArg(vInteger, lineMatch[2], "line") : void 0;
|
|
210
|
-
const fullPath = git.repoRelativePath ? `${git.repoRelativePath}${filePath}` : filePath;
|
|
211
|
-
const isDir = filePath.endsWith("/");
|
|
212
|
-
if (isDir) {
|
|
213
|
-
return {
|
|
214
|
-
ok: true,
|
|
215
|
-
url: gitTreeUrl(
|
|
216
|
-
host,
|
|
217
|
-
git.context.projectKey,
|
|
218
|
-
git.context.repoName,
|
|
219
|
-
ref,
|
|
220
|
-
fullPath.replace(/\/$/, "")
|
|
221
|
-
)
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
return {
|
|
225
|
-
ok: true,
|
|
226
|
-
url: gitBlobUrl(host, git.context.projectKey, git.context.repoName, ref, fullPath, line)
|
|
227
|
-
};
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
const browse = new BeeCommand("browse").summary("Open a Backlog page in the browser").description(
|
|
231
|
-
`With no arguments, opens the repository page (inside a Backlog repo) or the dashboard.
|
|
232
|
-
|
|
233
|
-
Accepts an issue key (\`PROJECT-123\`), bare number (\`123\`, project inferred from Git remote), file path (\`src/main.ts\`), or path with line (\`src/main.ts:42\`). Paths ending with \`/\` open the directory tree. Use \`--project\` with section flags (e.g. \`--issues\`, \`--board\`) for project pages.`
|
|
234
|
-
).argument("[target]", "Issue key, issue number, file path, or project key").addOption(projectOptional()).option("-b, --branch <name>", "View file at a specific branch").option("-c, --commit", "View file at the latest commit").addOption(noBrowser()).option("--issues", "Open the issues page").option("--board", "Open the board page").option("--gantt", "Open the Gantt chart page").option("--wiki", "Open the wiki page").option("--documents", "Open the documents page").option("--files", "Open the shared files page").option("--git", "Open the git repositories page").option("--svn", "Open the Subversion page").option("--settings", "Open the project settings page").addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([
|
|
235
|
-
{ description: "Open repository page (in a Backlog repo)", command: "bee browse" },
|
|
236
|
-
{ description: "Open dashboard (outside a Backlog repo)", command: "bee browse" },
|
|
237
|
-
{ description: "Open an issue", command: "bee browse PROJECT-123" },
|
|
238
|
-
{ description: "Open issue by number (inferred project)", command: "bee browse 123" },
|
|
239
|
-
{ description: "Open a file in git viewer", command: "bee browse src/main.ts" },
|
|
240
|
-
{ description: "Open a file at a specific line", command: "bee browse src/main.ts:42" },
|
|
241
|
-
{ description: "Open a directory in git viewer", command: "bee browse src/" },
|
|
242
|
-
{ description: "Browse at a specific branch", command: "bee browse src/main.ts -b develop" },
|
|
243
|
-
{ description: "Browse at the latest commit", command: "bee browse -c" },
|
|
244
|
-
{ description: "Print URL without opening browser", command: "bee browse -n" },
|
|
245
|
-
{ description: "Open project issues page", command: "bee browse -p PROJECT --issues" },
|
|
246
|
-
{ description: "Open project board", command: "bee browse -p PROJECT --board" },
|
|
247
|
-
{ description: "Open Gantt chart", command: "bee browse -p PROJECT --gantt" }
|
|
248
|
-
]).action(async (target, opts) => {
|
|
249
|
-
const { host } = await getClient(opts.space);
|
|
250
|
-
const [context, currentBranch, latestCommit, repoRelativePath] = await Promise.all([
|
|
251
|
-
detectGitContext(),
|
|
252
|
-
getCurrentBranch(),
|
|
253
|
-
getLatestCommit(),
|
|
254
|
-
getRepoRelativePath()
|
|
255
|
-
]);
|
|
256
|
-
const browseArgs = { target, ...opts };
|
|
257
|
-
const result = resolveUrl(context?.host ?? host, browseArgs, {
|
|
258
|
-
context,
|
|
259
|
-
currentBranch,
|
|
260
|
-
latestCommit,
|
|
261
|
-
repoRelativePath
|
|
262
|
-
});
|
|
263
|
-
if (!result.ok) {
|
|
264
|
-
throw new UserError(result.error);
|
|
265
|
-
}
|
|
266
|
-
await openOrPrintUrl(result.url, opts.browser === false, consola);
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
export { browse as default };
|
package/dist/chunks/clone.mjs
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
|
-
import consola from 'consola';
|
|
3
|
-
import { o as outputResult } from '../shared/bee.BTBGpv4K.mjs';
|
|
4
|
-
import 'node:stream/consumers';
|
|
5
|
-
import 'valibot';
|
|
6
|
-
import '../index.mjs';
|
|
7
|
-
import { g as getClient } from '../shared/bee.RsR9yniy.mjs';
|
|
8
|
-
import 'backlog-js';
|
|
9
|
-
import 'node:http';
|
|
10
|
-
import 'open';
|
|
11
|
-
import { B as BeeCommand, E as ENV_AUTH, a as ENV_PROJECT } from '../shared/bee.KteAW2rM.mjs';
|
|
12
|
-
import { d as project, j as json, s as space, r as resolveOptions } from '../shared/bee.CHtg3F43.mjs';
|
|
13
|
-
import 'node:fs';
|
|
14
|
-
import 'node:path';
|
|
15
|
-
import 'node:os';
|
|
16
|
-
import 'node:module';
|
|
17
|
-
import 'commander';
|
|
18
|
-
import 'consola/utils';
|
|
19
|
-
import '../shared/bee.CktwmH8R.mjs';
|
|
20
|
-
import '../shared/bee.CAARNIp6.mjs';
|
|
21
|
-
|
|
22
|
-
const gitClone = (gitArgs) => new Promise((resolve, reject) => {
|
|
23
|
-
const child = spawn("git", gitArgs, { stdio: "inherit" });
|
|
24
|
-
child.on("close", (code) => {
|
|
25
|
-
if (code === 0) {
|
|
26
|
-
resolve();
|
|
27
|
-
} else {
|
|
28
|
-
reject(new Error(`git clone exited with code ${code}`));
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
const clone = new BeeCommand("clone").summary("Clone a repository").description(`By default the SSH URL is used; pass \`--http\` to clone over HTTPS instead.`).argument("<repository>", "Repository name or ID").addOption(project()).option("-d, --directory <path>", "Directory to clone into").option("--http", "Clone using HTTP URL instead of SSH").addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([
|
|
33
|
-
{ description: "Clone a repository", command: "bee repo clone api-server -p PROJECT_KEY" },
|
|
34
|
-
{
|
|
35
|
-
description: "Clone to a specific directory",
|
|
36
|
-
command: "bee repo clone api-server -p PROJECT_KEY --directory ./dest"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
description: "Clone using HTTP URL",
|
|
40
|
-
command: "bee repo clone api-server -p PROJECT_KEY --http"
|
|
41
|
-
}
|
|
42
|
-
]).action(async (repository, opts, cmd) => {
|
|
43
|
-
await resolveOptions(cmd);
|
|
44
|
-
const { client } = await getClient(opts.space);
|
|
45
|
-
const repo = await client.getGitRepository(opts.project, repository);
|
|
46
|
-
if (opts.json !== void 0) {
|
|
47
|
-
outputResult(repo, opts, () => {
|
|
48
|
-
});
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const cloneUrl = opts.http ? repo.httpUrl : repo.sshUrl;
|
|
52
|
-
const gitArgs = ["clone", cloneUrl];
|
|
53
|
-
if (opts.directory) {
|
|
54
|
-
gitArgs.push(opts.directory);
|
|
55
|
-
}
|
|
56
|
-
consola.info(`Cloning into '${opts.directory ?? repo.name}'...`);
|
|
57
|
-
await gitClone(gitArgs);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
export { clone as default };
|