From daf0c6d3e368bda5d729a0f15497950d70b739a7 Mon Sep 17 00:00:00 2001 From: Ross Goldberg <484615+rgoldberg@users.noreply.github.com> Date: Tue, 6 Jan 2026 11:26:27 -0500 Subject: [PATCH 1/2] periphery 3.4.0 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com> --- .periphery.yaml | 2 +- Brewfile | 2 +- Scripts/lint | 8 ++++++-- Sources/mas/Models/CatalogApp.swift | 3 +-- Sources/mas/Models/CatalogAppResults.swift | 5 ++--- Sources/mas/Models/InstalledApp.swift | 3 +-- Sources/mas/Utilities/Version+SemVer.swift | 12 +++++------- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.periphery.yaml b/.periphery.yaml index 19b9f3a3..38646f99 100644 --- a/.periphery.yaml +++ b/.periphery.yaml @@ -2,7 +2,7 @@ # .periphery.yaml # mas # -# Periphery 3.3.0 +# Periphery 3.4.0 # --- disable_update_check: true diff --git a/Brewfile b/Brewfile index f8746eb5..173e944e 100644 --- a/Brewfile +++ b/Brewfile @@ -3,7 +3,7 @@ brew "gh" # 2.83.2 brew "git" # 2.52.0 brew "ipsw" # 3.1.648 brew "markdownlint-cli2" # 0.20.0 -brew "periphery" # 3.3.0 +brew "periphery" if MacOS.version >= :sequoia && `/usr/bin/arch` == "arm64" # 3.4.0 brew "shellcheck" # 0.11.0 brew "swiftformat" # 0.58.7 brew "swiftlint" # 0.63.0 diff --git a/Scripts/lint b/Scripts/lint index 54554e4e..29012513 100755 --- a/Scripts/lint +++ b/Scripts/lint @@ -14,7 +14,11 @@ print_notice '🚨 Linting' "${@}" -ensure_command_available actionlint git markdownlint-cli2 periphery shellcheck swiftformat swiftlint yamllint || exit +ensure_command_available actionlint git markdownlint-cli2 shellcheck swiftformat swiftlint yamllint || exit +[[ "$(/usr/bin/arch)" = arm64 && "${$(sw_vers -productVersion)%%.*}" -ge 15 ]] +integer -r can_use_periphery="$((! ?))" +# shellcheck disable=SC1083 +((can_use_periphery)) && { ensure_command_available periphery || exit } zmodload zsh/zutil zparseopts -D -A received_flag A P @@ -41,7 +45,7 @@ if ! [[ -v 'received_flag[-A]' ]]; then ((exit_status |= ${?})) fi -if ! [[ -v 'received_flag[-P]' ]]; then +if ((can_use_periphery)) && ! [[ -v 'received_flag[-P]' ]]; then printf -- $'--> 🌀 Periphery\n' script -q /dev/null periphery scan --exclude-tests | (grep -vxE '(?:\x1b\[0;1;32m|\^D\x08{2})\* (?:\x1b\[0;0m\x1b\[0;1m)?No unused code detected\.(?:\x1b\[0;0m)?\r' || true) diff --git a/Sources/mas/Models/CatalogApp.swift b/Sources/mas/Models/CatalogApp.swift index f9217769..b8cdcb61 100644 --- a/Sources/mas/Models/CatalogApp.swift +++ b/Sources/mas/Models/CatalogApp.swift @@ -8,8 +8,7 @@ struct CatalogApp: Sendable { let adamID: ADAMID let appStorePageURLString: String - // periphery:ignore - let bundleID: String + let bundleID: String // periphery:ignore let fileSizeBytes: String let formattedPrice: String? let minimumOSVersion: String diff --git a/Sources/mas/Models/CatalogAppResults.swift b/Sources/mas/Models/CatalogAppResults.swift index ed96f8d8..1b2589e5 100644 --- a/Sources/mas/Models/CatalogAppResults.swift +++ b/Sources/mas/Models/CatalogAppResults.swift @@ -5,8 +5,7 @@ // Copyright © 2018 mas-cli. All rights reserved. // -struct CatalogAppResults: Decodable, Sendable { - // periphery:ignore - let resultCount: Int // swiftlint:disable:this unused_declaration +struct CatalogAppResults: Decodable, Sendable { // swiftlint:disable:next unused_declaration + let resultCount: Int // periphery:ignore let results: [CatalogApp] } diff --git a/Sources/mas/Models/InstalledApp.swift b/Sources/mas/Models/InstalledApp.swift index 1a58131a..73a1f99f 100644 --- a/Sources/mas/Models/InstalledApp.swift +++ b/Sources/mas/Models/InstalledApp.swift @@ -9,8 +9,7 @@ struct InstalledApp: Sendable { let adamID: ADAMID let bundleID: String let name: String - // periphery:ignore - let path: String + let path: String // periphery:ignore let version: String var isTestFlight: Bool { diff --git a/Sources/mas/Utilities/Version+SemVer.swift b/Sources/mas/Utilities/Version+SemVer.swift index d72394bd..44b2cf52 100644 --- a/Sources/mas/Utilities/Version+SemVer.swift +++ b/Sources/mas/Utilities/Version+SemVer.swift @@ -20,8 +20,7 @@ protocol Version: CustomStringConvertible { var prerelease: String? { get } var build: String? { get } - // periphery:ignore - init?(from versionString: String) + init?(from versionString: String) // periphery:ignore } protocol CoreIntegerVersion: Version { @@ -36,12 +35,11 @@ extension CoreIntegerVersion where Integer: FixedWidthInteger { } } -// periphery:ignore protocol MajorMinorPatch { // swiftlint:disable unused_declaration - var major: String { get } - var minor: String { get } - var patch: String { get } // swiftlint:enable unused_declaration -} + var major: String { get } // periphery:ignore + var minor: String { get } // periphery:ignore + var patch: String { get } // periphery:ignore +} // swiftlint:enable unused_declaration protocol MajorMinorPatchInteger: MajorMinorPatch { associatedtype Integer: BinaryInteger From d3d12548339836a3cbe0c282e4bcf4f0102098ed Mon Sep 17 00:00:00 2001 From: Ross Goldberg <484615+rgoldberg@users.noreply.github.com> Date: Wed, 7 Jan 2026 15:17:08 -0500 Subject: [PATCH 2/2] Output installed/updated folder path. Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com> --- .../mas/AppStore/AppStoreAction+download.swift | 16 +++++++++++++--- Sources/mas/Utilities/Printer.swift | 4 ++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Sources/mas/AppStore/AppStoreAction+download.swift b/Sources/mas/AppStore/AppStoreAction+download.swift index 28c3a319..1bfc30a6 100644 --- a/Sources/mas/AppStore/AppStoreAction+download.swift +++ b/Sources/mas/AppStore/AppStoreAction+download.swift @@ -238,6 +238,7 @@ private actor DownloadQueueObserver: CKDownloadQueueObserver { MAS.printer.clearCurrentLine(of: .standardOutput) do { + let appFolderPath: String? if let error = snapshot.error { guard error is Ignorable else { throw error @@ -250,7 +251,7 @@ private actor DownloadQueueObserver: CKDownloadQueueObserver { "progress cannot be displayed", terminator: "", ) - try await install(appNameAndVersion: snapshot.appNameAndVersion) + appFolderPath = try await install(appNameAndVersion: snapshot.appNameAndVersion) MAS.printer.clearCurrentLine(of: .standardOutput) } else { guard !snapshot.isFailed else { @@ -263,9 +264,14 @@ private actor DownloadQueueObserver: CKDownloadQueueObserver { guard !snapshot.isCancelled else { throw MASError.error("Download cancelled for \(snapshot.appNameAndVersion)") } + + appFolderPath = snapshot.appFolderPath } - MAS.printer.notice(action.performed.capitalizingFirstCharacter, snapshot.appNameAndVersion) + MAS.printer.notice( + [action.performed.capitalizingFirstCharacter, snapshot.appNameAndVersion] + + (appFolderPath.map { ["in", $0] } ?? []), // swiftformat:disable:this indent + ) resumeOnce { $0.resume() } } catch { resumeOnce { $0.resume(throwing: error) } @@ -289,7 +295,7 @@ private actor DownloadQueueObserver: CKDownloadQueueObserver { return hardLinkURL } - private func install(appNameAndVersion: String) async throws { + private func install(appNameAndVersion: String) async throws -> String { guard let pkgHardLinkPath = pkgHardLinkURL?.path(percentEncoded: false) else { throw MASError.error("Failed to find pkg to \(action) \(appNameAndVersion)") } @@ -357,6 +363,8 @@ private actor DownloadQueueObserver: CKDownloadQueueObserver { ) LSRegisterURL(appFolderURL as NSURL, true) // swiftlint:disable:this legacy_objc_type + + return appFolderURL.path(percentEncoded: false) } } @@ -366,6 +374,7 @@ private struct DownloadSnapshot: Sendable { // swiftlint:disable:this one_declar let appNameAndVersion: String let activePhaseType: PhaseType let phasePercentComplete: Float + let appFolderPath: String? let isCancelled: Bool let isFailed: Bool let error: (any Error)? @@ -380,6 +389,7 @@ private struct DownloadSnapshot: Sendable { // swiftlint:disable:this one_declar appNameAndVersion = "\(metadata.title ?? "unknown app") (\(version ?? "unknown version"))" activePhaseType = PhaseType(action, rawValue: status.activePhase?.phaseType) phasePercentComplete = status.phasePercentComplete + appFolderPath = download.installPath isCancelled = status.isCancelled isFailed = status.isFailed error = status.error.map { $0 as NSError }.map { error in diff --git a/Sources/mas/Utilities/Printer.swift b/Sources/mas/Utilities/Printer.swift index b5ded5e6..674611d3 100644 --- a/Sources/mas/Utilities/Printer.swift +++ b/Sources/mas/Utilities/Printer.swift @@ -23,6 +23,7 @@ struct Printer: Sendable { } /// Prints to `stdout`. + @_disfavoredOverload func info(_ items: Any..., separator: String = " ", terminator: String = "\n") { info(items, separator: separator, terminator: terminator) } @@ -34,6 +35,7 @@ struct Printer: Sendable { /// Prints to `stdout`, prefixed with "==> "; if connected to a terminal, the /// prefix is blue. + @_disfavoredOverload func notice(_ items: Any..., separator: String = " ", terminator: String = "\n") { notice(items, separator: separator, terminator: terminator) } @@ -46,6 +48,7 @@ struct Printer: Sendable { /// Prints to `stderr`, prefixed with "Warning: "; if connected to a terminal, /// the prefix is yellow & underlined. + @_disfavoredOverload func warning(_ items: Any..., error: (any Error)? = nil, separator: String = " ", terminator: String = "\n") { warning(items, error: error, separator: separator, terminator: terminator) } @@ -58,6 +61,7 @@ struct Printer: Sendable { /// Prints to `stderr`, prefixed with "Error: "; if connected to a terminal, /// the prefix is red & underlined. + @_disfavoredOverload func error(_ items: Any..., error: (any Error)? = nil, separator: String = " ", terminator: String = "\n") { self.error(items, error: error, separator: separator, terminator: terminator) }