A saved snapshot of your macOS configuration. Contains sections like Homebrew packages, shell config, git settings, etc.
- Stored as JSON in
~/.skel/profiles/ - Loaded and modified during
scanandrestorecommands
A logical group of related config (e.g., "homebrew", "shell", "git").
- Each section is restorable independently (with
--only) - Blocked if required tools are missing
Sections that have actual data to restore. Not all sections may have data in a profile.
- "Homebrew" is restorable if profile.Homebrew.Formulas is not empty
- "Shell" is restorable if shell config was saved
A section that can't be restored because required tools are missing.
- Example: Can't restore "homebrew" section if
brewcommand isn't installed - UI shows blocked sections with ⚠ icon in interactive mode
The keys that identify a section in the Sections map.
- Defined per
ScanGroupincmd/section_registry.go - Example: ScanGroup for Homebrew has RestoreKeys = ["homebrew", "mas"]
- Both "homebrew" and "mas" are blocked if "brew" is missing
Metadata + functions for a restore section.
type ScanGroup struct {
Icon string // 🍺 for Homebrew
Label string // "Homebrew"
RestoreKeys []string // ["homebrew", "mas"]
ScanFunc func(...) // how to capture this section
RestoreFunc func(...) // how to restore this section
}Defined in cmd/section_registry.go and used throughout the app.
A rule that says: "If profile has data X, tool Y is required to restore it".
{
Section: "homebrew",
Tool: "brew",
Needed: func(p *Profile) bool {
return len(p.Homebrew.Formulas) > 0
},
}See internal/app/doctor/service.go.
A validation row showing:
- Tool name (label)
- Whether it's installed (OK)
- How to install it if missing (Fix)
Example output:
✓ Homebrew
✗ Node.js
→ brew install node
A shell command that exec.LookPath() searches for in PATH.
- Usually the tool name (e.g., "brew", "git")
- Sometimes different (e.g., "pip3" validates Python)
A terminal UI framework (go-tea/bubbletea).
- Used for interactive selection in
cmd/tui/ - Provides keyboard input, rendering, state management
Preview mode: show what would be restored without actually making changes.
- Each section prints what it would do (e.g., "Would install 3 packages")
- Use:
skel restore --dry-run
User is prompted to select sections to restore via keyboard.
- Requires TTY (terminal)
- Alternative: non-interactive mode skips UI and restores all sections
Limit restore to specific sections.
- Example:
skel restore --only shell,git - Skips interactive UI if specified
- Used to restore without user input
~/.skel/profiles/ - where profiles are stored as JSON files.
The filename (without .json) of a profile.
- Example:
default.json→ profile name is "default" - Passed to
skel restore default
Preview text showing what would be installed/changed.
- Printed to stdout before actual restore begins
Using %w format verb to preserve error chain.
return fmt.Errorf("restore failed: %w", err)Allows caller to unwrap errors and find root cause.
Adding context to an error before returning (via enhanceError()).
- Makes error messages more user-friendly
- Adds suggestions for fixing the problem
Exiting a function as soon as you know it will fail or succeed.
if someCondition {
return defaultValue
}
// Continue with main logicReduces nesting and improves readability.
A function passed as a parameter that captures variables from outer scope.
RequiredToolsForSections(p, func(section string) bool {
return opts.Sections[section] // captures opts from outer scope
})Verifying a pointer isn't nil before using it.
if g.ScanSummary != nil {
summary := g.ScanSummary(p)
}Required in Go; no automatic null checking.
Creating a struct with named fields.
SelectItem{
Icon: g.Icon,
Label: g.Label,
Selected: true,
}Self-documenting; easier to read than positional arguments.
Capture current Mac configuration → save to profile file.
Load a profile and restore it (interactive or non-interactive).
Validate that all tools needed by profile are installed.
Show all saved profiles.
Display profile contents (what's in it).
Preview what would be restored (no actual changes).
Restore only specific sections (comma-separated).