@brimveyn/aimux-config 0.5.2 → 0.5.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimveyn/aimux-config",
3
- "version": "0.5.2",
3
+ "version": "0.5.5",
4
4
  "description": "TypeScript configuration API for aimux — keymaps, themes, and backends with a fluent builder.",
5
5
  "keywords": [
6
6
  "aimux",
package/src/actions.ts CHANGED
@@ -547,6 +547,64 @@ export const gitDestructiveSelected: ActionFn = (ctx: ModeContext) => {
547
547
  return r([{ path: file.path, type: 'git-mode-set-pending-delete' }])
548
548
  }
549
549
 
550
+ export const gitToggleFoldAll: ActionFn = (ctx: ModeContext) => {
551
+ const file = selectedGitFile(ctx)
552
+ if (!file) return r([])
553
+ const key = gitFileKey(file.section, file.path)
554
+ return r([{ key, type: 'git-mode-fold-toggle-all' }])
555
+ }
556
+
557
+ export const gitStageAll: ActionFn = (ctx: ModeContext) => {
558
+ if (ctx.state.gitMode.headOffset > 0) {
559
+ return r([
560
+ {
561
+ message: 'disabled while viewing HEAD~N (press 0 or [ to return)',
562
+ type: 'git-mode-set-message',
563
+ },
564
+ ])
565
+ }
566
+ const files = ctx.state.gitPanel.files
567
+ const pending = clearPendingDelete(ctx)
568
+ if (files.length === 0) return r(pending)
569
+ const actions: AppAction[] = [...pending]
570
+ for (const f of files) {
571
+ if (f.section === 'staged') continue
572
+ actions.push({
573
+ fromSection: f.section,
574
+ path: f.path,
575
+ toSection: 'staged',
576
+ type: 'git-mode-optimistic-move',
577
+ })
578
+ }
579
+ return r(actions, [{ type: 'git-stage-all' }])
580
+ }
581
+
582
+ export const gitUnstageAll: ActionFn = (ctx: ModeContext) => {
583
+ if (ctx.state.gitMode.headOffset > 0) {
584
+ return r([
585
+ {
586
+ message: 'disabled while viewing HEAD~N (press 0 or [ to return)',
587
+ type: 'git-mode-set-message',
588
+ },
589
+ ])
590
+ }
591
+ const files = ctx.state.gitPanel.files
592
+ const pending = clearPendingDelete(ctx)
593
+ if (files.length === 0) return r(pending)
594
+ const actions: AppAction[] = [...pending]
595
+ for (const f of files) {
596
+ if (f.section !== 'staged') continue
597
+ const toSection = f.status === 'A' ? 'untracked' : 'unstaged'
598
+ actions.push({
599
+ fromSection: 'staged',
600
+ path: f.path,
601
+ toSection,
602
+ type: 'git-mode-optimistic-move',
603
+ })
604
+ }
605
+ return r(actions, [{ type: 'git-unstage-all' }])
606
+ }
607
+
550
608
  export const gitCommitOpen: ActionFn = (ctx: ModeContext) => {
551
609
  if (ctx.state.gitMode.headOffset > 0) {
552
610
  return r([
package/src/defaults.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AutoCommitConfig, ResolvedKeymapConfig } from './types'
1
+ import type { AutoCommitConfig, MultiRepoConfig, ResolvedKeymapConfig } from './types'
2
2
 
3
3
  import * as actions from './actions'
4
4
  import { KeymapBuilder } from './keymap-builder'
@@ -12,6 +12,11 @@ export const DEFAULT_AUTO_COMMIT_CONFIG: AutoCommitConfig = {
12
12
  timeoutMs: 60_000,
13
13
  }
14
14
 
15
+ export const DEFAULT_MULTI_REPO_CONFIG: MultiRepoConfig = {
16
+ enabled: true,
17
+ maxDepth: 1,
18
+ }
19
+
15
20
  /**
16
21
  * Build the default keymap — 1:1 transcription of all existing handlers.
17
22
  */
@@ -93,7 +98,10 @@ export function getDefaultKeymapConfig(): ResolvedKeymapConfig {
93
98
  .mode('git-mode', (m) =>
94
99
  m
95
100
  .map('a', actions.gitStageSelected, 'Stage')
101
+ .map('A', actions.gitStageAll, 'Stage all')
96
102
  .map('d', actions.gitDestructiveSelected, 'Unstage/delete')
103
+ .map('D', actions.gitUnstageAll, 'Unstage all')
104
+ .map('e', actions.gitToggleFoldAll, 'Expand/collapse all folds')
97
105
  .map('c', actions.gitCommitOpen, 'Commit')
98
106
  .map('p', actions.gitPush, 'Push')
99
107
  .map('v', actions.toggleGitDiffView, 'Toggle split/stacked')
package/src/index.ts CHANGED
@@ -25,6 +25,8 @@ export { GroupBuilder, KeymapBuilder, ModeBindingBuilder } from './keymap-builde
25
25
  export { getDefaultKeymapConfig } from './defaults'
26
26
  export { resolveConfig } from './resolver'
27
27
  export { isAutoCommitEnabled, setAutoCommitEnabled } from './auto-commit-runtime'
28
+ export { getMultiRepoConfig, setMultiRepoConfig } from './multi-repo-runtime'
29
+ export { DEFAULT_MULTI_REPO_CONFIG } from './defaults'
28
30
 
29
31
  // Type exports
30
32
  export type {
@@ -43,6 +45,7 @@ export type {
43
45
  AutoCommitConfig,
44
46
  BackendConfig,
45
47
  BindingDef,
48
+ DiscoveredRepo,
46
49
  FocusMode,
47
50
  GitFileListMode,
48
51
  GitPaneConfig,
@@ -65,6 +68,8 @@ export type {
65
68
  // Mode / state
66
69
  ModeId,
67
70
  ModeKeymapDef,
71
+ MultiRepoConfig,
72
+ MultiRepoState,
68
73
  // Resolved config (internal, but exported for tooling)
69
74
  ResolvedConfig,
70
75
  ResolvedKeymapConfig,
@@ -0,0 +1,20 @@
1
+ import type { MultiRepoConfig } from './types'
2
+
3
+ import { DEFAULT_MULTI_REPO_CONFIG } from './defaults'
4
+
5
+ /**
6
+ * Module-level mirror of `multiRepo` from the resolved config.
7
+ *
8
+ * Set once at startup via `setMultiRepoConfig(resolvedConfig.multiRepo)`. Read
9
+ * by non-React code paths (discovery, poller merge) that need the flag and depth.
10
+ */
11
+
12
+ let current: MultiRepoConfig = DEFAULT_MULTI_REPO_CONFIG
13
+
14
+ export function setMultiRepoConfig(value: MultiRepoConfig): void {
15
+ current = value
16
+ }
17
+
18
+ export function getMultiRepoConfig(): MultiRepoConfig {
19
+ return current
20
+ }
package/src/resolver.ts CHANGED
@@ -3,11 +3,16 @@ import type {
3
3
  AutoCommitConfig,
4
4
  ModeId,
5
5
  ModeKeymapDef,
6
+ MultiRepoConfig,
6
7
  ResolvedConfig,
7
8
  ResolvedKeymapConfig,
8
9
  } from './types'
9
10
 
10
- import { DEFAULT_AUTO_COMMIT_CONFIG, getDefaultKeymapConfig } from './defaults'
11
+ import {
12
+ DEFAULT_AUTO_COMMIT_CONFIG,
13
+ DEFAULT_MULTI_REPO_CONFIG,
14
+ getDefaultKeymapConfig,
15
+ } from './defaults'
11
16
  import { KeymapBuilder } from './keymap-builder'
12
17
 
13
18
  /**
@@ -23,12 +28,18 @@ export function resolveConfig(userConfig: AimuxUserConfig): ResolvedConfig {
23
28
  timeoutMs: userConfig.autoCommit?.timeoutMs ?? DEFAULT_AUTO_COMMIT_CONFIG.timeoutMs,
24
29
  }
25
30
 
31
+ const multiRepo: MultiRepoConfig = {
32
+ enabled: userConfig.multiRepo?.enabled ?? DEFAULT_MULTI_REPO_CONFIG.enabled,
33
+ maxDepth: Math.max(1, userConfig.multiRepo?.maxDepth ?? DEFAULT_MULTI_REPO_CONFIG.maxDepth),
34
+ }
35
+
26
36
  return {
27
37
  autoCommit,
28
38
  backends: userConfig.backends ?? {},
29
39
  gitPane: resolveGitPane(userConfig.gitPane),
30
40
  hooks: userConfig.hooks ?? {},
31
41
  keymaps,
42
+ multiRepo,
32
43
  sessionBar: resolveSessionBar(userConfig.sessionBar),
33
44
  sidebar: userConfig.sidebar ?? {},
34
45
  snippets: userConfig.snippets ?? [],
package/src/types.ts CHANGED
@@ -363,6 +363,17 @@ export interface AutoCommitState {
363
363
  bySession: Record<string, AutoCommitSuggestion>
364
364
  }
365
365
 
366
+ export interface DiscoveredRepo {
367
+ path: string
368
+ name: string
369
+ isRoot: boolean
370
+ }
371
+
372
+ export interface MultiRepoState {
373
+ repos: DiscoveredRepo[]
374
+ prefixes: Record<string, string>
375
+ }
376
+
366
377
  export interface AppState {
367
378
  tabs: TabSession[]
368
379
  activeTabId: string | null
@@ -382,6 +393,7 @@ export interface AppState {
382
393
  gitPanel: GitPanelState
383
394
  gitMode: GitModeState
384
395
  autoCommit: AutoCommitState
396
+ multiRepo: MultiRepoState
385
397
  pendingChords: string[] | null
386
398
  }
387
399
 
@@ -531,6 +543,7 @@ export type GitModeAction =
531
543
  delta: number
532
544
  }
533
545
  | { type: 'git-mode-fold-set'; key: string; foldId: string; top: number; bottom: number }
546
+ | { type: 'git-mode-fold-toggle-all'; key: string }
534
547
  | {
535
548
  type: 'git-mode-optimistic-move'
536
549
  path: string
@@ -607,6 +620,8 @@ export type SideEffect =
607
620
  | { type: 'persist-git-tree-compaction'; enabled: boolean }
608
621
  | { type: 'git-stage'; path: string }
609
622
  | { type: 'git-unstage'; path: string }
623
+ | { type: 'git-stage-all' }
624
+ | { type: 'git-unstage-all' }
610
625
  | { type: 'git-restore'; path: string }
611
626
  | { type: 'git-rm'; path: string }
612
627
  | { type: 'git-commit'; title: string; body: string }
@@ -823,6 +838,13 @@ export interface AutoCommitConfig {
823
838
  models: Partial<Record<string, string>>
824
839
  }
825
840
 
841
+ export interface MultiRepoConfig {
842
+ /** When true, scan projectPath for nested git repos and aggregate their status into the git panel. */
843
+ enabled: boolean
844
+ /** How deep to scan below projectPath when discovering sub-repos. 1 = immediate children only. */
845
+ maxDepth: number
846
+ }
847
+
826
848
  export interface AimuxThemeConfig {
827
849
  /** Startup override for light/dark theme family. Reapplied on each launch. */
828
850
  initialMode?: ThemeMode
@@ -855,6 +877,7 @@ export interface AimuxUserConfig {
855
877
  hooks?: HooksConfig
856
878
  snippets?: SnippetDef[]
857
879
  autoCommit?: Partial<AutoCommitConfig>
880
+ multiRepo?: Partial<MultiRepoConfig>
858
881
  statusBar?: StatusBarConfig
859
882
  }
860
883
 
@@ -922,5 +945,6 @@ export interface ResolvedConfig {
922
945
  hooks: HooksConfig
923
946
  snippets: SnippetDef[]
924
947
  autoCommit: AutoCommitConfig
948
+ multiRepo: MultiRepoConfig
925
949
  statusBar: StatusBarConfig
926
950
  }