claude-task-worker 0.110.0 → 0.112.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 +65 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1486,6 +1486,27 @@ async function fetchPrRef(owner, name, prNumber) {
|
|
|
1486
1486
|
return null;
|
|
1487
1487
|
}
|
|
1488
1488
|
}
|
|
1489
|
+
async function getPrDetail(prNumber) {
|
|
1490
|
+
const { owner, name } = await getRepoInfo();
|
|
1491
|
+
return fetchPrRef(owner, name, prNumber);
|
|
1492
|
+
}
|
|
1493
|
+
async function closeIssue(issueNumber, reason = "completed") {
|
|
1494
|
+
const { owner, name } = await getRepoInfo();
|
|
1495
|
+
await execGh([
|
|
1496
|
+
"api",
|
|
1497
|
+
"-X",
|
|
1498
|
+
"PATCH",
|
|
1499
|
+
`repos/${owner}/${name}/issues/${issueNumber}`,
|
|
1500
|
+
"-f",
|
|
1501
|
+
"state=closed",
|
|
1502
|
+
"-f",
|
|
1503
|
+
`state_reason=${reason}`
|
|
1504
|
+
]);
|
|
1505
|
+
}
|
|
1506
|
+
function parseClosingIssueNumbers(body) {
|
|
1507
|
+
const pattern = /\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s*:?\s*#(\d+)\b(?!\d)/gi;
|
|
1508
|
+
return [...new Set([...body.matchAll(pattern)].map((m) => Number(m[1])))];
|
|
1509
|
+
}
|
|
1489
1510
|
function bodyClosesIssue(body, issueNumber) {
|
|
1490
1511
|
const pattern = new RegExp(`\\b(close[sd]?|fix(?:e[sd])?|resolve[sd]?)\\s*:?\\s*#${issueNumber}\\b(?!\\d)`, "i");
|
|
1491
1512
|
return pattern.test(body);
|
|
@@ -2607,7 +2628,7 @@ function appendCloudDoneInstruction(prompt, target, debug = false) {
|
|
|
2607
2628
|
const checkoutInstruction = buildCloudCheckoutInstruction(target);
|
|
2608
2629
|
const worktreeInstruction = buildCloudWorktreeInstruction(prompt);
|
|
2609
2630
|
const reportInstruction = debug ? `\`${CLOUD_DONE_LABEL}\` \u30E9\u30D9\u30EB\u3092\u4ED8\u3051\u308B\u76F4\u524D\u306B\u3001${targetLabel} \u3078 \`${CLOUD_REPORT_HEADING}\` \u3092\u898B\u51FA\u3057\u3068\u3059\u308B\u30B3\u30E1\u30F3\u30C8\u30921\u4EF6\u6295\u7A3F\u3057\u3001\u672C\u6587\u306B\u6700\u7D42\u5831\u544A\uFF08\u5B8C\u4E86\u30FB\u4E2D\u65AD\u306B\u304B\u304B\u308F\u3089\u305A\uFF09\u3092\u66F8\u304F\u3053\u3068\u3002GitHub MCP\uFF08\`add_issue_comment\`\uFF09\u3092\u512A\u5148\u3057\u3001\u5931\u6557\u3057\u305F\u5834\u5408\u306E\u307F \`gh ${target.type} comment ${target.number} --body-file -\` \u3078\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u3059\u308B\u3053\u3068\uFF08\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u306F1\u56DE\u307E\u3067\uFF09\u3002\u30EF\u30FC\u30AB\u30FC\u306F\u3053\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u6700\u7D42\u30EC\u30DD\u30FC\u30C8\u3068\u3057\u3066\u56DE\u53CE\u3057 Slack \u901A\u77E5\u306B\u8F09\u305B\u308B\u3002` : "";
|
|
2610
|
-
const labelInstruction = `${debug ? "\u4E0A\u8A18\u30B3\u30E1\u30F3\u30C8\u306E\u6295\u7A3F\u5F8C\u3001" : ""}\u3053\u306E\u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u6700\u5F8C\u306E\u64CD\u4F5C\u3068\u3057\u3066 ${targetLabel} \u306B \`${CLOUD_DONE_LABEL}\` \u30E9\u30D9\u30EB\u3092\u4ED8\u4E0E\u3059\u308B\u3053\u3068\
|
|
2631
|
+
const labelInstruction = `${debug ? "\u4E0A\u8A18\u30B3\u30E1\u30F3\u30C8\u306E\u6295\u7A3F\u5F8C\u3001" : ""}\u3053\u306E\u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u6700\u5F8C\u306E\u64CD\u4F5C\u3068\u3057\u3066 ${targetLabel} \u306B \`${CLOUD_DONE_LABEL}\` \u30E9\u30D9\u30EB\u3092\u4ED8\u4E0E\u3059\u308B\u3053\u3068\u3002\u4ED8\u4E0E\u306F \`bash \${CLAUDE_PLUGIN_ROOT}/scripts/gh-compat.sh add-label ${target.number} ${CLOUD_DONE_LABEL}\` \u3067\u884C\u3044\u3001\u5931\u6557\u3057\u305F\u5834\u5408\u306E\u307F \`gh api -X POST repos/{owner}/{repo}/issues/${target.number}/labels -f "labels[]=${CLOUD_DONE_LABEL}"\` \u3078\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u3059\u308B\u3053\u3068\uFF08\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u306F1\u56DE\u307E\u3067\uFF09\u3002**GitHub MCP \u306E \`issue_write\` / \`pull_request_write\`\uFF08method: \`update\`\uFF09\u306F\u4F7F\u308F\u306A\u3044\u3053\u3068** \u2014 \u540C\u30C4\u30FC\u30EB\u306E \`labels\` \u306F\u5168\u7F6E\u63DB\u3067\u3001\`${CLOUD_DONE_LABEL}\` \u3092\u8DB3\u3059\u3064\u3082\u308A\u306E\u547C\u3073\u51FA\u3057\u304C\u65E2\u5B58\u30E9\u30D9\u30EB\uFF08\`cc-triage-scope\` / \`cc-in-progress\` \u7B49\uFF09\u3092\u5DFB\u304D\u6DFB\u3048\u3067\u6D88\u3057\u3001\u305D\u306E Issue/PR \u304C\u30EF\u30FC\u30AB\u30FC\u306E\u30DD\u30FC\u30EA\u30F3\u30B0\u5BFE\u8C61\u304B\u3089\u5916\u308C\u308B\u3002\u30EF\u30FC\u30AB\u30FC\u306F\u3053\u306E\u30E9\u30D9\u30EB\u3067\u30BF\u30B9\u30AF\u306E\u7D42\u4E86\u3092\u691C\u77E5\u3057\u3066\u304A\u308A\u3001\u4ED8\u4E0E\u3055\u308C\u306A\u3044\u3068\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8\u307E\u3067\u5B8C\u4E86\u6271\u3044\u306B\u306A\u3089\u306A\u3044\u3002`;
|
|
2611
2632
|
return [prompt, checkoutInstruction, worktreeInstruction, reportInstruction, labelInstruction].filter((part) => part !== "").join("\n\n");
|
|
2612
2633
|
}
|
|
2613
2634
|
var CLOUD_WORKTREE_EXEMPT_SKILLS = ["exec-issue", "fix-review-point", "create-ui-design"];
|
|
@@ -4389,11 +4410,27 @@ var triageCreatedIssueWorker = (opts = {}) => createIssuePollingWorker({
|
|
|
4389
4410
|
})();
|
|
4390
4411
|
|
|
4391
4412
|
// src/workers/triage-pr.ts
|
|
4413
|
+
function shouldCloseLinkedIssues(pr, defaultBranch) {
|
|
4414
|
+
return pr !== null && pr.state === "MERGED" && pr.baseRefName !== defaultBranch;
|
|
4415
|
+
}
|
|
4392
4416
|
var triagePrWorker = createPrPollingWorker({
|
|
4393
4417
|
name: "triage-pr",
|
|
4394
4418
|
command: "/claude-task-worker:triage-pr",
|
|
4395
4419
|
triggerLabel: "cc-triage-scope",
|
|
4396
|
-
excludeLabels: ["cc-fix-onetime", "cc-resolve-conflict", "cc-release-ready", "cc-need-human-check"]
|
|
4420
|
+
excludeLabels: ["cc-fix-onetime", "cc-resolve-conflict", "cc-release-ready", "cc-need-human-check"],
|
|
4421
|
+
onCompleted: async (pr) => {
|
|
4422
|
+
const detail = await getPrDetail(pr.number);
|
|
4423
|
+
const { defaultBranch } = await getRepoInfo();
|
|
4424
|
+
if (!shouldCloseLinkedIssues(detail, defaultBranch)) return;
|
|
4425
|
+
for (const issueNumber of parseClosingIssueNumbers(detail.body)) {
|
|
4426
|
+
try {
|
|
4427
|
+
await closeIssue(issueNumber);
|
|
4428
|
+
console.log(`[triage-pr] closed issue #${issueNumber} (PR #${pr.number} merged into ${detail.baseRefName})`);
|
|
4429
|
+
} catch (err) {
|
|
4430
|
+
console.error(`[triage-pr] failed to close issue #${issueNumber} for PR #${pr.number}: ${err}`);
|
|
4431
|
+
}
|
|
4432
|
+
}
|
|
4433
|
+
}
|
|
4397
4434
|
});
|
|
4398
4435
|
|
|
4399
4436
|
// src/workers/resolve-conflict.ts
|
|
@@ -4503,6 +4540,9 @@ function extractDesignFilePath(body) {
|
|
|
4503
4540
|
if (path2.length === 0 || path2.includes("<") || path2.includes(">") || !path2.endsWith(".pen")) return null;
|
|
4504
4541
|
return path2;
|
|
4505
4542
|
}
|
|
4543
|
+
function shouldVerifyDesignFileExists(cloud) {
|
|
4544
|
+
return !cloud;
|
|
4545
|
+
}
|
|
4506
4546
|
function classifyDesignPr(pr) {
|
|
4507
4547
|
if (pr === null) return "needs-human";
|
|
4508
4548
|
if (pr.state === "MERGED" || pr.mergedAt !== null) return "proceed";
|
|
@@ -4537,10 +4577,10 @@ function designPrNotCreatedComment(issueNumber) {
|
|
|
4537
4577
|
"- \u30C7\u30B6\u30A4\u30F3\u3092\u8AE6\u3081\u3066\u305D\u306E\u307E\u307E\u5B9F\u88C5\u3078\u9032\u3081\u308B\u5834\u5408: `cc-need-human-check` \u30E9\u30D9\u30EB\u3092\u5916\u3057\u3001`cc-exec-issue` \u30E9\u30D9\u30EB\u306E\u307F\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044"
|
|
4538
4578
|
].join("\n");
|
|
4539
4579
|
}
|
|
4540
|
-
function
|
|
4580
|
+
function designReferenceFailureComment(heading, cause) {
|
|
4541
4581
|
return [
|
|
4542
|
-
|
|
4543
|
-
|
|
4582
|
+
heading,
|
|
4583
|
+
cause,
|
|
4544
4584
|
"",
|
|
4545
4585
|
"## \u306A\u305C\u6B62\u3081\u3066\u3044\u308B\u304B",
|
|
4546
4586
|
"- \u30C7\u30B6\u30A4\u30F3\u53C2\u7167\u304C description \u306B\u7121\u3044\u3068\u3001`exec-issue` \u306F\u30C7\u30B6\u30A4\u30F3\u3092\u5165\u529B\u306B\u3067\u304D\u305A\u3001\u5408\u610F\u6E08\u307F\u306E\u30C7\u30B6\u30A4\u30F3\u3068\u7121\u95A2\u4FC2\u306A\u5B9F\u88C5\u306B\u306A\u308A\u307E\u3059",
|
|
@@ -4550,6 +4590,18 @@ function designReferenceMissingComment(issueNumber) {
|
|
|
4550
4590
|
"- \u624B\u52D5\u3067 description \u306B\u53C2\u7167\u3092\u8FFD\u8A18\u3057\u305F\u5834\u5408: `cc-need-human-check` \u30E9\u30D9\u30EB\u3092\u5916\u3057\u3001`cc-ui-design-ready` \u3068 `cc-exec-issue` \u30E9\u30D9\u30EB\u3092\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044"
|
|
4551
4591
|
].join("\n");
|
|
4552
4592
|
}
|
|
4593
|
+
function designReferenceMissingComment(issueNumber) {
|
|
4594
|
+
return designReferenceFailureComment(
|
|
4595
|
+
"## \u30C7\u30B6\u30A4\u30F3\u53C2\u7167\u306E\u66F8\u304D\u623B\u3057\u3092\u78BA\u8A8D\u3067\u304D\u307E\u305B\u3093\uFF08\u8981\u4EBA\u624B\u78BA\u8A8D\uFF09",
|
|
4596
|
+
`apply-ui-design \u306E\u30BB\u30C3\u30B7\u30E7\u30F3\u306F\u6B63\u5E38\u7D42\u4E86\uFF08exit 0\uFF09\u3057\u307E\u3057\u305F\u304C\u3001Issue #${issueNumber} \u306E description \u306B \`${DESIGN_REFERENCE_HEADING}\` \u30BB\u30AF\u30B7\u30E7\u30F3\uFF08\`.pen\` \u306E\u30D1\u30B9\u3092\u542B\u3080\uFF09\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30BB\u30C3\u30B7\u30E7\u30F3\u304C\u66F8\u304D\u623B\u3057\u524D\u306B\u4E2D\u65AD\u3057\u305F\u304B\u3001\u66F8\u304D\u623B\u3057\u306B\u5931\u6557\u3057\u305F\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002`
|
|
4597
|
+
);
|
|
4598
|
+
}
|
|
4599
|
+
function designFileMissingComment(issueNumber, designFilePath) {
|
|
4600
|
+
return designReferenceFailureComment(
|
|
4601
|
+
"## \u30C7\u30B6\u30A4\u30F3\u53C2\u7167\u306E\u30D1\u30B9\u304C\u5B9F\u5728\u3057\u307E\u305B\u3093\uFF08\u8981\u4EBA\u624B\u78BA\u8A8D\uFF09",
|
|
4602
|
+
`apply-ui-design \u306F Issue #${issueNumber} \u306E description \u306B \`${DESIGN_REFERENCE_HEADING}\` \u30BB\u30AF\u30B7\u30E7\u30F3\u3092\u66F8\u304D\u623B\u3057\u307E\u3057\u305F\u304C\u3001\u305D\u3053\u304C\u6307\u3059 \`${designFilePath}\` \u304C\u30D9\u30FC\u30B9\u30D6\u30E9\u30F3\u30C1\u306E\u4F5C\u696D\u30C4\u30EA\u30FC\u306B\u5B58\u5728\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30C7\u30B6\u30A4\u30F3PR\u306E\u30DE\u30FC\u30B8\u5148\u3068\u672CIssue\u306E\u30D9\u30FC\u30B9\u30D6\u30E9\u30F3\u30C1\u304C\u98DF\u3044\u9055\u3063\u3066\u3044\u308B\u304B\u3001\u30D1\u30B9\u306E\u7DB4\u308A\u304C\u8AA4\u3063\u3066\u3044\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002`
|
|
4603
|
+
);
|
|
4604
|
+
}
|
|
4553
4605
|
|
|
4554
4606
|
// src/workers/create-ui-design.ts
|
|
4555
4607
|
function designPrLabelingFailedComment(issueNumber, prNumber, error, yolo = false) {
|
|
@@ -4636,12 +4688,12 @@ import { join as join6 } from "node:path";
|
|
|
4636
4688
|
function designFileExistsInWorktree(worktreeId, designFilePath) {
|
|
4637
4689
|
return existsSync2(join6(getWorktreePath(worktreeId), designFilePath));
|
|
4638
4690
|
}
|
|
4639
|
-
async function markDesignReferenceMissing(issueNumber, logMessage) {
|
|
4691
|
+
async function markDesignReferenceMissing(issueNumber, logMessage, comment) {
|
|
4640
4692
|
console.error(logMessage);
|
|
4641
4693
|
await addLabel("issue", issueNumber, "cc-need-human-check").catch(
|
|
4642
4694
|
(err) => console.error(`[apply-ui-design] addLabel cc-need-human-check failed for #${issueNumber}: ${err}`)
|
|
4643
4695
|
);
|
|
4644
|
-
await commentOnIssue(issueNumber,
|
|
4696
|
+
await commentOnIssue(issueNumber, comment).catch(
|
|
4645
4697
|
(err) => console.error(`[apply-ui-design] commentOnIssue failed for #${issueNumber}: ${err}`)
|
|
4646
4698
|
);
|
|
4647
4699
|
}
|
|
@@ -4683,7 +4735,7 @@ var applyUiDesignWorker = async (opts = {}) => {
|
|
|
4683
4735
|
}
|
|
4684
4736
|
return "skip";
|
|
4685
4737
|
},
|
|
4686
|
-
onCompleted: async (issueNumber, worktreeId) => {
|
|
4738
|
+
onCompleted: async (issueNumber, worktreeId, _output, ctx) => {
|
|
4687
4739
|
let body;
|
|
4688
4740
|
try {
|
|
4689
4741
|
body = await getIssueBody(issueNumber);
|
|
@@ -4695,14 +4747,16 @@ var applyUiDesignWorker = async (opts = {}) => {
|
|
|
4695
4747
|
if (designFilePath === null) {
|
|
4696
4748
|
await markDesignReferenceMissing(
|
|
4697
4749
|
issueNumber,
|
|
4698
|
-
`[apply-ui-design] #${issueNumber}: session exited without a design reference section; marking cc-need-human-check
|
|
4750
|
+
`[apply-ui-design] #${issueNumber}: session exited without a design reference section; marking cc-need-human-check`,
|
|
4751
|
+
designReferenceMissingComment(issueNumber)
|
|
4699
4752
|
);
|
|
4700
4753
|
return false;
|
|
4701
4754
|
}
|
|
4702
|
-
if (!designFileExistsInWorktree(worktreeId, designFilePath)) {
|
|
4755
|
+
if (shouldVerifyDesignFileExists(ctx.cloud) && !designFileExistsInWorktree(worktreeId, designFilePath)) {
|
|
4703
4756
|
await markDesignReferenceMissing(
|
|
4704
4757
|
issueNumber,
|
|
4705
|
-
`[apply-ui-design] #${issueNumber}: design reference points to ${designFilePath}, which does not exist in worktree ${worktreeId}; marking cc-need-human-check
|
|
4758
|
+
`[apply-ui-design] #${issueNumber}: design reference points to ${designFilePath}, which does not exist in worktree ${worktreeId}; marking cc-need-human-check`,
|
|
4759
|
+
designFileMissingComment(issueNumber, designFilePath)
|
|
4706
4760
|
);
|
|
4707
4761
|
return false;
|
|
4708
4762
|
}
|