@eldrforge/kodrdriv 1.2.28 → 1.2.29
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.
- package/PARALLEL-PUBLISH-DEBUGGING-GUIDE.md +441 -0
- package/PARALLEL-PUBLISH-LOGGING-FIXES.md +274 -0
- package/dist/commands/tree.js +59 -5
- package/dist/commands/tree.js.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/execution/DynamicTaskPool.js +96 -9
- package/dist/execution/DynamicTaskPool.js.map +1 -1
- package/dist/execution/TreeExecutionAdapter.js +4 -1
- package/dist/execution/TreeExecutionAdapter.js.map +1 -1
- package/package.json +4 -4
package/dist/commands/tree.js
CHANGED
|
@@ -363,7 +363,7 @@ const extractPublishedVersion = async (packageDir, packageLogger)=>{
|
|
|
363
363
|
}
|
|
364
364
|
};
|
|
365
365
|
// Enhanced run function that can show output based on log level
|
|
366
|
-
const runWithLogging = async (command, packageLogger, options = {}, showOutput = 'none')=>{
|
|
366
|
+
const runWithLogging = async (command, packageLogger, options = {}, showOutput = 'none', logFilePath)=>{
|
|
367
367
|
const execPromise = util.promisify(exec);
|
|
368
368
|
// Ensure encoding is set to 'utf8' to get string output instead of Buffer
|
|
369
369
|
const execOptions = {
|
|
@@ -377,6 +377,24 @@ const runWithLogging = async (command, packageLogger, options = {}, showOutput =
|
|
|
377
377
|
} else if (showOutput === 'minimal') {
|
|
378
378
|
packageLogger.verbose(`Running: ${command}`);
|
|
379
379
|
}
|
|
380
|
+
// Helper to write to log file
|
|
381
|
+
const writeToLogFile = async (content)=>{
|
|
382
|
+
if (!logFilePath) return;
|
|
383
|
+
try {
|
|
384
|
+
const logDir = path__default.dirname(logFilePath);
|
|
385
|
+
await fs.mkdir(logDir, {
|
|
386
|
+
recursive: true
|
|
387
|
+
});
|
|
388
|
+
await fs.appendFile(logFilePath, content + '\n', 'utf-8');
|
|
389
|
+
} catch (err) {
|
|
390
|
+
packageLogger.warn(`Failed to write to log file ${logFilePath}: ${err.message}`);
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
// Write command to log file
|
|
394
|
+
if (logFilePath) {
|
|
395
|
+
const timestamp = new Date().toISOString();
|
|
396
|
+
await writeToLogFile(`[${timestamp}] Executing: ${command}\n`);
|
|
397
|
+
}
|
|
380
398
|
try {
|
|
381
399
|
const result = await execPromise(command, execOptions);
|
|
382
400
|
if (showOutput === 'full') {
|
|
@@ -401,6 +419,18 @@ const runWithLogging = async (command, packageLogger, options = {}, showOutput =
|
|
|
401
419
|
});
|
|
402
420
|
}
|
|
403
421
|
}
|
|
422
|
+
// Write output to log file
|
|
423
|
+
if (logFilePath) {
|
|
424
|
+
const stdout = String(result.stdout);
|
|
425
|
+
const stderr = String(result.stderr);
|
|
426
|
+
if (stdout.trim()) {
|
|
427
|
+
await writeToLogFile(`\n=== STDOUT ===\n${stdout}`);
|
|
428
|
+
}
|
|
429
|
+
if (stderr.trim()) {
|
|
430
|
+
await writeToLogFile(`\n=== STDERR ===\n${stderr}`);
|
|
431
|
+
}
|
|
432
|
+
await writeToLogFile(`\n[${new Date().toISOString()}] Command completed successfully\n`);
|
|
433
|
+
}
|
|
404
434
|
// Ensure result is properly typed as strings
|
|
405
435
|
return {
|
|
406
436
|
stdout: String(result.stdout),
|
|
@@ -426,6 +456,19 @@ const runWithLogging = async (command, packageLogger, options = {}, showOutput =
|
|
|
426
456
|
});
|
|
427
457
|
}
|
|
428
458
|
}
|
|
459
|
+
// Write error output to log file
|
|
460
|
+
if (logFilePath) {
|
|
461
|
+
await writeToLogFile(`\n[${new Date().toISOString()}] Command failed: ${error.message}`);
|
|
462
|
+
if (error.stdout) {
|
|
463
|
+
await writeToLogFile(`\n=== STDOUT ===\n${error.stdout}`);
|
|
464
|
+
}
|
|
465
|
+
if (error.stderr) {
|
|
466
|
+
await writeToLogFile(`\n=== STDERR ===\n${error.stderr}`);
|
|
467
|
+
}
|
|
468
|
+
if (error.stack) {
|
|
469
|
+
await writeToLogFile(`\n=== STACK TRACE ===\n${error.stack}`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
429
472
|
throw error;
|
|
430
473
|
}
|
|
431
474
|
};
|
|
@@ -473,6 +516,15 @@ const executePackage = async (packageName, packageInfo, commandToRun, runConfig,
|
|
|
473
516
|
const packageLogger = createPackageLogger(packageName, index + 1, total, isDryRun);
|
|
474
517
|
const packageDir = packageInfo.path;
|
|
475
518
|
const logger = getLogger();
|
|
519
|
+
// Create log file path for publish commands
|
|
520
|
+
let logFilePath;
|
|
521
|
+
if (isBuiltInCommand && commandToRun.includes('publish')) {
|
|
522
|
+
var _commandToRun_split_;
|
|
523
|
+
const outputDir = runConfig.outputDirectory || 'output/kodrdriv';
|
|
524
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').replace('T', '_').split('.')[0];
|
|
525
|
+
const commandName = ((_commandToRun_split_ = commandToRun.split(' ')[1]) === null || _commandToRun_split_ === void 0 ? void 0 : _commandToRun_split_.split(' ')[0]) || 'command';
|
|
526
|
+
logFilePath = path__default.join(packageDir, outputDir, `${commandName}_${timestamp}.log`);
|
|
527
|
+
}
|
|
476
528
|
// Determine output level based on flags
|
|
477
529
|
// For publish commands, default to full output to show OpenAI progress and other details
|
|
478
530
|
// For other commands, require --verbose or --debug for output
|
|
@@ -624,7 +676,7 @@ const executePackage = async (packageName, packageInfo, commandToRun, runConfig,
|
|
|
624
676
|
if (builtInCommandName === 'publish') {
|
|
625
677
|
packageLogger.info(`⏰ Setting timeout of ${commandTimeoutMs / 60000} minutes for publish command`);
|
|
626
678
|
}
|
|
627
|
-
const commandPromise = runWithLogging(effectiveCommand, packageLogger, {}, showOutput);
|
|
679
|
+
const commandPromise = runWithLogging(effectiveCommand, packageLogger, {}, showOutput, logFilePath);
|
|
628
680
|
const commandTimeoutPromise = new Promise((_, reject)=>{
|
|
629
681
|
setTimeout(()=>reject(new Error(`Command timed out after ${commandTimeoutMs / 60000} minutes`)), commandTimeoutMs);
|
|
630
682
|
});
|
|
@@ -649,7 +701,7 @@ const executePackage = async (packageName, packageInfo, commandToRun, runConfig,
|
|
|
649
701
|
}
|
|
650
702
|
} else {
|
|
651
703
|
// For custom commands, use the existing logic
|
|
652
|
-
await runWithLogging(commandToRun, packageLogger, {}, showOutput);
|
|
704
|
+
await runWithLogging(commandToRun, packageLogger, {}, showOutput, logFilePath);
|
|
653
705
|
}
|
|
654
706
|
// Track published version after successful publish (skip during dry run)
|
|
655
707
|
if (!isDryRun && isBuiltInCommand && commandToRun.includes('publish')) {
|
|
@@ -718,7 +770,8 @@ const executePackage = async (packageName, packageInfo, commandToRun, runConfig,
|
|
|
718
770
|
}
|
|
719
771
|
return {
|
|
720
772
|
success: true,
|
|
721
|
-
skippedNoChanges: publishWasSkipped
|
|
773
|
+
skippedNoChanges: publishWasSkipped,
|
|
774
|
+
logFile: logFilePath
|
|
722
775
|
};
|
|
723
776
|
} catch (error) {
|
|
724
777
|
var _error_message;
|
|
@@ -733,7 +786,8 @@ const executePackage = async (packageName, packageInfo, commandToRun, runConfig,
|
|
|
733
786
|
return {
|
|
734
787
|
success: false,
|
|
735
788
|
error,
|
|
736
|
-
isTimeoutError
|
|
789
|
+
isTimeoutError,
|
|
790
|
+
logFile: logFilePath
|
|
737
791
|
};
|
|
738
792
|
}
|
|
739
793
|
};
|