Migrating to v2.0
Pin and run Hyena in each project
Section titled “Pin and run Hyena in each project”v2 removes support for global command mappings. Add Hyena as a development dependency of every project that runs it:
dart pub add dev:hyena_dartflutter pub add dev:hyena_dartReplace direct CLI invocations with the project-local entry point:
dart run hyena_dart analyze .dart run hyena_dart dead-code libdart run hyena_dart complexity libThis resolves the dependency version selected by the project’s lockfile. Update scripts, CI jobs, editor tasks, and shell aliases that previously depended on a global executable.
For MCP, run the package entry point from the project:
dart run hyena_dart:hyena_mcp \ --root .If the client starts outside the project, set the spawned process’s working directory explicitly:
{ "command": "dart", "cwd": "/absolute/path/to/project", "args": [ "run", "hyena_dart:hyena_mcp", "--root", "." ]}cwd selects the project whose lockfile resolves Hyena. --root . then confines accepted analysis targets and automatic configuration discovery to that project. Dart 3.10 does not accept a top-level -C option; use the MCP client’s equivalent working-directory setting if it names the field differently. See Safe AI and MCP for the complete example.
Review the larger default finding set
Section titled “Review the larger default finding set”hyena.dead_code.ignore_exports changes from true to false. v2 therefore reports unused public declarations as well as unused private declarations by default.
Application projects should review the additional findings rather than hiding them broadly. Reusable package authors whose exported public API is intentionally consumed outside the scanned project can preserve that API as reachability roots:
hyena: dead_code: ignore_exports: trueThe equivalent one-run override is available on both combined and dead-code-only analysis:
dart run hyena_dart analyze . \ --ignore-exportsdart run hyena_dart dead-code . \ --ignore-exportsBoth commands also accept --ignore-private when convention- or tool-driven private declarations should be retained.
Update report-path consumers
Section titled “Update report-path consumers”Console, JSON, Markdown, and HTML now render every source and target path relative to the analyzed project root, or relative to the common workspace root for a Dart workspace.
Examples:
dart run hyena_dart analyze libreportslib/src/cache.dart, not a path relative toliband not an absolute machine path;- a single-file target reports
lib/src/cache.dart; and - a workspace member reports
packages/cache/lib/src/cache.dart.
For JSON integrations, update assumptions around targetPath and every filePath. These values are now portable project- or workspace-relative strings. Console parsers and checked-in Markdown or HTML snapshots may also change even when the findings do not.
Migration checklist
Section titled “Migration checklist”- Add Hyena to each project’s
dev_dependenciesand resolve dependencies. - Replace global command mappings in local scripts, CI, editors, and MCP configuration with the project-local commands above.
- Run dead-code analysis and review newly reported public declarations.
- Enable
ignore_exportsonly for a deliberately preserved reusable public API. - Update consumers and golden files for relative console, JSON, Markdown, and HTML paths.
- Keep the existing baseline unless the reviewed finding set itself changes.
