claudekit-cli 3.32.0-dev.2 → 3.32.0-dev.3

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 +29 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -30849,27 +30849,51 @@ class PromptsManager {
30849
30849
  init_logger();
30850
30850
 
30851
30851
  // src/shared/process-lock.ts
30852
+ init_logger();
30852
30853
  var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
30853
30854
  import { mkdir as mkdir8 } from "node:fs/promises";
30854
30855
  import os2 from "node:os";
30855
30856
  import { join as join29 } from "node:path";
30856
30857
  var LOCK_CONFIG = {
30857
- stale: 300000,
30858
+ stale: 60000,
30858
30859
  retries: 0
30859
30860
  };
30861
+ var activeLocks = new Set;
30862
+ var cleanupRegistered = false;
30860
30863
  function getLocksDir() {
30861
30864
  return join29(os2.homedir(), ".claudekit", "locks");
30862
30865
  }
30866
+ function cleanupLocks() {
30867
+ for (const name of activeLocks) {
30868
+ try {
30869
+ const lockPath = join29(getLocksDir(), `${name}.lock`);
30870
+ import_proper_lockfile.default.unlockSync(lockPath, { realpath: false });
30871
+ } catch {
30872
+ try {
30873
+ logger.verbose(`Failed to cleanup lock: ${name}`);
30874
+ } catch {}
30875
+ }
30876
+ }
30877
+ activeLocks.clear();
30878
+ }
30879
+ function registerCleanupHandlers() {
30880
+ if (cleanupRegistered)
30881
+ return;
30882
+ cleanupRegistered = true;
30883
+ process.on("exit", cleanupLocks);
30884
+ }
30863
30885
  async function ensureLocksDir() {
30864
30886
  const lockDir = getLocksDir();
30865
30887
  await mkdir8(lockDir, { recursive: true });
30866
30888
  }
30867
30889
  async function withProcessLock(lockName, fn) {
30890
+ registerCleanupHandlers();
30868
30891
  await ensureLocksDir();
30869
30892
  const lockPath = join29(getLocksDir(), `${lockName}.lock`);
30870
30893
  let release;
30871
30894
  try {
30872
30895
  release = await import_proper_lockfile.default.lock(lockPath, { ...LOCK_CONFIG, realpath: false });
30896
+ activeLocks.add(lockName);
30873
30897
  return await fn();
30874
30898
  } catch (e2) {
30875
30899
  const error = e2;
@@ -30884,6 +30908,7 @@ Wait for it to complete or remove lock: ${lockPath}`);
30884
30908
  if (release) {
30885
30909
  await release();
30886
30910
  }
30911
+ activeLocks.delete(lockName);
30887
30912
  }
30888
30913
  }
30889
30914
 
@@ -47943,7 +47968,8 @@ async function initCommand(options2) {
47943
47968
  return;
47944
47969
  }
47945
47970
  logger.error(error instanceof Error ? error.message : "Unknown error occurred");
47946
- process.exit(1);
47971
+ process.exitCode = 1;
47972
+ throw error;
47947
47973
  }
47948
47974
  }
47949
47975
  // src/commands/new/new-command.ts
@@ -49869,7 +49895,7 @@ var import_fs_extra37 = __toESM(require_lib(), 1);
49869
49895
  // package.json
49870
49896
  var package_default = {
49871
49897
  name: "claudekit-cli",
49872
- version: "3.32.0-dev.2",
49898
+ version: "3.32.0-dev.3",
49873
49899
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
49874
49900
  type: "module",
49875
49901
  repository: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudekit-cli",
3
- "version": "3.32.0-dev.2",
3
+ "version": "3.32.0-dev.3",
4
4
  "description": "CLI tool for bootstrapping and updating ClaudeKit projects",
5
5
  "type": "module",
6
6
  "repository": {