tv-anarchy/Sources/TVAnarchyCore/AppVersion.swift
Natalie 4a2ceb9781 feat(offline): inline star-to-keep and trash-to-cull on cache rows
Surface the existing pin (keep-from-cull) and per-file delete actions as
visible inline buttons on each offline cache row instead of context-menu-only:
a star toggles protection from auto-cull (and restore-if-missing), a trash
culls that file early. Aligns wording/icons to the star metaphor.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 00:12:41 -04:00

38 lines
No EOL
1.8 KiB
Swift

import Foundation
/// Build identity compiled into the binary (BuildStamp.swift) plus the bundle
/// plist. Spotlight launches /Applications/TVAnarchy.app compare the sidebar
/// stamp with `./run` output to confirm you're on the latest install.
public enum AppVersion {
/// Auto semver from tools/stamp-build.sh (latest vX.Y.Z tag + commits since).
public static var marketing: String { BuildStamp.version }
/// Monotonic git commit count (= CFBundleVersion).
public static var build: String { String(BuildStamp.commitCount) }
/// Short git SHA; "-dirty" when built from uncommitted changes.
public static var sha: String { BuildStamp.sha }
/// Build timestamp, "yyyy-MM-dd HH:mm:ss".
public static var buildTime: String { BuildStamp.buildTime }
public static var isDirty: Bool { BuildStamp.isDirty }
/// Where this running .app lives (Spotlight vs build/dd is obvious here).
public static var installPath: String { Bundle.main.bundleURL.path }
/// Glanceable sidebar line: "v1.1.50+b50 · abc1234 · 14:32".
public static var short: String {
let clock = buildTime.split(separator: " ").last.map(String.init) ?? buildTime
let dirty = isDirty ? "" : ""
return "v\(marketing)+b\(build) · \(sha) · \(clock)\(dirty)"
}
/// Full identity for copy/paste when reporting issues.
public static var full: String {
var line = "TVAnarchy v\(marketing) (build \(build)) · \(sha) · built \(buildTime)"
line += isDirty ? " · dirty tree" : ""
line += " · \(installPath)"
return line
}
/// True when launched from the standard install location (not an old build/dd copy).
public static var isInstalledCopy: Bool {
installPath.hasPrefix("/Applications/") || installPath.contains("/Applications/TVAnarchy.app")
}
}