@lumenflow/core 2.18.1 → 2.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/micro-worktree-shared.d.ts +134 -0
- package/dist/micro-worktree-shared.d.ts.map +1 -0
- package/dist/micro-worktree-shared.js +350 -0
- package/dist/micro-worktree-shared.js.map +1 -0
- package/dist/micro-worktree.d.ts +4 -273
- package/dist/micro-worktree.d.ts.map +1 -1
- package/dist/micro-worktree.js +2 -540
- package/dist/micro-worktree.js.map +1 -1
- package/package.json +14 -2
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared micro-worktree helpers used by multiple workflows.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from micro-worktree.ts (WU-1626) to support atomic merge flows
|
|
5
|
+
* without importing the full withMicroWorktree orchestration module.
|
|
6
|
+
*/
|
|
7
|
+
import type { GitAdapter } from './git-adapter.js';
|
|
8
|
+
import type { PushRetryConfig } from './lumenflow-config-schema.js';
|
|
9
|
+
/**
|
|
10
|
+
* Maximum retry attempts for ff-only merge when main moves
|
|
11
|
+
*
|
|
12
|
+
* This handles race conditions when multiple agents run wu:create or wu:edit
|
|
13
|
+
* concurrently. Each retry fetches latest main and rebases.
|
|
14
|
+
*/
|
|
15
|
+
export declare const MAX_MERGE_RETRIES = 3;
|
|
16
|
+
/**
|
|
17
|
+
* Maximum retry attempts for push when origin/main advances
|
|
18
|
+
*
|
|
19
|
+
* WU-1179: When push fails due to race condition (origin advanced while we
|
|
20
|
+
* were working), rollback local main to origin/main and retry.
|
|
21
|
+
* Each retry: fetch -> rebase temp branch -> re-merge -> push.
|
|
22
|
+
*
|
|
23
|
+
* @deprecated Use DEFAULT_PUSH_RETRY_CONFIG.retries instead (WU-1332)
|
|
24
|
+
*/
|
|
25
|
+
export declare const MAX_PUSH_RETRIES = 3;
|
|
26
|
+
/**
|
|
27
|
+
* WU-1332: Default push retry configuration
|
|
28
|
+
*
|
|
29
|
+
* Provides sensible defaults for micro-worktree push operations.
|
|
30
|
+
* Can be overridden via .lumenflow.config.yaml git.push_retry section.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DEFAULT_PUSH_RETRY_CONFIG: PushRetryConfig;
|
|
33
|
+
/**
|
|
34
|
+
* Resolve effective push retry config from defaults + global config + operation override.
|
|
35
|
+
*
|
|
36
|
+
* Priority (lowest to highest):
|
|
37
|
+
* 1. DEFAULT_PUSH_RETRY_CONFIG
|
|
38
|
+
* 2. Global config from `.lumenflow.config.yaml` (`git.push_retry`)
|
|
39
|
+
* 3. Operation-specific override from caller
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolvePushRetryConfig(globalConfig?: Partial<PushRetryConfig>, operationOverride?: Partial<PushRetryConfig>): PushRetryConfig;
|
|
42
|
+
/**
|
|
43
|
+
* Environment variable name for LUMENFLOW_FORCE bypass
|
|
44
|
+
*
|
|
45
|
+
* WU-1081: Exported for use in micro-worktree push operations.
|
|
46
|
+
*/
|
|
47
|
+
export declare const LUMENFLOW_FORCE_ENV = "LUMENFLOW_FORCE";
|
|
48
|
+
/**
|
|
49
|
+
* Environment variable name for LUMENFLOW_FORCE_REASON audit trail
|
|
50
|
+
*
|
|
51
|
+
* WU-1081: Exported for use in micro-worktree push operations.
|
|
52
|
+
*/
|
|
53
|
+
export declare const LUMENFLOW_FORCE_REASON_ENV = "LUMENFLOW_FORCE_REASON";
|
|
54
|
+
/**
|
|
55
|
+
* Environment variable name for LUMENFLOW_WU_TOOL
|
|
56
|
+
*
|
|
57
|
+
* WU-1365: Exported for use by CLI commands that use micro-worktree operations.
|
|
58
|
+
* The pre-push hook checks this env var to allow micro-worktree pushes to main.
|
|
59
|
+
* Valid values are: wu-create, wu-edit, wu-done, wu-delete, wu-claim, wu-block,
|
|
60
|
+
* wu-unblock, initiative-create, initiative-edit, release, lumenflow-upgrade
|
|
61
|
+
*/
|
|
62
|
+
export declare const LUMENFLOW_WU_TOOL_ENV = "LUMENFLOW_WU_TOOL";
|
|
63
|
+
/**
|
|
64
|
+
* Default log prefix for micro-worktree operations
|
|
65
|
+
*
|
|
66
|
+
* Extracted to constant to satisfy sonarjs/no-duplicate-string rule.
|
|
67
|
+
*/
|
|
68
|
+
export declare const DEFAULT_LOG_PREFIX = "[micro-wt]";
|
|
69
|
+
/**
|
|
70
|
+
* WU-1336: Typed error for retry exhaustion in micro-worktree operations
|
|
71
|
+
*
|
|
72
|
+
* Thrown when push retries are exhausted due to race conditions with parallel agents.
|
|
73
|
+
* CLI commands should use `isRetryExhaustionError` to detect this error type and
|
|
74
|
+
* `formatRetryExhaustionError` to generate actionable user-facing messages.
|
|
75
|
+
*/
|
|
76
|
+
export declare class RetryExhaustionError extends Error {
|
|
77
|
+
readonly name = "RetryExhaustionError";
|
|
78
|
+
readonly operation: string;
|
|
79
|
+
readonly retries: number;
|
|
80
|
+
constructor(operation: string, retries: number);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* WU-1336: Options for formatting retry exhaustion error messages
|
|
84
|
+
*/
|
|
85
|
+
export interface FormatRetryExhaustionOptions {
|
|
86
|
+
command: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* WU-1336: Type guard to check if an error is a retry exhaustion error
|
|
90
|
+
*
|
|
91
|
+
* Detects both the typed `RetryExhaustionError` class and legacy error messages
|
|
92
|
+
* that match the "Push failed after N attempts" pattern.
|
|
93
|
+
*/
|
|
94
|
+
export declare function isRetryExhaustionError(error: unknown): error is Error;
|
|
95
|
+
/**
|
|
96
|
+
* WU-1336: Format retry exhaustion error with actionable next steps
|
|
97
|
+
*/
|
|
98
|
+
export declare function formatRetryExhaustionError(error: Error, options: FormatRetryExhaustionOptions): string;
|
|
99
|
+
/**
|
|
100
|
+
* WU-1308: Check if remote operations should be skipped based on git.requireRemote config
|
|
101
|
+
*/
|
|
102
|
+
export declare function shouldSkipRemoteOperations(): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Temp branch prefix for micro-worktree operations
|
|
105
|
+
*/
|
|
106
|
+
export declare function getTempBranchName(operation: string, id: string): string;
|
|
107
|
+
/**
|
|
108
|
+
* Create micro-worktree in /tmp directory
|
|
109
|
+
*/
|
|
110
|
+
export declare function createMicroWorktreeDir(prefix: string): string;
|
|
111
|
+
/**
|
|
112
|
+
* Parse git worktree list output to find worktrees by branch
|
|
113
|
+
*/
|
|
114
|
+
export declare function findWorktreeByBranch(worktreeListOutput: string, branchName: string): string | null;
|
|
115
|
+
/**
|
|
116
|
+
* Clean up orphaned micro-worktree and temp branch from a previous interrupted operation
|
|
117
|
+
*/
|
|
118
|
+
export declare function cleanupOrphanedMicroWorktree(operation: string, id: string, gitAdapter: GitAdapter, logPrefix?: string): Promise<{
|
|
119
|
+
cleanedWorktree: boolean;
|
|
120
|
+
cleanedBranch: boolean;
|
|
121
|
+
}>;
|
|
122
|
+
/**
|
|
123
|
+
* Cleanup micro-worktree and temp branch
|
|
124
|
+
*/
|
|
125
|
+
export declare function cleanupMicroWorktree(worktreePath: string, branchName: string, logPrefix?: string): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Push using refspec with LUMENFLOW_FORCE to bypass pre-push hooks
|
|
128
|
+
*/
|
|
129
|
+
export declare function pushRefspecWithForce(gitAdapter: GitAdapter, remote: string, localRef: string, remoteRef: string, reason: string): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* WU-1337: Push using refspec with LUMENFLOW_FORCE and retry logic
|
|
132
|
+
*/
|
|
133
|
+
export declare function pushRefspecWithRetry(gitWorktree: GitAdapter, mainGit: GitAdapter, remote: string, localRef: string, remoteRef: string, reason: string, logPrefix?: string, config?: PushRetryConfig): Promise<void>;
|
|
134
|
+
//# sourceMappingURL=micro-worktree-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"micro-worktree-shared.d.ts","sourceRoot":"","sources":["../src/micro-worktree-shared.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EA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WU-1626) to support atomic merge flows
|
|
5
|
+
* without importing the full withMicroWorktree orchestration module.
|
|
6
|
+
*/
|
|
7
|
+
import { getGitForCwd } from './git-adapter.js';
|
|
8
|
+
import { existsSync, rmSync, mkdtempSync } from 'node:fs';
|
|
9
|
+
import { tmpdir } from 'node:os';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
import pRetry from 'p-retry';
|
|
12
|
+
import { BRANCHES } from './wu-constants.js';
|
|
13
|
+
import { getConfig } from './lumenflow-config.js';
|
|
14
|
+
/**
|
|
15
|
+
* Maximum retry attempts for ff-only merge when main moves
|
|
16
|
+
*
|
|
17
|
+
* This handles race conditions when multiple agents run wu:create or wu:edit
|
|
18
|
+
* concurrently. Each retry fetches latest main and rebases.
|
|
19
|
+
*/
|
|
20
|
+
export const MAX_MERGE_RETRIES = 3;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum retry attempts for push when origin/main advances
|
|
23
|
+
*
|
|
24
|
+
* WU-1179: When push fails due to race condition (origin advanced while we
|
|
25
|
+
* were working), rollback local main to origin/main and retry.
|
|
26
|
+
* Each retry: fetch -> rebase temp branch -> re-merge -> push.
|
|
27
|
+
*
|
|
28
|
+
* @deprecated Use DEFAULT_PUSH_RETRY_CONFIG.retries instead (WU-1332)
|
|
29
|
+
*/
|
|
30
|
+
export const MAX_PUSH_RETRIES = 3;
|
|
31
|
+
/**
|
|
32
|
+
* WU-1332: Default push retry configuration
|
|
33
|
+
*
|
|
34
|
+
* Provides sensible defaults for micro-worktree push operations.
|
|
35
|
+
* Can be overridden via .lumenflow.config.yaml git.push_retry section.
|
|
36
|
+
*/
|
|
37
|
+
export const DEFAULT_PUSH_RETRY_CONFIG = {
|
|
38
|
+
enabled: true,
|
|
39
|
+
retries: 3,
|
|
40
|
+
min_delay_ms: 100,
|
|
41
|
+
max_delay_ms: 1000,
|
|
42
|
+
jitter: true,
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Resolve effective push retry config from defaults + global config + operation override.
|
|
46
|
+
*
|
|
47
|
+
* Priority (lowest to highest):
|
|
48
|
+
* 1. DEFAULT_PUSH_RETRY_CONFIG
|
|
49
|
+
* 2. Global config from `.lumenflow.config.yaml` (`git.push_retry`)
|
|
50
|
+
* 3. Operation-specific override from caller
|
|
51
|
+
*/
|
|
52
|
+
export function resolvePushRetryConfig(globalConfig, operationOverride) {
|
|
53
|
+
return {
|
|
54
|
+
...DEFAULT_PUSH_RETRY_CONFIG,
|
|
55
|
+
...(globalConfig || {}),
|
|
56
|
+
...(operationOverride || {}),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Environment variable name for LUMENFLOW_FORCE bypass
|
|
61
|
+
*
|
|
62
|
+
* WU-1081: Exported for use in micro-worktree push operations.
|
|
63
|
+
*/
|
|
64
|
+
export const LUMENFLOW_FORCE_ENV = 'LUMENFLOW_FORCE';
|
|
65
|
+
/**
|
|
66
|
+
* Environment variable name for LUMENFLOW_FORCE_REASON audit trail
|
|
67
|
+
*
|
|
68
|
+
* WU-1081: Exported for use in micro-worktree push operations.
|
|
69
|
+
*/
|
|
70
|
+
export const LUMENFLOW_FORCE_REASON_ENV = 'LUMENFLOW_FORCE_REASON';
|
|
71
|
+
/**
|
|
72
|
+
* Environment variable name for LUMENFLOW_WU_TOOL
|
|
73
|
+
*
|
|
74
|
+
* WU-1365: Exported for use by CLI commands that use micro-worktree operations.
|
|
75
|
+
* The pre-push hook checks this env var to allow micro-worktree pushes to main.
|
|
76
|
+
* Valid values are: wu-create, wu-edit, wu-done, wu-delete, wu-claim, wu-block,
|
|
77
|
+
* wu-unblock, initiative-create, initiative-edit, release, lumenflow-upgrade
|
|
78
|
+
*/
|
|
79
|
+
export const LUMENFLOW_WU_TOOL_ENV = 'LUMENFLOW_WU_TOOL';
|
|
80
|
+
/**
|
|
81
|
+
* Default log prefix for micro-worktree operations
|
|
82
|
+
*
|
|
83
|
+
* Extracted to constant to satisfy sonarjs/no-duplicate-string rule.
|
|
84
|
+
*/
|
|
85
|
+
export const DEFAULT_LOG_PREFIX = '[micro-wt]';
|
|
86
|
+
/**
|
|
87
|
+
* WU-1336: Pattern to detect retry exhaustion errors from error messages
|
|
88
|
+
*
|
|
89
|
+
* Matches error messages like "Push failed after N attempts"
|
|
90
|
+
* Used for backwards compatibility with legacy error messages.
|
|
91
|
+
*/
|
|
92
|
+
const RETRY_EXHAUSTION_PATTERN = /Push failed after \d+ attempts/;
|
|
93
|
+
/**
|
|
94
|
+
* WU-1336: Typed error for retry exhaustion in micro-worktree operations
|
|
95
|
+
*
|
|
96
|
+
* Thrown when push retries are exhausted due to race conditions with parallel agents.
|
|
97
|
+
* CLI commands should use `isRetryExhaustionError` to detect this error type and
|
|
98
|
+
* `formatRetryExhaustionError` to generate actionable user-facing messages.
|
|
99
|
+
*/
|
|
100
|
+
export class RetryExhaustionError extends Error {
|
|
101
|
+
name = 'RetryExhaustionError';
|
|
102
|
+
operation;
|
|
103
|
+
retries;
|
|
104
|
+
constructor(operation, retries) {
|
|
105
|
+
super(`Push failed after ${retries} attempts. ` +
|
|
106
|
+
`Origin main may have significant traffic during ${operation}.`);
|
|
107
|
+
this.operation = operation;
|
|
108
|
+
this.retries = retries;
|
|
109
|
+
Object.setPrototypeOf(this, RetryExhaustionError.prototype);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* WU-1336: Type guard to check if an error is a retry exhaustion error
|
|
114
|
+
*
|
|
115
|
+
* Detects both the typed `RetryExhaustionError` class and legacy error messages
|
|
116
|
+
* that match the "Push failed after N attempts" pattern.
|
|
117
|
+
*/
|
|
118
|
+
export function isRetryExhaustionError(error) {
|
|
119
|
+
if (error instanceof RetryExhaustionError) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
if (error instanceof Error) {
|
|
123
|
+
return RETRY_EXHAUSTION_PATTERN.test(error.message);
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* WU-1336: Format retry exhaustion error with actionable next steps
|
|
129
|
+
*/
|
|
130
|
+
export function formatRetryExhaustionError(error, options) {
|
|
131
|
+
const { command } = options;
|
|
132
|
+
return (`${error.message}\n\n` +
|
|
133
|
+
`Next steps:\n` +
|
|
134
|
+
` 1. Wait a few seconds and retry the operation:\n` +
|
|
135
|
+
` ${command}\n` +
|
|
136
|
+
` 2. If the issue persists, check if another agent is rapidly pushing changes\n` +
|
|
137
|
+
` 3. Consider increasing git.push_retry.retries in .lumenflow.config.yaml`);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* WU-1308: Check if remote operations should be skipped based on git.requireRemote config
|
|
141
|
+
*/
|
|
142
|
+
export function shouldSkipRemoteOperations() {
|
|
143
|
+
const config = getConfig();
|
|
144
|
+
return config.git.requireRemote === false;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Temp branch prefix for micro-worktree operations
|
|
148
|
+
*/
|
|
149
|
+
export function getTempBranchName(operation, id) {
|
|
150
|
+
return `${BRANCHES.TEMP_PREFIX}${operation}/${id.toLowerCase()}`;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Create micro-worktree in /tmp directory
|
|
154
|
+
*/
|
|
155
|
+
export function createMicroWorktreeDir(prefix) {
|
|
156
|
+
return mkdtempSync(join(tmpdir(), prefix));
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Parse git worktree list output to find worktrees by branch
|
|
160
|
+
*/
|
|
161
|
+
export function findWorktreeByBranch(worktreeListOutput, branchName) {
|
|
162
|
+
const branchRef = `refs/heads/${branchName}`;
|
|
163
|
+
const lines = worktreeListOutput.split('\n');
|
|
164
|
+
let currentWorktreePath = null;
|
|
165
|
+
for (const line of lines) {
|
|
166
|
+
if (line.startsWith('worktree ')) {
|
|
167
|
+
currentWorktreePath = line.substring('worktree '.length);
|
|
168
|
+
}
|
|
169
|
+
else if (line.startsWith('branch ') && line.substring('branch '.length) === branchRef) {
|
|
170
|
+
return currentWorktreePath;
|
|
171
|
+
}
|
|
172
|
+
else if (line === '') {
|
|
173
|
+
currentWorktreePath = null;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Clean up orphaned micro-worktree and temp branch from a previous interrupted operation
|
|
180
|
+
*/
|
|
181
|
+
export async function cleanupOrphanedMicroWorktree(operation, id, gitAdapter, logPrefix = DEFAULT_LOG_PREFIX) {
|
|
182
|
+
const tempBranchName = getTempBranchName(operation, id);
|
|
183
|
+
let cleanedWorktree = false;
|
|
184
|
+
let cleanedBranch = false;
|
|
185
|
+
try {
|
|
186
|
+
const worktreeListOutput = await gitAdapter.worktreeList();
|
|
187
|
+
const orphanWorktreePath = findWorktreeByBranch(worktreeListOutput, tempBranchName);
|
|
188
|
+
if (orphanWorktreePath) {
|
|
189
|
+
console.log(`${logPrefix} Found orphaned worktree for ${tempBranchName}: ${orphanWorktreePath}`);
|
|
190
|
+
try {
|
|
191
|
+
await gitAdapter.worktreeRemove(orphanWorktreePath, { force: true });
|
|
192
|
+
console.log(`${logPrefix} ✅ Removed orphaned worktree: ${orphanWorktreePath}`);
|
|
193
|
+
cleanedWorktree = true;
|
|
194
|
+
}
|
|
195
|
+
catch (err) {
|
|
196
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
197
|
+
console.warn(`${logPrefix} ⚠️ Could not remove orphaned worktree: ${errMsg}`);
|
|
198
|
+
tryFilesystemCleanup(orphanWorktreePath);
|
|
199
|
+
cleanedWorktree = true;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
catch (err) {
|
|
204
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
205
|
+
console.warn(`${logPrefix} ⚠️ Could not check worktree list: ${errMsg}`);
|
|
206
|
+
}
|
|
207
|
+
try {
|
|
208
|
+
const branchExists = await gitAdapter.branchExists(tempBranchName);
|
|
209
|
+
if (branchExists) {
|
|
210
|
+
console.log(`${logPrefix} Found orphaned temp branch: ${tempBranchName}`);
|
|
211
|
+
await gitAdapter.deleteBranch(tempBranchName, { force: true });
|
|
212
|
+
console.log(`${logPrefix} ✅ Deleted orphaned temp branch: ${tempBranchName}`);
|
|
213
|
+
cleanedBranch = true;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
catch (err) {
|
|
217
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
218
|
+
console.warn(`${logPrefix} ⚠️ Could not delete orphaned branch: ${errMsg}`);
|
|
219
|
+
}
|
|
220
|
+
return { cleanedWorktree, cleanedBranch };
|
|
221
|
+
}
|
|
222
|
+
function tryFilesystemCleanup(worktreePath) {
|
|
223
|
+
try {
|
|
224
|
+
if (existsSync(worktreePath)) {
|
|
225
|
+
rmSync(worktreePath, { recursive: true, force: true });
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
// Ignore filesystem cleanup errors
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
async function removeWorktreeSafe(gitAdapter, worktreePath, logPrefix, contextLabel = '') {
|
|
233
|
+
const label = contextLabel ? ` ${contextLabel}` : '';
|
|
234
|
+
try {
|
|
235
|
+
await gitAdapter.worktreeRemove(worktreePath, { force: true });
|
|
236
|
+
if (contextLabel) {
|
|
237
|
+
console.log(`${logPrefix} ✅ Removed${label} worktree: ${worktreePath}`);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
catch (err) {
|
|
241
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
242
|
+
console.warn(`${logPrefix} ⚠️ Could not remove${label} worktree: ${errMsg}`);
|
|
243
|
+
tryFilesystemCleanup(worktreePath);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Cleanup micro-worktree and temp branch
|
|
248
|
+
*/
|
|
249
|
+
export async function cleanupMicroWorktree(worktreePath, branchName, logPrefix = DEFAULT_LOG_PREFIX) {
|
|
250
|
+
console.log(`${logPrefix} Cleaning up micro-worktree...`);
|
|
251
|
+
const mainGit = getGitForCwd();
|
|
252
|
+
if (existsSync(worktreePath)) {
|
|
253
|
+
await removeWorktreeSafe(mainGit, worktreePath, logPrefix);
|
|
254
|
+
}
|
|
255
|
+
await cleanupRegisteredWorktreeForBranch(mainGit, branchName, worktreePath, logPrefix);
|
|
256
|
+
await deleteBranchSafe(mainGit, branchName, logPrefix);
|
|
257
|
+
console.log(`${logPrefix} ✅ Cleanup complete`);
|
|
258
|
+
}
|
|
259
|
+
async function cleanupRegisteredWorktreeForBranch(gitAdapter, branchName, expectedPath, logPrefix) {
|
|
260
|
+
try {
|
|
261
|
+
const worktreeListOutput = await gitAdapter.worktreeList();
|
|
262
|
+
const registeredPath = findWorktreeByBranch(worktreeListOutput, branchName);
|
|
263
|
+
if (registeredPath && registeredPath !== expectedPath) {
|
|
264
|
+
console.log(`${logPrefix} Found additional registered worktree: ${registeredPath}`);
|
|
265
|
+
await removeWorktreeSafe(gitAdapter, registeredPath, logPrefix, 'registered');
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
catch (err) {
|
|
269
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
270
|
+
console.warn(`${logPrefix} ⚠️ Could not check worktree list: ${errMsg}`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
async function deleteBranchSafe(gitAdapter, branchName, logPrefix) {
|
|
274
|
+
try {
|
|
275
|
+
const branchExists = await gitAdapter.branchExists(branchName);
|
|
276
|
+
if (branchExists) {
|
|
277
|
+
await gitAdapter.deleteBranch(branchName, { force: true });
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
catch (err) {
|
|
281
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
282
|
+
console.warn(`${logPrefix} ⚠️ Could not delete branch: ${errMsg}`);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Push using refspec with LUMENFLOW_FORCE to bypass pre-push hooks
|
|
287
|
+
*/
|
|
288
|
+
export async function pushRefspecWithForce(gitAdapter, remote, localRef, remoteRef, reason) {
|
|
289
|
+
const originalForce = process.env[LUMENFLOW_FORCE_ENV];
|
|
290
|
+
const originalReason = process.env[LUMENFLOW_FORCE_REASON_ENV];
|
|
291
|
+
try {
|
|
292
|
+
process.env[LUMENFLOW_FORCE_ENV] = '1';
|
|
293
|
+
process.env[LUMENFLOW_FORCE_REASON_ENV] = reason;
|
|
294
|
+
await gitAdapter.pushRefspec(remote, localRef, remoteRef);
|
|
295
|
+
}
|
|
296
|
+
finally {
|
|
297
|
+
if (originalForce === undefined) {
|
|
298
|
+
Reflect.deleteProperty(process.env, LUMENFLOW_FORCE_ENV);
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
process.env[LUMENFLOW_FORCE_ENV] = originalForce;
|
|
302
|
+
}
|
|
303
|
+
if (originalReason === undefined) {
|
|
304
|
+
Reflect.deleteProperty(process.env, LUMENFLOW_FORCE_REASON_ENV);
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
process.env[LUMENFLOW_FORCE_REASON_ENV] = originalReason;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* WU-1337: Push using refspec with LUMENFLOW_FORCE and retry logic
|
|
313
|
+
*/
|
|
314
|
+
export async function pushRefspecWithRetry(gitWorktree, mainGit, remote, localRef, remoteRef, reason, logPrefix = DEFAULT_LOG_PREFIX, config = DEFAULT_PUSH_RETRY_CONFIG) {
|
|
315
|
+
if (!config.enabled) {
|
|
316
|
+
console.log(`${logPrefix} Pushing to ${remote}/${remoteRef} (push-only, retry disabled)...`);
|
|
317
|
+
await pushRefspecWithForce(gitWorktree, remote, localRef, remoteRef, reason);
|
|
318
|
+
console.log(`${logPrefix} ✅ Pushed to ${remote}/${remoteRef}`);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
let attemptNumber = 0;
|
|
322
|
+
await pRetry(async () => {
|
|
323
|
+
attemptNumber++;
|
|
324
|
+
console.log(`${logPrefix} Pushing to ${remote}/${remoteRef} (push-only, attempt ${attemptNumber}/${config.retries})...`);
|
|
325
|
+
try {
|
|
326
|
+
await pushRefspecWithForce(gitWorktree, remote, localRef, remoteRef, reason);
|
|
327
|
+
console.log(`${logPrefix} ✅ Pushed to ${remote}/${remoteRef}`);
|
|
328
|
+
}
|
|
329
|
+
catch (pushErr) {
|
|
330
|
+
console.log(`${logPrefix} ⚠️ Push failed (origin moved). Fetching and rebasing before retry...`);
|
|
331
|
+
console.log(`${logPrefix} Fetching ${remote}/${remoteRef}...`);
|
|
332
|
+
await mainGit.fetch(remote, remoteRef);
|
|
333
|
+
const remoteTrackingRef = `${remote}/${remoteRef}`;
|
|
334
|
+
console.log(`${logPrefix} Rebasing temp branch onto ${remoteTrackingRef}...`);
|
|
335
|
+
await gitWorktree.rebase(remoteTrackingRef);
|
|
336
|
+
throw pushErr;
|
|
337
|
+
}
|
|
338
|
+
}, {
|
|
339
|
+
retries: config.retries - 1,
|
|
340
|
+
minTimeout: config.min_delay_ms,
|
|
341
|
+
maxTimeout: config.max_delay_ms,
|
|
342
|
+
randomize: config.jitter,
|
|
343
|
+
onFailedAttempt: () => {
|
|
344
|
+
// Logging handled in the retry body
|
|
345
|
+
},
|
|
346
|
+
}).catch(() => {
|
|
347
|
+
throw new RetryExhaustionError('push-only', config.retries);
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
//# sourceMappingURL=micro-worktree-shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"micro-worktree-shared.js","sourceRoot":"","sources":["../src/micro-worktree-shared.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC1D,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