@buildautomaton/cli 0.1.83 → 0.1.84
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.js +49 -24
- package/dist/cli.js.map +3 -3
- package/dist/index.js +49 -24
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -30462,7 +30462,7 @@ var {
|
|
|
30462
30462
|
} = import_index.default;
|
|
30463
30463
|
|
|
30464
30464
|
// src/cli-version.ts
|
|
30465
|
-
var CLI_VERSION = "0.1.
|
|
30465
|
+
var CLI_VERSION = "0.1.84".length > 0 ? "0.1.84" : "0.0.0-dev";
|
|
30466
30466
|
|
|
30467
30467
|
// src/cli/defaults.ts
|
|
30468
30468
|
var DEFAULT_API_URL = process.env.BUILDAUTOMATON_API_URL ?? "https://api.buildautomaton.com";
|
|
@@ -38438,7 +38438,7 @@ var FLY_LEGACY_HOST_SKU = defineHostSku({
|
|
|
38438
38438
|
storage: { storageGb: 1 },
|
|
38439
38439
|
monthlyPriceCents: 750
|
|
38440
38440
|
});
|
|
38441
|
-
var
|
|
38441
|
+
var FLY_LEGACY_1G_HOST_SKU = defineHostSku({
|
|
38442
38442
|
id: "fly-shared-1x1024-1gb",
|
|
38443
38443
|
provider: "fly",
|
|
38444
38444
|
compute: { cpus: 1, cpuKind: "shared" },
|
|
@@ -38446,8 +38446,17 @@ var FLY_DEFAULT_HOST_SKU = defineHostSku({
|
|
|
38446
38446
|
storage: { storageGb: 1 },
|
|
38447
38447
|
monthlyPriceCents: 1e3
|
|
38448
38448
|
});
|
|
38449
|
+
var FLY_DEFAULT_HOST_SKU = defineHostSku({
|
|
38450
|
+
id: "fly-shared-2x2048-1gb",
|
|
38451
|
+
provider: "fly",
|
|
38452
|
+
compute: { cpus: 2, cpuKind: "shared" },
|
|
38453
|
+
memory: { memoryMb: 2048 },
|
|
38454
|
+
storage: { storageGb: 1 },
|
|
38455
|
+
monthlyPriceCents: 2e3
|
|
38456
|
+
});
|
|
38449
38457
|
var HOST_SKUS_BY_ID = {
|
|
38450
38458
|
[FLY_LEGACY_HOST_SKU.id]: FLY_LEGACY_HOST_SKU,
|
|
38459
|
+
[FLY_LEGACY_1G_HOST_SKU.id]: FLY_LEGACY_1G_HOST_SKU,
|
|
38451
38460
|
[FLY_DEFAULT_HOST_SKU.id]: FLY_DEFAULT_HOST_SKU
|
|
38452
38461
|
};
|
|
38453
38462
|
|
|
@@ -50828,12 +50837,6 @@ async function pushAheadOfUpstreamForPaths(paths) {
|
|
|
50828
50837
|
}
|
|
50829
50838
|
|
|
50830
50839
|
// src/worktrees/manager/resolve-commit-targets.ts
|
|
50831
|
-
function bridgeRootBinding(bridgeRoot) {
|
|
50832
|
-
return {
|
|
50833
|
-
sessionParentPath: bridgeRoot,
|
|
50834
|
-
repoCheckoutPaths: [bridgeRoot]
|
|
50835
|
-
};
|
|
50836
|
-
}
|
|
50837
50840
|
async function resolveCommitTargetsAsync(sessionId, cache2, discover) {
|
|
50838
50841
|
const sid = sessionId.trim();
|
|
50839
50842
|
const paths = cache2.getRepoCheckoutPathsRef(sid);
|
|
@@ -50843,9 +50846,7 @@ async function resolveCommitTargetsAsync(sessionId, cache2, discover) {
|
|
|
50843
50846
|
cache2.remember(sid, disc);
|
|
50844
50847
|
return disc.repoCheckoutPaths;
|
|
50845
50848
|
}
|
|
50846
|
-
|
|
50847
|
-
cache2.remember(sid, bridgeRootBinding(bridgeRoot));
|
|
50848
|
-
return [bridgeRoot];
|
|
50849
|
+
return [getBridgeRoot()];
|
|
50849
50850
|
}
|
|
50850
50851
|
|
|
50851
50852
|
// src/worktrees/manager/git/get-session-working-tree-status.ts
|
|
@@ -52052,33 +52053,42 @@ async function removeSessionWorktreeCheckouts(cache2, sessionId, worktreesRootPa
|
|
|
52052
52053
|
await removeSessionWorktrees(paths, worktreesRootPath, log2);
|
|
52053
52054
|
}
|
|
52054
52055
|
|
|
52056
|
+
// src/worktrees/manager/git/rename-session-worktree-branch.ts
|
|
52057
|
+
init_normalize_resolved_path();
|
|
52058
|
+
|
|
52055
52059
|
// src/git/branches/rename-branch.ts
|
|
52056
52060
|
async function gitRenameCurrentBranch(repoDir, newName) {
|
|
52057
52061
|
const g = cliSimpleGit(repoDir);
|
|
52058
52062
|
await g.raw(["branch", "-m", newName]);
|
|
52059
52063
|
}
|
|
52060
52064
|
|
|
52065
|
+
// src/worktrees/sanitize-git-branch-name.ts
|
|
52066
|
+
function sanitizeGitBranchName(newBranch) {
|
|
52067
|
+
return newBranch.replace(/[^a-zA-Z0-9/_-]+/g, "-").slice(0, 80) || "session-branch";
|
|
52068
|
+
}
|
|
52069
|
+
|
|
52061
52070
|
// src/worktrees/rename-session-worktree-branches.ts
|
|
52062
52071
|
async function renameSessionWorktreeBranches(paths, newBranch, log2) {
|
|
52063
|
-
const safe = newBranch
|
|
52072
|
+
const safe = sanitizeGitBranchName(newBranch);
|
|
52064
52073
|
await forEachWithGitYield(paths, async (wt) => {
|
|
52065
52074
|
if (!await isGitRepoDirectory(wt)) return;
|
|
52066
|
-
|
|
52067
|
-
|
|
52068
|
-
log2(`[worktrees] Renamed branch in ${wt} \u2192 ${safe}`);
|
|
52069
|
-
} catch (e) {
|
|
52070
|
-
log2(
|
|
52071
|
-
`[worktrees] Branch rename failed in ${wt}: ${e instanceof Error ? e.message : String(e)}`
|
|
52072
|
-
);
|
|
52073
|
-
}
|
|
52075
|
+
await gitRenameCurrentBranch(wt, safe);
|
|
52076
|
+
log2(`[worktrees] Renamed branch in ${wt} \u2192 ${safe}`);
|
|
52074
52077
|
});
|
|
52078
|
+
return safe;
|
|
52075
52079
|
}
|
|
52076
52080
|
|
|
52077
52081
|
// src/worktrees/manager/git/rename-session-worktree-branch.ts
|
|
52078
52082
|
async function renameSessionWorktreeBranch(cache2, sessionId, newBranch, log2) {
|
|
52079
52083
|
const paths = cache2.getRepoCheckoutPathsRef(sessionId);
|
|
52080
|
-
if (!paths?.length) return;
|
|
52081
|
-
|
|
52084
|
+
if (!paths?.length) return null;
|
|
52085
|
+
const bridgeRoot = normalizeResolvedPath(getBridgeRoot());
|
|
52086
|
+
const worktreePaths = paths.filter((p) => normalizeResolvedPath(p) !== bridgeRoot);
|
|
52087
|
+
if (!worktreePaths.length) {
|
|
52088
|
+
log2(`[worktrees] Skipping branch rename for ${sessionId}: no session worktree paths`);
|
|
52089
|
+
return null;
|
|
52090
|
+
}
|
|
52091
|
+
return renameSessionWorktreeBranches(worktreePaths, newBranch, log2);
|
|
52082
52092
|
}
|
|
52083
52093
|
|
|
52084
52094
|
// src/worktrees/discovery/discover-session-worktree-on-disk.ts
|
|
@@ -52878,7 +52888,20 @@ function createSessionWorktreeGitApi(ctx) {
|
|
|
52878
52888
|
await removeSessionWorktreeCheckouts(ctx.cache, sessionId, ctx.worktreesRootPath, ctx.log);
|
|
52879
52889
|
},
|
|
52880
52890
|
async commitSession(params) {
|
|
52881
|
-
|
|
52891
|
+
let branch = params.branch;
|
|
52892
|
+
if (params.renameBranch) {
|
|
52893
|
+
const renamed = await renameSessionWorktreeBranch(
|
|
52894
|
+
ctx.cache,
|
|
52895
|
+
params.sessionId,
|
|
52896
|
+
params.branch,
|
|
52897
|
+
ctx.log
|
|
52898
|
+
);
|
|
52899
|
+
if (renamed == null) {
|
|
52900
|
+
return { ok: false, error: "Branch rename is only supported for session worktrees" };
|
|
52901
|
+
}
|
|
52902
|
+
branch = renamed;
|
|
52903
|
+
}
|
|
52904
|
+
return commitSessionWorktree(ctx.cache, { ...params, branch });
|
|
52882
52905
|
},
|
|
52883
52906
|
async getSessionWorkingTreeStatus(sessionId) {
|
|
52884
52907
|
return getSessionWorkingTreeStatus(ctx.cache, sessionId, (sid) => paths.discoverAsync(sid));
|
|
@@ -56186,6 +56209,7 @@ async function handleSessionGitCommitAction(deps, sessionId, msg, reply) {
|
|
|
56186
56209
|
const branch = typeof msg.branch === "string" ? msg.branch : "";
|
|
56187
56210
|
const message = typeof msg.message === "string" ? msg.message : "";
|
|
56188
56211
|
const pushAfterCommit = msg.pushAfterCommit === true;
|
|
56212
|
+
const renameBranch = msg.renameBranch === true;
|
|
56189
56213
|
if (!branch.trim() || !message.trim()) {
|
|
56190
56214
|
reply({ ok: false, error: "branch and message are required for commit" });
|
|
56191
56215
|
return;
|
|
@@ -56194,7 +56218,8 @@ async function handleSessionGitCommitAction(deps, sessionId, msg, reply) {
|
|
|
56194
56218
|
sessionId,
|
|
56195
56219
|
branch: branch.trim(),
|
|
56196
56220
|
message: message.trim(),
|
|
56197
|
-
push: pushAfterCommit
|
|
56221
|
+
push: pushAfterCommit,
|
|
56222
|
+
renameBranch
|
|
56198
56223
|
});
|
|
56199
56224
|
if (!commitRes.ok) {
|
|
56200
56225
|
reply({ ok: false, error: commitRes.error ?? "Commit failed" });
|