claude-task-worker 0.108.0 → 0.109.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 +21 -20
  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}`);
@@ -3680,11 +3683,12 @@ async function notifyError(workerName, repoName, error) {
3680
3683
  }
3681
3684
 
3682
3685
  // src/worktree.ts
3683
- import { execFile as execFile2 } from "node:child_process";
3686
+ import { createRequire as createRequire3 } from "node:module";
3684
3687
  import { promisify as promisify3 } from "node:util";
3685
3688
  import { readdir, rm, stat } from "node:fs/promises";
3686
3689
  import { basename as basename2, resolve as resolve2, sep } from "node:path";
3687
- var execFileAsync2 = promisify3(execFile2);
3690
+ var childProcess3 = createRequire3(import.meta.url)("node:child_process");
3691
+ var execFileAsync2 = (command, args) => promisify3(childProcess3.execFile)(command, args);
3688
3692
  var WORKTREES_DIR = ".claude/worktrees";
3689
3693
  function isManagedWorktreePath(path2) {
3690
3694
  return resolve2(path2).startsWith(resolve2(WORKTREES_DIR) + sep);
@@ -4706,9 +4710,10 @@ var applyUiDesignWorker = async (opts = {}) => {
4706
4710
  };
4707
4711
 
4708
4712
  // src/last-run-pr.ts
4709
- import { execFile as execFile3 } from "node:child_process";
4713
+ import { createRequire as createRequire4 } from "node:module";
4710
4714
  import { promisify as promisify4 } from "node:util";
4711
- var execFileAsync3 = promisify4(execFile3);
4715
+ var childProcess4 = createRequire4(import.meta.url)("node:child_process");
4716
+ var execFileAsync3 = (command, args) => promisify4(childProcess4.execFile)(command, args);
4712
4717
  var CONFIG_FILE = "claude-task-worker.json";
4713
4718
  var LABEL_TRIAGE_SCOPE2 = "cc-triage-scope";
4714
4719
  function lastRunBranchName(workerName) {
@@ -4748,18 +4753,14 @@ async function publishLastRunPr(workerName, defaultBranch, at) {
4748
4753
  await git(cwd, ["commit", "-m", lastRunPrTitle(workerName)]);
4749
4754
  await git(cwd, ["push", "--force", "origin", `HEAD:refs/heads/${branch}`]);
4750
4755
  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() }
4756
+ const prNumber = existing ?? await createPullRequest(defaultBranch, branch, lastRunPrTitle(workerName), lastRunPrBody(workerName, at));
4757
+ console.log(`[${workerName}] ${existing !== null ? "updated" : "opened"} lastRun PR #${prNumber}`);
4758
+ await addLabel("pr", prNumber, LABEL_TRIAGE_SCOPE2).catch(
4759
+ (err) => console.error(`[${workerName}] addLabel ${LABEL_TRIAGE_SCOPE2} failed for PR #${prNumber}: ${err}`)
4760
+ );
4761
+ await addAssignee("pr", prNumber, await getCurrentUser()).catch(
4762
+ (err) => console.error(`[${workerName}] addAssignee failed for PR #${prNumber}: ${err}`)
4761
4763
  );
4762
- console.log(`[${workerName}] opened lastRun PR #${prNumber}`);
4763
4764
  return prNumber;
4764
4765
  } finally {
4765
4766
  await removeWorktree(branch).catch((err) => console.error(`[${workerName}] removeWorktree failed: ${err}`));
@@ -5521,9 +5522,9 @@ function version() {
5521
5522
  }
5522
5523
 
5523
5524
  // src/index.ts
5524
- import { execFile as execFile4 } from "node:child_process";
5525
+ import { execFile as execFile2 } from "node:child_process";
5525
5526
  import { promisify as promisify5 } from "node:util";
5526
- var execFileAsync4 = promisify5(execFile4);
5527
+ var execFileAsync4 = promisify5(execFile2);
5527
5528
  var WORKERS = {
5528
5529
  "exec-issue": execIssueWorker,
5529
5530
  "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.109.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",