dotfiles-system

Detects operating systems and executes platform-specific commands in Go installer code.

Updated Mar 7, 2026
One-click install
npx skills add https://github.com/albersg/dotfiles --skill dotfiles-system-albersg
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotfiles-system
Source: https://github.com/albersg/dotfiles/tree/main/skills/dotfiles-system
Command: npx skills add https://github.com/albersg/dotfiles --skill dotfiles-system-albersg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers extending the dotfiles installer need consistent patterns for OS detection and command execution across macOS, Linux, Arch, Debian, and Termux, and this Skill provides the exact code patterns and decision trees to avoid platform bugs. ## Core Features & Use Cases - OS Detection Patterns: Documents the OSType enum, SystemInfo struct, and detection priority order (Termux checked first) used in detect.go. - Command Execution Helpers: Maps each execution context to the right function, including RunSudo, RunBrewWithLogs, RunPkgInstall, and RunWithLogs. - Use Case: When adding support for a new Linux distribution, follow the decision tree to add an OSType constant, write a detection function, update Detect() priority, and wire the new OS into installer steps. ## Quick Start Ask the AI to add support for a new operating system in installer/internal/system/detect.go following the dotfiles-system patterns.

Frequently Asked Questions about dotfiles-system

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add support for a new operating system in a Go installer?▼

Add a new OSType constant in detect.go, write a detection function like isNewOS(), update the Detect() function respecting priority order, extend SystemInfo if new fields are needed, and add the OS case in the installer steps.

How do I detect Termux on Android in Go?▼

Check the TERMUX_VERSION environment variable first, then verify the PREFIX variable contains com.termux, and finally test for the /data/data/com.termux directory. Termux must be checked before standard Linux detection since it runs on Linux.

Which function should I use to run sudo commands with logging?▼

Use RunSudoWithLogs for privileged commands that need real-time log output, or RunSudo when logs are not needed. For Homebrew use RunBrewWithLogs, and for Termux use RunPkgInstall or RunPkgWithLogs since no sudo is required.

Does the Homebrew prefix differ between Apple Silicon and Intel Macs?▼

Yes. Apple Silicon (arm64) uses /opt/homebrew while Intel Macs use /usr/local. On Linux, Homebrew installs to /home/linuxbrew/.linuxbrew. The GetBrewPrefix function handles this via runtime.GOOS and runtime.GOARCH checks.

How do I handle command execution errors in the installer?▼

All execution functions return an ExecResult struct containing Output, Stderr, ExitCode, and Error. Check result.Error for execution failures and result.ExitCode for non-zero exits to handle each failure mode separately.