dart_boost 0.2.1
dart_boost: ^0.2.1 copied to clipboard
Version-aware AI coding guidelines and multi-agent wiring for Dart and Flutter: composes guidance from resolved versions, wires up dart mcp-server, and its own rules MCP server.
Changelog #
0.2.1 #
- Adds an example.
example/README.mdwalks a real session: install, recording a rule, bootstrapping rules from an existing codebase, and readingdoctor. pub.flutter-io.cn renders it as the package's Example tab, which was empty. No behaviour changed.
0.2.0 #
Project rules: dart_boost's own MCP server, so agents record durable project-specific decisions instead of re-deriving them every session.
record_ruleMCP server. A second server, run viadart run dart_boost:mcp, wired into every selected agent's config unless--no-rules. Its one tool,record_rule, takes a glob, a title and a note, and files the rule into.ai/rules/<area>.md— grouped by the part of the codebase the glob covers, appended to an existing file when one already covers that area — then regenerates.ai/rules/index.md, a table of every glob and the file that backs it. The guidelines stanza tells every agent to check the index before touching a file and read only the matching rows, so a large project's rules do not all land in context at once. The server never crashes on a malformed rule file; it skips it silently, anddart_boost rules indexanddoctorare what report it.dart_boost rules index. Regenerates the index from whatever is on disk without touching the rule files themselves — for the one case that bypassesrecord_rule: a rule file added or edited by hand, or a merge conflict resolved badly..ai/infer-conventions.md. Written alongside the guidelines whenever rules are enabled. Walks an agent through inferring this project's existing, unwritten conventions — state management, widget composition, error handling, testing, and more — from a representative sample of the code, and has it present every finding with evidence before recording anything, so a human decides what is a real convention and what is a coin flip.- Enabling rules adds a dev dependency, once, with consent.
dart run dart_boost:mcponly resolves when dart_boost is a dependency of the target project, so the firstinstallwith rules turned on asks before runningdart pub add dev:dart_boost— the one pubspec edit this installer ever makes, and only after an explicit yes. Unattended runs (no TTY, CI) skip the edit and say so rather than editingpubspec.yamlon a machine that never asked; the guidelines and the SDK's own MCP entry are still written regardless.--no-rulesturns the whole feature off — no server, no procedure file, no dependency — andupdateremembers that choice instead of silently turning it back on. doctorreports on rules. The rules directory and whether it exists, how many rule files parsed and how many failed to, whether dart_boost is a dev dependency (and what it means if not — the server cannot start), the exact server command, and whether rules are enabled indart_boost.json. Reported statically rather than probed: unlikedart mcp-server, the rules server is a stdio JSON-RPC process that blocks reading its own stdin and does not understand--version, so spawning it to check would just hangdoctor. The real question — will an agent be able to start this? — has a static answer: only when dart_boost is a resolved dependency.updateno longer adopts agents on its own. It configures exactly the agents recorded by the lastinstall. An agent installed since then is reported —Cursor was installed since the last run— and left alone, rather than being configured silently. The old behaviour wrote guidelines and MCP config to agents that had never been selected, and becauseupdateskips the confirmation prompt by contract, an unattended run gave you nothing to say no to. Adding an agent is now a deliberate act:install, or--agents=. This also means an agent you deliberately left unticked stays unticked instead of being re-offered on every run.- State file split.
dart_boost.jsonnow holds only what a human chose (agents, feature flags, trusted packages, whether rules are on); the observations a previous run recorded (resolved dependency versions, the fragments they produced, the last-seen SDKs) moved to.dart_tool/dart_boost/state.json, which is per-machine and already gitignored by.dart_tool/convention. Keeping them together meant a teammate on a different Flutter version rewrote the committed file on everyupdate, and made drift reporting compare against whoever last committed rather than against your own previous run. Adart_boost.jsonwritten before the split (schema version 1) is migrated automatically on the nextinstallorupdate: its observations are moved into the new machine-state file and it is rewritten in the new, choices-only shape — nothing to do by hand.
0.1.0 #
Initial release: the installer, the guidelines machinery, and the first fragment library.
- Project detection. Direct-vs-transitive resolution from
.dart_tool/package_graph.json, falling back topubspec.lock'sdependency:field and thenpubspec.yaml. SDK version resolved from.dart_tool/version→ FVM 3 → FVM 2 → the.fvm/flutter_sdksymlink →flutter.version.json→ an opt-influtter --version --machineprobe. Pub workspaces and Melos monorepos handled. - Version-aware composition. Fragments keyed on the resolved major (or the
minor below
1.0.0, which is pub's breaking axis) and on the SDK minor for both Flutter and Dart. The Dart SDK key applies to every project, Flutter or not, so a Dart-only project still gets version-keyed guidance. Four-source layering with user overrides, priority and must-be-direct rules. - Renderer.
if/else/endover named flags plus{{ variable }}, with fenced code blocks masked and HTML-comment directives. Never throws. - Agent wiring. Nine agents; guidelines written into a sentinel block that survives re-runs, and MCP entries spliced into JSON, JSONC and TOML configs without disturbing comments or formatting. Every splice is re-parsed before it is written, written atomically, and backed up once.
- FVM-aware MCP command, so an FVM-pinned project does not point its agents at the wrong SDK.
- 40 bundled fragments.
foundationanddart/corealways, plus Dart SDK-minor fragments for 3.12 and 3.13;flutter/coreplus Flutter SDK-minor fragments for 3.44 and 3.47; andtesting,fvmandmeloswhen the project has tests, an FVM pin or a Melos workspace. Version-keyed package guidance for riverpod 2 and 3 (each with atestingfragment), bloc 7–9, go_router 14–18, freezed 2–4, dio 4 and 5, get_it 7–9 and injectable 2 and 3, plus unversioned json_serializable. Version directories exist only where the API actually diverged; every family also ships acorefragment that applies at any version. - Third-party fragments. A direct dependency shipping
guidelines/**/*.mdat its package root contributes to the composition, but only after explicit per-package opt-in via--trust=<package>, which is persisted soupdaterepeats it. Aguidelines/manifest.yamldeclaring aboost_facts_version:newer than this release implements is skipped with a warning. - Skills hand-off. After a successful install,
installandupdateoffer to runpackage:skillsfor the agent skills your dependencies ship —dart run skills getwhen it is a dependency of the project,skills getwhen it is onPATH. The remote form,dart run skills@ get, downloads from pub.flutter-io.cn and is reachable only behind an explicit--skills;--yesand CI accept the locally resolvable forms and nothing else.--no-skillsturns it off. Running it is remembered asdelegateSkillssoupdaterepeats it, and declining is remembered as a no. The hand-off never fails an install: absent, declined or non-zero is reported and nothing more. - Dependency and guidance drift.
dart_boost.jsonnow recordsdependencies(the direct dependency set, name to resolved version) andfragments(the keys the run composed), soupdateprints Dependencies since the last run — additions, removals, and only the upgrades that move a fragment key — followed by Guidance changes, the fragments that actually appeared or dropped out. Both keys are nullable: a state file written before they existed has no baseline, soupdatereports nothing rather than announcing every existing dependency as new. - CI-aware prompts. Prompts are skipped when nothing can answer them: no
TTY, or
CI,CONTINUOUS_INTEGRATION,BUILD_NUMBER,GITHUB_ACTIONS,GITLAB_CI,TF_BUILDorTEAMCITY_VERSIONset to anything butfalseor0, orTERM=dumb. A TTY alone is not enough — CI runners routinely allocate one — andCI=falseopts back in. Interactively,installnow lists the files it is about to touch and confirms once before writing; skipped under--yes,--dry-run, CI, andupdate. doctor,compose,installandupdate, plus--dry-run.- Asset guard.
tool/verify_assets.dartasserts every file underguidelines/appears indart pub publish's manifest, and both CI and the publish workflow gate on it.pub publishstrips dot-prefixed paths, so a stray ignore entry would ship an empty fragment tree while every local run still passed.
Fixed before release #
package_config.json'srootUriresolved one directory too high. Pub writes a relativerootUrifor the root package, every path dependency and every workspace member, and the base URI lacked the trailing separator that makes it a directory — so resolution climbed out of the project and third-partyguidelines/discovery was a silent no-op for exactly the packages most likely to ship one.installin a directory with nopubspec.yamlwrote its files and reported success. It now warns first.