Raise the declared minimums in pubspec.yaml to what our deps already require: Flutter >=3.35.0 / Dart >=3.9.0 (was 3.19.0 / 3.5.0). alchemist 0.12 needs Flutter 3.32; Dart 3.9 first ships in Flutter 3.35, so 3.35 is the binding floor. Pin the exact build toolchain in .fvmrc (Flutter 3.44.1). Moving to the Dart 3.9 language level switches `dart format` to the new "tall" style and enables two new lints. This commit is the resulting mechanical churn, isolated from any behaviour change: - whole-tree `dart format` reformat (tall style) - `dart fix` for unnecessary_underscores + use_null_aware_elements No runtime behaviour change; `make test` green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
84 lines
3.1 KiB
Dart
84 lines
3.1 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:clide/clide.dart';
|
|
import 'package:clide/extension/extension.dart';
|
|
import 'package:clide/kernel/src/cli_install.dart';
|
|
|
|
/// VS Code-style "Install 'clide' command in PATH" affordance (T-212).
|
|
///
|
|
/// Registers a palette/CLI command that copies the bundled C client into a
|
|
/// PATH dir, and on activation proactively warns when `clide` is missing from
|
|
/// PATH or — the dogfood footgun — resolves to a stale symlink into the
|
|
/// Flutter GUI bundle instead of the C client. Detection and the copy live in
|
|
/// the Flutter-free [CliInstaller]; this extension only wires it to the
|
|
/// command and notification surfaces.
|
|
class CliInstallExtension extends ClideExtension {
|
|
CliInstallExtension({CliInstaller? installer}) : _installer = installer;
|
|
|
|
CliInstaller? _installer;
|
|
ClideExtensionContext? _ctx;
|
|
|
|
CliInstaller get _resolved => _installer ??= CliInstaller(resolvedExecutable: Platform.resolvedExecutable);
|
|
|
|
@override
|
|
String get id => 'builtin.cli-install';
|
|
@override
|
|
String get title => 'CLI Install';
|
|
@override
|
|
String get version => '0.1.0';
|
|
|
|
@override
|
|
Future<void> activate(ClideExtensionContext ctx) async {
|
|
_ctx = ctx;
|
|
// Proactive launch-time detection (desktop only). Non-modal: we notify
|
|
// and point at the command rather than auto-installing — no surprise
|
|
// filesystem writes (interaction-zone discipline, D-78).
|
|
if (!(Platform.isLinux || Platform.isMacOS)) return;
|
|
switch (_resolved.inspect().state) {
|
|
case CliInstallState.missing:
|
|
ctx.notify.warn(
|
|
'The `clide` command is not on your PATH. Run "clide: Install '
|
|
'command in PATH" from the command palette to reach it from a shell.',
|
|
title: 'clide CLI not installed',
|
|
);
|
|
case CliInstallState.staleGui:
|
|
ctx.notify.warn(
|
|
'`clide` on your PATH points at the GUI app, not the CLI client — '
|
|
'a bare `clide` launches a second app. Run "clide: Install command '
|
|
'in PATH" to replace it.',
|
|
title: 'clide CLI is stale',
|
|
);
|
|
case CliInstallState.devTree:
|
|
ctx.notify.info(
|
|
'`clide` on your PATH is the dev-tree build, not a packaged install '
|
|
'— fine for development; rebuild it with `make clide-cli`.',
|
|
title: 'clide CLI: dev build',
|
|
);
|
|
case CliInstallState.installed:
|
|
break;
|
|
}
|
|
}
|
|
|
|
@override
|
|
List<ContributionPoint> get contributions => [
|
|
CommandContribution(
|
|
id: 'clide.installCli',
|
|
command: 'clide.installCli',
|
|
title: "clide: Install 'clide' command in PATH",
|
|
run: (_) async {
|
|
final r = _resolved.install();
|
|
final ctx = _ctx;
|
|
if (r.ok) {
|
|
ctx?.notify.success(r.message, title: 'clide CLI installed');
|
|
return IpcResponse.ok(id: '', data: {'installed': r.installedPath, 'onPath': r.onPath});
|
|
}
|
|
ctx?.notify.error(r.message, title: 'clide CLI install failed');
|
|
return IpcResponse.err(
|
|
id: '',
|
|
error: IpcError(code: IpcExitCode.toolError, kind: IpcErrorKind.toolError, message: r.message),
|
|
);
|
|
},
|
|
),
|
|
];
|
|
}
|