upgrade-genkit
GitHub在 monorepo 中同步升级 Genkit Flutter 包以适配 flutter_gemma 核心 API 变更,涵盖差异分析、编译修复、新功能集成及测试更新。
Trigger Scenarios
Install
npx skills add DenisovAV/flutter_gemma --skill upgrade-genkit -g -y
SKILL.md
Frontmatter
{
"name": "upgrade-genkit",
"description": "Realign the genkit_flutter_gemma \/ genkit_hybrid packages when flutter_gemma's core API changes — discover changes, fix compilation, support new features, update fakes\/tests, bump version. Monorepo-aware.",
"user_invocable": true
}
Upgrade Genkit packages to the current flutter_gemma API
The Genkit integration packages (packages/genkit_flutter_gemma, packages/genkit_hybrid)
wrap flutter_gemma's public API. When that API changes, they must be realigned or
they break. In the monorepo they consume flutter_gemma as an in-workspace
path dependency, so a core change can break them in the same commit — run this
whenever a PR changes the public InferenceModel / InferenceChat /
EmbeddingModel / Message / ModelResponse / enum surface.
Follow these 5 phases sequentially. Ask the user before deciding which new features to support (Phase 3).
Paths below are relative to the repo root. Core package =
packages/flutter_gemma; genkit package =packages/genkit_flutter_gemma(mirror forgenkit_hybrid).REPO_ROOT= monorepo root,PKG_DIR=packages/genkit_flutter_gemma,EXAMPLE_DIR=$PKG_DIR/example.
Phase 1: Reconnaissance
- Identify what changed in the core public API. In the monorepo flutter_gemma
is a path dep (not pub), so don't rely on
dart pub outdated— instead read the diff / CHANGELOG ofpackages/flutter_gemma:git log --oneline -- packages/flutter_gemma/lib/flutter_gemma_interface.dart packages/flutter_gemma/lib/corepackages/flutter_gemma/CHANGELOG.md(top entry)
- Summarize for the user:
- Breaking changes (removed/renamed APIs, changed signatures)
- New APIs (new parameters, methods, enums, classes)
- Bug fixes / Deprecations
melos bootstrap(ordart pub getinPKG_DIR+EXAMPLE_DIR).
Phase 2: Fix Compilation
cd packages/genkit_flutter_gemma && dart analyze(repeat forgenkit_hybrid).- Fix all compilation errors. Files that depend on flutter_gemma's API:
-
lib/src/flutter_gemma_runtime.dart—FlutterGemma.getActiveModel(),getActiveEmbedder()signatures -
lib/src/flutter_gemma_model.dart—InferenceModel.createChat()signature,ModelResponsepattern matching,InferenceChatmethods -
lib/src/flutter_gemma_embedder.dart—EmbeddingModel.generateEmbeddings(),PreferredBackendenum -
lib/src/converters/request_converter.dart—Messageconstructors (.withImage,.withAudio,.toolCall,.toolResponse) -
lib/src/converters/response_converter.dart—ModelResponsesubtypes (TextResponse,FunctionCallResponse,ParallelFunctionCallResponse,ThinkingResponse) -
lib/src/converters/tool_converter.dart—Toolconstructor -
lib/src/flutter_gemma_plugin.dart—ModelType,ModelFileTypeenums -
test/src/fake_runtime.dart—FakeInferenceModel,FakeInferenceChat,FakeEmbeddingModelmust match upstream abstract-class signatures (see genkitCLAUDE.md)
-
- Repeat
dart analyzeuntil clean (0 issues).
Phase 3: Support New Features
Based on Phase 1, decide with the user which new APIs to support. Typical integration points:
New parameter in createChat() / createSession()
- Add field to
$FlutterGemmaModelOptionsinlib/src/flutter_gemma_options.dart - Manually update
lib/src/flutter_gemma_options.g.dart(constructor param, field with@override,fromJson,toJson,jsonSchema()entry) - Extract from config + pass in
lib/src/flutter_gemma_model.dart(_executeGeneration) - Update
FakeInferenceModel.createChat()intest/src/fake_runtime.dart(add param, store inlast*field for assertions)
New enum value (e.g. ModelFileType)
- Update comments in
lib/src/flutter_gemma_plugin.dart(FlutterGemmaModelConfig.fileType)
New method on InferenceChat / InferenceModel
- Add override in
FakeInferenceChat/FakeInferenceModelintest/src/fake_runtime.dart
Changed model capabilities
- Update
supportsmap inlib/src/flutter_gemma_plugin.dart(list()method)
Changed message handling
- Update converters in
lib/src/converters/; updateextractSystemInstruction()if system-message handling changed
IMPORTANT: *.g.dart here is manually maintained (build_runner not used by default). Always hand-update it when changing the schema.
Phase 4: Tests and Review
- Update existing tests that verify changed behavior.
- Add tests for each new feature from Phase 3.
flutter test(inPKG_DIR) — all must pass.- Run
/review-prfor comprehensive review; fix what it surfaces.
Phase 5: Finalize
- Bump version in
PKG_DIR/pubspec.yaml(minor for breaking behavior, patch for fixes/non-breaking additions). - Update
PKG_DIR/CHANGELOG.md(new section at top: breaking**Breaking**:/ new features / fixes). - Update
PKG_DIR/README.md(options table, known limitations, quick-start if usage changed). - Verify:
dart analyze && flutter test && dart pub publish --dry-run(all clean). - The release itself goes through the
releaseskill (genkit packages release in lockstep with the monorepo) — do not publish standalone.
Version History
- 451fc69 Current 2026-08-20 14:01


