Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 56 additions & 8 deletions .claude/rules/linux-compat.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Linux Compatibility
# Linux & Windows Compatibility

This rule covers Linux-specific workarounds and differences from macOS.
This rule covers Linux- and Windows-specific workarounds and differences from macOS.

The project builds on Linux (Ubuntu 22.04 LTS / Jammy). Key differences from macOS:
The project builds on Linux (Ubuntu 22.04 LTS / Jammy) and Windows (Swift 6.3). Key differences from macOS:

## Required Import for Networking

Expand Down Expand Up @@ -44,8 +44,56 @@ func testSomePngOperation() throws {

## Platform-Specific Features

| Feature | macOS | Linux |
| ------------ | ------------ | ------------------------ |
| HEIC encoding| ImageIO | Falls back to PNG |
| libpng tests | Full support | Build tests first |
| Foundation | Full | Some APIs missing/broken |
| Feature | macOS | Linux | Windows |
| ------------ | ------------ | ------------------------ | ------------------------ |
| HEIC encoding| ImageIO | Falls back to PNG | Falls back to PNG |
| libpng tests | Full support | Build tests first | Not tested |
| Foundation | Full | Some APIs missing/broken | Some APIs missing/broken |
| XcodeProj | Full | Full | Not available |
| Swift version| 6.2+ | 6.2+ | 6.3 required |

## Windows Support

### Swift Version

Windows requires Swift 6.3 (development snapshot) due to `swift-resvg` artifactbundle compatibility.
CI uses `compnerd/gha-setup-swift@v0.3.0` with `swift-6.3-branch`.

### Conditional Dependencies (Package.swift)

`#if` inside array literals does NOT work in SPM Package.swift. Use variable + `#if` append pattern:

```swift
var packageDependencies: [Package.Dependency] = [...]
#if !os(Windows)
packageDependencies.append(.package(url: "https://github.com/tuist/XcodeProj.git", from: "8.27.0"))
#endif
```

### XcodeProj Exclusion

XcodeProj is Apple-only (depends on PathKit/AEXML). On Windows:
- Dependency excluded via `#if !os(Windows)` in Package.swift
- `XcodeProjectWriter` wrapped in `#if canImport(XcodeProj)` (6 files in Export/)
- Xcode project manipulation silently skipped on Windows

### FoundationNetworking / FoundationXML

Use `#if canImport()` instead of `#if os(Linux)` — covers both Linux and Windows:

```swift
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

#if canImport(FoundationXML)
import FoundationXML
#endif
```

### SPM Artifactbundle on Windows

SPM on Windows has library naming differences:
- Unix linkers auto-prepend `lib` prefix (`-lresvg` finds `libresvg.a`)
- Windows `lld-link` does NOT prepend prefix (`resvg.lib` must exist as-is)
- Swift 6.3 allows `.lib` files without `lib` prefix in artifactbundle info.json
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,28 @@ jobs:
- name: Run tests
# Build tests separately to avoid hangs from concurrent build + test execution
run: swift test --skip-build --parallel 2>&1 | xcsift

build-windows:
name: Build (Windows)
runs-on: windows-latest
needs: lint
steps:
- uses: actions/checkout@v6

- name: Install Swift
uses: compnerd/gha-setup-swift@v0.3.0
with:
branch: swift-6.3-branch
tag: 6.3-DEVELOPMENT-SNAPSHOT-2026-02-21-a

- name: Swift version
run: swift --version

- name: Resolve dependencies
run: swift package resolve

- name: Build (Debug)
run: swift build

- name: Build (Release)
run: swift build -c release
41 changes: 40 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ jobs:
archive-name: exfig-linux-x64
container: swift:6.2-jammy
extra-flags: --static-swift-stdlib -Xlinker -lcurl -Xlinker -lxml2 -Xlinker -lssl -Xlinker -lcrypto -Xlinker -lz
- os: windows-latest
platform: windows-x64
build-path: x86_64-unknown-windows-msvc/release
archive-name: exfig-windows-x64


runs-on: ${{ matrix.os }}
Expand All @@ -45,6 +49,13 @@ jobs:
with:
lfs: true

- name: Install Swift (Windows)
if: matrix.platform == 'windows-x64'
uses: compnerd/gha-setup-swift@v0.3.0
with:
branch: swift-6.3-branch
tag: 6.3-DEVELOPMENT-SNAPSHOT-2026-02-21-a

- name: Select Xcode 26.1 (macOS)
if: matrix.platform == 'macos'
run: sudo xcode-select -s /Applications/Xcode_26.1.1.app/Contents/Developer
Expand All @@ -54,7 +65,8 @@ jobs:
run: |
apt-get install -y libcurl4-openssl-dev libxml2-dev libssl-dev

- name: Set version from tag
- name: Set version from tag (Unix)
if: matrix.platform != 'windows-x64'
run: |
VERSION="${GITHUB_REF#refs/tags/}"
FILE="Sources/ExFigCLI/ExFigCommand.swift"
Expand All @@ -64,6 +76,14 @@ jobs:
sed -i "s/static let version = \".*\"/static let version = \"$VERSION\"/" "$FILE"
fi

- name: Set version from tag (Windows)
if: matrix.platform == 'windows-x64'
shell: pwsh
run: |
$version = $env:GITHUB_REF -replace '^refs/tags/', ''
$file = "Sources/ExFigCLI/ExFigCommand.swift"
(Get-Content $file) -replace 'static let version = ".*"', "static let version = `"$version`"" | Set-Content $file

- name: Build release binary (macOS)
if: matrix.platform == 'macos'
run: |
Expand All @@ -83,6 +103,10 @@ jobs:
if: matrix.platform == 'linux-x64'
run: swift build -c release ${{ matrix.extra-flags }}

- name: Build release binary (Windows)
if: matrix.platform == 'windows-x64'
run: swift build -c release

- name: Create release archive (macOS)
if: matrix.platform == 'macos'
run: |
Expand All @@ -109,6 +133,20 @@ jobs:
cp LICENSE dist/
cd dist && tar -czf ../${{ matrix.archive-name }}.tar.gz -- *

- name: Create release archive (Windows)
if: matrix.platform == 'windows-x64'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path dist
Copy-Item ".build/${{ matrix.build-path }}/exfig.exe" "dist/ExFig.exe"
Copy-Item ".build/${{ matrix.build-path }}/exfig_AndroidExport.resources" "dist/" -Recurse -ErrorAction SilentlyContinue
Copy-Item ".build/${{ matrix.build-path }}/exfig_XcodeExport.resources" "dist/" -Recurse -ErrorAction SilentlyContinue
Copy-Item ".build/${{ matrix.build-path }}/exfig_FlutterExport.resources" "dist/" -Recurse -ErrorAction SilentlyContinue
Copy-Item ".build/${{ matrix.build-path }}/exfig_WebExport.resources" "dist/" -Recurse -ErrorAction SilentlyContinue
Copy-Item ".build/${{ matrix.build-path }}/exfig_ExFigCLI.resources" "dist/" -Recurse -ErrorAction SilentlyContinue
Copy-Item "LICENSE" "dist/"
Compress-Archive -Path "dist/*" -DestinationPath "${{ matrix.archive-name }}.zip"

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -200,6 +238,7 @@ jobs:
files: |
artifacts/exfig-macos/exfig-macos.zip
artifacts/exfig-linux-x64/exfig-linux-x64.tar.gz
artifacts/exfig-windows-x64/exfig-windows-x64.zip
.pkl-out/exfig@*/*

update-homebrew:
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/windows-test.yml

This file was deleted.

59 changes: 30 additions & 29 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,21 @@ pkl eval --format json <file.pkl> # Package URI requires published package

## Project Context

| Aspect | Details |
| --------------- | ---------------------------------------------------------------------------------- |
| Language | Swift 6.2, macOS 13.0+ |
| Package Manager | Swift Package Manager |
| CLI Framework | swift-argument-parser |
| Config Format | PKL (Programmable, Scalable, Safe) |
| Templates | Jinja2 (swift-jinja) |
| Required Env | `FIGMA_PERSONAL_TOKEN` |
| Config Files | `exfig.pkl` (PKL configuration) |
| Tooling | mise (`./bin/mise` self-contained, no global install needed) |
| Platforms | macOS 13+ (primary), Linux/Ubuntu 22.04 (CI) - see `.claude/rules/linux-compat.md` |
| Aspect | Details |
| --------------- | -------------------------------------------------------------------------------------------------- |
| Language | Swift 6.2, macOS 13.0+ |
| Package Manager | Swift Package Manager |
| CLI Framework | swift-argument-parser |
| Config Format | PKL (Programmable, Scalable, Safe) |
| Templates | Jinja2 (swift-jinja) |
| Required Env | `FIGMA_PERSONAL_TOKEN` |
| Config Files | `exfig.pkl` (PKL configuration) |
| Tooling | mise (`./bin/mise` self-contained, no global install needed) |
| Platforms | macOS 13+ (primary), Linux/Ubuntu 22.04, Windows (Swift 6.3) - see `.claude/rules/linux-compat.md` |

## Architecture

Twelve modules in `Sources/`:
Thirteen modules in `Sources/`:

| Module | Purpose |
| --------------- | --------------------------------------------------------- |
Expand All @@ -137,6 +137,7 @@ Twelve modules in `Sources/`:
| `FlutterExport` | Flutter export (Dart code, SVG/PNG assets) |
| `WebExport` | Web/React export (CSS variables, JSX icons) |
| `SVGKit` | SVG parsing, ImageVector/VectorDrawable generation |
| `JinjaSupport` | Shared Jinja2 template rendering helpers |

**Data flow:** CLI -> PKL config parsing -> FigmaAPI fetch -> ExFigCore processing -> Platform plugin -> Export module -> File write

Expand Down Expand Up @@ -326,22 +327,22 @@ NooraUI.formatLink("url", useColors: true) // underlined primary

## Dependencies

| Package | Version | Purpose |
| --------------------- | ------- | ------------------------------- |
| swift-argument-parser | 1.5.0+ | CLI framework |
| swift-collections | 1.2.x | Ordered collections |
| swift-jinja | 2.0.0+ | Jinja2 template engine |
| XcodeProj | 8.27.0+ | Xcode project manipulation |
| swift-log | 1.6.0+ | Logging |
| Rainbow | 4.2.0+ | Terminal colors |
| libwebp | 1.4.1+ | WebP encoding |
| libpng | 1.6.45+ | PNG decoding |
| swift-custom-dump | 1.3.0+ | Test assertions |
| Noora | 0.54.0+ | Terminal UI design system |
| swift-resvg | 0.45.1 | SVG parsing/rendering |
| swift-docc-plugin | 1.4.5+ | DocC documentation |
| swift-yyjson | 0.5.0+ | High-performance JSON codec |
| pkl-swift | 0.7.2+ | PKL config evaluation & codegen |
| Package | Version | Purpose |
| --------------------- | --------------- | -------------------------------------------------- |
| swift-argument-parser | 1.5.0+ | CLI framework |
| swift-collections | 1.2.x | Ordered collections |
| swift-jinja | 2.0.0+ | Jinja2 template engine |
| XcodeProj | 8.27.0+ | Xcode project manipulation (macOS/Linux only) |
| swift-log | 1.6.0+ | Logging |
| Rainbow | 4.2.0+ | Terminal colors |
| libwebp | 1.4.1+ | WebP encoding |
| libpng | 1.6.45+ | PNG decoding |
| swift-custom-dump | 1.3.0+ | Test assertions |
| Noora | 0.54.0+ | Terminal UI design system |
| swift-resvg | 0.45.1-swift.15 | SVG parsing/rendering (Windows requires Swift 6.3) |
| swift-docc-plugin | 1.4.5+ | DocC documentation |
| swift-yyjson | 0.5.0+ | High-performance JSON codec |
| pkl-swift | 0.7.2+ | PKL config evaluation & codegen |

## Troubleshooting

Expand Down Expand Up @@ -379,7 +380,7 @@ Contextual documentation is in `.claude/rules/`:
| `cache-granular.md` | Experimental granular node-level cache |
| `api-reference.md` | Figma API endpoints, response mapping |
| `gotchas.md` | Swift 6 concurrency, SwiftLint, rate limits |
| `linux-compat.md` | Linux-specific workarounds |
| `linux-compat.md` | Linux/Windows platform workarounds |
| `testing-workflow.md` | Testing guidelines, commit format |
| `pkl-codegen.md` | pkl-swift generated types, enum bridging, codegen |
| `Sources/*/CLAUDE.md` | Module-specific patterns, modification checklists |
Expand Down
6 changes: 3 additions & 3 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading