claude-task-worker 0.108.0 → 0.110.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.
Files changed (2) hide show
  1. package/dist/index.js +30 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1609,6 +1609,11 @@ async function addLabel(type, number, label) {
1609
1609
  }
1610
1610
  });
1611
1611
  }
1612
+ async function addAssignee(type, number, login) {
1613
+ await withRetry(async () => {
1614
+ await execGh([type, "edit", String(number), "--add-assignee", login]);
1615
+ });
1616
+ }
1612
1617
  async function hasLabel(type, number, label) {
1613
1618
  return withRetry(async () => {
1614
1619
  const output = await execGh([type, "view", String(number), "--json", "labels"]);
@@ -1668,10 +1673,8 @@ async function commentOnPR(prNumber, body) {
1668
1673
  async function commentOnIssue(issueNumber, body) {
1669
1674
  await execGh(["issue", "comment", String(issueNumber), "--body", body]);
1670
1675
  }
1671
- async function createPullRequest(base, head, title, body, options) {
1676
+ async function createPullRequest(base, head, title, body) {
1672
1677
  const args = ["pr", "create", "--base", base, "--head", head, "--title", title, "--body", body];
1673
- for (const label of options?.labels ?? []) args.push("--label", label);
1674
- if (options?.assignee) args.push("--assignee", options.assignee);
1675
1678
  const url = await execGh(args);
1676
1679
  const matched = url.match(/\/pull\/(\d+)/);
1677
1680
  if (!matched) throw new Error(`gh pr create returned an unexpected output: ${url}`);
@@ -2563,8 +2566,15 @@ function buildClaudeArgs({
2563
2566
  // クラウド実行(`cloud: true`)も print モード非対応のため同様に省く
2564
2567
  // (実測 T2: `Error: --cloud cannot be combined with --print.`)。
2565
2568
  ...mode === "herdr" || cloud === true ? [] : ["-p", prompt],
2566
- "--permission-mode",
2567
- permission,
2569
+ // クラウド実行では権限モードを渡さない。クラウドセッションは `--permission-mode` を
2570
+ // 受理するが VM 側へ反映せず(Issue #307。VM の権限モードは cloud-setup が書く
2571
+ // settings.json の `permissions.defaultMode` が決める)、一方でローカル側の作成
2572
+ // コマンドは script(1) の疑似pty越し=**対話起動**として扱われるため、
2573
+ // `bypassPermissions` を渡すと claude が「WARNING: ... Bypass Permissions mode /
2574
+ // No, exit / Yes, I accept」の承認ダイアログを出す(print モードでは出ない)。
2575
+ // 作成コマンドの stdin は ignore で誰も応答できず、セッションIDが出力されないまま
2576
+ // 必ず `timed out waiting for the cloud session id` で失敗する。
2577
+ ...cloud === true ? [] : ["--permission-mode", permission],
2568
2578
  "--disallowedTools",
2569
2579
  DISALLOWED_TOOLS_ARG,
2570
2580
  "--append-system-prompt-file",
@@ -3680,11 +3690,12 @@ async function notifyError(workerName, repoName, error) {
3680
3690
  }
3681
3691
 
3682
3692
  // src/worktree.ts
3683
- import { execFile as execFile2 } from "node:child_process";
3693
+ import { createRequire as createRequire3 } from "node:module";
3684
3694
  import { promisify as promisify3 } from "node:util";
3685
3695
  import { readdir, rm, stat } from "node:fs/promises";
3686
3696
  import { basename as basename2, resolve as resolve2, sep } from "node:path";
3687
- var execFileAsync2 = promisify3(execFile2);
3697
+ var childProcess3 = createRequire3(import.meta.url)("node:child_process");
3698
+ var execFileAsync2 = (command, args) => promisify3(childProcess3.execFile)(command, args);
3688
3699
  var WORKTREES_DIR = ".claude/worktrees";
3689
3700
  function isManagedWorktreePath(path2) {
3690
3701
  return resolve2(path2).startsWith(resolve2(WORKTREES_DIR) + sep);
@@ -4706,9 +4717,10 @@ var applyUiDesignWorker = async (opts = {}) => {
4706
4717
  };
4707
4718
 
4708
4719
  // src/last-run-pr.ts
4709
- import { execFile as execFile3 } from "node:child_process";
4720
+ import { createRequire as createRequire4 } from "node:module";
4710
4721
  import { promisify as promisify4 } from "node:util";
4711
- var execFileAsync3 = promisify4(execFile3);
4722
+ var childProcess4 = createRequire4(import.meta.url)("node:child_process");
4723
+ var execFileAsync3 = (command, args) => promisify4(childProcess4.execFile)(command, args);
4712
4724
  var CONFIG_FILE = "claude-task-worker.json";
4713
4725
  var LABEL_TRIAGE_SCOPE2 = "cc-triage-scope";
4714
4726
  function lastRunBranchName(workerName) {
@@ -4748,18 +4760,14 @@ async function publishLastRunPr(workerName, defaultBranch, at) {
4748
4760
  await git(cwd, ["commit", "-m", lastRunPrTitle(workerName)]);
4749
4761
  await git(cwd, ["push", "--force", "origin", `HEAD:refs/heads/${branch}`]);
4750
4762
  const existing = await findOpenPrNumberByHeadRef(branch);
4751
- if (existing !== null) {
4752
- console.log(`[${workerName}] updated lastRun PR #${existing}`);
4753
- return existing;
4754
- }
4755
- const prNumber = await createPullRequest(
4756
- defaultBranch,
4757
- branch,
4758
- lastRunPrTitle(workerName),
4759
- lastRunPrBody(workerName, at),
4760
- { labels: [LABEL_TRIAGE_SCOPE2], assignee: await getCurrentUser() }
4763
+ const prNumber = existing ?? await createPullRequest(defaultBranch, branch, lastRunPrTitle(workerName), lastRunPrBody(workerName, at));
4764
+ console.log(`[${workerName}] ${existing !== null ? "updated" : "opened"} lastRun PR #${prNumber}`);
4765
+ await addLabel("pr", prNumber, LABEL_TRIAGE_SCOPE2).catch(
4766
+ (err) => console.error(`[${workerName}] addLabel ${LABEL_TRIAGE_SCOPE2} failed for PR #${prNumber}: ${err}`)
4767
+ );
4768
+ await addAssignee("pr", prNumber, await getCurrentUser()).catch(
4769
+ (err) => console.error(`[${workerName}] addAssignee failed for PR #${prNumber}: ${err}`)
4761
4770
  );
4762
- console.log(`[${workerName}] opened lastRun PR #${prNumber}`);
4763
4771
  return prNumber;
4764
4772
  } finally {
4765
4773
  await removeWorktree(branch).catch((err) => console.error(`[${workerName}] removeWorktree failed: ${err}`));
@@ -5521,9 +5529,9 @@ function version() {
5521
5529
  }
5522
5530
 
5523
5531
  // src/index.ts
5524
- import { execFile as execFile4 } from "node:child_process";
5532
+ import { execFile as execFile2 } from "node:child_process";
5525
5533
  import { promisify as promisify5 } from "node:util";
5526
- var execFileAsync4 = promisify5(execFile4);
5534
+ var execFileAsync4 = promisify5(execFile2);
5527
5535
  var WORKERS = {
5528
5536
  "exec-issue": execIssueWorker,
5529
5537
  "fix-review-point": fixReviewPointWorker,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-task-worker",
3
- "version": "0.108.0",
3
+ "version": "0.110.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",