@lumenflow/core 2.3.2 → 2.5.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.
@@ -7,6 +7,30 @@
7
7
  * @module lumenflow-config-schema
8
8
  */
9
9
  import { z } from 'zod';
10
+ /**
11
+ * WU-1325: Lock policy for lane-level WIP enforcement
12
+ *
13
+ * Controls how lane locks behave:
14
+ * - 'all' (default): Lock acquired on claim, held through block, released on done
15
+ * - 'active': Lock acquired on claim, released on block, re-acquired on unblock
16
+ * - 'none': No lock files created, WIP checking disabled
17
+ *
18
+ * @example
19
+ * ```yaml
20
+ * lanes:
21
+ * definitions:
22
+ * - name: 'Content: Documentation'
23
+ * wip_limit: 4
24
+ * lock_policy: 'none' # Docs don't need lock coordination
25
+ * ```
26
+ */
27
+ export declare const LockPolicySchema: z.ZodDefault<z.ZodEnum<{
28
+ none: "none";
29
+ all: "all";
30
+ active: "active";
31
+ }>>;
32
+ /** WU-1325: TypeScript type for lock policy */
33
+ export type LockPolicy = z.infer<typeof LockPolicySchema>;
10
34
  /**
11
35
  * Event archival configuration (WU-1207)
12
36
  *
@@ -35,6 +59,9 @@ export declare const DirectoriesSchema: z.ZodObject<{
35
59
  statusPath: z.ZodDefault<z.ZodString>;
36
60
  skillsDir: z.ZodDefault<z.ZodString>;
37
61
  agentsDir: z.ZodDefault<z.ZodString>;
62
+ plansDir: z.ZodDefault<z.ZodString>;
63
+ templatesDir: z.ZodDefault<z.ZodString>;
64
+ onboardingDir: z.ZodDefault<z.ZodString>;
38
65
  }, z.core.$strip>;
39
66
  /**
40
67
  * Beacon paths configuration (.lumenflow directory structure)
@@ -55,6 +82,19 @@ export declare const BeaconPathsSchema: z.ZodObject<{
55
82
  keepArchives: z.ZodDefault<z.ZodBoolean>;
56
83
  }, z.core.$strip>>;
57
84
  }, z.core.$strip>;
85
+ /**
86
+ * WU-1332: Push retry configuration for micro-worktree operations
87
+ *
88
+ * When non-fast-forward push errors occur (origin/main moved during operation),
89
+ * retry with exponential backoff. Uses p-retry for robust retry behavior.
90
+ */
91
+ export declare const PushRetryConfigSchema: z.ZodObject<{
92
+ enabled: z.ZodDefault<z.ZodBoolean>;
93
+ retries: z.ZodDefault<z.ZodNumber>;
94
+ min_delay_ms: z.ZodDefault<z.ZodNumber>;
95
+ max_delay_ms: z.ZodDefault<z.ZodNumber>;
96
+ jitter: z.ZodDefault<z.ZodBoolean>;
97
+ }, z.core.$strip>;
58
98
  /**
59
99
  * Git configuration
60
100
  */
@@ -67,9 +107,17 @@ export declare const GitConfigSchema: z.ZodObject<{
67
107
  maxBranchDrift: z.ZodDefault<z.ZodNumber>;
68
108
  branchDriftWarning: z.ZodDefault<z.ZodNumber>;
69
109
  branchDriftInfo: z.ZodDefault<z.ZodNumber>;
110
+ requireRemote: z.ZodDefault<z.ZodBoolean>;
70
111
  agentBranchPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
71
112
  agentBranchPatternsOverride: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
113
  disableAgentPatternRegistry: z.ZodDefault<z.ZodBoolean>;
114
+ push_retry: z.ZodDefault<z.ZodObject<{
115
+ enabled: z.ZodDefault<z.ZodBoolean>;
116
+ retries: z.ZodDefault<z.ZodNumber>;
117
+ min_delay_ms: z.ZodDefault<z.ZodNumber>;
118
+ max_delay_ms: z.ZodDefault<z.ZodNumber>;
119
+ jitter: z.ZodDefault<z.ZodBoolean>;
120
+ }, z.core.$strip>>;
73
121
  }, z.core.$strip>;
