✨ Add custom timeout argument to git commit script
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import {parseArgs} from "jsr:@std/cli/parse-args";
|
||||
import {execCommandShell, log, ProcessBar, term,} from "https://script.hatter.ink/@61/deno-commons-mod.ts";
|
||||
import {summarizeGitStatusDiff} from "https://script.hatter.ink/@2/deno-ai-mod.ts";
|
||||
import {summarizeGitStatusDiff} from "https://script.hatter.ink/@4/deno-ai-mod.ts";
|
||||
import {getGitLocalRev, getGitRemoteRev, getGitStatus,} from "https://script.hatter.ink/@2/deno-git-mod.ts";
|
||||
|
||||
async function checkRev(): Promise<boolean> {
|
||||
@@ -22,14 +22,20 @@ async function checkRev(): Promise<boolean> {
|
||||
async function main() {
|
||||
const flags = parseArgs(Deno.args, {
|
||||
boolean: ["help", "check-only", "auto-commit"],
|
||||
string: ["timeout-ms"],
|
||||
alias: {
|
||||
h: "help",
|
||||
C: "check-only",
|
||||
A: "auto-commit",
|
||||
t: "timeout-ms",
|
||||
},
|
||||
});
|
||||
const checkOnly = flags["check-only"];
|
||||
const autoCommit = flags["auto-commit"];
|
||||
const argTimeoutMs = flags["timeout-ms"];
|
||||
const timeoutMillis: number | undefined = argTimeoutMs
|
||||
? parseInt(argTimeoutMs)
|
||||
: undefined;
|
||||
|
||||
if (flags.help) {
|
||||
console.log(`commit.ts
|
||||
@@ -55,7 +61,7 @@ commit.ts [-A|--auto-commit] - auto commit with AI summarize
|
||||
|
||||
const summary = await new ProcessBar("AI summarizing").call(
|
||||
async (): Promise<string> => {
|
||||
return await summarizeGitStatusDiff();
|
||||
return await summarizeGitStatusDiff(timeoutMillis);
|
||||
},
|
||||
);
|
||||
if (summary != null) {
|
||||
@@ -117,5 +123,5 @@ main().catch((err) => {
|
||||
process.exit(0);
|
||||
}).then(() => process.exit(0));
|
||||
|
||||
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260412T225340+08:00.MEUCIQCtE3akY/QOeUWRm6sz
|
||||
// R/yRzGFIChTIGNcBHouraVAkWwIgMsbQ2FvJIJDHHgyyeimmRbe7+8nYuVYGcw1udlCZz2A=
|
||||
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260427T000515+08:00.MEUCIQCWHN3NOg3iwZnNIuLp
|
||||
// 3EqVZEuJjqD4x1+gfgpGgznuEgIga/bS7aBT5mQtp7VWG27mY8DOgBxjDkj0NKTJ+TnqsDM=
|
||||
|
||||
Reference in New Issue
Block a user