Skip to content

[Xcode] AI Tools & Improvements #17875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

SvenTiigi
Copy link
Contributor

Description

AI Tools

This PR adds the following AI Tools to the Xcode Extension:

  • Xcode Projects: Provides the AI with the recently opened Xcode Projects, Swift Packages, Xcode Workspaces or Swift Playgrounds.
  • Swift Package Dependencies: The Swift Package dependencies of a Xcode Project, Xcode Workspace or Swift Package.
  • Xcode Simulators: Provides the AI with the installed Xcode simulators.
  • Boot a Xcode Simulator: Ability to boot a simulator by its udid.
  • Shutdowns a Xcode Simulator: Ability to shutdown a simulator by its udid.
  • Restart a Xcode Simulator: Ability to restart a simulator by its udid.
  • Open a URL in a Xcode Simulator: Ability to open a URL in a simulator.
  • Xcode Simulator Builds: Provides the AI with the builds/apps installed on the Xcode simulators.
  • Xcode Releases: Provides the AI with the information about the releases of Xcode.
  • Add Swift Package: Adds a Swift Package to an Xcode project.
  • Clear Derived Data: Ability to clear the derived data directory.
  • Clear Swift Package Manager: Ability to clear the Swift Package Manager cache directory.
  • Clear SwiftUI Previews Cache: Ability to clear the SwiftUI Previews cache directory.
  • Open Path: Ability to open a Xcode project, Swift Package or directory.

"Search Developer Documentation" command removal

