claude-task-worker 0.14.0 → 0.16.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 +34 -15
  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) {
@@ -193,6 +193,7 @@ __export(dispatcher_exports, {
193
193
  POLL_INTERVAL_MS: () => POLL_INTERVAL_MS,
194
194
  SHUTDOWN_RETRY_TIMEOUT_MS: () => SHUTDOWN_RETRY_TIMEOUT_MS,
195
195
  SHUTDOWN_TIMEOUT_MS: () => SHUTDOWN_TIMEOUT_MS,
196
+ TAB_LABEL_PREFIX: () => TAB_LABEL_PREFIX,
196
197
  createDispatcherShutdownHandler: () => createDispatcherShutdownHandler,
197
198
  formatUptime: () => formatUptime,
198
199
  monitorSessions: () => monitorSessions,
@@ -200,7 +201,8 @@ __export(dispatcher_exports, {
200
201
  removeSession: () => removeSession,
201
202
  renderSessionTable: () => renderSessionTable,
202
203
  runDispatcher: () => runDispatcher,
203
- shutdownDispatcher: () => shutdownDispatcher
204
+ shutdownDispatcher: () => shutdownDispatcher,
205
+ tabLabelFor: () => tabLabelFor
204
206
  });
205
207
  async function loadHerdr() {
206
208
  return await Promise.resolve().then(() => (init_herdr(), herdr_exports));
@@ -208,6 +210,9 @@ async function loadHerdr() {
208
210
  async function loadTable() {
209
211
  return await Promise.resolve().then(() => (init_table(), table_exports));
210
212
  }
213
+ function tabLabelFor(projectName) {
214
+ return `${TAB_LABEL_PREFIX}${projectName}`;
215
+ }
211
216
  async function runDispatcher(projects, forwardedCommand) {
212
217
  const { checkHerdrAvailable: checkHerdrAvailable2, tabCreate: tabCreate2, tabClose: tabClose2, tabList: tabList2, paneSendText: paneSendText2, paneSendKeys: paneSendKeys2 } = await loadHerdr();
213
218
  try {
@@ -221,13 +226,13 @@ async function runDispatcher(projects, forwardedCommand) {
221
226
  const existingLabels = new Set(existingTabs.map((tab) => tab.label));
222
227
  const sessions = /* @__PURE__ */ new Map();
223
228
  for (const project of projects) {
224
- if (existingLabels.has(project.name)) {
229
+ if (existingLabels.has(tabLabelFor(project.name))) {
225
230
  console.warn(`[dispatcher] project "${project.name}" already has a running tab, skipping`);
226
231
  continue;
227
232
  }
228
233
  let createdTabId;
229
234
  try {
230
- const { paneId, tabId } = await tabCreate2({ label: project.name, cwd: project.path });
235
+ const { paneId, tabId } = await tabCreate2({ label: tabLabelFor(project.name), cwd: project.path });
231
236
  createdTabId = tabId;
232
237
  sessions.set(project.name, {
233
238
  name: project.name,
@@ -462,23 +467,25 @@ function createDispatcherShutdownHandler(shutdown2) {
462
467
  };
463
468
  return { handle, isShuttingDown: () => shuttingDown2 };
464
469
  }
465
- var getDisplayWidth2, truncateToWidth2, padToWidth2, POLL_INTERVAL_MS, SHUTDOWN_TIMEOUT_MS, SHUTDOWN_RETRY_TIMEOUT_MS, CTRL_C_KEY, shutdownPromise;
470
+ var getDisplayWidth2, truncateToWidth2, padToWidth2, POLL_INTERVAL_MS, SHUTDOWN_TIMEOUT_MS, TAB_LABEL_PREFIX, SHUTDOWN_RETRY_TIMEOUT_MS, CTRL_C_KEY, shutdownPromise;
466
471
  var init_dispatcher = __esm({
467
472
  async "src/dispatcher.ts"() {
468
473
  "use strict";
469
474
  ({ getDisplayWidth: getDisplayWidth2, truncateToWidth: truncateToWidth2, padToWidth: padToWidth2 } = await loadTable());
470
475
  POLL_INTERVAL_MS = 7 * 1e3;
471
476
  SHUTDOWN_TIMEOUT_MS = 10 * 60 * 1e3;
477
+ TAB_LABEL_PREFIX = "ctw:";
472
478
  SHUTDOWN_RETRY_TIMEOUT_MS = 90 * 1e3;
473
479
  CTRL_C_KEY = "ctrl+c";
474
480
  }
475
481
  });
476
482
 
477
483
  // src/gh.ts
478
- import { execFile } from "node:child_process";
484
+ import { createRequire } from "node:module";
485
+ var childProcess = createRequire(import.meta.url)("node:child_process");
479
486
  function execGh(args) {
480
487
  return new Promise((resolve2, reject) => {
481
- execFile("gh", args, (error, stdout, stderr) => {
488
+ childProcess.execFile("gh", args, (error, stdout, stderr) => {
482
489
  if (error) {
483
490
  reject(new Error(`gh ${args.join(" ")} failed: ${stderr || error.message}`));
484
491
  return;
@@ -489,7 +496,7 @@ function execGh(args) {
489
496
  }
490
497
  function execGhAllowExit(args, allowedCodes) {
491
498
  return new Promise((resolve2, reject) => {
492
- execFile("gh", args, (error, stdout, stderr) => {
499
+ childProcess.execFile("gh", args, (error, stdout, stderr) => {
493
500
  if (error) {
494
501
  const code = error.code;
495
502
  if (typeof code === "number" && allowedCodes.includes(code)) {
@@ -664,6 +671,14 @@ async function addLabel(type, number, label) {
664
671
  }
665
672
  });
666
673
  }
674
+ async function hasLabel(type, number, label) {
675
+ return withRetry(async () => {
676
+ const output = await execGh([type, "view", String(number), "--json", "labels"]);
677
+ const parsed = JSON.parse(output);
678
+ const labels = parsed?.labels ?? [];
679
+ return labels.some((l) => l.name === label);
680
+ });
681
+ }
667
682
  async function removeLabel(type, number, label) {
668
683
  await withRetry(async () => {
669
684
  try {
@@ -890,9 +905,9 @@ function getWorkerConfig(workerName) {
890
905
  }
891
906
 
892
907
  // src/git.ts
893
- import { execSync, execFile as execFile2 } from "node:child_process";
908
+ import { execSync, execFile } from "node:child_process";
894
909
  import { promisify } from "node:util";
895
- var execFileAsync = promisify(execFile2);
910
+ var execFileAsync = promisify(execFile);
896
911
  var running = false;
897
912
  function syncDefaultBranch(branch) {
898
913
  if (running) return;
@@ -1539,11 +1554,11 @@ async function notifyError(workerName, repoName, error) {
1539
1554
  }
1540
1555
 
1541
1556
  // src/worktree.ts
1542
- import { execFile as execFile3 } from "node:child_process";
1557
+ import { execFile as execFile2 } from "node:child_process";
1543
1558
  import { promisify as promisify3 } from "node:util";
1544
1559
  import { readdir, rm, stat } from "node:fs/promises";
1545
1560
  import { basename, resolve, sep } from "node:path";
1546
- var execFileAsync2 = promisify3(execFile3);
1561
+ var execFileAsync2 = promisify3(execFile2);
1547
1562
  var WORKTREES_DIR = ".claude/worktrees";
1548
1563
  function isManagedWorktreePath(path) {
1549
1564
  return resolve(path).startsWith(resolve(WORKTREES_DIR) + sep);
@@ -1817,6 +1832,10 @@ var execIssueWorker = (opts = {}) => createIssuePollingWorker({
1817
1832
  epicFilters: opts.epicFilters,
1818
1833
  labelFilters: opts.labelFilters,
1819
1834
  onCompleted: async (issueNumber) => {
1835
+ if (await hasLabel("issue", issueNumber, "cc-need-human-check")) {
1836
+ console.log(`[exec-issue] #${issueNumber}: cc-need-human-check present, skip cc-pr-created`);
1837
+ return;
1838
+ }
1820
1839
  await addLabel("issue", issueNumber, "cc-pr-created");
1821
1840
  }
1822
1841
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-task-worker",
3
- "version": "0.14.0",
3
+ "version": "0.16.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",