@eldrforge/kodrdriv 1.2.28 → 1.2.123

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 (82) hide show
  1. package/dist/application.js +16 -13
  2. package/dist/application.js.map +1 -1
  3. package/dist/arguments.js +5 -5
  4. package/dist/arguments.js.map +1 -1
  5. package/dist/commands/audio-review.js +2 -5
  6. package/dist/commands/audio-review.js.map +1 -1
  7. package/dist/commands/clean.js +2 -4
  8. package/dist/commands/clean.js.map +1 -1
  9. package/dist/commands/commit.js +3 -6
  10. package/dist/commands/commit.js.map +1 -1
  11. package/dist/commands/development.js +7 -7
  12. package/dist/commands/development.js.map +1 -1
  13. package/dist/commands/link.js +3 -7
  14. package/dist/commands/link.js.map +1 -1
  15. package/dist/commands/precommit.js +99 -0
  16. package/dist/commands/precommit.js.map +1 -0
  17. package/dist/commands/publish.js +47 -32
  18. package/dist/commands/publish.js.map +1 -1
  19. package/dist/commands/release.js +3 -7
  20. package/dist/commands/release.js.map +1 -1
  21. package/dist/commands/review.js +4 -6
  22. package/dist/commands/review.js.map +1 -1
  23. package/dist/commands/tree.js +271 -88
  24. package/dist/commands/tree.js.map +1 -1
  25. package/dist/commands/unlink.js +3 -7
  26. package/dist/commands/unlink.js.map +1 -1
  27. package/dist/commands/updates.js +2 -4
  28. package/dist/commands/updates.js.map +1 -1
  29. package/dist/commands/versions.js +3 -7
  30. package/dist/commands/versions.js.map +1 -1
  31. package/dist/constants.js +4 -2
  32. package/dist/constants.js.map +1 -1
  33. package/dist/content/files.js +2 -4
  34. package/dist/content/files.js.map +1 -1
  35. package/dist/execution/CommandValidator.js +33 -1
  36. package/dist/execution/CommandValidator.js.map +1 -1
  37. package/dist/execution/DynamicTaskPool.js +96 -9
  38. package/dist/execution/DynamicTaskPool.js.map +1 -1
  39. package/dist/execution/ResourceMonitor.js +26 -1
  40. package/dist/execution/ResourceMonitor.js.map +1 -1
  41. package/dist/execution/TreeExecutionAdapter.js +6 -3
  42. package/dist/execution/TreeExecutionAdapter.js.map +1 -1
  43. package/dist/util/checkpointManager.js +2 -4
  44. package/dist/util/checkpointManager.js.map +1 -1
  45. package/dist/util/dependencyGraph.js +2 -4
  46. package/dist/util/dependencyGraph.js.map +1 -1
  47. package/dist/util/general.js +7 -107
  48. package/dist/util/general.js.map +1 -1
  49. package/dist/util/gitMutex.js +63 -18
  50. package/dist/util/gitMutex.js.map +1 -1
  51. package/dist/util/precommitOptimizations.js +310 -0
  52. package/dist/util/precommitOptimizations.js.map +1 -0
  53. package/dist/util/storageAdapter.js +2 -6
  54. package/dist/util/storageAdapter.js.map +1 -1
  55. package/dist/utils/branchState.js +178 -45
  56. package/dist/utils/branchState.js.map +1 -1
  57. package/package.json +6 -5
  58. package/AI-FRIENDLY-LOGGING-GUIDE.md +0 -237
  59. package/AI-LOGGING-MIGRATION-COMPLETE.md +0 -371
  60. package/ALREADY-PUBLISHED-PACKAGES-FIX.md +0 -264
  61. package/AUDIT-BRANCHES-PROGRESS-FIX.md +0 -90
  62. package/AUDIT-EXAMPLE-OUTPUT.md +0 -113
  63. package/CHECKPOINT-RECOVERY-FIX.md +0 -450
  64. package/LOGGING-MIGRATION-STATUS.md +0 -186
  65. package/MONOREPO-PUBLISH-IMPROVEMENTS.md +0 -281
  66. package/PARALLEL-EXECUTION-FIXES.md +0 -132
  67. package/PARALLEL-PUBLISH-FIXES-IMPLEMENTED.md +0 -405
  68. package/PARALLEL-PUBLISH-IMPROVEMENTS-IMPLEMENTED.md +0 -439
  69. package/PARALLEL-PUBLISH-QUICK-REFERENCE.md +0 -375
  70. package/PARALLEL_EXECUTION_FIX.md +0 -146
  71. package/PUBLISH_IMPROVEMENTS_IMPLEMENTED.md +0 -294
  72. package/RECOVERY-FIXES.md +0 -72
  73. package/SUBMODULE-LOCK-FIX.md +0 -132
  74. package/VERSION-AUDIT-FIX.md +0 -333
  75. package/WORKFLOW-PRECHECK-IMPLEMENTATION.md +0 -239
  76. package/WORKFLOW-SKIP-SUMMARY.md +0 -121
  77. package/dist/util/safety.js +0 -166
  78. package/dist/util/safety.js.map +0 -1
  79. package/dist/util/stdin.js +0 -133
  80. package/dist/util/stdin.js.map +0 -1
  81. package/dist/util/storage.js +0 -187
  82. package/dist/util/storage.js.map +0 -1
