config_migrator.go RawHistoryFolder

1package port
2
3// MigrationResult contains the result of a config migration check.
4type MigrationResult struct {
5	// MissingKeys contains the keys that exist in defaults but not in user config.
6	MissingKeys []string
7	// ConfigFile is the path to the user's config file.
8	ConfigFile string
9}
10
11// KeyInfo contains metadata about a config key for display purposes.
12type KeyInfo struct {
13	// Key is the dot-notation key path (e.g., "update.enable_on_startup").
14	Key string
15	// Type is the Go type of the value (e.g., "bool", "int", "string").
16	Type string
17	// DefaultValue is a string representation of the default value.
18	DefaultValue string
19}
20
21// KeyChangeType indicates the type of config key change.
22type KeyChangeType int
23
24const (
25	// KeyChangeAdded indicates a new key was added to defaults.
26	KeyChangeAdded KeyChangeType = iota
27	// KeyChangeRemoved indicates a key in user config no longer exists in defaults.
28	KeyChangeRemoved
29	// KeyChangeRenamed indicates a key was renamed (detected via similarity).
30	KeyChangeRenamed
31)
32
33// String returns a display symbol for the change type.
34func (t KeyChangeType) String() string {
35	switch t {
36	case KeyChangeAdded:
37		return "+"
38	case KeyChangeRemoved:
39		return "-"
40	case KeyChangeRenamed:
41		return "~"
42	default:
43		return "?"
44	}
45}
46
47// KeyChange represents a detected change between user config and defaults.
48type KeyChange struct {
49	Type     KeyChangeType // Type of change
50	OldKey   string        // Old key name (for removed/renamed)
51	NewKey   string        // New key name (for added/renamed)
52	OldValue string        // Old value (for renamed/consolidated)
53	NewValue string        // New/default value
54}
55
56// ConfigMigrator checks for and applies config migrations.
57type ConfigMigrator interface {
58	// CheckMigration checks if user config is missing any default keys.
59	// Returns nil if no migration is needed (config file doesn't exist or is complete).
60	CheckMigration() (*MigrationResult, error)
61
62	// DetectChanges analyzes user config and returns all detected changes.
63	// This provides a detailed diff-like view of what migration would do.
64	DetectChanges() ([]KeyChange, error)
65
66	// Migrate adds missing default keys and removes deprecated keys from the user's config file.
67	// Returns the list of keys that were added/renamed/removed.
68	Migrate() ([]string, error)
69
70	// GetKeyInfo returns detailed information about a config key.
71	GetKeyInfo(key string) KeyInfo
72
73	// GetConfigFile returns the path to the user's config file.
74	GetConfigFile() (string, error)
75}
76
77// DiffFormatter formats config changes for display.
78type DiffFormatter interface {
79	// FormatChangesAsDiff returns changes formatted as a diff-like string for display.
80	FormatChangesAsDiff(changes []KeyChange) string
81}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close