@eldrforge/kodrdriv 1.2.131 → 1.2.133

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 (48) hide show
  1. package/AI-GUIDE.md +834 -0
  2. package/README.md +35 -6
  3. package/agentic-reflection-commit-2025-12-27T22-56-06-143Z.md +50 -0
  4. package/agentic-reflection-commit-2025-12-27T23-01-57-294Z.md +50 -0
  5. package/agentic-reflection-commit-2025-12-27T23-11-57-811Z.md +50 -0
  6. package/agentic-reflection-commit-2025-12-27T23-12-50-645Z.md +50 -0
  7. package/agentic-reflection-commit-2025-12-27T23-13-59-347Z.md +52 -0
  8. package/agentic-reflection-commit-2025-12-27T23-14-36-001Z.md +50 -0
  9. package/agentic-reflection-commit-2025-12-27T23-18-59-832Z.md +50 -0
  10. package/agentic-reflection-commit-2025-12-27T23-25-20-667Z.md +62 -0
  11. package/dist/application.js +3 -0
  12. package/dist/application.js.map +1 -1
  13. package/dist/arguments.js +54 -21
  14. package/dist/arguments.js.map +1 -1
  15. package/dist/commands/audio-commit.js +2 -1
  16. package/dist/commands/audio-commit.js.map +1 -1
  17. package/dist/commands/audio-review.js +4 -2
  18. package/dist/commands/audio-review.js.map +1 -1
  19. package/dist/commands/commit.js +109 -288
  20. package/dist/commands/commit.js.map +1 -1
  21. package/dist/commands/publish.js +48 -6
  22. package/dist/commands/publish.js.map +1 -1
  23. package/dist/commands/release.js +79 -292
  24. package/dist/commands/release.js.map +1 -1
  25. package/dist/commands/review.js +1 -1
  26. package/dist/commands/review.js.map +1 -1
  27. package/dist/commands/tree.js +29 -33
  28. package/dist/commands/tree.js.map +1 -1
  29. package/dist/constants.js +3 -1
  30. package/dist/constants.js.map +1 -1
  31. package/dist/util/loggerAdapter.js +17 -0
  32. package/dist/util/loggerAdapter.js.map +1 -1
  33. package/dist/util/storageAdapter.js +9 -2
  34. package/dist/util/storageAdapter.js.map +1 -1
  35. package/guide/ai-system.md +519 -0
  36. package/guide/architecture.md +346 -0
  37. package/guide/commands.md +380 -0
  38. package/guide/configuration.md +513 -0
  39. package/guide/debugging.md +584 -0
  40. package/guide/development.md +629 -0
  41. package/guide/index.md +212 -0
  42. package/guide/integration.md +507 -0
  43. package/guide/monorepo.md +530 -0
  44. package/guide/quickstart.md +223 -0
  45. package/guide/testing.md +460 -0
  46. package/guide/tree-operations.md +618 -0
  47. package/guide/usage.md +575 -0
  48. package/package.json +9 -9
@@ -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`);
@@ -568,7 +613,7 @@ const execute = async (runConfig)=>{
568
613
  if (pr) {
569
614
  logger.info(`PR_FOUND: Existing pull request detected for current branch | URL: ${pr.html_url} | Status: open`);
570
615
  } else {
571
- var _runConfig_publish4, _runConfig_publish5, _runConfig_publish6, _runConfig_publish7, _runConfig_publish8, _runConfig_publish9, _runConfig_publish10, _runConfig_publish11, _runConfig_publish12, _releaseConfig_release, _releaseConfig_release1;
616
+ var _runConfig_publish4, _runConfig_publish5, _runConfig_publish6, _runConfig_publish7, _runConfig_publish8, _runConfig_publish9, _runConfig_publish10, _runConfig_publish11, _runConfig_publish12, _releaseConfig_release;
572
617
  logger.info('PR_NOT_FOUND: No open pull request exists for current branch | Action: Starting new release publishing process | Next: Prepare dependencies and version');
573
618
  // STEP 1: Prepare for release (update dependencies and run prepublish checks) with NO version bump yet
574
619
  logger.verbose('RELEASE_PREP_STARTING: Preparing for release | Phase: dependency management | Action: Switch from workspace to remote dependencies | Version Bump: Not yet applied');
@@ -917,11 +962,8 @@ const execute = async (runConfig)=>{
917
962
  if ((_runConfig_publish12 = runConfig.publish) === null || _runConfig_publish12 === void 0 ? void 0 : _runConfig_publish12.fromMain) {
918
963
  logger.verbose('Forcing comparison against main branch for release notes');
919
964
  }
920
- // Log agentic mode settings for debugging
921
- if ((_releaseConfig_release = releaseConfig.release) === null || _releaseConfig_release === void 0 ? void 0 : _releaseConfig_release.agentic) {
922
- logger.verbose('Agentic mode enabled for release notes generation');
923
- }
924
- if ((_releaseConfig_release1 = releaseConfig.release) === null || _releaseConfig_release1 === void 0 ? void 0 : _releaseConfig_release1.selfReflection) {
965
+ // Log self-reflection settings for debugging
966
+ if ((_releaseConfig_release = releaseConfig.release) === null || _releaseConfig_release === void 0 ? void 0 : _releaseConfig_release.selfReflection) {
925
967
  logger.verbose('Self-reflection enabled for release notes generation');
926
968
  }
927
969
  const releaseSummary = await execute$1(releaseConfig);