Skip to content

fix(doctor): detect missing Swift macro plugins on CLT-only hosts (#174)#414

Open
pnascimento9596 wants to merge 1 commit into
repoprompt:mainfrom
pnascimento9596:fix/issue-174-doctor-macro-plugin-probe
Open

fix(doctor): detect missing Swift macro plugins on CLT-only hosts (#174)#414
pnascimento9596 wants to merge 1 commit into
repoprompt:mainfrom
pnascimento9596:fix/issue-174-doctor-macro-plugin-probe

Conversation

@pnascimento9596

Copy link
Copy Markdown

Summary

Scripts/doctor.sh --quiet passes on Command Line Tools–only macOS hosts, but the build then fails at macro expansion. The check verified tool presence and a SwiftUI symbol typecheck (the Liquid Glass probe) but never exercised macro-plugin availability, so it reported success on a host that cannot build the app.

Root cause

RepoPrompt CE requires two Swift macro plugins that ship only with full Xcode.app, never with Command Line Tools:

  • SwiftUIMacros — CE's own source uses @Entry at 10 sites across 5 files.
  • PreviewsMacros — the pinned KeyboardShortcuts 2.3.0 (045cf174…) uses #Preview in Recorder.swift.

CLT alone is structurally insufficient, and the old doctor.sh could not tell a contributor that.

Fix

  • Scripts/doctor.sh: adds a macro-plugin probe (mirrors the existing Liquid Glass probe) that typechecks a snippet using both @Entry and #Preview. Because macro expansion runs during type-checking, an absent plugin fails the probe, which then hard-fails with guidance to install Xcode 26. Catches both blockers — and any future macro dependency — in one place.
  • README.md: corrects the source-build requirements, which incorrectly listed Command Line Tools as a supported alternative to Xcode.

Validation

  • Xcode 26 host: standalone probe typechecks clean (exit 0, no extra imports needed); full doctor.sh exits 0 with OK: toolchain provides Swift macro plugins (@Entry, #Preview).
  • CLT-only host (DEVELOPER_DIR=/Library/Developer/CommandLineTools): probe fails with external macro implementation type 'SwiftUIMacros.EntryMacro' … plugin for module 'SwiftUIMacros' not found and the equivalent for PreviewsMacros; doctor.sh --quiet exits non-zero with the install-Xcode guidance. Notably the Liquid Glass probe still passes under CLT — i.e. the old check would have reported success — confirming this reproduces and closes CLT-only builds fail despite doctor.sh passing — Xcode-only macro plugins #174.
  • bash -n Scripts/doctor.sh passes; python3 Scripts/test_release_tooling.py → 52 tests, all pass.

Scope

  • Blocker Refresh README introduction #1 from the issue (mid-cycle PackageDescription mismatch) is environment-specific and self-resolves via CLT reinstall; intentionally not probed to avoid false positives.
  • This does not attempt to restore CLT-only builds. Blocker Refresh README introduction #3 is first-party @Entry usage; making CLT builds succeed would mean removing an idiomatic SwiftUI macro codebase-wide and guarding it in CI — a poor trade for a native macOS app. The honest fix is to detect the unsupported host and say so.

Known limitation / follow-up

CI does not exercise the CLT-only path (GitHub macos-26 runners ship Xcode), so this probe is validated by contributors, not CI. A job that selects CLT and asserts doctor.sh fails would close that gap but is awkward on hosted runners; proposed as a separate change.

Scripts/doctor.sh passed on Command Line Tools-only machines while the
build could not succeed, because it never exercised macro-plugin
expansion. RepoPrompt CE's own source uses @entry (SwiftUIMacros, 10
sites across 5 files) and a pinned dependency uses #Preview
(PreviewsMacros); both plugins ship only with full Xcode.app. Add a
swiftc -typecheck probe that expands both macros and hard-fails with
actionable guidance when the plugins are absent, closing the false
positive where doctor.sh reported success on an unbuildable host.
Correct the README source-build requirements, which incorrectly listed
Command Line Tools as a supported build path.

Closes repoprompt#174
@pnascimento9596 pnascimento9596 force-pushed the fix/issue-174-doctor-macro-plugin-probe branch from 884c557 to df25992 Compare July 8, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant