bfi-cli 0.1.14 → 0.1.16
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/cli.mjs +15 -5
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -26,6 +26,8 @@ import { parse } from "yaml";
|
|
|
26
26
|
import { createHash as createHash$1 } from "crypto";
|
|
27
27
|
import { determineAgent } from "@vercel/detect-agent";
|
|
28
28
|
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
29
|
+
const GIT_HOST = process.env.BFI_GIT_HOST || "github.com";
|
|
30
|
+
const GIT_URL = `https://${GIT_HOST}`;
|
|
29
31
|
function getOwnerRepo(parsed) {
|
|
30
32
|
if (parsed.type === "local") return null;
|
|
31
33
|
const sshMatch = parsed.url.match(/^git@[^:]+:(.+)$/);
|
|
@@ -61,7 +63,7 @@ function parseOwnerRepo(ownerRepo) {
|
|
|
61
63
|
}
|
|
62
64
|
async function isRepoPrivate(owner, repo) {
|
|
63
65
|
try {
|
|
64
|
-
const res = await fetch(`https://api
|
|
66
|
+
const res = await fetch(`https://api.${GIT_HOST}/repos/${owner}/${repo}`);
|
|
65
67
|
if (!res.ok) return null;
|
|
66
68
|
return (await res.json()).private === true;
|
|
67
69
|
} catch {
|
|
@@ -141,7 +143,7 @@ function parseSource(input) {
|
|
|
141
143
|
const [, owner, repo, ref, subpath] = githubTreeWithPathMatch;
|
|
142
144
|
return {
|
|
143
145
|
type: "github",
|
|
144
|
-
url:
|
|
146
|
+
url: `${GIT_URL}/${owner}/${repo}.git`,
|
|
145
147
|
ref: ref || fragmentRef,
|
|
146
148
|
subpath: subpath ? sanitizeSubpath(subpath) : subpath
|
|
147
149
|
};
|
|
@@ -151,7 +153,7 @@ function parseSource(input) {
|
|
|
151
153
|
const [, owner, repo, ref] = githubTreeMatch;
|
|
152
154
|
return {
|
|
153
155
|
type: "github",
|
|
154
|
-
url:
|
|
156
|
+
url: `${GIT_URL}/${owner}/${repo}.git`,
|
|
155
157
|
ref: ref || fragmentRef
|
|
156
158
|
};
|
|
157
159
|
}
|
|
@@ -211,7 +213,7 @@ function parseSource(input) {
|
|
|
211
213
|
const [, owner, repo, skillFilter] = atSkillMatch;
|
|
212
214
|
return {
|
|
213
215
|
type: "github",
|
|
214
|
-
url:
|
|
216
|
+
url: `${GIT_URL}/${owner}/${repo}.git`,
|
|
215
217
|
...fragmentRef ? { ref: fragmentRef } : {},
|
|
216
218
|
skillFilter: fragmentSkillFilter || skillFilter
|
|
217
219
|
};
|
|
@@ -221,7 +223,7 @@ function parseSource(input) {
|
|
|
221
223
|
const [, owner, repo, subpath] = shorthandMatch;
|
|
222
224
|
return {
|
|
223
225
|
type: "github",
|
|
224
|
-
url:
|
|
226
|
+
url: `${GIT_URL}/${owner}/${repo}.git`,
|
|
225
227
|
...fragmentRef ? { ref: fragmentRef } : {},
|
|
226
228
|
subpath: subpath ? sanitizeSubpath(subpath) : subpath,
|
|
227
229
|
...fragmentSkillFilter ? { skillFilter: fragmentSkillFilter } : {}
|
|
@@ -8167,6 +8169,10 @@ async function dispatchSkillSubcommand(args, globalOpts) {
|
|
|
8167
8169
|
await runDocs(subArgs, globalOpts);
|
|
8168
8170
|
break;
|
|
8169
8171
|
case "auth":
|
|
8172
|
+
if (subArgs[0] === "logout") await runLogout();
|
|
8173
|
+
else if (subArgs[0] === "whoami") await runWhoami(globalOpts);
|
|
8174
|
+
else await runLogin(subArgs, globalOpts);
|
|
8175
|
+
break;
|
|
8170
8176
|
case "login":
|
|
8171
8177
|
await runLogin(subArgs, globalOpts);
|
|
8172
8178
|
break;
|
|
@@ -8240,6 +8246,10 @@ async function main() {
|
|
|
8240
8246
|
} catch {}
|
|
8241
8247
|
switch (command) {
|
|
8242
8248
|
case "auth":
|
|
8249
|
+
if (restArgs[0] === "logout") await runLogout();
|
|
8250
|
+
else if (restArgs[0] === "whoami") await runWhoami(globalOpts);
|
|
8251
|
+
else await runLogin(restArgs, globalOpts);
|
|
8252
|
+
break;
|
|
8243
8253
|
case "login":
|
|
8244
8254
|
await runLogin(restArgs, globalOpts);
|
|
8245
8255
|
break;
|