@staff0rd/assist 0.485.3 → 0.486.0
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/commands/sessions/web/bundle.js +421 -421
- package/dist/index.js +20 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.486.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -9245,6 +9245,7 @@ function toGitCwd(cwd) {
|
|
|
9245
9245
|
// src/commands/sessions/web/defaultBranchRef.ts
|
|
9246
9246
|
var ORIGIN_HEAD_REF = "refs/remotes/origin/HEAD";
|
|
9247
9247
|
var ORIGIN_REF_PREFIX = "refs/remotes/origin/";
|
|
9248
|
+
var FALLBACK_BRANCHES = ["main", "master"];
|
|
9248
9249
|
function configuredDefaultBranch(cwd) {
|
|
9249
9250
|
try {
|
|
9250
9251
|
return loadConfigFrom(toGitCwd(cwd)).branch?.defaultBranch;
|
|
@@ -9261,16 +9262,28 @@ async function originHeadBranch(cwd) {
|
|
|
9261
9262
|
return void 0;
|
|
9262
9263
|
}
|
|
9263
9264
|
}
|
|
9264
|
-
async function
|
|
9265
|
-
const
|
|
9266
|
-
|
|
9267
|
-
const
|
|
9265
|
+
async function candidateBranches(cwd) {
|
|
9266
|
+
const configured = configuredDefaultBranch(cwd);
|
|
9267
|
+
const originHead = configured ? void 0 : await originHeadBranch(cwd);
|
|
9268
|
+
const candidates = [configured, originHead, ...FALLBACK_BRANCHES].filter(
|
|
9269
|
+
(branch2) => Boolean(branch2)
|
|
9270
|
+
);
|
|
9271
|
+
return [...new Set(candidates)];
|
|
9272
|
+
}
|
|
9273
|
+
async function refExists2(cwd, ref) {
|
|
9268
9274
|
try {
|
|
9269
9275
|
await execGit(cwd, ["rev-parse", "--verify", "--quiet", `${ref}^{commit}`]);
|
|
9270
|
-
return
|
|
9276
|
+
return true;
|
|
9271
9277
|
} catch {
|
|
9272
|
-
return
|
|
9278
|
+
return false;
|
|
9279
|
+
}
|
|
9280
|
+
}
|
|
9281
|
+
async function defaultBranchRef(cwd) {
|
|
9282
|
+
for (const branch2 of await candidateBranches(cwd)) {
|
|
9283
|
+
const ref = `origin/${branch2}`;
|
|
9284
|
+
if (await refExists2(cwd, ref)) return ref;
|
|
9273
9285
|
}
|
|
9286
|
+
return void 0;
|
|
9274
9287
|
}
|
|
9275
9288
|
|
|
9276
9289
|
// src/commands/sessions/web/branchDiffBase.ts
|