claudekit-cli 3.34.1-dev.3 → 3.34.1-dev.4

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 +90 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -45236,7 +45236,7 @@ var package_default;
45236
45236
  var init_package = __esm(() => {
45237
45237
  package_default = {
45238
45238
  name: "claudekit-cli",
45239
- version: "3.34.1-dev.3",
45239
+ version: "3.34.1-dev.4",
45240
45240
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
45241
45241
  type: "module",
45242
45242
  repository: {
@@ -75850,6 +75850,9 @@ class FileScanner {
75850
75850
  }
75851
75851
  }
75852
75852
 
75853
+ // src/domains/installation/merger/settings-processor.ts
75854
+ import { execSync as execSync4 } from "node:child_process";
75855
+
75853
75856
  // src/domains/config/installed-settings-tracker.ts
75854
75857
  init_shared();
75855
75858
  import { existsSync as existsSync36 } from "node:fs";
@@ -75948,14 +75951,17 @@ init_settings_merger();
75948
75951
  init_environment();
75949
75952
  init_logger();
75950
75953
  var import_fs_extra11 = __toESM(require_lib3(), 1);
75954
+ var import_semver2 = __toESM(require_semver2(), 1);
75951
75955
 
75952
75956
  class SettingsProcessor {
75957
+ static MIN_TEAM_HOOKS_VERSION = "2.1.33";
75953
75958
  isGlobal = false;
75954
75959
  forceOverwriteSettings = false;
75955
75960
  projectDir = "";
75956
75961
  kitName = "engineer";
75957
75962
  tracker = null;
75958
75963
  installingKit;
75964
+ cachedVersion = undefined;
75959
75965
  setGlobalFlag(isGlobal) {
75960
75966
  this.isGlobal = isGlobal;
75961
75967
  }
@@ -76001,8 +76007,9 @@ class SettingsProcessor {
76001
76007
  } else {
76002
76008
  const formattedContent = this.formatJsonContent(transformedSource);
76003
76009
  await import_fs_extra11.writeFile(destFile, formattedContent, "utf-8");
76010
+ let parsedSettings;
76004
76011
  try {
76005
- const parsedSettings = JSON.parse(formattedContent);
76012
+ parsedSettings = JSON.parse(formattedContent);
76006
76013
  if (this.forceOverwriteSettings && destExists) {
76007
76014
  logger.debug("Force overwrite enabled, replaced settings.json completely");
76008
76015
  if (this.tracker) {
@@ -76011,6 +76018,7 @@ class SettingsProcessor {
76011
76018
  }
76012
76019
  await this.trackInstalledSettings(parsedSettings);
76013
76020
  } catch {}
76021
+ await this.injectTeamHooksIfSupported(destFile, parsedSettings);
76014
76022
  }
76015
76023
  } catch (error) {
76016
76024
  logger.error(`Failed to process settings.json: ${error}`);
@@ -76071,6 +76079,7 @@ class SettingsProcessor {
76071
76079
  }
76072
76080
  await SettingsMerger.writeSettingsFile(destFile, mergeResult.merged);
76073
76081
  logger.success("Merged settings.json (user customizations preserved)");
76082
+ await this.injectTeamHooksIfSupported(destFile, mergeResult.merged);
76074
76083
  }
76075
76084
  async trackInstalledSettings(settings) {
76076
76085
  if (!this.tracker)
@@ -76142,6 +76151,80 @@ class SettingsProcessor {
76142
76151
  }
76143
76152
  return transformed;
76144
76153
  }
76154
+ detectClaudeCodeVersion() {
76155
+ if (this.cachedVersion !== undefined)
76156
+ return this.cachedVersion;
76157
+ try {
76158
+ const output2 = execSync4("claude --version", {
76159
+ encoding: "utf-8",
76160
+ timeout: 5000,
76161
+ stdio: ["ignore", "pipe", "ignore"]
76162
+ });
76163
+ const match2 = output2.match(/(\d+\.\d+\.\d+)/);
76164
+ this.cachedVersion = match2 ? match2[1] : null;
76165
+ } catch {
76166
+ this.cachedVersion = null;
76167
+ }
76168
+ return this.cachedVersion;
76169
+ }
76170
+ isVersionAtLeast(version, minimum) {
76171
+ const coerced = import_semver2.default.coerce(version);
76172
+ if (!coerced)
76173
+ return false;
76174
+ return import_semver2.default.gte(coerced, minimum);
76175
+ }
76176
+ async injectTeamHooksIfSupported(destFile, existingSettings) {
76177
+ const version = this.detectClaudeCodeVersion();
76178
+ if (!version) {
76179
+ logger.debug("Claude Code version not detected, skipping team hooks injection");
76180
+ return;
76181
+ }
76182
+ if (!this.isVersionAtLeast(version, SettingsProcessor.MIN_TEAM_HOOKS_VERSION)) {
76183
+ logger.debug(`Claude Code ${version} does not support team hooks (requires >= 2.1.33), skipping injection`);
76184
+ return;
76185
+ }
76186
+ logger.debug(`Claude Code ${version} detected, checking team hooks`);
76187
+ const settings = existingSettings ?? await SettingsMerger.readSettingsFile(destFile);
76188
+ if (!settings) {
76189
+ logger.warning("Failed to read settings file for team hooks injection");
76190
+ return;
76191
+ }
76192
+ const prefix = this.isGlobal ? isWindows() ? "%USERPROFILE%" : "$HOME" : isWindows() ? "%CLAUDE_PROJECT_DIR%" : "$CLAUDE_PROJECT_DIR";
76193
+ if (!settings.hooks) {
76194
+ settings.hooks = {};
76195
+ }
76196
+ let injected = false;
76197
+ const installedSettings = this.tracker ? await this.tracker.loadInstalledSettings() : { hooks: [], mcpServers: [] };
76198
+ const teamHooks = [
76199
+ { event: "TaskCompleted", handler: "task-completed-handler.cjs" },
76200
+ { event: "TeammateIdle", handler: "teammate-idle-handler.cjs" }
76201
+ ];
76202
+ for (const { event, handler } of teamHooks) {
76203
+ const hookCommand = `node ${prefix}/.claude/hooks/${handler}`;
76204
+ const eventHooks = settings.hooks[event];
76205
+ if (eventHooks && eventHooks.length > 0)
76206
+ continue;
76207
+ if (this.tracker?.wasHookInstalled(hookCommand, installedSettings)) {
76208
+ logger.debug(`Skipping ${event} hook injection (previously removed by user)`);
76209
+ continue;
76210
+ }
76211
+ settings.hooks[event] = [{ hooks: [{ type: "command", command: hookCommand }] }];
76212
+ logger.info(`Injected ${event} hook`);
76213
+ injected = true;
76214
+ if (this.tracker) {
76215
+ this.tracker.trackHook(hookCommand, installedSettings);
76216
+ }
76217
+ }
76218
+ if (injected) {
76219
+ await SettingsMerger.writeSettingsFile(destFile, settings);
76220
+ if (this.tracker) {
76221
+ await this.tracker.saveInstalledSettings(installedSettings);
76222
+ }
76223
+ logger.success("Team hooks injected successfully");
76224
+ } else {
76225
+ logger.debug("Team hooks already present, no injection needed");
76226
+ }
76227
+ }
76145
76228
  }
76146
76229
 
76147
76230
  // src/domains/installation/merger/copy-executor.ts
@@ -81492,10 +81575,10 @@ init_dist2();
81492
81575
 
81493
81576
  // src/commands/setup/phases/preflight-check.ts
81494
81577
  init_dist2();
81495
- import { execSync as execSync4 } from "node:child_process";
81578
+ import { execSync as execSync5 } from "node:child_process";
81496
81579
  function isGhInstalled() {
81497
81580
  try {
81498
- execSync4("gh --version", { stdio: "pipe" });
81581
+ execSync5("gh --version", { stdio: "pipe" });
81499
81582
  return true;
81500
81583
  } catch {
81501
81584
  return false;
@@ -81503,7 +81586,7 @@ function isGhInstalled() {
81503
81586
  }
81504
81587
  function checkGhAuth() {
81505
81588
  try {
81506
- execSync4("gh auth status", { stdio: "pipe" });
81589
+ execSync5("gh auth status", { stdio: "pipe" });
81507
81590
  return true;
81508
81591
  } catch {
81509
81592
  return false;
@@ -81520,11 +81603,11 @@ function checkNodeVersion() {
81520
81603
  }
81521
81604
  function checkPython() {
81522
81605
  try {
81523
- execSync4("python3 --version", { stdio: "pipe" });
81606
+ execSync5("python3 --version", { stdio: "pipe" });
81524
81607
  return true;
81525
81608
  } catch {
81526
81609
  try {
81527
- execSync4("python --version", { stdio: "pipe" });
81610
+ execSync5("python --version", { stdio: "pipe" });
81528
81611
  return true;
81529
81612
  } catch {
81530
81613
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudekit-cli",
3
- "version": "3.34.1-dev.3",
3
+ "version": "3.34.1-dev.4",
4
4
  "description": "CLI tool for bootstrapping and updating ClaudeKit projects",
5
5
  "type": "module",
6
6
  "repository": {