Skip to content

Commit 63f7fe8

Browse files
p-linnaneclaude
andauthored
fix(app): register ValidateCommand in bundled CLI and remove dead code (#364)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 80668b4 commit 63f7fe8

5 files changed

Lines changed: 11 additions & 44 deletions

File tree

Sources/macosdb/ValidateCommand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ struct ValidateCommand: AsyncParsableCommand {
162162
}
163163

164164
private extension URL {
165-
var isReadableFile: Bool {
165+
nonisolated var isReadableFile: Bool {
166166
(try? checkResourceIsReachable()) == true
167167
}
168168
}

macOSdb.xcodeproj/project.pbxproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
CDAA000C2F6A0001005A8490 /* EntryPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDAA00062F6A0001005A8490 /* EntryPoint.swift */; };
2525
CDAA000D2F6A0001005A8490 /* ArgumentParser in Frameworks */ = {isa = PBXBuildFile; productRef = CDAA00112F6A0001005A8490 /* ArgumentParser */; };
2626
CDAA00222F6A0002005A8490 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CDAA00202F6A0002005A8490 /* Assets.xcassets */; };
27+
CDC3BCAD2F8360AC00380644 /* ValidateCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC3BCAC2F8360AC00380644 /* ValidateCommand.swift */; };
2728
/* End PBXBuildFile section */
2829

2930
/* Begin PBXFileReference section */
@@ -42,6 +43,7 @@
4243
CDAA00052F6A0001005A8490 /* Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = "<group>"; };
4344
CDAA00062F6A0001005A8490 /* EntryPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntryPoint.swift; sourceTree = "<group>"; };
4445
CDAA00202F6A0002005A8490 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
46+
CDC3BCAC2F8360AC00380644 /* ValidateCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValidateCommand.swift; sourceTree = "<group>"; };
4547
/* End PBXFileReference section */
4648

4749
/* Begin PBXFrameworksBuildPhase section */
@@ -115,6 +117,7 @@
115117
CDAA00042F6A0001005A8490 /* ScanCommand.swift */,
116118
CDAA00032F6A0001005A8490 /* ShowCommand.swift */,
117119
CDAA00052F6A0001005A8490 /* Utilities.swift */,
120+
CDC3BCAC2F8360AC00380644 /* ValidateCommand.swift */,
118121
);
119122
name = CommandLine;
120123
path = Sources/macosdb;
@@ -170,7 +173,7 @@
170173
attributes = {
171174
BuildIndependentTargetsInParallel = 1;
172175
LastSwiftUpdateCheck = 2630;
173-
LastUpgradeCheck = 2630;
176+
LastUpgradeCheck = 2640;
174177
TargetAttributes = {
175178
CD7238CE2F5F7DCF0027E06F = {
176179
CreatedOnToolsVersion = 26.3;
@@ -245,6 +248,7 @@
245248
CD7EEB8B2F5F8038005A8490 /* AppState.swift in Sources */,
246249
CDAA000C2F6A0001005A8490 /* EntryPoint.swift in Sources */,
247250
CDAA00072F6A0001005A8490 /* ListCommand.swift in Sources */,
251+
CDC3BCAD2F8360AC00380644 /* ValidateCommand.swift in Sources */,
248252
CDAA00082F6A0001005A8490 /* CompareCommand.swift in Sources */,
249253
CDAA00092F6A0001005A8490 /* ShowCommand.swift in Sources */,
250254
CDAA000A2F6A0001005A8490 /* ScanCommand.swift in Sources */,
@@ -289,6 +293,7 @@
289293
CLANG_WARN_UNREACHABLE_CODE = YES;
290294
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
291295
COPY_PHASE_STRIP = NO;
296+
DEAD_CODE_STRIPPING = YES;
292297
DEBUG_INFORMATION_FORMAT = dwarf;
293298
DEVELOPMENT_TEAM = 927JGANW46;
294299
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -315,6 +320,7 @@
315320
MTL_FAST_MATH = YES;
316321
ONLY_ACTIVE_ARCH = YES;
317322
SDKROOT = macosx;
323+
STRING_CATALOG_GENERATE_SYMBOLS = YES;
318324
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
319325
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
320326
};
@@ -354,6 +360,7 @@
354360
CLANG_WARN_UNREACHABLE_CODE = YES;
355361
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
356362
COPY_PHASE_STRIP = NO;
363+
DEAD_CODE_STRIPPING = YES;
357364
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
358365
DEVELOPMENT_TEAM = 927JGANW46;
359366
ENABLE_NS_ASSERTIONS = NO;
@@ -373,6 +380,7 @@
373380
MTL_ENABLE_DEBUG_INFO = NO;
374381
MTL_FAST_MATH = YES;
375382
SDKROOT = macosx;
383+
STRING_CATALOG_GENERATE_SYMBOLS = YES;
376384
SWIFT_COMPILATION_MODE = wholemodule;
377385
};
378386
name = Release;

macOSdbApp/Bootstrap/EntryPoint.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct MacOSdbCLI: AsyncParsableCommand {
2424
commandName: "macosdb",
2525
abstract: "Browse and compare open source components bundled in macOS releases.",
2626
version: appVersion,
27-
subcommands: [ListCommand.self, ShowCommand.self, CompareCommand.self, ScanCommand.self]
27+
subcommands: [ListCommand.self, ShowCommand.self, CompareCommand.self, ScanCommand.self, ValidateCommand.self]
2828
)
2929

3030
/// Falls back to the enclosing `.app` bundle when `Bundle.main` misses (e.g. symlink invocation).

macOSdbApp/Models/AppState.swift

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ final class AppState {
9999
}
100100

101101
isLoading = false
102-
if pendingCounterpartVersion != nil {
103-
// Defer selection to next run loop so the List has time to render with new data
104-
Task { @MainActor in
105-
selectPendingCounterpart()
106-
}
107-
}
108102
}
109103

