@brimveyn/aimux-config 0.5.9 → 0.5.12

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.9",
3
+ "version": "0.5.12",
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
@@ -635,6 +635,12 @@ export const gitPush: ActionFn = (ctx: ModeContext) => {
635
635
  return r(clearPendingDelete(ctx), [{ type: 'git-push' }])
636
636
  }
637
637
 
638
+ export const openSelectedGitFileInEditor: ActionFn = (ctx: ModeContext) => {
639
+ const file = selectedGitFile(ctx)
640
+ if (!file) return r([])
641
+ return r([], [{ path: file.path, type: 'open-file-in-editor' }])
642
+ }
643
+
638
644
  // ---------------------------------------------------------------------------
639
645
  // Modal: git-commit
640
646
  // ---------------------------------------------------------------------------
package/src/defaults.ts CHANGED
@@ -102,6 +102,7 @@ export function getDefaultKeymapConfig(): ResolvedKeymapConfig {
102
102
  .map('d', actions.gitDestructiveSelected, 'Unstage/delete')
103
103
  .map('D', actions.gitUnstageAll, 'Unstage all')
104
104
  .map('e', actions.gitToggleFoldAll, 'Expand/collapse all folds')
105
+ .map('o', actions.openSelectedGitFileInEditor, 'Open in editor')
105
106
  .map('c', actions.gitCommitOpen, 'Commit')
106
107
  .map('p', actions.gitPush, 'Push')
107
108
  .map('v', actions.toggleGitDiffView, 'Toggle split/stacked')
@@ -0,0 +1,78 @@
1
+ import type { ExternalEditorConfig } from './types'
2
+
3
+ /**
4
+ * Holds the resolved external-editor config so side effects (which run outside
5
+ * React) can read it synchronously. Set once at startup by the app.
6
+ */
7
+
8
+ let current: ExternalEditorConfig = {}
9
+
10
+ export function setExternalEditorConfig(value: ExternalEditorConfig): void {
11
+ current = value
12
+ }
13
+
14
+ export function getExternalEditorConfig(): ExternalEditorConfig {
15
+ return current
16
+ }
17
+
18
+ /** Editors known to be GUI — spawned detached so they don't claim aimux's TTY. */
19
+ export const KNOWN_GUI_EDITORS: ReadonlySet<string> = new Set([
20
+ 'appcode',
21
+ 'atom',
22
+ 'clion',
23
+ 'code',
24
+ 'code-insiders',
25
+ 'codium',
26
+ 'cursor',
27
+ 'datagrip',
28
+ 'fleet',
29
+ 'gedit',
30
+ 'goland',
31
+ 'gvim',
32
+ 'idea',
33
+ 'kate',
34
+ 'macvim',
35
+ 'mate',
36
+ 'mvim',
37
+ 'phpstorm',
38
+ 'pycharm',
39
+ 'rider',
40
+ 'rubymine',
41
+ 'subl',
42
+ 'sublime_text',
43
+ 'vscodium',
44
+ 'webstorm',
45
+ 'windsurf',
46
+ 'zed',
47
+ ])
48
+
49
+ /** Per-editor default argv with `{file}` / `{line}` placeholders. */
50
+ export const DEFAULT_EDITOR_ARGS: Record<string, string[]> = {
51
+ 'clion': ['--line', '{line}', '{file}'],
52
+ 'code': ['-g', '{file}:{line}'],
53
+ 'code-insiders': ['-g', '{file}:{line}'],
54
+ 'codium': ['-g', '{file}:{line}'],
55
+ 'cursor': ['-g', '{file}:{line}'],
56
+ 'emacs': ['+{line}', '{file}'],
57
+ 'fleet': ['{file}:{line}'],
58
+ 'goland': ['--line', '{line}', '{file}'],
59
+ 'gvim': ['+{line}', '{file}'],
60
+ 'helix': ['{file}:{line}'],
61
+ 'hx': ['{file}:{line}'],
62
+ 'idea': ['--line', '{line}', '{file}'],
63
+ 'micro': ['{file}:{line}'],
64
+ 'mvim': ['+{line}', '{file}'],
65
+ 'nano': ['+{line}', '{file}'],
66
+ 'nvim': ['+{line}', '{file}'],
67
+ 'phpstorm': ['--line', '{line}', '{file}'],
68
+ 'pycharm': ['--line', '{line}', '{file}'],
69
+ 'rider': ['--line', '{line}', '{file}'],
70
+ 'rubymine': ['--line', '{line}', '{file}'],
71
+ 'subl': ['{file}:{line}'],
72
+ 'sublime_text': ['{file}:{line}'],
73
+ 'vim': ['+{line}', '{file}'],
74
+ 'vscodium': ['-g', '{file}:{line}'],
75
+ 'webstorm': ['--line', '{line}', '{file}'],
76
+ 'windsurf': ['-g', '{file}:{line}'],
77
+ 'zed': ['{file}:{line}'],
78
+ }
package/src/index.ts CHANGED
@@ -29,6 +29,12 @@ export { getDefaultKeymapConfig } from './defaults'
29
29
  export { resolveConfig } from './resolver'
30
30
  export { isAutoCommitEnabled, setAutoCommitEnabled } from './auto-commit-runtime'
31
31
  export { getMultiRepoConfig, setMultiRepoConfig } from './multi-repo-runtime'
32
+ export {
33
+ DEFAULT_EDITOR_ARGS,
34
+ getExternalEditorConfig,
35
+ KNOWN_GUI_EDITORS,
36
+ setExternalEditorConfig,
37
+ } from './external-editor-runtime'
32
38
  export { DEFAULT_MULTI_REPO_CONFIG } from './defaults'
33
39
 
34
40
  // User-facing config types (keymap/backends/sessions/etc.).
@@ -45,6 +51,7 @@ export type {
45
51
  BackendConfig,
46
52
  BindingDef,
47
53
  DiscoveredRepo,
54
+ ExternalEditorConfig,
48
55
  FocusMode,
49
56
  GitFileListMode,
50
57
  GitPaneConfig,
package/src/resolver.ts CHANGED
@@ -36,6 +36,7 @@ export function resolveConfig(userConfig: AimuxUserConfig): ResolvedConfig {
36
36
  return {
37
37
  autoCommit,
38
38
  backends: userConfig.backends ?? {},
39
+ externalEditor: userConfig.externalEditor ?? {},
39
40
  gitPane: resolveGitPane(userConfig.gitPane),
40
41
  hooks: userConfig.hooks ?? {},
41
42
  keymaps,
package/src/types.ts CHANGED
@@ -204,7 +204,7 @@ export interface GitPanelState {
204
204
  error: GitPanelError | null
205
205
  }
206
206
 
207
- export type DiffFileStatus = 'modified' | 'new' | 'deleted' | 'binary' | 'renamed'
207
+ export type DiffFileStatus = 'modified' | 'new' | 'deleted' | 'binary' | 'renamed' | 'image'
208
208
 
209
209
  export interface DiffData {
210
210
  path: string
@@ -214,6 +214,10 @@ export interface DiffData {
214
214
  binarySizeBefore?: number
215
215
  binarySizeAfter?: number
216
216
  errorMessage?: string
217
+ imageBytesBefore?: Uint8Array
218
+ imageBytesAfter?: Uint8Array
219
+ imageMime?: string
220
+ imageFormatLabel?: string
217
221
  }
218
222
 
219
223
  export type GitDiffView = 'split' | 'stacked'
@@ -633,6 +637,7 @@ export type SideEffect =
633
637
  | { type: 'delete-session'; sessionId: string }
634
638
  | { type: 'toggle-transparent' }
635
639
  | { type: 'toggle-mode' }
640
+ | { type: 'open-file-in-editor'; path: string }
636
641
 
637
642
  // ─── Key input / KeyResult / ModeContext ──────────────────────────────────────
638
643
 
@@ -854,6 +859,29 @@ export interface StatusBarConfig {
854
859
  aiUsage?: AIUsageToolConfig
855
860
  }
856
861
 
862
+ export interface ExternalEditorConfig {
863
+ /** Override `$VISUAL` / `$EDITOR`. */
864
+ command?: string
865
+ /**
866
+ * Force GUI (detached spawn — for vscode/cursor/etc.) or TUI (inline shellout
867
+ * that hands the TTY to the editor). Defaults: GUI for editors in a built-in
868
+ * allowlist (`code`, `cursor`, `subl`, JetBrains, …), TUI otherwise.
869
+ */
870
+ kind?: 'gui' | 'tui'
871
+ /** Argv passed to the editor. Placeholders: `{file}`, `{line}`. Sensible defaults per known editor. */
872
+ args?: string[]
873
+ /**
874
+ * Opt-in escape hatch for TUI editors only: when set, the TUI editor is
875
+ * launched in a new terminal window using this argv template instead of the
876
+ * default inline shellout. Ignored when `kind` resolves to `'gui'` — GUI
877
+ * editors always spawn detached into their own app window.
878
+ *
879
+ * Placeholders: `{cmd}` (shell-quoted `cd <cwd> && <editor> <args>`), `{cwd}`.
880
+ * Example: `['wezterm', 'start', '--cwd', '{cwd}', '--', 'sh', '-c', '{cmd}']`.
881
+ */
882
+ terminal?: string[]
883
+ }
884
+
857
885
  export interface AimuxUserConfig {
858
886
  theme?: AimuxThemeConfig
859
887
  keymaps?: (k: KeymapBuilderApi) => KeymapBuilderApi
@@ -866,6 +894,7 @@ export interface AimuxUserConfig {
866
894
  autoCommit?: Partial<AutoCommitConfig>
867
895
  multiRepo?: Partial<MultiRepoConfig>
868
896
  statusBar?: StatusBarConfig
897
+ externalEditor?: ExternalEditorConfig
869
898
  }
870
899
 
871
900
  // ─── Resolved config (internal) ───────────────────────────────────────────────
@@ -938,4 +967,5 @@ export interface ResolvedConfig {
938
967
  autoCommit: AutoCommitConfig
939
968
  multiRepo: MultiRepoConfig
940
969
  statusBar: StatusBarConfig
970
+ externalEditor: ExternalEditorConfig
941
971
  }