Removed the Search Developer Documentation command due to the unavailability of the underlying API (#17795)

Improvements

  • Improved the Search Recent Projects command to better sort the list of recent projects based on their last usage date.
  • Added an option to select the Swift version when creating a playground.
  • Added an option to delete a simulator ([Xcode] Action to Delete simulator #15857)
  • Updated screenshots for the Raycast Store.

Checklist

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR adds extensive AI tools to the Xcode extension while removing the Search Developer Documentation command due to API issues, with significant improvements to project management and simulator controls.

  • Added 14 new AI tools in package.json for managing Xcode projects, simulators, Swift packages, and cache clearing operations
  • Improved sorting of recent projects in xcode-project.service.ts by adding lastUsed date tracking using mdfind's kMDItemLastUsedDate
  • Added Swift version selection (5 or 6) when creating playgrounds in xcode-swift-playground-creation-parameters.model.ts
  • Removed all Apple Developer Documentation related files and functionality due to API issues (issue [Xcode]...Search documentation always fails with a syntax error #17795)
  • Refactored simulator management to use UDIDs directly in xcode-simulator.service.ts for better decoupling

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

47 file(s) reviewed, 27 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines 283 to 354
"tools": [
{
"name": "xcode-projects",
"title": "Xcode Projects",
"description": "The recently opened Xcode Projects, Swift Packages, Xcode Workspaces or Swift Playgrounds."
},
{
"name": "xcode-swift-package-resolved",
"title": "Swift Package Dependencies",
"description": "The Swift Package dependencies of a Xcode Project, Xcode Workspace or Swift Package."
},
{
"name": "xcode-simulators",
"title": "Xcode Simulators",
"description": "The installed Xcode Simulators."
},
{
"name": "boot-xcode-simulator",
"title": "Boot a Xcode Simulator",
"description": "Boots the Xcode Simulator by its udid."
},
{
"name": "shutdown-xcode-simulator",
"title": "Shutdown a Xcode Simulator",
"description": "Shutdowns the Xcode Simulator by its udid."
},
{
"name": "restart-xcode-simulator",
"title": "Restart a Xcode Simulator",
"description": "Shutdowns the Xcode Simulator by its udid."
},
{
"name": "open-url-in-xcode-simulator",
"title": "Open a URL in a Xcode Simulator",
"description": "Opens a URL in a Xcode Simulator either the a specific one identified by its udid or the currently booted one, if any."
},
{
"name": "xcode-simulator-applications",
"title": "Xcode Simulator Builds",
"description": "The builds / apps installed on a Xcode simulator."
},
{
"name": "xcode-releases",
"title": "Xcode Releases",
"description": "The releases of Xcode."
},
{
"name": "xcode-add-swift-package",
"title": "Add Swift Package",
"description": "Adds a Swift Package to an Xcode project (*.xcodeproj) or Xcode workspace (*.xcworkspace) using its HTTPS or SSH URL."
},
{
"name": "clear-derived-data",
"title": "Clear Derived Data",
"description": "Clears the derived data directory."
},
{
"name": "clear-swift-package-manager-cache",
"title": "Clear Swift Package Manager Cache",
"description": "Clears the Swift Package Manager cache directory."
},
{
"name": "clear-swift-ui-previews-cache",
"title": "Clear SwiftUI Previews Cache",
"description": "Clears the SwiftUI previews cache directory."
},
{
"name": "open-path",
"title": "Open Path",
"description": "Opens a file path which either points to a file for example a Xcode Project (*.xcodeproj), Swift Package (Package.swift), Xcode Workspace (*.xcworkspace), Swift Playground (*.playground) or a directory."
}
],
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Since tools section includes AI capabilities, it should also include 'ai' field with 'evals' inside

Comment on lines +19 to +20
export default (input: Input) =>
XcodeSwiftPackageService.addSwiftPackage(input.swiftPackageUrl, input.xcodeProjectFilePath);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider wrapping this in a try-catch block to handle potential errors when adding packages

Suggested change
export default (input: Input) =>
XcodeSwiftPackageService.addSwiftPackage(input.swiftPackageUrl, input.xcodeProjectFilePath);
export default async (input: Input) => {
try {
await XcodeSwiftPackageService.addSwiftPackage(input.swiftPackageUrl, input.xcodeProjectFilePath);
} catch (error) {
await showFailureToast(error);
}
};

/**
* Returns the Xcode releases.
*/
export default () => XcodeReleaseService.xcodeReleases();
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider wrapping the service call in a try-catch block to handle potential fetch errors gracefully

Suggested change
export default () => XcodeReleaseService.xcodeReleases();
export default async () => {
try {
return await XcodeReleaseService.xcodeReleases();
} catch (error) {
showFailureToast("Failed to fetch Xcode releases", error);
return [];
}
};

* Retrieves the Swift Package Resolved file for an Xcode project.
* @param input The input.
*/
export default (input: Input) => XcodeSwiftPackageResolvedService.getPackageResolved(input.xcodeProjectDirectoryPath);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider wrapping this in a try-catch block to handle potential errors when reading package resolved files

Suggested change
export default (input: Input) => XcodeSwiftPackageResolvedService.getPackageResolved(input.xcodeProjectDirectoryPath);
export default async (input: Input) => {
try {
return await XcodeSwiftPackageResolvedService.getPackageResolved(input.xcodeProjectDirectoryPath);
} catch (error) {
showFailureToast("Failed to read package resolved file", error);
return [];
}
};

/**
* Returns the Xcode simulators.
*/
export default () => XcodeSimulatorService.xcodeSimulators();
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Missing return type annotation for better type safety

/**
* Returns the Xcode Simulator applications / builds.
*/
export default () => XcodeSimulatorApplicationService.xcodeSimulatorApplications();
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider wrapping this call in a try-catch block to handle potential errors when accessing simulator applications

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: xcode Issues related to the xcode extension OP is author The OP of the PR is the author of the extension labels Mar 19, 2025
@raycastbot
Copy link
Collaborator

raycastbot commented Mar 19, 2025

Thank you for the update! 🎉

You can expect an initial review within five business days.

…ments

# Conflicts:
#	extensions/xcode/CHANGELOG.md
@SvenTiigi
Copy link
Contributor Author

@pernielsentikaer any updates on this PR?

@pernielsentikaer
Copy link
Collaborator

It's up to our AI team to review AI extensions, but let me see if I can do it 😊

…ments

# Conflicts:
#	extensions/xcode/CHANGELOG.md
#	extensions/xcode/src/services/xcode-simulator.service.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Extension extension fix / improvement Label for PRs with extension's fix improvements extension: xcode Issues related to the xcode extension OP is author The OP of the PR is the author of the extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants