Skip to content
Open
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
30 changes: 7 additions & 23 deletions src/mcp/util/crashlytics/availability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Returns a function that detects whether Crashlytics is available.
*/
export async function isCrashlyticsAvailable(ctx: McpContext): Promise<boolean> {
ctx.host.logger.debug("Looking for whether crashlytics is installed...");

Check warning on line 10 in src/mcp/util/crashlytics/availability.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
return await isCrashlyticsInstalled(ctx);
}

Expand All @@ -22,24 +22,24 @@
!platforms.includes(Platform.ANDROID) &&
!platforms.includes(Platform.IOS)
) {
host.logger.debug("Found no supported Crashlytics platforms.");

Check warning on line 25 in src/mcp/util/crashlytics/availability.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
return false;
}

if (platforms.includes(Platform.FLUTTER) && (await flutterAppUsesCrashlytics(projectDir))) {
host.logger.debug("Found Flutter app using Crashlytics");

Check warning on line 30 in src/mcp/util/crashlytics/availability.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
return true;
}
if (platforms.includes(Platform.ANDROID) && (await androidAppUsesCrashlytics(projectDir))) {
host.logger.debug("Found Android app using Crashlytics");

Check warning on line 34 in src/mcp/util/crashlytics/availability.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
return true;
}
if (platforms.includes(Platform.IOS) && (await iosAppUsesCrashlytics(projectDir))) {
host.logger.debug("Found iOS app using Crashlytics");

Check warning on line 38 in src/mcp/util/crashlytics/availability.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
return true;
}

host.logger.debug(

Check warning on line 42 in src/mcp/util/crashlytics/availability.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
`Found supported platforms ${JSON.stringify(platforms)}, but did not find a Crashlytics dependency.`,
);
return false;
Expand All @@ -59,29 +59,13 @@
}

async function iosAppUsesCrashlytics(appPath: string): Promise<boolean> {
const podfiles = await detectFiles(appPath, "Podfile");
for (const file of podfiles) {
const content = await fs.readFile(path.join(appPath, file), "utf8");
if (content.includes("Crashlytics")) {
return true;
}
}
const swiftPackageFiles = await detectFiles(appPath, "Package.swift");
for (const file of swiftPackageFiles) {
const content = await fs.readFile(path.join(appPath, file), "utf8");
if (content.includes("Crashlytics")) {
return true;
}
}
const cartFiles = await detectFiles(appPath, "Cartfile*");
for (const file of cartFiles) {
const content = await fs.readFile(path.join(appPath, file), "utf8");
if (content.includes("Crashlytics")) {
return true;
}
}
const xcodeProjectFiles = await detectFiles(appPath, "project.pbxproj");
for (const file of xcodeProjectFiles) {
const filePatternsToDetect = ["Podfile", "Package.swift", "Cartfile*", "project.pbxproj"];
const fileArrays = await Promise.all(
filePatternsToDetect.map((term) => detectFiles(appPath, term)),
);

const files = fileArrays.flat();
for (const file of files) {
const content = await fs.readFile(path.join(appPath, file), "utf8");
if (content.includes("Crashlytics")) {
return true;
Expand Down
Loading