@eldrforge/kodrdriv 1.2.24 → 1.2.25

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.
@@ -0,0 +1,132 @@
1
+ # Git Submodule Lock File Fix
2
+
3
+ ## Problem
4
+
5
+ The file-based lock mechanism used to prevent concurrent git operations was failing when used with git submodules. The issue occurred because:
6
+
7
+ 1. In regular git repositories, `.git` is a directory
8
+ 2. In git submodules, `.git` is a file containing a `gitdir:` reference pointing to the actual git directory
9
+ 3. The code assumed `.git` was always a directory and tried to create lock files in `.git/kodrdriv.lock`
10
+ 4. This caused `ENOTDIR` errors when operating on submodules
11
+
12
+ ## Example Submodule Structure
13
+
14
+ ```
15
+ my-submodule/
16
+ ├── .git # FILE (not directory) containing: "gitdir: ../.git/modules/my-submodule"
17
+ ├── src/
18
+ └── package.json
19
+
20
+ parent-repo/
21
+ └── .git/
22
+ └── modules/
23
+ └── my-submodule/ # Actual git directory for the submodule
24
+ ├── HEAD
25
+ ├── refs/
26
+ └── objects/
27
+ ```
28
+
29
+ ## Solution
30
+
31
+ Modified `src/util/fileLock.ts` to handle both regular repositories and submodules:
32
+
33
+ ### Key Changes
34
+
35
+ 1. **Added `resolveGitDirectory()` method** that:
36
+ - Checks if `.git` is a directory (regular repo) or file (submodule)
37
+ - If it's a file, reads and parses the `gitdir:` reference
38
+ - Resolves the gitdir path (handles both relative and absolute paths)
39
+ - Returns the actual git directory path where locks can be created
40
+
41
+ 2. **Updated `getRepositoryLock()` method** to:
42
+ - Use `resolveGitDirectory()` instead of assuming `.git` is a directory
43
+ - Create lock files in the resolved git directory
44
+ - Log the actual lock path for debugging
45
+
46
+ ### Code Implementation
47
+
48
+ ```typescript
49
+ private resolveGitDirectory(repoPath: string): string {
50
+ const gitPath = path.join(repoPath, '.git');
51
+
52
+ try {
53
+ const stat = fs.statSync(gitPath);
54
+
55
+ if (stat.isDirectory()) {
56
+ // Regular git repository
57
+ return gitPath;
58
+ } else if (stat.isFile()) {
59
+ // Git submodule - .git is a file with format: gitdir: <path>
60
+ const gitFileContent = fs.readFileSync(gitPath, 'utf-8').trim();
61
+ const match = gitFileContent.match(/^gitdir:\s*(.+)$/);
62
+
63
+ if (match && match[1]) {
64
+ // Resolve the gitdir path (it's relative to the repo path)
65
+ const gitDirPath = path.resolve(repoPath, match[1]);
66
+ this.logger.debug(`Resolved submodule gitdir: ${gitDirPath}`);
67
+
68
+ // Ensure the git directory exists
69
+ if (!fs.existsSync(gitDirPath)) {
70
+ throw new Error(`Submodule git directory does not exist: ${gitDirPath}`);
71
+ }
72
+
73
+ return gitDirPath;
74
+ }
75
+
76
+ throw new Error(`Invalid .git file format in ${gitPath}: ${gitFileContent}`);
77
+ }
78
+ } catch (error: any) {
79
+ // Check if error is from statSync (file doesn't exist)
80
+ if (error.code === 'ENOENT') {
81
+ throw new Error(`No .git directory or file found in ${repoPath}`);
82
+ }
83
+ throw new Error(`Failed to resolve git directory for ${repoPath}: ${error.message}`);
84
+ }
85
+
86
+ throw new Error(`No .git directory or file found in ${repoPath}`);
87
+ }
88
+ ```
89
+
90
+ ## Testing
91
+
92
+ Comprehensive test suite added in `tests/fileLock.test.ts` covering:
93
+
94
+ 1. **Basic lock operations**
95
+ - Acquire and release locks
96
+ - Block concurrent lock acquisition
97
+ - Handle stale locks
98
+
99
+ 2. **Regular repository support**
100
+ - Create locks in `.git` directory
101
+
102
+ 3. **Submodule support** (NEW)
103
+ - Handle `.git` file with `gitdir:` reference
104
+ - Resolve relative gitdir paths
105
+ - Create locks in the actual git directory
106
+ - Proper error handling for missing submodule directories
107
+ - Proper error handling for invalid `.git` file format
108
+
109
+ 4. **Lock manager functionality**
110
+ - Execute operations under lock
111
+ - Release locks on operation failure
112
+ - Serialize multiple operations on same repo
113
+
114
+ All 12 tests pass successfully with 86%+ coverage on the fileLock module.
115
+
116
+ ## Impact
117
+
118
+ This fix enables kodrdriv to work correctly in monorepo setups where packages are organized as git submodules, such as:
119
+
120
+ - Multi-repository projects using git submodules for shared libraries
121
+ - Projects with external dependencies included as submodules
122
+ - Monorepos with complex submodule hierarchies
123
+
124
+ The fix maintains backward compatibility with regular git repositories while adding robust support for submodules.
125
+
126
+ ## Related Files
127
+
128
+ - `src/util/fileLock.ts` - Core fix implementation
129
+ - `tests/fileLock.test.ts` - Comprehensive test suite
130
+ - `src/util/gitMutex.ts` - Uses RepositoryFileLockManager
131
+ - `src/commands/publish.ts` - Uses git locks during publish operations
132
+
package/dist/constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import os__default from 'os';
2
2
  import path__default from 'path';
