@lumenflow/core 1.0.0

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 (263) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +119 -0
  3. package/dist/active-wu-detector.d.ts +33 -0
  4. package/dist/active-wu-detector.js +106 -0
  5. package/dist/adapters/filesystem-metrics.adapter.d.ts +108 -0
  6. package/dist/adapters/filesystem-metrics.adapter.js +519 -0
  7. package/dist/adapters/terminal-renderer.adapter.d.ts +106 -0
  8. package/dist/adapters/terminal-renderer.adapter.js +337 -0
  9. package/dist/arg-parser.d.ts +63 -0
  10. package/dist/arg-parser.js +560 -0
  11. package/dist/backlog-editor.d.ts +98 -0
  12. package/dist/backlog-editor.js +179 -0
  13. package/dist/backlog-generator.d.ts +111 -0
  14. package/dist/backlog-generator.js +381 -0
  15. package/dist/backlog-parser.d.ts +45 -0
  16. package/dist/backlog-parser.js +102 -0
  17. package/dist/backlog-sync-validator.d.ts +78 -0
  18. package/dist/backlog-sync-validator.js +294 -0
  19. package/dist/branch-drift.d.ts +34 -0
  20. package/dist/branch-drift.js +51 -0
  21. package/dist/cleanup-install-config.d.ts +33 -0
  22. package/dist/cleanup-install-config.js +37 -0
  23. package/dist/cleanup-lock.d.ts +139 -0
  24. package/dist/cleanup-lock.js +313 -0
  25. package/dist/code-path-validator.d.ts +146 -0
  26. package/dist/code-path-validator.js +537 -0
  27. package/dist/code-paths-overlap.d.ts +55 -0
  28. package/dist/code-paths-overlap.js +245 -0
  29. package/dist/commands-logger.d.ts +77 -0
  30. package/dist/commands-logger.js +254 -0
  31. package/dist/commit-message-utils.d.ts +25 -0
  32. package/dist/commit-message-utils.js +41 -0
  33. package/dist/compliance-parser.d.ts +150 -0
  34. package/dist/compliance-parser.js +507 -0
  35. package/dist/constants/backlog-patterns.d.ts +20 -0
  36. package/dist/constants/backlog-patterns.js +23 -0
  37. package/dist/constants/dora-constants.d.ts +49 -0
  38. package/dist/constants/dora-constants.js +53 -0
  39. package/dist/constants/gate-constants.d.ts +15 -0
  40. package/dist/constants/gate-constants.js +15 -0
  41. package/dist/constants/linter-constants.d.ts +16 -0
  42. package/dist/constants/linter-constants.js +16 -0
  43. package/dist/constants/tokenizer-constants.d.ts +15 -0
  44. package/dist/constants/tokenizer-constants.js +15 -0
  45. package/dist/core/scope-checker.d.ts +97 -0
  46. package/dist/core/scope-checker.js +163 -0
  47. package/dist/core/tool-runner.d.ts +161 -0
  48. package/dist/core/tool-runner.js +393 -0
  49. package/dist/core/tool.constants.d.ts +105 -0
  50. package/dist/core/tool.constants.js +101 -0
  51. package/dist/core/tool.schemas.d.ts +226 -0
  52. package/dist/core/tool.schemas.js +226 -0
  53. package/dist/core/worktree-guard.d.ts +130 -0
  54. package/dist/core/worktree-guard.js +242 -0
  55. package/dist/coverage-gate.d.ts +108 -0
  56. package/dist/coverage-gate.js +196 -0
  57. package/dist/date-utils.d.ts +75 -0
  58. package/dist/date-utils.js +140 -0
  59. package/dist/dependency-graph.d.ts +142 -0
  60. package/dist/dependency-graph.js +550 -0
  61. package/dist/dependency-guard.d.ts +54 -0
  62. package/dist/dependency-guard.js +142 -0
  63. package/dist/dependency-validator.d.ts +105 -0
  64. package/dist/dependency-validator.js +154 -0
  65. package/dist/docs-path-validator.d.ts +36 -0
  66. package/dist/docs-path-validator.js +95 -0
  67. package/dist/domain/orchestration.constants.d.ts +99 -0
  68. package/dist/domain/orchestration.constants.js +97 -0
  69. package/dist/domain/orchestration.schemas.d.ts +280 -0
  70. package/dist/domain/orchestration.schemas.js +211 -0
  71. package/dist/domain/orchestration.types.d.ts +133 -0
  72. package/dist/domain/orchestration.types.js +12 -0
  73. package/dist/error-handler.d.ts +116 -0
  74. package/dist/error-handler.js +136 -0
  75. package/dist/file-classifiers.d.ts +62 -0
  76. package/dist/file-classifiers.js +108 -0
  77. package/dist/gates-agent-mode.d.ts +81 -0
  78. package/dist/gates-agent-mode.js +94 -0
  79. package/dist/generate-traceability.d.ts +107 -0
  80. package/dist/generate-traceability.js +411 -0
  81. package/dist/git-adapter.d.ts +395 -0
  82. package/dist/git-adapter.js +649 -0
  83. package/dist/git-staged-validator.d.ts +32 -0
  84. package/dist/git-staged-validator.js +48 -0
  85. package/dist/hardcoded-strings.d.ts +61 -0
  86. package/dist/hardcoded-strings.js +270 -0
  87. package/dist/incremental-lint.d.ts +78 -0
  88. package/dist/incremental-lint.js +129 -0
  89. package/dist/incremental-test.d.ts +39 -0
  90. package/dist/incremental-test.js +61 -0
  91. package/dist/index.d.ts +42 -0
  92. package/dist/index.js +61 -0
  93. package/dist/invariants/check-automated-tests.d.ts +50 -0
  94. package/dist/invariants/check-automated-tests.js +166 -0
  95. package/dist/invariants-runner.d.ts +103 -0
  96. package/dist/invariants-runner.js +527 -0
  97. package/dist/lane-checker.d.ts +50 -0
  98. package/dist/lane-checker.js +319 -0
  99. package/dist/lane-inference.d.ts +39 -0
  100. package/dist/lane-inference.js +195 -0
  101. package/dist/lane-lock.d.ts +211 -0
  102. package/dist/lane-lock.js +474 -0
  103. package/dist/lane-validator.d.ts +48 -0
  104. package/dist/lane-validator.js +114 -0
  105. package/dist/logs-lib.d.ts +104 -0
  106. package/dist/logs-lib.js +207 -0
  107. package/dist/lumenflow-config-schema.d.ts +272 -0
  108. package/dist/lumenflow-config-schema.js +207 -0
  109. package/dist/lumenflow-config.d.ts +95 -0
  110. package/dist/lumenflow-config.js +236 -0
  111. package/dist/manual-test-validator.d.ts +80 -0
  112. package/dist/manual-test-validator.js +200 -0
  113. package/dist/merge-lock.d.ts +115 -0
  114. package/dist/merge-lock.js +251 -0
  115. package/dist/micro-worktree.d.ts +159 -0
  116. package/dist/micro-worktree.js +427 -0
  117. package/dist/migration-deployer.d.ts +69 -0
  118. package/dist/migration-deployer.js +151 -0
  119. package/dist/orchestration-advisory-loader.d.ts +28 -0
  120. package/dist/orchestration-advisory-loader.js +87 -0
  121. package/dist/orchestration-advisory.d.ts +58 -0
  122. package/dist/orchestration-advisory.js +94 -0
  123. package/dist/orchestration-di.d.ts +48 -0
  124. package/dist/orchestration-di.js +57 -0
  125. package/dist/orchestration-rules.d.ts +57 -0
  126. package/dist/orchestration-rules.js +201 -0
  127. package/dist/orphan-detector.d.ts +131 -0
  128. package/dist/orphan-detector.js +226 -0
  129. package/dist/path-classifiers.d.ts +57 -0
  130. package/dist/path-classifiers.js +93 -0
  131. package/dist/piped-command-detector.d.ts +34 -0
  132. package/dist/piped-command-detector.js +64 -0
  133. package/dist/ports/dashboard-renderer.port.d.ts +112 -0
  134. package/dist/ports/dashboard-renderer.port.js +25 -0
  135. package/dist/ports/metrics-collector.port.d.ts +132 -0
  136. package/dist/ports/metrics-collector.port.js +26 -0
  137. package/dist/process-detector.d.ts +84 -0
  138. package/dist/process-detector.js +172 -0
  139. package/dist/prompt-linter.d.ts +72 -0
  140. package/dist/prompt-linter.js +312 -0
  141. package/dist/prompt-monitor.d.ts +15 -0
  142. package/dist/prompt-monitor.js +205 -0
  143. package/dist/rebase-artifact-cleanup.d.ts +145 -0
  144. package/dist/rebase-artifact-cleanup.js +433 -0
  145. package/dist/retry-strategy.d.ts +189 -0
  146. package/dist/retry-strategy.js +283 -0
  147. package/dist/risk-detector.d.ts +108 -0
  148. package/dist/risk-detector.js +252 -0
  149. package/dist/rollback-utils.d.ts +76 -0
  150. package/dist/rollback-utils.js +104 -0
  151. package/dist/section-headings.d.ts +43 -0
  152. package/dist/section-headings.js +49 -0
  153. package/dist/spawn-escalation.d.ts +90 -0
  154. package/dist/spawn-escalation.js +253 -0
  155. package/dist/spawn-monitor.d.ts +229 -0
  156. package/dist/spawn-monitor.js +672 -0
  157. package/dist/spawn-recovery.d.ts +82 -0
  158. package/dist/spawn-recovery.js +298 -0
  159. package/dist/spawn-registry-schema.d.ts +98 -0
  160. package/dist/spawn-registry-schema.js +108 -0
  161. package/dist/spawn-registry-store.d.ts +146 -0
  162. package/dist/spawn-registry-store.js +273 -0
  163. package/dist/spawn-tree.d.ts +121 -0
  164. package/dist/spawn-tree.js +285 -0
  165. package/dist/stamp-status-validator.d.ts +84 -0
  166. package/dist/stamp-status-validator.js +134 -0
  167. package/dist/stamp-utils.d.ts +100 -0
  168. package/dist/stamp-utils.js +229 -0
  169. package/dist/state-machine.d.ts +26 -0
  170. package/dist/state-machine.js +83 -0
  171. package/dist/system-map-validator.d.ts +80 -0
  172. package/dist/system-map-validator.js +272 -0
  173. package/dist/telemetry.d.ts +80 -0
  174. package/dist/telemetry.js +213 -0
  175. package/dist/token-counter.d.ts +51 -0
  176. package/dist/token-counter.js +145 -0
  177. package/dist/usecases/get-dashboard-data.usecase.d.ts +52 -0
  178. package/dist/usecases/get-dashboard-data.usecase.js +61 -0
  179. package/dist/usecases/get-suggestions.usecase.d.ts +100 -0
  180. package/dist/usecases/get-suggestions.usecase.js +153 -0
  181. package/dist/user-normalizer.d.ts +41 -0
  182. package/dist/user-normalizer.js +141 -0
  183. package/dist/validators/phi-constants.d.ts +97 -0
  184. package/dist/validators/phi-constants.js +152 -0
  185. package/dist/validators/phi-scanner.d.ts +58 -0
  186. package/dist/validators/phi-scanner.js +215 -0
  187. package/dist/worktree-ownership.d.ts +50 -0
  188. package/dist/worktree-ownership.js +74 -0
  189. package/dist/worktree-scanner.d.ts +103 -0
  190. package/dist/worktree-scanner.js +168 -0
  191. package/dist/worktree-symlink.d.ts +99 -0
  192. package/dist/worktree-symlink.js +359 -0
  193. package/dist/wu-backlog-updater.d.ts +17 -0
  194. package/dist/wu-backlog-updater.js +37 -0
  195. package/dist/wu-checkpoint.d.ts +124 -0
  196. package/dist/wu-checkpoint.js +233 -0
  197. package/dist/wu-claim-helpers.d.ts +26 -0
  198. package/dist/wu-claim-helpers.js +63 -0
  199. package/dist/wu-claim-resume.d.ts +106 -0
  200. package/dist/wu-claim-resume.js +276 -0
  201. package/dist/wu-consistency-checker.d.ts +95 -0
  202. package/dist/wu-consistency-checker.js +567 -0
  203. package/dist/wu-constants.d.ts +1275 -0
  204. package/dist/wu-constants.js +1382 -0
  205. package/dist/wu-create-validators.d.ts +42 -0
  206. package/dist/wu-create-validators.js +93 -0
  207. package/dist/wu-done-branch-only.d.ts +63 -0
  208. package/dist/wu-done-branch-only.js +191 -0
  209. package/dist/wu-done-messages.d.ts +119 -0
  210. package/dist/wu-done-messages.js +185 -0
  211. package/dist/wu-done-pr.d.ts +72 -0
  212. package/dist/wu-done-pr.js +174 -0
  213. package/dist/wu-done-retry-helpers.d.ts +85 -0
  214. package/dist/wu-done-retry-helpers.js +172 -0
  215. package/dist/wu-done-ui.d.ts +37 -0
  216. package/dist/wu-done-ui.js +69 -0
  217. package/dist/wu-done-validators.d.ts +411 -0
  218. package/dist/wu-done-validators.js +1229 -0
  219. package/dist/wu-done-worktree.d.ts +182 -0
  220. package/dist/wu-done-worktree.js +1097 -0
  221. package/dist/wu-helpers.d.ts +128 -0
  222. package/dist/wu-helpers.js +248 -0
  223. package/dist/wu-lint.d.ts +70 -0
  224. package/dist/wu-lint.js +234 -0
  225. package/dist/wu-paths.d.ts +171 -0
  226. package/dist/wu-paths.js +178 -0
  227. package/dist/wu-preflight-validators.d.ts +86 -0
  228. package/dist/wu-preflight-validators.js +251 -0
  229. package/dist/wu-recovery.d.ts +138 -0
  230. package/dist/wu-recovery.js +341 -0
  231. package/dist/wu-repair-core.d.ts +131 -0
  232. package/dist/wu-repair-core.js +669 -0
  233. package/dist/wu-schema-normalization.d.ts +17 -0
  234. package/dist/wu-schema-normalization.js +82 -0
  235. package/dist/wu-schema.d.ts +793 -0
  236. package/dist/wu-schema.js +881 -0
  237. package/dist/wu-spawn-helpers.d.ts +121 -0
  238. package/dist/wu-spawn-helpers.js +271 -0
  239. package/dist/wu-spawn.d.ts +158 -0
  240. package/dist/wu-spawn.js +1306 -0
  241. package/dist/wu-state-schema.d.ts +213 -0
  242. package/dist/wu-state-schema.js +156 -0
  243. package/dist/wu-state-store.d.ts +264 -0
  244. package/dist/wu-state-store.js +691 -0
  245. package/dist/wu-status-transition.d.ts +63 -0
  246. package/dist/wu-status-transition.js +382 -0
  247. package/dist/wu-status-updater.d.ts +25 -0
  248. package/dist/wu-status-updater.js +116 -0
  249. package/dist/wu-transaction-collectors.d.ts +116 -0
  250. package/dist/wu-transaction-collectors.js +272 -0
  251. package/dist/wu-transaction.d.ts +170 -0
  252. package/dist/wu-transaction.js +273 -0
  253. package/dist/wu-validation-constants.d.ts +60 -0
  254. package/dist/wu-validation-constants.js +66 -0
  255. package/dist/wu-validation.d.ts +118 -0
  256. package/dist/wu-validation.js +243 -0
  257. package/dist/wu-validator.d.ts +62 -0
  258. package/dist/wu-validator.js +325 -0
  259. package/dist/wu-yaml-fixer.d.ts +97 -0
  260. package/dist/wu-yaml-fixer.js +264 -0
  261. package/dist/wu-yaml.d.ts +86 -0
  262. package/dist/wu-yaml.js +222 -0
  263. package/package.json +114 -0
