@norman-else/dsh-claude 0.1.21 → 0.1.22
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 +7 -0
- package/lib/client.js +362 -153
- package/lib/client.js.map +1 -1
- package/lib/index.mjs +30 -2
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -3579,6 +3579,30 @@ var RepositoryActionService = class {
|
|
|
3579
3579
|
pushed: true
|
|
3580
3580
|
};
|
|
3581
3581
|
}
|
|
3582
|
+
if (request.action === "merge-pr") {
|
|
3583
|
+
const method = request.mergeMethod;
|
|
3584
|
+
if (method !== "merge" && method !== "squash" && method !== "rebase") throw new RepositoryActionError("invalid-request", "The merge method is invalid.");
|
|
3585
|
+
let gh;
|
|
3586
|
+
try {
|
|
3587
|
+
gh = await this.#gh();
|
|
3588
|
+
} catch (error) {
|
|
3589
|
+
throw new RepositoryActionError("gh-unavailable", error instanceof Error ? error.message : "GitHub CLI is unavailable.");
|
|
3590
|
+
}
|
|
3591
|
+
const merged = await this.#run(gh, [
|
|
3592
|
+
"pr",
|
|
3593
|
+
"merge",
|
|
3594
|
+
`--${method}`
|
|
3595
|
+
], before.root, REMOTE_TIMEOUT_MS);
|
|
3596
|
+
if (merged.exitCode !== 0 || merged.lossy) {
|
|
3597
|
+
const reason = merged.stderr.split(/\r?\n/u).map((line) => line.trim()).filter((line) => line.length > 0).at(-1);
|
|
3598
|
+
throw new RepositoryActionError("merge-failed", reason === void 0 || reason.length === 0 ? "The pull request could not be merged." : reason);
|
|
3599
|
+
}
|
|
3600
|
+
this.#invalidate(before.root);
|
|
3601
|
+
return {
|
|
3602
|
+
commit: before.head,
|
|
3603
|
+
pushed: true
|
|
3604
|
+
};
|
|
3605
|
+
}
|
|
3582
3606
|
const message = safeText(request.message, MAX_MESSAGE_CHARS, "Commit message");
|
|
3583
3607
|
if (before.files.length === 0 && request.action !== "create-pr") throw new RepositoryActionError("nothing-to-commit", "There are no changes to commit.");
|
|
3584
3608
|
const git = await this.#git();
|
|
@@ -3916,7 +3940,8 @@ const ACTIONS = /* @__PURE__ */ new Set([
|
|
|
3916
3940
|
"commit",
|
|
3917
3941
|
"commit-push",
|
|
3918
3942
|
"push",
|
|
3919
|
-
"create-pr"
|
|
3943
|
+
"create-pr",
|
|
3944
|
+
"merge-pr"
|
|
3920
3945
|
]);
|
|
3921
3946
|
function record$1(value) {
|
|
3922
3947
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
@@ -3956,13 +3981,16 @@ function actionRequest(input) {
|
|
|
3956
3981
|
return {
|
|
3957
3982
|
action,
|
|
3958
3983
|
fingerprint: string(input, "fingerprint"),
|
|
3959
|
-
message: action === "push" ? optionalString(input, "message") ?? "" : string(input, "message"),
|
|
3984
|
+
message: action === "push" || action === "merge-pr" ? optionalString(input, "message") ?? "" : string(input, "message"),
|
|
3960
3985
|
includeUnstaged: input.includeUnstaged,
|
|
3961
3986
|
...optionalString(input, "prTitle") === void 0 ? {} : { prTitle: optionalString(input, "prTitle") },
|
|
3962
3987
|
...optionalString(input, "prBody") === void 0 ? {} : { prBody: optionalString(input, "prBody") },
|
|
3963
3988
|
...optionalString(input, "baseBranch") === void 0 ? {} : { baseBranch: optionalString(input, "baseBranch") },
|
|
3964
3989
|
...input.draft === void 0 ? {} : typeof input.draft === "boolean" ? { draft: input.draft } : (() => {
|
|
3965
3990
|
throw new RepositoryActionError("invalid-request", "The draft field must be a boolean.");
|
|
3991
|
+
})(),
|
|
3992
|
+
...input.mergeMethod === void 0 ? {} : input.mergeMethod === "merge" || input.mergeMethod === "squash" || input.mergeMethod === "rebase" ? { mergeMethod: input.mergeMethod } : (() => {
|
|
3993
|
+
throw new RepositoryActionError("invalid-request", "The mergeMethod field is invalid.");
|
|
3966
3994
|
})()
|
|
3967
3995
|
};
|
|
3968
3996
|
}
|