Skip to content

CLT-only builds fail despite doctor.sh passing — Xcode-only macro plugins #174

@pnascimento9596

Description

@pnascimento9596

On a CLT-only host (no Xcode.app), Scripts/doctor.sh --quiet passes but swift build -c release --product RepoPrompt cannot succeed. Three distinct failures observed on macOS 26.5, CLT 26.5 (swift-driver 1.148.6, Swift 6.3.2), repo @ 6f8fcbb:

1. PackageDescription module mismatch (environment-specific; fixed by CLT reinstall — noted for completeness). swift package dump-package failed on any tools-version-6.x manifest: the CLT .swiftinterface advertises the swiftLanguageModes: init under @available(_PackageDescription 6), but libPackageDescription.dylib only exports the legacy swiftLanguageVersions: symbol — compile error when the manifest uses the new label, link error when it doesn't. A clean CLT reinstall resolved it (likely a mismatched mid-cycle update). Relevant here because doctor.sh passed throughout: it checks tool presence, not whether the toolchain can actually compile a manifest.

2. PreviewsMacros plugin missing from CLT. KeyboardShortcuts 2.3.0 (Recorder.swift:172,177,182) has three #Preview blocks. CLT ships only libObservationMacros.dylib and libSwiftMacros.dylib under /Library/Developer/CommandLineTools/usr/lib/swift/host/plugins/; PreviewsMacros ships with Xcode.app only. Repro on a CLT-only host:

swift build -c release --product RepoPrompt
# error: external macro implementation type 'PreviewsMacros.SwiftUIView' could not be found
#        for macro 'Preview(_:body:)'; plugin for module 'PreviewsMacros' not found

KeyboardShortcuts main still carries these blocks, so a dependency bump would not fix this.

3. SwiftUIMacros plugin missing from CLT. With (2) worked around, the build fails again on CE's own source: @Entry is used at 8 sites across 4 files (App/FontPreset.swift, Features/AgentMode/Views/AgentMessageBubble.swift, Features/AgentMode/Views/ToolCards/ToolCardContainer.swift, Infrastructure/UI/Markdown/MarkdownFileLinkInteraction.swift):

grep -rn '@Entry' Sources/RepoPrompt | wc -l   # 8
# error: external macro implementation type 'SwiftUIMacros.EntryMacro' could not be found
#        for macro 'Entry()'; plugin for module 'SwiftUIMacros' not found

The pattern: CLT alone is structurally insufficient for this codebase, and doctor.sh currently can't tell a contributor that.

CI doesn't surface any of this because GitHub's macos-26 runners ship Xcode.app, so the CLT path is never exercised.

Two suggestions, either of which would close the trap:

  • doctor.sh gains a macro-compile probe (and ideally a tiny dump-package probe for (1)) — compile a snippet using #Preview/@Entry and hard-fail with "install Xcode.app" guidance when the plugins are absent;
  • or the docs state plainly that Xcode.app is required to build.

I have a working fix for blocker (2) following the existing Scripts/patches mechanism (same 045cf17 pin, idempotency marker, mirrored release-tooling harness coverage) — happy to PR it if a CLT path is in scope. It deliberately does not claim to restore CLT builds on its own, since (3) remains.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions