This project implements a CLI tool to manipulate Xcode project files (.xcodeproj) by porting functionality from the xcodeproj-mcp-server.
- Package name:
xcodeproj-cli(wasxcodeproj_cli, renamed to avoid module conflicts) - Executable name:
xcodeproj - Target directory:
Sources/xcodeproj-cli/ - Dependencies:
- https://github.com/tuist/xcodeproj v9.4.3+ (for .xcodeproj manipulation)
- https://github.com/apple/swift-argument-parser v1.6.1+ (for CLI structure)
All 19 tools from the MCP server have been converted to CLI subcommands:
- ✅ create (from create_xcodeproj)
- ✅ list-targets
- ✅ list-build-configurations
- ✅ list-files
- ✅ get-build-settings
- ✅ add-file
- ✅ remove-file
- ✅ move-file
- ✅ create-group
- ✅ add-target
- ✅ remove-target
- ✅ add-dependency
- ✅ set-build-setting
- ✅ add-framework
- ✅ add-build-phase
- ✅ duplicate-target
- ✅ add-swift-package
- ✅ list-swift-packages
- ✅ remove-swift-package
brew install ainame/tap/xcodeprojnpm install -g @ainame/xcodeproj-cli./scripts/release.sh <version>
# Example: ./scripts/release.sh 0.1.3This script will:
- Validate version format and prerequisites
- Update version in
Sources/xcodeproj-cli/Command.swiftandpackage.json - Build and test the project
- Commit the version bump
- Create and push a git tag
- Trigger GitHub Actions to build and publish
- Builds universal binary (arm64 + x86_64) for macOS
- Builds Linux binaries (x86_64 + aarch64)
- Creates GitHub release with assets
- Updates Homebrew formula with new URL and SHA256
- Publishes to npm registry
- Commits formula changes back to main
The project includes a complete npm distribution setup:
xcodeproj-cli/
├── package.json # npm package manifest (at root)
├── npm/ # npm-specific files
│ ├── postinstall.js # Downloads binary from GitHub releases
│ └── wrapper.js # JavaScript entry point
└── .npmignore # Excludes source code from npm package
- package.json: Defines npm package as
@ainame/xcodeproj-cli - npm/wrapper.js: JavaScript wrapper that detects platform/architecture
- npm/postinstall.js: Downloads appropriate binary from GitHub releases after npm install
- .npmignore: Excludes source code, only includes essential distribution files
- User runs
npm install -g @ainame/xcodeproj-cli - npm installs the lightweight package (no binaries included)
- Post-install script downloads the correct binary based on platform:
- macOS (x64/arm64):
xcodeproj-macos-universal - Linux x64:
xcodeproj-linux-x86_64 - Linux arm64:
xcodeproj-linux-aarch64
- macOS (x64/arm64):
- Binary is verified via checksum and made executable
- JavaScript wrapper (
npm/wrapper.js) acts as entry point
- Use ./tmp as workspace (gitignored)
- Scripts are tracked in ./scripts (no longer gitignored)
- Follow the MCP server's implementation patterns but adapt for CLI context
- Use proper error handling and exit codes
- Provide helpful command descriptions and examples
# Development build
swift build
# Release build
swift build -c release
# Run directly
swift run xcodeproj --help# Run local macOS tests
./scripts/test.sh# Run Linux tests (native on Linux, Docker on macOS)
./scripts/test-linux-native.sh # For native Linux environments
./scripts/test-linux.sh # For Docker-based testing
# Run comprehensive testing (macOS + Linux with auto-detection)
./scripts/test-all.sh
# Skip Linux tests if needed
./scripts/test-all.sh --skip-linux# Test individual commands
./TestDemo.xcodeproj
xcodeproj list-targets TestDemo.xcodeproj- Version in Command.swift must match git tag for releases
- BuildSetting type in XcodeProj 9.x uses enum (.string/.array) instead of direct values
- Homebrew formula is automatically updated by GitHub Actions after release
- Use Renovate for automated dependency updates (configured in .github/renovate.json)