fix(npm): vendor the current Dart sources instead of a v0.9.1 snapshot - #61
Merged
Conversation
The npm wrapper falls back to running the server from vendored Dart source whenever a native binary is unavailable, but that tree had been frozen at v0.9.1 while lib/ grew to 100 files. Users on npm were running a server nearly forty releases old, which is why tap by `ref` and by coordinates were rejected with an error string that no longer exists in the source (issue #52, problem 1). Two reasons it drifted: - `build.js` resolved the repository root one directory too high, so every source path missed and it only ever printed warnings. - Even when run, it copied a hardcoded list of nine files. Everything added since — drivers/, discovery/, bridge/, engine/, protocol/, diagnostics/, cli/tool_handlers/ — was silently skipped. - Nothing invoked it during a release; `npm publish` shipped whatever happened to be committed. Mirror whole directories rather than an enumerated list, fix the root path, and abort with a non-zero exit when an expected source file is missing so a broken tree cannot be published quietly. The generated pubspec drops dev dependencies and is checked against the entrypoint's `package:` import, since a rename there would leave the fallback unable to compile. Wiring the script to `prepack` means npm regenerates the tree before every `npm pack` and `npm publish`.
This was referenced Sep 1, 2026
`dart analyze` treats warnings as fatal (exit 2), and this unreferenced declaration was one of the issues keeping it red. Regenerating the vendored tree in this branch would otherwise have duplicated the warning into packaging/npm/dart/, so it is removed here rather than separately. dart analyze now reports no issues at all.
Member
Author
|
Follow-up: Regenerating the vendored tree removes the two errors it was causing: I also removed the unreferenced The |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes problem 1 of #52. Also unblocks the Dart fallback that #45, #49 and #50 depend on.
Summary
The npm wrapper runs the server from vendored Dart source whenever a native binary is missing or fails to launch. That vendored tree was frozen at v0.9.1 while
lib/grew to 100 files, so npm users have been running a server ~40 releases old.That is the exact symptom reported in #52: the published server rejects
tapbyrefand by coordinates withand that string exists nowhere in v0.9.36 source — only in
packaging/npm/dart/lib/src/flutter_skill_client.dart, the stale copy. Current source says"Must provide key, text, or ref for tap".Why it drifted — three compounding bugs
build.jscomputedrootDiraspath.join(__dirname, '..', '..'), which lands onpackaging/, not the repo root. Every source path missed, so the script only ever printedWarning: ... not foundand copied nothing.drivers/,discovery/,bridge/,engine/,protocol/,diagnostics/,cli/tool_handlers/— was silently skipped.publish-npmchecks out the repo and callsnpm publishdirectly, so whatever was committed got shipped.Changes
lib/) instead of an enumerated list, so newly added files can never be missed again.npm publishrather than shipping a broken fallback.pubspec.yamlname matches thepackage:import inbin/server.dart— a rename upstream would otherwise leave the fallback uncompilable (the stale tree had diverged toflutter_skill_npm).dev_dependenciesfrom the vendored pubspec so thepub getthe wrapper runs on first launch stays light.prepackso npm regenerates the tree before everynpm pack/npm publish. The tree stays committed as a safety net, and is regenerated here.Test plan
node scripts/build.js→Copied lib/ (100 files),102 files vendored for flutter_skill 0.9.36(was: 7 Dart files at v0.9.1)flutter pub get && dart run bin/server.dart server→initializereturns"version":"0.9.36"tools/call tap {x:10,y:20}against the vendored copy now fails withNot connected to Flutter app— i.e. the argument is accepted — instead ofMust provide key or text for tapnpm pack --dry-run→ prepack fires, tarball contains 100dart/libfiles includingdart/lib/src/cli/tool_handlers/bf_interaction.dart,dart/lib/src/drivers/flutter_driver.dart,dart/lib/src/discovery/unified_discovery.dartlib/flutter_skill.dart→ build exits1withrequired source file is missing, publishing would abortname: flutter_skill/version: 0.9.36/publish_to: 'none', matchingpackage:flutter_skill/...in the entrypointNote
Problem 2 of #52 (topmost-route matching) was fixed by #53 and is merged but unreleased. Problem 3 (Semantics-based targeting) is tracked separately.
🤖 Generated with Claude Code