-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add CLI commands for Crashlytics #9688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @igor-makarov, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly expands the Firebase CLI's capabilities for Crashlytics by introducing a suite of new commands. These additions empower users to manage Crashlytics issues, notes, reports, and events directly from the command line, mirroring functionality previously available only through the Firebase console. The goal is to provide a more streamlined and scriptable workflow for developers interacting with Crashlytics data. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a comprehensive set of CLI commands for interacting with Firebase Crashlytics, covering issues, notes, reports, and events. The implementation is straightforward and leverages existing service functions effectively.
My review focuses on improving maintainability by reducing code duplication and enhancing robustness through better input validation. Specifically, I've identified opportunities for refactoring:
- The validation for the
--appoption is duplicated across all new command files. - The table rendering logic for events is duplicated in two commands.
- The report generation in
crashlytics-reports-get.tsuses a largeif/else ifstructure that could be simplified.
Additionally, I've pointed out a missing input validation for the --error-type option that could lead to runtime errors.
Addressing these points will make the new commands more robust and easier to maintain in the future.
Add runtime validation for the --error-type option values to prevent invalid error types from being passed to the API. The validation: - Checks that each provided error type is one of: FATAL, NON_FATAL, ANR - Throws a descriptive FirebaseError if an invalid type is provided - Normalizes input to uppercase for case-insensitive matching
Consolidate duplicated --app validation logic into a reusable helper function in src/crashlytics/utils.ts. This reduces code duplication across 8 command files and provides a single source of truth for the validation error message.
Move duplicated event table rendering logic from crashlytics-events-list and crashlytics-events-batchget commands into a shared helper function. This reduces code duplication and ensures consistent table formatting across event display commands.
Replace large if/else if structure with a configuration object that maps report types to their table headers and row extraction functions. This improves maintainability by consolidating report-specific logic into a declarative structure, making it easier to add new report types or modify existing ones.
Rename the CLI option and related variable names: - --error-type -> --issue-type - VALID_ERROR_TYPES -> VALID_ISSUE_TYPES - errorType -> issueType in CommandOptions interface
Commander.js returns a string for single values and an array for multiple values with variadic options. Normalize to array before iterating to prevent iterating over characters of a string.
Description
Add 8 new Crashlytics CLI commands that expose the same functionality available via MCP tools to CLI users:
Issue Management
crashlytics:issues:get- Get details for a Crashlytics issuecrashlytics:issues:update- Update the state of an issue (OPEN/CLOSED)Notes
crashlytics:notes:create- Add a note to an issuecrashlytics:notes:list- List notes for an issuecrashlytics:notes:delete- Delete a note from an issueReports
crashlytics:reports:get- Get aggregated reports (TOP_ISSUES, TOP_VARIANTS, TOP_VERSIONS, TOP_OPERATING_SYSTEMS, TOP_ANDROID_DEVICES, TOP_APPLE_DEVICES)Events
crashlytics:events:list- List recent events for an issuecrashlytics:events:batchget- Get specific events by resource nameAll commands reuse existing service functions from
src/crashlytics/.Scenarios Tested
npm run lint:changed-filespasses (0 errors)npm run buildpassesfirebase help--helpoutputSample Commands