@brimveyn/aimux-config 0.6.10 → 0.6.11
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/package.json +1 -1
- package/src/actions.ts +25 -1
- package/src/defaults.ts +11 -0
- package/src/types.ts +38 -0
package/package.json
CHANGED
package/src/actions.ts
CHANGED
|
@@ -403,7 +403,10 @@ export const openWorktreeMove: ActionFn = (ctx: ModeContext) => {
|
|
|
403
403
|
}
|
|
404
404
|
// Overlay: no mode transition — deriveModeId routes input to the picker and
|
|
405
405
|
// focusMode stays 'git' so the git view remains mounted underneath.
|
|
406
|
-
return r(
|
|
406
|
+
return r(
|
|
407
|
+
[{ sourceWorktreeId: source.id, type: 'open-worktree-move-modal' }],
|
|
408
|
+
[{ type: 'load-worktree-move-stats' }]
|
|
409
|
+
)
|
|
407
410
|
}
|
|
408
411
|
|
|
409
412
|
export const toggleWorktreeMoveDelete: KeyResult = r([{ type: 'toggle-worktree-move-delete' }])
|
|
@@ -436,6 +439,27 @@ export const confirmWorktreeMove: ActionFn = (ctx: ModeContext) => {
|
|
|
436
439
|
)
|
|
437
440
|
}
|
|
438
441
|
|
|
442
|
+
// Confirms the dialog opened after a recoverable move failure: re-runs the
|
|
443
|
+
// move with the flag matching the failure (stash the target / keep conflicts).
|
|
444
|
+
export const confirmWorktreeMoveRetry: ActionFn = (ctx: ModeContext) => {
|
|
445
|
+
const modal = ctx.state.modal
|
|
446
|
+
if (modal.type !== 'worktree-move-confirm') return null
|
|
447
|
+
return r(
|
|
448
|
+
[{ type: 'close-modal' }],
|
|
449
|
+
[
|
|
450
|
+
{
|
|
451
|
+
deleteSource: modal.deleteSource,
|
|
452
|
+
sessionId: modal.sessionId,
|
|
453
|
+
sourceWorktreeId: modal.sourceWorktreeId,
|
|
454
|
+
targetWorktreeId: modal.targetWorktreeId,
|
|
455
|
+
type: 'move-worktree',
|
|
456
|
+
...(modal.variant === 'stash-target' ? { stashTarget: true } : { keepConflicts: true }),
|
|
457
|
+
},
|
|
458
|
+
],
|
|
459
|
+
'navigation'
|
|
460
|
+
)
|
|
461
|
+
}
|
|
462
|
+
|
|
439
463
|
export const closePane: ActionFn = (ctx: ModeContext) => {
|
|
440
464
|
const tabId = ctx.state.activeTabId
|
|
441
465
|
if (!(tabId != null && tabId !== '')) return null
|
package/src/defaults.ts
CHANGED
|
@@ -204,6 +204,17 @@ export function getDefaultKeymapConfig(): ResolvedKeymapConfig {
|
|
|
204
204
|
.map('<CR>', actions.confirmWorktreeMove, 'Move')
|
|
205
205
|
)
|
|
206
206
|
|
|
207
|
+
// -----------------------------------------------------------------------
|
|
208
|
+
// Modal: worktree-move recoverable-failure confirmation (stash / conflicts)
|
|
209
|
+
// -----------------------------------------------------------------------
|
|
210
|
+
.mode('modal.worktree-move-confirm', (m) =>
|
|
211
|
+
m
|
|
212
|
+
.map('<Esc>', actions.closeModal, 'Cancel')
|
|
213
|
+
.map('n', actions.closeModal, 'Cancel')
|
|
214
|
+
.map('<CR>', actions.confirmWorktreeMoveRetry, 'Confirm')
|
|
215
|
+
.map('y', actions.confirmWorktreeMoveRetry, 'Confirm')
|
|
216
|
+
)
|
|
217
|
+
|
|
207
218
|
// -----------------------------------------------------------------------
|
|
208
219
|
// Modal: standalone worktree delete confirmation (sidebar "Remove worktree")
|
|
209
220
|
// -----------------------------------------------------------------------
|
package/src/types.ts
CHANGED
|
@@ -30,6 +30,7 @@ export type ModeId =
|
|
|
30
30
|
| 'modal.git-commit.generating'
|
|
31
31
|
| 'modal.update-available'
|
|
32
32
|
| 'modal.worktree-move'
|
|
33
|
+
| 'modal.worktree-move-confirm'
|
|
33
34
|
| 'modal.ai-usage'
|
|
34
35
|
|
|
35
36
|
// ─── Primitive app types ──────────────────────────────────────────────────────
|
|
@@ -378,6 +379,26 @@ export interface ModalWorktreeMove extends ModalBase {
|
|
|
378
379
|
/** The worktree being moved (may differ from the active one, e.g. a tab menu). */
|
|
379
380
|
sourceWorktreeId: string
|
|
380
381
|
deleteSource: boolean
|
|
382
|
+
/** Per-worktree dirty file counts, loaded async when the modal opens. */
|
|
383
|
+
stats: { kind: 'loading' } | { kind: 'ready'; dirtyFiles: Record<string, number> }
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Confirmation for a recoverable move failure: the target's dirty files
|
|
388
|
+
* overlap the incoming changes (stash-target) or the squash conflicts
|
|
389
|
+
* (keep-conflicts). Both worktrees are already restored; confirming re-runs
|
|
390
|
+
* move-worktree with the matching flag.
|
|
391
|
+
*/
|
|
392
|
+
export interface ModalWorktreeMoveConfirm extends ModalBase {
|
|
393
|
+
type: 'worktree-move-confirm'
|
|
394
|
+
variant: 'stash-target' | 'keep-conflicts'
|
|
395
|
+
files: string[]
|
|
396
|
+
sessionId: string
|
|
397
|
+
sourceWorktreeId: string
|
|
398
|
+
targetWorktreeId: string
|
|
399
|
+
deleteSource: boolean
|
|
400
|
+
sourceLabel: string
|
|
401
|
+
targetLabel: string
|
|
381
402
|
}
|
|
382
403
|
|
|
383
404
|
/**
|
|
@@ -412,6 +433,7 @@ export type ModalState =
|
|
|
412
433
|
| ModalUpdateAvailable
|
|
413
434
|
| ModalAIUsage
|
|
414
435
|
| ModalWorktreeMove
|
|
436
|
+
| ModalWorktreeMoveConfirm
|
|
415
437
|
| ModalWorktreeDeleteConfirm
|
|
416
438
|
|
|
417
439
|
export interface LayoutState {
|
|
@@ -526,6 +548,18 @@ export type ModalAction =
|
|
|
526
548
|
| { type: 'open-edit-custom-command'; assistantId: AssistantId }
|
|
527
549
|
| { type: 'open-worktree-move-modal'; sourceWorktreeId: string }
|
|
528
550
|
| { type: 'toggle-worktree-move-delete' }
|
|
551
|
+
| { type: 'set-worktree-move-stats'; dirtyFiles: Record<string, number> }
|
|
552
|
+
| {
|
|
553
|
+
type: 'open-worktree-move-confirm'
|
|
554
|
+
variant: 'stash-target' | 'keep-conflicts'
|
|
555
|
+
files: string[]
|
|
556
|
+
sessionId: string
|
|
557
|
+
sourceWorktreeId: string
|
|
558
|
+
targetWorktreeId: string
|
|
559
|
+
deleteSource: boolean
|
|
560
|
+
sourceLabel: string
|
|
561
|
+
targetLabel: string
|
|
562
|
+
}
|
|
529
563
|
| {
|
|
530
564
|
type: 'open-worktree-delete-confirm'
|
|
531
565
|
sessionId: string
|
|
@@ -799,7 +833,11 @@ export type SideEffect =
|
|
|
799
833
|
sourceWorktreeId: string
|
|
800
834
|
targetWorktreeId: string
|
|
801
835
|
deleteSource?: boolean
|
|
836
|
+
// Retry flags set by the worktree-move-confirm dialog.
|
|
837
|
+
stashTarget?: boolean
|
|
838
|
+
keepConflicts?: boolean
|
|
802
839
|
}
|
|
840
|
+
| { type: 'load-worktree-move-stats' }
|
|
803
841
|
| { type: 'toggle-transparent' }
|
|
804
842
|
| { type: 'toggle-mode' }
|
|
805
843
|
| { type: 'open-file-in-editor'; path: string }
|