@eldrforge/kodrdriv 1.2.131 → 1.2.132
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/agentic-reflection-commit-2025-12-27T22-56-06-143Z.md +50 -0
- package/agentic-reflection-commit-2025-12-27T23-01-57-294Z.md +50 -0
- package/agentic-reflection-commit-2025-12-27T23-11-57-811Z.md +50 -0
- package/agentic-reflection-commit-2025-12-27T23-12-50-645Z.md +50 -0
- package/agentic-reflection-commit-2025-12-27T23-13-59-347Z.md +52 -0
- package/agentic-reflection-commit-2025-12-27T23-14-36-001Z.md +50 -0
- package/agentic-reflection-commit-2025-12-27T23-18-59-832Z.md +50 -0
- package/agentic-reflection-commit-2025-12-27T23-25-20-667Z.md +62 -0
- package/dist/application.js +3 -0
- package/dist/application.js.map +1 -1
- package/dist/arguments.js +1 -1
- package/dist/arguments.js.map +1 -1
- package/dist/commands/commit.js +26 -163
- package/dist/commands/commit.js.map +1 -1
- package/dist/commands/publish.js +45 -0
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/release.js +25 -161
- package/dist/commands/release.js.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/util/loggerAdapter.js +17 -0
- package/dist/util/loggerAdapter.js.map +1 -1
- package/package.json +9 -9
package/dist/commands/publish.js
CHANGED
|
@@ -11,6 +11,7 @@ import { DEFAULT_OUTPUT_DIRECTORY, KODRDRIV_DEFAULTS } from '../constants.js';
|
|
|
11
11
|
import fs from 'fs/promises';
|
|
12
12
|
import { runGitWithLock } from '../util/gitMutex.js';
|
|
13
13
|
import { filterContent } from '../util/stopContext.js';
|
|
14
|
+
import { runAgenticPublish, formatAgenticPublishResult } from '@eldrforge/ai-service';
|
|
14
15
|
|
|
15
16
|
const scanNpmrcForEnvVars = async (storage)=>{
|
|
16
17
|
const logger = getLogger();
|
|
@@ -186,6 +187,7 @@ const runPrechecks = async (runConfig, targetBranch)=>{
|
|
|
186
187
|
if (targetBranchExists) {
|
|
187
188
|
const syncStatus = await isBranchInSyncWithRemote(effectiveTargetBranch);
|
|
188
189
|
if (!syncStatus.inSync) {
|
|
190
|
+
var _runConfig_publish2;
|
|
189
191
|
logger.error(`BRANCH_SYNC_FAILED: Target branch not synchronized with remote | Branch: ${effectiveTargetBranch} | Status: out-of-sync | Impact: Cannot proceed with publish`);
|
|
190
192
|
logger.error('');
|
|
191
193
|
if (syncStatus.error) {
|
|
@@ -193,6 +195,48 @@ const runPrechecks = async (runConfig, targetBranch)=>{
|
|
|
193
195
|
} else if (syncStatus.localSha && syncStatus.remoteSha) {
|
|
194
196
|
logger.error(`BRANCH_SYNC_DIVERGENCE: Local and remote commits differ | Local SHA: ${syncStatus.localSha.substring(0, 8)} | Remote SHA: ${syncStatus.remoteSha.substring(0, 8)}`);
|
|
195
197
|
}
|
|
198
|
+
// Check if agentic publish is enabled
|
|
199
|
+
if ((_runConfig_publish2 = runConfig.publish) === null || _runConfig_publish2 === void 0 ? void 0 : _runConfig_publish2.agenticPublish) {
|
|
200
|
+
logger.info('');
|
|
201
|
+
logger.info('AGENTIC_PUBLISH_STARTING: Attempting automatic diagnosis and fix | Mode: agentic | Feature: AI-powered recovery');
|
|
202
|
+
try {
|
|
203
|
+
var _syncStatus_localSha, _syncStatus_remoteSha, _runConfig_publish3;
|
|
204
|
+
const currentBranch = await GitHub.getCurrentBranchName();
|
|
205
|
+
const agenticResult = await runAgenticPublish({
|
|
206
|
+
targetBranch: effectiveTargetBranch,
|
|
207
|
+
sourceBranch: currentBranch,
|
|
208
|
+
issue: 'branch_sync',
|
|
209
|
+
issueDetails: syncStatus.error || `Local SHA: ${(_syncStatus_localSha = syncStatus.localSha) === null || _syncStatus_localSha === void 0 ? void 0 : _syncStatus_localSha.substring(0, 8)}, Remote SHA: ${(_syncStatus_remoteSha = syncStatus.remoteSha) === null || _syncStatus_remoteSha === void 0 ? void 0 : _syncStatus_remoteSha.substring(0, 8)}`,
|
|
210
|
+
workingDirectory: process.cwd(),
|
|
211
|
+
maxIterations: ((_runConfig_publish3 = runConfig.publish) === null || _runConfig_publish3 === void 0 ? void 0 : _runConfig_publish3.agenticPublishMaxIterations) || 10,
|
|
212
|
+
storage,
|
|
213
|
+
logger,
|
|
214
|
+
dryRun: runConfig.dryRun
|
|
215
|
+
});
|
|
216
|
+
// Display the formatted result
|
|
217
|
+
const formattedResult = formatAgenticPublishResult(agenticResult);
|
|
218
|
+
logger.info(formattedResult);
|
|
219
|
+
if (agenticResult.success) {
|
|
220
|
+
logger.info('AGENTIC_PUBLISH_SUCCESS: Issue resolved automatically | Status: ready-to-retry | Action: Re-running prechecks');
|
|
221
|
+
// Re-run the sync check to verify it was fixed
|
|
222
|
+
const reSyncStatus = await isBranchInSyncWithRemote(effectiveTargetBranch);
|
|
223
|
+
if (reSyncStatus.inSync) {
|
|
224
|
+
logger.info(`BRANCH_SYNC_VERIFIED: Target branch is now synchronized with remote | Branch: ${effectiveTargetBranch} | Status: in-sync`);
|
|
225
|
+
return; // Continue with publish
|
|
226
|
+
} else {
|
|
227
|
+
logger.warn('AGENTIC_PUBLISH_VERIFICATION_FAILED: Branch still not in sync after agentic fix | Status: needs-attention');
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (agenticResult.requiresManualIntervention) {
|
|
231
|
+
throw new Error(`Target branch '${effectiveTargetBranch}' requires manual intervention. Please see the steps above.`);
|
|
232
|
+
} else {
|
|
233
|
+
throw new Error(`Agentic publish could not resolve the issue automatically. Please see the analysis above.`);
|
|
234
|
+
}
|
|
235
|
+
} catch (agenticError) {
|
|
236
|
+
logger.warn(`AGENTIC_PUBLISH_FAILED: Agentic recovery failed | Error: ${agenticError.message} | Fallback: Manual steps`);
|
|
237
|
+
// Fall through to manual steps
|
|
238
|
+
}
|
|
239
|
+
}
|
|
196
240
|
logger.error('');
|
|
197
241
|
logger.error('RESOLUTION_STEPS: Manual intervention required to sync branches:');
|
|
198
242
|
logger.error(` Step 1: Switch to target branch | Command: git checkout ${effectiveTargetBranch}`);
|
|
@@ -201,6 +245,7 @@ const runPrechecks = async (runConfig, targetBranch)=>{
|
|
|
201
245
|
logger.error(' Step 4: Return to feature branch and retry publish');
|
|
202
246
|
logger.error('');
|
|
203
247
|
logger.error(`ALTERNATIVE_OPTION: Automatic sync available | Command: kodrdriv publish --sync-target | Branch: ${effectiveTargetBranch}`);
|
|
248
|
+
logger.error(`ALTERNATIVE_OPTION_AI: AI-powered recovery available | Command: kodrdriv publish --agentic-publish | Branch: ${effectiveTargetBranch}`);
|
|
204
249
|
throw new Error(`Target branch '${effectiveTargetBranch}' is not in sync with remote. Please sync the branch before running publish.`);
|
|
205
250
|
} else {
|
|
206
251
|
logger.info(`BRANCH_SYNC_VERIFIED: Target branch is synchronized with remote | Branch: ${effectiveTargetBranch} | Status: in-sync`);
|