@shepai/cli 1.122.2-pr395.d35739a → 1.123.0-pr396.ac74a97

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 (164) hide show
  1. package/dist/packages/core/src/application/ports/output/services/git-pr-service.interface.d.ts +50 -41
  2. package/dist/packages/core/src/application/ports/output/services/git-pr-service.interface.d.ts.map +1 -1
  3. package/dist/packages/core/src/application/ports/output/services/git-pr-service.interface.js +5 -5
  4. package/dist/packages/core/src/application/use-cases/features/rebase-feature-on-main.use-case.d.ts +28 -0
  5. package/dist/packages/core/src/application/use-cases/features/rebase-feature-on-main.use-case.d.ts.map +1 -0
  6. package/dist/packages/core/src/application/use-cases/features/rebase-feature-on-main.use-case.js +81 -0
  7. package/dist/packages/core/src/application/use-cases/repositories/sync-repository-main.use-case.d.ts +16 -0
  8. package/dist/packages/core/src/application/use-cases/repositories/sync-repository-main.use-case.d.ts.map +1 -0
  9. package/dist/packages/core/src/application/use-cases/{sync-fork-main.use-case.js → repositories/sync-repository-main.use-case.js} +20 -17
  10. package/dist/packages/core/src/infrastructure/di/container.d.ts.map +1 -1
  11. package/dist/packages/core/src/infrastructure/di/container.js +13 -8
  12. package/dist/packages/core/src/infrastructure/services/agents/conflict-resolution/conflict-resolution.prompt.d.ts +35 -0
  13. package/dist/packages/core/src/infrastructure/services/agents/conflict-resolution/conflict-resolution.prompt.d.ts.map +1 -0
  14. package/dist/packages/core/src/infrastructure/services/agents/conflict-resolution/conflict-resolution.prompt.js +66 -0
  15. package/dist/packages/core/src/infrastructure/services/agents/conflict-resolution/conflict-resolution.service.d.ts +42 -0
  16. package/dist/packages/core/src/infrastructure/services/agents/conflict-resolution/conflict-resolution.service.d.ts.map +1 -0
  17. package/dist/packages/core/src/infrastructure/services/agents/conflict-resolution/conflict-resolution.service.js +169 -0
  18. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.d.ts +6 -9
  19. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.d.ts.map +1 -1
  20. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.js +94 -62
  21. package/dist/src/presentation/cli/commands/feat/index.d.ts.map +1 -1
  22. package/dist/src/presentation/cli/commands/feat/index.js +1 -3
  23. package/dist/src/presentation/cli/commands/repo/index.d.ts.map +1 -1
  24. package/dist/src/presentation/cli/commands/repo/index.js +1 -3
  25. package/dist/tsconfig.build.tsbuildinfo +1 -1
  26. package/package.json +1 -1
  27. package/web/.next/BUILD_ID +1 -1
  28. package/web/.next/build-manifest.json +2 -2
  29. package/web/.next/fallback-build-manifest.json +2 -2
  30. package/web/.next/prerender-manifest.json +3 -3
  31. package/web/.next/required-server-files.js +2 -2
  32. package/web/.next/required-server-files.json +2 -2
  33. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +22 -22
  34. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  35. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  36. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +28 -28
  37. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  38. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  39. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +28 -28
  40. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  41. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  42. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +20 -20
  43. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  44. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  45. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +22 -22
  46. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  47. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  48. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +28 -28
  49. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  50. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  51. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +28 -28
  52. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  53. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  54. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +20 -20
  55. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  56. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  57. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +20 -20
  58. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  59. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  60. package/web/.next/server/app/_global-error.html +2 -2
  61. package/web/.next/server/app/_global-error.rsc +1 -1
  62. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  63. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  64. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  65. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  66. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  67. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  68. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  69. package/web/.next/server/app/settings/page/server-reference-manifest.json +6 -6
  70. package/web/.next/server/app/settings/page.js.nft.json +1 -1
  71. package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  72. package/web/.next/server/app/skills/page/server-reference-manifest.json +6 -6
  73. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  74. package/web/.next/server/app/tools/page/server-reference-manifest.json +6 -6
  75. package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  76. package/web/.next/server/app/version/page/server-reference-manifest.json +1 -1
  77. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  78. package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
  79. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
  80. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
  81. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_f30d0343.js +1 -1
  82. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_f30d0343.js.map +1 -1
  83. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_9f1775bb.js +1 -1
  84. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_9f1775bb.js.map +1 -1
  85. package/web/.next/server/chunks/ssr/[root-of-the-server]__06fef644._.js +1 -1
  86. package/web/.next/server/chunks/ssr/[root-of-the-server]__14664e9b._.js +2 -2
  87. package/web/.next/server/chunks/ssr/[root-of-the-server]__545792ab._.js +1 -1
  88. package/web/.next/server/chunks/ssr/[root-of-the-server]__545792ab._.js.map +1 -1
  89. package/web/.next/server/chunks/ssr/[root-of-the-server]__6b17a22d._.js +1 -1
  90. package/web/.next/server/chunks/ssr/[root-of-the-server]__6b17a22d._.js.map +1 -1
  91. package/web/.next/server/chunks/ssr/[root-of-the-server]__6bb00d90._.js +2 -2
  92. package/web/.next/server/chunks/ssr/[root-of-the-server]__6bb00d90._.js.map +1 -1
  93. package/web/.next/server/chunks/ssr/[root-of-the-server]__7cbda1ea._.js +1 -1
  94. package/web/.next/server/chunks/ssr/[root-of-the-server]__7cbda1ea._.js.map +1 -1
  95. package/web/.next/server/chunks/ssr/[root-of-the-server]__804c006d._.js +1 -1
  96. package/web/.next/server/chunks/ssr/[root-of-the-server]__804c006d._.js.map +1 -1
  97. package/web/.next/server/chunks/ssr/[root-of-the-server]__8c553503._.js +2 -2
  98. package/web/.next/server/chunks/ssr/[root-of-the-server]__9e8b25ad._.js +1 -1
  99. package/web/.next/server/chunks/ssr/[root-of-the-server]__9e8b25ad._.js.map +1 -1
  100. package/web/.next/server/chunks/ssr/[root-of-the-server]__a7de2711._.js +2 -2
  101. package/web/.next/server/chunks/ssr/[root-of-the-server]__aed1d6f8._.js +1 -1
  102. package/web/.next/server/chunks/ssr/[root-of-the-server]__aed1d6f8._.js.map +1 -1
  103. package/web/.next/server/chunks/ssr/[root-of-the-server]__ce6057f6._.js +1 -1
  104. package/web/.next/server/chunks/ssr/[root-of-the-server]__ce6057f6._.js.map +1 -1
  105. package/web/.next/server/chunks/ssr/_135edb9c._.js +1 -1
  106. package/web/.next/server/chunks/ssr/_135edb9c._.js.map +1 -1
  107. package/web/.next/server/chunks/ssr/{_59905c6b._.js → _2c12de0e._.js} +2 -2
  108. package/web/.next/server/chunks/ssr/{_59905c6b._.js.map → _2c12de0e._.js.map} +1 -1
  109. package/web/.next/server/chunks/ssr/_2f6f48b8._.js +1 -1
  110. package/web/.next/server/chunks/ssr/_2f6f48b8._.js.map +1 -1
  111. package/web/.next/server/chunks/ssr/{_8042b250._.js → _453aab7f._.js} +2 -2
  112. package/web/.next/server/chunks/ssr/{_8042b250._.js.map → _453aab7f._.js.map} +1 -1
  113. package/web/.next/server/chunks/ssr/_cc77a143._.js +1 -1
  114. package/web/.next/server/chunks/ssr/_cc77a143._.js.map +1 -1
  115. package/web/.next/server/chunks/ssr/_e9703421._.js +1 -1
  116. package/web/.next/server/chunks/ssr/_e9703421._.js.map +1 -1
  117. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
  118. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
  119. package/web/.next/server/chunks/ssr/src_presentation_web_3bdae61e._.js +3 -0
  120. package/web/.next/server/chunks/ssr/{src_presentation_web_7df6451f._.js.map → src_presentation_web_3bdae61e._.js.map} +1 -1
  121. package/web/.next/server/chunks/ssr/src_presentation_web_5f039db1._.js +2 -2
  122. package/web/.next/server/chunks/ssr/src_presentation_web_5f039db1._.js.map +1 -1
  123. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_2a52b697.js +1 -1
  124. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_2a52b697.js.map +1 -1
  125. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1fa8042e.js +1 -1
  126. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1fa8042e.js.map +1 -1
  127. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_24684200.js +1 -1
  128. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_24684200.js.map +1 -1
  129. package/web/.next/server/chunks/ssr/src_presentation_web_c4337169._.js +2 -2
  130. package/web/.next/server/chunks/ssr/src_presentation_web_c4337169._.js.map +1 -1
  131. package/web/.next/server/chunks/ssr/src_presentation_web_components_bf50c527._.js +1 -1
  132. package/web/.next/server/chunks/ssr/src_presentation_web_components_de814675._.js +1 -1
  133. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
  134. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
  135. package/web/.next/server/pages/500.html +2 -2
  136. package/web/.next/server/server-reference-manifest.js +1 -1
  137. package/web/.next/server/server-reference-manifest.json +34 -34
  138. package/web/.next/static/chunks/{2d718a04eb97fa9c.js → 18d48be836aa52c7.js} +1 -1
  139. package/web/.next/static/chunks/{47030173ef438c4c.js → 1c8720120b410d97.js} +2 -2
  140. package/web/.next/static/chunks/{5738cc053b378225.js → 2a7a88568c0b333c.js} +1 -1
  141. package/web/.next/static/chunks/{16c125d4054dae40.js → 71bbee1068681c20.js} +1 -1
  142. package/web/.next/static/chunks/{3c8f903477aacd29.js → 79130e383fd42bd3.js} +1 -1
  143. package/web/.next/static/chunks/{28882fc716f51419.js → 81991ab1194e5add.js} +2 -2
  144. package/web/.next/static/chunks/{4aadcf496c0c45da.js → be7f6f6f348b8a7b.js} +1 -1
  145. package/web/.next/static/chunks/{44ec09b4f33c494d.js → cccafcc6f11a334d.js} +1 -1
  146. package/web/.next/static/chunks/dad42b7aec1260a8.js +1 -0
  147. package/web/.next/static/chunks/de901251b6aedd83.js +1 -0
  148. package/dist/packages/core/src/application/use-cases/features/rebase-feature.use-case.d.ts +0 -21
  149. package/dist/packages/core/src/application/use-cases/features/rebase-feature.use-case.d.ts.map +0 -1
  150. package/dist/packages/core/src/application/use-cases/features/rebase-feature.use-case.js +0 -58
  151. package/dist/packages/core/src/application/use-cases/sync-fork-main.use-case.d.ts +0 -18
  152. package/dist/packages/core/src/application/use-cases/sync-fork-main.use-case.d.ts.map +0 -1
  153. package/dist/src/presentation/cli/commands/feat/rebase.command.d.ts +0 -13
  154. package/dist/src/presentation/cli/commands/feat/rebase.command.d.ts.map +0 -1
  155. package/dist/src/presentation/cli/commands/feat/rebase.command.js +0 -45
  156. package/dist/src/presentation/cli/commands/repo/sync.command.d.ts +0 -12
  157. package/dist/src/presentation/cli/commands/repo/sync.command.d.ts.map +0 -1
  158. package/dist/src/presentation/cli/commands/repo/sync.command.js +0 -38
  159. package/web/.next/server/chunks/ssr/src_presentation_web_7df6451f._.js +0 -3
  160. package/web/.next/static/chunks/0b7e384fe33dc5d4.js +0 -1
  161. package/web/.next/static/chunks/6bc9ac207dab5ad3.js +0 -1
  162. /package/web/.next/static/{8e_LzmibF0x2F_XwXUjHz → qG2ZylwG6wDwdBv8fcdAw}/_buildManifest.js +0 -0
  163. /package/web/.next/static/{8e_LzmibF0x2F_XwXUjHz → qG2ZylwG6wDwdBv8fcdAw}/_clientMiddlewareManifest.json +0 -0
  164. /package/web/.next/static/{8e_LzmibF0x2F_XwXUjHz → qG2ZylwG6wDwdBv8fcdAw}/_ssgManifest.js +0 -0
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Conflict Resolution Service
3
+ *
4
+ * Orchestrates agent-powered conflict resolution during git rebase.
5
+ * Follows the CI watch/fix loop pattern: detect conflict → invoke agent →
6
+ * validate resolution → stage files → continue rebase, with retry logic.
7
+ */
8
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
9
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
12
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
13
+ };
14
+ var __metadata = (this && this.__metadata) || function (k, v) {
15
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
16
+ };
17
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
18
+ return function (target, key) { decorator(target, key, paramIndex); }
19
+ };
20
+ import { injectable, inject } from 'tsyringe';
21
+ import { readFileSync } from 'node:fs';
22
+ import { join } from 'node:path';
23
+ import { GitPrError, GitPrErrorCode, } from '../../../../application/ports/output/services/git-pr-service.interface.js';
24
+ import { buildConflictResolutionPrompt, } from './conflict-resolution.prompt.js';
25
+ const MAX_RETRIES_PER_COMMIT = 3;
26
+ /** Conflict markers that indicate unresolved conflicts */
27
+ const CONFLICT_MARKERS = ['<<<<<<<', '=======', '>>>>>>>'];
28
+ let ConflictResolutionService = class ConflictResolutionService {
29
+ agentProvider;
30
+ gitPrService;
31
+ constructor(agentProvider, gitPrService) {
32
+ this.agentProvider = agentProvider;
33
+ this.gitPrService = gitPrService;
34
+ }
35
+ /**
36
+ * Resolve all conflicts during a rebase operation.
37
+ *
38
+ * Handles multi-commit rebases where each commit may introduce conflicts.
39
+ * For each conflicted commit: reads conflicted files, invokes agent to
40
+ * resolve, validates no remaining markers, stages resolved files, and
41
+ * continues the rebase. Retries up to MAX_RETRIES_PER_COMMIT times.
42
+ *
43
+ * If retries are exhausted, aborts the rebase and throws REBASE_CONFLICT.
44
+ *
45
+ * @param cwd - Working directory (repo root or worktree path)
46
+ * @param featureBranch - Feature branch being rebased
47
+ * @param baseBranch - Base branch being rebased onto
48
+ */
49
+ async resolve(cwd, featureBranch, baseBranch) {
50
+ const executor = await this.agentProvider.getExecutor();
51
+ // Outer loop: handle multi-commit rebases where rebaseContinue
52
+ // may reveal conflicts on the next commit
53
+ while (true) {
54
+ const conflictedFiles = await this.gitPrService.getConflictedFiles(cwd);
55
+ if (conflictedFiles.length === 0) {
56
+ return; // No conflicts — rebase is complete
57
+ }
58
+ // Inner loop: retry agent resolution for the current commit's conflicts
59
+ let resolved = false;
60
+ for (let attempt = 1; attempt <= MAX_RETRIES_PER_COMMIT; attempt++) {
61
+ const fileContents = this.readConflictedFileContents(cwd, conflictedFiles);
62
+ const previousFeedback = attempt > 1 ? this.buildFeedbackFromRemainingMarkers(cwd, conflictedFiles) : undefined;
63
+ const prompt = buildConflictResolutionPrompt({
64
+ conflictedFiles: fileContents,
65
+ featureBranch,
66
+ baseBranch,
67
+ attemptNumber: attempt,
68
+ maxAttempts: MAX_RETRIES_PER_COMMIT,
69
+ previousFeedback,
70
+ });
71
+ await executor.execute(prompt, { cwd });
72
+ // Validate: check no conflict markers remain
73
+ if (this.validateResolution(cwd, conflictedFiles)) {
74
+ resolved = true;
75
+ break;
76
+ }
77
+ }
78
+ if (!resolved) {
79
+ // Exhausted retries — abort and report
80
+ await this.gitPrService.rebaseAbort(cwd);
81
+ const remaining = conflictedFiles.join(', ');
82
+ throw new GitPrError(`Failed to resolve conflicts after ${MAX_RETRIES_PER_COMMIT} attempts. ` +
83
+ `Unresolved files: ${remaining}. The rebase has been aborted.`, GitPrErrorCode.REBASE_CONFLICT);
84
+ }
85
+ // Resolution succeeded — stage files and continue rebase
86
+ await this.gitPrService.stageFiles(cwd, conflictedFiles);
87
+ try {
88
+ await this.gitPrService.rebaseContinue(cwd);
89
+ // rebaseContinue succeeded — check if there are more conflicts
90
+ // from subsequent commits (loop continues)
91
+ return; // No more conflicts
92
+ }
93
+ catch (error) {
94
+ if (error instanceof GitPrError && error.code === GitPrErrorCode.REBASE_CONFLICT) {
95
+ // Next commit has conflicts — loop back to resolve them
96
+ continue;
97
+ }
98
+ throw error; // Unexpected error
99
+ }
100
+ }
101
+ }
102
+ /**
103
+ * Read the contents of conflicted files from the working directory.
104
+ */
105
+ readConflictedFileContents(cwd, filePaths) {
106
+ return filePaths.map((filePath) => {
107
+ try {
108
+ const content = readFileSync(join(cwd, filePath), 'utf-8');
109
+ return { path: filePath, content };
110
+ }
111
+ catch {
112
+ return { path: filePath, content: '(unable to read file)' };
113
+ }
114
+ });
115
+ }
116
+ /**
117
+ * Validate that no conflict markers remain in the previously-conflicted files.
118
+ */
119
+ validateResolution(cwd, filePaths) {
120
+ for (const filePath of filePaths) {
121
+ try {
122
+ const content = readFileSync(join(cwd, filePath), 'utf-8');
123
+ for (const marker of CONFLICT_MARKERS) {
124
+ if (content.includes(marker)) {
125
+ return false;
126
+ }
127
+ }
128
+ }
129
+ catch {
130
+ return false;
131
+ }
132
+ }
133
+ return true;
134
+ }
135
+ /**
136
+ * Build feedback about remaining conflict markers for retry attempts.
137
+ */
138
+ buildFeedbackFromRemainingMarkers(cwd, filePaths) {
139
+ const remaining = [];
140
+ for (const filePath of filePaths) {
141
+ try {
142
+ const content = readFileSync(join(cwd, filePath), 'utf-8');
143
+ const lines = content.split('\n');
144
+ const markerLines = [];
145
+ lines.forEach((line, index) => {
146
+ if (CONFLICT_MARKERS.some((marker) => line.includes(marker))) {
147
+ markerLines.push(index + 1);
148
+ }
149
+ });
150
+ if (markerLines.length > 0) {
151
+ remaining.push(`- \`${filePath}\`: conflict markers remain on lines ${markerLines.join(', ')}`);
152
+ }
153
+ }
154
+ catch {
155
+ remaining.push(`- \`${filePath}\`: unable to read file`);
156
+ }
157
+ }
158
+ return remaining.length > 0
159
+ ? remaining.join('\n')
160
+ : 'No specific markers found, but validation failed.';
161
+ }
162
+ };
163
+ ConflictResolutionService = __decorate([
164
+ injectable(),
165
+ __param(0, inject('IAgentExecutorProvider')),
166
+ __param(1, inject('IGitPrService')),
167
+ __metadata("design:paramtypes", [Object, Object])
168
+ ], ConflictResolutionService);
169
+ export { ConflictResolutionService };
@@ -45,14 +45,11 @@ export declare class GitPrService implements IGitPrService {
45
45
  private parseGhError;
46
46
  private parsePrNumberFromUrl;
47
47
  private parseDiffStat;
48
- isFork(cwd: string): Promise<{
49
- isFork: boolean;
50
- upstreamUrl?: string;
51
- }>;
52
- ensureUpstreamRemote(cwd: string, upstreamUrl: string): Promise<void>;
53
- fetchUpstream(cwd: string): Promise<void>;
54
- syncForkMain(cwd: string): Promise<void>;
55
- rebase(cwd: string, branch: string, onto: string): Promise<void>;
56
- private parseConflictFiles;
48
+ syncMain(cwd: string, baseBranch: string): Promise<void>;
49
+ rebaseOnMain(cwd: string, featureBranch: string, baseBranch: string): Promise<void>;
50
+ getConflictedFiles(cwd: string): Promise<string[]>;
51
+ stageFiles(cwd: string, files: string[]): Promise<void>;
52
+ rebaseContinue(cwd: string): Promise<void>;
53
+ rebaseAbort(cwd: string): Promise<void>;
57
54
  }
