Skip to content

docs: add the CLAUDE.md this package never had - #15

Merged
anilcancakir merged 1 commit into
masterfrom
docs/add-claude-md
Aug 25, 2026
Merged

docs: add the CLAUDE.md this package never had#15
anilcancakir merged 1 commit into
masterfrom
docs/add-claude-md

Conversation

@anilcancakir

Copy link
Copy Markdown
Contributor

What

A root CLAUDE.md for magic_devtools. Documentation only, no source touched.

Covers what this package is for and why it is a package at all, the stack, the commands and CI gates, the four-barrel split, the two-phase install contract, the enricher and watcher contracts, the preview catalog's release boundary, the golden rules, branching, and style.

Why

magic_devtools is the only package in the ecosystem with no project instructions at all, while magic's own CLAUDE.md points at it by name ("the dev-tooling adapters live in the sibling magic_devtools package"). Anybody sent here arrived with nothing but the README.

The parts worth writing down are the ones a reader gets wrong unaided:

  • Why the package exists. magic core keeps zero dependency on dusk and telescope so a production app does not resolve an E2E driver and a runtime inspector. That is the reason for the whole shape, and it is invisible from inside the code.
  • Why the kDebugMode guard sits at the consumer call site. Moving it inward defeats the release tree-shake, which is the single failure this arrangement prevents.
  • Why the two-phase install cannot collapse into one call, plus the rule for deciding which half new wiring belongs to (does it resolve through the container, or does it have to observe Magic booting). That is the question the next change here will actually ask.

Testing

Every number and claim was read out of the source, not carried over from a sibling repo's file:

  • barrel list and purposes from the four library docblocks
  • 14 enrichers and 5 watchers plus MagicHttpFacadeAdapter counted from the install bodies
  • CI gates from .github/workflows/ci.yml
  • SDK floors from pubspec.yaml
  • the preview release boundary (kReleaseMode early return, PREVIEW_ENABLED dart-define, addRoute throwing StateError once the router is built) from preview_routes.dart

Not included

No .claude/rules/ directory. Five source files do not carry a directory-spanning invariant that a root spec cannot hold, and the ecosystem convention is that a rule arrives with the subsystem it governs rather than ahead of it.

This branch is cut from master, so it describes master. The performance data path in #14 is not covered; that PR adds MagicPerfIntegration and a section for it follows once #14 lands.

magic_devtools is the only package in the ecosystem with no project
instructions at all, while magic's own CLAUDE.md points at it by name ("the
dev-tooling adapters live in the sibling magic_devtools package"). Anybody
sent here arrived with nothing to read but the README.

Written from the source rather than from the sibling files: barrel list and
their purposes from the four library docblocks, 14 enrichers and 5 watchers
counted from the install bodies, CI gates from ci.yml, SDK floors from
pubspec.yaml, the preview release boundary from preview_routes.dart.

The load-bearing parts are the ones a reader gets wrong on their own: why the
package exists at all (magic core keeps zero dependency on dusk and telescope,
so a production app does not resolve an E2E driver), why the kDebugMode guard
lives at the consumer call site and must never move inward, and why the
two-phase install cannot be collapsed into one call. The rule for deciding
which half new wiring belongs to is stated, because that is the question the
next change here will actually ask.

No .claude/rules/ yet. Five source files do not have a directory-spanning
invariant that a root spec cannot hold, and a rule arrives with the subsystem
it governs rather than ahead of it.
@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kodizm

kodizm Bot commented Aug 25, 2026

Copy link
Copy Markdown

Note

Kodizm (AI-generated). May contain mistakes; verify before acting.

Docs-only, and the load-bearing numbers check out (14 enrichers, 5 watchers, four barrels, both SDK floors, all three CI gates), but four claims do not match the source they describe, and a rule file that misnames an API is worse than no rule file.

Major

CLAUDE.md:82MagicDuskIntegration.uninstall() does not exist. The teardown is resetForTesting(), annotated @visibleForTesting (lib/src/dusk_integration.dart:147); grep -n "uninstall" lib/src/dusk_integration.dart returns nothing. The invariant the sentence carries is right and worth keeping, so it just needs the real name, otherwise the next contributor adding an enricher looks for a public teardown that was never there. (correctness)

CLAUDE.md:32 — "Importing [fluttersdk_wind] directly is flagged as an unnecessary import" is not true as a blanket rule. lib/src/preview/magic_preview.dart:2 imports package:fluttersdk_wind/fluttersdk_wind.dart directly and flutter analyze --no-fatal-infos reports "No issues found!". unnecessary_import only fires when the same symbols are already reachable through another import in that file, which is not the case there because magic_preview.dart imports neither magic nor anything else exporting wind. As written this instruction points at deleting a load-bearing import.

Minor

CLAUDE.md:74 — "Anything that registers with a subsystem which locks its table on first read (the router does), is pre" is the only worked example given for the pre half, and it is post in the actual code. The MagicRouter navigate adapter is registered inside MagicDuskIntegration.install() (lib/src/dusk_integration.dart:135), which installPost calls, and the preview routes register in the consumer's RouteServiceProvider.boot(), not in installPre at all. Nothing in installPre touches the router table.

CLAUDE.md:123 — "No em-dash or en-dash anywhere" is stated absolutely, and the repo at this head does not satisfy it: 25 in lib/src/dusk_integration.dart, 20 in test/dusk_integration_test.dart, 4 in lib/src/preview/preview_routes.dart, 1 in lib/preview.dart. Either scope the rule to new and changed content, or say the extracted-from-magic files are a known exception, so a future reader does not read it as licence to reformat those docblocks.

CLAUDE.md:94 — "guarded by kReleaseMode plus bool.fromEnvironment('PREVIEW_ENABLED')" omits that kPreviewEnabled has defaultValue: kDebugMode (lib/src/preview/preview_routes.dart:16). It reads as though a debug build needs the dart-define to see /preview; it does not, and the define exists to opt profile in or force debug off.

Tests

None, and none is right: this adds no source. Correctly no ## [Unreleased] bullet either, since golden rule 3 scopes that to behavioural and interface changes.

Checks I ran

  • flutter pub get then flutter analyze --no-fatal-infos: "No issues found! (ran in 15.1s)".
  • dart format --set-exit-if-changed .: "Formatted 14 files (0 changed)", exit 0.
  • flutter test --coverage: "+99: All tests passed!".
  • Counted DuskPlugin.enrichers.add in dusk_integration.dart (14) and TelescopePlugin.registerWatcher in telescope_integration.dart (5, plus registerHttpAdapter(MagicHttpFacadeAdapter())); confirmed the _installed idempotency guards, both SDK floors in pubspec.yaml, all three gates in .github/workflows/ci.yml, pubspec_overrides.yaml at .gitignore:30, and that .claude/rules/ does not exist.

@anilcancakir
anilcancakir merged commit 98a2c87 into master Aug 25, 2026
3 checks passed
@anilcancakir
anilcancakir deleted the docs/add-claude-md branch August 25, 2026 20:12
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.

1 participant