@@ -0,0 +1,395 @@
1
+ /**
2
+ * @file git-adapter.mjs
3
+ * @description Git operations adapter using simple-git library
4
+ * WU-1082: Extract shared utilities (eliminate run() duplication)
5
+ * WU-1213: Refactor to use simple-git library (eliminate execSync)
6
+ * WU-2242: Add runtime type assertions to prevent silent API misuse
7
+ *
8
+ * Replaces run() function in:
9
+ * - tools/wu-claim.mjs
10
+ * - tools/wu-done.mjs
11
+ * - tools/wu-block.mjs
12
+ * - tools/wu-unblock.mjs
13
+ * - tools/wu-create.mjs
14
+ * - tools/wu-cleanup.mjs
15
+ * - tools/gates-pre-commit.mjs
16
+ * - tools/validate.mjs
17
+ * - tools/guard-worktree-commit.mjs
18
+ */
19
+ import { type SimpleGit } from 'simple-git';
20
+ interface GitAdapterOptions {
21
+ git?: SimpleGit;
22
+ baseDir?: string;
23
+ }
24
+ interface PushOptions {
25
+ setUpstream?: boolean;
26
+ }
27
+ interface MergeOptions {
28
+ ffOnly?: boolean;
29
+ }
30
+ interface WorktreeRemoveOptions {
31
+ force?: boolean;
32
+ }
33
+ interface DeleteBranchOptions {
34
+ force?: boolean;
35
+ }
36
+ interface ResetOptions {
37
+ hard?: boolean;
38
+ }
39
+ interface LogOptions {
40
+ maxCount?: number;
41
+ }
42
+ /**
43
+ * Git operations adapter with dependency injection support
44
+ * @class GitAdapter
45
+ */
46
+ export declare class GitAdapter {
47
+ private readonly git;
48
+ /**
49
+ * Create a GitAdapter instance
50
+ * @param {object} [options] - Configuration options
51
+ * @param {object} [options.git] - simple-git instance (for testing)
52
+ * @param {string} [options.baseDir] - Base directory for git operations
53
+ */
54
+ constructor(options?: GitAdapterOptions);
55
+ /**
56
+ * Get current branch name
57
+ * @returns {Promise<string>} Current branch name
58
+ * @example
59
+ * await git.getCurrentBranch(); // "lane/operations/wu-1213"
60
+ */
61
+ getCurrentBranch(): Promise<string>;
62
+ /**
63
+ * Get git status (porcelain format string for compatibility)
64
+ * @returns {Promise<string>} Status output in porcelain format
65
+ * @example
66
+ * await git.getStatus(); // " M file.txt\n?? untracked.txt"
67
+ */
68
+ getStatus(): Promise<string>;
69
+ /**
70
+ * Check if a branch exists
71
+ * @param {string} branch - Branch name
72
+ * @returns {Promise<boolean>} True if branch exists
73
+ * @throws {TypeError} If branch is not a string
74
+ * @throws {Error} If branch is empty
75
+ * @example
76
+ * await git.branchExists('main'); // true
77
+ * await git.branchExists('nonexistent'); // false
78
+ */
79
+ branchExists(branch: string): Promise<boolean>;
80
+ /**
81
+ * Fetch from remote
82
+ * @param {string} [remote] - Remote name (defaults to fetching all)
83
+ * @param {string} [branch] - Branch name
84
+ * @throws {TypeError} If remote or branch is not a string (when provided)
85
+ * @example
86
+ * await git.fetch('origin', 'main');
87
+ * await git.fetch(); // Fetch all remotes
88
+ */
89
+ fetch(remote?: string, branch?: string): Promise<void>;
90
+ /**
91
+ * Pull from remote branch
92
+ * @param {string} remote - Remote name
93
+ * @param {string} branch - Branch name
94
+ * @throws {TypeError} If remote or branch is not a string
95
+ * @example
96
+ * await git.pull('origin', 'main');
97
+ */
98
+ pull(remote: string, branch: string): Promise<void>;
99
+ /**
100
+ * Get git config value
101
+ * @param {string} key - Config key (e.g., 'user.email')
102
+ * @returns {Promise<string>} Config value
103
+ * @example
104
+ * await git.getConfigValue('user.email'); // "user@example.com"
105
+ */
106
+ getConfigValue(key: string): Promise<string>;
107
+ /**
108
+ * Check if working tree is clean (no uncommitted changes)
109
+ * @returns {Promise<boolean>} True if clean
110
+ * @example
111
+ * await git.isClean(); // true or false
112
+ */
113
+ isClean(): Promise<boolean>;
114
+ /**
115
+ * Add files to staging area
116
+ * @param {string|string[]} files - Files to add
117
+ * @throws {TypeError} If files is not a string or array
118
+ * @throws {Error} If files is empty string or empty array
119
+ * @example
120
+ * await git.add('file.txt');
121
+ * await git.add(['file1.txt', 'file2.txt']);
122
+ * await git.add('.'); // Add all
123
+ */
124
+ add(files: string | string[]): Promise<void>;
125
+ /**
126
+ * Add files to staging area including deletions
127
+ *
128
+ * WU-1813: Stages modifications, additions, AND deletions for specified files.
129
+ * Unlike add(), this uses `git add -A` which properly handles tracked file deletions.
130
+ *
131
+ * When files array is empty, stages all changes in the working directory (git add -A .)
132
+ * to catch any deletions that might not have been explicitly listed.
133
+ *
134
+ * @param {string[]} files - Files to add (empty array = add all)
135
+ * @example
136
+ * await git.addWithDeletions(['modified.txt', 'deleted.txt']);
137
+ * await git.addWithDeletions([]); // Add all changes including deletions
138
+ */
139
+ addWithDeletions(files: string[]): Promise<void>;
140
+ /**
141
+ * Commit changes
142
+ * @param {string} message - Commit message
143
+ * @throws {TypeError} If message is not a string
144
+ * @throws {Error} If message is empty
145
+ * @example
146
+ * await git.commit('feat: add new feature');
147
+ */
148
+ commit(message: string): Promise<void>;
149
+ /**
150
+ * Push to remote
151
+ * @param {string} [remote='origin'] - Remote name
152
+ * @param {string} [branch] - Branch name (uses current branch if not specified)
153
+ * @param {object} [options] - Push options
154
+ * @param {boolean} [options.setUpstream] - Set upstream tracking (-u flag)
155
+ * @throws {TypeError} If remote or branch is not a string (when provided)
156
+ * @example
157
+ * await git.push('origin', 'main');
158
+ * await git.push('origin', 'feature', { setUpstream: true });
159
+ */
160
+ push(remote?: string, branch?: string, options?: PushOptions): Promise<void>;
161
+ /**
162
+ * Push using refspec to push local ref to different remote ref
163
+ *
164
+ * WU-1435: Enables push-only pattern to keep local main pristine.
165
+ * Pushes directly to origin/main without updating local main.
166
+ *
167
+ * @param {string} remote - Remote name (e.g., 'origin')
168
+ * @param {string} localRef - Local ref to push (e.g., 'tmp/wu-claim/wu-123')
169
+ * @param {string} remoteRef - Remote ref to update (e.g., 'main')
170
+ * @example
171
+ * await git.pushRefspec('origin', 'tmp/wu-claim/wu-123', 'main');
172
+ * // Equivalent to: git push origin tmp/wu-claim/wu-123:main
173
+ */
174
+ pushRefspec(remote: string, localRef: string, remoteRef: string): Promise<void>;
175
+ /**
176
+ * Create and checkout a new branch
177
+ * @param {string} branch - Branch name
178
+ * @param {string} [startPoint] - Starting commit (defaults to HEAD)
179
+ * @throws {TypeError} If branch is not a string, or startPoint is not a string (when provided)
180
+ * @throws {Error} If branch is empty
181
+ * @example
182
+ * await git.createBranch('feature/new-feature');
183
+ * await git.createBranch('hotfix/bug', 'main');
184
+ */
185
+ createBranch(branch: string, startPoint?: string): Promise<void>;
186
+ /**
187
+ * Checkout a branch
188
+ * @param {string} branch - Branch name
189
+ * @throws {TypeError} If branch is not a string
190
+ * @throws {Error} If branch is empty
191
+ * @example
192
+ * await git.checkout('main');
193
+ */
194
+ checkout(branch: string): Promise<void>;
195
+ /**
196
+ * Get commit hash
197
+ * @param {string} [ref='HEAD'] - Git ref
198
+ * @returns {Promise<string>} Commit hash
199
+ * @example
200
+ * await git.getCommitHash(); // "a1b2c3d..."
201
+ * await git.getCommitHash('main'); // "e4f5g6h..."
202
+ */
203
+ getCommitHash(ref?: string): Promise<string>;
204
+ /**
205
+ * Merge a branch
206
+ *
207
+ * WU-1749: Bug 1 fix - Return success status and handle false positive failures.
208
+ * simple-git's merge() returns a MergeSummary that we now properly handle.
209
+ *
210
+ * @param {string} branch - Branch to merge
211
+ * @param {object} [options] - Merge options
212
+ * @param {boolean} [options.ffOnly] - Fast-forward only merge
213
+ * @returns {Promise<{success: boolean}>} Merge result
214
+ * @throws {TypeError} If branch is not a string
215
+ * @throws {Error} If branch is empty
216
+ * @example
217
+ * await git.merge('feature-branch');
218
+ * await git.merge('feature-branch', { ffOnly: true });
219
+ */
220
+ merge(branch: string, options?: MergeOptions): Promise<{
221
+ success: boolean;
222
+ }>;
223
+ /**
224
+ * Get commit log
225
+ *
226
+ * WU-1749: Bug 4 fix - Add log() method for counting commits.
227
+ * Used by wu-done-retry-helpers.mjs to count previous completion attempts.
228
+ *
229
+ * @param {object} [options] - Log options
230
+ * @param {number} [options.maxCount] - Maximum number of commits to return
231
+ * @returns {Promise<{all: Array<{hash: string, message: string}>, total: number}>} Log result
232
+ * @example
233
+ * await git.log({ maxCount: 50 });
234
+ */
235
+ log(options?: LogOptions): Promise<import("simple-git").LogResult<import("simple-git").DefaultLogFields>>;
236
+ /**
237
+ * Find common ancestor (merge base) of two refs
238
+ * @param {string} ref1 - First ref
239
+ * @param {string} ref2 - Second ref
240
+ * @returns {Promise<string>} Common ancestor commit hash
241
+ * @throws {TypeError} If ref1 or ref2 is not a string
242
+ * @example
243
+ * await git.mergeBase('main', 'feature'); // "abc123def456"
244
+ */
245
+ mergeBase(ref1: string, ref2: string): Promise<string>;
246
+ /**
247
+ * Simulate merge and detect conflicts without touching working tree
248
+ * @param {string} base - Base commit hash
249
+ * @param {string} ref1 - First ref to merge
250
+ * @param {string} ref2 - Second ref to merge
251
+ * @returns {Promise<string>} Merge tree output (contains conflict markers if conflicts exist)
252
+ * @example
253
+ * await git.mergeTree('base123', 'main', 'feature');
254
+ */
255
+ mergeTree(base: string, ref1: string, ref2: string): Promise<string>;
256
+ /**
257
+ * List commits with various options
258
+ * @param {string[]} args - Arguments to pass to git rev-list
259
+ * @returns {Promise<string>} Rev-list output
260
+ * @example
261
+ * await git.revList(['--count', '--left-right', 'main...feature']); // "5\t0"
262
+ */
263
+ revList(args: string[]): Promise<string>;
264
+ /**
265
+ * Add a worktree with new branch
266
+ * @param {string} path - Worktree path
267
+ * @param {string} branch - Branch name
268
+ * @param {string} [startPoint] - Starting commit (defaults to HEAD)
269
+ * @throws {TypeError} If path or branch is not a string
270
+ * @throws {Error} If path or branch is empty
271
+ * @example
272
+ * await git.worktreeAdd('worktrees/feature', 'feature-branch', 'main');
273
+ */
274
+ worktreeAdd(path: string, branch: string, startPoint?: string): Promise<void>;
275
+ /**
276
+ * Remove a worktree
277
+ *
278
+ * WU-1476: Layer 1 defense - explicit directory cleanup after git worktree remove.
279
+ * Git worktree remove can leave orphan directories when:
280
+ * - The worktree was forcefully removed
281
+ * - Git worktree metadata was corrupted
282
+ * - Previous wu:done failed mid-workflow
283
+ *
284
+ * @param {string} worktreePath - Worktree path
285
+ * @param {object} [options] - Remove options
286
+ * @param {boolean} [options.force] - Force removal
287
+ * @example
288
+ * await git.worktreeRemove('worktrees/feature');
289
+ * await git.worktreeRemove('worktrees/feature', { force: true });
290
+ */
291
+ worktreeRemove(worktreePath: string, options?: WorktreeRemoveOptions): Promise<void>;
292
+ /**
293
+ * List all worktrees
294
+ * @returns {Promise<string>} Worktree list in porcelain format
295
+ * @example
296
+ * await git.worktreeList();
297
+ */
298
+ worktreeList(): Promise<string>;
299
+ /**
300
+ * Delete a branch
301
+ * @param {string} branch - Branch name
302
+ * @param {object} [options] - Delete options
303
+ * @param {boolean} [options.force] - Force delete (use -D instead of -d)
304
+ * @throws {TypeError} If branch is not a string
305
+ * @throws {Error} If branch is empty
306
+ * @example
307
+ * await git.deleteBranch('feature');
308
+ * await git.deleteBranch('feature', { force: true });
309
+ */
310
+ deleteBranch(branch: string, options?: DeleteBranchOptions): Promise<void>;
311
+ /**
312
+ * Create a branch WITHOUT switching to it (WU-1262)
313
+ * Used for micro-worktree pattern where main checkout stays on main
314
+ * @param {string} branch - Branch name to create
315
+ * @param {string} [startPoint] - Starting commit (defaults to HEAD)
316
+ * @example
317
+ * await git.createBranchNoCheckout('tmp/wu-create/wu-123', 'main');
318
+ */
319
+ createBranchNoCheckout(branch: string, startPoint?: string): Promise<void>;
320
+ /**
321
+ * Add a worktree for an EXISTING branch (WU-1262)
322
+ * Unlike worktreeAdd, this doesn't create a new branch
323
+ * @param {string} path - Worktree path
324
+ * @param {string} branch - Existing branch name
325
+ * @example
326
+ * await git.worktreeAddExisting('/tmp/wu-create-xyz', 'tmp/wu-create/wu-123');
327
+ */
328
+ worktreeAddExisting(path: string, branch: string): Promise<void>;
329
+ /**
330
+ * Rebase current branch onto target (WU-1262)
331
+ * Used in micro-worktree to rebase temp branch when main moves
332
+ * @param {string} onto - Target ref to rebase onto
333
+ * @throws {TypeError} If onto is not a string
334
+ * @throws {Error} If onto is empty
335
+ * @example
336
+ * await git.rebase('main');
337
+ */
338
+ rebase(onto: string): Promise<void>;
339
+ /**
340
+ * Reset HEAD to specified commit
341
+ * @param {string} [ref] - Commit ref to reset to (defaults to HEAD)
342
+ * @param {object} [options] - Reset options
343
+ * @param {boolean} [options.hard] - Hard reset (--hard flag)
344
+ * @example
345
+ * await git.reset('abc123', { hard: true });
346
+ */
347
+ reset(ref?: string, options?: ResetOptions): Promise<void>;
348
+ /**
349
+ * Execute arbitrary git command via raw()
350
+ * @param {string[]} args - Git command arguments
351
+ * @returns {Promise<string>} Command output
352
+ * @throws {TypeError} If args is not an array
353
+ * @example
354
+ * await git.raw(['status', '--porcelain']);
355
+ */
356
+ raw(args: string[]): Promise<string>;
357
+ /**
358
+ * @deprecated Use async methods directly instead
359
+ * Legacy method for backward compatibility
360
+ * Execute a git command and return trimmed output
361
+ * @param {string} cmd - Command to execute
362
+ * @returns {string} Trimmed command output
363
+ */
364
+ run(cmd: string): never;
365
+ /**
366
+ * @deprecated Use worktreeAdd() instead
367
+ */
368
+ addWorktree(path: string, branch: string, startPoint?: string): Promise<void>;
369
+ /**
370
+ * @deprecated Use worktreeRemove() instead
371
+ */
372
+ removeWorktree(path: string, options?: WorktreeRemoveOptions): Promise<void>;
373
+ }
374
+ /**
375
+ * Create a GitAdapter for a specific directory
376
+ * Use this when you need git operations in an explicit path (e.g., worktree vs main)
377
+ * @param {string} baseDir - Directory for git operations
378
+ * @returns {GitAdapter} New GitAdapter instance for the specified directory
379
+ * @example
380
+ * const gitWorktree = createGitForPath('/path/to/worktree');
381
+ * const gitMain = createGitForPath('/path/to/main');
382
+ */
383
+ export declare function createGitForPath(baseDir: string): GitAdapter;
384
+ /**
385
+ * Create a GitAdapter for the current working directory
386
+ * Captures process.cwd() at call time (not import time)
387
+ * Use this after process.chdir() to get an adapter for the new directory
388
+ * @returns {GitAdapter} New GitAdapter instance for current process.cwd()
389
+ * @example
390
+ * process.chdir(worktreePath);
391
+ * const git = getGitForCwd(); // Uses new directory
392
+ */
393
+ export declare function getGitForCwd(): GitAdapter;
394
+ export declare const git: GitAdapter;
395
+ export {};