@sudocode-ai/local-server 0.1.7 → 0.1.9

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 (282) hide show
  1. package/README.md +6 -0
  2. package/dist/errors/agent-errors.d.ts +43 -0
  3. package/dist/errors/agent-errors.d.ts.map +1 -0
  4. package/dist/errors/agent-errors.js +69 -0
  5. package/dist/errors/agent-errors.js.map +1 -0
  6. package/dist/execution/adapters/claude-adapter.d.ts +63 -0
  7. package/dist/execution/adapters/claude-adapter.d.ts.map +1 -0
  8. package/dist/execution/adapters/claude-adapter.js +82 -0
  9. package/dist/execution/adapters/claude-adapter.js.map +1 -0
  10. package/dist/execution/adapters/codex-adapter.d.ts +67 -0
  11. package/dist/execution/adapters/codex-adapter.d.ts.map +1 -0
  12. package/dist/execution/adapters/codex-adapter.js +183 -0
  13. package/dist/execution/adapters/codex-adapter.js.map +1 -0
  14. package/dist/execution/adapters/codex-config-builder.d.ts +30 -0
  15. package/dist/execution/adapters/codex-config-builder.d.ts.map +1 -0
  16. package/dist/execution/adapters/codex-config-builder.js +110 -0
  17. package/dist/execution/adapters/codex-config-builder.js.map +1 -0
  18. package/dist/execution/adapters/copilot-adapter.d.ts +94 -0
  19. package/dist/execution/adapters/copilot-adapter.d.ts.map +1 -0
  20. package/dist/execution/adapters/copilot-adapter.js +163 -0
  21. package/dist/execution/adapters/copilot-adapter.js.map +1 -0
  22. package/dist/execution/adapters/copilot-config-builder.d.ts +48 -0
  23. package/dist/execution/adapters/copilot-config-builder.d.ts.map +1 -0
  24. package/dist/execution/adapters/copilot-config-builder.js +125 -0
  25. package/dist/execution/adapters/copilot-config-builder.js.map +1 -0
  26. package/dist/execution/adapters/cursor-adapter.d.ts +66 -0
  27. package/dist/execution/adapters/cursor-adapter.d.ts.map +1 -0
  28. package/dist/execution/adapters/cursor-adapter.js +121 -0
  29. package/dist/execution/adapters/cursor-adapter.js.map +1 -0
  30. package/dist/execution/adapters/cursor-config-builder.d.ts +29 -0
  31. package/dist/execution/adapters/cursor-config-builder.d.ts.map +1 -0
  32. package/dist/execution/adapters/cursor-config-builder.js +49 -0
  33. package/dist/execution/adapters/cursor-config-builder.js.map +1 -0
  34. package/dist/execution/adapters/shared/config-presets.d.ts +102 -0
  35. package/dist/execution/adapters/shared/config-presets.d.ts.map +1 -0
  36. package/dist/execution/adapters/shared/config-presets.js +205 -0
  37. package/dist/execution/adapters/shared/config-presets.js.map +1 -0
  38. package/dist/execution/adapters/shared/config-utils.d.ts +95 -0
  39. package/dist/execution/adapters/shared/config-utils.d.ts.map +1 -0
  40. package/dist/execution/adapters/shared/config-utils.js +163 -0
  41. package/dist/execution/adapters/shared/config-utils.js.map +1 -0
  42. package/dist/execution/adapters/shared/index.d.ts +8 -0
  43. package/dist/execution/adapters/shared/index.d.ts.map +1 -0
  44. package/dist/execution/adapters/shared/index.js +8 -0
  45. package/dist/execution/adapters/shared/index.js.map +1 -0
  46. package/dist/execution/executors/agent-executor-wrapper.d.ts +153 -0
  47. package/dist/execution/executors/agent-executor-wrapper.d.ts.map +1 -0
  48. package/dist/execution/executors/agent-executor-wrapper.js +652 -0
  49. package/dist/execution/executors/agent-executor-wrapper.js.map +1 -0
  50. package/dist/execution/executors/executor-factory.d.ts +95 -0
  51. package/dist/execution/executors/executor-factory.d.ts.map +1 -0
  52. package/dist/execution/executors/executor-factory.js +120 -0
  53. package/dist/execution/executors/executor-factory.js.map +1 -0
  54. package/dist/execution/output/ag-ui-adapter.d.ts +0 -2
  55. package/dist/execution/output/ag-ui-adapter.d.ts.map +1 -1
  56. package/dist/execution/output/ag-ui-adapter.js +0 -2
  57. package/dist/execution/output/ag-ui-adapter.js.map +1 -1
  58. package/dist/execution/output/index.d.ts +0 -3
  59. package/dist/execution/output/index.d.ts.map +1 -1
  60. package/dist/execution/output/index.js +0 -2
  61. package/dist/execution/output/index.js.map +1 -1
  62. package/dist/execution/output/normalized-to-ag-ui-adapter.d.ts +108 -0
  63. package/dist/execution/output/normalized-to-ag-ui-adapter.d.ts.map +1 -0
  64. package/dist/execution/output/normalized-to-ag-ui-adapter.js +321 -0
  65. package/dist/execution/output/normalized-to-ag-ui-adapter.js.map +1 -0
  66. package/dist/execution/process/builders/claude.d.ts +24 -57
  67. package/dist/execution/process/builders/claude.d.ts.map +1 -1
  68. package/dist/execution/process/builders/claude.js +153 -19
  69. package/dist/execution/process/builders/claude.js.map +1 -1
  70. package/dist/execution/transport/ipc-transport-manager.d.ts +74 -0
  71. package/dist/execution/transport/ipc-transport-manager.d.ts.map +1 -0
  72. package/dist/execution/transport/ipc-transport-manager.js +104 -0
  73. package/dist/execution/transport/ipc-transport-manager.js.map +1 -0
  74. package/dist/execution/transport/transport-manager.d.ts.map +1 -1
  75. package/dist/execution/transport/transport-manager.js +3 -0
  76. package/dist/execution/transport/transport-manager.js.map +1 -1
  77. package/dist/execution/worktree/conflict-detector.d.ts +85 -0
  78. package/dist/execution/worktree/conflict-detector.d.ts.map +1 -0
  79. package/dist/execution/worktree/conflict-detector.js +129 -0
  80. package/dist/execution/worktree/conflict-detector.js.map +1 -0
  81. package/dist/execution/worktree/git-cli.d.ts +9 -0
  82. package/dist/execution/worktree/git-cli.d.ts.map +1 -1
  83. package/dist/execution/worktree/git-cli.js +10 -0
  84. package/dist/execution/worktree/git-cli.js.map +1 -1
  85. package/dist/execution/worktree/git-sync-cli.d.ts +198 -0
  86. package/dist/execution/worktree/git-sync-cli.d.ts.map +1 -0
  87. package/dist/execution/worktree/git-sync-cli.js +401 -0
  88. package/dist/execution/worktree/git-sync-cli.js.map +1 -0
  89. package/dist/execution/worktree/manager.d.ts +18 -0
  90. package/dist/execution/worktree/manager.d.ts.map +1 -1
  91. package/dist/execution/worktree/manager.js +9 -3
  92. package/dist/execution/worktree/manager.js.map +1 -1
  93. package/dist/index.d.ts +1 -3
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/index.js +124 -229
  96. package/dist/index.js.map +1 -1
  97. package/dist/middleware/project-context.d.ts +37 -0
  98. package/dist/middleware/project-context.d.ts.map +1 -0
  99. package/dist/middleware/project-context.js +91 -0
  100. package/dist/middleware/project-context.js.map +1 -0
  101. package/dist/public/assets/index-DV9Tbujb.css +1 -0
  102. package/dist/public/assets/index-DcDX9-Ad.js +740 -0
  103. package/dist/public/assets/index-DcDX9-Ad.js.map +1 -0
  104. package/dist/public/assets/{react-vendor-ByUx1V_q.js → react-vendor-DiL5hC7l.js} +2 -2
  105. package/dist/public/assets/{react-vendor-ByUx1V_q.js.map → react-vendor-DiL5hC7l.js.map} +1 -1
  106. package/dist/public/assets/ui-vendor-B4WMPEfa.js +54 -0
  107. package/dist/public/assets/ui-vendor-B4WMPEfa.js.map +1 -0
  108. package/dist/public/index.html +4 -4
  109. package/dist/routes/agents.d.ts +3 -0
  110. package/dist/routes/agents.d.ts.map +1 -0
  111. package/dist/routes/agents.js +62 -0
  112. package/dist/routes/agents.js.map +1 -0
  113. package/dist/routes/config.d.ts +3 -0
  114. package/dist/routes/config.d.ts.map +1 -0
  115. package/dist/routes/config.js +25 -0
  116. package/dist/routes/config.js.map +1 -0
  117. package/dist/routes/editors.d.ts +15 -0
  118. package/dist/routes/editors.d.ts.map +1 -0
  119. package/dist/routes/editors.js +98 -0
  120. package/dist/routes/editors.js.map +1 -0
  121. package/dist/routes/executions-stream.d.ts +8 -5
  122. package/dist/routes/executions-stream.d.ts.map +1 -1
  123. package/dist/routes/executions-stream.js +10 -6
  124. package/dist/routes/executions-stream.js.map +1 -1
  125. package/dist/routes/executions.d.ts +6 -10
  126. package/dist/routes/executions.d.ts.map +1 -1
  127. package/dist/routes/executions.js +792 -37
  128. package/dist/routes/executions.js.map +1 -1
  129. package/dist/routes/feedback.d.ts +3 -2
  130. package/dist/routes/feedback.d.ts.map +1 -1
  131. package/dist/routes/feedback.js +12 -10
  132. package/dist/routes/feedback.js.map +1 -1
  133. package/dist/routes/files.d.ts +18 -0
  134. package/dist/routes/files.d.ts.map +1 -0
  135. package/dist/routes/files.js +89 -0
  136. package/dist/routes/files.js.map +1 -0
  137. package/dist/routes/issues.d.ts +3 -2
  138. package/dist/routes/issues.d.ts.map +1 -1
  139. package/dist/routes/issues.js +19 -18
  140. package/dist/routes/issues.js.map +1 -1
  141. package/dist/routes/projects.d.ts +11 -0
  142. package/dist/routes/projects.d.ts.map +1 -0
  143. package/dist/routes/projects.js +447 -0
  144. package/dist/routes/projects.js.map +1 -0
  145. package/dist/routes/relationships.d.ts +3 -2
  146. package/dist/routes/relationships.d.ts.map +1 -1
  147. package/dist/routes/relationships.js +12 -10
  148. package/dist/routes/relationships.js.map +1 -1
  149. package/dist/routes/repo-info.d.ts +3 -0
  150. package/dist/routes/repo-info.d.ts.map +1 -0
  151. package/dist/routes/repo-info.js +203 -0
  152. package/dist/routes/repo-info.js.map +1 -0
  153. package/dist/routes/specs.d.ts +3 -2
  154. package/dist/routes/specs.d.ts.map +1 -1
  155. package/dist/routes/specs.js +19 -18
  156. package/dist/routes/specs.js.map +1 -1
  157. package/dist/routes/version.d.ts +3 -0
  158. package/dist/routes/version.d.ts.map +1 -0
  159. package/dist/routes/version.js +25 -0
  160. package/dist/routes/version.js.map +1 -0
  161. package/dist/services/agent-registry.d.ts +140 -0
  162. package/dist/services/agent-registry.d.ts.map +1 -0
  163. package/dist/services/agent-registry.js +272 -0
  164. package/dist/services/agent-registry.js.map +1 -0
  165. package/dist/services/editor-service.d.ts +57 -0
  166. package/dist/services/editor-service.d.ts.map +1 -0
  167. package/dist/services/editor-service.js +204 -0
  168. package/dist/services/editor-service.js.map +1 -0
  169. package/dist/services/execution-changes-service.d.ts +110 -0
  170. package/dist/services/execution-changes-service.d.ts.map +1 -0
  171. package/dist/services/execution-changes-service.js +700 -0
  172. package/dist/services/execution-changes-service.js.map +1 -0
  173. package/dist/services/execution-lifecycle.d.ts +1 -0
  174. package/dist/services/execution-lifecycle.d.ts.map +1 -1
  175. package/dist/services/execution-lifecycle.js +37 -7
  176. package/dist/services/execution-lifecycle.js.map +1 -1
  177. package/dist/services/execution-logs-store.d.ts +75 -0
  178. package/dist/services/execution-logs-store.d.ts.map +1 -1
  179. package/dist/services/execution-logs-store.js +142 -2
  180. package/dist/services/execution-logs-store.js.map +1 -1
  181. package/dist/services/execution-service.d.ts +82 -59
  182. package/dist/services/execution-service.d.ts.map +1 -1
  183. package/dist/services/execution-service.js +514 -469
  184. package/dist/services/execution-service.js.map +1 -1
  185. package/dist/services/execution-worker-pool.d.ts +116 -0
  186. package/dist/services/execution-worker-pool.d.ts.map +1 -0
  187. package/dist/services/execution-worker-pool.js +326 -0
  188. package/dist/services/execution-worker-pool.js.map +1 -0
  189. package/dist/services/executions.d.ts +3 -0
  190. package/dist/services/executions.d.ts.map +1 -1
  191. package/dist/services/executions.js +11 -17
  192. package/dist/services/executions.js.map +1 -1
  193. package/dist/services/export.d.ts +8 -2
  194. package/dist/services/export.d.ts.map +1 -1
  195. package/dist/services/export.js +29 -23
  196. package/dist/services/export.js.map +1 -1
  197. package/dist/services/file-search/git-ls-files-strategy.d.ts +72 -0
  198. package/dist/services/file-search/git-ls-files-strategy.d.ts.map +1 -0
  199. package/dist/services/file-search/git-ls-files-strategy.js +176 -0
  200. package/dist/services/file-search/git-ls-files-strategy.js.map +1 -0
  201. package/dist/services/file-search/index.d.ts +9 -0
  202. package/dist/services/file-search/index.d.ts.map +1 -0
  203. package/dist/services/file-search/index.js +10 -0
  204. package/dist/services/file-search/index.js.map +1 -0
  205. package/dist/services/file-search/registry.d.ts +97 -0
  206. package/dist/services/file-search/registry.d.ts.map +1 -0
  207. package/dist/services/file-search/registry.js +140 -0
  208. package/dist/services/file-search/registry.js.map +1 -0
  209. package/dist/services/file-search/strategy.d.ts +58 -0
  210. package/dist/services/file-search/strategy.d.ts.map +1 -0
  211. package/dist/services/file-search/strategy.js +8 -0
  212. package/dist/services/file-search/strategy.js.map +1 -0
  213. package/dist/services/project-context.d.ts +69 -0
  214. package/dist/services/project-context.d.ts.map +1 -0
  215. package/dist/services/project-context.js +113 -0
  216. package/dist/services/project-context.js.map +1 -0
  217. package/dist/services/project-manager.d.ts +95 -0
  218. package/dist/services/project-manager.d.ts.map +1 -0
  219. package/dist/services/project-manager.js +388 -0
  220. package/dist/services/project-manager.js.map +1 -0
  221. package/dist/services/project-registry.d.ts +98 -0
  222. package/dist/services/project-registry.d.ts.map +1 -0
  223. package/dist/services/project-registry.js +289 -0
  224. package/dist/services/project-registry.js.map +1 -0
  225. package/dist/services/prompt-resolver.d.ts +97 -0
  226. package/dist/services/prompt-resolver.d.ts.map +1 -0
  227. package/dist/services/prompt-resolver.js +377 -0
  228. package/dist/services/prompt-resolver.js.map +1 -0
  229. package/dist/services/repo-info.d.ts +12 -0
  230. package/dist/services/repo-info.d.ts.map +1 -1
  231. package/dist/services/repo-info.js +46 -0
  232. package/dist/services/repo-info.js.map +1 -1
  233. package/dist/services/version-service.d.ts +14 -0
  234. package/dist/services/version-service.d.ts.map +1 -0
  235. package/dist/services/version-service.js +57 -0
  236. package/dist/services/version-service.js.map +1 -0
  237. package/dist/services/watcher.d.ts +3 -4
  238. package/dist/services/watcher.d.ts.map +1 -1
  239. package/dist/services/watcher.js +18 -35
  240. package/dist/services/watcher.js.map +1 -1
  241. package/dist/services/websocket.d.ts +30 -16
  242. package/dist/services/websocket.d.ts.map +1 -1
  243. package/dist/services/websocket.js +102 -37
  244. package/dist/services/websocket.js.map +1 -1
  245. package/dist/services/worktree-sync-service.d.ts +326 -0
  246. package/dist/services/worktree-sync-service.d.ts.map +1 -0
  247. package/dist/services/worktree-sync-service.js +1091 -0
  248. package/dist/services/worktree-sync-service.js.map +1 -0
  249. package/dist/types/editor.d.ts +49 -0
  250. package/dist/types/editor.d.ts.map +1 -0
  251. package/dist/types/editor.js +50 -0
  252. package/dist/types/editor.js.map +1 -0
  253. package/dist/types/project.d.ts +58 -0
  254. package/dist/types/project.d.ts.map +1 -0
  255. package/dist/types/project.js +10 -0
  256. package/dist/types/project.js.map +1 -0
  257. package/dist/utils/executable-check.d.ts +36 -0
  258. package/dist/utils/executable-check.d.ts.map +1 -0
  259. package/dist/utils/executable-check.js +79 -0
  260. package/dist/utils/executable-check.js.map +1 -0
  261. package/dist/workers/execution-worker.d.ts +18 -0
  262. package/dist/workers/execution-worker.d.ts.map +1 -0
  263. package/dist/workers/execution-worker.js +340 -0
  264. package/dist/workers/execution-worker.js.map +1 -0
  265. package/dist/workers/worker-ipc.d.ts +84 -0
  266. package/dist/workers/worker-ipc.d.ts.map +1 -0
  267. package/dist/workers/worker-ipc.js +29 -0
  268. package/dist/workers/worker-ipc.js.map +1 -0
  269. package/package.json +6 -5
  270. package/dist/execution/output/ag-ui-integration.d.ts +0 -96
  271. package/dist/execution/output/ag-ui-integration.d.ts.map +0 -1
  272. package/dist/execution/output/ag-ui-integration.js +0 -96
  273. package/dist/execution/output/ag-ui-integration.js.map +0 -1
  274. package/dist/execution/output/claude-code-output-processor.d.ts +0 -321
  275. package/dist/execution/output/claude-code-output-processor.d.ts.map +0 -1
  276. package/dist/execution/output/claude-code-output-processor.js +0 -769
  277. package/dist/execution/output/claude-code-output-processor.js.map +0 -1
  278. package/dist/public/assets/index-B3SEMufD.js +0 -580
  279. package/dist/public/assets/index-B3SEMufD.js.map +0 -1
  280. package/dist/public/assets/index-D2YGL3gX.css +0 -1
  281. package/dist/public/assets/ui-vendor-CotR6bx9.js +0 -54
  282. package/dist/public/assets/ui-vendor-CotR6bx9.js.map +0 -1
