← back to jterrazz__jterrazz-configuration

Function bodies 209 total

All specs Real LLM only Function bodies
config.RemoteUp function · go · L628-L649 (22 LOC)
src/internal/config/remote.go
func RemoteUp(settings RemoteSettings) (RemoteMode, error) {
	settings = normalizeRemoteSettings(settings)
	if err := ValidateRemoteSettings(settings); err != nil {
		return "", err
	}

	switch settings.Mode {
	case RemoteModeUserspace:
		if err := remoteUpWithMode(RemoteModeUserspace, settings); err != nil {
			return "", err
		}
		return RemoteModeUserspace, nil
	case RemoteModeAuto:
		if err := remoteUpWithMode(RemoteModeUserspace, settings); err == nil {
			return RemoteModeUserspace, nil
		} else {
			return "", err
		}
	default:
		return "", fmt.Errorf("unsupported mode: %s", settings.Mode)
	}
}
config.RemoteDown function · go · L653-L671 (19 LOC)
src/internal/config/remote.go
func RemoteDown(settings RemoteSettings) (RemoteMode, error) {
	settings = normalizeRemoteSettings(settings)
	mode := settings.Mode
	if mode == RemoteModeAuto {
		mode = detectActiveMode()
	}

	if mode == RemoteModeUserspace {
		downOutput, downErr := runTailscale(RemoteModeUserspace, "down")
		stopKeepAwake()
		stopUserspaceDaemon()
		if downErr != nil {
			return mode, formatCommandError(downErr, downOutput)
		}
		return mode, nil
	}

	return mode, fmt.Errorf("unsupported mode: %s", mode)
}
config.RemoteStatusInfo function · go · L674-L704 (31 LOC)
src/internal/config/remote.go
func RemoteStatusInfo(settings RemoteSettings) (RemoteStatus, error) {
	settings = normalizeRemoteSettings(settings)
	mode := settings.Mode
	if mode == RemoteModeAuto {
		mode = detectActiveMode()
	}

	st, err := getTailscaleStatus(mode)
	if err != nil {
		return RemoteStatus{Mode: mode, Connected: false}, err
	}

	result := RemoteStatus{
		Mode:         mode,
		BackendState: st.BackendState,
		Connected:    st.BackendState == "Running",
		KeepAwake:    isKeepAwakeRunning(),
	}

	if st.Self != nil {
		result.Hostname = st.Self.HostName
		if result.Hostname == "" {
			result.Hostname = st.Self.DNSName
		}
		if len(st.Self.TailscaleIP) > 0 {
			result.IP = st.Self.TailscaleIP[0]
		}
	}

	return result, nil
}
config.DiskCheck.Check method · go · L285-L295 (11 LOC)
src/internal/config/resources.go
func (d DiskCheck) Check() ResourceResult {
	if d.CheckFn != nil {
		return d.CheckFn()
	}

	path := expandHome(d.Path)
	if size := GetDirSize(path); size > 0 {
		return ResourceResult{Value: tool.FormatBytes(size), Style: d.Style, Available: true}
	}
	return ResourceResult{Available: false}
}
config.expandHome function · go · L298-L303 (6 LOC)
src/internal/config/resources.go
func expandHome(path string) string {
	if strings.HasPrefix(path, "~/") {
		return filepath.Join(os.Getenv("HOME"), path[2:])
	}
	return path
}
config.parseCPUOutput function · go · L338-L360 (23 LOC)
src/internal/config/resources.go
func parseCPUOutput(out []byte) []ProcessInfo {
	lines := strings.Split(strings.TrimSpace(string(out)), "\n")
	var processes []ProcessInfo

	// Skip header, take top 5
	for i := 1; i < len(lines) && len(processes) < 5; i++ {
		fields := strings.Fields(lines[i])
		if len(fields) < 3 {
			continue
		}
		pid := fields[0]
		cpuPercent := fields[1]
		name := strings.Join(fields[2:], " ")

		processes = append(processes, ProcessInfo{
			Name:  name,
			Value: cpuPercent + "%",
			PID:   pid,
		})
	}

	return processes
}
config.parseMemoryOutput function · go · L363-L398 (36 LOC)
src/internal/config/resources.go
func parseMemoryOutput(out []byte) []ProcessInfo {
	lines := strings.Split(strings.TrimSpace(string(out)), "\n")
	var processes []ProcessInfo

	// Skip header, take top 5
	for i := 1; i < len(lines) && len(processes) < 5; i++ {
		fields := strings.Fields(lines[i])
		if len(fields) < 3 {
			continue
		}
		pid := fields[0]
		rssKB := fields[1]
		name := strings.Join(fields[2:], " ")

		// Convert RSS from KB to human readable format
		var formatted string
		if kb, err := strconv.ParseInt(rssKB, 10, 64); err == nil {
			mb := kb / 1024
			if mb >= 1024 {
				formatted = fmt.Sprintf("%.1fG", float64(mb)/1024)
			} else {
				formatted = fmt.Sprintf("%dM", mb)
			}
		} else {
			formatted = rssKB + "K"
		}

		processes = append(processes, ProcessInfo{
			Name:  name,
			Value: formatted,
			PID:   pid,
		})
	}

	return processes
}
Repobility analyzer · published findings · https://repobility.com
config.runHushlogin function · go · L216-L233 (18 LOC)
src/internal/config/scripts.go
func runHushlogin() error {
	fmt.Println(out.Cyan("Setting up hushlogin..."))

	hushPath := os.Getenv("HOME") + "/.hushlogin"
	if _, err := os.Stat(hushPath); err == nil {
		fmt.Printf("%s .hushlogin already exists\n", out.Green("Done"))
		return nil
	}

	f, err := os.Create(hushPath)
	if err != nil {
		return fmt.Errorf("failed to create .hushlogin: %w", err)
	}
	f.Close()

	fmt.Println(out.Green("Done - terminal login message silenced"))
	return nil
}
config.runGhosttyConfig function · go · L235-L261 (27 LOC)
src/internal/config/scripts.go
func runGhosttyConfig() error {
	fmt.Println(out.Cyan("Setting up Ghostty config..."))

	configDir := os.Getenv("HOME") + "/.config/ghostty"
	configPath := configDir + "/config"

	if err := os.MkdirAll(configDir, 0755); err != nil {
		return fmt.Errorf("failed to create config directory: %w", err)
	}

	repoConfig, err := GetRepoConfigPath("dotfiles/applications/ghostty/config")
	if err != nil {
		return fmt.Errorf("failed to find repo config: %w", err)
	}

	configContent, err := os.ReadFile(repoConfig)
	if err != nil {
		return fmt.Errorf("failed to read config file %s: %w", repoConfig, err)
	}

	if err := os.WriteFile(configPath, configContent, 0644); err != nil {
		return fmt.Errorf("failed to write config file %s: %w", configPath, err)
	}

	fmt.Println(out.Green("Done - Ghostty config installed"))
	return nil
}
config.runTmuxConfig function · go · L263-L290 (28 LOC)
src/internal/config/scripts.go
func runTmuxConfig() error {
	fmt.Println(out.Cyan("Setting up tmux config..."))

	configPath := os.Getenv("HOME") + "/.tmux.conf"

	repoConfig, err := GetRepoConfigPath("dotfiles/applications/tmux/tmux.conf")
	if err != nil {
		return fmt.Errorf("failed to find repo config: %w", err)
	}

	configContent, err := os.ReadFile(repoConfig)
	if err != nil {
		return fmt.Errorf("failed to read config file %s: %w", repoConfig, err)
	}

	if err := os.WriteFile(configPath, configContent, 0644); err != nil {
		return fmt.Errorf("failed to write config file %s: %w", configPath, err)
	}

	// Reload tmux config if a server is running.
	if err := exec.Command("tmux", "source-file", configPath).Run(); err == nil {
		fmt.Println(out.Green("Done - tmux config installed and reloaded"))
		return nil
	}

	fmt.Println(out.Green("Done - tmux config installed"))
	return nil
}
config.runGPGSetup function · go · L292-L332 (41 LOC)
src/internal/config/scripts.go
func runGPGSetup() error {
	fmt.Println(out.Cyan("Setting up GPG for commit signing..."))

	email := UserEmail
	name := UserName

	if !CommandExists("gpg") {
		return fmt.Errorf("GPG not installed. Run: brew install gnupg")
	}

	checkCmd := exec.Command("gpg", "--list-secret-keys", "--keyid-format", "long", email)
	if output, err := checkCmd.Output(); err == nil && len(output) > 0 {
		fmt.Println(out.Green("GPG key already exists for " + email))
		configureGitGPG(email)
		return nil
	}

	fmt.Println("Generating GPG key...")
	fmt.Println(out.Dimmed("Using ed25519 algorithm"))

	batchConfig := fmt.Sprintf(`%%no-protection
Key-Type: eddsa
Key-Curve: ed25519
Name-Real: %s
Name-Email: %s
Expire-Date: 0
%%commit
`, name, email)

	genCmd := exec.Command("gpg", "--batch", "--generate-key")
	genCmd.Stdin = strings.NewReader(batchConfig)
	genCmd.Stdout = os.Stdout
	genCmd.Stderr = os.Stderr
	if err := genCmd.Run(); err != nil {
		return fmt.Errorf("failed to generate GPG key: %w", err)
	}
	fmt.P
config.runSpotlightExclude function · go · L454-L478 (25 LOC)
src/internal/config/scripts.go
func runSpotlightExclude() error {
	fmt.Println(out.Cyan("Excluding ~/Developer from Spotlight indexing..."))

	devDir := os.Getenv("HOME") + "/Developer"
	marker := devDir + "/.metadata_never_index"

	if _, err := os.Stat(devDir); err != nil {
		return fmt.Errorf("~/Developer directory does not exist")
	}

	if _, err := os.Stat(marker); err == nil {
		fmt.Println(out.Green("Done - already excluded"))
		return nil
	}

	f, err := os.Create(marker)
	if err != nil {
		return fmt.Errorf("failed to create .metadata_never_index: %w", err)
	}
	f.Close()

	fmt.Println(out.Green("Done - ~/Developer excluded from Spotlight"))
	fmt.Println(out.Dimmed("Spotlight will stop indexing this directory"))
	return nil
}
config.runZedConfig function · go · L480-L506 (27 LOC)
src/internal/config/scripts.go
func runZedConfig() error {
	fmt.Println(out.Cyan("Setting up Zed config..."))

	configDir := os.Getenv("HOME") + "/.config/zed"
	configPath := configDir + "/settings.json"

	if err := os.MkdirAll(configDir, 0755); err != nil {
		return fmt.Errorf("failed to create config directory: %w", err)
	}

	repoConfig, err := GetRepoConfigPath("dotfiles/applications/zed/settings.json")
	if err != nil {
		return fmt.Errorf("failed to find repo config: %w", err)
	}

	configContent, err := os.ReadFile(repoConfig)
	if err != nil {
		return fmt.Errorf("failed to read config file %s: %w", repoConfig, err)
	}

	if err := os.WriteFile(configPath, configContent, 0644); err != nil {
		return fmt.Errorf("failed to write config file %s: %w", configPath, err)
	}

	fmt.Println(out.Green("Done - Zed config installed"))
	return nil
}
config.runJavaSymlink function · go · L508-L535 (28 LOC)
src/internal/config/scripts.go
func runJavaSymlink() error {
	fmt.Println(out.Cyan("Setting up Java runtime..."))

	brewJava := "/opt/homebrew/opt/openjdk/libexec/openjdk.jdk"
	if _, err := os.Stat(brewJava); err != nil {
		return fmt.Errorf("OpenJDK not installed. Run: j install openjdk")
	}

	symlinkPath := "/Library/Java/JavaVirtualMachines/openjdk.jdk"

	if _, err := os.Lstat(symlinkPath); err == nil {
		fmt.Printf("%s Java symlink already exists\n", out.Green("Done"))
		return nil
	}

	fmt.Println("Creating symlink for macOS Java recognition...")

	sudoCmd := exec.Command("sudo", "ln", "-sfn", brewJava, symlinkPath)
	sudoCmd.Stdout = os.Stdout
	sudoCmd.Stderr = os.Stderr
	sudoCmd.Stdin = os.Stdin
	if err := sudoCmd.Run(); err != nil {
		return fmt.Errorf("failed to create symlink: %w", err)
	}

	fmt.Println(out.Green("Done - Java configured for macOS"))
	return nil
}
config.runDockReset function · go · L537-L543 (7 LOC)
src/internal/config/scripts.go
func runDockReset() error {
	fmt.Println(out.Cyan("Resetting macOS Dock..."))
	ExecCommand("defaults", "delete", "com.apple.dock")
	ExecCommand("killall", "Dock")
	fmt.Println(out.Green("Done - Dock reset to defaults"))
	return nil
}
Want fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
config.runDockSpacer function · go · L545-L551 (7 LOC)
src/internal/config/scripts.go
func runDockSpacer() error {
	fmt.Println(out.Cyan("Adding spacer to Dock..."))
	ExecCommand("defaults", "write", "com.apple.dock", "persistent-apps", "-array-add", `{"tile-type"="small-spacer-tile";}`)
	ExecCommand("killall", "Dock")
	fmt.Println(out.Green("Done - Dock spacer added"))
	return nil
}
config.runDNSEncrypt function · go · L562-L582 (21 LOC)
src/internal/config/scripts.go
func runDNSEncrypt() error {
	if IsDNSProfileInstalled() {
		exec.Command("open", "x-apple.systempreferences:com.apple.Profiles-Settings.extension").Run()
		return nil
	}

	profilePath := dnsProfilePath()
	if err := os.MkdirAll(filepath.Dir(profilePath), 0755); err != nil {
		return fmt.Errorf("failed to create config directory: %w", err)
	}

	if err := os.WriteFile(profilePath, []byte(generateDNSProfile()), 0644); err != nil {
		return fmt.Errorf("failed to write profile: %w", err)
	}

	exec.Command("open", profilePath).Run()

	// Give macOS time to read the file before the TUI resumes
	time.Sleep(2 * time.Second)
	return nil
}
config.generateDNSProfile function · go · L584-L640 (57 LOC)
src/internal/config/scripts.go
func generateDNSProfile() string {
	return `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>PayloadContent</key>
	<array>
		<dict>
			<key>DNSSettings</key>
			<dict>
				<key>DNSProtocol</key>
				<string>HTTPS</string>
				<key>ServerAddresses</key>
				<array>
					<string>2620:fe::fe</string>
					<string>2620:fe::9</string>
					<string>9.9.9.9</string>
					<string>149.112.112.112</string>
				</array>
				<key>ServerURL</key>
				<string>https://dns.quad9.net/dns-query</string>
			</dict>
			<key>PayloadDescription</key>
			<string>Configures device to use Quad9 Encrypted DNS over HTTPS</string>
			<key>PayloadDisplayName</key>
			<string>Quad9 DNS over HTTPS</string>
			<key>PayloadIdentifier</key>
			<string>` + dnsProfileIdentifier + `.doh</string>
			<key>PayloadType</key>
			<string>com.apple.dnsSettings.managed</string>
			<key>PayloadUUID</key>
config.GetRepoConfigPath function · go · L647-L661 (15 LOC)
src/internal/config/scripts.go
func GetRepoConfigPath(relativePath string) (string, error) {
	possibleRoots := []string{
		os.Getenv("HOME") + "/Developer/jterrazz-cli",
		"/usr/local/share/jterrazz-cli",
	}

	for _, root := range possibleRoots {
		fullPath := root + "/" + relativePath
		if _, err := os.Stat(fullPath); err == nil {
			return fullPath, nil
		}
	}

	return "", fmt.Errorf("config file not found: %s", relativePath)
}
config.GetScriptByName function · go · L677-L684 (8 LOC)
src/internal/config/scripts.go
func GetScriptByName(name string) *Script {
	for i := range Scripts {
		if Scripts[i].Name == name {
			return &Scripts[i]
		}
	}
	return nil
}
config.GetScriptsByCategory function · go · L687-L695 (9 LOC)
src/internal/config/scripts.go
func GetScriptsByCategory(category ScriptCategory) []Script {
	var result []Script
	for _, script := range Scripts {
		if script.Category == category {
			result = append(result, script)
		}
	}
	return result
}
config.GetScriptsForTool function · go · L698-L711 (14 LOC)
src/internal/config/scripts.go
func GetScriptsForTool(toolName string) []Script {
	tool := GetToolByName(toolName)
	if tool == nil || len(tool.Scripts) == 0 {
		return nil
	}

	var result []Script
	for _, scriptName := range tool.Scripts {
		if script := GetScriptByName(scriptName); script != nil {
			result = append(result, *script)
		}
	}
	return result
}
config.GetStandaloneScripts function · go · L714-L730 (17 LOC)
src/internal/config/scripts.go
func GetStandaloneScripts() []Script {
	// Build set of tool-attached scripts
	attached := make(map[string]bool)
	for _, tool := range Tools {
		for _, scriptName := range tool.Scripts {
			attached[scriptName] = true
		}
	}

	var result []Script
	for _, script := range Scripts {
		if !attached[script.Name] {
			result = append(result, script)
		}
	}
	return result
}
Open data scored by Repobility · https://repobility.com
config.GetConfigurableScripts function · go · L733-L741 (9 LOC)
src/internal/config/scripts.go
func GetConfigurableScripts() []Script {
	var result []Script
	for _, script := range Scripts {
		if script.CheckFn != nil {
			result = append(result, script)
		}
	}
	return result
}
config.GetUnconfiguredScripts function · go · L744-L755 (12 LOC)
src/internal/config/scripts.go
func GetUnconfiguredScripts() []Script {
	var result []Script
	for _, script := range Scripts {
		if script.CheckFn != nil {
			check := script.CheckFn()
			if !check.Installed {
				result = append(result, script)
			}
		}
	}
	return result
}
config.CheckScript function · go · L758-L763 (6 LOC)
src/internal/config/scripts.go
func CheckScript(script Script) CheckResult {
	if script.CheckFn != nil {
		return script.CheckFn()
	}
	return CheckResult{} // No check = unknown state
}
config.RunScript function · go · L766-L772 (7 LOC)
src/internal/config/scripts.go
func RunScript(script Script) error {
	if script.RunFn != nil {
		return script.RunFn()
	}
	// Scripts without RunFn are invoked via `j setup <RunCmd>`
	return nil
}
config.GetSkillRepoByName function · go · L51-L58 (8 LOC)
src/internal/config/skills.go
func GetSkillRepoByName(name string) *SkillRepo {
	for i := range SkillRepos {
		if SkillRepos[i].Name == name {
			return &SkillRepos[i]
		}
	}
	return nil
}
config.IsFavoriteSkill function · go · L67-L76 (10 LOC)
src/internal/config/skills.go
func IsFavoriteSkill(repo, skill string) bool {
	for _, fav := range FavoriteSkills {
		if fav.Skill == skill {
			if repo == "" || fav.Repo == repo {
				return true
			}
		}
	}
	return false
}
config.InstallMethod.String method · go · L75-L94 (20 LOC)
src/internal/config/tools.go
func (m InstallMethod) String() string {
	switch m {
	case InstallBrewFormula, InstallBrewCask:
		return "brew"
	case InstallNpm:
		return "npm"
	case InstallBun:
		return "bun"
	case InstallNvm:
		return "nvm"
	case InstallXcode:
		return "xcode"
	case InstallManual:
		return "sh"
	case InstallMAS:
		return "mas"
	default:
		return "-"
	}
}
config.GetToolsByCategory function · go · L1025-L1033 (9 LOC)
src/internal/config/tools.go
func GetToolsByCategory(category ToolCategory) []Tool {
	var result []Tool
	for _, tool := range Tools {
		if tool.Category == category {
			result = append(result, tool)
		}
	}
	return result
}
Powered by Repobility — scan your code at https://repobility.com
config.GetInstallableTools function · go · L1036-L1044 (9 LOC)
src/internal/config/tools.go
func GetInstallableTools() []Tool {
	var result []Tool
	for _, tool := range Tools {
		if tool.Method == InstallBrewFormula || tool.Method == InstallBrewCask || tool.Method == InstallNpm || tool.Method == InstallBun || tool.InstallFn != nil {
			result = append(result, tool)
		}
	}
	return result
}
config.GetToolByName function · go · L1047-L1054 (8 LOC)
src/internal/config/tools.go
func GetToolByName(name string) *Tool {
	for i := range Tools {
		if Tools[i].Name == name {
			return &Tools[i]
		}
	}
	return nil
}
config.GetToolsInDependencyOrder function · go · L1057-L1098 (42 LOC)
src/internal/config/tools.go
func GetToolsInDependencyOrder() []Tool {
	installable := GetInstallableTools()

	toolMap := make(map[string]*Tool)
	for i := range installable {
		toolMap[installable[i].Name] = &installable[i]
	}

	visited := make(map[string]bool)
	var result []Tool

	var visit func(name string)
	visit = func(name string) {
		if visited[name] {
			return
		}

		tool := toolMap[name]
		if tool == nil {
			tool = GetToolByName(name)
		}
		if tool == nil {
			return
		}

		for _, dep := range tool.Dependencies {
			visit(dep)
		}

		visited[name] = true

		if toolMap[name] != nil {
			result = append(result, *tool)
		}
	}

	for _, tool := range installable {
		visit(tool.Name)
	}

	return result
}
config.Tool.Check method · go · L1101-L1121 (21 LOC)
src/internal/config/tools.go
func (t Tool) Check() CheckResult {
	if t.CheckFn != nil {
		return t.CheckFn()
	}

	if t.Command == "" {
		return CheckResult{}
	}

	if _, err := exec.LookPath(t.Command); err != nil {
		return CheckResult{}
	}

	result := CheckResult{Installed: true}

	if t.VersionFn != nil {
		result.Version = t.VersionFn()
	}

	return result
}
config.Tool.Install method · go · L1124-L1141 (18 LOC)
src/internal/config/tools.go
func (t Tool) Install() error {
	if t.InstallFn != nil {
		return t.InstallFn()
	}

	switch t.Method {
	case InstallBrewFormula:
		return RunBrewCommand("install", t.Formula)
	case InstallBrewCask:
		return RunBrewCommand("install", "--cask", t.Formula)
	case InstallNpm:
		return ExecCommand("npm", "install", "-g", t.Formula)
	case InstallBun:
		return ExecCommand("bun", "install", "-g", t.Formula)
	default:
		return fmt.Errorf("cannot auto-install %s (method: %s)", t.Name, t.Method)
	}
}
config.RunBrewCommand function · go · L1144-L1150 (7 LOC)
src/internal/config/tools.go
func RunBrewCommand(args ...string) error {
	cmd := exec.Command("arch", append([]string{"-arm64", "brew"}, args...)...)
	cmd.Stdout = os.Stdout
	cmd.Stderr = os.Stderr
	cmd.Stdin = os.Stdin
	return cmd.Run()
}
config.GetPackageManagerByFlag function · go · L40-L47 (8 LOC)
src/internal/config/upgraders.go
func GetPackageManagerByFlag(flag string) *PackageManager {
	for i := range PackageManagers {
		if PackageManagers[i].Flag == flag {
			return &PackageManagers[i]
		}
	}
	return nil
}
config.UpgradeAll function · go · L50-L56 (7 LOC)
src/internal/config/upgraders.go
func UpgradeAll() {
	for _, pm := range PackageManagers {
		if CommandExists(pm.RequiresCmd) {
			pm.UpgradeFn()
		}
	}
}
Repobility analyzer · published findings · https://repobility.com
config.UpgradePackageManager function · go · L59-L65 (7 LOC)
src/internal/config/upgraders.go
func UpgradePackageManager(pm PackageManager) {
	if !CommandExists(pm.RequiresCmd) {
		fmt.Printf("%s %s not found, skipping\n", output.Yellow("Warning:"), pm.RequiresCmd)
		return
	}
	pm.UpgradeFn()
}
config.UpgradePackageByName function · go · L68-L117 (50 LOC)
src/internal/config/upgraders.go
func UpgradePackageByName(name string) error {
	// Find package in our tools list
	pkg := GetToolByName(name)
	if pkg != nil {
		switch pkg.Method {
		case InstallBrewFormula:
			if !CommandExists("brew") {
				return fmt.Errorf("Homebrew not found")
			}
			fmt.Printf("  📥 Upgrading %s...\n", name)
			ExecCommand("brew", "upgrade", pkg.Formula)
			fmt.Printf("  %s %s upgraded\n", output.Green("✓"), name)
			return nil
		case InstallBrewCask:
			if !CommandExists("brew") {
				return fmt.Errorf("Homebrew not found")
			}
			fmt.Printf("  📥 Upgrading %s...\n", name)
			ExecCommand("brew", "upgrade", "--cask", pkg.Formula)
			fmt.Printf("  %s %s upgraded\n", output.Green("✓"), name)
			return nil
		case InstallNpm:
			if !CommandExists("npm") {
				return fmt.Errorf("npm not found")
			}
			fmt.Printf("  📥 Upgrading %s...\n", name)
			ExecCommand("npm", "update", "-g", pkg.Formula)
			fmt.Printf("  %s %s upgraded\n", output.Green("✓"), name)
			return nil
		case InstallBun:
			if !Comman
config.upgradeBrew function · go · L123-L128 (6 LOC)
src/internal/config/upgraders.go
func upgradeBrew() {
	fmt.Println(output.Cyan("🍺 Upgrading Homebrew packages..."))
	ExecCommand("brew", "update")
	ExecCommand("brew", "upgrade")
	fmt.Println(output.Green("  ✅ Homebrew upgrade completed"))
}
skill.ParseSkillsListOutput function · go · L14-L51 (38 LOC)
src/internal/domain/skill/parser.go
func ParseSkillsListOutput(output string) []string {
	var skills []string
	cleanOutput := tool.StripAnsi(output)
	lines := strings.Split(cleanOutput, "\n")

	inSkillsSection := false
	for _, line := range lines {
		if strings.Contains(line, "Available Skills") {
			inSkillsSection = true
			continue
		}

		if !inSkillsSection {
			continue
		}

		if strings.Contains(line, "Use --skill") {
			break
		}

		cleaned := boxCharsRegex.ReplaceAllString(line, "")

		leadingSpaces := len(cleaned) - len(strings.TrimLeft(cleaned, " "))
		trimmed := strings.TrimSpace(cleaned)

		if trimmed == "" {
			continue
		}

		if leadingSpaces <= 5 && !strings.Contains(trimmed, " ") && len(trimmed) > 0 {
			if IsValidName(trimmed) {
				skills = append(skills, trimmed)
			}
		}
	}

	return skills
}
skill.IsValidName function · go · L54-L64 (11 LOC)
src/internal/domain/skill/parser.go
func IsValidName(s string) bool {
	if len(s) == 0 {
		return false
	}
	for _, c := range s {
		if !((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '-' || c == '_') {
			return false
		}
	}
	return true
}
skill.Install function · go · L12-L18 (7 LOC)
src/internal/domain/skill/skill.go
func Install(repo, skill string) error {
	cmd := exec.Command("skills", "add", repo, "-g", "-y", "--skill", skill)
	if output, err := cmd.CombinedOutput(); err != nil {
		return fmt.Errorf("%s", strings.TrimSpace(string(output)))
	}
	return nil
}
skill.InstallAll function · go · L21-L27 (7 LOC)
src/internal/domain/skill/skill.go
func InstallAll(repo string) error {
	cmd := exec.Command("skills", "add", repo, "-g", "-y", "--all")
	if output, err := cmd.CombinedOutput(); err != nil {
		return fmt.Errorf("%s", strings.TrimSpace(string(output)))
	}
	return nil
}
skill.Remove function · go · L30-L36 (7 LOC)
src/internal/domain/skill/skill.go
func Remove(skill string) error {
	cmd := exec.Command("skills", "remove", "-g", "-y", skill)
	if err := cmd.Run(); err != nil {
		return fmt.Errorf("failed to remove %s: %w", skill, err)
	}
	return nil
}
Want fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
skill.RemoveAll function · go · L39-L45 (7 LOC)
src/internal/domain/skill/skill.go
func RemoveAll() error {
	cmd := exec.Command("skills", "remove", "-g", "-y", "--all")
	if err := cmd.Run(); err != nil {
		return fmt.Errorf("failed to remove all skills: %w", err)
	}
	return nil
}
skill.ListInstalled function · go · L48-L87 (40 LOC)
src/internal/domain/skill/skill.go
func ListInstalled() []string {
	var installed []string

	cmd := exec.Command("skills", "list", "-g")
	output, err := cmd.Output()
	if err != nil {
		return installed
	}

	cleanOutput := tool.StripAnsi(string(output))
	lines := strings.Split(cleanOutput, "\n")
	for _, line := range lines {
		if len(line) > 0 && (line[0] == ' ' || line[0] == '\t') {
			continue
		}

		line = strings.TrimSpace(line)

		if line == "" ||
			strings.Contains(line, "No global skills") ||
			strings.Contains(line, "Global") ||
			strings.Contains(line, "Skills") ||
			strings.HasPrefix(line, "Try ") {
			continue
		}

		parts := strings.Fields(line)
		if len(parts) >= 1 {
			skillName := parts[0]
			if !strings.HasPrefix(skillName, "/") &&
				!strings.HasPrefix(skillName, "~") &&
				!strings.Contains(skillName, ":") &&
				len(skillName) > 0 {
				installed = append(installed, skillName)
			}
		}
	}

	return installed
}
skill.ListFromRepo function · go · L90-L97 (8 LOC)
src/internal/domain/skill/skill.go
func ListFromRepo(repo string) ([]string, error) {
	cmd := exec.Command("skills", "add", repo, "--list")
	output, err := cmd.CombinedOutput()
	if err != nil {
		return nil, err
	}
	return ParseSkillsListOutput(string(output)), nil
}
‹ prevpage 2 / 5next ›