claude-task-worker 0.118.0 → 0.119.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/README.md CHANGED
@@ -239,11 +239,12 @@ claude-task-worker all --inherit-config ~/ctw/shared.json
239
239
  claude-task-worker init --inherit-config ~/ctw/shared.json # 指定パスへ設定ファイルを生成する
240
240
  ```
241
241
 
242
+ - フラグの代わりに、cwd 直下の `claude-task-worker.json`(または `claude-task-worker.local.json`。local が勝つ)のトップレベル `inheritConfig` に土台ファイルのパスを書いてもよい(例: `"inheritConfig": "~/ctw/shared.json"`)。挙動はフラグと同一で、相対パスは cwd 基準、`~` はホーム展開。フラグとキーの両方があればフラグが勝つ。土台ファイル側の `inheritConfig` は解釈しない(継承は1段のみ)。非 string・空文字は警告して未指定扱い
242
243
  - 未指定時は従来どおり cwd 直下の `claude-task-worker.json` / `claude-task-worker.local.json` だけを読む
243
244
  - 値自体の相対パスは起動時の cwd 基準。ファイル内の相対パス(`workerFiles` / `uiDesign.designDir`)は**そのファイルの所在ディレクトリ基準**で解決する
244
245
  - 配列(`labels` / `workerFiles` など)は置き換えではなく、cwd 側の値を土台の後ろへ追記する(重複は除く)。cwd の `claude-task-worker.json` と `claude-task-worker.local.json` 同士は従来どおり local が丸ごと置き換え、その結果を土台へ追記する
245
246
  - `claude-task-worker.local.json` は常に cwd 直下のものを読む(指定ファイルと同じディレクトリのものは読まない)。cwd 直下の `claude-task-worker.json` は無くてもよい
246
- - 指定ファイルが存在しなければエラー終了する(既定ファイルへは倒さない)。`--project` では絶対パスにして各プロジェクトへ転送する
247
+ - 指定ファイルが存在しなければエラー終了する(既定ファイルへは倒さない。メッセージは指定元に応じて `--inherit-config <path>` / `inheritConfig <path>`)。`--project` では絶対パスにして各プロジェクトへ転送する
247
248
  - 定期ワーカーの `lastRun` は指定に関わらずリポジトリ直下の `claude-task-worker.json` で読み書きする。リポジトリ直下に同ファイルが無ければ `lastRun` だけを持つファイルが作られる(他のキーを持たないので土台の設定とは衝突しない)。`init` を `--inherit-config` 付きで実行した場合も、未記録のワーカーの `lastRun` はリポジトリ直下へ記録する(セットアップ直後に定期ワーカーが一斉に走らないようにするため)
248
249
  - スキル(`create-ui-design` / `update-design-md` / `triage-created-issue`)はリポジトリ直下の `claude-task-worker.json` を直接読むため、**`uiDesign` の設定は `--inherit-config` のファイルに書いてもスキルには届かない**。`uiDesign` はリポジトリ直下に書くこと
249
250
 
@@ -514,6 +514,7 @@ function buildForwardedCommand(argv) {
514
514
 
515
515
  // src/config.ts
516
516
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
517
+ import { homedir } from "node:os";
517
518
  import { dirname, isAbsolute, join, normalize, relative, resolve as resolve2, sep as SEP } from "node:path";
518
519
  var DEFAULT_UI_DESIGN_CONFIG = {
519
520
  enabled: false,
@@ -965,19 +966,39 @@ function resolveInheritedRelativePaths(raw, configDir, repoRoot) {
965
966
  }
966
967
  return result;
967
968
  }
968
- function readInheritedRawConfig(path2, repoRoot) {
969
- if (!existsSync(path2)) {
970
- throw new Error(`${INHERIT_CONFIG_FLAG} ${path2} does not exist`);
969
+ var INHERIT_CONFIG_KEY = "inheritConfig";
970
+ var cachedInheritConfigSource;
971
+ function resolveInheritConfigSource() {
972
+ if (cachedInheritConfigSource !== void 0) return cachedInheritConfigSource;
973
+ const flagPath = getInheritConfigPath();
974
+ if (flagPath) return cachedInheritConfigSource = { path: flagPath, origin: INHERIT_CONFIG_FLAG };
975
+ const raw = readCwdRawConfig();
976
+ if (!(INHERIT_CONFIG_KEY in raw)) return cachedInheritConfigSource = null;
977
+ const val = raw[INHERIT_CONFIG_KEY];
978
+ if (typeof val !== "string" || val.trim().length === 0) {
979
+ console.warn(`[config] invalid ${INHERIT_CONFIG_KEY}: ${String(val)}, ignoring`);
980
+ return cachedInheritConfigSource = null;
981
+ }
982
+ cachedInheritConfigSource = {
983
+ path: resolveWorkerFilePath(val.trim(), process.cwd(), homedir()),
984
+ origin: INHERIT_CONFIG_KEY
985
+ };
986
+ return cachedInheritConfigSource;
987
+ }
988
+ function readInheritedRawConfig(source, repoRoot) {
989
+ if (!existsSync(source.path)) {
990
+ throw new Error(`${source.origin} ${source.path} does not exist`);
971
991
  }
972
- return resolveInheritedRelativePaths(readRawConfig(path2), dirname(path2), repoRoot);
992
+ const { [INHERIT_CONFIG_KEY]: _ignored, ...raw } = readRawConfig(source.path);
993
+ return resolveInheritedRelativePaths(raw, dirname(source.path), repoRoot);
973
994
  }
974
995
  function readCwdRawConfig() {
975
996
  return mergeConfigRaw(readRawConfig(CONFIG_PATH), readRawConfig(LOCAL_CONFIG_PATH));
976
997
  }
977
998
  function loadConfig() {
978
- const inheritPath = getInheritConfigPath();
999
+ const inheritSource = resolveInheritConfigSource();
979
1000
  const cwdRaw = readCwdRawConfig();
980
- const raw = inheritPath ? mergeConfigRaw(readInheritedRawConfig(inheritPath, process.cwd()), cwdRaw, true) : cwdRaw;
1001
+ const raw = inheritSource ? mergeConfigRaw(readInheritedRawConfig(inheritSource, process.cwd()), cwdRaw, true) : cwdRaw;
981
1002
  const result = {
982
1003
  ...DEFAULT_CONFIG,
983
1004
  labels: [],
@@ -1098,7 +1119,7 @@ function getUiDesignConfig() {
1098
1119
 
1099
1120
  // src/user-config.ts
1100
1121
  import { readFileSync as readFileSync2, statSync } from "node:fs";
1101
- import { homedir } from "node:os";
1122
+ import { homedir as homedir2 } from "node:os";
1102
1123
  import { isAbsolute as isAbsolute2, join as join2, resolve as resolve3 } from "node:path";
1103
1124
  var RESERVED_ALL = "all";
1104
1125
  var DEFAULT_RUN_MODE = "default";
@@ -1120,7 +1141,7 @@ var UserConfigError = class extends Error {
1120
1141
  };
1121
1142
  function getConfigDir() {
1122
1143
  const xdg = process.env.XDG_CONFIG_HOME;
1123
- const configHome = xdg && xdg.length > 0 ? xdg : join2(homedir(), ".config");
1144
+ const configHome = xdg && xdg.length > 0 ? xdg : join2(homedir2(), ".config");
1124
1145
  return join2(configHome, "claude-task-worker");
1125
1146
  }
1126
1147
  function getUserConfigPath() {
@@ -2338,15 +2359,15 @@ function isGeneratedWorktreeName(name) {
2338
2359
  // src/slack.ts
2339
2360
  import { exec } from "node:child_process";
2340
2361
  import { readFileSync as readFileSync3, writeFileSync as writeFileSync4 } from "node:fs";
2341
- import { homedir as homedir3 } from "node:os";
2362
+ import { homedir as homedir4 } from "node:os";
2342
2363
  import { join as join4 } from "node:path";
2343
2364
  import { promisify as promisify2 } from "node:util";
2344
2365
 
2345
2366
  // src/runcat.ts
2346
2367
  import { mkdirSync as mkdirSync2, renameSync as renameSync2, rmSync, writeFileSync as writeFileSync3 } from "node:fs";
2347
- import { homedir as homedir2 } from "node:os";
2368
+ import { homedir as homedir3 } from "node:os";
2348
2369
  import { dirname as dirname2, join as join3 } from "node:path";
2349
- var RUNCAT_OUT_FILE = process.env.RUNCAT_OUT_FILE ?? join3(process.env.HOME ?? homedir2(), ".claude", "runcat-usage.json");
2370
+ var RUNCAT_OUT_FILE = process.env.RUNCAT_OUT_FILE ?? join3(process.env.HOME ?? homedir3(), ".claude", "runcat-usage.json");
2350
2371
  var JST = "Asia/Tokyo";
2351
2372
  function formatG(value) {
2352
2373
  return String(Number(value.toPrecision(6)));
@@ -2447,7 +2468,7 @@ async function getOAuthToken() {
2447
2468
  const { stdout } = await execAsync('security find-generic-password -s "Claude Code-credentials" -w');
2448
2469
  return extractToken(JSON.parse(stdout.trim()));
2449
2470
  } catch {
2450
- const raw = readFileSync3(join4(homedir3(), ".claude", ".credentials.json"), "utf-8");
2471
+ const raw = readFileSync3(join4(homedir4(), ".claude", ".credentials.json"), "utf-8");
2451
2472
  return extractToken(JSON.parse(raw));
2452
2473
  }
2453
2474
  }
@@ -3336,7 +3357,6 @@ export {
3336
3357
  hasProjectFilter,
3337
3358
  assertProjectCompatibleCommand,
3338
3359
  hasCloudFlag,
3339
- INHERIT_CONFIG_FLAG,
3340
3360
  getInheritConfigPath,
3341
3361
  assertCloudCompatibleCommand,
3342
3362
  buildForwardedCommand,
@@ -3349,6 +3369,8 @@ export {
3349
3369
  CONFIG_PATH,
3350
3370
  LOCAL_CONFIG_PATH,
3351
3371
  resolveWorkerFilePath,
3372
+ INHERIT_CONFIG_KEY,
3373
+ resolveInheritConfigSource,
3352
3374
  loadConfig,
3353
3375
  getWorkerConfig,
3354
3376
  isWorkerEnabled,
package/dist/config.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { INHERIT_CONFIG_FLAG } from "./dispatch-args";
1
2
  export type WorkerName = "exec-issue" | "answer-issue-questions" | "create-issue" | "update-issue" | "triage-created-issue" | "fix-review-point" | "check-dependabot" | "triage-pr" | "resolve-conflict" | "epic-issue" | "create-ui-design" | "apply-ui-design" | "update-coding-guidelines" | "update-requirement-rules" | "update-design-md";
2
3
  export interface WorkerRuntimeConfig {
3
4
  skill: string;
@@ -62,6 +63,13 @@ export declare function parseWorkerFilesEntry(val: unknown): string[];
62
63
  export declare function resolveWorkerFilePath(entry: string, configDir: string, home: string): string;
63
64
  export declare function mergeConfigRaw(base: Record<string, unknown>, local: Record<string, unknown>, appendArrays?: boolean): Record<string, unknown>;
64
65
  export declare function resolveInheritedRelativePaths(raw: Record<string, unknown>, configDir: string, repoRoot: string): Record<string, unknown>;
66
+ export declare const INHERIT_CONFIG_KEY = "inheritConfig";
67
+ export interface InheritConfigSource {
68
+ path: string;
69
+ origin: typeof INHERIT_CONFIG_FLAG | typeof INHERIT_CONFIG_KEY;
70
+ }
71
+ export declare function resolveInheritConfigSource(): InheritConfigSource | null;
72
+ export declare function resetInheritConfigSourceCache(): void;
65
73
  export declare function loadConfig(): Config;
66
74
  export declare function getWorkerConfig(workerName: string): WorkerRuntimeConfig;
67
75
  export declare function isWorkerEnabled(workerName: string): boolean;
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  CONFIG_PATH,
5
5
  DEFAULT_CONFIG,
6
6
  DEFAULT_UI_DESIGN_CONFIG,
7
- INHERIT_CONFIG_FLAG,
7
+ INHERIT_CONFIG_KEY,
8
8
  LOCAL_CONFIG_PATH,
9
9
  SCHEDULED_WORKER_NAMES,
10
10
  UserConfigError,
@@ -57,6 +57,7 @@ import {
57
57
  partitionEnabledWorkers,
58
58
  removeStaleWorktrees,
59
59
  renderTable,
60
+ resolveInheritConfigSource,
60
61
  resolveTargetProjects,
61
62
  resolveWorkerFilePath,
62
63
  send,
@@ -64,7 +65,7 @@ import {
64
65
  shutdown,
65
66
  waitForAllProcesses,
66
67
  writeLastRun
67
- } from "./chunk-ULDG6SEE.js";
68
+ } from "./chunk-Z2IEIKI3.js";
68
69
  import {
69
70
  captureConsole
70
71
  } from "./chunk-N42YU3GJ.js";
@@ -1537,10 +1538,17 @@ if (workerType === "version" || workerType === "--version" || workerType === "-v
1537
1538
  process.exit(process.exitCode ?? 0);
1538
1539
  }
1539
1540
  void notifyIfOutdated();
1540
- var inheritConfigPath = getInheritConfigPath();
1541
- if (inheritConfigPath && workerType !== "init" && !existsSync3(inheritConfigPath)) {
1542
- console.error(`${INHERIT_CONFIG_FLAG} ${inheritConfigPath} does not exist`);
1543
- process.exit(1);
1541
+ if (workerType !== "init") {
1542
+ let inheritSource;
1543
+ try {
1544
+ inheritSource = resolveInheritConfigSource();
1545
+ } catch {
1546
+ inheritSource = null;
1547
+ }
1548
+ if (inheritSource && !(hasProjectFilter() && inheritSource.origin === INHERIT_CONFIG_KEY) && !existsSync3(inheritSource.path)) {
1549
+ console.error(`${inheritSource.origin} ${inheritSource.path} does not exist`);
1550
+ process.exit(1);
1551
+ }
1544
1552
  }
1545
1553
  var customWorkers = workerType && !NON_WORKER_COMMANDS.includes(workerType) && !hasProjectFilter() ? await loadCustomWorkersOrExit() : [];
1546
1554
  var WORKERS = Object.fromEntries(
package/dist/lib.js CHANGED
@@ -58,7 +58,7 @@ import {
58
58
  removeWorktreeByBranch,
59
59
  run,
60
60
  syncDefaultBranch
61
- } from "./chunk-ULDG6SEE.js";
61
+ } from "./chunk-Z2IEIKI3.js";
62
62
  import "./chunk-N42YU3GJ.js";
63
63
  export {
64
64
  CLOUD_DONE_LABEL,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-task-worker",
3
- "version": "0.118.0",
3
+ "version": "0.119.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",