Cross-platform scaffold: honest build gates + macOS/Linux plan - #2
Open
NORTHTEKDevs wants to merge 1 commit into
Open
Cross-platform scaffold: honest build gates + macOS/Linux plan#2NORTHTEKDevs wants to merge 1 commit into
NORTHTEKDevs wants to merge 1 commit into
Conversation
Ghost runs on Windows only today, but the workspace didn't say so at build time: seven crates pulled the `windows` crate unconditionally (directly or transitively), so `cargo build` on macOS/Linux produced hundreds of Win32 FFI errors rather than a clear answer, and CI had no non-Windows target at all. Build honesty: - Move `windows`/`windows-core` into `[target.'cfg(windows)'.dependencies]` in ghost-core, ghost-cache, ghost-session, ghost-cli, ghost-mcp. - Add `#![cfg(windows)]` plus a six-line build-script guard to all seven Windows-locked crates (the five above plus ghost-intent and ghost-http, which inherit the lock through ghost-core/ghost-session). Off Windows each now fails with exactly one sentence pointing at docs/cross-platform.md. - Add `default-members = [ghost-platform, ghost-ground]` so a bare `cargo build` is green and honest on macOS/Linux; `.cargo/config.toml` adds build-all/check-all/test-all aliases for Windows development. - CI gains check-macos and check-linux jobs running `cargo check -p ghost-platform -p ghost-ground` and `cargo test -p ghost-platform` on their native hosts. Existing Windows jobs and `-D warnings` are untouched. - New ghost-platform integration test asserts the host backend reports functional only on Windows — a tripwire against an accidental capability flip. Surface honesty (per docs/audits/2026-07-honesty-audit.md, items S1-a, S1-c, S1-d, S2-a, S3-a, S3-b): README leads with "Windows 10/11 only" and demotes mac/linux to roadmap, Install header carries the OS requirement, the MCP tool count reads 20 verbs to match the crate description and CHANGELOG, the architecture diagram shows ghost-platform, comparison.md gains a platform coverage row, and server.json catches up to 0.16.0. No Windows source semantics change. No capability flag changes: macOS and Linux still report functional: false and stay that way until the on-device checklist in docs/plans/2026-07-cross-platform-plan.md passes.
Draft
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ghost runs on Windows 10/11 only today. This PR makes the build system and the user-facing surfaces say that plainly, and lands the implementation plan for the macOS/Linux backends. It changes no Windows behaviour and flips no capability flag — macOS and Linux still report
functional: false.Plan:
docs/plans/2026-07-cross-platform-plan.mdAudit it implements:
docs/audits/2026-07-honesty-audit.mdExisting capability contract (cited, not duplicated):
docs/cross-platform.mdThe problem
Seven crates were Windows-locked but didn't declare it:
ghost-core,ghost-cache,ghost-session,ghost-cli,ghost-mcpnamed thewindowscrate unconditionally, andghost-intent/ghost-httpinherited the lock through their dependencies.cargo buildon macOS/Linux produced hundreds of unresolved-import errors instead of an answer, and CI ran onwindows-latestonly, so nothing proved "compiles on Darwin/Linux" either way.Build honesty
windows/windows-coremoved into[target.'cfg(windows)'.dependencies]in the five crates that name them.#![cfg(windows)]and a six-linebuild.rsthat exits with one sentence off Windows:Ghost's ghost-core is Windows-only today; see docs/cross-platform.mdBoth mechanisms are needed:
#![cfg(windows)]alone gives libraries a clean empty build but gives the three binaries a bareerror[E0601]: main function not found, and acompile_error!alone does not suppress the FFI avalanche from the rest of the file (gating ~60 top-level items inghost-mcp/src/main.rsis not a small change). The build guard reads the target OS, so cross-checking a Mac target from a Windows box errors correctly too. Rationale is written up in the plan, §4.2.default-members—ghost-platformandghost-ground(verified free of any Win32 dependency). A barecargo buildon macOS/Linux is now green and honest;cargo build --workspacestill gives Windows developers everything, and.cargo/config.tomladdsbuild-all/check-all/test-allaliases so that's discoverable.check-macos(macos-latest) andcheck-linux(ubuntu-latest) jobs runningcargo check -p ghost-platform -p ghost-groundandcargo test -p ghost-platform. They deliberately never pass--workspace: the Windows-only crates are expected to fail there, and a red X on an expected failure trains people to ignore CI. Existing Windows jobs and the workspace-wideRUSTFLAGS: -D warningsare untouched.crates/ghost-platform/tests/host_capability_tripwire.rsasserts the host backend reports functional only on Windows, and that the scaffolds advertise noFeature. Turning a platform on now requires editing this test in the same commit.Surface honesty
Applies exactly the redlines the audit marked S1-a, S1-c, S1-d, S2-a, S3-a, S3-b. S1-b (the tagline) and every technical claim about Windows are untouched.
## Install→## Install (Windows 10/11), requirement moved out of the tail parentheticalghost-platformnodedocs/comparison.mdgains a "Platform coverage" row: Windows only today; mac/linux scaffoldedserver.json0.15.1 → 0.16.0 (both fields)kit/*is unchanged — those are Windows artifacts making no cross-platform claim, and per the plan §10 nothing ships there until macOS is verified on-device.The plan doc
docs/plans/2026-07-cross-platform-plan.mdcovers: goals/non-goals (Apple Silicon primary), the current architecture reality crate-by-crate, two refactor options with a pick (Option A — cfg-gate now; Option B — extractghost-session-coreafter Mac lands, because the trait should be drawn with two working implementations in hand), concrete deltas, the MacBackend design (AXUIElement discovery, CGEvent input, ScreenCaptureKit capture, the Accessibility + Screen Recording permission model), the LinuxBackend design (AT-SPI, XTest/libei, the spelled-out Wayland-vs-X11 detection branch and its reduced capability set), a ~30-row function-by-function map ofGhostSession↔ Windows ↔ macOS ↔ Linux primitives, the on-device verification checklist that gatesfunctional: true, CI additions,ghost doctorchanges (exit code 2 on an unsupported OS; the Mac doctor design), the kit/release plan, and an explicit not-in-scope list.The headline claim gets the honest treatment it needs: background dispatch is built on Windows posted window messages, which have no exact macOS/Linux equivalent. The plan requires it to be measured across an app set before it appears in any capability list, and says out loud that it may ship as PARTIAL or absent off Windows.
Testing
Verified on Linux with a real toolchain (cargo 1.97.1). Cross-target checks were run from Linux; a Windows host is still the authority for the Windows jobs.
cargo check(default members) on Linux — green, buildsghost-platform+ghost-groundcargo test -p ghost-platformon Linux withRUSTFLAGS="-D warnings"— 7 passed, including both new tripwire testscargo check --workspaceon Linux — fails as designed with the intended one-line message;--keep-goingconfirms all seven guards emit their own sentence and nothing elsecargo check --workspace --target x86_64-pc-windows-gnu— green for the entire workspace, which is the load-bearing check that the Windows build is unaffected: build guards pass, target-gated deps resolve,#![cfg(windows)]is a no-opcargo check -p ghost-platform -p ghost-ground --target aarch64-apple-darwin— green (this is what the newcheck-macosjob runs)Cargo.lockunchanged;cargo metadata --filter-platformconfirmswindowsresolves forx86_64-pc-windows-msvcand is absent foraarch64-apple-darwinNot verified here, and worth a Windows-host eye before merge:
cargo build --workspace/cargo test --workspace/cargo clippy --workspaceon a realwindows-latestrunner. The cross-check above covers compilation but not linking or the live desktop tests. CI will run these on this PR.cargo check --workspaceon a real macOS host stops atring's build script when cross-compiled from Linux (no Darwin C toolchain in the sandbox); on a real Mac theghost-coreguard fires first, as it does natively on Linux.