Skip to content

Conversation

@cameroncooke
Copy link
Collaborator

@cameroncooke cameroncooke commented Nov 6, 2025

Note

Migrates simulator and UI-testing tools to session-aware APIs, replacing simulatorUuid with simulatorId, hiding IDs from public schemas, and updating simulator-management, logging, workflows, docs, and tests.

  • Session-aware migration:
    • Convert tools to session-aware handlers (createSessionAwareTool) with required simulatorId from session defaults; remove it from public schemas.
    • Rename all params/usage from simulatorUuidsimulatorId across code and tests.
  • Simulator management:
    • erase_sims simplified to single-UDID erase with optional shutdownFirst; updated messages/hints.
    • Update set_sim_location, reset_sim_location, set_sim_appearance, sim_statusbar to session-aware schemas/handlers.
  • Logging:
    • start_sim_log_cap made session-aware; launch_app_logs_sim passes through args and uses console capture by default.
  • Simulator workflows:
    • Update boot_sim, install_app_sim, launch_app_sim, stop_app_sim, build_run_sim, get_sim_app_path, list_sims, open_sim, record_sim_video to use/show simulatorId and adjust next-step guidance.
  • UI testing:
    • Migrate button, describe_ui, gesture, key_press, key_sequence to session-aware; keep others validated against simulatorId and update messaging.
  • Docs:
    • TOOLS.md and session migration checklist updated (mark completed items; adjust erase_sims description).
  • Misc:
    • Add example project .gitignore for build artifacts.

Written by Cursor Bugbot for commit bf78589. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • Documentation

    • Updated simulator management and testing tool documentation
    • Marked session-aware migration tasks as completed
  • Refactor

    • Unified simulator identifier parameter naming across simulator and UI testing tools for consistency
    • Enhanced tool infrastructure for improved session-aware execution and management
  • Chores

    • Added build configuration file for iOS Calculator example project

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 6, 2025

Walkthrough

This PR completes a session-aware tool migration by renaming simulatorUuid to simulatorId across 40+ files, converting tools from createTypedTool to createSessionAwareTool, introducing public schema objects that omit session parameters, and updating corresponding tests and documentation.

Changes

Cohort / File(s) Change Summary
Migration task list
docs/session-aware-migration-todo.md
Marks five simulator-management tools (erase_sims, set_sim_location, reset_sim_location, set_sim_appearance, sim_statusbar) and one logging tool (start_sim_log_cap) as complete in the TODO checklist.
Xcode build artifacts
example_projects/iOS_Calculator/.gitignore
Adds new .gitignore to exclude Xcode build server files (buildServer.json, .compile, .build/).
Simulator logging tool
src/mcp/tools/logging/start_sim_log_cap.ts
src/mcp/tools/logging/__tests__/start_sim_log_cap.test.ts
Switches to createSessionAwareTool, renames simulatorUuidsimulatorId, introduces publicSchemaObject omitting simulatorId, adds uuid validation. Tests updated accordingly.
Simulator management—erase
src/mcp/tools/simulator-management/erase_sims.ts
src/mcp/tools/simulator-management/__tests__/erase_sims.test.ts
Converts to createSessionAwareTool, renames simulatorUdidsimulatorId, removes all-mode erasure, adds publicSchemaObject. Test coverage refocused on single-simulator mode.
Simulator management—location
src/mcp/tools/simulator-management/reset_sim_location.ts
src/mcp/tools/simulator-management/__tests__/reset_sim_location.test.ts
src/mcp/tools/simulator-management/set_sim_location.ts
src/mcp/tools/simulator-management/__tests__/set_sim_location.test.ts
All convert to createSessionAwareTool, rename simulatorUuidsimulatorId, add strict public schemas omitting simulatorId, update all tests.
Simulator management—appearance & status
src/mcp/tools/simulator-management/set_sim_appearance.ts
src/mcp/tools/simulator-management/__tests__/set_sim_appearance.test.ts
src/mcp/tools/simulator-management/sim_statusbar.ts
src/mcp/tools/simulator-management/__tests__/sim_statusbar.test.ts
Switch to createSessionAwareTool, rename parameter to simulatorId, introduce publicSchemaObject.strict(), update test expectations.
Simulator core tools
src/mcp/tools/simulator/boot_sim.ts
src/mcp/tools/simulator/__tests__/boot_sim.test.ts
src/mcp/tools/simulator/build_run_sim.ts
src/mcp/tools/simulator/get_sim_app_path.ts
src/mcp/tools/simulator/install_app_sim.ts
src/mcp/tools/simulator/launch_app_logs_sim.ts
src/mcp/tools/simulator/launch_app_sim.ts
src/mcp/tools/simulator/list_sims.ts
src/mcp/tools/simulator/open_sim.ts
src/mcp/tools/simulator/record_sim_video.ts
src/mcp/tools/simulator/screenshot.ts
src/mcp/tools/simulator/stop_app_sim.ts
Update simulatorUuid references to simulatorId in schemas, descriptions, and Next Steps messaging; add .strict() to public schemas; launch_app_sim adds session-aware tool wiring and exclusivity rules. Corresponding tests updated.
Simulator core test files
src/mcp/tools/simulator/__tests__/install_app_sim.test.ts
src/mcp/tools/simulator/__tests__/launch_app_logs_sim.test.ts
src/mcp/tools/simulator/__tests__/launch_app_sim.test.ts
src/mcp/tools/simulator/__tests__/list_sims.test.ts
src/mcp/tools/simulator/__tests__/open_sim.test.ts
src/mcp/tools/simulator/__tests__/screenshot.test.ts
src/mcp/tools/simulator/__tests__/stop_app_sim.test.ts
Verify that simulatorId is accepted in input but omitted from parsed data; update test expectations, error messages, and command assertions to reference simulatorId.
UI testing tools
src/mcp/tools/ui-testing/button.ts
src/mcp/tools/ui-testing/describe_ui.ts
src/mcp/tools/ui-testing/gesture.ts
src/mcp/tools/ui-testing/key_press.ts
src/mcp/tools/ui-testing/key_sequence.ts
src/mcp/tools/ui-testing/long_press.ts
src/mcp/tools/ui-testing/screenshot.ts
src/mcp/tools/ui-testing/swipe.ts
src/mcp/tools/ui-testing/tap.ts
src/mcp/tools/ui-testing/touch.ts
src/mcp/tools/ui-testing/type_text.ts
Convert to createSessionAwareTool, rename simulatorUuidsimulatorId in schemas and helper functions, introduce strict publicSchemaObject omitting simulatorId, update executeAxeCommand and logging to use new identifier.
UI testing test files
src/mcp/tools/ui-testing/__tests__/button.test.ts
src/mcp/tools/ui-testing/__tests__/describe_ui.test.ts
src/mcp/tools/ui-testing/__tests__/gesture.test.ts
src/mcp/tools/ui-testing/__tests__/key_press.test.ts
src/mcp/tools/ui-testing/__tests__/key_sequence.test.ts
src/mcp/tools/ui-testing/__tests__/long_press.test.ts
src/mcp/tools/ui-testing/__tests__/screenshot.test.ts
src/mcp/tools/ui-testing/__tests__/swipe.test.ts
src/mcp/tools/ui-testing/__tests__/tap.test.ts
src/mcp/tools/ui-testing/__tests__/touch.test.ts
src/mcp/tools/ui-testing/__tests__/type_text.test.ts
Rename simulatorUuidsimulatorId in all test inputs, validations, and error message assertions; verify simulatorId is not present in parsed output; remove unused beforeEach imports.
Utilities
src/utils/simulator-utils.ts
Updates determineSimulatorUuid to accept simulatorId and compute directUuid via simulatorUuid ?? simulatorId.
Documentation
docs/TOOLS.md
Removes dual-mode erase_sims option (all=true); adds new sim_statusbar tool entry.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Areas requiring extra attention:

  • launch_app_sim.ts and corresponding test: Introduces session-aware tool wiring with sessionKeys and exclusivePairs logic; requires verification that mutually exclusive options and session-defaults hydration work correctly.
  • Schema omit/strict patterns: Across ~20 files, verify that the publicSchemaObject.omit({ simulatorId: true }).strict() pattern correctly prevents simulatorId leakage to parsed output while maintaining internal validation.
  • Test coverage validation: Large number of test files updated; spot-check a few representative test suites (e.g., launch_app_sim.test.ts, describe_ui.test.ts, erase_sims.test.ts) to ensure new session-aware tool behavior is exercised.
  • createSessionAwareTool conversion consistency: Verify all tools are using the new factory with matching internalSchema, logicFunction, getExecutor, and requirements structure; check for any inconsistencies in requirements clauses.
  • Command-line interface stability: Verify that the renamed parameter (simulatorUuidsimulatorId) does not break existing user-facing command invocations or documentation beyond what is updated here.

Possibly related PRs

  • PR #120: Introduces session-aware tool pattern and createSessionAwareTool factory that this PR heavily depends on.
  • PR #125: Performs a similar session-aware migration pattern for other tools, using the same createSessionAwareTool and public schema omit strategy.
  • PR #111: Modified the same erase_sims tool; this PR refactors it further to session-aware, single-simulator mode.

Suggested labels

enhancement, refactor

Poem

🐰 The session defaults bloom in spring,
simulatorId takes the reigning crown,
PublicSchemas humbly shrink and trim,
While strict validations keep us all in town,
Forty files now dance as one—
The migration marathon is done! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(simulator): migrate simulator tools to session defaults' accurately summarizes the main change—migrating simulator tools to session-aware handlers with session defaults.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/session-sim-management

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (8)
src/utils/simulator-utils.ts (1)

49-49: Update warning message to reference new parameter name.

The warning message still suggests using simulatorUuid parameter, but should now recommend simulatorId to align with the migration:

-        warning: `The simulatorName '${params.simulatorName}' appears to be a UUID. Consider using simulatorUuid parameter instead.`,
+        warning: `The simulatorName '${params.simulatorName}' appears to be a UUID. Consider using simulatorId parameter instead.`,
src/mcp/tools/simulator/stop_app_sim.ts (1)

11-22: Restore UUID validation for simulatorId

Dropping the .uuid() guard means any string now reaches xcrun simctl terminate, so we’ll surface runtime failures instead of stopping bad input up front. Please reinstate the UUID check so only valid simulator identifiers pass through.

Apply this diff to restore the validation:

