package cli

import (
	"path/filepath"
	"strings"

	"iop/apps/node/internal/runtime"
	"iop/packages/go/config"
)

func shouldAutostartPersistentProfile(profile config.CLIProfileConf) bool {
	return profile.Persistent &&
		profile.Mode != modeCodexExec &&
		profile.Mode != modeCodexAppServer &&
		profile.Mode != modeAntigravity &&
		profile.Mode != modeOpencodeSSE &&
		profile.Mode != modePersistentLazy
}

func cliTargetName(spec runtime.ExecutionSpec) string {
	return spec.Target
}

func isClaudeTerminalProfile(target string, profile config.CLIProfileConf) bool {
	if strings.Contains(strings.ToLower(target), "claude-tui") {
		return true
	}
	return strings.EqualFold(filepath.Base(profile.Command), "claude")
}