110104
func switchProduct(_ product: ProductType) {
@@ -117,28 +111,6 @@ final class AppState {
117111
Task { await refresh() }
118112
}
119113

120-
private var pendingCounterpartVersion: String?
121-
122-
func navigateToCounterpart(_ release: Release, in targetProduct: ProductType) {
123-
pendingCounterpartVersion = release.osVersion
124-
switchProduct(targetProduct)
125-
}
126-
127-
private func selectPendingCounterpart() {
128-
guard let version = pendingCounterpartVersion else { return }
129-
pendingCounterpartVersion = nil
130-
131-
let parts = version.split(separator: ".")
132-
let major = parts.first.flatMap { Int($0) }
133-
let minor = parts.count > 1 ? Int(parts[1]) : nil
134-
135-
selectedRelease = releases.first { $0.osVersion == version }
136-
?? releases.first {
137-
$0.majorVersion == major && $0.minorVersion == minor
138-
}
139-
?? releases.first { $0.majorVersion == major }
140-
}
141-
142114
func startCompare() {
143115
isComparing = true
144116
}

macOSdbApp/Views/ReleaseDetailView.swift

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,12 @@ struct ReleaseDetailView: View {
6969
Label("Download", systemImage: "arrow.down.circle")
7070
}
7171
}
72-
if let counterpart = counterpartProduct(for: release) {
73-
Button {
74-
appState.navigateToCounterpart(release, in: counterpart)
75-
} label: {
76-
Label(counterpart.displayName, systemImage: "arrow.triangle.swap")
77-
}
78-
}
7972
}
8073
.font(.callout)
8174
.foregroundStyle(.secondary)
8275
}
8376
}
8477

85-
private func counterpartProduct(for release: Release) -> ProductType? {
86-
switch release.resolvedProductType {
87-
case .macOS, .xcode: nil
88-
}
89-
}
90-
9178
// MARK: - SDK Info
9279

9380
@ViewBuilder

0 commit comments

Comments
 (0)