@norman-else/dsh-claude 0.1.27 → 0.1.28
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/lib/client.d.ts +5 -3
- package/lib/client.js +60 -39
- package/lib/client.js.map +1 -1
- package/lib/index.mjs +13 -7
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -3850,6 +3850,8 @@ var RepositoryActionService = class {
|
|
|
3850
3850
|
if (request.action === "update-branch") {
|
|
3851
3851
|
const base = safeText(request.baseBranch ?? "", 512, "Base branch");
|
|
3852
3852
|
if (before.files.length > 0) throw new RepositoryActionError("dirty-workspace", "Commit or stash workspace changes before updating the branch.");
|
|
3853
|
+
const method = request.mergeMethod ?? "rebase";
|
|
3854
|
+
if (method !== "merge" && method !== "rebase") throw new RepositoryActionError("invalid-request", "Update branch supports merge or rebase.");
|
|
3853
3855
|
const git = await this.#git();
|
|
3854
3856
|
await this.#mustRun(git, [
|
|
3855
3857
|
"fetch",
|
|
@@ -3857,7 +3859,11 @@ var RepositoryActionService = class {
|
|
|
3857
3859
|
"--",
|
|
3858
3860
|
base
|
|
3859
3861
|
], before.root, REMOTE_TIMEOUT_MS, "fetch-failed", "Git could not fetch the base branch.");
|
|
3860
|
-
const merged = await this.#run(git, [
|
|
3862
|
+
const merged = await this.#run(git, method === "rebase" ? [
|
|
3863
|
+
"rebase",
|
|
3864
|
+
"--",
|
|
3865
|
+
`origin/${base}`
|
|
3866
|
+
] : [
|
|
3861
3867
|
"merge",
|
|
3862
3868
|
"--no-edit",
|
|
3863
3869
|
"--",
|
|
@@ -3872,8 +3878,8 @@ var RepositoryActionService = class {
|
|
|
3872
3878
|
], before.root, GIT_TIMEOUT_MS$1);
|
|
3873
3879
|
const conflicts = conflicted.exitCode === 0 && !conflicted.lossy ? conflicted.stdout.split(/\r?\n/u).filter((line) => line.length > 0).slice(0, 100) : [];
|
|
3874
3880
|
if (conflicts.length === 0) {
|
|
3875
|
-
await this.#run(git, [
|
|
3876
|
-
throw new RepositoryActionError("merge-failed",
|
|
3881
|
+
await this.#run(git, [method, "--abort"], before.root, GIT_TIMEOUT_MS$1).catch(() => void 0);
|
|
3882
|
+
throw new RepositoryActionError("merge-failed", `Git could not ${method} the base branch.`);
|
|
3877
3883
|
}
|
|
3878
3884
|
this.#invalidate(before.root);
|
|
3879
3885
|
return {
|
|
@@ -3882,9 +3888,9 @@ var RepositoryActionService = class {
|
|
|
3882
3888
|
conflicts
|
|
3883
3889
|
};
|
|
3884
3890
|
}
|
|
3885
|
-
const mergedHead = (await this.#mustRun(git, ["rev-parse", "HEAD"], before.root, GIT_TIMEOUT_MS$1, "merge-failed", "The
|
|
3891
|
+
const mergedHead = (await this.#mustRun(git, ["rev-parse", "HEAD"], before.root, GIT_TIMEOUT_MS$1, "merge-failed", "The updated commit could not be verified.")).stdout.trim();
|
|
3886
3892
|
try {
|
|
3887
|
-
await this.#push(git, before.root, before.branch);
|
|
3893
|
+
await this.#push(git, before.root, before.branch, method === "rebase");
|
|
3888
3894
|
} catch (error) {
|
|
3889
3895
|
throw new RepositoryActionError("push-failed", error instanceof Error ? error.message : "Git push failed.", mergedHead);
|
|
3890
3896
|
}
|
|
@@ -4073,13 +4079,13 @@ var RepositoryActionService = class {
|
|
|
4073
4079
|
if (staged.exitCode !== 0 || staged.lossy) throw new RepositoryActionError("repository-unavailable", "Staged files could not be verified.");
|
|
4074
4080
|
if (staged.stdout.split(/\r?\n/u).some((path) => path.length > 0 && isProtectedWarpPath(path))) throw new RepositoryActionError("protected-warp-file", "WARP.md files cannot be committed. Unstage them before continuing.");
|
|
4075
4081
|
}
|
|
4076
|
-
async #push(git, cwd, branch) {
|
|
4082
|
+
async #push(git, cwd, branch, forceWithLease = false) {
|
|
4077
4083
|
const args = (await this.#run(git, [
|
|
4078
4084
|
"rev-parse",
|
|
4079
4085
|
"--abbrev-ref",
|
|
4080
4086
|
"--symbolic-full-name",
|
|
4081
4087
|
"@{upstream}"
|
|
4082
|
-
], cwd, GIT_TIMEOUT_MS$1)).exitCode === 0 ? ["push"] : [
|
|
4088
|
+
], cwd, GIT_TIMEOUT_MS$1)).exitCode === 0 ? ["push", ...forceWithLease ? ["--force-with-lease"] : []] : [
|
|
4083
4089
|
"push",
|
|
4084
4090
|
"--set-upstream",
|
|
4085
4091
|
"origin",
|