Skip to content

Add Swift Package build tool#52

Merged
cameroncooke merged 4 commits intomainfrom
codex/add-swift-package-build-tool-to-xcodebuildmcp
Jun 4, 2025
Merged

Add Swift Package build tool#52
cameroncooke merged 4 commits intomainfrom
codex/add-swift-package-build-tool-to-xcodebuildmcp

Conversation

@cameroncooke
Copy link
Collaborator

Summary

  • add new build_swift_package tool
  • register the tool in the tool registry
  • document environment variable for enabling the tool
  • add example Swift package for testing
  • fix formatting in tool implementation

Testing

  • npm run lint
  • npm run format
  • npm run build
  • built and ran default package build
  • built specific target
  • release build with arch error path verified

https://chatgpt.com/codex/tasks/task_e_683ffa38f338832b9b8e50946308d7b4

This comment was marked as outdated.

@cameroncooke cameroncooke force-pushed the codex/add-swift-package-build-tool-to-xcodebuildmcp branch from b92a837 to 33a0d2b Compare June 4, 2025 20:11
@cameroncooke cameroncooke requested a review from Copilot June 4, 2025 20:15

This comment was marked as outdated.

@cameroncooke cameroncooke self-assigned this Jun 4, 2025
- Rename 'archs' parameter to 'architectures' for better readability
- Remove unreachable configuration validation (Zod handles it)
- Fix CHANGELOG.md tool name from swift_package_list_processes to swift_package_list
- Rename registerListSwiftPackageProcessesTool to registerListSwiftPackageTool for consistency
- Extract repeated Zod schemas to common.ts to reduce duplication
@cameroncooke cameroncooke requested a review from Copilot June 4, 2025 20:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Introduces full Swift Package Manager (SPM) support by defining a new workflow group, registering workflow tools, implementing SPM commands, and providing example projects and documentation updates.

  • Defined SWIFT_PACKAGE_WORKFLOW and registered build/test/run/list/stop/clean tools.
  • Implemented SPM tool handlers (swift_package_build, swift_package_test, swift_package_run, etc.).
  • Updated documentation, examples, and the changelog to reflect SPM support.

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/utils/tool-groups.ts Added SWIFT_PACKAGE_WORKFLOW enum value
src/utils/register-tools.ts Registered all SPM tools in the registry
src/tools/common.ts Added Zod schemas for SPM configuration and architectures
src/tools/build-swift-package.ts Implemented swift_package_build tool handler
src/tools/test-swift-package.ts Implemented swift_package_test tool handler
src/tools/run-swift-package.ts Implemented swift_package_run, swift_package_list, swift_package_stop, and swift_package_clean
example_projects/spm/ Added example Swift package with executables and tests
TOOL_OPTIONS.md Documented environment flags for SPM tools
README.md Added Swift Package Manager section
CHANGELOG.md Added v1.7.0 entry for SPM support
Comments suppressed due to low confidence (2)

src/utils/register-tools.ts:160

  • No tests currently cover the registration of the new Swift package tools. Add unit or integration tests to verify that each tool is registered and discoverable by the server.
{

src/tools/test-swift-package.ts:47

  • The --test-product flag may not be supported by swift test. Verify the correct CLI option (e.g., --filter) or remove this parameter to avoid unexpected failures.
args.push('--test-product', params.testProduct);

const args: string[] = ['build', '--package-path', resolvedPath];

if (params.configuration && params.configuration.toLowerCase() === 'release') {
args.push('-c', 'release');
Copy link

Copilot AI Jun 4, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding an else if branch to explicitly handle invalid configuration values (values other than 'debug' or 'release') and return an error, similar to the test and run tools.

Suggested change
args.push('-c', 'release');
args.push('-c', 'release');
} else if (params.configuration && params.configuration.toLowerCase() !== 'debug') {
return createErrorResponse(
'Invalid configuration value',
`The configuration '${params.configuration}' is not supported. Valid values are 'debug' or 'release'.`,
'ValidationError'
);

Copilot uses AI. Check for mistakes.
@cameroncooke cameroncooke merged commit bdcb947 into main Jun 4, 2025
1 check passed
@cameroncooke cameroncooke deleted the codex/add-swift-package-build-tool-to-xcodebuildmcp branch June 4, 2025 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants