claude-task-worker 0.16.0 → 0.18.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 +43 -6
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -518,7 +518,7 @@ async function getRepoInfo() {
|
|
|
518
518
|
const parsed = JSON.parse(output);
|
|
519
519
|
return { owner: parsed.owner.login, name: parsed.name, defaultBranch: parsed.defaultBranchRef.name };
|
|
520
520
|
}
|
|
521
|
-
async function listIssuesByLabel(assignee, labels, excludeLabels = [], epicFilter) {
|
|
521
|
+
async function listIssuesByLabel(assignee, labels, excludeLabels = [], epicFilter, limit = 10) {
|
|
522
522
|
const labelArgs = labels.flatMap((label) => ["--label", label]);
|
|
523
523
|
const searchTerms = ["sort:created-asc", "-is:blocked", ...excludeLabels.map((label) => `-label:"${label}"`)];
|
|
524
524
|
if (epicFilter && epicFilter.numbers.length > 0) {
|
|
@@ -538,7 +538,7 @@ async function listIssuesByLabel(assignee, labels, excludeLabels = [], epicFilte
|
|
|
538
538
|
"--search",
|
|
539
539
|
search,
|
|
540
540
|
"--limit",
|
|
541
|
-
|
|
541
|
+
String(limit)
|
|
542
542
|
]);
|
|
543
543
|
return JSON.parse(output);
|
|
544
544
|
}
|
|
@@ -622,7 +622,7 @@ async function fetchPRChecks(prNumber) {
|
|
|
622
622
|
if (!output) return [];
|
|
623
623
|
return JSON.parse(output);
|
|
624
624
|
}
|
|
625
|
-
async function listPullRequestsWithChecks(assignee, label, excludeLabels = []) {
|
|
625
|
+
async function listPullRequestsWithChecks(assignee, label, excludeLabels = [], limit = 5) {
|
|
626
626
|
const search = ["sort:created-asc", ...excludeLabels.map((l) => `-label:"${l}"`)].join(" ");
|
|
627
627
|
const args = [
|
|
628
628
|
"pr",
|
|
@@ -634,7 +634,7 @@ async function listPullRequestsWithChecks(assignee, label, excludeLabels = []) {
|
|
|
634
634
|
"--search",
|
|
635
635
|
search,
|
|
636
636
|
"--limit",
|
|
637
|
-
|
|
637
|
+
String(limit)
|
|
638
638
|
];
|
|
639
639
|
if (assignee) {
|
|
640
640
|
args.push("--assignee", assignee);
|
|
@@ -706,6 +706,28 @@ async function createLabel(name, color, force) {
|
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
708
|
|
|
709
|
+
// src/claude-args.ts
|
|
710
|
+
var DISALLOWED_TOOLS = [
|
|
711
|
+
// 遅延 / yield: 後続ウェイクアップ前提。print モードには再起動ループが無いため、
|
|
712
|
+
// 呼ぶと処理未完のままプロセスが終了する。
|
|
713
|
+
"Monitor",
|
|
714
|
+
"ScheduleWakeup",
|
|
715
|
+
// 対話 / 承認: 自律実行セッションには回答・承認するユーザーが存在しない。
|
|
716
|
+
"AskUserQuestion",
|
|
717
|
+
"EnterPlanMode",
|
|
718
|
+
// スコープ外の副作用を伴う自動化: コード修正タスクに用途がなく、ユーザーの
|
|
719
|
+
// クラウド routine / リモート環境へ副作用を及ぼしうる。
|
|
720
|
+
"CronCreate",
|
|
721
|
+
"CronDelete",
|
|
722
|
+
"CronList",
|
|
723
|
+
"RemoteTrigger",
|
|
724
|
+
// 環境管理の競合: ワーカーは locked worktree の残骸問題のため claude 管理の worktree を
|
|
725
|
+
// 意図的に避け、自前で worktree を生成して cwd として渡している。モデルが worktree を
|
|
726
|
+
// 作成/切り替えると、この前提とクリーンアップが壊れる。
|
|
727
|
+
"EnterWorktree"
|
|
728
|
+
];
|
|
729
|
+
var DISALLOWED_TOOLS_ARG = DISALLOWED_TOOLS.join(",");
|
|
730
|
+
|
|
709
731
|
// src/config.ts
|
|
710
732
|
import { readFileSync } from "node:fs";
|
|
711
733
|
import { join } from "node:path";
|
|
@@ -1706,6 +1728,7 @@ async function removeStaleWorktrees() {
|
|
|
1706
1728
|
|
|
1707
1729
|
// src/workers/issue-worker.ts
|
|
1708
1730
|
var LABEL_TRIAGE_SCOPE = "cc-triage-scope";
|
|
1731
|
+
var PREFLIGHT_SEARCH_LIMIT = 5;
|
|
1709
1732
|
function createIssuePollingWorker(config) {
|
|
1710
1733
|
return async () => {
|
|
1711
1734
|
const { owner, name, defaultBranch } = await getRepoInfo();
|
|
@@ -1724,7 +1747,9 @@ function createIssuePollingWorker(config) {
|
|
|
1724
1747
|
const excludeLabels = ["cc-in-progress", "cc-need-human-check", ...config.excludeLabels ?? []];
|
|
1725
1748
|
const epicFilter = config.epicFilters && config.epicFilters.length > 0 ? { owner, repo: name, numbers: config.epicFilters } : void 0;
|
|
1726
1749
|
const labels = config.labelFilters && config.labelFilters.length > 0 ? [...config.triggerLabels, ...config.labelFilters] : config.triggerLabels;
|
|
1727
|
-
const
|
|
1750
|
+
const { maxConcurrentTasks } = getWorkerConfig(config.name);
|
|
1751
|
+
const searchLimit = config.preflight ? PREFLIGHT_SEARCH_LIMIT : maxConcurrentTasks;
|
|
1752
|
+
const candidates = config.ownNumberFilters && config.ownNumberFilters.length > 0 ? await listIssuesByNumbers(user, labels, excludeLabels, config.ownNumberFilters) : await listIssuesByLabel(user, labels, excludeLabels, epicFilter, searchLimit);
|
|
1728
1753
|
for (const issue of candidates) {
|
|
1729
1754
|
if (isRunning(issue.number)) continue;
|
|
1730
1755
|
if (isWorkerAtCapacity(config.name)) break;
|
|
@@ -1751,6 +1776,8 @@ function createIssuePollingWorker(config) {
|
|
|
1751
1776
|
"-p",
|
|
1752
1777
|
`${command} ${issue.number}`,
|
|
1753
1778
|
"--dangerously-skip-permissions",
|
|
1779
|
+
"--disallowedTools",
|
|
1780
|
+
DISALLOWED_TOOLS_ARG,
|
|
1754
1781
|
"--model",
|
|
1755
1782
|
model,
|
|
1756
1783
|
"--effort",
|
|
@@ -1877,7 +1904,17 @@ function createPrPollingWorker(config) {
|
|
|
1877
1904
|
const command = skill || config.command;
|
|
1878
1905
|
run(
|
|
1879
1906
|
"claude",
|
|
1880
|
-
[
|
|
1907
|
+
[
|
|
1908
|
+
"-p",
|
|
1909
|
+
`${command} ${pr.number}`,
|
|
1910
|
+
"--dangerously-skip-permissions",
|
|
1911
|
+
"--disallowedTools",
|
|
1912
|
+
DISALLOWED_TOOLS_ARG,
|
|
1913
|
+
"--model",
|
|
1914
|
+
model,
|
|
1915
|
+
"--effort",
|
|
1916
|
+
effort
|
|
1917
|
+
],
|
|
1881
1918
|
pr.number,
|
|
1882
1919
|
`PR #${pr.number} (${pr.headRefName})`,
|
|
1883
1920
|
config.name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-task-worker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "CLI tool that polls GitHub Issues/PRs and delegates work to Claude CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dev": "tsc --noEmit --watch",
|
|
13
13
|
"lint": "eslint .",
|
|
14
14
|
"lint:fix": "eslint . --fix",
|
|
15
|
-
"test": "node --experimental-strip-types --test src/**/*.test.ts",
|
|
15
|
+
"test": "node --experimental-strip-types --test \"src/**/*.test.ts\" \"plugin/scripts/**/*.test.mjs\"",
|
|
16
16
|
"format": "prettier --write .",
|
|
17
17
|
"format:check": "prettier --check .",
|
|
18
18
|
"prepublishOnly": "npm run build"
|