74
122
  /**
75
123
  * WU (Work Unit) configuration
@@ -309,6 +357,23 @@ export declare const TelemetryConfigSchema: z.ZodObject<{
309
357
  enabled: z.ZodDefault<z.ZodBoolean>;
310
358
  }, z.core.$strip>>;
311
359
  }, z.core.$strip>;
360
+ /**
361
+ * WU-1322: Lane definition schema for .lumenflow.config.yaml
362
+ *
363
+ * Extends the existing lane configuration with lock_policy field.
364
+ * Compatible with WU-1016 (wip_limit) and WU-1187 (wip_justification).
365
+ */
366
+ export declare const LaneDefinitionSchema: z.ZodObject<{
367
+ name: z.ZodString;
368
+ wip_limit: z.ZodOptional<z.ZodNumber>;
369
+ wip_justification: z.ZodOptional<z.ZodString>;
370
+ lock_policy: z.ZodDefault<z.ZodDefault<z.ZodEnum<{
371
+ none: "none";
372
+ all: "all";
373
+ active: "active";
374
+ }>>>;
375
+ code_paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
376
+ }, z.core.$strip>;
312
377
  /**
313
378
  * Complete LumenFlow configuration schema
314
379
  */
@@ -329,6 +394,9 @@ export declare const LumenFlowConfigSchema: z.ZodObject<{
329
394
  statusPath: z.ZodDefault<z.ZodString>;
330
395
  skillsDir: z.ZodDefault<z.ZodString>;
331
396
  agentsDir: z.ZodDefault<z.ZodString>;
397
+ plansDir: z.ZodDefault<z.ZodString>;
398
+ templatesDir: z.ZodDefault<z.ZodString>;
399
+ onboardingDir: z.ZodDefault<z.ZodString>;
332
400
  }, z.core.$strip>>;