@@ -0,0 +1,326 @@
1
+ /**
2
+ * Worktree Sync Service
3
+ *
4
+ * Orchestrates worktree sync operations including conflict detection,
5
+ * JSONL resolution, git operations, and database updates.
6
+ *
7
+ * @module services/worktree-sync-service
8
+ */
9
+ import type Database from "better-sqlite3";
10
+ import type { Execution, ExecutionStatus } from "@sudocode-ai/types";
11
+ import { type DiffResult, type Commit } from "../execution/worktree/git-sync-cli.js";
12
+ import { type ConflictReport, type JSONLConflict } from "../execution/worktree/conflict-detector.js";
13
+ /**
14
+ * Worktree sync error codes
15
+ */
16
+ export declare enum WorktreeSyncErrorCode {
17
+ NO_WORKTREE = "NO_WORKTREE",
18
+ WORKTREE_MISSING = "WORKTREE_MISSING",
19
+ BRANCH_MISSING = "BRANCH_MISSING",
20
+ DIRTY_WORKING_TREE = "DIRTY_WORKING_TREE",
21
+ TARGET_BRANCH_MISSING = "TARGET_BRANCH_MISSING",
22
+ NO_COMMON_BASE = "NO_COMMON_BASE",
23
+ CODE_CONFLICTS = "CODE_CONFLICTS",
24
+ MERGE_FAILED = "MERGE_FAILED",
25
+ JSONL_RESOLUTION_FAILED = "JSONL_RESOLUTION_FAILED",
26
+ DATABASE_SYNC_FAILED = "DATABASE_SYNC_FAILED",
27
+ EXECUTION_NOT_FOUND = "EXECUTION_NOT_FOUND"
28
+ }
29
+ /**
30
+ * Worktree sync error class
31
+ */
32
+ export declare class WorktreeSyncError extends Error {
33
+ code: WorktreeSyncErrorCode;
34
+ cause?: Error | undefined;
35
+ constructor(message: string, code: WorktreeSyncErrorCode, cause?: Error | undefined);
36
+ }
37
+ /**
38
+ * Uncommitted file stats for preview
39
+ */
40
+ export interface UncommittedFileStats {
41
+ files: string[];
42
+ additions: number;
43
+ deletions: number;
44
+ }
45
+ /**
46
+ * Sync preview result
47
+ */
48
+ export interface SyncPreviewResult {
49
+ canSync: boolean;
50
+ conflicts: ConflictReport;
51
+ diff: DiffResult;
52
+ commits: Commit[];
53
+ mergeBase: string;
54
+ /** @deprecated Use uncommittedChanges instead */
55
+ uncommittedJSONLChanges: string[];
56
+ /** Stats about uncommitted changes in worktree (not included in sync by default) */
57
+ uncommittedChanges?: UncommittedFileStats;
58
+ executionStatus: ExecutionStatus;
59
+ warnings: string[];
60
+ }
61
+ /**
62
+ * Squash sync result
63
+ */
64
+ export interface SyncResult {
65
+ success: boolean;
66
+ finalCommit?: string;
67
+ filesChanged: number;
68
+ /** Whether there are unresolved merge conflicts (user must resolve manually) */
69
+ hasConflicts?: boolean;
70
+ /** Number of uncommitted files copied from worktree (stage sync only) */
71
+ uncommittedFilesIncluded?: number;
72
+ error?: string;
73
+ cleanupOffered?: boolean;
74
+ }
75
+ /**
76
+ * WorktreeSyncService
77
+ *
78
+ * Main service class for orchestrating worktree sync operations
79
+ */
80
+ export declare class WorktreeSyncService {
81
+ private db;
82
+ private repoPath;
83
+ private gitSync;
84
+ constructor(db: Database.Database, repoPath: string);
85
+ /**
86
+ * Preview sync without making changes
87
+ *
88
+ * @param executionId - Execution ID to preview sync for
89
+ * @returns Preview result with conflicts, diff, and warnings
90
+ */
91
+ previewSync(executionId: string): Promise<SyncPreviewResult>;
92
+ /**
93
+ * Validate critical preconditions that prevent us from getting any sync info
94
+ *
95
+ * These are "hard" failures - if these fail, we can't get diff/commits info.
96
+ * Returns an error message if validation fails, null if validation passes.
97
+ *
98
+ * @param execution - Execution to validate
99
+ * @returns Error message if validation fails, null if validation passes
100
+ */
101
+ private _validateCriticalPreconditions;
102
+ /**
103
+ * Load execution from database and validate it exists
104
+ *
105
+ * Used by previewSync() and will be used in i-9gz4 (squash sync)
106
+ *
107
+ * @param executionId - Execution ID to load
108
+ * @returns Execution record
109
+ * @throws WorktreeSyncError if execution not found
110
+ */
111
+ private _loadAndValidateExecution;
112
+ /**
113
+ * Validate preconditions for sync
114
+ *
115
+ * Used by previewSync() and will be used in i-9gz4 (squash sync)
116
+ *
117
+ * Checks:
118
+ * - Worktree exists
119
+ * - Worktree branch exists
120
+ * - Local working tree is clean
121
+ * - Target branch exists
122
+ * - Branches have common base
123
+ *
124
+ * @param execution - Execution to validate
125
+ * @throws WorktreeSyncError if any precondition fails
126
+ */
127
+ private _validateSyncPreconditions;
128
+ /**
129
+ * Create safety snapshot before sync
130
+ *
131
+ * Creates a git tag pointing to current target branch HEAD
132
+ * for rollback capability
133
+ *
134
+ * @param executionId - Execution ID
135
+ * @param targetBranch - Target branch name
136
+ * @returns Tag name created
137
+ */
138
+ private _createSafetySnapshot;
139
+ /**
140
+ * Get all uncommitted files from worktree
141
+ *
142
+ * @param worktreePath - Path to worktree
143
+ * @returns Array of all uncommitted file paths
144
+ */
145
+ private _getUncommittedFiles;
146
+ /**
147
+ * Get uncommitted file stats from worktree
148
+ *
149
+ * Returns list of files and aggregate additions/deletions stats
150
+ * for uncommitted changes in the worktree.
151
+ *
152
+ * @param worktreePath - Path to worktree
153
+ * @returns Uncommitted file stats
154
+ */
155
+ private _getUncommittedFileStats;
156
+ /**
157
+ * Check if local working tree is clean
158
+ *
159
+ * TODO: Will be used in i-7ya6 (sync preview)
160
+ *
161
+ * @returns true if clean, false if dirty
162
+ */
163
+ private _isLocalTreeClean;
164
+ /**
165
+ * Get list of branches in repository
166
+ *
167
+ * @returns Array of branch names
168
+ */
169
+ private _getBranches;
170
+ /**
171
+ * Get current commit SHA for a branch
172
+ *
173
+ * @param branchName - Branch name
174
+ * @returns Commit SHA
175
+ */
176
+ private _getCurrentCommit;
177
+ /**
178
+ * Escape shell argument for safe command execution
179
+ *
180
+ * @param arg - Argument to escape
181
+ * @returns Escaped argument
182
+ */
183
+ private _escapeShellArg;
184
+ /**
185
+ * Resolve JSONL conflicts using three-way merge
186
+ *
187
+ * Used in squash sync to auto-resolve JSONL conflicts
188
+ *
189
+ * @param execution - Execution record
190
+ * @param jsonlConflicts - List of JSONL conflicts to resolve
191
+ * @throws WorktreeSyncError if resolution fails
192
+ */
193
+ resolveJSONLConflicts(execution: Execution, jsonlConflicts: JSONLConflict[]): Promise<void>;
194
+ /**
195
+ * Read JSONL file at a specific git revision
196
+ *
197
+ * @param filePath - Relative path to JSONL file
198
+ * @param revision - Git revision (commit SHA or branch name)
199
+ * @returns Array of JSONL entities
200
+ */
201
+ private _readJSONLVersion;
202
+ /**
203
+ * Commit uncommitted JSONL files in worktree
204
+ *
205
+ * Used during sync to include uncommitted JSONL changes
206
+ *
207
+ * @param worktreePath - Path to worktree
208
+ * @param uncommittedFiles - List of uncommitted JSONL file paths
209
+ * @throws WorktreeSyncError if commit fails
210
+ */
211
+ commitUncommittedJSONL(worktreePath: string, uncommittedFiles: string[]): Promise<void>;
212
+ /**
213
+ * Perform git merge --squash operation, allowing conflicts
214
+ *
215
+ * This method doesn't throw on conflicts.
216
+ * Instead, it returns information about whether conflicts occurred.
217
+ *
218
+ * @param sourceBranch - Branch to merge from (worktree branch)
219
+ * @param targetBranch - Branch to merge into
220
+ * @returns Object with filesChanged count and hasConflicts flag
221
+ */
222
+ private _performSquashMergeAllowConflicts;
223
+ /**
224
+ * Copy uncommitted files from worktree to local repo
225
+ *
226
+ * Copies files that are modified or untracked in the worktree
227
+ * to the local repository working directory.
228
+ *
229
+ * @param worktreePath - Path to the worktree
230
+ * @returns Number of files copied
231
+ */
232
+ private _copyUncommittedFiles;
233
+ /**
234
+ * Resolve JSONL merge conflicts in the local repository
235
+ *
236
+ * Checks for git conflict markers in issues.jsonl and specs.jsonl,
237
+ * and resolves them using the merge-resolver logic.
238
+ *
239
+ * @returns Number of files resolved
240
+ */
241
+ private _resolveJSONLConflicts;
242
+ /**
243
+ * Resolve conflicts in a single JSONL file
244
+ *
245
+ * @param filePath - Path to the JSONL file with conflicts
246
+ */
247
+ private _resolveJSONLFile;
248
+ /**
249
+ * Generate commit message for squash sync
250
+ *
251
+ * @param execution - Execution record
252
+ * @param commitCount - Number of commits being squashed
253
+ * @returns Generated commit message
254
+ */
255
+ private _generateCommitMessage;
256
+ /**
257
+ * Create commit with staged changes
258
+ *
259
+ * @param message - Commit message
260
+ * @returns Commit SHA
261
+ * @throws WorktreeSyncError if commit fails
262
+ */
263
+ private _createCommit;
264
+ /**
265
+ * Rollback to safety snapshot
266
+ *
267
+ * @param targetBranch - Target branch to reset
268
+ * @param tagName - Safety tag to rollback to
269
+ * @throws WorktreeSyncError if rollback fails
270
+ */
271
+ private _rollbackToSnapshot;
272
+ /**
273
+ * Perform squash sync operation
274
+ *
275
+ * Squashes all committed worktree changes into a single commit on the target branch.
276
+ * Only includes committed changes - uncommitted changes are excluded.
277
+ * If merge conflicts occur, they are left for the user to resolve manually.
278
+ *
279
+ * @param executionId - Execution ID to sync
280
+ * @param customCommitMessage - Optional custom commit message
281
+ * @returns Sync result with details
282
+ * @throws WorktreeSyncError if sync fails
283
+ */
284
+ squashSync(executionId: string, customCommitMessage?: string): Promise<SyncResult>;
285
+ /**
286
+ * Perform stage sync operation
287
+ *
288
+ * Applies committed worktree changes to the working directory without committing.
289
+ * Changes are left staged, ready for the user to commit manually.
290
+ * Only includes committed changes by default - uncommitted changes are excluded
291
+ * unless includeUncommitted is true.
292
+ *
293
+ * @param executionId - Execution ID to sync
294
+ * @param options - Optional settings
295
+ * @param options.includeUncommitted - If true, also copy uncommitted files from worktree
296
+ * @returns Sync result with details
297
+ * @throws WorktreeSyncError if sync fails
298
+ */
299
+ stageSync(executionId: string, options?: {
300
+ includeUncommitted?: boolean;
301
+ }): Promise<SyncResult>;
302
+ /**
303
+ * Check if worktree branch is an ancestor of target branch
304
+ *
305
+ * If the worktree branch is an ancestor, it means target already has all
306
+ * the commits from the worktree (e.g., via a previous sync).
307
+ *
308
+ * @param worktreeBranch - Worktree branch name
309
+ * @param targetBranch - Target branch name
310
+ * @returns true if worktree branch is an ancestor of target branch
311
+ */
312
+ private _isAncestor;
313
+ /**
314
+ * Perform preserve sync operation
315
+ *
316
+ * Merges all commits from worktree branch to target branch, preserving commit history.
317
+ * Only includes committed changes - uncommitted changes are excluded.
318
+ * If merge conflicts occur, they are left for the user to resolve manually.
319
+ *
320
+ * @param executionId - Execution ID to sync
321
+ * @returns Sync result with details
322
+ * @throws WorktreeSyncError if sync fails
323
+ */
324
+ preserveSync(executionId: string): Promise<SyncResult>;
325
+ }
326
+ //# sourceMappingURL=worktree-sync-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worktree-sync-service.d.ts","sourceRoot":"","sources":["../../src/services/worktree-sync-service.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBA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