-  simulatorId: z
-    .string()
-    .optional()
-    .describe(
+  simulatorId: z
+    .string()
+    .uuid()
+    .optional()
+    .describe(
src/mcp/tools/ui-testing/long_press.ts (2)

12-19: Incorrect source for error classes

DependencyError, AxeError, and SystemError should come from the errors module, not responses. This will break type resolution/runtime.

Apply this fix:

-import {
-  createTextResponse,
-  createErrorResponse,
-  DependencyError,
-  AxeError,
-  SystemError,
-} from '../../../utils/responses/index.ts';
+import { createTextResponse, createErrorResponse } from '../../../utils/responses/index.ts';
+import { DependencyError, AxeError, SystemError } from '../../../utils/errors.ts';

109-125: Migrate to session-aware wrapper and hide simulatorId from public schema

This tool still uses createTypedTool and exposes simulatorId in the public schema. Migrate to the established pattern: (1) import createSessionAwareTool from ../../../utils/typed-tool-factory.ts, (2) create publicSchemaObject by omitting simulatorId (e.g., longPressSchema.omit({ simulatorId: true } as const).strict()), (3) use createSessionAwareTool<LongPressParams> with requirements: [{ allOf: ['simulatorId'], message: 'simulatorId is required' }]. Reference: src/mcp/tools/ui-testing/button.ts.

src/mcp/tools/ui-testing/swipe.ts (2)

120-136: Switch to session-aware factory

Replace createTypedTool with the session-aware tool factory, similar to other migrated plugins, so handler can rely on session defaults and keep simulatorId out of the public surface.


21-33: Refactor swipe.ts to use session-aware tool pattern and omit simulatorId from public schema

Update swipe.ts to follow the established pattern used in similar tools (button.ts, gesture.ts, etc.):

  1. Create publicSchemaObject that omits simulatorId (line ~21)
  2. Change schema export to use publicSchemaObject.shape instead of swipeSchema.shape (line 133)
  3. Replace createTypedTool with createSessionAwareTool in handler (lines 134–140)
  4. Add requirements: [{ allOf: ['simulatorId'] }] to ensure simulatorId is provided via session defaults

This aligns swipe.ts with the session-aware pattern already implemented in button.ts, describe_ui.ts, gesture.ts, and other tools, ensuring simulatorId is derived from session defaults rather than exposed to callers.

src/mcp/tools/ui-testing/touch.ts (1)

22-31: Refactor UI-testing tools to use session-aware wrapper pattern

Tools touch, type_text, tap, swipe, screenshot, and long_press still expose simulatorId in their public schemas. Adopt the established pattern from key_press, key_sequence, describe_ui, gesture, and button:

  1. Create publicSchemaObject by omitting simulatorId from the full schema
  2. Replace createTypedTool with createSessionAwareTool in the handler
  3. Add requirements: [{ allOf: ['simulatorId'], message: 'simulatorId is required' }] to surface session defaults

This ensures consistent session-default handling across all UI-testing tools.

src/mcp/tools/ui-testing/type_text.ts (1)

20-88: Migrate type_text to the session-aware wrapper

Every other simulator-facing tool in this refactor now sources simulatorId from session defaults via createSessionAwareTool and exposes a public schema with that field omitted. Keeping type_text on createTypedTool means the handler still requires simulatorId in the request body, so any caller relying on the new session-default contract will immediately fail validation here. Please mirror the pattern used in files like src/mcp/tools/simulator-management/set_sim_location.ts—introduce a publicSchemaObject that omits simulatorId, switch the export to createSessionAwareTool, and declare the requirements so this tool consumes the shared session default like the rest of the suite.

🧹 Nitpick comments (10)
example_projects/iOS_Calculator/.gitignore (1)

1-7: Reasonable starter .gitignore for the iOS example project.

The file correctly excludes xcode-build-server artifacts and local build directories. The format is clean and well-commented.

Consider including additional common iOS development artifacts for a more complete coverage. This is entirely optional and depends on your project's needs:

 # xcode-build-server files
 buildServer.json
 .compile
 
 # Local build artifacts
 .build/
+
+# Xcode-specific artifacts
+.DS_Store
+*.xcodeproj/xcuserdata/
+.swiftpm/

These additions capture macOS metadata and Xcode user settings that often pollute example projects, though only if your project generates them.

src/mcp/tools/ui-testing/long_press.ts (2)

20-25: Unify axe helper imports with the rest of UI testing tools

Other tools import from utils/axe-helpers.ts; this file uses utils/axe/index.ts. Prefer a single helper module to avoid drift.


44-79: Minor: message clarity for coordinates and duration

Consider including units explicitly in logs/messages, e.g., “duration=1.2s” rather than raw milliseconds conversion only in command args.

src/mcp/tools/ui-testing/swipe.ts (2)

84-93: Optional: include duration=0 in message text

optionsText uses a truthy check, so duration=0 won’t render. Consider explicit check to display duration=0s when provided.

-const optionsText = duration ? ` duration=${duration}s` : '';
+const optionsText = duration !== undefined ? ` duration=${duration}s` : '';

15-19: Helper import consistency

Other files use utils/axe-helpers.ts. Consider standardizing on a single helper module path.

src/mcp/tools/simulator/__tests__/launch_app_logs_sim.test.ts (1)

157-163: Test duplication

Two tests validate bundleId when a simulatorId default is set; they overlap substantially. Consider merging to reduce noise.

Also applies to: 165-172, 174-182

src/mcp/tools/simulator-management/set_sim_appearance.ts (1)

97-101: Trim the redundant schema cast.

setSimAppearanceSchema already satisfies ZodType<SetSimAppearanceParams>, so the as unknown as hop just hides real typing mistakes. Dropping the cast keeps the code honest without changing behavior.

src/mcp/tools/ui-testing/tap.ts (1)

23-24: Align the validation message with the new field name.

Now that the parameter is simulatorId, consider updating the error string to something like “Invalid simulatorId (UUID) format” so the copy matches the API surface.

src/mcp/tools/simulator/launch_app_sim.ts (1)

118-127: Update the fallback message to say “simulatorId.”

If this guard ever fires, the user now expects the terminology you introduced elsewhere (simulatorId). A quick copy edit keeps the messaging consistent with the renamed field.

src/mcp/tools/simulator/launch_app_logs_sim.ts (1)

13-17: Align log capture contract with simulatorId rename

The rest of this tool now works with simulatorId, but the injected log-capture contract still exposes a simulatorUuid key. To keep the rename coherent—and to avoid silently dropping the simulator identifier if startLogCapture has already switched to simulatorId—please update the DTO and invocation to use simulatorId, or confirm that the underlying capture helper still requires the older key.

Also applies to: 46-49

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c004aa and 683a467.

📒 Files selected for processing (56)
  • docs/session-aware-migration-todo.md (1 hunks)
  • example_projects/iOS_Calculator/.gitignore (1 hunks)
  • src/mcp/tools/logging/__tests__/start_sim_log_cap.test.ts (7 hunks)
  • src/mcp/tools/logging/start_sim_log_cap.ts (3 hunks)
  • src/mcp/tools/simulator-management/__tests__/erase_sims.test.ts (4 hunks)
  • src/mcp/tools/simulator-management/__tests__/reset_sim_location.test.ts (5 hunks)
  • src/mcp/tools/simulator-management/__tests__/set_sim_appearance.test.ts (5 hunks)
  • src/mcp/tools/simulator-management/__tests__/set_sim_location.test.ts (14 hunks)
  • src/mcp/tools/simulator-management/__tests__/sim_statusbar.test.ts (9 hunks)
  • src/mcp/tools/simulator-management/erase_sims.ts (6 hunks)
  • src/mcp/tools/simulator-management/reset_sim_location.ts (5 hunks)
  • src/mcp/tools/simulator-management/set_sim_appearance.ts (5 hunks)
  • src/mcp/tools/simulator-management/set_sim_location.ts (5 hunks)
  • src/mcp/tools/simulator-management/sim_statusbar.ts (2 hunks)
  • src/mcp/tools/simulator/__tests__/boot_sim.test.ts (3 hunks)
  • src/mcp/tools/simulator/__tests__/install_app_sim.test.ts (10 hunks)
  • src/mcp/tools/simulator/__tests__/launch_app_logs_sim.test.ts (8 hunks)
  • src/mcp/tools/simulator/__tests__/launch_app_sim.test.ts (10 hunks)
  • src/mcp/tools/simulator/__tests__/list_sims.test.ts (4 hunks)
  • src/mcp/tools/simulator/__tests__/open_sim.test.ts (1 hunks)
  • src/mcp/tools/simulator/__tests__/record_sim_video.test.ts (6 hunks)
  • src/mcp/tools/simulator/__tests__/screenshot.test.ts (13 hunks)
  • src/mcp/tools/simulator/__tests__/stop_app_sim.test.ts (6 hunks)
  • src/mcp/tools/simulator/boot_sim.ts (4 hunks)
  • src/mcp/tools/simulator/build_run_sim.ts (9 hunks)
  • src/mcp/tools/simulator/get_sim_app_path.ts (1 hunks)
  • src/mcp/tools/simulator/install_app_sim.ts (4 hunks)
  • src/mcp/tools/simulator/launch_app_logs_sim.ts (4 hunks)
  • src/mcp/tools/simulator/launch_app_sim.ts (9 hunks)
  • src/mcp/tools/simulator/list_sims.ts (1 hunks)
  • src/mcp/tools/simulator/open_sim.ts (1 hunks)
  • src/mcp/tools/simulator/record_sim_video.ts (6 hunks)
  • src/mcp/tools/simulator/stop_app_sim.ts (8 hunks)
  • src/mcp/tools/ui-testing/__tests__/button.test.ts (16 hunks)
  • src/mcp/tools/ui-testing/__tests__/describe_ui.test.ts (8 hunks)
  • src/mcp/tools/ui-testing/__tests__/gesture.test.ts (14 hunks)
  • src/mcp/tools/ui-testing/__tests__/key_press.test.ts (12 hunks)
  • src/mcp/tools/ui-testing/__tests__/key_sequence.test.ts (13 hunks)
  • src/mcp/tools/ui-testing/__tests__/long_press.test.ts (15 hunks)
  • src/mcp/tools/ui-testing/__tests__/screenshot.test.ts (14 hunks)
  • src/mcp/tools/ui-testing/__tests__/swipe.test.ts (16 hunks)
  • src/mcp/tools/ui-testing/__tests__/tap.test.ts (31 hunks)
  • src/mcp/tools/ui-testing/__tests__/touch.test.ts (23 hunks)
  • src/mcp/tools/ui-testing/__tests__/type_text.test.ts (14 hunks)
  • src/mcp/tools/ui-testing/button.ts (5 hunks)
  • src/mcp/tools/ui-testing/describe_ui.ts (6 hunks)
  • src/mcp/tools/ui-testing/gesture.ts (6 hunks)
  • src/mcp/tools/ui-testing/key_press.ts (5 hunks)
  • src/mcp/tools/ui-testing/key_sequence.ts (5 hunks)
  • src/mcp/tools/ui-testing/long_press.ts (7 hunks)
  • src/mcp/tools/ui-testing/screenshot.ts (4 hunks)
  • src/mcp/tools/ui-testing/swipe.ts (7 hunks)
  • src/mcp/tools/ui-testing/tap.ts (7 hunks)
  • src/mcp/tools/ui-testing/touch.ts (7 hunks)
  • src/mcp/tools/ui-testing/type_text.ts (5 hunks)
  • src/utils/simulator-utils.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: Use .ts extensions for all internal relative imports (e.g., import { tool } from './tool.ts')
Use .ts extensions in re-exports for internal files (e.g., export { default } from '../shared/tool.ts')
Use .js extension only for external package entry points (e.g., import ... from '@scope/pkg/file.js')
Never import internal project files using .js extensions

Files:

  • src/mcp/tools/simulator/open_sim.ts
  • src/mcp/tools/simulator/list_sims.ts
  • src/mcp/tools/ui-testing/screenshot.ts
  • src/mcp/tools/ui-testing/__tests__/screenshot.test.ts
  • src/mcp/tools/simulator/__tests__/list_sims.test.ts
  • src/mcp/tools/simulator/__tests__/open_sim.test.ts
  • src/mcp/tools/simulator/__tests__/stop_app_sim.test.ts
  • src/mcp/tools/simulator/__tests__/record_sim_video.test.ts
  • src/mcp/tools/simulator/__tests__/launch_app_logs_sim.test.ts
  • src/mcp/tools/simulator/__tests__/launch_app_sim.test.ts
  • src/mcp/tools/ui-testing/__tests__/type_text.test.ts
  • src/mcp/tools/ui-testing/__tests__/describe_ui.test.ts
  • src/mcp/tools/ui-testing/touch.ts
  • src/mcp/tools/ui-testing/__tests__/touch.test.ts
  • src/mcp/tools/simulator/launch_app_sim.ts
  • src/mcp/tools/simulator-management/sim_statusbar.ts
  • src/mcp/tools/simulator-management/__tests__/set_sim_appearance.test.ts
  • src/mcp/tools/ui-testing/__tests__/long_press.test.ts
  • src/mcp/tools/simulator-management/set_sim_appearance.ts
  • src/mcp/tools/simulator/__tests__/screenshot.test.ts
  • src/mcp/tools/simulator/stop_app_sim.ts
  • src/mcp/tools/ui-testing/__tests__/gesture.test.ts
  • src/mcp/tools/simulator-management/__tests__/set_sim_location.test.ts
  • src/mcp/tools/ui-testing/long_press.ts
  • src/mcp/tools/logging/start_sim_log_cap.ts
  • src/mcp/tools/simulator/launch_app_logs_sim.ts
  • src/mcp/tools/ui-testing/__tests__/swipe.test.ts
  • src/mcp/tools/simulator/get_sim_app_path.ts
  • src/mcp/tools/simulator/record_sim_video.ts
  • src/mcp/tools/ui-testing/button.ts
  • src/mcp/tools/ui-testing/key_sequence.ts
  • src/mcp/tools/ui-testing/key_press.ts
  • src/mcp/tools/ui-testing/tap.ts
  • src/mcp/tools/simulator-management/__tests__/reset_sim_location.test.ts
  • src/mcp/tools/simulator/boot_sim.ts
  • src/mcp/tools/simulator-management/__tests__/erase_sims.test.ts
  • src/mcp/tools/simulator/build_run_sim.ts
  • src/mcp/tools/simulator-management/reset_sim_location.ts
  • src/mcp/tools/ui-testing/swipe.ts
  • src/mcp/tools/ui-testing/__tests__/tap.test.ts
  • src/mcp/tools/simulator/install_app_sim.ts
  • src/mcp/tools/ui-testing/type_text.ts
  • src/mcp/tools/simulator-management/erase_sims.ts
  • src/mcp/tools/ui-testing/__tests__/key_press.test.ts
  • src/utils/simulator-utils.ts
  • src/mcp/tools/simulator-management/__tests__/sim_statusbar.test.ts
  • src/mcp/tools/ui-testing/gesture.ts
  • src/mcp/tools/simulator/__tests__/boot_sim.test.ts
  • src/mcp/tools/simulator-management/set_sim_location.ts
  • src/mcp/tools/logging/__tests__/start_sim_log_cap.test.ts
  • src/mcp/tools/ui-testing/__tests__/button.test.ts
  • src/mcp/tools/simulator/__tests__/install_app_sim.test.ts
  • src/mcp/tools/ui-testing/describe_ui.ts
  • src/mcp/tools/ui-testing/__tests__/key_sequence.test.ts
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{test,spec}.ts: Do not use Vitest mocking APIs in tests (no vi.mock, vi.fn, vi.spyOn, etc.)
In tests, import the core ...Logic function from the tool and use createMockExecutor/createMockFileSystemExecutor to simulate outcomes

Files:

  • src/mcp/tools/ui-testing/__tests__/screenshot.test.ts
  • src/mcp/tools/simulator/__tests__/list_sims.test.ts
  • src/mcp/tools/simulator/__tests__/open_sim.test.ts
  • src/mcp/tools/simulator/__tests__/stop_app_sim.test.ts
  • src/mcp/tools/simulator/__tests__/record_sim_video.test.ts
  • src/mcp/tools/simulator/__tests__/launch_app_logs_sim.test.ts
  • src/mcp/tools/simulator/__tests__/launch_app_sim.test.ts
  • src/mcp/tools/ui-testing/__tests__/type_text.test.ts
  • src/mcp/tools/ui-testing/__tests__/describe_ui.test.ts
  • src/mcp/tools/ui-testing/__tests__/touch.test.ts
  • src/mcp/tools/simulator-management/__tests__/set_sim_appearance.test.ts
  • src/mcp/tools/ui-testing/__tests__/long_press.test.ts
  • src/mcp/tools/simulator/__tests__/screenshot.test.ts
  • src/mcp/tools/ui-testing/__tests__/gesture.test.ts
  • src/mcp/tools/simulator-management/__tests__/set_sim_location.test.ts
  • src/mcp/tools/ui-testing/__tests__/swipe.test.ts
  • src/mcp/tools/simulator-management/__tests__/reset_sim_location.test.ts
  • src/mcp/tools/simulator-management/__tests__/erase_sims.test.ts
  • src/mcp/tools/ui-testing/__tests__/tap.test.ts
  • src/mcp/tools/ui-testing/__tests__/key_press.test.ts
  • src/mcp/tools/simulator-management/__tests__/sim_statusbar.test.ts
  • src/mcp/tools/simulator/__tests__/boot_sim.test.ts
  • src/mcp/tools/logging/__tests__/start_sim_log_cap.test.ts
  • src/mcp/tools/ui-testing/__tests__/button.test.ts
  • src/mcp/tools/simulator/__tests__/install_app_sim.test.ts
  • src/mcp/tools/ui-testing/__tests__/key_sequence.test.ts
🧠 Learnings (2)
📚 Learning: 2025-09-21T19:27:22.795Z
Learnt from: CR
Repo: cameroncooke/XcodeBuildMCP PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-21T19:27:22.795Z
Learning: Applies to **/*.{test,spec}.ts : In tests, import the core ...Logic function from the tool and use createMockExecutor/createMockFileSystemExecutor to simulate outcomes

Applied to files:

  • src/mcp/tools/ui-testing/__tests__/screenshot.test.ts
  • src/mcp/tools/simulator/__tests__/stop_app_sim.test.ts
  • src/mcp/tools/simulator/__tests__/record_sim_video.test.ts
  • src/mcp/tools/simulator/__tests__/launch_app_logs_sim.test.ts
  • src/mcp/tools/simulator/__tests__/launch_app_sim.test.ts
  • src/mcp/tools/ui-testing/__tests__/type_text.test.ts
  • src/mcp/tools/ui-testing/__tests__/describe_ui.test.ts
  • src/mcp/tools/simulator/launch_app_sim.ts
  • src/mcp/tools/simulator-management/sim_statusbar.ts
  • src/mcp/tools/simulator-management/set_sim_appearance.ts
  • src/mcp/tools/simulator/__tests__/screenshot.test.ts
  • src/mcp/tools/simulator/stop_app_sim.ts
  • src/mcp/tools/ui-testing/__tests__/gesture.test.ts
  • src/mcp/tools/logging/start_sim_log_cap.ts
  • src/mcp/tools/simulator/launch_app_logs_sim.ts
  • docs/session-aware-migration-todo.md
  • src/mcp/tools/ui-testing/key_sequence.ts
  • src/mcp/tools/simulator/boot_sim.ts
  • src/mcp/tools/simulator-management/__tests__/erase_sims.test.ts
  • src/mcp/tools/simulator-management/reset_sim_location.ts
  • src/mcp/tools/ui-testing/__tests__/tap.test.ts
  • src/mcp/tools/simulator/install_app_sim.ts
  • src/mcp/tools/simulator/__tests__/boot_sim.test.ts
  • src/mcp/tools/simulator-management/set_sim_location.ts
  • src/mcp/tools/logging/__tests__/start_sim_log_cap.test.ts
  • src/mcp/tools/ui-testing/__tests__/button.test.ts
  • src/mcp/tools/simulator/__tests__/install_app_sim.test.ts
📚 Learning: 2025-09-21T19:27:22.795Z
Learnt from: CR
Repo: cameroncooke/XcodeBuildMCP PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-21T19:27:22.795Z
Learning: Applies to **/*.{test,spec}.ts : Do not use Vitest mocking APIs in tests (no vi.mock, vi.fn, vi.spyOn, etc.)

Applied to files:

  • src/mcp/tools/simulator/__tests__/stop_app_sim.test.ts
  • src/mcp/tools/simulator/__tests__/record_sim_video.test.ts
  • src/mcp/tools/ui-testing/__tests__/describe_ui.test.ts
  • src/mcp/tools/logging/__tests__/start_sim_log_cap.test.ts
  • src/mcp/tools/ui-testing/__tests__/button.test.ts
  • src/mcp/tools/simulator/__tests__/install_app_sim.test.ts
🧬 Code graph analysis (31)
src/mcp/tools/ui-testing/screenshot.ts (1)
src/utils/logger.ts (1)
  • log (142-162)
src/mcp/tools/simulator/__tests__/stop_app_sim.test.ts (1)
src/utils/session-store.ts (1)
  • sessionStore (47-47)
src/mcp/tools/simulator/__tests__/record_sim_video.test.ts (1)
src/utils/session-store.ts (1)
  • sessionStore (47-47)
src/mcp/tools/simulator/__tests__/launch_app_logs_sim.test.ts (1)
src/utils/session-store.ts (1)
  • sessionStore (47-47)
src/mcp/tools/simulator/__tests__/launch_app_sim.test.ts (1)
src/utils/session-store.ts (1)
  • sessionStore (47-47)
src/mcp/tools/ui-testing/touch.ts (1)
src/utils/logger.ts (1)
  • log (142-162)
src/mcp/tools/simulator/launch_app_sim.ts (2)
src/utils/logger.ts (1)
  • log (142-162)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/simulator-management/sim_statusbar.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/simulator-management/__tests__/set_sim_appearance.test.ts (2)
src/test-utils/mock-executors.ts (1)
  • createMockExecutor (27-75)
src/mcp/tools/simulator-management/set_sim_appearance.ts (1)
  • set_sim_appearanceLogic (72-88)
src/mcp/tools/simulator-management/set_sim_appearance.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/simulator/stop_app_sim.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/ui-testing/long_press.ts (1)
src/utils/logger.ts (1)
  • log (142-162)
src/mcp/tools/logging/start_sim_log_cap.ts (3)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/utils/execution/index.ts (1)
  • getDefaultCommandExecutor (5-5)
src/utils/command.ts (1)
  • getDefaultCommandExecutor (199-210)
src/mcp/tools/simulator/launch_app_logs_sim.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/simulator/record_sim_video.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/ui-testing/button.ts (2)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/utils/command.ts (2)
  • CommandExecutor (20-20)
  • getDefaultCommandExecutor (199-210)
src/mcp/tools/ui-testing/key_sequence.ts (2)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/utils/command.ts (2)
  • CommandExecutor (20-20)
  • getDefaultCommandExecutor (199-210)
src/mcp/tools/ui-testing/key_press.ts (2)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/utils/command.ts (2)
  • CommandExecutor (20-20)
  • getDefaultCommandExecutor (199-210)
src/mcp/tools/ui-testing/tap.ts (2)
src/utils/logger.ts (1)
  • log (142-162)
src/utils/logging/index.ts (1)
  • log (5-5)
src/mcp/tools/simulator/boot_sim.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/simulator-management/__tests__/erase_sims.test.ts (2)
src/test-utils/mock-executors.ts (1)
  • createMockExecutor (27-75)
src/mcp/tools/simulator-management/erase_sims.ts (1)
  • erase_simsLogic (26-130)
src/mcp/tools/simulator-management/reset_sim_location.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/ui-testing/swipe.ts (1)
src/utils/logger.ts (1)
  • log (142-162)
src/mcp/tools/simulator/install_app_sim.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/simulator-management/erase_sims.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/utils/simulator-utils.ts (3)
src/utils/execution/index.ts (1)
  • CommandExecutor (8-8)
src/utils/responses/index.ts (1)
  • ToolResponse (15-15)
src/utils/logger.ts (1)
  • log (142-162)
src/mcp/tools/ui-testing/gesture.ts (2)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/utils/command.ts (2)
  • CommandExecutor (20-20)
  • getDefaultCommandExecutor (199-210)
src/mcp/tools/simulator/__tests__/boot_sim.test.ts (2)
src/test-utils/mock-executors.ts (1)
  • createMockExecutor (27-75)
src/mcp/tools/simulator/boot_sim.ts (1)
  • boot_simLogic (16-62)
src/mcp/tools/simulator-management/set_sim_location.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/simulator/__tests__/install_app_sim.test.ts (1)
src/utils/session-store.ts (1)
  • sessionStore (47-47)
src/mcp/tools/ui-testing/describe_ui.ts (2)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/utils/command.ts (2)
  • CommandExecutor (20-20)
  • getDefaultCommandExecutor (199-210)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cursor Bugbot
🔇 Additional comments (56)
src/mcp/tools/ui-testing/__tests__/touch.test.ts (1)

1-829: LGTM! Comprehensive and consistent renaming.

The migration from simulatorUuid to simulatorId has been applied consistently across all test cases including schema validation, command generation, and handler behavior tests. The test logic and assertions remain unchanged, ensuring the test suite continues to provide the same comprehensive coverage.

src/mcp/tools/ui-testing/__tests__/screenshot.test.ts (5)

1-14: LGTM! Test structure follows coding guidelines.

The imports correctly use .ts extensions, and the test properly imports the core screenshotLogic function along with the appropriate mock executors.


31-50: LGTM! Schema validation tests updated consistently.

All references to the parameter have been correctly updated from simulatorUuid to simulatorId, including test inputs and comments.


53-82: LGTM! Validation error messages properly updated.

The test expectations for validation errors have been correctly updated to reference simulatorId in both the test descriptions and expected error messages.


85-238: LGTM! Command generation tests consistently updated.

All test cases properly use simulatorId as the parameter name while maintaining the correct command generation expectations.


240-448: Handler behavior tests correctly verified and aligned with implementation.

Verification confirms the implementation file at src/mcp/tools/ui-testing/screenshot.ts correctly uses simulatorId throughout:

  • Schema definition uses simulatorId with UUID validation
  • Function signature and all internal references use simulatorId consistently
  • No remnants of simulatorUuid
  • All test expectations match implementation behavior

The test suite comprehensively covers success paths, command execution failures, file I/O errors, cleanup edge cases, and various error types. Tests properly use createMockExecutor and createMockFileSystemExecutor without relying on Vitest mocking APIs.

docs/session-aware-migration-todo.md (1)

36-51: LGTM! Migration tracking looks complete.

The documentation clearly tracks the completed migration of simulator runtime actions, management tools, and logging tools to session-aware defaults. The "(hydrate simulatorUuid)" notation effectively indicates the migration path.

src/mcp/tools/simulator/get_sim_app_path.ts (1)

250-252: LGTM! Parameter naming updated consistently.

The Next Steps guidance now correctly references simulatorId instead of SIMULATOR_UUID, aligning with the session-aware migration.

src/mcp/tools/ui-testing/__tests__/tap.test.ts (1)

1-816: LGTM! Test suite successfully migrated to simulatorId.

All test cases have been systematically updated from simulatorUuid to simulatorId. The changes include:

  • Schema validation test inputs
  • Logic function invocations
  • Error message expectations
  • UUID format validation (still correctly validates UUID format)

The test coverage and assertions remain comprehensive and logically equivalent.

src/mcp/tools/ui-testing/__tests__/long_press.test.ts (1)

1-521: LGTM! Long press tests migrated consistently.

All test cases systematically updated from simulatorUuid to simulatorId, matching the pattern in other UI testing tools. Test coverage and validation logic remain comprehensive.

src/mcp/tools/ui-testing/__tests__/gesture.test.ts (2)

30-55: LGTM! Public schema validation added.

Excellent addition of tests validating that the public schema:

  • Accepts preset and optional parameters
  • Does not expose simulatorId in parsed data (line 54)
  • Still validates input correctly

This properly tests the session-aware tool pattern where simulatorId is handled via session defaults.


78-420: LGTM! Gesture logic tests migrated consistently.

All gestureLogic invocations systematically updated to use simulatorId, maintaining comprehensive test coverage for command generation and error handling.

src/utils/simulator-utils.ts (1)

28-36: LGTM! Backward-compatible parameter handling.

The function now accepts both simulatorUuid and simulatorId, using simulatorUuid ?? simulatorId to maintain backward compatibility while supporting the new naming convention.

src/mcp/tools/simulator/build_run_sim.ts (5)

240-259: LGTM! UUID determination updated for simulatorId.

The call to determineSimulatorUuid now passes simulatorId instead of simulatorUuid, and the returned UUID is stored in the simulatorId variable for clarity.


262-333: LGTM! Simulator boot logic migrated consistently.

All references to the simulator identifier updated to use simulatorId:

  • State checking (line 263)
  • Device comparison (line 291)
  • Boot command construction (line 316)
  • Logging messages (line 323)

348-364: LGTM! App installation updated to use simulatorId.

Install command construction (line 351) and logging (line 349) correctly reference simulatorId.


437-453: LGTM! App launch updated to use simulatorId.

Launch command construction (line 440) and logging (line 438) correctly reference simulatorId.


474-480: LGTM! Next Steps guidance updated consistently.

User-facing examples now use simulatorId parameter, aligning with the new API naming convention.

src/mcp/tools/simulator/__tests__/stop_app_sim.test.ts (4)

8-10: LGTM! Session store cleanup added.

Proper test hygiene with beforeEach clearing the session store to ensure test isolation.


25-40: LGTM! Public schema validation comprehensive.

Excellent testing of the session-aware public API:

  • Validates that bundleId is required in public schema
  • Confirms simulator selectors are stripped from parsed data (lines 32, 39)
  • Tests both simulatorId and simulatorName handling

44-58: LGTM! Session default guidance tested.

Good coverage of error scenarios:

  • Missing simulator selector guidance (lines 44-50)
  • BundleId validation when simulator defaults exist (lines 52-58)

This ensures users receive helpful error messages when session defaults are not configured.


60-170: LGTM! Logic tests migrated to simulatorId.

All stop_app_simLogic invocations systematically updated to use simulatorId, maintaining comprehensive coverage of success and error scenarios.

src/mcp/tools/simulator/list_sims.ts (1)

187-192: LGTM! Instructional text updated to reflect simulatorId parameter naming.

The "Next Steps" guidance now consistently uses simulatorId across all example commands, aligning with the broader parameter renaming in this PR.

src/mcp/tools/ui-testing/screenshot.ts (1)

21-51: LGTM! Complete and consistent migration from simulatorUuid to simulatorId.

The schema, parameter destructuring, command arguments, and log messages have all been updated consistently. The z.infer type automatically reflects the schema change.

src/mcp/tools/simulator/__tests__/open_sim.test.ts (1)

64-73: LGTM! Test expectations updated to match the simulatorId parameter naming.

All occurrences of simulatorUuid in the expected "Next Steps" text have been correctly updated to simulatorId, maintaining alignment with the tool's output.

src/mcp/tools/simulator/__tests__/list_sims.test.ts (1)

124-127: LGTM! Test expectations consistently updated across all test cases.

All four test cases now expect simulatorId in the "Next Steps" guidance, maintaining alignment with the updated tool output.

Also applies to: 180-183, 242-245, 309-312

src/mcp/tools/simulator/open_sim.ts (1)

43-52: LGTM! Instructional text consistently updated to use simulatorId.

All example commands in the "Next Steps" guidance now use simulatorId instead of simulatorUuid, including boot_sim, start_sim_log_cap (with both variants), and launch_app_logs_sim.

src/mcp/tools/simulator/__tests__/screenshot.test.ts (3)

35-51: LGTM! Schema validation tests updated to use simulatorId.

The schema validation tests now correctly use simulatorId for valid and invalid input scenarios, and verify that the field is required.


83-90: LGTM! All test cases consistently updated with simulatorId parameter.

Every invocation of screenshotLogic throughout the test suite now uses simulatorId instead of simulatorUuid, ensuring comprehensive test coverage for the renamed parameter.

Also applies to: 149-157, 207-213, 262-270, 315-323, 358-366, 406-414, 459-467, 492-500, 525-533, 568-576


284-296: LGTM! Error message validation updated to reflect simulatorId.

The validation error message expectation correctly references simulatorId as the required field, aligning with the schema changes.

src/mcp/tools/simulator/__tests__/record_sim_video.test.ts (3)

1-14: LGTM! Test setup adopts session-aware pattern.

The addition of sessionStore import and beforeEach hook to clear session state before each test ensures a clean testing environment, aligning with the session-aware tool migration mentioned in the PR objectives.


21-31: LGTM! Validation tests properly set up simulator context via session store.

The tests now establish a simulator context using sessionStore.setDefaults({ simulatorId: VALID_UUID }) before testing validation logic, ensuring the session-aware tool has the required context.

Also applies to: 33-42


69-91: LGTM! All logic tests updated to use simulatorId parameter.

All invocations of record_sim_videoLogic now use simulatorId instead of simulatorUuid, maintaining consistency with the broader parameter renaming effort.

Also applies to: 120-130, 133-144, 179-188

src/mcp/tools/simulator-management/__tests__/sim_statusbar.test.ts (2)

28-38: LGTM! Tests verify public schema correctly omits simulatorId.

The schema validation tests confirm that:

  1. The public schema accepts dataNetwork values
  2. simulatorId can be provided but is not present in the parsed output
  3. This aligns with the session-aware tool pattern where simulatorId is managed through session defaults

48-64: LGTM! All test cases comprehensively updated to use simulatorId.

Every invocation of sim_statusbarLogic throughout the test suite now uses simulatorId instead of simulatorUuid, covering:

  • Success scenarios (wifi, clear operations)
  • Failure scenarios (command failures, exceptions)
  • Command generation verification for both override and clear operations

Also applies to: 74-86, 94-111, 118-135, 142-159, 184-207, 232-247, 255-271

src/mcp/tools/ui-testing/__tests__/type_text.test.ts (3)

54-71: Schema rename to simulatorId looks good

Validation cases cover valid/invalid UUID and text; imports use .ts extensions and no Vitest mocking is used. Good coverage.

Also applies to: 73-88


112-128: Command args assertion is correct

Verifies --udid is appended and preserves text argument verbatim.


300-319: Error-path coverage is solid

DependencyError handling path is exercised without relying on vi.mock. Nice.

src/mcp/tools/ui-testing/long_press.ts (1)

136-167: Map keying by simulatorId is consistent

getCoordinateWarning uses simulatorId for session tracking; consistent with rename. LGTM.

src/mcp/tools/ui-testing/__tests__/swipe.test.ts (3)

63-86: Schema validation updated correctly

All validations now target simulatorId. Inputs and failure modes look correct.

Also applies to: 88-98, 99-125


128-169: Command construction coverage is thorough

You validate base, duration, all-option, and bundled-path cases with explicit --udid. Nice.

Also applies to: 171-214, 216-268, 270-320


323-331: Handler error messaging checks are precise

Asserting parameter names in the error text reduces regressions in validation formatting.

Also applies to: 333-346

src/mcp/tools/simulator-management/__tests__/reset_sim_location.test.ts (2)

22-30: Good: simulatorId hidden from the public schema

Parsing removes simulatorId, aligning with session-defaults pattern.


100-125: Command and log prefix assertions add valuable guarantees

Capturing argv and the logPrefix ensures stable UX.

src/mcp/tools/simulator/__tests__/launch_app_logs_sim.test.ts (2)

36-48: Public schema correctly hides simulatorId

Validates bundleId-only inputs and strips simulatorId when present.


86-91: Review comment is incorrect

The code exhibits an intentional adapter pattern, not an inconsistency. Tools expose simulatorId as their public parameter but convert it to simulatorUuid when calling internal utilities (log_capture, video_capture). The tests correctly verify this conversion occurs—asserting simulatorUuid is the right expectation because they're testing that the tool properly adapts from simulatorId to simulatorUuid. This pattern is consistent across all tools: launch_app_logs_sim.ts, record_sim_video.ts, and start_sim_log_cap.ts all follow the same conversion logic. No changes are needed.

Likely an incorrect or invalid review comment.

src/mcp/tools/simulator/__tests__/launch_app_sim.test.ts (3)

25-44: Schema hides simulator selectors while allowing passthrough

Nice pattern: schema exposes bundleId/args and strips simulatorId/simulatorName. Matches session-defaults approach.


98-111: Next Steps hint uses simulatorId consistently

Guidance strings reflect the selected identifier and are easy to follow.


322-388: Great: hints respect user’s selector (simulatorName)

When simulatorName is used, all hints continue with simulatorName instead of switching to the resolved UDID.

src/mcp/tools/ui-testing/touch.ts (1)

68-86: Core logic and axe execution paths look correct

Validation enforces at least one of down/up; --udid appended; error mapping covers Dependency/Axe/SystemError.

Also applies to: 142-202

src/mcp/tools/simulator-management/__tests__/set_sim_location.test.ts (1)

28-41: Nice public schema assertion

The literal checks here give solid coverage that the public schema strips simulatorId while still validating latitude/longitude payloads—exactly what the session-default contract relies on.

src/mcp/tools/simulator-management/__tests__/set_sim_appearance.test.ts (1)

85-92: Great session-default coverage

Exercising the handler with no simulatorId and asserting on the guidance text is a nice safeguard that the session-aware wrapper responds correctly when the session defaults are absent.

src/mcp/tools/simulator/__tests__/boot_sim.test.ts (1)

30-37: Session default guard looks good

Thanks for asserting that the new handler path flags missing session defaults and calls out simulatorId explicitly—great regression coverage for the migration.

src/mcp/tools/ui-testing/__tests__/describe_ui.test.ts (1)

42-48: Solid check on session-default enforcement

The explicit assertion that a missing simulatorId triggers the session-default error keeps describe_ui aligned with the new contract—nice coverage.

src/mcp/tools/ui-testing/__tests__/button.test.ts (1)

26-42: Nice public schema guard coverage.

Love that the test now asserts simulatorId is stripped while still validating the rest of the payload—great regression net for the session-aware boundary.

src/mcp/tools/ui-testing/__tests__/key_sequence.test.ts (1)

26-42: Great job mirroring the public schema contract.

These assertions neatly mirror the session-default story and catch accidental reintroduction of simulatorId into the exposed shape—exactly the kind of coverage we need.

Comment on lines 138 to 142
handler: createSessionAwareTool<EraseSimsParams>({
internalSchema: eraseSimsSchema as unknown as z.ZodType<EraseSimsParams>,
logicFunction: erase_simsLogic,
getExecutor: getDefaultCommandExecutor,
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Prevent session defaults from breaking the all: true pathway.

With a stored session default (sessionStore.setDefaults({ simulatorId: 'A' })), calling erase_sims.handler({ all: true }) now fails validation because the merged payload still contains the defaulted simulatorId, so your refine sees both selectors and rejects the request. This used to work before the session-aware migration and is a functional regression: the user can no longer erase all simulators without first clearing their defaults.

Ensure that providing all: true clears any session-sourced simulatorId before validation. One straightforward fix is to configure an exclusive pair so the factory drops the default when all is supplied:

+import type { SessionDefaults } from '../../../utils/session-store.ts';
…
   handler: createSessionAwareTool<EraseSimsParams>({
     internalSchema: eraseSimsSchema as unknown as z.ZodType<EraseSimsParams>,
     logicFunction: erase_simsLogic,
     getExecutor: getDefaultCommandExecutor,
+    exclusivePairs: [['simulatorId', 'all']] as unknown as (keyof SessionDefaults)[][],
   }),

That way a user-provided all removes the conflicting simulatorId coming from session defaults, and validation succeeds again. Adjust the cast/import to match the actual type export if needed.

🤖 Prompt for AI Agents
In src/mcp/tools/simulator-management/erase_sims.ts around lines 138-142,
session defaults can inject a simulatorId that conflicts with a user-supplied
all: true, causing validation to fail; update the createSessionAwareTool call so
that the factory treats the pair (all, simulatorId) as exclusive — i.e., when
all is present it should drop any session-sourced simulatorId before running
validation; implement this by supplying the exclusive-pair configuration/options
to createSessionAwareTool (or the appropriate cast/imported type) so the merged
payload removes simulatorId when all is provided, ensuring the all:true pathway
validates successfully.

Comment on lines 94 to 97
const startRes = await video.startSimulatorVideoCapture(
{ simulatorUuid: params.simulatorUuid, fps: fpsUsed },
{ simulatorUuid: params.simulatorId, fps: fpsUsed },
executor,
);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix capture helper payload key

Both start/stop invocations still send { simulatorUuid: ... }. After the rename, startSimulatorVideoCapture/stopSimulatorVideoCapture expect simulatorId, so this call hands them undefined, causing AXe to run with a missing UDID and the tool to fail consistently. Please switch the payload key to simulatorId in both places.

-      { simulatorUuid: params.simulatorId, fps: fpsUsed },
+      { simulatorId: params.simulatorId, fps: fpsUsed },
@@
-    { simulatorUuid: params.simulatorId },
+    { simulatorId: params.simulatorId },

Also applies to: 145-146

🤖 Prompt for AI Agents
In src/mcp/tools/simulator/record_sim_video.ts around lines 94-97 (and also
apply same change at lines 145-146), the payload uses the old key simulatorUuid
when calling startSimulatorVideoCapture/stopSimulatorVideoCapture; change the
payload key to simulatorId so the function receives the expected value (e.g., {
simulatorId: params.simulatorId, fps: fpsUsed } for start and { simulatorId:
params.simulatorId } for stop), leaving executor and other args unchanged.

@cameroncooke cameroncooke force-pushed the feat/session-sim-management branch from 683a467 to bf78589 Compare November 7, 2025 08:58
@cameroncooke
Copy link
Collaborator Author

@cursor review

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 7, 2025

Open in StackBlitz

npm i https://pkg.pr.new/cameroncooke/XcodeBuildMCP/xcodebuildmcp@135

commit: bf78589

Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no bugs!


Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/mcp/tools/ui-testing/swipe.ts (2)

22-32: Incomplete migration: simulatorId still exposed in public schema.

The PR objectives state that simulatorId should be "hidden from public schemas" and the AI summary indicates a publicSchemaObject should be introduced that omits simulatorId. However, the schema here still includes simulatorId as a required field.

Based on the PR summary and related tools mentioned (e.g., set_sim_location.ts, erase_sims.ts, describe_ui.ts), you should:

  1. Create a publicSchemaObject that omits simulatorId using .omit({ simulatorId: true }) with strict mode
  2. Use the full swipeSchema as the internalSchema for session-aware handling

120-136: Incomplete migration: still using createTypedTool instead of createSessionAwareTool.

The PR objectives and AI summary state this tool should be migrated to use createSessionAwareTool to enable session-aware handling with simulatorId. However, the code still uses createTypedTool.

Migrate the default export to use createSessionAwareTool with:

  • internalSchema set to swipeSchema (with simulatorId)
  • A public schema object that omits simulatorId
  • Session-aware handler that injects simulatorId from session context

Apply a pattern similar to other migrated tools in this PR:

+import { createSessionAwareTool } from '../../../utils/session-aware-tool-factory.ts';
+
+// Public schema omits simulatorId (injected from session)
+const publicSchemaObject = swipeSchema.omit({ simulatorId: true }).strict();
+
 export default {
   name: 'swipe',
   description:
     "Swipe from one point to another. Use describe_ui for precise coordinates (don't guess from screenshots). Supports configurable timing.",
-  schema: swipeSchema.shape, // MCP SDK compatibility
-  handler: createTypedTool(
-    swipeSchema,
-    (params: SwipeParams, executor: CommandExecutor) => {
-      return swipeLogic(params, executor, {
-        getAxePath,
-        getBundledAxeEnvironment,
-        createAxeNotAvailableResponse,
-      });
-    },
-    getDefaultCommandExecutor,
-  ),
+  schema: publicSchemaObject.shape,
+  handler: createSessionAwareTool<typeof swipeSchema, typeof publicSchemaObject>(
+    swipeSchema,
+    publicSchemaObject,
+    (params: SwipeParams, executor: CommandExecutor) => {
+      return swipeLogic(params, executor, {
+        getAxePath,
+        getBundledAxeEnvironment,
+        createAxeNotAvailableResponse,
+      });
+    },
+    getDefaultCommandExecutor,
+  ),
 };
src/mcp/tools/ui-testing/tap.ts (1)

108-124: Incomplete migration: tap.ts still uses createTypedTool.

This file has updated the parameter name from simulatorUuid to simulatorId but hasn't completed the session-aware tool migration that other UI-testing tools have adopted. Compare with button.ts (lines 76-93), which:

  • Imports createSessionAwareTool instead of createTypedTool
  • Defines publicSchemaObject = buttonSchema.omit({ simulatorId: true }).strict()
  • Uses createSessionAwareTool with requirements: [{ allOf: ['simulatorId'], message: '...' }]

The current implementation directly exposes tapSchema.shape (line 112), which includes simulatorId in the public schema, inconsistent with the PR's objective to hide simulatorId from public schemas.

Apply this pattern to complete the migration:

-import { createTypedTool } from '../../../utils/typed-tool-factory.ts';
+import { createSessionAwareTool } from '../../../utils/typed-tool-factory.ts';
+const publicSchemaObject = tapSchema.omit({ simulatorId: true } as const).strict();
+
 export default {
   name: 'tap',
   description:
     "Tap at specific coordinates. Use describe_ui to get precise element coordinates (don't guess from screenshots). Supports optional timing delays.",
-  schema: tapSchema.shape, // MCP SDK compatibility
-  handler: createTypedTool(
-    tapSchema,
-    (params: TapParams, executor: CommandExecutor) => {
-      return tapLogic(params, executor, {
-        getAxePath,
-        getBundledAxeEnvironment,
-        createAxeNotAvailableResponse,
-      });
-    },
-    getDefaultCommandExecutor,
-  ),
+  schema: publicSchemaObject.shape, // MCP SDK compatibility
+  handler: createSessionAwareTool<TapParams>({
+    internalSchema: tapSchema as unknown as z.ZodType<TapParams>,
+    logicFunction: (params: TapParams, executor: CommandExecutor) =>
+      tapLogic(params, executor, {
+        getAxePath,
+        getBundledAxeEnvironment,
+        createAxeNotAvailableResponse,
+      }),
+    getExecutor: getDefaultCommandExecutor,
+    requirements: [{ allOf: ['simulatorId'], message: 'simulatorId is required' }],
+  }),
 };
♻️ Duplicate comments (2)
src/mcp/tools/simulator/record_sim_video.ts (1)

94-97: Critical: Fix payload object keys to use simulatorId.

The payload objects still use the old key simulatorUuid instead of simulatorId. This causes the video capture functions to receive undefined for the simulator identifier, breaking the functionality.

Apply this diff:

-      { simulatorUuid: params.simulatorId, fps: fpsUsed },
+      { simulatorId: params.simulatorId, fps: fpsUsed },

And at line 145:

-    { simulatorUuid: params.simulatorId },
+    { simulatorId: params.simulatorId },

Also applies to: 145-146

src/mcp/tools/ui-testing/gesture.ts (1)

174-230: Duplicate of executeAxeCommand from key_sequence.ts.

This is the same helper function duplicated from key_sequence.ts (lines 110-166). See the refactoring suggestion in that file's review to centralize this helper and eliminate duplication.

🧹 Nitpick comments (3)
src/mcp/tools/simulator/get_sim_app_path.ts (2)

193-193: Simplify redundant conditional.

The ternary (simulatorId ? false : useLatestOS) is redundant since this code is in the else if (simulatorName) branch where simulatorId is guaranteed to be undefined due to XOR validation (lines 125-130). The condition will always evaluate to useLatestOS.

Apply this diff to simplify:

-        destinationString = `platform=${platform},name=${simulatorName}${(simulatorId ? false : useLatestOS) ? ',OS=latest' : ''}`;
+        destinationString = `platform=${platform},name=${simulatorName}${useLatestOS ? ',OS=latest' : ''}`;

250-252: Align placeholder with parameter naming.

The placeholder text uses "SIMULATOR_UUID" while the parameter is named simulatorId. For consistency and clarity in user-facing documentation, consider updating the placeholder to "SIMULATOR_ID".

Apply this diff:

-2. Boot simulator: boot_sim({ simulatorId: "SIMULATOR_UUID" })
-3. Install app: install_app_sim({ simulatorId: "SIMULATOR_UUID", appPath: "${appPath}" })
-4. Launch app: launch_app_sim({ simulatorId: "SIMULATOR_UUID", bundleId: "BUNDLE_ID" })
+2. Boot simulator: boot_sim({ simulatorId: "SIMULATOR_ID" })
+3. Install app: install_app_sim({ simulatorId: "SIMULATOR_ID", appPath: "${appPath}" })
+4. Launch app: launch_app_sim({ simulatorId: "SIMULATOR_ID", bundleId: "BUNDLE_ID" })
src/mcp/tools/ui-testing/key_sequence.ts (1)

110-166: Consider extracting the duplicated executeAxeCommand helper.

This function is duplicated across multiple UI testing tools (also in gesture.ts lines 174-230, and likely others). The comment indicates it was "inlined from src/tools/axe/index.ts". Consider re-centralizing this helper to reduce maintenance burden and ensure consistency across tools.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 683a467 and bf78589.

📒 Files selected for processing (56)
  • docs/TOOLS.md (1 hunks)
  • docs/session-aware-migration-todo.md (1 hunks)
  • example_projects/iOS_Calculator/.gitignore (1 hunks)
  • src/mcp/tools/logging/__tests__/start_sim_log_cap.test.ts (7 hunks)
  • src/mcp/tools/logging/start_sim_log_cap.ts (3 hunks)
  • src/mcp/tools/simulator-management/__tests__/erase_sims.test.ts (4 hunks)
  • src/mcp/tools/simulator-management/__tests__/reset_sim_location.test.ts (5 hunks)
  • src/mcp/tools/simulator-management/__tests__/set_sim_appearance.test.ts (5 hunks)
  • src/mcp/tools/simulator-management/__tests__/set_sim_location.test.ts (14 hunks)
  • src/mcp/tools/simulator-management/__tests__/sim_statusbar.test.ts (9 hunks)
  • src/mcp/tools/simulator-management/erase_sims.ts (3 hunks)
  • src/mcp/tools/simulator-management/reset_sim_location.ts (5 hunks)
  • src/mcp/tools/simulator-management/set_sim_appearance.ts (5 hunks)
  • src/mcp/tools/simulator-management/set_sim_location.ts (5 hunks)
  • src/mcp/tools/simulator-management/sim_statusbar.ts (2 hunks)
  • src/mcp/tools/simulator/__tests__/boot_sim.test.ts (3 hunks)
  • src/mcp/tools/simulator/__tests__/install_app_sim.test.ts (3 hunks)
  • src/mcp/tools/simulator/__tests__/launch_app_logs_sim.test.ts (2 hunks)
  • src/mcp/tools/simulator/__tests__/launch_app_sim.test.ts (7 hunks)
  • src/mcp/tools/simulator/__tests__/list_sims.test.ts (4 hunks)
  • src/mcp/tools/simulator/__tests__/open_sim.test.ts (1 hunks)
  • src/mcp/tools/simulator/__tests__/screenshot.test.ts (13 hunks)
  • src/mcp/tools/simulator/__tests__/stop_app_sim.test.ts (2 hunks)
  • src/mcp/tools/simulator/boot_sim.ts (1 hunks)
  • src/mcp/tools/simulator/build_run_sim.ts (9 hunks)
  • src/mcp/tools/simulator/get_sim_app_path.ts (1 hunks)
  • src/mcp/tools/simulator/install_app_sim.ts (1 hunks)
  • src/mcp/tools/simulator/launch_app_logs_sim.ts (2 hunks)
  • src/mcp/tools/simulator/launch_app_sim.ts (3 hunks)
  • src/mcp/tools/simulator/list_sims.ts (1 hunks)
  • src/mcp/tools/simulator/open_sim.ts (1 hunks)
  • src/mcp/tools/simulator/record_sim_video.ts (1 hunks)
  • src/mcp/tools/simulator/stop_app_sim.ts (3 hunks)
  • src/mcp/tools/ui-testing/__tests__/button.test.ts (16 hunks)
  • src/mcp/tools/ui-testing/__tests__/describe_ui.test.ts (8 hunks)
  • src/mcp/tools/ui-testing/__tests__/gesture.test.ts (14 hunks)
  • src/mcp/tools/ui-testing/__tests__/key_press.test.ts (12 hunks)
  • src/mcp/tools/ui-testing/__tests__/key_sequence.test.ts (13 hunks)
  • src/mcp/tools/ui-testing/__tests__/long_press.test.ts (15 hunks)
  • src/mcp/tools/ui-testing/__tests__/screenshot.test.ts (14 hunks)
  • src/mcp/tools/ui-testing/__tests__/swipe.test.ts (16 hunks)
  • src/mcp/tools/ui-testing/__tests__/tap.test.ts (31 hunks)
  • src/mcp/tools/ui-testing/__tests__/touch.test.ts (23 hunks)
  • src/mcp/tools/ui-testing/__tests__/type_text.test.ts (14 hunks)
  • src/mcp/tools/ui-testing/button.ts (5 hunks)
  • src/mcp/tools/ui-testing/describe_ui.ts (6 hunks)
  • src/mcp/tools/ui-testing/gesture.ts (6 hunks)
  • src/mcp/tools/ui-testing/key_press.ts (5 hunks)
  • src/mcp/tools/ui-testing/key_sequence.ts (5 hunks)
  • src/mcp/tools/ui-testing/long_press.ts (7 hunks)
  • src/mcp/tools/ui-testing/screenshot.ts (4 hunks)
  • src/mcp/tools/ui-testing/swipe.ts (7 hunks)
  • src/mcp/tools/ui-testing/tap.ts (7 hunks)
  • src/mcp/tools/ui-testing/touch.ts (7 hunks)
  • src/mcp/tools/ui-testing/type_text.ts (5 hunks)
  • src/utils/simulator-utils.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (20)
  • src/mcp/tools/ui-testing/tests/type_text.test.ts
  • example_projects/iOS_Calculator/.gitignore
  • src/mcp/tools/simulator/tests/list_sims.test.ts
  • src/mcp/tools/logging/tests/start_sim_log_cap.test.ts
  • src/utils/simulator-utils.ts
  • src/mcp/tools/simulator/list_sims.ts
  • src/mcp/tools/simulator/stop_app_sim.ts
  • src/mcp/tools/ui-testing/tests/touch.test.ts
  • src/mcp/tools/ui-testing/tests/long_press.test.ts
  • src/mcp/tools/ui-testing/tests/describe_ui.test.ts
  • src/mcp/tools/ui-testing/long_press.ts
  • src/mcp/tools/simulator/open_sim.ts
  • src/mcp/tools/simulator/tests/screenshot.test.ts
  • src/mcp/tools/simulator/boot_sim.ts
  • src/mcp/tools/simulator/tests/boot_sim.test.ts
  • src/mcp/tools/simulator/install_app_sim.ts
  • src/mcp/tools/ui-testing/screenshot.ts
  • docs/session-aware-migration-todo.md
  • src/mcp/tools/simulator/build_run_sim.ts
  • src/mcp/tools/simulator/tests/open_sim.test.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: Use .ts extensions for all internal relative imports (e.g., import { tool } from './tool.ts')
Use .ts extensions in re-exports for internal files (e.g., export { default } from '../shared/tool.ts')
Use .js extension only for external package entry points (e.g., import ... from '@scope/pkg/file.js')
Never import internal project files using .js extensions

Files:

  • src/mcp/tools/simulator/get_sim_app_path.ts
  • src/mcp/tools/ui-testing/touch.ts
  • src/mcp/tools/simulator/__tests__/launch_app_sim.test.ts
  • src/mcp/tools/simulator-management/__tests__/erase_sims.test.ts
  • src/mcp/tools/ui-testing/swipe.ts
  • src/mcp/tools/ui-testing/__tests__/key_press.test.ts
  • src/mcp/tools/simulator/record_sim_video.ts
  • src/mcp/tools/simulator/__tests__/stop_app_sim.test.ts
  • src/mcp/tools/ui-testing/type_text.ts
  • src/mcp/tools/ui-testing/__tests__/gesture.test.ts
  • src/mcp/tools/simulator-management/reset_sim_location.ts
  • src/mcp/tools/simulator-management/__tests__/set_sim_location.test.ts
  • src/mcp/tools/simulator-management/__tests__/reset_sim_location.test.ts
  • src/mcp/tools/simulator-management/sim_statusbar.ts
  • src/mcp/tools/ui-testing/__tests__/tap.test.ts
  • src/mcp/tools/simulator/__tests__/install_app_sim.test.ts
  • src/mcp/tools/simulator-management/set_sim_location.ts
  • src/mcp/tools/simulator-management/__tests__/sim_statusbar.test.ts
  • src/mcp/tools/ui-testing/__tests__/swipe.test.ts
  • src/mcp/tools/ui-testing/__tests__/screenshot.test.ts
  • src/mcp/tools/simulator-management/__tests__/set_sim_appearance.test.ts
  • src/mcp/tools/simulator/__tests__/launch_app_logs_sim.test.ts
  • src/mcp/tools/logging/start_sim_log_cap.ts
  • src/mcp/tools/simulator-management/set_sim_appearance.ts
  • src/mcp/tools/simulator/launch_app_sim.ts
  • src/mcp/tools/ui-testing/key_press.ts
  • src/mcp/tools/ui-testing/key_sequence.ts
  • src/mcp/tools/ui-testing/gesture.ts
  • src/mcp/tools/simulator/launch_app_logs_sim.ts
  • src/mcp/tools/ui-testing/describe_ui.ts
  • src/mcp/tools/ui-testing/tap.ts
  • src/mcp/tools/ui-testing/__tests__/button.test.ts
  • src/mcp/tools/ui-testing/__tests__/key_sequence.test.ts
  • src/mcp/tools/simulator-management/erase_sims.ts
  • src/mcp/tools/ui-testing/button.ts
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{test,spec}.ts: Do not use Vitest mocking APIs in tests (no vi.mock, vi.fn, vi.spyOn, etc.)
In tests, import the core ...Logic function from the tool and use createMockExecutor/createMockFileSystemExecutor to simulate outcomes

Files:

  • src/mcp/tools/simulator/__tests__/launch_app_sim.test.ts
  • src/mcp/tools/simulator-management/__tests__/erase_sims.test.ts
  • src/mcp/tools/ui-testing/__tests__/key_press.test.ts
  • src/mcp/tools/simulator/__tests__/stop_app_sim.test.ts
  • src/mcp/tools/ui-testing/__tests__/gesture.test.ts
  • src/mcp/tools/simulator-management/__tests__/set_sim_location.test.ts
  • src/mcp/tools/simulator-management/__tests__/reset_sim_location.test.ts
  • src/mcp/tools/ui-testing/__tests__/tap.test.ts
  • src/mcp/tools/simulator/__tests__/install_app_sim.test.ts
  • src/mcp/tools/simulator-management/__tests__/sim_statusbar.test.ts
  • src/mcp/tools/ui-testing/__tests__/swipe.test.ts
  • src/mcp/tools/ui-testing/__tests__/screenshot.test.ts
  • src/mcp/tools/simulator-management/__tests__/set_sim_appearance.test.ts
  • src/mcp/tools/simulator/__tests__/launch_app_logs_sim.test.ts
  • src/mcp/tools/ui-testing/__tests__/button.test.ts
  • src/mcp/tools/ui-testing/__tests__/key_sequence.test.ts
🧠 Learnings (2)
📚 Learning: 2025-09-21T19:27:22.795Z
Learnt from: CR
Repo: cameroncooke/XcodeBuildMCP PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-21T19:27:22.795Z
Learning: Applies to **/*.{test,spec}.ts : In tests, import the core ...Logic function from the tool and use createMockExecutor/createMockFileSystemExecutor to simulate outcomes

Applied to files:

  • src/mcp/tools/simulator/__tests__/launch_app_sim.test.ts
  • src/mcp/tools/simulator-management/__tests__/erase_sims.test.ts
  • src/mcp/tools/ui-testing/__tests__/key_press.test.ts
  • src/mcp/tools/simulator/__tests__/stop_app_sim.test.ts
  • src/mcp/tools/ui-testing/__tests__/gesture.test.ts
  • src/mcp/tools/simulator-management/reset_sim_location.ts
  • src/mcp/tools/simulator-management/sim_statusbar.ts
  • src/mcp/tools/simulator/__tests__/install_app_sim.test.ts
  • src/mcp/tools/simulator-management/set_sim_location.ts
  • src/mcp/tools/ui-testing/__tests__/screenshot.test.ts
  • src/mcp/tools/simulator/__tests__/launch_app_logs_sim.test.ts
  • src/mcp/tools/logging/start_sim_log_cap.ts
  • src/mcp/tools/simulator-management/set_sim_appearance.ts
  • src/mcp/tools/ui-testing/key_sequence.ts
  • src/mcp/tools/ui-testing/__tests__/button.test.ts
  • src/mcp/tools/simulator-management/erase_sims.ts
📚 Learning: 2025-09-21T19:27:22.795Z
Learnt from: CR
Repo: cameroncooke/XcodeBuildMCP PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-21T19:27:22.795Z
Learning: Applies to **/*.{test,spec}.ts : Do not use Vitest mocking APIs in tests (no vi.mock, vi.fn, vi.spyOn, etc.)

Applied to files:

  • src/mcp/tools/ui-testing/__tests__/button.test.ts
🧬 Code graph analysis (20)
src/mcp/tools/ui-testing/touch.ts (2)
src/utils/logger.ts (1)
  • log (142-162)
src/utils/logging/index.ts (1)
  • log (5-5)
src/mcp/tools/simulator/__tests__/launch_app_sim.test.ts (1)
src/mcp/tools/simulator/launch_app_sim.ts (1)
  • launch_app_simLogic (40-191)
src/mcp/tools/simulator-management/__tests__/erase_sims.test.ts (2)
src/test-utils/mock-executors.ts (1)
  • createMockExecutor (27-75)
src/mcp/tools/simulator-management/erase_sims.ts (1)
  • erase_simsLogic (21-79)
src/mcp/tools/ui-testing/swipe.ts (1)
src/utils/logger.ts (1)
  • log (142-162)
src/mcp/tools/simulator/__tests__/stop_app_sim.test.ts (1)
src/mcp/tools/simulator/stop_app_sim.ts (1)
  • stop_app_simLogic (37-145)
src/mcp/tools/ui-testing/type_text.ts (1)
src/utils/logger.ts (1)
  • log (142-162)
src/mcp/tools/simulator-management/reset_sim_location.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/simulator-management/sim_statusbar.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/simulator/__tests__/install_app_sim.test.ts (2)
src/test-utils/mock-executors.ts (1)
  • createMockFileSystemExecutor (165-181)
src/mcp/tools/simulator/install_app_sim.ts (1)
  • install_app_simLogic (24-94)
src/mcp/tools/simulator-management/set_sim_location.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/simulator-management/__tests__/set_sim_appearance.test.ts (2)
src/test-utils/mock-executors.ts (1)
  • createMockExecutor (27-75)
src/mcp/tools/simulator-management/set_sim_appearance.ts (1)
  • set_sim_appearanceLogic (72-88)
src/mcp/tools/logging/start_sim_log_cap.ts (2)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/utils/command.ts (1)
  • getDefaultCommandExecutor (199-210)
src/mcp/tools/simulator-management/set_sim_appearance.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/ui-testing/key_press.ts (2)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/utils/command.ts (2)
  • CommandExecutor (20-20)
  • getDefaultCommandExecutor (199-210)
src/mcp/tools/ui-testing/key_sequence.ts (2)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/utils/command.ts (2)
  • CommandExecutor (20-20)
  • getDefaultCommandExecutor (199-210)
src/mcp/tools/ui-testing/gesture.ts (2)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/utils/command.ts (2)
  • CommandExecutor (20-20)
  • getDefaultCommandExecutor (199-210)
src/mcp/tools/ui-testing/describe_ui.ts (3)
src/utils/logger.ts (1)
  • log (142-162)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/utils/command.ts (2)
  • CommandExecutor (20-20)
  • getDefaultCommandExecutor (199-210)
src/mcp/tools/ui-testing/tap.ts (2)
src/utils/logger.ts (1)
  • log (142-162)
src/utils/logging/index.ts (1)
  • log (5-5)
src/mcp/tools/simulator-management/erase_sims.ts (1)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/mcp/tools/ui-testing/button.ts (2)
src/utils/typed-tool-factory.ts (1)
  • createSessionAwareTool (74-176)
src/utils/command.ts (2)
  • CommandExecutor (20-20)
  • getDefaultCommandExecutor (199-210)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Cursor Bugbot
  • GitHub Check: Cursor Bugbot
🔇 Additional comments (49)
src/mcp/tools/simulator/__tests__/install_app_sim.test.ts (3)

33-39: LGTM! Correct validation of session-aware schema behavior.

The test properly validates that simulatorId is accepted as input but stripped from parsed data, which aligns with the session-aware tool migration pattern.


177-229: Excellent coverage of bundle ID extraction failure path.

This test properly validates graceful degradation when bundle ID extraction fails, ensuring users still receive helpful Next Steps guidance with a placeholder.


231-283: LGTM! Proper validation of successful bundle ID extraction.

The test correctly validates the happy path where bundle ID extraction succeeds, and line 282's assertion of 2 executor calls accurately reflects the implementation (install command + bundle ID extraction).

src/mcp/tools/ui-testing/__tests__/screenshot.test.ts (1)

1-449: LGTM! Clean parameter rename throughout test file.

The migration from simulatorUuid to simulatorId is consistent and complete across all test cases. The test logic, command generation verification, error handling, and assertions remain unchanged—this is a clean mechanical refactor. The file follows all coding guidelines: no Vitest mocking APIs, uses the mock executor pattern with createMockExecutor/createMockFileSystemExecutor, and imports use .ts extensions.

src/mcp/tools/ui-testing/__tests__/swipe.test.ts (1)

1-563: LGTM! Test file correctly updated for simulatorId rename.

All test cases have been consistently updated to use simulatorId instead of simulatorUuid. The changes include:

  • Schema validation tests (lines 69, 77-86, 91-97, 102-112, 117-124)
  • Command generation tests with various parameter combinations (lines 145, 187, 232, 293)
  • Handler behavior tests for success and error scenarios (lines 324-561)

The test coverage remains comprehensive and the updates align with the parameter rename.

src/mcp/tools/simulator/launch_app_logs_sim.ts (1)

29-33: LGTM! Public schema correctly configured.

The publicSchemaObject correctly omits simulatorId from the public surface and applies strict validation, following the consistent pattern across the PR.

src/mcp/tools/ui-testing/__tests__/tap.test.ts (1)

67-67: LGTM! Test cases correctly migrated to simulatorId.

All test inputs and assertions have been consistently updated from simulatorUuid to simulatorId throughout the file.

Also applies to: 168-168, 356-356, 445-445

src/mcp/tools/simulator/__tests__/stop_app_sim.test.ts (1)

26-35: LGTM! Session defaults test correctly validates schema behavior.

The test correctly verifies that when simulatorId and simulatorName are provided as session defaults, they are accepted by the schema but omitted from the parsed result, ensuring the public API surface properly hides internal session parameters.

src/mcp/tools/ui-testing/__tests__/key_press.test.ts (1)

30-47: LGTM! Public schema test correctly validates session-aware behavior.

The test properly verifies that the public schema accepts simulatorId as input but omits it from the parsed data object, consistent with the session-aware tool pattern.

src/mcp/tools/ui-testing/__tests__/button.test.ts (1)

26-42: LGTM! Public schema validation test correctly implemented.

The test properly validates that the public schema accepts simulatorId but omits it from parsed data, and the unused beforeEach import has been correctly removed.

src/mcp/tools/simulator-management/set_sim_location.ts (1)

118-129: LGTM! Session-aware tool migration correctly implemented.

The migration to createSessionAwareTool is properly configured with the public schema omitting simulatorId, the internal schema retaining full validation, and requirements correctly enforcing simulatorId presence.

src/mcp/tools/simulator/record_sim_video.ts (1)

221-221: LGTM! Strict validation correctly added.

The addition of .strict() to the public schema object correctly enforces that no unknown keys are accepted in the public API surface.

src/mcp/tools/simulator-management/__tests__/sim_statusbar.test.ts (2)

28-38: LGTM: Schema validation correctly tests simulatorId privacy.

The test properly verifies that simulatorId is accepted as input but hidden from the parsed data object, aligning with the session-aware tool pattern.


42-271: LGTM: Test cases consistently updated to simulatorId.

All test invocations, command generation tests, and assertions correctly reference simulatorId instead of simulatorUuid. The expected command arrays and success messages properly incorporate the new parameter name.

src/mcp/tools/simulator/__tests__/launch_app_logs_sim.test.ts (2)

40-46: LGTM: Schema validation correctly tests simulatorId privacy.

The new test case properly validates that simulatorId can be provided in input but is not exposed in the parsed data, consistent with the session-aware tool pattern.


114-143: LGTM: Args passthrough correctly tested with internal parameter mapping.

The test correctly validates that args are passed through to log capture setup. Note that the test accepts simulatorId as public input (line 130) but the captured params show simulatorUuid (line 139), indicating the logic function correctly maps public parameter names to internal implementation names.

src/mcp/tools/ui-testing/__tests__/gesture.test.ts (3)

30-55: LGTM: Schema validation correctly tests simulatorId privacy.

The test properly validates that simulatorId is accepted as input but excluded from parsed data, and that invalid presets are rejected. This aligns with the session-aware tool pattern.


59-221: LGTM: Command generation tests correctly use simulatorId.

All command generation tests properly pass simulatorId as input and verify it appears in the --udid argument position in the generated axe commands.


224-432: LGTM: Handler behavior tests consistently updated.

All handler behavior tests correctly use simulatorId in test inputs across success, error, and edge case scenarios.

src/mcp/tools/simulator-management/__tests__/reset_sim_location.test.ts (2)

22-30: LGTM: Schema validation correctly allows empty input.

The test properly validates that the public schema accepts an empty object (relying on session defaults) and that simulatorId is hidden from parsed data when provided.


34-125: LGTM: All test cases correctly use simulatorId.

Handler behavior and command generation tests consistently use simulatorId in inputs and verify correct command construction with simulatorId in the appropriate position.

src/mcp/tools/ui-testing/touch.ts (4)

24-50: LGTM: Schema and parameter handling updated to simulatorId.

The schema definition and parameter destructuring correctly use simulatorId throughout.


69-108: LGTM: Logging and error handling consistently use simulatorId.

All logging statements and error response creation properly reference simulatorId.


119-140: LGTM: Session tracking updated to simulatorId.

The DescribeUISession type and getCoordinateWarning function correctly use simulatorId for session tracking and warning generation.


143-201: LGTM: Command execution helper updated to simulatorId.

The executeAxeCommand helper function correctly uses simulatorId in its signature, command construction (--udid), and error handling (AxeError construction).

src/mcp/tools/simulator-management/__tests__/set_sim_location.test.ts (3)

28-42: LGTM: Schema validation correctly tests parameter requirements.

The test properly validates that both latitude and longitude are required, and that simulatorId is hidden from parsed data when provided.


45-140: LGTM: Command generation tests correctly use simulatorId.

All command generation tests consistently use simulatorId in inputs and verify correct command construction with simulatorId in the proper position for xcrun simctl location.


143-386: LGTM: Response processing tests comprehensive and correct.

All response processing tests, including success, validation failures, command failures, and boundary value tests, consistently use simulatorId in inputs and expected outputs.

src/mcp/tools/ui-testing/type_text.ts (2)

26-56: LGTM: Schema, parameters, and logging updated to simulatorId.

The schema definition, parameter destructuring, and all logging statements correctly use simulatorId throughout.


91-149: LGTM: Command execution helper updated to simulatorId.

The executeAxeCommand helper function correctly uses simulatorId in its signature, command construction (--udid argument), and error handling (AxeError construction), consistent with the pattern in other UI testing tools.

src/mcp/tools/simulator-management/__tests__/erase_sims.test.ts (2)

6-24: LGTM: Test suite updated for single-simulator mode.

The test suite name, description, and schema validation correctly reflect the narrowed scope to single-simulator erasure by UDID, with optional shutdownFirst parameter.


27-67: LGTM: All test cases consistently use simulatorId.

All test cases correctly use simulatorId in inputs, expected outputs, and tool hint messages. The removal of all-mode tests aligns with the PR's focus on single-simulator operations with session defaults.

src/mcp/tools/simulator/__tests__/launch_app_sim.test.ts (2)

40-48: LGTM: Proper validation of public schema behavior.

The test correctly verifies that simulatorId and simulatorName are accepted as inputs but stripped from the parsed data, which aligns with the session-aware tool pattern where these parameters are hidden from the public schema.


130-171: LGTM: Command sequence properly verified.

The test now properly collects commands and verifies the full sequence: get_app_container check followed by the launch command. This matches the implementation logic in the relevant code snippet.

src/mcp/tools/simulator-management/__tests__/set_sim_appearance.test.ts (1)

22-32: LGTM: Public schema correctly omits simulatorId.

The test properly validates that while simulatorId can be passed as input, it's stripped from the parsed data in the public schema, consistent with the session-aware tool pattern.

src/mcp/tools/ui-testing/__tests__/key_sequence.test.ts (1)

26-44: LGTM: Public schema validation is correct.

The test properly verifies that simulatorId is accepted as input but excluded from parsed data, maintaining the session-aware tool contract.

src/mcp/tools/simulator-management/reset_sim_location.ts (1)

88-102: LGTM: Correctly implements session-aware tool pattern.

The migration is complete and consistent:

  • Public schema properly omits simulatorId (lines 88-90)
  • Session-aware wrapper correctly configured with requirements (lines 96-102)
  • All internal references updated to simulatorId
src/mcp/tools/simulator-management/set_sim_appearance.ts (1)

90-102: LGTM: Complete session-aware migration.

This file correctly implements the session-aware tool pattern with proper public schema separation and requirements enforcement. All references consistently updated to simulatorId.

src/mcp/tools/simulator-management/sim_statusbar.ts (1)

91-104: LGTM: Session-aware pattern correctly applied.

The migration is complete with proper separation of public/internal schemas and consistent use of simulatorId throughout the command construction and messaging.

src/mcp/tools/ui-testing/button.ts (1)

76-94: LGTM: Exemplary session-aware tool migration.

This file demonstrates the complete and correct migration pattern:

  • Public schema properly omits simulatorId (line 76)
  • Session-aware wrapper with requirements enforcement (lines 83-93)
  • All internal references consistently use simulatorId

This serves as a good reference for other UI-testing tools.

src/mcp/tools/ui-testing/describe_ui.ts (1)

117-126: Session-aware handler wiring LGTM.

Good job swapping in createSessionAwareTool with the internal schema and simulatorId requirement; this lines up cleanly with the shared factory contract.

src/mcp/tools/logging/start_sim_log_cap.ts (1)

35-42: Nice UUID-to-legacy bridge.

Mapping simulatorId back to simulatorUuid for startLogCapture keeps the runtime stable while exposing the new session-aware API.

src/mcp/tools/simulator-management/erase_sims.ts (1)

57-68: Helpful shutdown hint.

The conditional hint when the device is still booted is a great touch for guiding users toward shutdownFirst: true.

src/mcp/tools/ui-testing/key_press.ts (1)

88-98: Session default enforcement looks solid.

Requiring simulatorId via the session-aware wrapper keeps the tool consistent with the rest of the AXe surface.

src/mcp/tools/simulator/launch_app_sim.ts (1)

204-213: Exclusive pair handling looks great.

Letting explicit args clear conflicting session defaults for simulatorId/simulatorName avoids the old validation traps.

src/mcp/tools/ui-testing/key_sequence.ts (2)

24-34: LGTM! Schema migration is correct.

The migration from simulatorUuid to simulatorId is complete and consistent. The UUID validation and type inference are correctly implemented.


90-107: Session-aware tool setup is correct.

The public schema correctly omits simulatorId and the handler properly enforces its presence via requirements. The type casting as unknown as z.ZodType<KeySequenceParams> on line 97 appears heavy-handed but is likely necessary due to TypeScript's type inference limitations with ZodObject vs ZodType.

src/mcp/tools/ui-testing/gesture.ts (2)

25-83: LGTM! Schema migration is consistent and correct.

The migration to simulatorId with UUID validation is properly implemented. The schema appropriately validates all gesture parameters including optional screen dimensions, duration, delta, and delay values.


153-171: Session-aware tool setup follows the established pattern.

The configuration mirrors the approach in key_sequence.ts with proper public schema derivation, simulatorId requirement enforcement, and correct handler wiring. The type casting on line 161 is consistent with the pattern used across UI testing tools.

**Purpose**: Tools for managing simulators from booting, opening simulators, listing simulators, stopping simulators, erasing simulator content and settings, and setting simulator environment options like location, network, statusbar and appearance. (5 tools)

- `erase_sims` - Erases simulator content and settings. Provide exactly one of: simulatorUdid or all=true. Optional: shutdownFirst to shut down before erasing.
- `erase_sims` - Erases simulator content and settings for a specific simulator. Requires simulatorUdid. Optional: shutdownFirst to shut down before erasing.
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix documentation to use simulatorId instead of simulatorUdid.

The documentation references simulatorUdid, but this PR consistently migrates the codebase to use simulatorId. Update the description to match.

Apply this diff:

-- `erase_sims` - Erases simulator content and settings for a specific simulator. Requires simulatorUdid. Optional: shutdownFirst to shut down before erasing.
+- `erase_sims` - Erases simulator content and settings for a specific simulator. Requires simulatorId. Optional: shutdownFirst to shut down before erasing.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- `erase_sims` - Erases simulator content and settings for a specific simulator. Requires simulatorUdid. Optional: shutdownFirst to shut down before erasing.
- `erase_sims` - Erases simulator content and settings for a specific simulator. Requires simulatorId. Optional: shutdownFirst to shut down before erasing.
🤖 Prompt for AI Agents
In docs/TOOLS.md around line 72, the description for `erase_sims` uses the old
parameter name `simulatorUdid`; update the text to reference `simulatorId`
instead (e.g., "Requires simulatorId. Optional: shutdownFirst to shut down
before erasing.") so the documentation matches the codebase rename.

@cameroncooke cameroncooke merged commit 81d7183 into main Nov 10, 2025
10 of 11 checks passed
@cameroncooke cameroncooke deleted the feat/session-sim-management branch November 10, 2025 19:29
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.

1 participant