bamboo-agents 0.1.5-dev.14 → 0.1.5-dev.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/VERSION +1 -1
- package/dist/index.js +96 -7
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.5-dev.
|
|
1
|
+
0.1.5-dev.16
|
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.5-dev.
|
|
3040
|
+
VERSION = "0.1.5-dev.16";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -11406,6 +11406,24 @@ var init_auth_status = __esm({
|
|
|
11406
11406
|
}
|
|
11407
11407
|
});
|
|
11408
11408
|
|
|
11409
|
+
// ../../src/lib/api-contracts/cli/billing-status.ts
|
|
11410
|
+
var BillingStatusResponseSchema;
|
|
11411
|
+
var init_billing_status = __esm({
|
|
11412
|
+
"../../src/lib/api-contracts/cli/billing-status.ts"() {
|
|
11413
|
+
init_zod();
|
|
11414
|
+
BillingStatusResponseSchema = external_exports.object({
|
|
11415
|
+
/** Normalized billing state used by the CLI to decide write-block + copy. */
|
|
11416
|
+
state: external_exports.enum(["trialing", "active", "expired", "unknown"]),
|
|
11417
|
+
/** Whole days remaining on the trial. Only meaningful when state === 'trialing'. */
|
|
11418
|
+
trial_days_remaining: external_exports.number().int().nullable(),
|
|
11419
|
+
/** Best tier name we resolved for the org. Null when no subscription rows exist. */
|
|
11420
|
+
tier_name: external_exports.string().nullable(),
|
|
11421
|
+
/** Where to send the user to upgrade or recover from an expired sub. */
|
|
11422
|
+
billing_url: external_exports.string().url()
|
|
11423
|
+
});
|
|
11424
|
+
}
|
|
11425
|
+
});
|
|
11426
|
+
|
|
11409
11427
|
// src/lib/api.ts
|
|
11410
11428
|
import { platform as platform2 } from "node:os";
|
|
11411
11429
|
function defaultApiBase(version) {
|
|
@@ -11454,6 +11472,14 @@ async function getCliAuthStatus(bambooSession) {
|
|
|
11454
11472
|
const json = await res.json();
|
|
11455
11473
|
return AuthStatusResponseSchema.parse(json);
|
|
11456
11474
|
}
|
|
11475
|
+
async function getCliBillingStatus(bambooSession) {
|
|
11476
|
+
const res = await cliApiFetch(`${apiBase()}/api/cli/billing/status`, {
|
|
11477
|
+
headers: { Authorization: `Bearer ${bambooSession}` }
|
|
11478
|
+
});
|
|
11479
|
+
if (!res.ok) throw await parseError(res);
|
|
11480
|
+
const json = await res.json();
|
|
11481
|
+
return BillingStatusResponseSchema.parse(json);
|
|
11482
|
+
}
|
|
11457
11483
|
async function startGithubOAuthRelink(bambooSession) {
|
|
11458
11484
|
const res = await cliApiFetch(
|
|
11459
11485
|
`${apiBase()}/api/auth/github/oauth-relink/start`,
|
|
@@ -11482,6 +11508,7 @@ var init_api = __esm({
|
|
|
11482
11508
|
init_zod();
|
|
11483
11509
|
init_auth_token();
|
|
11484
11510
|
init_auth_status();
|
|
11511
|
+
init_billing_status();
|
|
11485
11512
|
init_version();
|
|
11486
11513
|
PROD_DEFAULT_BASE = "https://withbamboo.com";
|
|
11487
11514
|
DEV_DEFAULT_BASE = "https://dev.withbamboo.com";
|
|
@@ -11858,6 +11885,27 @@ async function checkGitCredentialForGitHub() {
|
|
|
11858
11885
|
proc.stdin?.end();
|
|
11859
11886
|
});
|
|
11860
11887
|
}
|
|
11888
|
+
async function getRepoRemoteUrl(repoPath, remoteName = "origin") {
|
|
11889
|
+
try {
|
|
11890
|
+
const { stdout } = await execFileP(
|
|
11891
|
+
"git",
|
|
11892
|
+
["-C", repoPath, "remote", "get-url", remoteName],
|
|
11893
|
+
{ encoding: "utf8" }
|
|
11894
|
+
);
|
|
11895
|
+
return stdout.trim() || null;
|
|
11896
|
+
} catch {
|
|
11897
|
+
return null;
|
|
11898
|
+
}
|
|
11899
|
+
}
|
|
11900
|
+
function remoteUrlMatchesRepo(remoteUrl, repoFullName) {
|
|
11901
|
+
const expected = repoFullName.replace(/\.git$/i, "").toLowerCase();
|
|
11902
|
+
const url = remoteUrl.trim().replace(/\.git$/i, "");
|
|
11903
|
+
const httpsMatch = url.match(/^https?:\/\/[^/]*github\.com\/(.+)$/i);
|
|
11904
|
+
if (httpsMatch && httpsMatch[1].toLowerCase() === expected) return true;
|
|
11905
|
+
const sshMatch = url.match(/^[^@]+@github\.com:(.+)$/i);
|
|
11906
|
+
if (sshMatch && sshMatch[1].toLowerCase() === expected) return true;
|
|
11907
|
+
return false;
|
|
11908
|
+
}
|
|
11861
11909
|
async function getGitConfig(key) {
|
|
11862
11910
|
try {
|
|
11863
11911
|
const { stdout } = await execFileP("git", ["config", "--global", "--get", key], {
|
|
@@ -12104,16 +12152,33 @@ async function runInit() {
|
|
|
12104
12152
|
} catch {
|
|
12105
12153
|
}
|
|
12106
12154
|
if (dirExists) {
|
|
12155
|
+
const existingRemote = await getRepoRemoteUrl(repoPath);
|
|
12156
|
+
const matches = existingRemote != null && remoteUrlMatchesRepo(existingRemote, membership.org.workspace_repo);
|
|
12157
|
+
if (matches) {
|
|
12158
|
+
await writeConfig({
|
|
12159
|
+
org_id: membership.org.id,
|
|
12160
|
+
org_name: membership.org.name,
|
|
12161
|
+
workspace_repo: membership.org.workspace_repo,
|
|
12162
|
+
repo_path: repoPath,
|
|
12163
|
+
installed_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
12164
|
+
});
|
|
12165
|
+
console.log("");
|
|
12166
|
+
console.log(` \u2713 Workspace already at ${repoPath}`);
|
|
12167
|
+
console.log(" (skipped clone \u2014 origin matches your workspace repo)");
|
|
12168
|
+
console.log(" Next: `bamboo-agents open` to launch Claude Code there.");
|
|
12169
|
+
console.log("");
|
|
12170
|
+
return;
|
|
12171
|
+
}
|
|
12107
12172
|
console.error(
|
|
12108
12173
|
`
|
|
12109
|
-
${repoPath} already exists.
|
|
12174
|
+
${repoPath} already exists and is NOT the right repo.
|
|
12110
12175
|
|
|
12111
|
-
|
|
12112
|
-
|
|
12176
|
+
` + (existingRemote ? ` Found origin: ${existingRemote}
|
|
12177
|
+
Expected: github.com/${membership.org.workspace_repo}
|
|
12113
12178
|
|
|
12114
|
-
|
|
12115
|
-
|
|
12116
|
-
`
|
|
12179
|
+
` : ` It's not a git repo (no origin remote).
|
|
12180
|
+
|
|
12181
|
+
`) + " Move or rename it, then re-run `bamboo-agents init`.\n"
|
|
12117
12182
|
);
|
|
12118
12183
|
process.exit(2);
|
|
12119
12184
|
}
|
|
@@ -12244,6 +12309,22 @@ var status_exports = {};
|
|
|
12244
12309
|
__export(status_exports, {
|
|
12245
12310
|
runStatus: () => runStatus
|
|
12246
12311
|
});
|
|
12312
|
+
function formatSubscriptionLine(billing) {
|
|
12313
|
+
switch (billing.state) {
|
|
12314
|
+
case "trialing": {
|
|
12315
|
+
const days = billing.trial_days_remaining;
|
|
12316
|
+
const suffix = days === null ? "" : days === 1 ? " (1 day left)" : ` (${days} days left)`;
|
|
12317
|
+
return `Subscription: TRIAL${suffix} \u2014 subscribe at ${billing.billing_url}`;
|
|
12318
|
+
}
|
|
12319
|
+
case "active":
|
|
12320
|
+
return `Subscription: ACTIVE${billing.tier_name ? ` (${billing.tier_name})` : ""}`;
|
|
12321
|
+
case "expired":
|
|
12322
|
+
return `Subscription: EXPIRED \u2014 subscribe at ${billing.billing_url}`;
|
|
12323
|
+
case "unknown":
|
|
12324
|
+
default:
|
|
12325
|
+
return `Subscription: not yet started \u2014 subscribe at ${billing.billing_url}`;
|
|
12326
|
+
}
|
|
12327
|
+
}
|
|
12247
12328
|
async function runStatus() {
|
|
12248
12329
|
const creds = await readCredentials();
|
|
12249
12330
|
const cfg = await readConfig();
|
|
@@ -12269,6 +12350,13 @@ async function runStatus() {
|
|
|
12269
12350
|
console.log(` Org: ${cfg.org_name}`);
|
|
12270
12351
|
console.log(` Installed: ${cfg.installed_at}`);
|
|
12271
12352
|
}
|
|
12353
|
+
if (creds?.bamboo_session) {
|
|
12354
|
+
try {
|
|
12355
|
+
const billing = await getCliBillingStatus(creds.bamboo_session);
|
|
12356
|
+
console.log(` ${formatSubscriptionLine(billing)}`);
|
|
12357
|
+
} catch {
|
|
12358
|
+
}
|
|
12359
|
+
}
|
|
12272
12360
|
console.log("");
|
|
12273
12361
|
}
|
|
12274
12362
|
var init_status = __esm({
|
|
@@ -12276,6 +12364,7 @@ var init_status = __esm({
|
|
|
12276
12364
|
"use strict";
|
|
12277
12365
|
init_state();
|
|
12278
12366
|
init_credentials();
|
|
12367
|
+
init_api();
|
|
12279
12368
|
}
|
|
12280
12369
|
});
|
|
12281
12370
|
|