@eldrforge/kodrdriv 1.2.29 → 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 +213 -84
  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/ResourceMonitor.js +26 -1
  38. package/dist/execution/ResourceMonitor.js.map +1 -1
  39. package/dist/execution/TreeExecutionAdapter.js +2 -2
  40. package/dist/execution/TreeExecutionAdapter.js.map +1 -1
  41. package/dist/util/checkpointManager.js +2 -4
  42. package/dist/util/checkpointManager.js.map +1 -1
  43. package/dist/util/dependencyGraph.js +2 -4
  44. package/dist/util/dependencyGraph.js.map +1 -1
  45. package/dist/util/general.js +7 -107
  46. package/dist/util/general.js.map +1 -1
  47. package/dist/util/gitMutex.js +63 -18
  48. package/dist/util/gitMutex.js.map +1 -1
  49. package/dist/util/precommitOptimizations.js +310 -0
  50. package/dist/util/precommitOptimizations.js.map +1 -0
  51. package/dist/util/storageAdapter.js +2 -6
  52. package/dist/util/storageAdapter.js.map +1 -1
  53. package/dist/utils/branchState.js +178 -45
  54. package/dist/utils/branchState.js.map +1 -1
  55. package/package.json +6 -5
  56. package/AI-FRIENDLY-LOGGING-GUIDE.md +0 -237
  57. package/AI-LOGGING-MIGRATION-COMPLETE.md +0 -371
  58. package/ALREADY-PUBLISHED-PACKAGES-FIX.md +0 -264
  59. package/AUDIT-BRANCHES-PROGRESS-FIX.md +0 -90
  60. package/AUDIT-EXAMPLE-OUTPUT.md +0 -113
  61. package/CHECKPOINT-RECOVERY-FIX.md +0 -450
  62. package/LOGGING-MIGRATION-STATUS.md +0 -186
  63. package/MONOREPO-PUBLISH-IMPROVEMENTS.md +0 -281
  64. package/PARALLEL-EXECUTION-FIXES.md +0 -132
  65. package/PARALLEL-PUBLISH-DEBUGGING-GUIDE.md +0 -441
  66. package/PARALLEL-PUBLISH-FIXES-IMPLEMENTED.md +0 -405
  67. package/PARALLEL-PUBLISH-IMPROVEMENTS-IMPLEMENTED.md +0 -439
  68. package/PARALLEL-PUBLISH-LOGGING-FIXES.md +0 -274
  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,405 +0,0 @@