58
55
  //# sourceMappingURL=git-pr.service.d.ts.map
@@ -1 +1 @@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C;IA6CnB;;;OAGG;YACW,UAAU;IAmBlB,cAAc,CAClB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,WAAW,SAAS,GACnB,OAAO,CAAC,MAAM,CAAC;IAWlB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,aAAa;IAkBf,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAiBvE,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcrE,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQzC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BxC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCtE,OAAO,CAAC,kBAAkB;CAI3B"}
1
+ {"version":3,"file":"git-pr.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/git/git-pr.service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wEAAwE,CAAC;AAC5G,OAAO,KAAK,EACV,cAAc,EAGd,WAAW,EACX,QAAQ,EACR,aAAa,EACb,cAAc,EACd,YAAY,EACb,MAAM,wEAAwE,CAAC;AAUhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,qBACa,YAAa,YAAW,a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AE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmCxD,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqEnF,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAelD,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQvD,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB1C,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAO9C"}
@@ -612,6 +612,14 @@ let GitPrService = class GitPrService {
612
612
  parseGitError(error) {
613
613
  const message = error instanceof Error ? error.message : String(error);
614
614
  const cause = error instanceof Error ? error : undefined;
615
+ // Rebase-specific: detect "CONFLICT" during rebase operations
616
+ if (message.includes('CONFLICT') && message.includes('rebase')) {
617
+ return new GitPrError(message, GitPrErrorCode.REBASE_CONFLICT, cause);
618
+ }
619
+ // Sync-specific: non-fast-forward or diverged branch
620
+ if (message.includes('non-fast-forward') || message.includes('diverged')) {
621
+ return new GitPrError(message, GitPrErrorCode.SYNC_FAILED, cause);
622
+ }
615
623
  if (message.includes('rejected') || message.includes('conflict')) {
616
624
  return new GitPrError(message, GitPrErrorCode.MERGE_CONFLICT, cause);
617
625
  }
@@ -652,99 +660,123 @@ let GitPrService = class GitPrService {
652
660
  commitCount,
653
661
  };
654
662
  }
655
- async isFork(cwd) {
663
+ // --- Rebase & Sync operations ---
664
+ async syncMain(cwd, baseBranch) {
656
665
  try {
657
- const { stdout } = await this.execFile('gh', ['repo', 'view', '--json', 'parent', '--jq', '.parent.url'], { cwd });
658
- const url = stdout.trim();
659
- if (!url || url === 'null') {
660
- return { isFork: false };
666
+ // Detect current branch
667
+ const { stdout } = await this.execFile('git', ['rev-parse', '--abbrev-ref', 'HEAD'], { cwd });
668
+ const currentBranch = stdout.trim();
669
+ if (currentBranch === baseBranch) {
670
+ // On the base branch — use git pull --ff-only
671
+ await this.execFile('git', ['pull', '--ff-only', 'origin', baseBranch], { cwd });
672
+ }
673
+ else {
674
+ // On a different branch — use git fetch to update the base branch ref without switching
675
+ await this.execFile('git', ['fetch', 'origin', `${baseBranch}:${baseBranch}`], { cwd });
661
676
  }
662
- return { isFork: true, upstreamUrl: url };
663
677
  }
664
- catch {
665
- return { isFork: false };
678
+ catch (error) {
679
+ const message = error instanceof Error ? error.message : String(error);
680
+ const cause = error instanceof Error ? error : undefined;
681
+ if (message.includes('non-fast-forward') || message.includes('diverged')) {
682
+ throw new GitPrError(`Cannot fast-forward '${baseBranch}': local branch has diverged from remote. ` +
683
+ `Resolve the divergence manually with 'git checkout ${baseBranch} && git reset --hard origin/${baseBranch}' ` +
684
+ `if you want to discard local changes on ${baseBranch}.`, GitPrErrorCode.SYNC_FAILED, cause);
685
+ }
686
+ throw new GitPrError(`Failed to sync '${baseBranch}' with remote: ${message}`, GitPrErrorCode.GIT_ERROR, cause);
666
687
  }
667
688
  }
668
- async ensureUpstreamRemote(cwd, upstreamUrl) {
689
+ async rebaseOnMain(cwd, featureBranch, baseBranch) {
690
+ // Check for dirty worktree before starting
691
+ const dirty = await this.hasUncommittedChanges(cwd);
692
+ if (dirty) {
693
+ throw new GitPrError(`Cannot rebase: working directory has uncommitted changes. ` +
694
+ `Please commit or stash your changes before rebasing.`, GitPrErrorCode.GIT_ERROR);
695
+ }
696
+ // Checkout the feature branch
669
697
  try {
670
- await this.execFile('git', ['remote', 'get-url', 'upstream'], { cwd });
671
- // Remote already exists — no-op
698
+ await this.execFile('git', ['checkout', featureBranch], { cwd });
672
699
  }
673
- catch {
674
- // Remote does not exist — add it
675
- try {
676
- await this.execFile('git', ['remote', 'add', 'upstream', upstreamUrl], { cwd });
700
+ catch (error) {
701
+ const message = error instanceof Error ? error.message : String(error);
702
+ const cause = error instanceof Error ? error : undefined;
703
+ if (message.includes('did not match') ||
704
+ message.includes('not a commit') ||
705
+ message.includes('pathspec')) {
706
+ throw new GitPrError(`Branch '${featureBranch}' not found.`, GitPrErrorCode.BRANCH_NOT_FOUND, cause);
677
707
  }
678
- catch (error) {
679
- throw this.parseGitError(error);
708
+ throw new GitPrError(`Failed to checkout '${featureBranch}': ${message}`, GitPrErrorCode.GIT_ERROR, cause);
709
+ }
710
+ // Rebase onto the base branch
711
+ try {
712
+ await this.execFile('git', ['rebase', baseBranch], { cwd });
713
+ }
714
+ catch (error) {
715
+ const message = error instanceof Error ? error.message : String(error);
716
+ const cause = error instanceof Error ? error : undefined;
717
+ // Detect rebase conflict from git stderr/exit code
718
+ if (message.includes('CONFLICT') || message.includes('could not apply')) {
719
+ // Get the list of conflicted files to include in the error message
720
+ let conflictedFiles = [];
721
+ try {
722
+ conflictedFiles = await this.getConflictedFiles(cwd);
723
+ }
724
+ catch {
725
+ // Failed to get conflicted files — still report the conflict
726
+ }
727
+ const fileList = conflictedFiles.length > 0 ? ` Conflicted files: ${conflictedFiles.join(', ')}` : '';
728
+ throw new GitPrError(`Rebase of '${featureBranch}' onto '${baseBranch}' encountered conflicts.${fileList}`, GitPrErrorCode.REBASE_CONFLICT, cause);
680
729
  }
730
+ throw new GitPrError(`Rebase of '${featureBranch}' onto '${baseBranch}' failed: ${message}`, GitPrErrorCode.GIT_ERROR, cause);
681
731
  }
682
732
  }
683
- async fetchUpstream(cwd) {
733
+ async getConflictedFiles(cwd) {
684
734
  try {
685
- await this.execFile('git', ['fetch', 'upstream'], { cwd });
735
+ const { stdout } = await this.execFile('git', ['diff', '--name-only', '--diff-filter=U'], {
736
+ cwd,
737
+ });
738
+ return stdout
739
+ .trim()
740
+ .split('\n')
741
+ .filter((f) => f.length > 0)
742
+ .map((f) => f.replace(/\\/g, '/'));
686
743
  }
687
744
  catch (error) {
688
745
  throw this.parseGitError(error);
689
746
  }
690
747
  }
691
- async syncForkMain(cwd) {
692
- // Save current branch to restore after sync
693
- let currentBranch;
748
+ async stageFiles(cwd, files) {
694
749
  try {
695
- const { stdout } = await this.execFile('git', ['symbolic-ref', '--short', 'HEAD'], { cwd });
696
- currentBranch = stdout.trim();
750
+ await this.execFile('git', ['add', ...files], { cwd });
697
751
  }
698
- catch {
699
- // Detached HEAD — save commit hash instead
700
- const { stdout } = await this.execFile('git', ['rev-parse', 'HEAD'], { cwd });
701
- currentBranch = stdout.trim();
752
+ catch (error) {
753
+ throw this.parseGitError(error);
702
754
  }
755
+ }
756
+ async rebaseContinue(cwd) {
703
757
  try {
704
- await this.fetchUpstream(cwd);
705
- await this.execFile('git', ['checkout', 'main'], { cwd });
706
- await this.execFile('git', ['reset', '--hard', 'upstream/main'], { cwd });
758
+ await this.execFile('git', ['rebase', '--continue'], {
759
+ cwd,
760
+ env: { ...process.env, GIT_EDITOR: 'true' },
761
+ });
707
762
  }
708
- finally {
709
- // Restore previous branch even if sync partially fails
710
- try {
711
- await this.execFile('git', ['checkout', currentBranch], { cwd });
712
- }
713
- catch {
714
- // best effort — ignore restore failure
763
+ catch (error) {
764
+ const message = error instanceof Error ? error.message : String(error);
765
+ const cause = error instanceof Error ? error : undefined;
766
+ if (message.includes('CONFLICT') || message.includes('could not apply')) {
767
+ throw new GitPrError(`Rebase continue encountered new conflicts: ${message}`, GitPrErrorCode.REBASE_CONFLICT, cause);
715
768
  }
769
+ throw this.parseGitError(error);
716
770
  }
717
771
  }
718
- async rebase(cwd, branch, onto) {
772
+ async rebaseAbort(cwd) {
719
773
  try {
720
- await this.execFile('git', ['rebase', onto], { cwd });
774
+ await this.execFile('git', ['rebase', '--abort'], { cwd });
721
775
  }
722
776
  catch (error) {
723
- // Extract stdout/stderr from the exec error to find conflict file names
724
- const stdout = error.stdout ?? '';
725
- const stderr = error.stderr ?? '';
726
- const combined = `${stdout}\n${stderr}`;
727
- const conflictFiles = this.parseConflictFiles(combined);
728
- // Abort to keep the worktree clean
729
- try {
730
- await this.execFile('git', ['rebase', '--abort'], { cwd });
731
- }
732
- catch {
733
- // abort is best-effort — ignore failure
734
- }
735
- if (conflictFiles.length > 0) {
736
- const fileList = conflictFiles.map((f) => ` - ${f}`).join('\n');
737
- throw new GitPrError(`Rebase of '${branch}' onto '${onto}' failed due to conflicts.\n` +
738
- `Conflicting files:\n${fileList}\n\n` +
739
- `Resolve the conflicts manually then re-run the rebase command.`, GitPrErrorCode.REBASE_CONFLICT, error instanceof Error ? error : undefined);
740
- }
741
777
  throw this.parseGitError(error);
742
778
  }
743
779
  }
744
- parseConflictFiles(output) {
745
- const matches = output.matchAll(/CONFLICT \(content\): Merge conflict in (.+)/g);
746
- return [...matches].map((m) => m[1].trim());
747
- }
748
780
  };
749
781
  GitPrService = __decorate([
750
782
  injectable(),
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/cli/commands/feat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAc3C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/cli/commands/feat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAa3C"}
@@ -20,7 +20,6 @@ import { createReviewCommand } from './review.command.js';
20
20
  import { createApproveCommand } from './approve.command.js';
21
21
  import { createRejectCommand } from './reject.command.js';
22
22
  import { createLogsCommand } from './logs.command.js';
23
- import { createRebaseCommand } from './rebase.command.js';
24
23
  /**
25
24
  * Create the feat command group
26
25
  */
@@ -36,6 +35,5 @@ export function createFeatCommand() {
36
35
  .addCommand(createReviewCommand())
37
36
  .addCommand(createApproveCommand())
38
37
  .addCommand(createRejectCommand())
39
- .addCommand(createLogsCommand())
40
- .addCommand(createRebaseCommand());
38
+ .addCommand(createLogsCommand());
41
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/cli/commands/repo/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAQ3C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/cli/commands/repo/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAO3C"}
@@ -13,7 +13,6 @@
13
13
  import { Command } from 'commander';
14
14
  import { createShowCommand } from './show.command.js';
15
15
  import { createLsCommand } from './ls.command.js';
16
- import { createSyncCommand } from './sync.command.js';
17
16
  /**
18
17
  * Create the repo command with all subcommands
19
18
  */
@@ -21,7 +20,6 @@ export function createRepoCommand() {
21
20
  const repo = new Command('repo')
22
21
  .description('Manage tracked repositories')
23
22
  .addCommand(createLsCommand())
24
- .addCommand(createShowCommand())
25
- .addCommand(createSyncCommand());
23
+ .addCommand(createShowCommand());
26
24
  return repo;
27
25
  }