bamboo-agents 0.1.2 → 0.1.3
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/VERSION +1 -1
- package/dist/index.js +45 -6
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.3
|
package/dist/index.js
CHANGED
|
@@ -3037,7 +3037,7 @@ var VERSION;
|
|
|
3037
3037
|
var init_version = __esm({
|
|
3038
3038
|
"src/version.ts"() {
|
|
3039
3039
|
"use strict";
|
|
3040
|
-
VERSION = "0.1.
|
|
3040
|
+
VERSION = "0.1.3";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -11450,10 +11450,23 @@ async function getCliAuthStatus(bambooSession) {
|
|
|
11450
11450
|
const json = await res.json();
|
|
11451
11451
|
return AuthStatusResponseSchema.parse(json);
|
|
11452
11452
|
}
|
|
11453
|
-
|
|
11453
|
+
async function startGithubOAuthRelink(bambooSession) {
|
|
11454
|
+
const res = await cliApiFetch(
|
|
11455
|
+
`${apiBase()}/api/auth/github/oauth-relink/start`,
|
|
11456
|
+
{
|
|
11457
|
+
method: "POST",
|
|
11458
|
+
headers: { Authorization: `Bearer ${bambooSession}` }
|
|
11459
|
+
}
|
|
11460
|
+
);
|
|
11461
|
+
if (!res.ok) throw await parseError(res);
|
|
11462
|
+
const json = await res.json();
|
|
11463
|
+
return OAuthRelinkStartResponseSchema.parse(json);
|
|
11464
|
+
}
|
|
11465
|
+
var DEFAULT_BASE, REQUEST_TIMEOUT_MS, ApiError, OAuthRelinkStartResponseSchema;
|
|
11454
11466
|
var init_api = __esm({
|
|
11455
11467
|
"src/lib/api.ts"() {
|
|
11456
11468
|
"use strict";
|
|
11469
|
+
init_zod();
|
|
11457
11470
|
init_auth_token();
|
|
11458
11471
|
init_auth_status();
|
|
11459
11472
|
init_version();
|
|
@@ -11467,6 +11480,9 @@ var init_api = __esm({
|
|
|
11467
11480
|
this.name = "ApiError";
|
|
11468
11481
|
}
|
|
11469
11482
|
};
|
|
11483
|
+
OAuthRelinkStartResponseSchema = external_exports.object({
|
|
11484
|
+
relink_url: external_exports.string().url()
|
|
11485
|
+
});
|
|
11470
11486
|
}
|
|
11471
11487
|
});
|
|
11472
11488
|
|
|
@@ -11530,6 +11546,7 @@ var init_credentials = __esm({
|
|
|
11530
11546
|
// src/commands/login.ts
|
|
11531
11547
|
var login_exports = {};
|
|
11532
11548
|
__export(login_exports, {
|
|
11549
|
+
handleMissingGithubToken: () => handleMissingGithubToken,
|
|
11533
11550
|
runLogin: () => runLogin,
|
|
11534
11551
|
startCallbackServer: () => startCallbackServer,
|
|
11535
11552
|
verificationCode: () => verificationCode
|
|
@@ -11542,6 +11559,26 @@ function verificationCode(state) {
|
|
|
11542
11559
|
const head = state.slice(0, 8).toUpperCase();
|
|
11543
11560
|
return `${head.slice(0, 4)}-${head.slice(4, 8)}`;
|
|
11544
11561
|
}
|
|
11562
|
+
async function handleMissingGithubToken(bambooSession) {
|
|
11563
|
+
try {
|
|
11564
|
+
const { relink_url } = await startGithubOAuthRelink(bambooSession);
|
|
11565
|
+
await open_default(relink_url);
|
|
11566
|
+
console.log("");
|
|
11567
|
+
console.log(
|
|
11568
|
+
" After authorizing in your browser, re-run `bamboo-agents login`."
|
|
11569
|
+
);
|
|
11570
|
+
console.log("");
|
|
11571
|
+
return 0;
|
|
11572
|
+
} catch {
|
|
11573
|
+
console.log("");
|
|
11574
|
+
console.log(
|
|
11575
|
+
` Couldn't start GitHub re-link automatically. Open this URL in your browser, then re-run \`bamboo-agents login\`:`
|
|
11576
|
+
);
|
|
11577
|
+
console.log(` ${FALLBACK_RELINK_URL}`);
|
|
11578
|
+
console.log("");
|
|
11579
|
+
return 1;
|
|
11580
|
+
}
|
|
11581
|
+
}
|
|
11545
11582
|
async function startCallbackServer(expectedState) {
|
|
11546
11583
|
let resolveSession;
|
|
11547
11584
|
let rejectSession;
|
|
@@ -11649,10 +11686,11 @@ async function runLogin() {
|
|
|
11649
11686
|
tokenResp = await getGithubToken(bambooSession);
|
|
11650
11687
|
} catch (err) {
|
|
11651
11688
|
if (err instanceof ApiError && err.status === 404) {
|
|
11652
|
-
tokenSpinner.
|
|
11653
|
-
"No GitHub token linked yet
|
|
11689
|
+
tokenSpinner.warn(
|
|
11690
|
+
"No GitHub token linked yet \u2014 opening browser to authorize Bamboo with GitHub\u2026"
|
|
11654
11691
|
);
|
|
11655
|
-
|
|
11692
|
+
const code2 = await handleMissingGithubToken(bambooSession);
|
|
11693
|
+
process.exit(code2);
|
|
11656
11694
|
}
|
|
11657
11695
|
if (err instanceof ApiError && err.status === 410) {
|
|
11658
11696
|
tokenSpinner.fail("Your GitHub token expired. Sign in to Bamboo with GitHub again, then re-run.");
|
|
@@ -11676,7 +11714,7 @@ async function runLogin() {
|
|
|
11676
11714
|
console.log(" Next: `bamboo-agents init` to clone your workspace.");
|
|
11677
11715
|
console.log("");
|
|
11678
11716
|
}
|
|
11679
|
-
var LOGIN_TIMEOUT_MS;
|
|
11717
|
+
var FALLBACK_RELINK_URL, LOGIN_TIMEOUT_MS;
|
|
11680
11718
|
var init_login = __esm({
|
|
11681
11719
|
"src/commands/login.ts"() {
|
|
11682
11720
|
"use strict";
|
|
@@ -11684,6 +11722,7 @@ var init_login = __esm({
|
|
|
11684
11722
|
init_ora();
|
|
11685
11723
|
init_api();
|
|
11686
11724
|
init_credentials();
|
|
11725
|
+
FALLBACK_RELINK_URL = "https://withbamboo.com/connect-github";
|
|
11687
11726
|
LOGIN_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
11688
11727
|
}
|
|
11689
11728
|
});
|