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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [Unreleased]

### Fixed

- Fixed `mobilebuildmcp debugging attach --pid` failing with "Mutually exclusive parameters provided: bundleId, pid" when the project's session defaults set `bundleId`. An explicit `pid` now drops the configured `bundleId` on the CLI, as it already did over MCP ([#551](https://github.com/getsentry/MobileBuildMCP/issues/551)).

## [2.7.1]

### Changed
Expand Down
33 changes: 33 additions & 0 deletions src/cli/__tests__/session-defaults.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,39 @@ describe('CLI session defaults', () => {
});
});

it('drops a configured bundleId when the user attaches by pid', () => {
const merged = mergeCliSessionDefaults({
defaults: {
bundleId: 'com.example.App',
simulatorId: 'SIM-1',
},
explicitArgs: {
pid: 4242,
},
});

expect(merged).toEqual({
simulatorId: 'SIM-1',
pid: 4242,
});
});

it('drops a configured bundleId when JSON args pass pid with a null bundleId', () => {
const merged = mergeCliSessionDefaults({
defaults: {
bundleId: 'com.example.App',
},
explicitArgs: {
pid: 4242,
bundleId: null,
},
});

expect(merged).toEqual({
pid: 4242,
});
});

it('prefers simulatorId when both simulator defaults come only from config', () => {
const merged = mergeCliSessionDefaults({
defaults: {
Expand Down
6 changes: 5 additions & 1 deletion src/cli/session-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import type { SessionDefaults } from '../utils/session-store.ts';
import {
mergeSessionDefaultArgs,
pickSessionDefaultsForKeys,
type ExclusiveParameterGroup,
} from '../utils/session-default-args.ts';

const CLI_SESSION_DEFAULT_EXCLUSIVE_PAIRS: (keyof SessionDefaults)[][] = [
// Mirrors the exclusive pairs the tool handlers declare: an explicit value for one key drops the
// configured default for the other, so a merged default never collides with an explicit argument.
const CLI_SESSION_DEFAULT_EXCLUSIVE_PAIRS: readonly ExclusiveParameterGroup[] = [
['projectPath', 'workspacePath'],
['simulatorId', 'simulatorName'],
['bundleId', 'pid'],
];

export function resolveCliSessionDefaults(opts: {
Expand Down