333
401
  beacon: z.ZodDefault<z.ZodObject<{
334
402
  base: z.ZodDefault<z.ZodString>;
@@ -355,9 +423,17 @@ export declare const LumenFlowConfigSchema: z.ZodObject<{
355
423
  maxBranchDrift: z.ZodDefault<z.ZodNumber>;
356
424
  branchDriftWarning: z.ZodDefault<z.ZodNumber>;
357
425
  branchDriftInfo: z.ZodDefault<z.ZodNumber>;
426
+ requireRemote: z.ZodDefault<z.ZodBoolean>;
358
427
  agentBranchPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
359
428
  agentBranchPatternsOverride: z.ZodOptional<z.ZodArray<z.ZodString>>;
360
429
  disableAgentPatternRegistry: z.ZodDefault<z.ZodBoolean>;
430
+ push_retry: z.ZodDefault<z.ZodObject<{
431
+ enabled: z.ZodDefault<z.ZodBoolean>;
432
+ retries: z.ZodDefault<z.ZodNumber>;
433
+ min_delay_ms: z.ZodDefault<z.ZodNumber>;
434
+ max_delay_ms: z.ZodDefault<z.ZodNumber>;
435
+ jitter: z.ZodDefault<z.ZodBoolean>;
436
+ }, z.core.$strip>>;
361
437
  }, z.core.$strip>>;
362
438
  wu: z.ZodDefault<z.ZodObject<{
363
439
  idPattern: z.ZodDefault<z.ZodString>;
@@ -501,6 +577,7 @@ export declare const LumenFlowConfigSchema: z.ZodObject<{
501
577
  */
502
578
  export type Directories = z.infer<typeof DirectoriesSchema>;
503
579
  export type BeaconPaths = z.infer<typeof BeaconPathsSchema>;
580
+ export type PushRetryConfig = z.infer<typeof PushRetryConfigSchema>;
504
581
  export type GitConfig = z.infer<typeof GitConfigSchema>;
505
582
  export type WuConfig = z.infer<typeof WuConfigSchema>;
506
583
  export type GatesConfig = z.infer<typeof GatesConfigSchema>;
@@ -520,6 +597,7 @@ export type ValidationMode = z.infer<typeof ValidationModeSchema>;
520
597
  export type MethodologyTelemetryConfig = z.infer<typeof MethodologyTelemetryConfigSchema>;
521
598
  export type TelemetryConfig = z.infer<typeof TelemetryConfigSchema>;
522
599
  export type LumenFlowConfig = z.infer<typeof LumenFlowConfigSchema>;
600
+ export type LaneDefinition = z.infer<typeof LaneDefinitionSchema>;
523
601
  export type { MethodologyConfig, MethodologyOverrides } from './resolve-policy.js';
524
602
  /**
525
603
  * Validate configuration data
@@ -544,6 +622,9 @@ export declare function validateConfig(data: unknown): z.ZodSafeParseResult<{
544
622
  statusPath: string;
545
623
  skillsDir: string;
546
624
  agentsDir: string;
625
+ plansDir: string;
626
+ templatesDir: string;
627
+ onboardingDir: string;
547
628
  };
548
629
  beacon: {
549
630
  base: string;
@@ -570,8 +651,16 @@ export declare function validateConfig(data: unknown): z.ZodSafeParseResult<{
570
651
  maxBranchDrift: number;
571
652
  branchDriftWarning: number;
572
653
  branchDriftInfo: number;
654
+ requireRemote: boolean;
573
655
  agentBranchPatterns: string[];
574
656
  disableAgentPatternRegistry: boolean;
657
+ push_retry: {
658
+ enabled: boolean;
659
+ retries: number;
660
+ min_delay_ms: number;
661
+ max_delay_ms: number;
662
+ jitter: boolean;
663
+ };
575
664
  agentBranchPatternsOverride?: string[];
576
665
  };
577
666
  wu: {
@@ -11,6 +11,24 @@ import { z } from 'zod';
11
11
  import { GatesExecutionConfigSchema } from './gates-config.js';
12
12
  // WU-1259: Import methodology config schema for resolvePolicy()
13
13
  import { MethodologyConfigSchema } from './resolve-policy.js';
14
+ /**
15
+ * WU-1325: Lock policy for lane-level WIP enforcement
16
+ *
17
+ * Controls how lane locks behave:
18
+ * - 'all' (default): Lock acquired on claim, held through block, released on done
19
+ * - 'active': Lock acquired on claim, released on block, re-acquired on unblock
20
+ * - 'none': No lock files created, WIP checking disabled
21
+ *
22
+ * @example
23
+ * ```yaml
24
+ * lanes:
25
+ * definitions:
26
+ * - name: 'Content: Documentation'
27
+ * wip_limit: 4
28
+ * lock_policy: 'none' # Docs don't need lock coordination
29
+ * ```
30
+ */
31
+ export const LockPolicySchema = z.enum(['all', 'active', 'none']).default('all');
14
32
  /**
15
33
  * Event archival configuration (WU-1207)
16
34
  *
@@ -67,6 +85,12 @@ export const DirectoriesSchema = z.object({
67
85
  skillsDir: z.string().default('.claude/skills'),
68
86
  /** Agents directory (default: '.claude/agents') */
69
87
  agentsDir: z.string().default('.claude/agents'),
88
+ /** Plans directory (default: 'docs/04-operations/plans') - WU-1301 */
89
+ plansDir: z.string().default('docs/04-operations/plans'),
90
+ /** Templates directory (default: '.lumenflow/templates') - WU-1310 */
91
+ templatesDir: z.string().default('.lumenflow/templates'),
92
+ /** Onboarding directory (default: 'docs/04-operations/_frameworks/lumenflow/agent/onboarding') - WU-1310 */
93
+ onboardingDir: z.string().default('docs/04-operations/_frameworks/lumenflow/agent/onboarding'),
70
94
  });
71
95
  /**
72
96
  * Beacon paths configuration (.lumenflow directory structure)
@@ -98,6 +122,45 @@ export const BeaconPathsSchema = z.object({
98
122
  */
99
123
  eventArchival: EventArchivalConfigSchema.default(() => EventArchivalConfigSchema.parse({})),
100
124
  });
125
+ /**
126
+ * WU-1332: Push retry configuration for micro-worktree operations
127
+ *
128
+ * When non-fast-forward push errors occur (origin/main moved during operation),
129
+ * retry with exponential backoff. Uses p-retry for robust retry behavior.
130
+ */
131
+ export const PushRetryConfigSchema = z.object({
132
+ /**
133
+ * Enable push retry with rebase on non-fast-forward errors.
134
+ * When true, failed pushes trigger automatic rebase and retry.
135
+ * When false, the original error is thrown immediately.
136
+ * @default true
137
+ */
138
+ enabled: z.boolean().default(true),
139
+ /**
140
+ * Maximum number of retry attempts (including the initial attempt).
141
+ * After this many failures, the operation fails with clear guidance.
142
+ * @default 3
143
+ */
144
+ retries: z.number().int().positive().default(3),
145
+ /**
146
+ * Minimum delay in milliseconds between retries.
147
+ * Used as the base for exponential backoff.
148
+ * @default 100
149
+ */
150
+ min_delay_ms: z.number().int().nonnegative().default(100),
151
+ /**
152
+ * Maximum delay in milliseconds between retries.
153
+ * Caps the exponential backoff to prevent excessive waits.
154
+ * @default 1000
155
+ */
156
+ max_delay_ms: z.number().int().positive().default(1000),
157
+ /**
158
+ * Add randomization to retry delays (recommended for concurrent agents).
159
+ * Helps prevent thundering herd when multiple agents retry simultaneously.
160
+ * @default true
161
+ */
162
+ jitter: z.boolean().default(true),
163
+ });
101
164
  /**
102
165
  * Git configuration
103
166
  */
@@ -118,6 +181,25 @@ export const GitConfigSchema = z.object({
118
181
  branchDriftWarning: z.number().int().positive().default(15),
119
182
  /** Info threshold for branch drift */
120
183
  branchDriftInfo: z.number().int().positive().default(10),
184
+ /**
185
+ * WU-1302: Require a remote repository for wu:create and wu:claim.
186
+ * When true (default), operations fail if no remote 'origin' exists.
187
+ * When false, operations can proceed locally without pushing.
188
+ *
189
+ * Use `git.requireRemote: false` for:
190
+ * - Local-only development before remote is set up
191
+ * - Air-gapped environments
192
+ * - Testing/evaluation of LumenFlow
193
+ *
194
+ * @default true
195
+ *
196
+ * @example
197
+ * ```yaml
198
+ * git:
199
+ * requireRemote: false # Allow offline/local mode
200
+ * ```
201
+ */
202
+ requireRemote: z.boolean().default(true),
121
203
  /**
122
204
  * Agent branch patterns to MERGE with the registry patterns.
123
205
  * These patterns are merged with patterns from lumenflow.dev/registry/agent-patterns.json.
@@ -168,6 +250,23 @@ export const GitConfigSchema = z.object({
168
250
  * ```
169
251
  */
170
252
  disableAgentPatternRegistry: z.boolean().default(false),
253
+ /**
254
+ * WU-1332: Push retry configuration for micro-worktree operations.
255
+ * When push fails due to non-fast-forward (origin moved), automatically
256
+ * rebase and retry with exponential backoff.
257
+ *
258
+ * @example
259
+ * ```yaml
260
+ * git:
261
+ * push_retry:
262
+ * enabled: true
263
+ * retries: 5 # Try 5 times total
264
+ * min_delay_ms: 200 # Start with 200ms delay
265
+ * max_delay_ms: 2000 # Cap at 2 second delay
266
+ * jitter: true # Add randomization
267
+ * ```
268
+ */
269
+ push_retry: PushRetryConfigSchema.default(() => PushRetryConfigSchema.parse({})),
171
270
  });
172
271
  /**
173
272
  * WU (Work Unit) configuration
@@ -483,6 +582,40 @@ export const TelemetryConfigSchema = z.object({
483
582
  */
484
583
  methodology: MethodologyTelemetryConfigSchema.default(() => MethodologyTelemetryConfigSchema.parse({})),
485
584
  });
585
+ /**
586
+ * WU-1322: Lane definition schema for .lumenflow.config.yaml
587
+ *
588
+ * Extends the existing lane configuration with lock_policy field.
589
+ * Compatible with WU-1016 (wip_limit) and WU-1187 (wip_justification).
590
+ */
591
+ export const LaneDefinitionSchema = z.object({
592
+ /** Lane name in "Parent: Sublane" format (e.g., "Framework: Core") */
593
+ name: z.string(),
594
+ /** WU-1016: Maximum WUs allowed in progress concurrently for this lane */
595
+ wip_limit: z.number().int().positive().optional(),
596
+ /** WU-1187: Required justification when wip_limit > 1 */
597
+ wip_justification: z.string().optional(),
598
+ /**
599
+ * WU-1322: Lock policy for this lane.
600
+ * - 'all': Lock lane for all other agents (default)
601
+ * - 'active': Lock only for agents with overlapping code_paths
602
+ * - 'none': No locking (suitable for documentation lanes)
603
+ *
604
+ * @default 'all'
605
+ *
606
+ * @example
607
+ * ```yaml
608
+ * lanes:
609
+ * definitions:
610
+ * - name: 'Content: Documentation'
611
+ * wip_limit: 4
612
+ * lock_policy: 'none' # Docs can be worked in parallel
613
+ * ```
614
+ */
615
+ lock_policy: LockPolicySchema.default('all'),
616
+ /** Code paths associated with this lane (glob patterns) */
617
+ code_paths: z.array(z.string()).optional(),
618
+ });
486
619
  /**
487
620
  * Complete LumenFlow configuration schema
488
621
  */
