Files
clide/test/cli/clide_version_test.dart
T
jpmschweitzerandClaude Opus 4.8 4ac52664ea ship the clide CLI on PATH (Epic A)
`make build`/`make install` now compile the C `clide` client by default
(clide-cli is a prereq of both), and `make install` places that binary at
$(INSTALL_DIR)/clide on Linux and macOS instead of symlinking the Flutter
GUI runner. The GUI still launches via its desktop entry / clide.app.
macOS install now delivers the CLI too; macOS uninstall removes it.

Adds a regression test asserting clideVersion (build_info.g.dart) stays
equal to pubspec.yaml version, so an agent keying off `clide version` is
never misled.

Closes T-210, T-211, T-213 (under T-209 / T-208 "Give Claude hands").

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 11:01:13 +02:00

36 lines
1.2 KiB
Dart

/// Regression guard for the `clide version` contract (T-213).
///
/// `clideVersion` (lib/src/build_info.g.dart, baked by gen-build-info)
/// is what the dispatcher returns for `ping`/`version` and what the C
/// client surfaces. An agent keys off `clide version`; if it ever drifts
/// from pubspec.yaml `version:` — the single source of truth — that agent
/// is misled. This test fails the moment the two diverge.
library;
import 'dart:io';
import 'package:clide/clide.dart' show clideVersion;
import 'package:test/test.dart';
/// First `version:` entry in pubspec.yaml — mirrors the Makefile awk
/// (`/^version:/ {gsub(/[" ]/,"",$2); print $2}`).
String _pubspecVersion() {
final lines = File('pubspec.yaml').readAsLinesSync();
for (final line in lines) {
if (line.startsWith('version:')) {
return line.substring('version:'.length).replaceAll('"', '').trim();
}
}
fail('no `version:` line in pubspec.yaml');
}
void main() {
test('clideVersion matches pubspec.yaml version (T-213)', () {
expect(
clideVersion,
_pubspecVersion(),
reason: 'build_info.g.dart drifted from pubspec.yaml — run `make gen-build-info`',
);
});
}