Skip to content

feat: add Flutter framework support - #942

Merged
edwinyjlim merged 3 commits into
PostHog:mainfrom
peter-trost:feat/flutter-framework-support
Aug 3, 2026
Merged

edwinyjlim merged 3 commits into
PostHog:mainfrom
peter-trost:feat/flutter-framework-support

Conversation

@peter-trost

Copy link
Copy Markdown
Contributor

Related PRs:

Adds Flutter as a supported framework, following the mobile-framework pattern (Android / Swift / KMP, #906):

  • Integration.flutter enum entry, ordered before kmp/swift/android so a Flutter project's android/ and ios/ subtrees don't match the native detectors first
  • FLUTTER_AGENT_CONFIG in src/frameworks/flutter/ — claims a pubspec.yaml that depends on the Flutter SDK (sdk: flutter), so pure Dart projects fall through; gathers the enabled target platforms (android/ios/web/…) as agent context; installs via flutter pub add posthog_flutter
  • pub package-manager helper + FRAMEWORK_REGISTRY entry
  • Pins framework: flutter on integration-flutter in the variant-resolution contract test, matching the context-mill PR above — that PR must release before this merges

Monorepos (pub workspaces / melos) need no framework-specific handling: the agentic project scan targets are built from the registry, so nested Flutter apps are found and scoped automatically; a workspace root pubspec has no sdk: flutter dependency and is correctly not claimed.

Verification: pnpm build ✅, pnpm test ✅ (1533 tests, incl. new flutter detect + enum-order tests), pnpm fix ✅

Closes #47

🤖 Generated with Claude Code

@peter-trost

Copy link
Copy Markdown
Contributor Author

@turnipdabeets this follows your KMP setup from #906 (enum ordering, docs-only skill variant first). Would value your eyes on it. @ioannisj flagging since it drives posthog_flutter. Happy to incorporate any feedback.

@peter-trost

Copy link
Copy Markdown
Contributor Author

Verified end-to-end against a real flutter create app (EU project, OAuth, pi harness / gpt-5.6-sol):

  • Detection resolves Flutter on the intro screen with no manual pick; a pub-workspace root is correctly not claimed.
  • The agent picked integration-flutter from the skill menu, wrote manual Dart initialization from a compile-time env token, disabled native auto-init in AndroidManifest.xml and Info.plist, raised minSdk to 23, instrumented events, and created the dashboard/insight/notebook.
  • flutter analyze on the result: no issues.

The run surfaced one real gap, fixed in the second commit: the bash fence had no flutter/dart entry, so the agent's flutter pub add posthog_flutter was denied and it had to hand installation back to the user in the report. The fence now allows flutter/dart pub (add/remove/get/upgrade/outdated/deps) plus analyze/build/clean/doctor, with run/test/pub run staying denied (same contract as xcodebuild test). Harness bug found along the way split out into #943.

@turnipdabeets turnipdabeets left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I left a few suggestions, but will let @PostHog/team-wizard-docs merge. Also I believe all of your commits need to be signed and verified to merge.

Comment thread src/lib/detection/package-manager.ts Resolved
Comment thread src/lib/agent/bash-fence.ts Resolved
@peter-trost

Copy link
Copy Markdown
Contributor Author

@turnipdabeets thank you for the review and suggestions! Everything addressed.

I've setup commit signing and will force-push the signed commits once this PR gets the green light :)

@gewenyu99

Copy link
Copy Markdown
Collaborator

Hey @Peetee06, this is perfect timing! We're right in the middle of adding Flutter, Java, Go, Rust, and Elixir this morning.

We do need an example app in the context mill that we'll package. I'll be adding that project after your changes go in and publishing this. I'll merge this PR last since context mill needs to go out first.

appreciate your help here!

@peter-trost

Copy link
Copy Markdown
Contributor Author

@gewenyu99 that's awesome! I had the example app lined up next, but then that's already covered!

Anything else you're tackling next where some support is beneficial? I have some capacity and plan to contribute in the coming days. If there's anything you don't have capacity right now to do yourself I can prioritize that. Otherwise I'll find and fix some issues proactively :)

@gewenyu99

Copy link
Copy Markdown
Collaborator

@Peetee06 I will tag you to review my burrito consideration app. I wrote Flutter last in 2023, and I wasn't very good at it so if you have a moment to share your wisdom, I'd appreciate it!

Also thanks for pushing through what might be the most chaotic few weeks in this repo. We're actively ripping apart and rebuilding the agentic core of this repo 🙏 so koodos for managing the confusing layout and out of date readmes :D

@peter-trost

Copy link
Copy Markdown
Contributor Author

Will take a look right at the Flutter example right now 👍

Good thing we have agents to help understand unknown projects now. Fable 5 took 2 minutes to find the right places to add stuff 😄💪 I just stress-tested some assumptions it made about Flutter projects.

@peter-trost

Copy link
Copy Markdown
Contributor Author

@gewenyu99 fixed the conflicts, so this can be merged when the context-mill PR is merged. :)

Let me know if I can support in any way.

@edwinyjlim edwinyjlim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice job @Peetee06

@edwinyjlim

Copy link
Copy Markdown
Member

@Peetee06 we require commits to be signed. would you mind rebasing and adding signatures?

gh pr checkout 942
git rebase --gpg-sign origin/main
git push --force-with-lease

peter-trost and others added 3 commits August 3, 2026 20:43
Adds Flutter as a supported framework following the mobile-framework
pattern (Android / Swift / KMP):

- Integration.flutter enum entry, ordered before kmp/swift/android so a
  Flutter project's android/ and ios/ subtrees don't match the native
  detectors first
- FLUTTER_AGENT_CONFIG in src/frameworks/flutter/ — detects a
  pubspec.yaml depending on the Flutter SDK (sdk: flutter), gathers the
  enabled target platforms as agent context, installs via
  'flutter pub add posthog_flutter'
- pub package-manager helper in detection/package-manager.ts
- FRAMEWORK_REGISTRY entry

The pinned skill-menu contract in variant-resolution.test.ts gains
framework: 'flutter' on integration-flutter, matching the companion
context-mill change that promotes the existing docs-only variant.

Closes #47

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Found in a live e2e run: the agent follows the Flutter prompt's
'flutter pub add posthog_flutter' and the fence denies it — flutter and
dart were missing from the allowlist entirely. The agent then has to
hand the installation back to the user in the setup report.

Allows flutter/dart pub (add|remove|get|upgrade|outdated|deps) and
analyze/build/clean/doctor. run and test stay denied (arbitrary code
execution, same contract as xcodebuild test), as does pub run.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…lper

- detect() anchors on a key/value line (/^\s*sdk:\s*flutter\s*$/m) so
  commented-out mentions don't match and multi-space YAML does
- getTags() guards platforms with ?.length, matching
  getAdditionalContextLines, so platform-less packages emit no empty tag
- pubPackageManager joins the static-helpers it.each suite
- bash-fence comment reframed: build/analyze run project-defined code
  (same contract as xcodebuild build); run/test are out for *arbitrary*
  code execution

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@peter-trost
peter-trost force-pushed the feat/flutter-framework-support branch from 4c61021 to 5214ac4 Compare August 3, 2026 18:51
@peter-trost

Copy link
Copy Markdown
Contributor Author

@edwinyjlim all signed ✅

@edwinyjlim
edwinyjlim merged commit 8e5537b into PostHog:main Aug 3, 2026
12 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.

flutter please

4 participants