Skip to content

Add Cloud Agent Linux development environment - #116

Merged
bisonbet merged 1 commit into
mainfrom
cursor/setup-cloud-agent-env-c5ed
Aug 22, 2026
Merged

Add Cloud Agent Linux development environment#116
bisonbet merged 1 commit into
mainfrom
cursor/setup-cloud-agent-env-c5ed

Conversation

@bisonbet

Copy link
Copy Markdown
Owner

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 -parse syntax 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:
    • installs the Swift OS dependencies,
    • installs Swift 6.3.3 via Swiftly,
    • installs SwiftLint 0.58.2 to /usr/local/bin,
    • wires swiftly/env.sh + an auto-computed LINUX_SOURCEKIT_LIB_PATH into ~/.bashrc (also picked up by login shells via ~/.profile).
  • AGENTS.md — refreshed to match the real setup and to document the SwiftLintBaseline.json portability caveat (it stores absolute macOS paths, so on a Linux checkout the baseline does not match and swiftlint lint reports 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 --versionSwift version 6.3.3
  • swiftlint version0.58.2
  • swiftc -parse Models/AudioModels.swift → exit 0 (and correctly reports errors on malformed Swift)
  • swiftlint lint --baseline <local baseline>Found 0 violations, 0 serious in 176 files
  • Install script run twice → fully idempotent (no duplicate ~/.bashrc block, no stray .swift-version).

No application code changed.

Open in Web Open in Cursor 

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>
Copilot AI lite review requested due to automatic review settings August 20, 2026 22:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md to 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_PATH is computed by taking the first toolchains/* 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 selected swiftc/toolchain (e.g., via readlink -f "$(command -v swiftc)" and walking to the adjacent usr/lib). Note this same pattern also appears earlier when exporting LINUX_SOURCEKIT_LIB_PATH for 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.sh without checking that it exists. With set -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.

Comment thread .cursor/install.sh
Comment on lines +16 to +18
SWIFT_VERSION="6.3.3"
SWIFTLINT_VERSION="0.58.2"
SWIFTLY_HOME_DIR="${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}"
Comment thread .cursor/install.sh
Comment on lines +23 to +32
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
Comment thread .cursor/install.sh
Comment on lines +65 to +68
# 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"
@bisonbet
bisonbet marked this pull request as ready for review August 20, 2026 22:09
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@bisonbet
bisonbet merged commit 23fe9e7 into main Aug 22, 2026
1 check passed
@bisonbet
bisonbet deleted the cursor/setup-cloud-agent-env-c5ed branch August 22, 2026 23:07
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.

3 participants