1
- # Kodrdriv Parallel Publish Workflow Fixes - Implementation Report
2
-
3
- **Date**: 2025-12-12
4
- **Status**: Partial Implementation Complete
5
- **Issue Reference**: Parallel publish workflow failures requiring manual intervention
6
-
7
- ## Summary
8
-
9
- This document tracks the implementation of critical fixes to address the parallel publish workflow failures described in the user's detailed issue report. The goal is to make parallel publishing reliable and eliminate the need for manual intervention.
10
-
11
- ## ✅ COMPLETED FIXES
12
-
13
- ### 1. CRITICAL: Manual Fallback for Inter-Project Dependencies
14
-
15
- **Problem**: When parallel publish fails, manually running `kodrdriv publish` on individual packages skips the automatic dependency update step, resulting in packages being published with outdated inter-project dependencies. This breaks coordinated releases.
16
-
17
- **Solution Implemented**:
18
-
19
- #### New Commands
20
-
21
- 1. **`kodrdriv updates --inter-project <scope>`** - Update inter-project dependencies in current package
22
- ```bash
23
- cd ~/gitw/getfjell/cache
24
- kodrdriv updates --inter-project @fjell
25
- # Updates all @fjell/* dependencies to latest versions from tree/npm
26
- ```
27
-
28
- 2. **`kodrdriv tree updates --inter-project <scope>`** - Update inter-project dependencies across all packages
29
- ```bash
30
- cd ~/gitw/getfjell
31
- kodrdriv tree updates --inter-project @fjell
32
- # Updates @fjell/* dependencies in all packages in tree
33
- ```
34
-
35
- 3. **`kodrdriv publish --update-deps <scope>`** - Update dependencies before individual publish
36
- ```bash
37
- cd ~/gitw/getfjell/cache
38
- kodrdriv publish --update-deps @fjell --model "gpt-5-mini"
39
- # Updates @fjell/* dependencies, then publishes
40
- ```
41
-
42
- #### Implementation Details
43
-
44
- - **File**: `src/commands/updates.ts`
45
- - Added `updateInterProjectDependencies()` function
46
- - Scans package.json for dependencies matching scope
47
- - Looks up latest versions from tree (sibling packages) or npm registry
48
- - Updates dependencies with caret ranges (`^X.Y.Z`)
49
- - Runs `npm install` to update lockfile
50
-
51
- - **Files Modified**:
52
- - `src/commands/updates.ts` - Core dependency update logic
53
- - `src/commands/publish.ts` - Integration with publish command
54
- - `src/types.ts` - Added `UpdatesConfig.interProject` and `PublishConfig.updateDeps`
55
- - `src/arguments.ts` - Added CLI flags `--inter-project` and `--update-deps`
56
-
57
- #### Usage Examples
58
-
59
- **Scenario 1: Parallel publish fails on `cache` package**
60
- ```bash
61
- # Old (broken) approach:
62
- cd ~/gitw/getfjell/cache
63
- kodrdriv publish --model "gpt-5-mini"
64
- # ❌ Publishes with OLD @fjell/logging ^4.4.62
65
-
66
- # New (correct) approach:
67
- cd ~/gitw/getfjell/cache
68
- kodrdriv publish --update-deps @fjell --model "gpt-5-mini"
69
- # ✅ Updates @fjell/logging to ^4.4.65, then publishes
70
- ```
71
-
72
- **Scenario 2: Update all packages before retry**
73
- ```bash
74
- cd ~/gitw/getfjell
75
- kodrdriv tree updates --inter-project @fjell
76
- # Updates all @fjell/* dependencies across all packages
77
- kodrdriv tree publish --continue
78
- # Retry publish with updated dependencies
79
- ```
80
-
81
- ---
82
-
83
- ### 2. HIGH: Enhanced Audit-Branches to Check Exact Main Branch Sync
84
-
85
- **Problem**: The `--audit-branches` check passed packages as "in good state" even when their local main branches were out of sync with remote. This caused "branch not in sync" errors during parallel publish execution.
86
-
87
- **Solution Implemented**:
88
-
89
- #### New Functionality
90
-
91
- - **Exact SHA comparison**: Checks if local `main` branch SHA exactly matches remote `origin/main` SHA
92
- - **Divergence detection**: Identifies when local main has diverged from remote (needs reset vs. can fast-forward)
93
- - **Prominent reporting**: Target branch sync issues are displayed first in audit output as CRITICAL issues
94
-
95
- #### Implementation Details
96
-
97
- - **File**: `src/utils/branchState.ts`
98
- - Added `TargetBranchSyncStatus` interface
99
- - Added `checkTargetBranchSync()` function
100
- - Enhanced `auditBranchState()` to check target branch sync for each package
101
- - Updated `formatAuditResults()` to prominently display sync issues
102
- - Added `targetBranchSyncIssues` count to `BranchAuditResult`
103
-
104
- #### New Audit Output
105
-
106
- ```
107
- 🚨 Target Branch Sync Issues (3 packages):
108
- ⚠️ 3 packages with target branch NOT in sync with remote
109
- This will cause "branch out of sync" errors during parallel publish!
110
-
111
- @fjell/logging
112
- - Target Branch: main
113
- - Local SHA: a1b2c3d4...
114
- - Remote SHA: e5f6g7h8...
115
- - Action: RESET REQUIRED (local has diverged)
116
-
117
- @fjell/common-config
118
- - Target Branch: main
119
- - Local SHA: i9j0k1l2...
120
- - Remote SHA: m3n4o5p6...
121
- - Action: Pull to fast-forward
122
-
123
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
124
- 📝 RECOMMENDED WORKFLOW:
125
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
126
-
127
- 1️⃣ SYNC TARGET BRANCHES (CRITICAL - Do this FIRST):
128
- • @fjell/logging: cd ~/gitw/getfjell/logging && git checkout main && git reset --hard origin/main && git checkout working
129
- • @fjell/common-config: cd ~/gitw/getfjell/common-config && git checkout main && git pull origin main && git checkout working
130
- ```
131
-
132
- #### Checks Performed
133
-
134
- For each package, the audit now checks:
135
- 1. ✅ Working branch state (ahead/behind, conflicts)
136
- 2. ✅ Version consistency (dev vs. release versions)
137
- 3. ✅ **NEW**: Target branch exact sync with remote
138
- - Local target branch exists?
139
- - Remote target branch exists?
140
- - Local SHA === Remote SHA? (exact match)
141
- - Can fast-forward? (local is ancestor of remote)
142
- - Needs reset? (local has diverged)
143
-
144
- ---
145
-
146
- ## 🚧 IN PROGRESS
147
-
148
- ### 3. HIGH: Auto-Fix Capability for Audit Issues
149
-
150
- **Status**: Partially implemented (infrastructure exists in `autoSyncBranch()` function)
151
-
152
- **Planned**: Add `--sync-all` or `--fix` flag to `kodrdriv tree publish --audit-branches`
153
-
154
- ```bash
155
- kodrdriv tree publish --audit-branches --fix
156
- ```
157
-
158
- This would automatically:
159
- - Reset local main branches to match remote: `git reset --hard origin/main`
160
- - Sync working branches with remote: `git pull --rebase origin working`
161
- - Clean and reinstall node_modules if needed
162
- - Commit any uncommitted package-lock.json changes
163
-
164
- ---
165
-
166
- ## 📋 REMAINING HIGH-PRIORITY FIXES
167
-
168
- ### 4. HIGH: NPM Install Locking to Prevent Race Conditions
169
-
170
- **Problem**: When multiple packages run `npm install` in parallel to update dependencies, they encounter `ENOTEMPTY` errors because they're trying to update the same shared dependencies simultaneously.
171
-
172
- **Proposed Solution**:
173
-
174
- 1. **File-based locking** around npm install operations
175
- - Create `.npm-install.lock` file before npm install
176
- - Wait/retry if lock exists
177
- - Remove lock after completion
178
-
179
- 2. **Sequential dependency updates at each level**
180
- - Level 1 packages complete fully (including dependency propagation)
181
- - Then Level 2 starts
182
- - Prevents race conditions entirely
183
-
184
- 3. **Retry logic for ENOTEMPTY errors**
185
- - Detect `ENOTEMPTY` errors specifically
186
- - Retry with exponential backoff
187
- - Clean node_modules and retry if persistent
188
-
189
- **Implementation Location**: `src/commands/tree.ts` in `updateInterProjectDependencies()` and `updateScopedDependencies()`
190
-
191
- ---
192
-
193
- ### 5. MEDIUM: Improved Checkpoint Failure Categorization
194
-
195
- **Problem**: Checkpoint system doesn't differentiate between transient failures (race conditions, network errors) and permanent failures (merge conflicts, test failures). The `--mark-completed` flag doesn't always work correctly.
196
-
197
- **Proposed Solution**:
198
-
199
- Add failure categorization:
200
- ```typescript
201
- enum FailureCategory {
202
- TRANSIENT = 'transient', // Race condition, network error → Auto-retry
203
- FIXABLE = 'fixable', // Uncommitted changes, branch desync → Suggest fix
204
- BLOCKING = 'blocking' // Merge conflict, test failure → Require manual intervention
205
- }
206
- ```
207
-
208
- Enhanced recovery commands:
209
- ```bash
210
- kodrdriv tree publish --continue --auto-retry # Auto-retry transient failures
211
- kodrdriv tree publish --continue --reset-failed "pkg1,pkg2" # Reset specific failures
212
- kodrdriv tree --status-detailed # Show WHY each package failed
213
- ```
214
-
215
- **Implementation Location**: `src/util/checkpointManager.ts` and `src/execution/RecoveryManager.ts`
216
-
217
- ---
218
-
219
- ### 6. MEDIUM: Detailed Error Reporting with Recovery Suggestions
220
-
221
- **Problem**: Generic error messages like "Failed: @fjell/http-api - Command failed" don't provide actionable information.
222
-
223
- **Proposed Solution**:
224
-
225
- Enhanced error messages:
226
- ```
227
- ❌ Failed: @fjell/http-api
228
- Reason: npm install race condition (ENOTEMPTY)
229
- Suggested fix:
230
- cd /Users/tobrien/gitw/getfjell/http-api
231
- rm -rf node_modules && npm install
232
- git add package-lock.json && git commit -m "Fix lockfile" && git push
233
-
234
- Or retry with: kodrdriv tree publish --continue --retry-failed
235
- ```
236
-
237
- **Implementation Location**: `src/execution/TreeExecutionAdapter.ts` and error handling in `src/commands/tree.ts`
238
-
239
- ---
240
-
241
- ## 📚 DOCUMENTATION UPDATES NEEDED
242
-
243
- ### 1. Update `docs/public/commands/tree-built-in-commands.md`
244
-
245
- Add sections for:
246
- - New `updates --inter-project` command
247
- - Enhanced `--audit-branches` functionality
248
- - Target branch sync checking
249
- - Recovery workflows
250
-
251
- ### 2. Update `docs/public/workflows/run-publish.md`
252
-
253
- Revise workflow to include:
254
- ```markdown
255
- ## Recommended Workflow
256
-
257
- 1. **Run audit with enhanced checks**:
258
- ```bash
259
- kodrdriv tree publish --audit-branches
260
- ```
261
- This now checks:
262
- - Branch consistency
263
- - Uncommitted changes
264
- - Merge conflicts
265
- - Version consistency
266
- - **Target branch exact sync** (NEW)
267
-
268
- 2. **Fix any issues identified**:
269
- - Target branch sync issues are CRITICAL - fix these first
270
- - Follow the numbered workflow in audit output
271
-
272
- 3. **Re-run audit to verify**:
273
- ```bash
274
- kodrdriv tree publish --audit-branches
275
- ```
276
-
277
- 4. **Run parallel publish**:
278
- ```bash
279
- kodrdriv tree publish --parallel --model "gpt-5-mini"
280
- ```
281
-
282
- ## Recovery from Parallel Publish Failures
283
-
284
- If parallel publish fails on specific packages:
285
-
286
- ### Option 1: Update dependencies and retry individual package
287
- ```bash
288
- cd ~/gitw/getfjell/<failed-package>
289
- kodrdriv publish --update-deps @fjell --model "gpt-5-mini"
290
- ```
291
-
292
- ### Option 2: Update all dependencies and retry tree publish
293
- ```bash
294
- kodrdriv tree updates --inter-project @fjell
295
- kodrdriv tree publish --continue
296
- ```
297
-
298
- ### Option 3: Use serial mode (slow but reliable)
299
- ```bash
300
- kodrdriv tree publish --model "gpt-5-mini"
301
- ```
302
- ```
303
-
304
- ### 3. Create new `docs/public/troubleshooting/parallel-publish.md`
305
-
306
- Document common failure scenarios and solutions:
307
- - Target branch sync issues
308
- - npm install race conditions
309
- - Checkpoint recovery
310
- - Manual fallback procedures
311
-
312
- ---
313
-
314
- ## TESTING CHECKLIST
315
-
316
- Before considering parallel mode production-ready:
317
-
318
- - [ ] Run `--audit-branches` on clean repo → Should pass
319
- - [ ] Run `--audit-branches` with main branch desync → Should detect and report
320
- - [ ] Run parallel publish immediately after clean audit → Should complete without manual intervention
321
- - [ ] Test `kodrdriv publish --update-deps` on individual package → Should update dependencies correctly
322
- - [ ] Test `kodrdriv tree updates --inter-project` → Should update all packages
323
- - [ ] Run with 2, 4, 8 packages in parallel → All succeed
324
- - [ ] Simulate slow network during parallel publish → Graceful handling
325
- - [ ] Test checkpoint recovery after forced exit → State restored correctly
326
- - [ ] Test `--mark-completed` on manually fixed package → Correctly unblocks dependents
327
-
328
- ---
329
-
330
- ## MIGRATION NOTES
331
-
332
- ### For Users Currently Experiencing Issues
333
-
334
- If you're currently stuck with a failed parallel publish:
335
-
336
- 1. **Update dependencies in failed packages**:
337
- ```bash
338
- cd ~/gitw/getfjell/<failed-package>
339
- kodrdriv publish --update-deps @fjell --model "gpt-5-mini"
340
- ```
341
-
342
- 2. **Or update all and retry**:
343
- ```bash
344
- cd ~/gitw/getfjell
345
- kodrdriv tree updates --inter-project @fjell
346
- kodrdriv tree publish --continue
347
- ```
348
-
349
- 3. **If main branches are out of sync** (check with audit):
350
- ```bash
351
- kodrdriv tree publish --audit-branches
352
- # Follow the "SYNC TARGET BRANCHES" instructions in output
353
- ```
354
-
355
- ### Breaking Changes
356
-
357
- None. All new functionality is additive and backward-compatible.
358
-
359
- ---
360
-
361
- ## PERFORMANCE IMPACT
362
-
363
- ### Build Time
364
- - No significant impact on build time
365
- - Enhanced audit adds ~2-3 seconds per package for target branch sync check
366
-
367
- ### Runtime
368
- - Inter-project dependency updates add ~5-10 seconds per package
369
- - Overall parallel publish time unchanged (fixes prevent failures, not optimize speed)
370
-
371
- ---
372
-
373
- ## NEXT STEPS
374
-
375
- ### Immediate (High Priority)
376
- 1. ✅ **DONE**: Implement manual fallback commands
377
- 2. ✅ **DONE**: Enhance audit-branches with target branch sync
378
- 3. 🚧 **IN PROGRESS**: Add auto-fix capability (`--fix` flag)
379
- 4. ⏳ **TODO**: Implement npm install locking
380
-
381
- ### Short Term (Medium Priority)
382
- 5. ⏳ **TODO**: Improve checkpoint failure categorization
383
- 6. ⏳ **TODO**: Enhanced error reporting with recovery suggestions
384
- 7. ⏳ **TODO**: Update documentation
385
-
386
- ### Long Term (Architectural)
387
- - Consider redesigning parallel execution to treat publish as an orchestrated workflow rather than independent operations
388
- - Implement proper coordination and recovery mechanisms at the architecture level
389
- - Add telemetry to track failure patterns and optimize retry strategies
390
-
391
- ---
392
-
393
- ## CONCLUSION
394
-
395
- The critical "dependency update trap" has been resolved, allowing safe manual fallback when parallel publish fails. The enhanced audit now catches target branch sync issues before they cause failures during execution.
396
-
397
- However, parallel publish is still not fully production-ready due to:
398
- 1. npm install race conditions (needs locking)
399
- 2. Limited checkpoint recovery intelligence
400
- 3. Generic error messages
401
-
402
- Users should continue using serial mode for critical releases until remaining fixes are implemented. Parallel mode can be used for development/testing with the understanding that manual intervention may still be required.
403
-
404
- The new commands (`--update-deps`, `--inter-project`) provide the tools needed to safely recover from failures without breaking coordinated releases.
405
-