3
3
 
4
- const VERSION = '1.2.24 (HEAD/4bd4bef T:v1.2.24 2025-12-11 22:14:52 -0800) linux x64 v22.21.1';
4
+ const VERSION = '1.2.25 (HEAD/b499989 T:v1.2.25 2025-12-11 22:47:24 -0800) linux x64 v22.21.1';
5
5
  const PROGRAM_NAME = 'kodrdriv';
6
6
  const DEFAULT_OVERRIDES = false;
7
7
  const DATE_FORMAT_YEAR_MONTH_DAY_HOURS_MINUTES_SECONDS_MILLISECONDS = 'YYYY-MM-DD-HHmmss.SSS';
@@ -129,9 +129,10 @@ function _define_property(obj, key, value) {
129
129
  */ getRepositoryLock(repoPath) {
130
130
  const normalizedPath = path.resolve(repoPath);
131
131
  if (!this.locks.has(normalizedPath)) {
132
- // Create lock file in .git directory to ensure it's in the repo
133
- const lockPath = path.join(normalizedPath, '.git', 'kodrdriv.lock');
134
- this.logger.debug(`Creating file lock for repository: ${normalizedPath}`);
132
+ // Resolve the actual .git directory (handles both regular repos and submodules)
133
+ const gitDirPath = this.resolveGitDirectory(normalizedPath);
134
+ const lockPath = path.join(gitDirPath, 'kodrdriv.lock');
135
+ this.logger.debug(`Creating file lock for repository: ${normalizedPath} at ${lockPath}`);
135
136
  this.locks.set(normalizedPath, new FileLock(lockPath));
136
137
  // Register cleanup handler on first lock creation
137
138
  if (!this.cleanupRegistered) {
@@ -141,6 +142,42 @@ function _define_property(obj, key, value) {
141
142
  }
142
143
  return this.locks.get(normalizedPath);
143
144
  }
145
+ /**
146
+ * Resolve the actual .git directory path, handling both regular repos and submodules
147
+ * @param repoPath Path to the repository root
148
+ * @returns Path to the actual .git directory
149
+ */ resolveGitDirectory(repoPath) {
150
+ const gitPath = path.join(repoPath, '.git');
151
+ try {
152
+ const stat = fs.statSync(gitPath);
153
+ if (stat.isDirectory()) {
154
+ // Regular git repository
155
+ return gitPath;
156
+ } else if (stat.isFile()) {
157
+ // Git submodule - .git is a file with format: gitdir: <path>
158
+ const gitFileContent = fs.readFileSync(gitPath, 'utf-8').trim();
159
+ const match = gitFileContent.match(/^gitdir:\s*(.+)$/);
160
+ if (match && match[1]) {
161
+ // Resolve the gitdir path (it's relative to the repo path)
162
+ const gitDirPath = path.resolve(repoPath, match[1]);
163
+ this.logger.debug(`Resolved submodule gitdir: ${gitDirPath}`);
164
+ // Ensure the git directory exists
165
+ if (!fs.existsSync(gitDirPath)) {
166
+ throw new Error(`Submodule git directory does not exist: ${gitDirPath}`);
167
+ }
168
+ return gitDirPath;
169
+ }
170
+ throw new Error(`Invalid .git file format in ${gitPath}: ${gitFileContent}`);
171
+ }
172
+ } catch (error) {
173
+ // Check if error is from statSync (file doesn't exist)
174
+ if (error.code === 'ENOENT') {
175
+ throw new Error(`No .git directory or file found in ${repoPath}`);
176
+ }
177
+ throw new Error(`Failed to resolve git directory for ${repoPath}: ${error.message}`);
178
+ }
179
+ throw new Error(`No .git directory or file found in ${repoPath}`);
180
+ }
144
181
  /**
145
182
  * Register cleanup handlers to release locks on process exit
146
183
  */ registerCleanupHandlers() {
@@ -1 +1 @@
1
- {"version":3,"file":"fileLock.js","sources":["../../src/util/fileLock.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport { getLogger } from '../logging';\n\n/**\n * File-based lock for cross-process synchronization\n * Uses atomic file operations to coordinate across multiple Node processes\n */\nexport class FileLock {\n private lockPath: string;\n private lockAcquired = false;\n private maxRetries = 100; // Maximum number of lock attempts\n private retryDelay = 100; // Initial retry delay in ms\n private maxRetryDelay = 2000; // Maximum retry delay in ms\n private lockTimeout = 30000; // Consider lock stale after 30 seconds\n private logger = getLogger();\n\n constructor(lockPath: string) {\n this.lockPath = lockPath;\n }\n\n /**\n * Acquire the file lock with exponential backoff retry\n */\n async lock(): Promise<void> {\n let attempts = 0;\n let currentDelay = this.retryDelay;\n\n while (attempts < this.maxRetries) {\n try {\n // Try to create lock file atomically with 'wx' flag (fails if exists)\n const lockData = {\n pid: process.pid,\n timestamp: Date.now(),\n hostname: os.hostname()\n };\n\n // Check if lock file exists and is stale\n if (fs.existsSync(this.lockPath)) {\n const lockContent = fs.readFileSync(this.lockPath, 'utf-8');\n try {\n const existingLock = JSON.parse(lockContent);\n const lockAge = Date.now() - existingLock.timestamp;\n\n // If lock is stale, try to remove it\n if (lockAge > this.lockTimeout) {\n this.logger.debug(`Removing stale lock file (age: ${lockAge}ms, pid: ${existingLock.pid})`);\n try {\n fs.unlinkSync(this.lockPath);\n } catch {\n // Lock might have been removed by another process, continue\n }\n }\n } catch {\n // Invalid lock file, try to remove it\n try {\n fs.unlinkSync(this.lockPath);\n } catch {\n // Ignore errors\n }\n }\n }\n\n // Try to acquire lock\n fs.writeFileSync(this.lockPath, JSON.stringify(lockData, null, 2), { flag: 'wx' });\n this.lockAcquired = true;\n\n if (attempts > 0) {\n this.logger.debug(`Acquired file lock after ${attempts} attempts: ${this.lockPath}`);\n }\n\n return;\n } catch (error: any) {\n if (error.code === 'EEXIST') {\n // Lock file exists, retry with backoff\n attempts++;\n\n if (attempts === 1 || attempts % 10 === 0) {\n this.logger.verbose(`Waiting for file lock (attempt ${attempts}/${this.maxRetries}): ${this.lockPath}`);\n }\n\n await new Promise(resolve => setTimeout(resolve, currentDelay));\n\n // Exponential backoff\n currentDelay = Math.min(currentDelay * 1.5, this.maxRetryDelay);\n } else {\n // Unexpected error\n throw new Error(`Failed to acquire file lock ${this.lockPath}: ${error.message}`);\n }\n }\n }\n\n throw new Error(`Failed to acquire file lock after ${this.maxRetries} attempts: ${this.lockPath}`);\n }\n\n /**\n * Release the file lock\n */\n unlock(): void {\n if (!this.lockAcquired) {\n return;\n }\n\n try {\n if (fs.existsSync(this.lockPath)) {\n fs.unlinkSync(this.lockPath);\n }\n this.lockAcquired = false;\n this.logger.silly(`Released file lock: ${this.lockPath}`);\n } catch (error: any) {\n // Lock file might have been removed by another process or stale lock cleanup\n this.logger.debug(`Error releasing file lock ${this.lockPath}: ${error.message}`);\n this.lockAcquired = false;\n }\n }\n\n /**\n * Check if this instance currently holds the lock\n */\n isLocked(): boolean {\n return this.lockAcquired;\n }\n}\n\n/**\n * Manages file-based locks for git repositories (cross-process safe)\n */\nexport class RepositoryFileLockManager {\n private locks: Map<string, FileLock> = new Map();\n private logger = getLogger();\n private cleanupRegistered = false;\n\n /**\n * Get or create a file lock for a specific git repository\n * @param repoPath Path to the git repository root\n * @returns FileLock for this repository\n */\n getRepositoryLock(repoPath: string): FileLock {\n const normalizedPath = path.resolve(repoPath);\n\n if (!this.locks.has(normalizedPath)) {\n // Create lock file in .git directory to ensure it's in the repo\n const lockPath = path.join(normalizedPath, '.git', 'kodrdriv.lock');\n this.logger.debug(`Creating file lock for repository: ${normalizedPath}`);\n this.locks.set(normalizedPath, new FileLock(lockPath));\n\n // Register cleanup handler on first lock creation\n if (!this.cleanupRegistered) {\n this.registerCleanupHandlers();\n this.cleanupRegistered = true;\n }\n }\n\n return this.locks.get(normalizedPath)!;\n }\n\n /**\n * Register cleanup handlers to release locks on process exit\n */\n private registerCleanupHandlers(): void {\n const cleanup = () => {\n this.destroy();\n };\n\n // Handle various exit scenarios\n process.on('exit', cleanup);\n process.on('SIGINT', () => {\n cleanup();\n process.exit(130); // Standard exit code for SIGINT\n });\n process.on('SIGTERM', () => {\n cleanup();\n process.exit(143); // Standard exit code for SIGTERM\n });\n process.on('uncaughtException', (error) => {\n this.logger.error('Uncaught exception, cleaning up locks:', error);\n cleanup();\n process.exit(1);\n });\n }\n\n /**\n * Execute a git operation with repository-level file locking\n * @param repoPath Path to the git repository root\n * @param operation The async operation to execute under lock\n * @param operationName Optional name for logging\n * @returns Result of the operation\n */\n async withGitLock<T>(\n repoPath: string,\n operation: () => Promise<T>,\n operationName?: string\n ): Promise<T> {\n const lock = this.getRepositoryLock(repoPath);\n const startWait = Date.now();\n\n this.logger.silly(\n `Acquiring file lock for ${repoPath}${operationName ? ` for: ${operationName}` : ''}`\n );\n\n await lock.lock();\n\n const waitTime = Date.now() - startWait;\n if (waitTime > 100) {\n this.logger.debug(\n `Acquired file lock for ${repoPath} after ${waitTime}ms${operationName ? ` for: ${operationName}` : ''}`\n );\n }\n\n try {\n return await operation();\n } finally {\n lock.unlock();\n }\n }\n\n /**\n * Clean up all locks\n */\n destroy(): void {\n this.logger.debug(`Cleaning up ${this.locks.size} file lock(s)`);\n for (const lock of this.locks.values()) {\n lock.unlock();\n }\n this.locks.clear();\n }\n}\n"],"names":["FileLock","lock","attempts","currentDelay","retryDelay","maxRetries","lockData","pid","process","timestamp","Date","now","hostname","os","fs","existsSync","lockPath","lockContent","readFileSync","existingLock","JSON","parse","lockAge","lockTimeout","logger","debug","unlinkSync","writeFileSync","stringify","flag","lockAcquired","error","code","verbose","Promise","resolve","setTimeout","Math","min","maxRetryDelay","Error","message","unlock","silly","isLocked","getLogger","RepositoryFileLockManager","getRepositoryLock","repoPath","normalizedPath","path","locks","has","join","set","cleanupRegistered","registerCleanupHandlers","get","cleanup","destroy","on","exit","withGitLock","operation","operationName","startWait","waitTime","size","values","clear","Map"],"mappings":";;;;;AAAA;;;;;;;;;;;;;;AAMA;;;AAGC,IACM,MAAMA,QAAAA,CAAAA;AAaT;;AAEC,QACD,MAAMC,IAAAA,GAAsB;AACxB,QAAA,IAAIC,QAAAA,GAAW,CAAA;QACf,IAAIC,YAAAA,GAAe,IAAI,CAACC,UAAU;AAElC,QAAA,MAAOF,QAAAA,GAAW,IAAI,C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I,CAACnC,MAAM,CAACC,KAAK,CAAC,CAAC,YAAY,EAAE,IAAI,CAAC0B,KAAK,CAACgB,IAAI,CAAC,aAAa,CAAC,CAAA;AAC/D,QAAA,KAAK,MAAMlE,IAAAA,IAAQ,IAAI,CAACkD,KAAK,CAACiB,MAAM,EAAA,CAAI;AACpCnE,YAAAA,IAAAA,CAAKyC,MAAM,EAAA;AACf,QAAA;QACA,IAAI,CAACS,KAAK,CAACkB,KAAK,EAAA;AACpB,IAAA;;AAjGA,QAAA,gBAAA,CAAA,IAAA,EAAQlB,SAA+B,IAAImB,GAAAA,EAAAA,CAAAA;AAC3C,QAAA,gBAAA,CAAA,IAAA,EAAQ9C,QAAAA,EAASqB,SAAAA,EAAAA,CAAAA;AACjB,QAAA,gBAAA,CAAA,IAAA,EAAQU,mBAAAA,EAAoB,KAAA,CAAA;;AAgGhC;;;;"}
1
+ {"version":3,"file":"fileLock.js","sources":["../../src/util/fileLock.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport { getLogger } from '../logging';\n\n/**\n * File-based lock for cross-process synchronization\n * Uses atomic file operations to coordinate across multiple Node processes\n */\nexport class FileLock {\n private lockPath: string;\n private lockAcquired = false;\n private maxRetries = 100; // Maximum number of lock attempts\n private retryDelay = 100; // Initial retry delay in ms\n private maxRetryDelay = 2000; // Maximum retry delay in ms\n private lockTimeout = 30000; // Consider lock stale after 30 seconds\n private logger = getLogger();\n\n constructor(lockPath: string) {\n this.lockPath = lockPath;\n }\n\n /**\n * Acquire the file lock with exponential backoff retry\n */\n async lock(): Promise<void> {\n let attempts = 0;\n let currentDelay = this.retryDelay;\n\n while (attempts < this.maxRetries) {\n try {\n // Try to create lock file atomically with 'wx' flag (fails if exists)\n const lockData = {\n pid: process.pid,\n timestamp: Date.now(),\n hostname: os.hostname()\n };\n\n // Check if lock file exists and is stale\n if (fs.existsSync(this.lockPath)) {\n const lockContent = fs.readFileSync(this.lockPath, 'utf-8');\n try {\n const existingLock = JSON.parse(lockContent);\n const lockAge = Date.now() - existingLock.timestamp;\n\n // If lock is stale, try to remove it\n if (lockAge > this.lockTimeout) {\n this.logger.debug(`Removing stale lock file (age: ${lockAge}ms, pid: ${existingLock.pid})`);\n try {\n fs.unlinkSync(this.lockPath);\n } catch {\n // Lock might have been removed by another process, continue\n }\n }\n } catch {\n // Invalid lock file, try to remove it\n try {\n fs.unlinkSync(this.lockPath);\n } catch {\n // Ignore errors\n }\n }\n }\n\n // Try to acquire lock\n fs.writeFileSync(this.lockPath, JSON.stringify(lockData, null, 2), { flag: 'wx' });\n this.lockAcquired = true;\n\n if (attempts > 0) {\n this.logger.debug(`Acquired file lock after ${attempts} attempts: ${this.lockPath}`);\n }\n\n return;\n } catch (error: any) {\n if (error.code === 'EEXIST') {\n // Lock file exists, retry with backoff\n attempts++;\n\n if (attempts === 1 || attempts % 10 === 0) {\n this.logger.verbose(`Waiting for file lock (attempt ${attempts}/${this.maxRetries}): ${this.lockPath}`);\n }\n\n await new Promise(resolve => setTimeout(resolve, currentDelay));\n\n // Exponential backoff\n currentDelay = Math.min(currentDelay * 1.5, this.maxRetryDelay);\n } else {\n // Unexpected error\n throw new Error(`Failed to acquire file lock ${this.lockPath}: ${error.message}`);\n }\n }\n }\n\n throw new Error(`Failed to acquire file lock after ${this.maxRetries} attempts: ${this.lockPath}`);\n }\n\n /**\n * Release the file lock\n */\n unlock(): void {\n if (!this.lockAcquired) {\n return;\n }\n\n try {\n if (fs.existsSync(this.lockPath)) {\n fs.unlinkSync(this.lockPath);\n }\n this.lockAcquired = false;\n this.logger.silly(`Released file lock: ${this.lockPath}`);\n } catch (error: any) {\n // Lock file might have been removed by another process or stale lock cleanup\n this.logger.debug(`Error releasing file lock ${this.lockPath}: ${error.message}`);\n this.lockAcquired = false;\n }\n }\n\n /**\n * Check if this instance currently holds the lock\n */\n isLocked(): boolean {\n return this.lockAcquired;\n }\n}\n\n/**\n * Manages file-based locks for git repositories (cross-process safe)\n */\nexport class RepositoryFileLockManager {\n private locks: Map<string, FileLock> = new Map();\n private logger = getLogger();\n private cleanupRegistered = false;\n\n /**\n * Get or create a file lock for a specific git repository\n * @param repoPath Path to the git repository root\n * @returns FileLock for this repository\n */\n getRepositoryLock(repoPath: string): FileLock {\n const normalizedPath = path.resolve(repoPath);\n\n if (!this.locks.has(normalizedPath)) {\n // Resolve the actual .git directory (handles both regular repos and submodules)\n const gitDirPath = this.resolveGitDirectory(normalizedPath);\n const lockPath = path.join(gitDirPath, 'kodrdriv.lock');\n this.logger.debug(`Creating file lock for repository: ${normalizedPath} at ${lockPath}`);\n this.locks.set(normalizedPath, new FileLock(lockPath));\n\n // Register cleanup handler on first lock creation\n if (!this.cleanupRegistered) {\n this.registerCleanupHandlers();\n this.cleanupRegistered = true;\n }\n }\n\n return this.locks.get(normalizedPath)!;\n }\n\n /**\n * Resolve the actual .git directory path, handling both regular repos and submodules\n * @param repoPath Path to the repository root\n * @returns Path to the actual .git directory\n */\n private resolveGitDirectory(repoPath: string): string {\n const gitPath = path.join(repoPath, '.git');\n\n try {\n const stat = fs.statSync(gitPath);\n\n if (stat.isDirectory()) {\n // Regular git repository\n return gitPath;\n } else if (stat.isFile()) {\n // Git submodule - .git is a file with format: gitdir: <path>\n const gitFileContent = fs.readFileSync(gitPath, 'utf-8').trim();\n const match = gitFileContent.match(/^gitdir:\\s*(.+)$/);\n\n if (match && match[1]) {\n // Resolve the gitdir path (it's relative to the repo path)\n const gitDirPath = path.resolve(repoPath, match[1]);\n this.logger.debug(`Resolved submodule gitdir: ${gitDirPath}`);\n\n // Ensure the git directory exists\n if (!fs.existsSync(gitDirPath)) {\n throw new Error(`Submodule git directory does not exist: ${gitDirPath}`);\n }\n\n return gitDirPath;\n }\n\n throw new Error(`Invalid .git file format in ${gitPath}: ${gitFileContent}`);\n }\n } catch (error: any) {\n // Check if error is from statSync (file doesn't exist)\n if (error.code === 'ENOENT') {\n throw new Error(`No .git directory or file found in ${repoPath}`);\n }\n throw new Error(`Failed to resolve git directory for ${repoPath}: ${error.message}`);\n }\n\n throw new Error(`No .git directory or file found in ${repoPath}`);\n }\n\n /**\n * Register cleanup handlers to release locks on process exit\n */\n private registerCleanupHandlers(): void {\n const cleanup = () => {\n this.destroy();\n };\n\n // Handle various exit scenarios\n process.on('exit', cleanup);\n process.on('SIGINT', () => {\n cleanup();\n process.exit(130); // Standard exit code for SIGINT\n });\n process.on('SIGTERM', () => {\n cleanup();\n process.exit(143); // Standard exit code for SIGTERM\n });\n process.on('uncaughtException', (error) => {\n this.logger.error('Uncaught exception, cleaning up locks:', error);\n cleanup();\n process.exit(1);\n });\n }\n\n /**\n * Execute a git operation with repository-level file locking\n * @param repoPath Path to the git repository root\n * @param operation The async operation to execute under lock\n * @param operationName Optional name for logging\n * @returns Result of the operation\n */\n async withGitLock<T>(\n repoPath: string,\n operation: () => Promise<T>,\n operationName?: string\n ): Promise<T> {\n const lock = this.getRepositoryLock(repoPath);\n const startWait = Date.now();\n\n this.logger.silly(\n `Acquiring file lock for ${repoPath}${operationName ? ` for: ${operationName}` : ''}`\n );\n\n await lock.lock();\n\n const waitTime = Date.now() - startWait;\n if (waitTime > 100) {\n this.logger.debug(\n `Acquired file lock for ${repoPath} after ${waitTime}ms${operationName ? ` for: ${operationName}` : ''}`\n );\n }\n\n try {\n return await operation();\n } finally {\n lock.unlock();\n }\n }\n\n /**\n * Clean up all locks\n */\n destroy(): void {\n this.logger.debug(`Cleaning up ${this.locks.size} file lock(s)`);\n for (const lock of this.locks.values()) {\n lock.unlock();\n }\n this.locks.clear();\n }\n}\n"],"names":["FileLock","lock","attempts","currentDelay","retryDelay","maxRetries","lockData","pid","process","timestamp","Date","now","hostname","os","fs","existsSync","lockPath","lockContent","readFileSync","existingLock","JSON","parse","lockAge","lockTimeout","logger","debug","unlinkSync","writeFileSync","stringify","flag","lockAcquired","error","code","verbose","Promise","resolve","setTimeout","Math","min","maxRetryDelay","Error","message","unlock","silly","isLocked","getLogger","RepositoryFileLockManager","getRepositoryLock","repoPath","normalizedPath","path","locks","has","gitDirPath","resolveGitDirectory","join","set","cleanupRegistered","registerCleanupHandlers","get","gitPath","stat","statSync","isDirectory","isFile","gitFileContent","trim","match","cleanup","destroy","on","exit","withGitLock","operation","operationName","startWait","waitTime","size","values","clear","Map"],"mappings":";;;;;AAAA;;;;;;;;;;;;;;AAMA;;;AAGC,IACM,MAAMA,QAAAA,CAAAA;AAaT;;AAEC,QACD,MAAMC,IAAAA,GAAsB;AACxB,QAAA,IAAIC,QAAAA,GAAW,CAAA;QACf,IAAIC,YAAAA,GAAe,IAAI,CAACC,UAAU;AAElC,QAAA,MAAOF,QAAAA,GAAW,IAAI,CAACG,UAAU,CAAE;YAC/B,IAAI;;AAEA,gBAAA,MAAMC,QAAAA,GAAW;AACbC,oBAAAA,GAAAA,EAAKC,QAAQD,GAAG;AAChBE,oBAAAA,SAAAA,EAAWC,KAAKC,GAAG,EAAA;AACnBC,oBAAAA,QAAAA,EAAUC,GAAGD,QAAQ;AACzB,iBAAA;;AAGA,gBAAA,IAAIE,GAAGC,UAAU,CAAC,IAAI,CAACC,QAAQ,CAAA,EAAG;AAC9B,oBAAA,MAAMC,cAAcH,EAAAA,CAAGI,YAAY,CAAC,IAAI,CAACF,QAAQ,EAAE,OAAA,CAAA;oBACnD,IAAI;wBACA,MAAMG,YAAAA,GAAeC,IAAAA,CAAKC,KAAK,CAACJ,WAAAA,CAAAA;AAChC,wBAAA,MAAMK,OAAAA,GAAUZ,IAAAA,CAAKC,GAAG,EAAA,GAAKQ,aAAaV,SAAS;;AAGnD,wBAAA,IAAIa,OAAAA,GAAU,IAAI,CAACC,WAAW,EAAE;AAC5B,4BAAA,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC,+BAA+B,EAAEH,OAAAA,CAAQ,SAAS,EAAEH,YAAAA,CAAaZ,GAAG,CAAC,CAAC,CAAC,CAAA;4BAC1F,IAAI;AACAO,gCAAAA,EAAAA,CAA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AC3C,QAAA,gBAAA,CAAA,IAAA,EAAQxD,QAAAA,EAASqB,SAAAA,EAAAA,CAAAA;AACjB,QAAA,gBAAA,CAAA,IAAA,EAAQY,mBAAAA,EAAoB,KAAA,CAAA;;AA8IhC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eldrforge/kodrdriv",
3
- "version": "1.2.24",
3
+ "version": "1.2.25",
4
4
  "description": "Create Intelligent Release Notes or Change Logs from Git",
5
5
  "main": "dist/main.js",
6
6
  "type": "module",