Skip to content

fix(codegen-init): add correct pubspec dependency#84

Merged
Arenukvern merged 1 commit into
Arenukvern:mainfrom
drown0315:main
Jun 1, 2026
Merged

fix(codegen-init): add correct pubspec dependency#84
Arenukvern merged 1 commit into
Arenukvern:mainfrom
drown0315:main

Conversation

@drown0315
Copy link
Copy Markdown
Contributor

@drown0315 drown0315 commented May 29, 2026

This PR fixes the dependency added by the flutter-mcp-toolkit codegen-init

Previously, codegen-init executed:

flutter pub add flutter_mcp_toolkit

However, flutter_mcp_toolkit is not a valid/existing pub package, so the command could not add the correct dependency to the target Flutter project’s pubspec.yaml.

This PR changes it to:

flutter pub add mcp_toolkit

Changes

  • Update codegen_init_command.dart
  • Replace flutter_mcp_toolkit with mcp_toolkit in the flutter pub add command

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Corrected package dependency reference to ensure the correct package is added to projects.

Review Change Stack

@docs-page
Copy link
Copy Markdown

docs-page Bot commented May 29, 2026

To view this pull requests documentation preview, visit the following URL:

docs.page/arenukvern/mcp_flutter~84

Documentation is deployed and generated using docs.page.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

📝 Walkthrough

Walkthrough

The runCodegenInit command updates its dependency addition to use the correct package name. When initializing a new Dart MCP server project with flutter pub add enabled, the command now adds mcp_toolkit instead of flutter_mcp_toolkit.

Changes

Package Dependency Update

Layer / File(s) Summary
Flutter pub add package update
mcp_server_dart/lib/src/cli/codegen_init_command.dart
The package name passed to flutter pub add is updated from flutter_mcp_toolkit to mcp_toolkit in the codegen initialization command.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A single package name, corrected with care,
From flutter_mcp_toolkit to mcp_toolkit fair,
The initialization path now shines so bright,
One tiny change that sets the project right! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing the pubspec dependency by changing from an incorrect package name to the correct one.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown

@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.

Caution

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

⚠️ Outside diff range comments (2)
mcp_server_dart/lib/src/cli/codegen_init_command.dart (2)

6-10: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Add comprehensive Dart documentation for this public function.

The runCodegenInit function lacks documentation comments. Public API functions should be documented with:

  • Brief summary of purpose using ///
  • Explanation of key design decisions (why it exists, what problem it solves)
  • Documentation for all parameters
  • Description of return values and error conditions

As per coding guidelines: "Document all public members (methods, properties, etc.) with clear, concise explanations of their purpose and usage in Dart" and "Always focus on WHY (key Design Decisions) it does what it does in concise manner when adding Dart documentation comments".

📝 Example documentation
+/// Initializes MCP server code generation in a Flutter project.
+///
+/// Adds the `mcp_toolkit` dependency and emits the integration snippet.
+/// This command ensures the project has the necessary package and provides
+/// setup instructions for developers to complete the integration.
+///
+/// [projectRoot] is the Flutter project directory path.
+/// [printSnippetOnly] when true, skips dependency installation.
+/// [runPubAdd] when true, executes `flutter pub add mcp_toolkit`.
+///
+/// Returns 0 on success, 66 if pubspec.yaml is missing, or the
+/// exit code from `flutter pub add` on failure.
 Future<int> runCodegenInit({
   required final String projectRoot,
   required final bool printSnippetOnly,
   required final bool runPubAdd,
 }) async {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@mcp_server_dart/lib/src/cli/codegen_init_command.dart` around lines 6 - 10,
Add a Dart documentation comment (///) above the public function runCodegenInit
that provides a brief summary of its purpose, a short note on key design
decisions (why it exists and the problem it solves), parameter documentation for
projectRoot, printSnippetOnly, and runPubAdd, and a description of the return
value and possible error conditions; ensure the doc uses concise "why" focused
language and follows Dart style for public API docs so IDEs and dartdoc render
clear guidance for callers of runCodegenInit.

11-11: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Add explicit type declarations.

Several variables use type inference instead of explicit type declarations. The coding guidelines require explicit types.

As per coding guidelines: "Explicit type declarations must be used".

🔧 Proposed fix
-  final pubspec = File('$projectRoot/pubspec.yaml');
+  final File pubspec = File('$projectRoot/pubspec.yaml');
-    final result = await Process.start(
+    final Process result = await Process.start(
       'flutter',
       ['pub', 'add', 'mcp_toolkit'],
       workingDirectory: projectRoot,
       mode: ProcessStartMode.inheritStdio,
     );
-    final exit = await result.exitCode;
+    final int exit = await result.exitCode;

Also applies to: 19-19, 25-25

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@mcp_server_dart/lib/src/cli/codegen_init_command.dart` at line 11, Change
inferred declarations to explicit typed declarations in the CodegenInitCommand
file: replace the inferred declaration "final pubspec =
File('$projectRoot/pubspec.yaml');" with an explicitly typed declaration "final
File pubspec = File(...)" and do the same for the other inferred variables in
this file (the other two occurrences flagged in the review) by annotating them
with the correct types (e.g., String, File, Directory, etc.) that match their
assigned constructors/values.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@mcp_server_dart/lib/src/cli/codegen_init_command.dart`:
- Around line 6-10: Add a Dart documentation comment (///) above the public
function runCodegenInit that provides a brief summary of its purpose, a short
note on key design decisions (why it exists and the problem it solves),
parameter documentation for projectRoot, printSnippetOnly, and runPubAdd, and a
description of the return value and possible error conditions; ensure the doc
uses concise "why" focused language and follows Dart style for public API docs
so IDEs and dartdoc render clear guidance for callers of runCodegenInit.
- Line 11: Change inferred declarations to explicit typed declarations in the
CodegenInitCommand file: replace the inferred declaration "final pubspec =
File('$projectRoot/pubspec.yaml');" with an explicitly typed declaration "final
File pubspec = File(...)" and do the same for the other inferred variables in
this file (the other two occurrences flagged in the review) by annotating them
with the correct types (e.g., String, File, Directory, etc.) that match their
assigned constructors/values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: df148ad3-a972-4613-9aab-0230225af842

📥 Commits

Reviewing files that changed from the base of the PR and between da12e32 and 0fb5230.

📒 Files selected for processing (1)
  • mcp_server_dart/lib/src/cli/codegen_init_command.dart

@Arenukvern Arenukvern self-assigned this Jun 1, 2026
@Arenukvern
Copy link
Copy Markdown
Owner

@all-contributors please add @drown0315 code maintenance bug

@allcontributors
Copy link
Copy Markdown
Contributor

@Arenukvern

I've put up a pull request to add @drown0315! 🎉

@Arenukvern Arenukvern merged commit dbbb32d into Arenukvern:main Jun 1, 2026
5 of 6 checks passed
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.

2 participants