claude-task-worker 0.13.0 → 0.15.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 +27 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -67,10 +67,10 @@ __export(herdr_exports, {
67
67
  tabCreate: () => tabCreate,
68
68
  tabList: () => tabList
69
69
  });
70
- import { createRequire } from "node:module";
70
+ import { createRequire as createRequire2 } from "node:module";
71
71
  function runHerdr(args) {
72
72
  return new Promise((resolve2) => {
73
- childProcess.execFile(
73
+ childProcess2.execFile(
74
74
  "herdr",
75
75
  args,
76
76
  { timeout: HERDR_TIMEOUT_MS, killSignal: "SIGKILL" },
@@ -162,11 +162,11 @@ async function checkHerdrAvailable() {
162
162
  );
163
163
  }
164
164
  }
165
- var childProcess, HerdrUnavailableError, HerdrError, HERDR_TIMEOUT_MS;
165
+ var childProcess2, HerdrUnavailableError, HerdrError, HERDR_TIMEOUT_MS;
166
166
  var init_herdr = __esm({
167
167
  "src/herdr.ts"() {
168
168
  "use strict";
169
- childProcess = createRequire(import.meta.url)("node:child_process");
169
+ childProcess2 = createRequire2(import.meta.url)("node:child_process");
170
170
  HerdrUnavailableError = class extends Error {
171
171
  reason;
172
172
  constructor(message, reason) {
@@ -351,7 +351,7 @@ async function sendCtrlCToAllSessions(sessions, herdr) {
351
351
  await Promise.all(
352
352
  [...sessions.values()].map(async (session) => {
353
353
  try {
354
- await herdr.paneSendKeys(session.paneId, "ctrl-c");
354
+ await herdr.paneSendKeys(session.paneId, CTRL_C_KEY);
355
355
  } catch (error) {
356
356
  console.error(`[dispatcher] failed to send ctrl-c to session "${session.name}": ${error}`);
357
357
  }
@@ -462,7 +462,7 @@ function createDispatcherShutdownHandler(shutdown2) {
462
462
  };
463
463
  return { handle, isShuttingDown: () => shuttingDown2 };
464
464
  }
465
- var getDisplayWidth2, truncateToWidth2, padToWidth2, POLL_INTERVAL_MS, SHUTDOWN_TIMEOUT_MS, SHUTDOWN_RETRY_TIMEOUT_MS, shutdownPromise;
465
+ var getDisplayWidth2, truncateToWidth2, padToWidth2, POLL_INTERVAL_MS, SHUTDOWN_TIMEOUT_MS, SHUTDOWN_RETRY_TIMEOUT_MS, CTRL_C_KEY, shutdownPromise;
466
466
  var init_dispatcher = __esm({
467
467
  async "src/dispatcher.ts"() {
468
468
  "use strict";
@@ -470,14 +470,16 @@ var init_dispatcher = __esm({
470
470
  POLL_INTERVAL_MS = 7 * 1e3;
471
471
  SHUTDOWN_TIMEOUT_MS = 10 * 60 * 1e3;
472
472
  SHUTDOWN_RETRY_TIMEOUT_MS = 90 * 1e3;
473
+ CTRL_C_KEY = "ctrl+c";
473
474
  }
474
475
  });
475
476
 
476
477
  // src/gh.ts
477
- import { execFile } from "node:child_process";
478
+ import { createRequire } from "node:module";
479
+ var childProcess = createRequire(import.meta.url)("node:child_process");
478
480
  function execGh(args) {
479
481
  return new Promise((resolve2, reject) => {
480
- execFile("gh", args, (error, stdout, stderr) => {
482
+ childProcess.execFile("gh", args, (error, stdout, stderr) => {
481
483
  if (error) {
482
484
  reject(new Error(`gh ${args.join(" ")} failed: ${stderr || error.message}`));
483
485
  return;
@@ -488,7 +490,7 @@ function execGh(args) {
488
490
  }
489
491
  function execGhAllowExit(args, allowedCodes) {
490
492
  return new Promise((resolve2, reject) => {
491
- execFile("gh", args, (error, stdout, stderr) => {
493
+ childProcess.execFile("gh", args, (error, stdout, stderr) => {
492
494
  if (error) {
493
495
  const code = error.code;
494
496
  if (typeof code === "number" && allowedCodes.includes(code)) {
@@ -663,6 +665,14 @@ async function addLabel(type, number, label) {
663
665
  }
664
666
  });
665
667
  }
668
+ async function hasLabel(type, number, label) {
669
+ return withRetry(async () => {
670
+ const output = await execGh([type, "view", String(number), "--json", "labels"]);
671
+ const parsed = JSON.parse(output);
672
+ const labels = parsed?.labels ?? [];
673
+ return labels.some((l) => l.name === label);
674
+ });
675
+ }
666
676
  async function removeLabel(type, number, label) {
667
677
  await withRetry(async () => {
668
678
  try {
@@ -889,9 +899,9 @@ function getWorkerConfig(workerName) {
889
899
  }
890
900
 
891
901
  // src/git.ts
892
- import { execSync, execFile as execFile2 } from "node:child_process";
902
+ import { execSync, execFile } from "node:child_process";
893
903
  import { promisify } from "node:util";
894
- var execFileAsync = promisify(execFile2);
904
+ var execFileAsync = promisify(execFile);
895
905
  var running = false;
896
906
  function syncDefaultBranch(branch) {
897
907
  if (running) return;
@@ -1538,11 +1548,11 @@ async function notifyError(workerName, repoName, error) {
1538
1548
  }
1539
1549
 
1540
1550
  // src/worktree.ts
1541
- import { execFile as execFile3 } from "node:child_process";
1551
+ import { execFile as execFile2 } from "node:child_process";
1542
1552
  import { promisify as promisify3 } from "node:util";
1543
1553
  import { readdir, rm, stat } from "node:fs/promises";
1544
1554
  import { basename, resolve, sep } from "node:path";
1545
- var execFileAsync2 = promisify3(execFile3);
1555
+ var execFileAsync2 = promisify3(execFile2);
1546
1556
  var WORKTREES_DIR = ".claude/worktrees";
1547
1557
  function isManagedWorktreePath(path) {
1548
1558
  return resolve(path).startsWith(resolve(WORKTREES_DIR) + sep);
@@ -1816,6 +1826,10 @@ var execIssueWorker = (opts = {}) => createIssuePollingWorker({
1816
1826
  epicFilters: opts.epicFilters,
1817
1827
  labelFilters: opts.labelFilters,
1818
1828
  onCompleted: async (issueNumber) => {
1829
+ if (await hasLabel("issue", issueNumber, "cc-need-human-check")) {
1830
+ console.log(`[exec-issue] #${issueNumber}: cc-need-human-check present, skip cc-pr-created`);
1831
+ return;
1832
+ }
1819
1833
  await addLabel("issue", issueNumber, "cc-pr-created");
1820
1834
  }
1821
1835
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-task-worker",
3
- "version": "0.13.0",
3
+ "version": "0.15.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",