Add Cloud Agent Linux development environment - #116
Conversation
Adds .cursor/environment.json and an idempotent .cursor/install.sh that installs Swiftly + Swift 6.3.3 and SwiftLint 0.58.2, and wires LINUX_SOURCEKIT_LIB_PATH into the shell for SwiftLint on Linux. Refreshes AGENTS.md to match the real setup and documents the SwiftLintBaseline.json macOS-absolute-path portability caveat. Co-authored-by: Tim Champ <bisonbet@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a reproducible Linux “Cloud Agent” setup for the repository so contributors can lint Swift code (SwiftLint) and run swiftc -parse syntax checks without needing macOS/Xcode, while keeping actual build/test workflows macOS-only.
Changes:
- Adds a Cloud Agent definition (
.cursor/environment.json) that runs a scripted Linux setup. - Introduces an idempotent install script (
.cursor/install.sh) to install Swift (via Swiftly), SwiftLint, and configure shell environment variables. - Updates
AGENTS.mdto document the Linux workflow and SwiftLint baseline portability caveat.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
AGENTS.md |
Updates documentation for Linux Cloud Agent setup, linting, and baseline behavior. |
.cursor/install.sh |
New idempotent installer for Swift/SwiftLint + SourceKit path wiring in ~/.bashrc. |
.cursor/environment.json |
Declares the Cloud Agent environment and install entrypoint. |
Suppressed comments (2)
.cursor/install.sh:104
LINUX_SOURCEKIT_LIB_PATHis computed by taking the firsttoolchains/*match. If multiple toolchains are present, this can point SwiftLint at a SourceKit that doesn’t correspond to the active Swift version, causing SwiftLint failures that are hard to diagnose. Prefer deriving the SourceKit path from the currently selectedswiftc/toolchain (e.g., viareadlink -f "$(command -v swiftc)"and walking to the adjacentusr/lib). Note this same pattern also appears earlier when exportingLINUX_SOURCEKIT_LIB_PATHfor the install script run.
if [ -f "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh" ]; then
. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh"
fi
export LINUX_SOURCEKIT_LIB_PATH="$(dirname "$(ls "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}"/toolchains/*/usr/lib/libsourcekitdInProc.so 2>/dev/null | head -n1)")"
.cursor/install.sh:52
- The script sources
$SWIFTLY_HOME_DIR/env.shwithout checking that it exists. Withset -euo pipefail, a failed Swiftly install (or a mismatched home dir) will terminate here with a relatively cryptic error. Adding an explicit existence check will fail fast with a clearer message.
# Make swiftly + the active toolchain available to the rest of this script.
# shellcheck disable=SC1091
. "$SWIFTLY_HOME_DIR/env.sh"
hash -r
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| SWIFT_VERSION="6.3.3" | ||
| SWIFTLINT_VERSION="0.58.2" | ||
| SWIFTLY_HOME_DIR="${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}" |
| if ! dpkg -s libcurl4-openssl-dev >/dev/null 2>&1; then | ||
| log "Installing OS dependencies for Swift..." | ||
| sudo apt-get update -qq | ||
| sudo apt-get install -y -qq \ | ||
| binutils gnupg2 libc6-dev libcurl4-openssl-dev libedit2 libgcc-13-dev \ | ||
| libpython3-dev libstdc++-13-dev libxml2-dev libz3-dev pkg-config tzdata \ | ||
| unzip zlib1g-dev libncurses-dev | ||
| else | ||
| log "OS dependencies already present." | ||
| fi |
| # Location of libsourcekitdInProc.so inside the installed toolchain; SwiftLint | ||
| # needs this on Linux. | ||
| SOURCEKIT_LIB_DIR="$(dirname "$(ls "$SWIFTLY_HOME_DIR"/toolchains/*/usr/lib/libsourcekitdInProc.so 2>/dev/null | head -n1)")" | ||
| export LINUX_SOURCEKIT_LIB_PATH="$SOURCEKIT_LIB_DIR" |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
Sets up a reproducible Cloud Agent (Linux) development environment for this native iOS/watchOS Xcode project. Building/running/testing still require macOS + Xcode, but the supported Linux workflow — SwiftLint and
swiftc -parsesyntax checks — now works out of the box for any future Cloud Agent.What's included
.cursor/environment.json— declares the environment and runs the install script..cursor/install.sh— idempotent setup that:/usr/local/bin,swiftly/env.sh+ an auto-computedLINUX_SOURCEKIT_LIB_PATHinto~/.bashrc(also picked up by login shells via~/.profile).AGENTS.md— refreshed to match the real setup and to document theSwiftLintBaseline.jsonportability caveat (it stores absolute macOS paths, so on a Linux checkout the baseline does not match andswiftlint lintreports the ~2,600 pre-existing violations; a locally generated baseline yields a clean run).Validation
Run from a clean login shell (as a fresh agent experiences it):
swift --version→Swift version 6.3.3swiftlint version→0.58.2swiftc -parse Models/AudioModels.swift→ exit0(and correctly reports errors on malformed Swift)swiftlint lint --baseline <local baseline>→Found 0 violations, 0 serious in 176 files~/.bashrcblock, no stray.swift-version).No application code changed.