Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ This project follows [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.

## [Unreleased]

### Changed

- **`telescope:install` now injects `import 'package:magic_devtools/telescope.dart';` and gates the Magic-stack wiring on the `magic_devtools` dependency** instead of the removed `package:magic/telescope_integration.dart`. Coordinated with the `magic_devtools` extraction that moved `MagicTelescopeIntegration` out of the magic core package. The injected `MagicTelescopeIntegration.install()` call and all other wiring are unchanged.

## [0.0.4] - 2026-06-17

### Changed

- **`fluttersdk_artisan` constraint bumped `^0.0.6` -> `^0.0.8`.** Required for co-installability with `fluttersdk_dusk` 0.0.7, which declares `fluttersdk_artisan: ^0.0.8`. Without this bump, a downstream package listing both `fluttersdk_dusk: ^0.0.7` and `fluttersdk_telescope` would fail pub dependency resolution. No public API change; constraint only.

## [0.0.3] - 2026-05-28

### Added
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,17 @@ packages:
dependency: transitive
description:
name: fluttersdk_artisan
sha256: "196e6fbd513036de002e70ac005d596f0837b91a70f09f64010fbad0b4b73122"
sha256: "008a29e38629ee1295a601fc9146d976ecf642b93e6dbe6750a9336ed4cac05c"
url: "https://pub.dev"
source: hosted
version: "0.0.6"
version: "0.0.8"
fluttersdk_telescope:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "0.0.3"
version: "0.0.4"
http_parser:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies:
cupertino_icons: ^1.0.8
fluttersdk_telescope:
path: ../
version: 0.0.3
version: 0.0.4
dio: ^5.7.0
logging: ^1.2.0

Expand Down
21 changes: 11 additions & 10 deletions lib/src/commands/telescope_install_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import 'package:fluttersdk_artisan/artisan.dart';
/// 3. Inject the runtime wiring into `lib/main.dart` via
/// [MainDartEditor]: imports plus the `kDebugMode`-gated
/// [TelescopePlugin.install] + [ExceptionWatcher] + [DumpWatcher]
/// block before `runApp(`. When the consumer's pubspec lists `magic`
/// block before `runApp(`. When the consumer's pubspec lists `magic_devtools`
/// as a dependency AND `lib/main.dart` contains an `await Magic.init(`
/// call, also injects `MagicTelescopeIntegration.install()` after it.
/// All steps idempotent; re-runs are no-ops.
Expand Down Expand Up @@ -133,7 +133,7 @@ class TelescopeInstallCommand extends ArtisanCommand {
/// the canonical install anchor: `await Magic.init(` on Magic-stack
/// apps (so ExceptionWatcher captures Magic boot errors), otherwise
/// `runApp(` for vanilla Flutter apps.
/// 3c. When pubspec has `magic:` AND main.dart has `await Magic.init(`,
/// 3c. When pubspec has `magic_devtools:` AND main.dart has `await Magic.init(`,
/// inject `MagicTelescopeIntegration.install()` after that call.
static void _injectRuntimeWiring(ArtisanContext ctx, String mainDartPath) {
ctx.output.info('Wiring TelescopePlugin into $mainDartPath...');
Expand Down Expand Up @@ -187,13 +187,13 @@ class TelescopeInstallCommand extends ArtisanCommand {
FileHelper.writeFile(mainDartPath, source);
}

// 3c. Magic-side coordinated wiring when the consumer pulls in magic.
// Detect via pubspec.yaml; skip silently when magic is not a dep or
// 3c. Magic-side coordinated wiring when the consumer pulls in magic_devtools.
// Detect via pubspec.yaml; skip silently when magic_devtools is not a dep or
// when main.dart has no Magic.init() anchor (vanilla Flutter app).
if (_hasMagicDep()) {
if (_hasMagicDevtoolsDep()) {
MainDartEditor.addImport(
mainDartPath,
"import 'package:magic/telescope_integration.dart';",
"import 'package:magic_devtools/telescope.dart';",
);
Comment on lines +193 to 197
try {
MainDartEditor.injectAfterMagicInit(
Expand All @@ -209,11 +209,12 @@ class TelescopeInstallCommand extends ArtisanCommand {
}
}

/// Returns true when the consumer's pubspec.yaml lists `magic:` as a
/// top-level dependency (2-space indent under `dependencies:`).
static bool _hasMagicDep() {
/// Returns true when the consumer's pubspec.yaml lists `magic_devtools:`
/// (the package that ships MagicTelescopeIntegration) as a dependency or
/// dev_dependency (2-space indent).
Comment on lines +212 to +214
static bool _hasMagicDevtoolsDep() {
final pubspec = File('pubspec.yaml');
if (!pubspec.existsSync()) return false;
return RegExp(r'\n magic:').hasMatch(pubspec.readAsStringSync());
return RegExp(r'\n magic_devtools:').hasMatch(pubspec.readAsStringSync());
}
}
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: fluttersdk_telescope
description: "Passive runtime inspector for Flutter. Captures HTTP, logs, exceptions, DB queries, and Magic events via VM Service extensions. CLI tail and MCP tools for Claude Code."
version: 0.0.3
version: 0.0.4
homepage: https://fluttersdk.com/telescope
repository: https://github.com/fluttersdk/telescope
issue_tracker: https://github.com/fluttersdk/telescope/issues
Expand All @@ -25,7 +25,7 @@ environment:
dependencies:
flutter:
sdk: flutter
fluttersdk_artisan: ^0.0.6
fluttersdk_artisan: ^0.0.8
logging: ^1.2.0
meta: ^1.16.0

Expand Down
25 changes: 13 additions & 12 deletions test/src/commands/telescope_install_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,15 @@ void main() {
});

// -------------------------------------------------------------------------
// Magic-stack branch: pubspec lists `magic:` + main.dart has
// `await Magic.init(` ; injected magic import must reference the new
// opt-in sub-barrel (`package:magic/telescope_integration.dart`), NOT the
// legacy main barrel (`package:magic/magic.dart`).
// Magic-stack branch: pubspec lists `magic_devtools:` + main.dart has
// `await Magic.init(` ; injected magic import must reference the
// magic_devtools telescope barrel (`package:magic_devtools/telescope.dart`),
// NOT the removed package:magic sub-barrel.
// -------------------------------------------------------------------------

test(
'magic-stack app: injects import for the telescope_integration sub-barrel '
'(not the legacy magic.dart main barrel) plus the integration install '
'magic-stack app: injects import for the magic_devtools telescope barrel '
'(not the removed package:magic sub-barrel) plus the integration install '
'call after Magic.init',
() async {
final tempDir =
Expand All @@ -208,7 +208,7 @@ void main() {

final mainDartPath = _seedProject(
tempDir,
pubspecDeps: const {'magic': 'any'},
pubspecDeps: const {'magic': 'any', 'magic_devtools': 'any'},
mainDartContents: '''
import 'package:flutter/material.dart';
import 'package:magic/magic.dart';
Expand Down Expand Up @@ -242,14 +242,15 @@ Future<void> main() async {

final result = File(mainDartPath).readAsStringSync();

// The magic-detect branch (L187 ; _hasMagicDep + Magic.init anchor)
// must inject the opt-in sub-barrel; never the legacy main barrel.
// The magic-detect branch (_hasMagicDevtoolsDep + Magic.init anchor)
// must inject the magic_devtools telescope barrel; never the removed
// package:magic sub-barrel.
expect(
result.contains("import 'package:magic/telescope_integration.dart';"),
result.contains("import 'package:magic_devtools/telescope.dart';"),
isTrue,
reason:
'magic-stack inject must reference the new telescope_integration '
'sub-barrel, not the legacy magic.dart main barrel',
'magic-stack inject must reference the magic_devtools telescope '
'barrel, not the removed package:magic sub-barrel',
);

// Parity check: the integration install call still lands after
Expand Down