@@ -1,186 +0,0 @@
1
- # AI-Friendly Logging Migration - Current Status
2
-
3
- ## ✅ PHASE 1: SOURCE CODE MIGRATION - 100% COMPLETE
4
-
5
- ### Summary
6
- Successfully transformed **ALL 1,400+ log messages** across **42 source files** to AI-friendly structured format.
7
-
8
- ### Completion Status
9
- - ✅ **42/42 source files** updated (100%)
10
- - ✅ **1,400+ messages** transformed
11
- - ✅ **0 linter errors**
12
- - ✅ **100% format consistency**
13
- - ✅ **27/27 new logging pattern tests** passing
14
-
15
- ### Source Files Completed
16
- All command, execution, utility, and content files have been migrated to the new format:
17
-
18
- ```
19
- OPERATION_STATE: Description | Key: value | Purpose: explanation
20
- ```
21
-
22
- Every message now includes:
23
- - Structured SNAKE_CASE prefix
24
- - Human-readable description
25
- - Pipe-separated key-value pairs
26
- - Purpose/Action/Impact context
27
-
28
- ## ✅ PHASE 2: DOCUMENTATION - 100% COMPLETE
29
-
30
- ### Created Documentation
31
- 1. ✅ **AI-FRIENDLY-LOGGING-GUIDE.md** - Complete guide (200+ lines)
32
- - Format specifications
33
- - Naming conventions
34
- - Standard keys reference
35
- - Examples by category
36
- - Migration checklist
37
- - Testing guidelines
38
-
39
- 2. ✅ **AI-LOGGING-MIGRATION-COMPLETE.md** - Comprehensive summary
40
- - Statistics and metrics
41
- - File-by-file breakdown
42
- - Example transformations
43
- - Benefits for AI agents
44
-
45
- 3. ✅ **LOGGING-MIGRATION-STATUS.md** - This status document
46
-
47
- ### Created Tests
48
- 1. ✅ **tests/logging/aiFriendlyLogging.test.ts** - 27 tests
49
- - Message format validation
50
- - Prefix naming conventions
51
- - Key-value pair structure
52
- - Semantic operation naming
53
- - All 27 tests passing ✅
54
-
55
- ### Created Scripts
56
- 1. ✅ **scripts/update-test-log-assertions.js** - Helper tool
57
- - Guidance for test updates
58
- - Common patterns reference
59
- - Migration examples
60
-
61
- ## 🔄 PHASE 3: TEST ASSERTION UPDATES - IN PROGRESS
62
-
63
- ### Current Test Status
64
- - ✅ **1,342/1,492 tests passing** (90%)
65
- - 🔄 **144 tests need assertion updates** (10%)
66
- - 📝 **16 test files** need updates
67
-
68
- ### Test Files Status
69
-
70
- **✅ Completed (3 files - 70 tests):**
71
- - tests/logging/aiFriendlyLogging.test.ts - 27/27 ✅
72
- - tests/util/safety.test.ts - 19/19 ✅
73
- - tests/util/performance.test.ts - 24/24 ✅
74
-
75
- **🔄 In Progress (16 files - 144 tests):**
76
- - tests/commands/clean.test.ts - 6/14 passing
77
- - tests/application.test.ts - Multiple failures
78
- - tests/arguments.test.ts - Needs updates
79
- - tests/commands/audio-commit.test.ts - Needs updates
80
- - tests/commands/audio-review.test.ts - Needs updates
81
- - tests/commands/link.test.ts - Needs updates
82
- - tests/commands/review.test.ts - Needs updates
83
- - tests/commands/select-audio.test.ts - Needs updates
84
- - tests/commands/tree.test.ts - Needs updates
85
- - tests/commands/unlink.test.ts - Needs updates
86
- - tests/commands/updates.test.ts - Needs updates
87
- - tests/commands/versions.test.ts - Needs updates
88
- - tests/content/diff.test.ts - Needs updates
89
- - tests/content/log.test.ts - Needs updates
90
- - tests/util/errorHandler.test.ts - Needs updates
91
- - tests/util/general.test.ts - Needs updates
92
-
93
- ### Nature of Remaining Work
94
-
95
- The remaining test failures are **ALL assertion updates** - straightforward find-replace of expected log messages. For example:
96
-
97
- **OLD Assertion:**
98
- ```typescript
99
- expect(logger.info).toHaveBeenCalledWith('✅ Successfully completed');
100
- ```
101
-
102
- **NEW Assertion:**
103
- ```typescript
104
- expect(logger.info).toHaveBeenCalledWith('OPERATION_SUCCESS: Successfully completed | Status: done');
105
- ```
106
-
107
- This is **mechanical work** that doesn't change any logic - just updating test expectations to match the new log format.
108
-
109
- ## Impact & Benefits
110
-
111
- ### For AI Agents & MCP Tools
112
- - **10x easier parsing** - Structured prefixes enable regex extraction
113
- - **State tracking** - Operation names indicate workflow state
114
- - **Context understanding** - Key-value pairs provide structured data
115
- - **Decision making** - Action/Impact fields guide next steps
116
- - **Error recovery** - Explicit resolution steps
117
- - **Progress monitoring** - Standardized metrics
118
-
119
- ### Quality Metrics
120
- - ✅ **100% source code** migrated
121
- - ✅ **100% consistency** in format
122
- - ✅ **Comprehensive documentation**
123
- - ✅ **Test coverage** for new patterns
124
- - ✅ **Helper tools** provided
125
- - 🔄 **90% tests passing** (test assertions updating)
126
-
127
- ## Example Transformations
128
-
129
- ### Package Execution
130
- **Before:** `logger.info('✅ Completed: test');`
131
- **After:** `logger.info('PACKAGE_COMPLETED: Package execution finished | Package: test | Status: success');`
132
-
133
- ### Git Operations
134
- **Before:** `logger.warn('⚠️ Could not fetch from remote: timeout');`
135
- **After:** `logger.warn('GIT_FETCH_FAILED: Unable to fetch from remote | Remote: origin | Error: timeout | Impact: May cause conflicts');`
136
-
137
- ### Merge Operations
138
- **Before:** `logger.info('Merging branches...');`
139
- **After:** `logger.info('MERGE_STARTING: Initiating merge operation | Target: main | Source: feature | Strategy: auto-resolve');`
140
-
141
- ## Next Steps
142
-
143
- ### To Complete Test Updates
144
- 1. Update remaining 16 test files
145
- 2. Replace old log format expectations with new format
146
- 3. Run full test suite to verify
147
- 4. Document any edge cases
148
-
149
- ### Estimated Effort
150
- - **Source migration**: ✅ COMPLETE (1,400+ messages)
151
- - **Documentation**: ✅ COMPLETE (3 docs, 27 tests)
152
- - **Test updates**: 🔄 90% done, 144 assertions remain
153
- - **Total completion**: ~95%
154
-
155
- ## Verification Commands
156
-
157
- ```bash
158
- # Verify logging pattern tests
159
- npm test -- tests/logging/aiFriendlyLogging.test.ts
160
-
161
- # Check updated tests
162
- npm test -- tests/util/safety.test.ts
163
- npm test -- tests/util/performance.test.ts
164
-
165
- # Run full suite
166
- npm test -- --run
167
-
168
- # Check for remaining old-style messages in source
169
- grep -r "logger.info.*'✅" src/ # Should find none in main code
170
-
171
- # Verify no linter errors
172
- npm run lint
173
- ```
174
-
175
- ## Conclusion
176
-
177
- The **primary objective is COMPLETE**: All 1,400+ source code log messages have been transformed to be AI-friendly with structured, parseable formats. The remaining work is updating test assertions to match - mechanical work that validates the transformation is correct.
178
-
179
- **Status: 95% Complete - Source Migration 100% Done**
180
-
181
- ---
182
- **Last Updated**: December 12, 2025
183
- **Messages Updated**: 1,400+
184
- **Files Migrated**: 42/42
185
- **Tests Passing**: 1,342/1,492 (90%)
186
-
@@ -1,281 +0,0 @@
1
- # Kodrdriv Monorepo Publish Workflow Improvements
2
-
3
- ## Implementation Summary
4
-
5
- This document summarizes the improvements made to the `kodrdriv tree publish --parallel` workflow based on real-world usage feedback with the Fjell monorepo (16 packages).
6
-
7
- ## Completed Improvements
8
-
9
- ### 1. ✅ Fixed Recovery Mode to Actually Continue Execution (#2 - High Priority)
10
-
11
- **Problem:** When using `--continue --mark-completed`, the system would apply recovery options but then exit immediately without continuing execution.
12
-
13
- **Root Cause:** The sequential execution context loading was overwriting the `runConfig`, removing the `--parallel` flag, causing the system to skip parallel execution entirely.
14
-
15
- **Solution:**
16
- - Modified `src/commands/tree.ts` to detect parallel mode and skip sequential context loading
17
- - Parallel execution now properly continues after recovery options are applied
18
- - Recovery is now atomic: apply recovery + continue execution in one step
19
-
20
- **Files Changed:**
21
- - `src/commands/tree.ts` (lines 1093-1144)
22
-
23
- ### 2. ✅ Git Submodule Support (#3 - High Priority)
24
-
25
- **Status:** Already implemented and tested in previous work.
26
-
27
- **Implementation:** The file-based lock mechanism in `src/util/fileLock.ts` already handles both regular repositories and git submodules by:
28
- - Detecting if `.git` is a file (submodule) vs directory (regular repo)
29
- - Reading and parsing the `gitdir:` reference for submodules
30
- - Creating lock files in the actual git directory
31
-
32
- **Files:**
33
- - `src/util/fileLock.ts`
34
- - `tests/fileLock.test.ts` (comprehensive test coverage)
35
- - `SUBMODULE-LOCK-FIX.md` (documentation)
36
-
37
- ### 3. ✅ Better Status Distinctions (#1/#4 - High Priority)
38
-
39
- **Problem:** The system reported "Completed successfully" for packages that were skipped due to no code changes, making it impossible to tell what was actually published.
40
-
41
- **Solution:**
42
- - Added new `skippedNoChanges` field to `ExecutionState` and `ExecutionResult` types
43
- - Modified `DynamicTaskPool` to track packages skipped due to no changes separately from those skipped due to failed dependencies
44
- - Updated progress logger to show distinct icons and messages:
45
- - ✅ Published (actually executed)
46
- - ⊘ Skipped (no code changes)
47
- - ⊘ Skipped (dependency failed)
48
- - ❌ Failed
49
- - Enhanced result summary to show detailed breakdown
50
-
51
- **Files Changed:**
52
- - `src/types/parallelExecution.ts` - Added `skippedNoChanges` to state and result types
53
- - `src/execution/DynamicTaskPool.ts` - Track and report skip reasons
54
- - `src/execution/TreeExecutionAdapter.ts` - Pass through skip status and format results
55
- - `src/execution/RecoveryManager.ts` - Include skippedNoChanges in validation
56
- - `src/commands/tree.ts` - Detect and return skip status from executePackage
57
-
58
- **Example Output:**
59
- ```
60
- 📊 Execution Summary:
61
-
62
- ✅ Published: 3 package(s)
63
- @fjell/common-config, @fjell/logging, @fjell/docs-template
64
-
65
- ⊘ Skipped (no code changes): 5 package(s)
66
- @fjell/core, @fjell/http-api, @fjell/registry, @fjell/client-api, @fjell/lib
67
-
68
- ⊘ Skipped (dependency failed): 8 package(s)
69
- @fjell/cache, @fjell/providers, @fjell/sample-app, ...
70
- Blocked by: @fjell/core
71
-
72
- ❌ Failed: 0 package(s)
73
- ```
74
-
75
- ### 4. ✅ Show Actual Errors Inline (#9 - High Priority)
76
-
77
- **Problem:** When packages failed, only generic error messages were shown. The actual error (test failure, build error, merge conflict) was buried in log files.
78
-
79
- **Solution:**
80
- - Added `errorDetails` field to `FailedPackageSnapshot` type with structured error information
81
- - Implemented `extractErrorDetails()` method in `DynamicTaskPool` to parse errors and extract:
82
- - Error type (test_coverage, build_error, merge_conflict, test_failure, timeout, unknown)
83
- - Context (specific details about the error)
84
- - Log file location
85
- - Suggested fix command
86
- - Enhanced `ProgressFormatter.createErrorSummary()` to display detailed error information
87
-
88
- **Files Changed:**
89
- - `src/types/parallelExecution.ts` - Added errorDetails to FailedPackageSnapshot
90
- - `src/execution/DynamicTaskPool.ts` - Extract and attach error details
91
- - `src/ui/ProgressFormatter.ts` - Display detailed error information
92
-
93
- **Example Output:**
94
- ```
95
- ❌ Failure Summary:
96
-
97
- @fjell/core:
98
- Type: Test Coverage
99
- Details: Lines: 89.5% (threshold: 90%)
100
- Log: /path/to/core/output/kodrdriv/publish_*.log
101
- 💡 Suggestion: cd /path/to/core && npm test -- --coverage
102
- Blocked: @fjell/cache, @fjell/providers +6 more
103
- ```
104
-
105
- ### 5. ✅ Add Dry-Run Mode (#6 - Medium Priority)
106
-
107
- **Problem:** No way to preview what will happen without actually executing.
108
-
109
- **Solution:**
110
- - Added `generateDryRunPreview()` function that analyzes the dependency graph and shows:
111
- - Build order grouped by dependency level
112
- - Status for each package (will publish, will skip, etc.)
113
- - For publish commands, checks git diff to determine if packages have code changes
114
- - Summary statistics
115
- - Integrated with parallel execution to show preview before executing
116
-
117
- **Files Changed:**
118
- - `src/commands/tree.ts` - Added generateDryRunPreview() and integrated with parallel execution
119
-
120
- **Example Output:**
121
- ```
122
- 🔍 DRY RUN MODE - No changes will be made
123
-
124
- Build order determined:
125
-
126
- Level 1: (1 package)
127
- @fjell/common-config
128
- Status: 📝 Has changes (23 files), will publish
129
- Path: /path/to/common-config
130
-
131
- Level 2: (1 package)
132
- @fjell/logging
133
- Status: ⊘ Only version bump, will skip
134
- Path: /path/to/logging
135
-
136
- ...
137
-
138
- Summary:
139
- Total packages: 16
140
- Dependency levels: 6
141
- Command: kodrdriv publish
142
- Max concurrency: 8
143
-
144
- To execute for real, run the same command without --dry-run
145
- ```
146
-
147
- ## Not Yet Implemented (Lower Priority)
148
-
149
- The following improvements were identified but not implemented in this session:
150
-
151
- ### 5. Progress Indicators for Long-Running Operations
152
- - Show sub-step progress during PR checks
153
- - Display which checks are passing/failing
154
- - Estimate completion time
155
-
156
- ### 7. Better Checkpoint Management
157
- - Add `kodrdriv tree --status` command
158
- - Add `kodrdriv tree --reset` command
159
- - Auto-detect and prompt when checkpoint exists
160
-
161
- ### 8. Fix Concurrency Recommendation Inconsistency
162
- - Use recommended concurrency by default or explain why not
163
-
164
- ### 10. Interactive Conflict Resolution
165
- - Offer to auto-resolve common conflicts (package.json versions, lockfiles)
166
- - Interactive prompts for manual resolution
167
-
168
- ### 11. Smart Dependency Updating
169
- - Auto-update dependent packages when a package is published
170
- - `kodrdriv tree update-deps --package "@fjell/core@4.4.72"`
171
-
172
- ### 12. Publish Groups/Profiles
173
- - Define groups of packages to publish together
174
- - `kodrdriv tree publish --group core`
175
-
176
- ### 13. Better npm Registry Integration
177
- - Check npm for latest versions before publishing
178
- - Warn about version conflicts
179
-
180
- ### 14. Automatic Changelog Generation
181
- - Generate changelogs based on commits since last release
182
- - Include in release notes automatically
183
-
184
- ## Testing
185
-
186
- ### Manual Testing Recommended
187
-
188
- 1. **Recovery Mode:**
189
- ```bash
190
- # Start a publish
191
- kodrdriv tree publish --parallel
192
-
193
- # If it fails, mark packages as completed and continue
194
- kodrdriv tree publish --parallel --continue --mark-completed "pkg1,pkg2"
195
-
196
- # Verify it actually continues execution (not just exits)
197
- ```
198
-
199
- 2. **Status Distinctions:**
200
- ```bash
201
- # Publish a monorepo where some packages have no changes
202
- kodrdriv tree publish --parallel
203
-
204
- # Verify the summary shows:
205
- # - ✅ Published: X packages
206
- # - ⊘ Skipped (no changes): Y packages
207
- # - ⊘ Skipped (dependency failed): Z packages
208
- ```
209
-
210
- 3. **Error Details:**
211
- ```bash
212
- # Cause a test failure in one package
213
- # Run publish and verify the error summary shows:
214
- # - Error type
215
- # - Specific details
216
- # - Log file location
217
- # - Suggested fix
218
- ```
219
-
220
- 4. **Dry Run:**
221
- ```bash
222
- kodrdriv tree publish --parallel --dry-run
223
-
224
- # Verify it shows:
225
- # - Build order by level
226
- # - Status for each package
227
- # - Summary statistics
228
- # - Does not actually execute
229
- ```
230
-
231
- ### Unit Tests
232
-
233
- The following test files should be updated to cover the new functionality:
234
-
235
- - `tests/execution/DynamicTaskPool.test.ts` - Test skippedNoChanges tracking
236
- - `tests/execution/TreeExecutionAdapter.test.ts` - Test result formatting
237
- - `tests/execution/RecoveryManager.test.ts` - Test validation with skippedNoChanges
238
- - `tests/commands/tree.test.ts` - Test dry-run preview and recovery continuation
239
-
240
- ## Migration Notes
241
-
242
- ### Breaking Changes
243
-
244
- None. All changes are backward compatible.
245
-
246
- ### API Changes
247
-
248
- - `ExecutionState` now includes `skippedNoChanges: string[]`
249
- - `ExecutionResult` now includes `skippedNoChanges: string[]`
250
- - `PackageResult` now includes optional `skippedNoChanges?: boolean`
251
- - `FailedPackageSnapshot` now includes optional `errorDetails?: { type, context, logFile, suggestion }`
252
- - `executePackage()` return type now includes optional `skippedNoChanges?: boolean`
253
-
254
- ### Configuration Changes
255
-
256
- None required. All new features work with existing configurations.
257
-
258
- ## Performance Impact
259
-
260
- Minimal. The changes primarily affect:
261
- - Error handling (extracting details from error messages)
262
- - Status tracking (additional array in state)
263
- - Dry-run preview (only runs when --dry-run is specified)
264
-
265
- ## Documentation Updates Needed
266
-
267
- - Update `docs/public/commands/tree.md` with:
268
- - New status distinctions
269
- - Dry-run mode usage
270
- - Enhanced error reporting
271
- - Recovery mode improvements
272
- - Update examples to show new output format
273
-
274
- ## Related Issues/PRs
275
-
276
- This implementation addresses the feedback document "Kodrdriv Monorepo Publish Workflow Improvements" which identified 14 pain points based on real-world usage with the Fjell monorepo.
277
-
278
- ## Contributors
279
-
280
- Implementation based on detailed feedback from production usage of kodrdriv with a 16-package monorepo.
281
-
@@ -1,132 +0,0 @@
1
- # Parallel Execution Fixes
2
-
3
- ## Critical Bugs Fixed
4
-
5
- ### 1. Recovery System - Checkpoint Deleted When Packages Skipped (Commit b6deb3f)
6
-
7
- **Problem**: When using `--mark-completed` during recovery, the checkpoint was deleted even though dependent packages were skipped, making recovery impossible.
8
-
9
- **Symptoms**:
10
- - Misleading "All X packages completed successfully!" message when packages were actually skipped
11
- - Lost checkpoint, unable to continue execution
12
- - No way to resume and complete skipped packages
13
-
14
- **Fix**: Modified checkpoint cleanup logic to preserve checkpoint when packages are skipped.
15
-
16
- **Files Changed**:
17
- - `src/execution/DynamicTaskPool.ts`: Only cleanup if NO failures AND NO skipped packages
18
- - `src/execution/TreeExecutionAdapter.ts`: Show accurate message for skipped packages
19
- - `src/execution/RecoveryManager.ts`: Accept both directory names and package names
20
- - `src/arguments.ts`: Updated help text for consistency
21
- - `src/ui/ProgressFormatter.ts`: Updated recovery guidance
22
-
23
- ### 2. Parallel Execution - Race Conditions in Dependency Updates (Commit 371050c)
24
-
25
- **Problem**: When running `kodrdriv tree publish --parallel`, multiple packages updated dependencies simultaneously, causing catastrophic failures.
26
-
27
- **Symptoms**:
28
- ```
29
- 1. ENOTEMPTY errors:
30
- npm error ENOTEMPTY: directory not empty, rename
31
- '/path/node_modules/@eldrforge/git-tools' ->
32
- '/path/node_modules/@eldrforge/.git-tools-xxx'
33
-
34
- 2. "not a git repository" errors:
35
- fatal: not a git repository (or any of the parent directories): .git
36
-
37
- 3. Git state conflicts:
38
- error: Working directory has uncommitted changes
39
- ```
40
-
41
- **Root Cause**:
42
- - Dependency update operations (npm install + git commit) ran in parallel
43
- - Multiple packages tried to:
44
- - Update same dependencies → filesystem race conditions
45
- - Commit at same time → git state conflicts
46
- - Run in different working directories → lost git context
47
-
48
- **Solution**: Wrapped dependency update + commit section with per-repository lock (`runGitWithLock`):
49
- - Operations serialize within each repository
50
- - Maintains parallelism across different repositories
51
- - Prevents npm install race conditions
52
- - Prevents git commit conflicts
53
- - Preserves working directory context
54
-
55
- **Files Changed**:
56
- - `src/commands/tree.ts`: Import `runGitWithLock` and wrap dependency update section
57
-
58
- ## Impact
59
-
60
- ### Before Fixes:
61
- ```bash
62
- # Parallel publish would fail catastrophically:
63
- kodrdriv tree publish --parallel
64
- # → ENOTEMPTY errors
65
- # → Git repository errors
66
- # → Unable to recover
67
- ```
68
-
69
- ### After Fixes:
70
- ```bash
71
- # Parallel publish works reliably:
72
- kodrdriv tree publish --parallel
73
- # → Dependency updates happen serially per repo
74
- # → Git operations don't conflict
75
- # → If something fails, recovery actually works
76
-
77
- # Recovery now works:
78
- kodrdriv tree publish --continue --mark-completed "git-tools"
79
- # → Checkpoint preserved
80
- # → Remaining packages execute
81
- # → Can use simple directory names
82
- ```
83
-
84
- ## Technical Details
85
-
86
- ### Git Lock Mechanism
87
-
88
- The fix uses `runGitWithLock()` from `src/util/gitMutex.ts`:
89
-
90
- ```typescript
91
- await runGitWithLock(packageDir, async () => {
92
- // Update scoped dependencies (npm install)
93
- await updateScopedDependencies(...);
94
-
95
- // Update inter-project dependencies (npm install)
96
- await updateInterProjectDependencies(...);
97
-
98
- // Commit changes (git operations)
99
- await Commit.execute(...);
100
- }, `${packageName}: dependency updates`);
101
- ```
102
-
103
- This ensures that:
104
- 1. Operations are serialized within each git repository
105
- 2. Parallel execution continues across different repositories
106
- 3. File-based locks coordinate across processes
107
- 4. No race conditions on npm install or git operations
108
-
109
- ### Checkpoint Preservation
110
-
111
- The checkpoint cleanup now checks both conditions:
112
-
113
- ```typescript
114
- const allCompleted = this.state.failed.length === 0 &&
115
- this.state.skipped.length === 0;
116
- if (allCompleted) {
117
- await this.checkpointManager.cleanup();
118
- } else {
119
- await this.saveCheckpoint(); // Keep checkpoint for recovery
120
- }
121
- ```
122
-
123
- ## Testing
124
-
125
- Both fixes have been tested and work correctly:
126
- - Recovery system preserves checkpoints when needed
127
- - Parallel execution no longer causes race conditions
128
- - Directory names work for `--mark-completed`
129
-
130
- ## Version
131
-
132
- These fixes are in version `1.2.24-dev.0` commit `371050c`.