claude-task-worker 0.82.0 → 0.83.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/index.js +26 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1525,15 +1525,15 @@ async function commentOnPR(prNumber, body) {
|
|
|
1525
1525
|
async function commentOnIssue(issueNumber, body) {
|
|
1526
1526
|
await execGh(["issue", "comment", String(issueNumber), "--body", body]);
|
|
1527
1527
|
}
|
|
1528
|
-
async function createPullRequest(base, head, title, body) {
|
|
1529
|
-
const
|
|
1528
|
+
async function createPullRequest(base, head, title, body, options) {
|
|
1529
|
+
const args = ["pr", "create", "--base", base, "--head", head, "--title", title, "--body", body];
|
|
1530
|
+
for (const label of options?.labels ?? []) args.push("--label", label);
|
|
1531
|
+
if (options?.assignee) args.push("--assignee", options.assignee);
|
|
1532
|
+
const url = await execGh(args);
|
|
1530
1533
|
const matched = url.match(/\/pull\/(\d+)/);
|
|
1531
1534
|
if (!matched) throw new Error(`gh pr create returned an unexpected output: ${url}`);
|
|
1532
1535
|
return Number(matched[1]);
|
|
1533
1536
|
}
|
|
1534
|
-
async function mergePullRequest(prNumber) {
|
|
1535
|
-
await execGh(["pr", "merge", String(prNumber), "--merge", "--delete-branch"]);
|
|
1536
|
-
}
|
|
1537
1537
|
async function createLabel(name, color, force) {
|
|
1538
1538
|
try {
|
|
1539
1539
|
const args = ["label", "create", name];
|
|
@@ -2059,6 +2059,11 @@ var WORKER_DEFAULTS = {
|
|
|
2059
2059
|
maxConcurrentTasks: 1
|
|
2060
2060
|
}
|
|
2061
2061
|
};
|
|
2062
|
+
var SCHEDULED_WORKER_NAMES = [
|
|
2063
|
+
"update-coding-guidelines",
|
|
2064
|
+
"update-requirement-rules",
|
|
2065
|
+
"update-design-md"
|
|
2066
|
+
];
|
|
2062
2067
|
var DEFAULT_CONFIG = {
|
|
2063
2068
|
fixReviewPointCallbackCommentMessage: "",
|
|
2064
2069
|
uiDesign: { ...DEFAULT_UI_DESIGN_CONFIG },
|
|
@@ -3911,6 +3916,7 @@ import { execFile as execFile3 } from "node:child_process";
|
|
|
3911
3916
|
import { promisify as promisify4 } from "node:util";
|
|
3912
3917
|
var execFileAsync3 = promisify4(execFile3);
|
|
3913
3918
|
var CONFIG_FILE = "claude-task-worker.json";
|
|
3919
|
+
var LABEL_TRIAGE_SCOPE3 = "cc-triage-scope";
|
|
3914
3920
|
function lastRunBranchName(workerName) {
|
|
3915
3921
|
return `ctw-last-run-${workerName}`;
|
|
3916
3922
|
}
|
|
@@ -3927,7 +3933,7 @@ function lastRunPrBody(workerName, at) {
|
|
|
3927
3933
|
`- \u5B9F\u884C\u6642\u523B: ${at.toISOString()}`,
|
|
3928
3934
|
"",
|
|
3929
3935
|
`\u3053\u306EPR\u306F\u5B9F\u884C\u8A18\u9332\u306E\u307F\u3092\u66F4\u65B0\u3057\u307E\u3059\uFF08\u6210\u679C\u7269\u306E\u5909\u66F4\u306F\u540C\u30EF\u30FC\u30AB\u30FC\u304C\u8D77\u52D5\u3057\u305F\u30B9\u30AD\u30EB\u304C\u5225PR\u3067\u51FA\u3057\u307E\u3059\uFF09\u3002`,
|
|
3930
|
-
`\
|
|
3936
|
+
`\u30DE\u30FC\u30B8\u306F \`triage-pr\` \u30EF\u30FC\u30AB\u30FC\u304C\u884C\u3044\u307E\u3059\u3002`
|
|
3931
3937
|
].join("\n");
|
|
3932
3938
|
}
|
|
3933
3939
|
async function git(cwd, args) {
|
|
@@ -3948,9 +3954,18 @@ async function publishLastRunPr(workerName, defaultBranch, at) {
|
|
|
3948
3954
|
await git(cwd, ["commit", "-m", lastRunPrTitle(workerName)]);
|
|
3949
3955
|
await git(cwd, ["push", "--force", "origin", `HEAD:refs/heads/${branch}`]);
|
|
3950
3956
|
const existing = await findOpenPrNumberByHeadRef(branch);
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3957
|
+
if (existing !== null) {
|
|
3958
|
+
console.log(`[${workerName}] updated lastRun PR #${existing}`);
|
|
3959
|
+
return;
|
|
3960
|
+
}
|
|
3961
|
+
const prNumber = await createPullRequest(
|
|
3962
|
+
defaultBranch,
|
|
3963
|
+
branch,
|
|
3964
|
+
lastRunPrTitle(workerName),
|
|
3965
|
+
lastRunPrBody(workerName, at),
|
|
3966
|
+
{ labels: [LABEL_TRIAGE_SCOPE3], assignee: await getCurrentUser() }
|
|
3967
|
+
);
|
|
3968
|
+
console.log(`[${workerName}] opened lastRun PR #${prNumber}`);
|
|
3954
3969
|
} finally {
|
|
3955
3970
|
await removeWorktree(branch).catch((err) => console.error(`[${workerName}] removeWorktree failed: ${err}`));
|
|
3956
3971
|
}
|
|
@@ -4240,9 +4255,11 @@ function logWriteResult(result, path2) {
|
|
|
4240
4255
|
else console.log(`[init] Already exists: ${path2}`);
|
|
4241
4256
|
}
|
|
4242
4257
|
async function createConfig(force) {
|
|
4258
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4243
4259
|
const initialConfig = {
|
|
4244
4260
|
...DEFAULT_CONFIG,
|
|
4245
4261
|
uiDesign: { ...DEFAULT_UI_DESIGN_CONFIG },
|
|
4262
|
+
lastRun: Object.fromEntries(SCHEDULED_WORKER_NAMES.map((name) => [name, now])),
|
|
4246
4263
|
workers: {}
|
|
4247
4264
|
};
|
|
4248
4265
|
const result = await writeFileWithMode(CONFIG_PATH, JSON.stringify(initialConfig, null, 2), force);
|