@@ -71,6 +71,9 @@ export declare function getResolvedPaths(options?: {
71
71
  skillsDir: string;
72
72
  agentsDir: string;
73
73
  memoryBank: string;
74
+ plansDir: string;
75
+ templatesDir: string;
76
+ onboardingDir: string;
74
77
  };
75
78
  /**
76
79
  * Validate a config file
@@ -92,4 +95,5 @@ export declare function validateConfigFile(configPath: string): {
92
95
  export declare function createSampleConfig(outputPath: string, options?: {
93
96
  includeComments?: boolean;
94
97
  }): void;
95
- export type { LumenFlowConfig, Directories, BeaconPaths, GitConfig, WuConfig, GatesConfig, MemoryConfig, UiConfig, YamlConfig, } from './lumenflow-config-schema.js';
98
+ export type { LumenFlowConfig, Directories, BeaconPaths, PushRetryConfig, GitConfig, WuConfig, GatesConfig, MemoryConfig, UiConfig, YamlConfig, } from './lumenflow-config-schema.js';
99
+ export { getDefaultConfig } from './lumenflow-config-schema.js';
@@ -55,6 +55,7 @@ function loadConfigFile(projectRoot) {
55
55
  return data || {};
56
56
  }
57
57
  catch (error) {
58
+ // eslint-disable-next-line no-console -- Config loading runs before logger init
58
59
  console.warn(`Warning: Failed to parse ${CONFIG_FILE_NAME}:`, error);
59
60
  return null;
60
61
  }
@@ -144,6 +145,9 @@ export function getResolvedPaths(options = {}) {
144
145
  skillsDir: path.join(projectRoot, config.directories.skillsDir),
145
146
  agentsDir: path.join(projectRoot, config.directories.agentsDir),
146
147
  memoryBank: path.join(projectRoot, config.directories.memoryBank),
148
+ plansDir: path.join(projectRoot, config.directories.plansDir),
149
+ templatesDir: path.join(projectRoot, config.directories.templatesDir),
150
+ onboardingDir: path.join(projectRoot, config.directories.onboardingDir),
147
151
  };
148
152
  }
149
153
  /**
@@ -205,6 +209,12 @@ directories:
205
209
  skillsDir: "${defaultConfig.directories.skillsDir}"
206
210
  # Agents directory
207
211
  agentsDir: "${defaultConfig.directories.agentsDir}"
212
+ # Plans directory
213
+ plansDir: "${defaultConfig.directories.plansDir}"
214
+ # Templates directory
215
+ templatesDir: "${defaultConfig.directories.templatesDir}"
216
+ # Onboarding directory
217
+ onboardingDir: "${defaultConfig.directories.onboardingDir}"
208
218
 
209
219
  # Beacon paths (.lumenflow directory structure)
210
220
  beacon:
@@ -234,3 +244,5 @@ gates:
234
244
  : yaml.stringify(defaultConfig);
235
245
  fs.writeFileSync(outputPath, configContent, 'utf8');
236
246
  }
247
+ // Re-export getDefaultConfig for consumers
248
+ export { getDefaultConfig } from './lumenflow-config-schema.js';
@@ -28,6 +28,7 @@
28
28
  * @see {@link packages/@lumenflow/cli/src/initiative-create.ts} - Initiative creation (WU-1439)
29
29
  */
30
30
  import type { GitAdapter } from './git-adapter.js';
31
+ import type { PushRetryConfig } from './lumenflow-config-schema.js';
31
32
  /**
32
33
  * Context passed to the execute function in withMicroWorktree
33
34
  */
@@ -81,8 +82,17 @@ export declare const MAX_MERGE_RETRIES = 3;
81
82
  * WU-1179: When push fails due to race condition (origin advanced while we
82
83
  * were working), rollback local main to origin/main and retry.
83
84
  * Each retry: fetch -> rebase temp branch -> re-merge -> push.
85
+ *
86
+ * @deprecated Use DEFAULT_PUSH_RETRY_CONFIG.retries instead (WU-1332)
84
87
  */
85
88
  export declare const MAX_PUSH_RETRIES = 3;
89
+ /**
90
+ * WU-1332: Default push retry configuration
91
+ *
92
+ * Provides sensible defaults for micro-worktree push operations.
93
+ * Can be overridden via .lumenflow.config.yaml git.push_retry section.
94
+ */
95
+ export declare const DEFAULT_PUSH_RETRY_CONFIG: PushRetryConfig;
86
96
  /**
87
97
  * Environment variable name for LUMENFLOW_FORCE bypass
88
98
  *
@@ -101,6 +111,102 @@ export declare const LUMENFLOW_FORCE_REASON_ENV = "LUMENFLOW_FORCE_REASON";
101
111
  * Extracted to constant to satisfy sonarjs/no-duplicate-string rule.
102
112
  */
103
113
  export declare const DEFAULT_LOG_PREFIX = "[micro-wt]";
114
+ /**
115
+ * WU-1336: Typed error for retry exhaustion in micro-worktree operations
116
+ *
117
+ * Thrown when push retries are exhausted due to race conditions with parallel agents.
118
+ * CLI commands should use `isRetryExhaustionError` to detect this error type and
119
+ * `formatRetryExhaustionError` to generate actionable user-facing messages.
120
+ *
121
+ * This centralizes retry exhaustion handling so CLI commands do not need to
122
+ * duplicate detection logic or error formatting.
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * import { RetryExhaustionError, isRetryExhaustionError, formatRetryExhaustionError } from '@lumenflow/core';
127
+ *
128
+ * try {
129
+ * await withMicroWorktree({ ... });
130
+ * } catch (error) {
131
+ * if (isRetryExhaustionError(error)) {
132
+ * console.error(formatRetryExhaustionError(error, { command: 'pnpm initiative:add-wu ...' }));
133
+ * } else {
134
+ * throw error;
135
+ * }
136
+ * }
137
+ * ```
138
+ */
139
+ export declare class RetryExhaustionError extends Error {
140
+ /** Name of the error class (for instanceof checks across module boundaries) */
141
+ readonly name = "RetryExhaustionError";
142
+ /** Operation that was being performed (e.g., 'initiative-add-wu') */
143
+ readonly operation: string;
144
+ /** Number of retry attempts that were exhausted */
145
+ readonly retries: number;
146
+ constructor(operation: string, retries: number);
147
+ }
148
+ /**
149
+ * WU-1336: Options for formatting retry exhaustion error messages
150
+ */
151
+ export interface FormatRetryExhaustionOptions {
152
+ /** Command to suggest for retrying (e.g., 'pnpm initiative:add-wu --wu WU-123 --initiative INIT-001') */
153
+ command: string;
154
+ }
155
+ /**
156
+ * WU-1336: Type guard to check if an error is a retry exhaustion error
157
+ *
158
+ * Detects both the typed `RetryExhaustionError` class and legacy error messages
159
+ * that match the "Push failed after N attempts" pattern.
160
+ *
161
+ * @param {unknown} error - Error to check
162
+ * @returns {boolean} True if this is a retry exhaustion error
163
+ *
164
+ * @example
165
+ * ```typescript
166
+ * if (isRetryExhaustionError(error)) {
167
+ * // Handle retry exhaustion
168
+ * }
169
+ * ```
170
+ */
171
+ export declare function isRetryExhaustionError(error: unknown): error is Error;
172
+ /**
173
+ * WU-1336: Format retry exhaustion error with actionable next steps
174
+ *
175
+ * When push retries are exhausted, provides clear guidance on how to proceed.
176
+ * CLI commands should use this instead of duplicating error formatting logic.
177
+ *
178
+ * @param {Error} error - The retry exhaustion error
179
+ * @param {FormatRetryExhaustionOptions} options - Formatting options
180
+ * @returns {string} Formatted error message with next steps
181
+ *
182
+ * @example
183
+ * ```typescript
184
+ * const message = formatRetryExhaustionError(error, {
185
+ * command: 'pnpm initiative:add-wu --wu WU-123 --initiative INIT-001',
186
+ * });
187
+ * console.error(message);
188
+ * ```
189
+ */
190
+ export declare function formatRetryExhaustionError(error: Error, options: FormatRetryExhaustionOptions): string;
191
+ /**
192
+ * WU-1308: Check if remote operations should be skipped based on git.requireRemote config
193
+ *
194
+ * When git.requireRemote is false, micro-worktree operations skip:
195
+ * - Fetching origin/main before starting
196
+ * - Pushing to origin/main after completion
197
+ *
198
+ * This enables local-only development without a remote repository.
199
+ *
200
+ * @returns {boolean} True if remote operations should be skipped (requireRemote=false)
201
+ *
202
+ * @example
203
+ * ```yaml
204
+ * # .lumenflow.config.yaml
205
+ * git:
206
+ * requireRemote: false # Enable local-only mode
207
+ * ```
208
+ */
209
+ export declare function shouldSkipRemoteOperations(): boolean;
104
210
  /**
105
211
  * Temp branch prefix for micro-worktree operations
106
212
  *
@@ -215,6 +321,23 @@ export declare function mergeWithRetry(tempBranchName: string, microWorktreePath
215
321
  * @throws {Error} If push fails after all retries
216
322
  */
217
323
  export declare function pushWithRetry(mainGit: GitAdapter, worktreeGit: GitAdapter, remote: string, branch: string, tempBranchName: string, logPrefix?: string): Promise<void>;
324
+ /**
325
+ * WU-1332: Push to origin with configurable retry using p-retry
326
+ *
327
+ * Enhanced version of pushWithRetry that uses p-retry for exponential backoff
328
+ * and supports configuration via PushRetryConfig. When push fails due to
329
+ * non-fast-forward (origin moved), automatically rebases and retries.
330
+ *
331
+ * @param {Object} mainGit - GitAdapter instance for main checkout
332
+ * @param {Object} worktreeGit - GitAdapter instance for micro-worktree
333
+ * @param {string} remote - Remote name (e.g., 'origin')
334
+ * @param {string} branch - Branch name (e.g., 'main')
335
+ * @param {string} tempBranchName - Temp branch that was merged (for rebase)
336
+ * @param {string} logPrefix - Log prefix for console output
337
+ * @param {PushRetryConfig} config - Push retry configuration
338
+ * @throws {Error} If push fails after all retries or if retry is disabled
339
+ */
340
+ export declare function pushWithRetryConfig(mainGit: GitAdapter, worktreeGit: GitAdapter, remote: string, branch: string, tempBranchName: string, logPrefix?: string, config?: PushRetryConfig): Promise<void>;
218
341
  /**
219
342
  * Push using refspec with LUMENFLOW_FORCE to bypass pre-push hooks
220
343
  *
@@ -234,6 +357,33 @@ export declare function pushWithRetry(mainGit: GitAdapter, worktreeGit: GitAdapt
234
357
  * @throws {Error} If push fails (env vars still restored)
235
358
  */
236
359
  export declare function pushRefspecWithForce(gitAdapter: GitAdapter, remote: string, localRef: string, remoteRef: string, reason: string): Promise<void>;
360
+ /**
361
+ * WU-1337: Push using refspec with LUMENFLOW_FORCE and retry logic
362
+ *
363
+ * Enhanced version of pushRefspecWithForce that adds retry with rebase
364
+ * on non-fast-forward errors. Uses p-retry for exponential backoff and
365
+ * respects git.push_retry configuration.
366
+ *
367
+ * On each retry:
368
+ * 1. Fetch origin/main to get latest state
369
+ * 2. Rebase the temp branch onto the updated main
370
+ * 3. Retry the push with LUMENFLOW_FORCE
371
+ *
372
+ * This is used by pushOnly mode in withMicroWorktree to handle race conditions
373
+ * when multiple agents are pushing to origin/main concurrently.
374
+ *
375
+ * @param {GitAdapter} gitWorktree - GitAdapter instance for the worktree (for rebase)
376
+ * @param {GitAdapter} mainGit - GitAdapter instance for main checkout (for fetch)
377
+ * @param {string} remote - Remote name (e.g., 'origin')
378
+ * @param {string} localRef - Local ref to push (e.g., 'tmp/wu-claim/wu-123')
379
+ * @param {string} remoteRef - Remote ref to update (e.g., 'main')
380
+ * @param {string} reason - Audit reason for the LUMENFLOW_FORCE bypass
381
+ * @param {string} logPrefix - Log prefix for console output
382
+ * @param {PushRetryConfig} config - Push retry configuration
383
+ * @returns {Promise<void>}
384
+ * @throws {RetryExhaustionError} If push fails after all retries
385
+ */
386
+ export declare function pushRefspecWithRetry(gitWorktree: GitAdapter, mainGit: GitAdapter, remote: string, localRef: string, remoteRef: string, reason: string, logPrefix?: string, config?: PushRetryConfig): Promise<void>;
237
387
  /**
238
388
  * Execute an operation in a micro-worktree with full isolation
239
389
  *
@@ -243,6 +393,7 @@ export declare function pushRefspecWithForce(gitAdapter: GitAdapter, remote: str
243
393
  *
244
394
  * WU-1435: Added pushOnly option to keep local main pristine.
245
395
  * WU-2237: Added pre-creation cleanup of orphaned temp branches/worktrees.
396
+ * WU-1337: Push-only path now uses retry with rebase.
246
397
  *
247
398
  * @param {Object} options - Options for the operation
248
399
  * @param {string} options.operation - Operation name (e.g., 'wu-create', 'wu-edit')